-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use instance of LockService instantiated in JobScheduler through Guice (
#677) * WIP to show Geospatial plugin using LockService instance from JS Signed-off-by: Craig Perkins <[email protected]> * Use instance of LockService from Guice that is instantiated by Job Scheduler Signed-off-by: Craig Perkins <[email protected]> * Fix failing tests Signed-off-by: Craig Perkins <[email protected]> * Add to CHANGELOG Signed-off-by: Craig Perkins <[email protected]> * Address comments Signed-off-by: Craig Perkins <[email protected]> * Add checks to see if initialized Signed-off-by: Craig Perkins <[email protected]> * Remove constructor that accepts client Signed-off-by: Craig Perkins <[email protected]> * Switch to package-private Signed-off-by: Craig Perkins <[email protected]> * package-private Signed-off-by: Craig Perkins <[email protected]> * public Signed-off-by: Craig Perkins <[email protected]> --------- Signed-off-by: Craig Perkins <[email protected]> (cherry picked from commit 847be33)
- Loading branch information
1 parent
a452b88
commit 013554e
Showing
7 changed files
with
126 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/test/java/org/opensearch/geospatial/TestGeospatialPlugin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.geospatial; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collection; | ||
import java.util.List; | ||
|
||
import org.opensearch.common.lifecycle.LifecycleComponent; | ||
import org.opensearch.geospatial.ip2geo.listener.Ip2GeoListener; | ||
import org.opensearch.geospatial.plugin.GeospatialPlugin; | ||
|
||
/** | ||
* This class is needed for ClusterSettingsHelper.createMockNode to instantiate a test instance of the | ||
* GeospatialPlugin without the JobSchedulerPlugin installed. Without overriding this class, the | ||
* GeospatialPlugin would try to Inject JobScheduler's LockService in the GuiceHolder which will | ||
* fail because JobScheduler is not installed | ||
*/ | ||
public class TestGeospatialPlugin extends GeospatialPlugin { | ||
@Override | ||
public Collection<Class<? extends LifecycleComponent>> getGuiceServiceClasses() { | ||
final List<Class<? extends LifecycleComponent>> services = new ArrayList<>(1); | ||
services.add(Ip2GeoListener.class); | ||
return services; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters