Skip to content

Commit

Permalink
Update constructor usage on ExtensionManager
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Nied <petern@amazon.com>
  • Loading branch information
peternied committed May 2, 2023
1 parent ef079d8 commit d087609
Showing 1 changed file with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ public void tearDown() throws Exception {
public void testDiscover() throws Exception {
Files.write(extensionDir.resolve("extensions.yml"), extensionsYmlLines, StandardCharsets.UTF_8);

ExtensionsManager extensionsManager = new ExtensionsManager(settings, extensionDir);
ExtensionsManager extensionsManager = new ExtensionsManager(extensionDir);

List<DiscoveryExtensionNode> expectedExtensions = new ArrayList<DiscoveryExtensionNode>();

Expand Down Expand Up @@ -253,7 +253,7 @@ public void testNonUniqueExtensionsDiscovery() throws Exception {
.collect(Collectors.toList());
Files.write(emptyExtensionDir.resolve("extensions.yml"), nonUniqueYmlLines, StandardCharsets.UTF_8);

ExtensionsManager extensionsManager = new ExtensionsManager(settings, emptyExtensionDir);
ExtensionsManager extensionsManager = new ExtensionsManager(emptyExtensionDir);

List<DiscoveryExtensionNode> expectedExtensions = new ArrayList<DiscoveryExtensionNode>();

Expand Down Expand Up @@ -302,7 +302,7 @@ public void testMissingRequiredFieldsInExtensionDiscovery() throws Exception {
)
);

extensionsManager = new ExtensionsManager(settings, emptyExtensionDir);
extensionsManager = new ExtensionsManager(emptyExtensionDir);

mockLogAppender.assertAllExpectationsMatched();
}
Expand Down Expand Up @@ -387,7 +387,7 @@ public void testNonAccessibleDirectory() throws Exception {
AccessControlException e = expectThrows(

AccessControlException.class,
() -> new ExtensionsManager(settings, PathUtils.get(""))
() -> new ExtensionsManager(PathUtils.get(""))
);
assertEquals("access denied (\"java.io.FilePermission\" \"\" \"read\")", e.getMessage());
}
Expand All @@ -406,7 +406,7 @@ public void testNoExtensionsFile() throws Exception {
)
);

new ExtensionsManager(settings, extensionDir);
new ExtensionsManager(extensionDir);

mockLogAppender.assertAllExpectationsMatched();
}
Expand All @@ -420,12 +420,12 @@ public void testEmptyExtensionsFile() throws Exception {

Settings settings = Settings.builder().build();

expectThrows(IOException.class, () -> new ExtensionsManager(settings, emptyExtensionDir));
expectThrows(IOException.class, () -> new ExtensionsManager( emptyExtensionDir));
}

public void testInitialize() throws Exception {
Files.write(extensionDir.resolve("extensions.yml"), extensionsYmlLines, StandardCharsets.UTF_8);
ExtensionsManager extensionsManager = new ExtensionsManager(settings, extensionDir);
ExtensionsManager extensionsManager = new ExtensionsManager(extensionDir);

initialize(extensionsManager);

Expand Down Expand Up @@ -468,7 +468,7 @@ public void testInitialize() throws Exception {
public void testHandleRegisterRestActionsRequest() throws Exception {
Files.write(extensionDir.resolve("extensions.yml"), extensionsYmlLines, StandardCharsets.UTF_8);

ExtensionsManager extensionsManager = new ExtensionsManager(settings, extensionDir);
ExtensionsManager extensionsManager = new ExtensionsManager(extensionDir);
initialize(extensionsManager);

String uniqueIdStr = "uniqueid1";
Expand All @@ -483,7 +483,7 @@ public void testHandleRegisterRestActionsRequest() throws Exception {

public void testHandleRegisterSettingsRequest() throws Exception {
Files.write(extensionDir.resolve("extensions.yml"), extensionsYmlLines, StandardCharsets.UTF_8);
ExtensionsManager extensionsManager = new ExtensionsManager(settings, extensionDir);
ExtensionsManager extensionsManager = new ExtensionsManager(extensionDir);
initialize(extensionsManager);

String uniqueIdStr = "uniqueid1";
Expand All @@ -499,7 +499,7 @@ public void testHandleRegisterSettingsRequest() throws Exception {
}

public void testHandleRegisterRestActionsRequestWithInvalidMethod() throws Exception {
ExtensionsManager extensionsManager = new ExtensionsManager(settings, extensionDir);
ExtensionsManager extensionsManager = new ExtensionsManager(extensionDir);
initialize(extensionsManager);

String uniqueIdStr = "uniqueid1";
Expand All @@ -513,7 +513,7 @@ public void testHandleRegisterRestActionsRequestWithInvalidMethod() throws Excep
}

public void testHandleRegisterRestActionsRequestWithInvalidDeprecatedMethod() throws Exception {
ExtensionsManager extensionsManager = new ExtensionsManager(settings, extensionDir);
ExtensionsManager extensionsManager = new ExtensionsManager(extensionDir);
initialize(extensionsManager);

String uniqueIdStr = "uniqueid1";
Expand All @@ -527,7 +527,7 @@ public void testHandleRegisterRestActionsRequestWithInvalidDeprecatedMethod() th
}

public void testHandleRegisterRestActionsRequestWithInvalidUri() throws Exception {
ExtensionsManager extensionsManager = new ExtensionsManager(settings, extensionDir);
ExtensionsManager extensionsManager = new ExtensionsManager(extensionDir);
initialize(extensionsManager);
String uniqueIdStr = "uniqueid1";
List<String> actionsList = List.of("GET", "PUT /bar", "POST /baz");
Expand All @@ -540,7 +540,7 @@ public void testHandleRegisterRestActionsRequestWithInvalidUri() throws Exceptio
}

public void testHandleRegisterRestActionsRequestWithInvalidDeprecatedUri() throws Exception {
ExtensionsManager extensionsManager = new ExtensionsManager(settings, extensionDir);
ExtensionsManager extensionsManager = new ExtensionsManager(extensionDir);
initialize(extensionsManager);
String uniqueIdStr = "uniqueid1";
List<String> actionsList = List.of("GET /foo", "PUT /bar", "POST /baz");
Expand All @@ -553,7 +553,7 @@ public void testHandleRegisterRestActionsRequestWithInvalidDeprecatedUri() throw
}

public void testHandleExtensionRequest() throws Exception {
ExtensionsManager extensionsManager = new ExtensionsManager(settings, extensionDir);
ExtensionsManager extensionsManager = new ExtensionsManager(extensionDir);
initialize(extensionsManager);

ExtensionRequest clusterStateRequest = new ExtensionRequest(ExtensionRequestProto.RequestType.REQUEST_EXTENSION_CLUSTER_STATE);
Expand Down Expand Up @@ -709,7 +709,7 @@ public void testEnvironmentSettingsDefaultValue() throws Exception {
public void testAddSettingsUpdateConsumerRequest() throws Exception {
Path extensionDir = createTempDir();
Files.write(extensionDir.resolve("extensions.yml"), extensionsYmlLines, StandardCharsets.UTF_8);
ExtensionsManager extensionsManager = new ExtensionsManager(settings, extensionDir);
ExtensionsManager extensionsManager = new ExtensionsManager(extensionDir);
initialize(extensionsManager);

List<Setting<?>> componentSettings = List.of(
Expand Down Expand Up @@ -756,7 +756,7 @@ public void testHandleAddSettingsUpdateConsumerRequest() throws Exception {

Path extensionDir = createTempDir();
Files.write(extensionDir.resolve("extensions.yml"), extensionsYmlLines, StandardCharsets.UTF_8);
ExtensionsManager extensionsManager = new ExtensionsManager(settings, extensionDir);
ExtensionsManager extensionsManager = new ExtensionsManager(extensionDir);
initialize(extensionsManager);

List<Setting<?>> componentSettings = List.of(
Expand All @@ -778,7 +778,7 @@ public void testHandleAddSettingsUpdateConsumerRequest() throws Exception {
public void testUpdateSettingsRequest() throws Exception {
Path extensionDir = createTempDir();
Files.write(extensionDir.resolve("extensions.yml"), extensionsYmlLines, StandardCharsets.UTF_8);
ExtensionsManager extensionsManager = new ExtensionsManager(settings, extensionDir);
ExtensionsManager extensionsManager = new ExtensionsManager(extensionDir);
initialize(extensionsManager);

Setting<?> componentSetting = Setting.boolSetting("falseSetting", false, Property.Dynamic);
Expand Down Expand Up @@ -807,7 +807,7 @@ public void testUpdateSettingsRequest() throws Exception {

public void testRegisterHandler() throws Exception {

ExtensionsManager extensionsManager = new ExtensionsManager(settings, extensionDir);
ExtensionsManager extensionsManager = new ExtensionsManager(extensionDir);

TransportService mockTransportService = spy(
new TransportService(
Expand All @@ -834,7 +834,7 @@ public void testRegisterHandler() throws Exception {

public void testOnIndexModule() throws Exception {
Files.write(extensionDir.resolve("extensions.yml"), extensionsYmlLines, StandardCharsets.UTF_8);
ExtensionsManager extensionsManager = new ExtensionsManager(settings, extensionDir);
ExtensionsManager extensionsManager = new ExtensionsManager(extensionDir);
initialize(extensionsManager);

Environment environment = TestEnvironment.newEnvironment(settings);
Expand Down Expand Up @@ -891,7 +891,7 @@ public void testIncompatibleExtensionRegistration() throws IOException, IllegalA
);

Files.write(extensionDir.resolve("extensions.yml"), incompatibleExtension, StandardCharsets.UTF_8);
ExtensionsManager extensionsManager = new ExtensionsManager(settings, extensionDir);
ExtensionsManager extensionsManager = new ExtensionsManager(extensionDir);
assertEquals(0, extensionsManager.getExtensionIdMap().values().size());
mockLogAppender.assertAllExpectationsMatched();
}
Expand Down

0 comments on commit d087609

Please sign in to comment.