diff --git a/commands/src/main/java/org/wildfly/extras/creaper/commands/elytron/providerloader/AddAggregateProviders.java b/commands/src/main/java/org/wildfly/extras/creaper/commands/elytron/providerloader/AddAggregateProviders.java new file mode 100644 index 00000000..506b9823 --- /dev/null +++ b/commands/src/main/java/org/wildfly/extras/creaper/commands/elytron/providerloader/AddAggregateProviders.java @@ -0,0 +1,76 @@ +package org.wildfly.extras.creaper.commands.elytron.providerloader; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import org.wildfly.extras.creaper.core.online.OnlineCommand; +import org.wildfly.extras.creaper.core.online.OnlineCommandContext; +import org.wildfly.extras.creaper.core.online.operations.Address; +import org.wildfly.extras.creaper.core.online.operations.Operations; +import org.wildfly.extras.creaper.core.online.operations.Values; +import org.wildfly.extras.creaper.core.online.operations.admin.Administration; + +public class AddAggregateProviders implements OnlineCommand { + + private final String name; + private final List providers; + private final boolean replaceExisting; + + private AddAggregateProviders(Builder builder) { + this.name = builder.name; + this.providers = builder.providers; + this.replaceExisting = builder.replaceExisting; + } + + @Override + public void apply(OnlineCommandContext ctx) throws Exception { + Operations ops = new Operations(ctx.client); + Address aggregatepProvidersAddress = Address.subsystem("elytron").and("aggregate-providers", name); + if (replaceExisting) { + ops.removeIfExists(aggregatepProvidersAddress); + new Administration(ctx.client).reloadIfRequired(); + } + + ops.add(aggregatepProvidersAddress, Values.empty() + .andList(String.class, "providers", providers)); + } + + public static final class Builder { + + private final String name; + private final List providers = new ArrayList(); + private boolean replaceExisting; + + public Builder(String name) { + if (name == null) { + throw new IllegalArgumentException("Name of the aggregate-providers must be specified as non null value"); + } + if (name.isEmpty()) { + throw new IllegalArgumentException("Name of the aggregate-providers must not be empty value"); + } + + this.name = name; + } + + public Builder providers(String... providers) { + if (providers == null) { + throw new IllegalArgumentException("Providers added to aggregate-providers must not be null"); + } + Collections.addAll(this.providers, providers); + return this; + } + + public Builder replaceExisting() { + this.replaceExisting = true; + return this; + } + + public AddAggregateProviders build() { + if (providers.size() < 2) { + throw new IllegalArgumentException("There must be at least two providers"); + } + return new AddAggregateProviders(this); + } + } + +} diff --git a/commands/src/main/java/org/wildfly/extras/creaper/commands/elytron/providerloader/AddProviderLoader.java b/commands/src/main/java/org/wildfly/extras/creaper/commands/elytron/providerloader/AddProviderLoader.java new file mode 100644 index 00000000..639440e4 --- /dev/null +++ b/commands/src/main/java/org/wildfly/extras/creaper/commands/elytron/providerloader/AddProviderLoader.java @@ -0,0 +1,124 @@ +package org.wildfly.extras.creaper.commands.elytron.providerloader; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.wildfly.extras.creaper.core.online.OnlineCommand; +import org.wildfly.extras.creaper.core.online.OnlineCommandContext; +import org.wildfly.extras.creaper.core.online.operations.Address; +import org.wildfly.extras.creaper.core.online.operations.Operations; +import org.wildfly.extras.creaper.core.online.operations.Values; +import org.wildfly.extras.creaper.core.online.operations.admin.Administration; + +public class AddProviderLoader implements OnlineCommand { + + private final String name; + private final List classNames; + private final Map configuration; + private final String module; + private final String path; + private final String relativeTo; + private final boolean replaceExisting; + + private AddProviderLoader(Builder builder) { + this.name = builder.name; + this.classNames = builder.classNames; + this.configuration = builder.configuration; + this.module = builder.module; + this.path = builder.path; + this.relativeTo = builder.relativeTo; + this.replaceExisting = builder.replaceExisting; + } + + @Override + public void apply(OnlineCommandContext ctx) throws Exception { + Operations ops = new Operations(ctx.client); + Address providerLoaderAddress = Address.subsystem("elytron").and("provider-loader", name); + if (replaceExisting) { + ops.removeIfExists(providerLoaderAddress); + new Administration(ctx.client).reloadIfRequired(); + } + + ops.add(providerLoaderAddress, Values.empty() + .andListOptional(String.class, "class-names", classNames) + .andObjectOptional("configuration", Values.fromMap(configuration)) + .andOptional("module", module) + .andOptional("path", path) + .andOptional("relative-to", relativeTo)); + } + + public static final class Builder { + + private final String name; + private List classNames; + private Map configuration = new HashMap(); + private String module; + private String path; + private String relativeTo; + private boolean replaceExisting; + + public Builder(String name) { + if (name == null) { + throw new IllegalArgumentException("Name of the provider-loader must be specified as non null value"); + } + if (name.isEmpty()) { + throw new IllegalArgumentException("Name of the provider-loader must not be empty value"); + } + this.name = name; + } + + public Builder classNames(String... classNames) { + if (classNames == null) { + throw new IllegalArgumentException("Class-names added to provider-loader must not be null"); + } + if (this.classNames == null) { + this.classNames = new ArrayList(); + } + + Collections.addAll(this.classNames, classNames); + return this; + } + + public Builder addConfiguration(String name, String value) { + if (name == null || name.isEmpty()) { + throw new IllegalArgumentException("Name of the configuration of the provider-loader must not be null"); + } + if (value == null || value.isEmpty()) { + throw new IllegalArgumentException("Value of the configuration of the provider-loader must not be null"); + } + configuration.put(name, value); + return this; + } + + public Builder module(String module) { + this.module = module; + return this; + } + + public Builder path(String path) { + this.path = path; + return this; + } + + public Builder relativeTo(String relativeTo) { + this.relativeTo = relativeTo; + return this; + } + + public Builder replaceExisting() { + this.replaceExisting = true; + return this; + } + + public AddProviderLoader build() { + if (configuration != null && !configuration.isEmpty() && path != null && !path.isEmpty()) { + throw new IllegalArgumentException("Provider-loader must not have configured both path and configuration"); + } + + return new AddProviderLoader(this); + } + } + +} diff --git a/testsuite/standalone/src/test/java/org/wildfly/extras/creaper/commands/elytron/providerloader/AddAggregateProvidersOnlineTest.java b/testsuite/standalone/src/test/java/org/wildfly/extras/creaper/commands/elytron/providerloader/AddAggregateProvidersOnlineTest.java new file mode 100644 index 00000000..b1505041 --- /dev/null +++ b/testsuite/standalone/src/test/java/org/wildfly/extras/creaper/commands/elytron/providerloader/AddAggregateProvidersOnlineTest.java @@ -0,0 +1,177 @@ +package org.wildfly.extras.creaper.commands.elytron.providerloader; + +import org.jboss.arquillian.junit.Arquillian; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.wildfly.extras.creaper.commands.elytron.AbstractElytronOnlineTest; +import org.wildfly.extras.creaper.core.CommandFailedException; +import org.wildfly.extras.creaper.core.online.operations.Address; + +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +@RunWith(Arquillian.class) +public class AddAggregateProvidersOnlineTest extends AbstractElytronOnlineTest { + + private static final String TEST_AGGREGATE_PROVIDERS_NAME = "CreaperTestAggregateProviders"; + private static final Address TEST_AGGREGATE_PROVIDERS_ADDRESS = SUBSYSTEM_ADDRESS + .and("aggregate-providers", TEST_AGGREGATE_PROVIDERS_NAME); + private static final String TEST_AGGREGATE_PROVIDERS_NAME2 = "CreaperTestAggregateProviders2"; + private static final Address TEST_AGGREGATE_PROVIDERS_ADDRESS2 = SUBSYSTEM_ADDRESS + .and("aggregate-providers", TEST_AGGREGATE_PROVIDERS_NAME2); + + protected static final String TEST_PROVIDER_LOADER_NAME = "CreaperTestProviderLoader"; + protected static final Address TEST_PROVIDER_LOADER_ADDRESS = SUBSYSTEM_ADDRESS + .and("provider-loader", TEST_PROVIDER_LOADER_NAME); + protected static final String TEST_PROVIDER_LOADER_NAME2 = "CreaperTestProviderLoader2"; + protected static final Address TEST_PROVIDER_LOADER_ADDRESS2 = SUBSYSTEM_ADDRESS + .and("provider-loader", TEST_PROVIDER_LOADER_NAME2); + + @Before + public void createProviderLoaders() throws Exception { + AddProviderLoader addProviderLoader = new AddProviderLoader.Builder(TEST_PROVIDER_LOADER_NAME) + .build(); + AddProviderLoader addProviderLoader2 = new AddProviderLoader.Builder(TEST_PROVIDER_LOADER_NAME2) + .build(); + client.apply(addProviderLoader); + client.apply(addProviderLoader2); + } + + @After + public void cleanup() throws Exception { + ops.removeIfExists(TEST_AGGREGATE_PROVIDERS_ADDRESS); + ops.removeIfExists(TEST_AGGREGATE_PROVIDERS_ADDRESS2); + ops.removeIfExists(TEST_PROVIDER_LOADER_ADDRESS); + ops.removeIfExists(TEST_PROVIDER_LOADER_ADDRESS2); + administration.reloadIfRequired(); + } + + @Test + public void addAggregateProviders() throws Exception { + AddAggregateProviders addAggregateProviders + = new AddAggregateProviders.Builder(TEST_AGGREGATE_PROVIDERS_NAME) + .providers(TEST_PROVIDER_LOADER_NAME, TEST_PROVIDER_LOADER_NAME2) + .build(); + + client.apply(addAggregateProviders); + + assertTrue("Aggregate-providers should be created", ops.exists(TEST_AGGREGATE_PROVIDERS_ADDRESS)); + checkAttribute(TEST_AGGREGATE_PROVIDERS_ADDRESS, "providers[0]", TEST_PROVIDER_LOADER_NAME); + checkAttribute(TEST_AGGREGATE_PROVIDERS_ADDRESS, "providers[1]", TEST_PROVIDER_LOADER_NAME2); + } + + @Test + public void addTwoAggregateProviders() throws Exception { + AddAggregateProviders addAggregateProviders + = new AddAggregateProviders.Builder(TEST_AGGREGATE_PROVIDERS_NAME) + .providers(TEST_PROVIDER_LOADER_NAME, TEST_PROVIDER_LOADER_NAME2) + .build(); + + AddAggregateProviders addAggregateProviders2 + = new AddAggregateProviders.Builder(TEST_AGGREGATE_PROVIDERS_NAME2) + .providers(TEST_PROVIDER_LOADER_NAME2, TEST_PROVIDER_LOADER_NAME2) + .build(); + + client.apply(addAggregateProviders); + client.apply(addAggregateProviders2); + + assertTrue("Aggregate-providers should be created", ops.exists(TEST_AGGREGATE_PROVIDERS_ADDRESS)); + assertTrue("Second aggregate-providers should be created", ops.exists(TEST_AGGREGATE_PROVIDERS_ADDRESS2)); + } + + @Test(expected = CommandFailedException.class) + public void addExistAggregateProvidersNotAllowed() throws Exception { + AddAggregateProviders addAggregateProviders + = new AddAggregateProviders.Builder(TEST_AGGREGATE_PROVIDERS_NAME) + .providers(TEST_PROVIDER_LOADER_NAME, TEST_PROVIDER_LOADER_NAME2) + .build(); + + AddAggregateProviders addAggregateProviders2 + = new AddAggregateProviders.Builder(TEST_AGGREGATE_PROVIDERS_NAME) + .providers(TEST_PROVIDER_LOADER_NAME2, TEST_PROVIDER_LOADER_NAME2) + .build(); + + client.apply(addAggregateProviders); + assertTrue("Aggregate-providers should be created", ops.exists(TEST_AGGREGATE_PROVIDERS_ADDRESS)); + + client.apply(addAggregateProviders2); + fail("Aggregate-providers CreaperTestAggregateProviders already exists in configuration, exception should be thrown"); + } + + @Test + public void addExistAggregateProvidersAllowed() throws Exception { + AddAggregateProviders addAggregateProviders + = new AddAggregateProviders.Builder(TEST_AGGREGATE_PROVIDERS_NAME) + .providers(TEST_PROVIDER_LOADER_NAME, TEST_PROVIDER_LOADER_NAME2) + .build(); + + AddAggregateProviders addAggregateProviders2 + = new AddAggregateProviders.Builder(TEST_AGGREGATE_PROVIDERS_NAME) + .providers(TEST_PROVIDER_LOADER_NAME2, TEST_PROVIDER_LOADER_NAME2) + .replaceExisting() + .build(); + + client.apply(addAggregateProviders); + assertTrue("Aggregate-providers should be created", ops.exists(TEST_AGGREGATE_PROVIDERS_ADDRESS)); + + client.apply(addAggregateProviders2); + assertTrue("Aggregate-providers should be created", ops.exists(TEST_AGGREGATE_PROVIDERS_ADDRESS)); + + // check whether it was really rewritten + checkAttribute(TEST_AGGREGATE_PROVIDERS_ADDRESS, "providers[1]", TEST_PROVIDER_LOADER_NAME2); + } + + @Test(expected = CommandFailedException.class) + public void addAggregateProvidersWithoutConfiguredProviderLoader() throws Exception { + AddAggregateProviders addAggregateProviders + = new AddAggregateProviders.Builder(TEST_AGGREGATE_PROVIDERS_NAME) + .providers(TEST_PROVIDER_LOADER_NAME, "NotConfiguredProviderLoader") + .build(); + + client.apply(addAggregateProviders); + fail("Aggregate-providers shouldn't be added when using unconfigured provider-loader"); + } + + @Test(expected = IllegalArgumentException.class) + public void addAggregateProviders_nullName() throws Exception { + new AddAggregateProviders.Builder(null) + .providers(TEST_PROVIDER_LOADER_NAME, TEST_PROVIDER_LOADER_NAME2) + .build(); + fail("Creating command with null name should throw exception"); + } + + @Test(expected = IllegalArgumentException.class) + public void addAggregateProviders_emptyName() throws Exception { + new AddAggregateProviders.Builder("") + .providers(TEST_PROVIDER_LOADER_NAME, TEST_PROVIDER_LOADER_NAME2) + .build(); + fail("Creating command with empty name should throw exception"); + } + + @Test(expected = IllegalArgumentException.class) + public void addAggregateProviders_nullProviders() throws Exception { + new AddAggregateProviders.Builder(TEST_AGGREGATE_PROVIDERS_NAME) + .providers(null) + .build(); + fail("Creating command with null providers should throw exception"); + } + + @Test(expected = IllegalArgumentException.class) + public void addAggregateProviders_emptyProviders() throws Exception { + new AddAggregateProviders.Builder(TEST_AGGREGATE_PROVIDERS_NAME) + .providers("") + .build(); + fail("Creating command with empty providers should throw exception"); + } + + @Test(expected = IllegalArgumentException.class) + public void addAggregateProviders_oneProvider() throws Exception { + new AddAggregateProviders.Builder(TEST_AGGREGATE_PROVIDERS_NAME) + .providers(TEST_PROVIDER_LOADER_NAME) + .build(); + fail("Creating command with only one provider should throw exception"); + } + +} diff --git a/testsuite/standalone/src/test/java/org/wildfly/extras/creaper/commands/elytron/providerloader/AddProviderLoaderImpl.java b/testsuite/standalone/src/test/java/org/wildfly/extras/creaper/commands/elytron/providerloader/AddProviderLoaderImpl.java new file mode 100644 index 00000000..1c876649 --- /dev/null +++ b/testsuite/standalone/src/test/java/org/wildfly/extras/creaper/commands/elytron/providerloader/AddProviderLoaderImpl.java @@ -0,0 +1,11 @@ +package org.wildfly.extras.creaper.commands.elytron.providerloader; + +import java.security.Provider; + +public class AddProviderLoaderImpl extends Provider { + + public AddProviderLoaderImpl() { + super("name", 1.0, "some info"); + } + +} diff --git a/testsuite/standalone/src/test/java/org/wildfly/extras/creaper/commands/elytron/providerloader/AddProviderLoaderOnlineTest.java b/testsuite/standalone/src/test/java/org/wildfly/extras/creaper/commands/elytron/providerloader/AddProviderLoaderOnlineTest.java new file mode 100644 index 00000000..05e65362 --- /dev/null +++ b/testsuite/standalone/src/test/java/org/wildfly/extras/creaper/commands/elytron/providerloader/AddProviderLoaderOnlineTest.java @@ -0,0 +1,192 @@ +package org.wildfly.extras.creaper.commands.elytron.providerloader; + +import java.io.File; +import java.io.IOException; +import org.jboss.arquillian.junit.Arquillian; +import org.junit.After; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TemporaryFolder; +import org.junit.runner.RunWith; +import org.wildfly.extras.creaper.commands.elytron.AbstractElytronOnlineTest; +import org.wildfly.extras.creaper.commands.modules.AddModule; +import org.wildfly.extras.creaper.commands.modules.RemoveModule; +import org.wildfly.extras.creaper.core.CommandFailedException; +import org.wildfly.extras.creaper.core.online.OnlineManagementClient; +import org.wildfly.extras.creaper.core.online.operations.Address; + +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +@RunWith(Arquillian.class) +public class AddProviderLoaderOnlineTest extends AbstractElytronOnlineTest { + + private static final String TEST_PROVIDER_LOADER_NAME = "CreaperTestProviderLoader"; + private static final Address TEST_PROVIDER_LOADER_ADDRESS = SUBSYSTEM_ADDRESS.and("provider-loader", + TEST_PROVIDER_LOADER_NAME); + private static final String TEST_PROVIDER_LOADER_NAME2 = "CreaperTestProviderLoader2"; + private static final Address TEST_PROVIDER_LOADER_ADDRESS2 = SUBSYSTEM_ADDRESS.and("provider-loader", + TEST_PROVIDER_LOADER_NAME2); + + private static final String TEST_MODULE_NAME = "com.example.creaper-test-module"; + + @Rule + public TemporaryFolder tmp = new TemporaryFolder(); + + @After + public void cleanup() throws Exception { + ops.removeIfExists(TEST_PROVIDER_LOADER_ADDRESS); + ops.removeIfExists(TEST_PROVIDER_LOADER_ADDRESS2); + removeModuleQuietly(); + + administration.reloadIfRequired(); + } + + @Test + public void addSimpleProviderLoader() throws Exception { + AddProviderLoader addProviderLoader = new AddProviderLoader.Builder(TEST_PROVIDER_LOADER_NAME) + .build(); + + client.apply(addProviderLoader); + + assertTrue("Provider loader should be created", ops.exists(TEST_PROVIDER_LOADER_ADDRESS)); + } + + @Test + public void addTwoProviderLoaders() throws Exception { + AddProviderLoader addProviderLoader = new AddProviderLoader.Builder(TEST_PROVIDER_LOADER_NAME) + .build(); + AddProviderLoader addProviderLoader2 = new AddProviderLoader.Builder(TEST_PROVIDER_LOADER_NAME2) + .build(); + + client.apply(addProviderLoader); + client.apply(addProviderLoader2); + + assertTrue("Provider loader should be created", ops.exists(TEST_PROVIDER_LOADER_ADDRESS)); + assertTrue("Second provider loader should be created", ops.exists(TEST_PROVIDER_LOADER_ADDRESS2)); + } + + @Test + public void addFullProviderLoaderConfiguration() throws Exception { + File testJar1 = createJar("testJar", AddProviderLoaderImpl.class); + AddModule addModule = new AddModule.Builder(TEST_MODULE_NAME) + .resource(testJar1) + .build(); + client.apply(addModule); + + AddProviderLoader addProviderLoader = new AddProviderLoader.Builder(TEST_PROVIDER_LOADER_NAME) + .module(TEST_MODULE_NAME) + .classNames(AddProviderLoaderImpl.class.getCanonicalName()) + .addConfiguration("configurationName", "configurationValue") + .build(); + + client.apply(addProviderLoader); + + assertTrue("Provider loader should be created", ops.exists(TEST_PROVIDER_LOADER_ADDRESS)); + checkAttribute(TEST_PROVIDER_LOADER_ADDRESS, "module", TEST_MODULE_NAME); + checkAttribute(TEST_PROVIDER_LOADER_ADDRESS, "class-names[0]", AddProviderLoaderImpl.class.getCanonicalName()); + checkAttribute(TEST_PROVIDER_LOADER_ADDRESS, "configuration.configurationName", "configurationValue"); + } + + @Test + public void addFullProviderLoaderPath() throws Exception { + File testJar1 = createJar("testJar", AddProviderLoaderImpl.class); + + AddModule addModule = new AddModule.Builder(TEST_MODULE_NAME) + .resource(testJar1) + .build(); + client.apply(addModule); + + AddProviderLoader addProviderLoader = new AddProviderLoader.Builder(TEST_PROVIDER_LOADER_NAME) + .module(TEST_MODULE_NAME) + .classNames(AddProviderLoaderImpl.class.getCanonicalName()) + .path("application-users.properties") + .relativeTo("jboss.server.config.dir") + .build(); + + client.apply(addProviderLoader); + + assertTrue("Provider loader should be created", ops.exists(TEST_PROVIDER_LOADER_ADDRESS)); + checkAttribute(TEST_PROVIDER_LOADER_ADDRESS, "module", TEST_MODULE_NAME); + checkAttribute(TEST_PROVIDER_LOADER_ADDRESS, "class-names[0]", AddProviderLoaderImpl.class.getCanonicalName()); + checkAttribute(TEST_PROVIDER_LOADER_ADDRESS, "path", "application-users.properties"); + checkAttribute(TEST_PROVIDER_LOADER_ADDRESS, "relative-to", "jboss.server.config.dir"); + } + + @Test(expected = CommandFailedException.class) + public void addExistProviderLoaderNotAllowed() throws Exception { + AddProviderLoader addProviderLoader = new AddProviderLoader.Builder(TEST_PROVIDER_LOADER_NAME) + .build(); + AddProviderLoader addProviderLoader2 = new AddProviderLoader.Builder(TEST_PROVIDER_LOADER_NAME) + .build(); + + client.apply(addProviderLoader); + assertTrue("Provider loader should be created", ops.exists(TEST_PROVIDER_LOADER_ADDRESS)); + client.apply(addProviderLoader2); + fail("Provider loader CreaperTestProviderLoader already exists in configuration, exception should be thrown"); + } + + @Test + public void addExistProviderLoaderAllowed() throws Exception { + AddProviderLoader addProviderLoader = new AddProviderLoader.Builder(TEST_PROVIDER_LOADER_NAME) + .build(); + AddProviderLoader addProviderLoader2 = new AddProviderLoader.Builder(TEST_PROVIDER_LOADER_NAME) + .addConfiguration("configurationName", "configurationValue") + .replaceExisting() + .build(); + + client.apply(addProviderLoader); + assertTrue("Provider loader should be created", ops.exists(TEST_PROVIDER_LOADER_ADDRESS)); + client.apply(addProviderLoader2); + + // check whether it was really rewritten + checkAttribute(TEST_PROVIDER_LOADER_ADDRESS, "configuration.configurationName", "configurationValue"); + } + + @Test(expected = IllegalArgumentException.class) + public void addProviderLoader_configurationAndPath() throws Exception { + new AddProviderLoader.Builder(TEST_PROVIDER_LOADER_NAME) + .addConfiguration("configurationName", "configurationValue") + .path("application-users.properties") + .build(); + } + + @Test(expected = IllegalArgumentException.class) + public void addProviderLoader_nullName() throws Exception { + new AddProviderLoader.Builder(null) + .build(); + fail("Creating command with null name should throw exception"); + } + + @Test(expected = IllegalArgumentException.class) + public void addProviderLoader_emptyName() throws Exception { + new AddProviderLoader.Builder("") + .build(); + fail("Creating command with empty name should throw exception"); + } + + @Test(expected = IllegalArgumentException.class) + public void addProviderLoader_nullClassNames() throws Exception { + new AddProviderLoader.Builder(TEST_PROVIDER_LOADER_NAME) + .classNames(null) + .build(); + fail("Creating command with null class-names should throw exception"); + } + + @Test(expected = IllegalArgumentException.class) + public void addProviderLoader_nullConfiguration() throws Exception { + new AddProviderLoader.Builder(TEST_PROVIDER_LOADER_NAME) + .addConfiguration(null, null) + .build(); + fail("Creating command with null configuration should throw exception"); + } + + private static void removeModuleQuietly() throws IOException { + try (OnlineManagementClient client = createManagementClient()) { + RemoveModule removeModule = new RemoveModule(TEST_MODULE_NAME); + client.apply(removeModule); + } catch (CommandFailedException ignore) { + // ignored + } + } +}