From 45c5e71a7a305be984f380f819f19c9c22232a74 Mon Sep 17 00:00:00 2001 From: Bartosz Spyrko-Smietanko Date: Tue, 15 Aug 2023 11:31:15 +0100 Subject: [PATCH] Merge model and config parameters --- dist/docs/guide/usage/add_feature_pack.adoc | 5 +- pom.xml | 3 +- .../prospero/cli/commands/CliConstants.java | 1 - .../cli/commands/FeaturesCommand.java | 22 ++++-- .../cli/commands/FeaturesCommandTest.java | 70 ++++++++++++------- .../prospero/actions/FeaturesAddAction.java | 11 ++- .../actions/FeaturesAddActionTest.java | 45 ++++++------ 7 files changed, 97 insertions(+), 60 deletions(-) diff --git a/dist/docs/guide/usage/add_feature_pack.adoc b/dist/docs/guide/usage/add_feature_pack.adoc index aa75afa26..bb82a9def 100644 --- a/dist/docs/guide/usage/add_feature_pack.adoc +++ b/dist/docs/guide/usage/add_feature_pack.adoc @@ -42,8 +42,7 @@ The Galleon feature packs may provide different capabilities using https://docs. NOTE: Using `--layers` parameter overwrites the default configuration defined by some feature packs. -If the feature pack changes server configuration files, the user may also choose which server configuration should be affected using `--model` and `--config` -parameters. If those parameters are not provided, the layer configuration will use default values. Most Wildfly feature packs provide only a single model (standalone) and the default configuration file of standalone.xml. +If the feature pack changes server configuration files, the user may also choose which server configuration should be affected using `--config` parameter. If not provided, the layer configuration will use default values. Most Wildfly feature packs provide only a single model (standalone) and the default configuration file of standalone.xml. NOTE: If the affected configuration file has been modified by the user, that file will not be modified. Instead, a new configuration file with suffix `.glnew` will be created with the changes. @@ -57,6 +56,8 @@ $ prospero feature-pack add \ --dir wildfly ``` +If the feature pack provides multiple configuration model, the configuration name can be prefixed with model name e.g. `--config standalone/standalone.xml` + #### Offline installation Similarly to other operations, `feature-pack add` can be executed in an offline mode. To do so, users should provide local repositories with all required artifacts (both for base server and the new feature) using `--repositories` parameter. diff --git a/pom.xml b/pom.xml index 3b42c0fd9..92e0f964a 100644 --- a/pom.xml +++ b/pom.xml @@ -461,10 +461,11 @@ org.apache.maven.plugins maven-compiler-plugin - 2.5.1 11 11 + 11 + 11 diff --git a/prospero-cli/src/main/java/org/wildfly/prospero/cli/commands/CliConstants.java b/prospero-cli/src/main/java/org/wildfly/prospero/cli/commands/CliConstants.java index 37066d881..3e5c181e5 100644 --- a/prospero-cli/src/main/java/org/wildfly/prospero/cli/commands/CliConstants.java +++ b/prospero-cli/src/main/java/org/wildfly/prospero/cli/commands/CliConstants.java @@ -101,6 +101,5 @@ private Commands() { public static final String ACCEPT_AGREEMENTS = "--accept-license-agreements"; public static final String LAYERS = "--layers"; - public static final String MODEL = "--model"; public static final String CONFIG = "--config"; } diff --git a/prospero-cli/src/main/java/org/wildfly/prospero/cli/commands/FeaturesCommand.java b/prospero-cli/src/main/java/org/wildfly/prospero/cli/commands/FeaturesCommand.java index 16fad33e2..444a7e5ad 100644 --- a/prospero-cli/src/main/java/org/wildfly/prospero/cli/commands/FeaturesCommand.java +++ b/prospero-cli/src/main/java/org/wildfly/prospero/cli/commands/FeaturesCommand.java @@ -17,6 +17,7 @@ package org.wildfly.prospero.cli.commands; +import org.jboss.galleon.config.ConfigId; import org.wildfly.channel.Repository; import org.wildfly.prospero.actions.FeaturesAddAction; import org.wildfly.prospero.api.MavenOptions; @@ -50,9 +51,6 @@ public static class AddCommand extends AbstractMavenCommand { @CommandLine.Option(names = CliConstants.LAYERS, split = ",") private Set layers; - @CommandLine.Option(names = CliConstants.MODEL) - private String model; - @CommandLine.Option(names = CliConstants.CONFIG) private String config; @@ -95,7 +93,7 @@ public Integer call() throws Exception { } try { - featuresAddAction.addFeaturePack(fpl, layers == null ? Collections.emptySet() : layers, model, config); + featuresAddAction.addFeaturePack(fpl, layers == null ? Collections.emptySet() : layers, parseConfigName()); } catch (FeaturesAddAction.LayerNotFoundException e) { if (!e.getSupportedLayers().isEmpty()) { console.error(CliMessages.MESSAGES.layerNotSupported(fpl, e.getLayers(), e.getSupportedLayers())); @@ -117,6 +115,22 @@ public Integer call() throws Exception { return ReturnCodes.SUCCESS; } + + private ConfigId parseConfigName() { + if (config == null) { + return null; + } + int i = config.indexOf("/"); + if (i < 0) { + return new ConfigId(null, config.trim()); + } + + if (i == config.length() -1) { + return new ConfigId(config.substring(0, i).trim(), null); + } else { + return new ConfigId(config.substring(0, i).trim(), config.substring(i+1).trim()); + } + } } diff --git a/prospero-cli/src/test/java/org/wildfly/prospero/cli/commands/FeaturesCommandTest.java b/prospero-cli/src/test/java/org/wildfly/prospero/cli/commands/FeaturesCommandTest.java index 38cfd2aa8..43cd38249 100644 --- a/prospero-cli/src/test/java/org/wildfly/prospero/cli/commands/FeaturesCommandTest.java +++ b/prospero-cli/src/test/java/org/wildfly/prospero/cli/commands/FeaturesCommandTest.java @@ -60,6 +60,9 @@ public class FeaturesCommandTest extends AbstractMavenCommandTest { @Captor private ArgumentCaptor mavenOptions; + @Captor + private ArgumentCaptor configNameCaptor; + @Rule public TemporaryFolder tempFolder = new TemporaryFolder(); @@ -104,14 +107,11 @@ public void passArgumentsToFeaturesAddAction_OnlyFpl() throws Exception { final ArgumentCaptor fplCaptor = ArgumentCaptor.forClass(String.class); final ArgumentCaptor> layersCaptor = ArgumentCaptor.forClass(Set.class); - final ArgumentCaptor modelCaptor = ArgumentCaptor.forClass(String.class); - final ArgumentCaptor configNameCaptor = ArgumentCaptor.forClass(String.class); verify(featuresAddAction).addFeaturePack(fplCaptor.capture(), layersCaptor.capture(), - modelCaptor.capture(), configNameCaptor.capture()); + configNameCaptor.capture()); assertEquals(fplCaptor.getValue(), "test:test"); assertEquals(Collections.emptySet(), layersCaptor.getValue()); - assertEquals(modelCaptor.getValue(), null); assertEquals(configNameCaptor.getValue(), null); } @@ -125,30 +125,53 @@ public void passArgumentsToFeaturesAddAction_LayersAreSplit() throws Exception { final ArgumentCaptor> layersCaptor = ArgumentCaptor.forClass(Set.class); verify(featuresAddAction).addFeaturePack(any(), layersCaptor.capture(), - any(), any()); + any()); assertEquals(Set.of("layer1", "layer2"), layersCaptor.getValue()); } + @Test + public void passArgumentsToFeaturesAddAction_ModuleOnlyConfig() throws Exception { + int exitCode = commandLine.execute(CliConstants.Commands.FEATURE_PACKS, CliConstants.Commands.ADD, + CliConstants.DIR, installationDir.toString(), + CliConstants.FPL, "test:test", + CliConstants.CONFIG, "test/"); + assertEquals(ReturnCodes.SUCCESS, exitCode); + + verify(featuresAddAction).addFeaturePack(any(), any(), + configNameCaptor.capture()); + + assertEquals(new ConfigId("test", null), configNameCaptor.getValue()); + } + + @Test + public void passArgumentsToFeaturesAddAction_NameOnlyConfig() throws Exception { + int exitCode = commandLine.execute(CliConstants.Commands.FEATURE_PACKS, CliConstants.Commands.ADD, + CliConstants.DIR, installationDir.toString(), + CliConstants.FPL, "test:test", + CliConstants.CONFIG, "test"); + assertEquals(ReturnCodes.SUCCESS, exitCode); + + verify(featuresAddAction).addFeaturePack(any(), any(), + configNameCaptor.capture()); + + assertEquals(new ConfigId(null, "test"), configNameCaptor.getValue()); + } + @Test public void passArgumentsToFeaturesAddAction_AllParameters() throws Exception { int exitCode = commandLine.execute(CliConstants.Commands.FEATURE_PACKS, CliConstants.Commands.ADD, CliConstants.DIR, installationDir.toString(), CliConstants.FPL, "test:test", CliConstants.LAYERS, "layer1", - CliConstants.CONFIG, "config", - CliConstants.MODEL, "model"); + CliConstants.CONFIG, "model/config"); assertEquals(ReturnCodes.SUCCESS, exitCode); final ArgumentCaptor> layersCaptor = ArgumentCaptor.forClass(Set.class); - final ArgumentCaptor modelCaptor = ArgumentCaptor.forClass(String.class); - final ArgumentCaptor configNameCaptor = ArgumentCaptor.forClass(String.class); - verify(featuresAddAction).addFeaturePack(any(), layersCaptor.capture(), - modelCaptor.capture(), configNameCaptor.capture()); + verify(featuresAddAction).addFeaturePack(any(), layersCaptor.capture(), configNameCaptor.capture()); assertEquals(Set.of("layer1"), layersCaptor.getValue()); - assertEquals("config", configNameCaptor.getValue()); - assertEquals("model", modelCaptor.getValue()); + assertEquals(new ConfigId("model", "config"), configNameCaptor.getValue()); } @Test @@ -160,8 +183,7 @@ public void nonExistingFeaturePack_CausesError() throws Exception { CliConstants.DIR, installationDir.toString(), CliConstants.FPL, "test:idontexist", CliConstants.LAYERS, "layer1", - CliConstants.CONFIG, "config", - CliConstants.MODEL, "model"); + CliConstants.CONFIG, "model/config"); assertEquals(ReturnCodes.INVALID_ARGUMENTS, exitCode); assertThat(getErrorOutput()) .contains(CliMessages.MESSAGES.featurePackNotFound("test:idontexist")); @@ -178,8 +200,7 @@ public void unableToResolveFeaturePack_CausesError() throws Exception { CliConstants.DIR, installationDir.toString(), CliConstants.FPL, "test:idontexist", CliConstants.LAYERS, "layer1", - CliConstants.CONFIG, "config", - CliConstants.MODEL, "model"); + CliConstants.CONFIG, "model/config"); assertEquals(ReturnCodes.PROCESSING_ERROR, exitCode); assertThat(getErrorOutput()) .contains("Unable to resolve artifacts:") @@ -209,7 +230,7 @@ public void fplWithTreePartsFails() throws Exception { @Test public void nonExistingLayersShowsError() throws Exception { doThrow(new FeaturesAddAction.LayerNotFoundException("foo", Set.of("idontexist"), Set.of("layer1", "layer2"))) - .when(featuresAddAction).addFeaturePack("org.test:test", Set.of("idontexist"), null, null); + .when(featuresAddAction).addFeaturePack("org.test:test", Set.of("idontexist"), null); int exitCode = commandLine.execute(CliConstants.Commands.FEATURE_PACKS, CliConstants.Commands.ADD, CliConstants.DIR, installationDir.toString(), CliConstants.LAYERS, "idontexist", @@ -223,7 +244,7 @@ public void nonExistingLayersShowsError() throws Exception { @Test public void nonExistingLayersShowsErrorNoAvailableLayers() throws Exception { doThrow(new FeaturesAddAction.LayerNotFoundException("foo", Set.of("idontexist"), Collections.emptySet())) - .when(featuresAddAction).addFeaturePack("org.test:test", Set.of("idontexist"), null, null); + .when(featuresAddAction).addFeaturePack("org.test:test", Set.of("idontexist"), null); int exitCode = commandLine.execute(CliConstants.Commands.FEATURE_PACKS, CliConstants.Commands.ADD, CliConstants.DIR, installationDir.toString(), CliConstants.LAYERS, "idontexist", @@ -238,10 +259,11 @@ public void nonExistingLayersShowsErrorNoAvailableLayers() throws Exception { @Test public void nonExistingModelShowsError() throws Exception { doThrow(new FeaturesAddAction.ModelNotDefinedException("test", "idontexist", Set.of("model1", "model2"))) - .when(featuresAddAction).addFeaturePack("org.test:test", Collections.emptySet(), "idontexist", null); + .when(featuresAddAction).addFeaturePack("org.test:test", Collections.emptySet(), + new ConfigId("idontexist", "test")); int exitCode = commandLine.execute(CliConstants.Commands.FEATURE_PACKS, CliConstants.Commands.ADD, CliConstants.DIR, installationDir.toString(), - CliConstants.MODEL, "idontexist", + CliConstants.CONFIG, "idontexist/test", CliConstants.FPL, "org.test:test"); assertEquals(ReturnCodes.INVALID_ARGUMENTS, exitCode); assertThat(getErrorOutput()) @@ -252,11 +274,11 @@ public void nonExistingModelShowsError() throws Exception { @Test public void nonExistingConfigurationShowsError() throws Exception { doThrow(new FeaturesAddAction.ConfigurationNotFoundException("test", new ConfigId("test", "idontexist"))) - .when(featuresAddAction).addFeaturePack("org.test:test", Collections.emptySet(), "test", "idontexist"); + .when(featuresAddAction).addFeaturePack("org.test:test", Collections.emptySet(), + new ConfigId("test", "idontexist")); int exitCode = commandLine.execute(CliConstants.Commands.FEATURE_PACKS, CliConstants.Commands.ADD, CliConstants.DIR, installationDir.toString(), - CliConstants.MODEL, "test", - CliConstants.CONFIG, "idontexist", + CliConstants.CONFIG, "test/idontexist", CliConstants.FPL, "org.test:test"); assertEquals(ReturnCodes.INVALID_ARGUMENTS, exitCode); assertThat(getErrorOutput()) diff --git a/prospero-common/src/main/java/org/wildfly/prospero/actions/FeaturesAddAction.java b/prospero-common/src/main/java/org/wildfly/prospero/actions/FeaturesAddAction.java index e22c2fdce..b84e556d8 100644 --- a/prospero-common/src/main/java/org/wildfly/prospero/actions/FeaturesAddAction.java +++ b/prospero-common/src/main/java/org/wildfly/prospero/actions/FeaturesAddAction.java @@ -102,8 +102,7 @@ public FeaturesAddAction(MavenOptions mavenOptions, Path installDir, List layers, String model, String configName) + public void addFeaturePack(String featurePackCoord, Set layers, ConfigId configName) throws ProvisioningException, OperationException { Objects.requireNonNull(layers); if (featurePackCoord == null || featurePackCoord.isEmpty()) { @@ -140,18 +139,18 @@ public void addFeaturePack(String featurePackCoord, Set layers, String m } } - selectedModel = getSelectedModel(model, allLayers); + selectedModel = getSelectedModel(configName == null?null:configName.getModel(), allLayers); verifyLayerAvailable(layers, selectedModel, allLayers); - if (configName == null) { + if (configName == null || configName.getName() == null) { if (selectedModel == null) { selectedConfig = null; } else { selectedConfig = selectedModel + ".xml"; } } else { - selectedConfig = configName; + selectedConfig = configName.getName(); } if (ProsperoLogger.ROOT_LOGGER.isDebugEnabled()) { diff --git a/prospero-common/src/test/java/org/wildfly/prospero/actions/FeaturesAddActionTest.java b/prospero-common/src/test/java/org/wildfly/prospero/actions/FeaturesAddActionTest.java index 7b1a93208..3deda7b87 100644 --- a/prospero-common/src/test/java/org/wildfly/prospero/actions/FeaturesAddActionTest.java +++ b/prospero-common/src/test/java/org/wildfly/prospero/actions/FeaturesAddActionTest.java @@ -77,9 +77,7 @@ @RunWith(MockitoJUnitRunner.class) public class FeaturesAddActionTest { - - private static final String NO_MODEL = null; - private static final String NO_CONFIG = null; + private static final ConfigId NO_CONFIG = null; @Rule public TemporaryFolder temp = new TemporaryFolder(); @Mock @@ -198,7 +196,8 @@ public void layerNotAvailable_throwsException() throws Exception { // install installFeaturePack(installDir, "org.test:base-pack:1.0.0:zip"); - assertThatThrownBy(()-> getFeaturesAddAction().addFeaturePack("org.test:added-pack", Set.of("idontexist"), null, null)) + assertThatThrownBy(()-> getFeaturesAddAction().addFeaturePack("org.test:added-pack", + Set.of("idontexist"), NO_CONFIG)) .isInstanceOf(FeaturesAddAction.LayerNotFoundException.class) .hasFieldOrPropertyWithValue("layers", Set.of("idontexist")) .hasFieldOrPropertyWithValue("supportedLayers", Set.of("layer1")); @@ -220,7 +219,7 @@ public void noLayersInTheFeaturePacks_provisionsNoConfigs() throws Exception { // install installFeaturePack(installDir, "org.test:base-pack:1.0.0:zip"); - getFeaturesAddAction().addFeaturePack("org.test:added-pack", Collections.emptySet(), null, null); + getFeaturesAddAction().addFeaturePack("org.test:added-pack", Collections.emptySet(), NO_CONFIG); final ArgumentCaptor provisioningConfigArgumentCaptor = ArgumentCaptor.forClass(ProvisioningConfig.class); verify(prepareCandidateAction).buildCandidate(any(), any(), eq(ApplyCandidateAction.Type.FEATURE_ADD), @@ -245,7 +244,8 @@ public void noLayersInTheFeaturePackWithRequriedLayer_throwsException() throws E // install installFeaturePack(installDir, "org.test:base-pack:1.0.0:zip"); - assertThatThrownBy(()-> getFeaturesAddAction().addFeaturePack("org.test:added-pack", Set.of("idontexist"), null, null)) + assertThatThrownBy(()-> getFeaturesAddAction().addFeaturePack("org.test:added-pack", + Set.of("idontexist"), NO_CONFIG)) .isInstanceOf(FeaturesAddAction.LayerNotFoundException.class) .hasFieldOrPropertyWithValue("layers", Set.of("idontexist")); @@ -274,7 +274,7 @@ public void requestedLayerAddsItsConfig() throws Exception { // install installFeaturePack(installDir, "org.test:base-pack:1.0.0:zip"); - getFeaturesAddAction().addFeaturePack("org.test:added-pack", Set.of("layer1"), null, null); + getFeaturesAddAction().addFeaturePack("org.test:added-pack", Set.of("layer1"), NO_CONFIG); final ArgumentCaptor provisioningConfigArgumentCaptor = ArgumentCaptor.forClass(ProvisioningConfig.class); verify(prepareCandidateAction).buildCandidate(any(), any(), eq(ApplyCandidateAction.Type.FEATURE_ADD), @@ -310,7 +310,8 @@ public void selectedConfigOverridesDefaultWithRequestedLayer() throws Exception // install installFeaturePack(installDir, "org.test:base-pack:1.0.0:zip"); - getFeaturesAddAction().addFeaturePack("org.test:added-pack", Set.of("layer1"), null, "test.xml"); + getFeaturesAddAction().addFeaturePack("org.test:added-pack", Set.of("layer1"), + new ConfigId(null, "test.xml")); final ArgumentCaptor provisioningConfigArgumentCaptor = ArgumentCaptor.forClass(ProvisioningConfig.class); verify(prepareCandidateAction).buildCandidate(any(), any(), eq(ApplyCandidateAction.Type.FEATURE_ADD), @@ -356,7 +357,7 @@ public void addFeaturePackAlreadyInstalledAsDependency() throws Exception { .build()); mockInstallationData(installDir, "org.test:base-pack:1.0.0", "org.test:added-pack:1.0.0"); - getFeaturesAddAction().addFeaturePack("org.test:added-pack", Set.of("layer2"), null, "test.xml"); + getFeaturesAddAction().addFeaturePack("org.test:added-pack", Set.of("layer2"), new ConfigId(null, "test.xml")); final ArgumentCaptor provisioningConfigArgumentCaptor = ArgumentCaptor.forClass(ProvisioningConfig.class); verify(prepareCandidateAction).buildCandidate(any(), any(), eq(ApplyCandidateAction.Type.FEATURE_ADD), @@ -413,7 +414,7 @@ public void installingLayerOverridesExcludesLayer() throws Exception { .build()); mockInstallationData(installDir, "org.test:base-pack:1.0.0"); - getFeaturesAddAction().addFeaturePack("org.test:added-pack", Set.of("layer2"), null, "test.xml"); + getFeaturesAddAction().addFeaturePack("org.test:added-pack", Set.of("layer2"), new ConfigId(null, "test.xml")); final ArgumentCaptor provisioningConfigArgumentCaptor = ArgumentCaptor.forClass(ProvisioningConfig.class); verify(prepareCandidateAction).buildCandidate(any(), any(), eq(ApplyCandidateAction.Type.FEATURE_ADD), @@ -457,7 +458,7 @@ public void multipleModelsDefinedInLayersWithoutSelectedModel_throwError() throw installFeaturePack(installDir, "org.test:base-pack:1.0.0:zip"); assertThatThrownBy(()->getFeaturesAddAction().addFeaturePack( - "org.test:added-pack", Collections.emptySet(), null, null)) + "org.test:added-pack", Collections.emptySet(), new ConfigId(null, "test"))) .isInstanceOf(FeaturesAddAction.ModelNotDefinedException.class); } @@ -477,7 +478,7 @@ public void selectedModelIsNotDefinedInFeaturePack_throwError() throws Exception installFeaturePack(installDir, "org.test:base-pack:1.0.0:zip"); assertThatThrownBy(()->getFeaturesAddAction().addFeaturePack( - "org.test:added-pack", Collections.emptySet(), "model2", null)) + "org.test:added-pack", Collections.emptySet(), new ConfigId("model2", null))) .isInstanceOf(FeaturesAddAction.ModelNotDefinedException.class) .hasFieldOrPropertyWithValue("model", "model2"); @@ -507,7 +508,7 @@ public void selectedModelOverridesTheDefault() throws Exception { installFeaturePack(installDir, "org.test:base-pack:1.0.0:zip"); getFeaturesAddAction().addFeaturePack( - "org.test:added-pack", Set.of("layer1"), "model2", null); + "org.test:added-pack", Set.of("layer1"), new ConfigId("model2", null)); final ArgumentCaptor provisioningConfigArgumentCaptor = ArgumentCaptor.forClass(ProvisioningConfig.class); verify(prepareCandidateAction).buildCandidate(any(), any(), eq(ApplyCandidateAction.Type.FEATURE_ADD), provisioningConfigArgumentCaptor.capture()); @@ -533,7 +534,7 @@ public void featurePacksWithoutLayersCanBeInstalled() throws Exception { installFeaturePack(installDir, "org.test:base-pack:1.0.0:zip"); getFeaturesAddAction().addFeaturePack( - "org.test:added-pack", Collections.emptySet(), null, null); + "org.test:added-pack", Collections.emptySet(), null); final ArgumentCaptor provisioningConfigArgumentCaptor = ArgumentCaptor.forClass(ProvisioningConfig.class); verify(prepareCandidateAction).buildCandidate(any(), any(), eq(ApplyCandidateAction.Type.FEATURE_ADD), provisioningConfigArgumentCaptor.capture()); @@ -548,21 +549,21 @@ public void featurePacksWithoutLayersCanBeInstalled() throws Exception { @Test public void invalidFeatureNameThrowsException() throws Exception { mockInstallationData(installDir); - assertThatThrownBy(()->getFeaturesAddAction().addFeaturePack(null, Collections.emptySet(), NO_MODEL, NO_CONFIG)) + assertThatThrownBy(()->getFeaturesAddAction().addFeaturePack(null, Collections.emptySet(), NO_CONFIG)) .isInstanceOf(IllegalArgumentException.class) .hasMessageContaining("The feature pack coordinate cannot be null"); assertThatThrownBy(()->getFeaturesAddAction().isFeaturePackAvailable(null)) .isInstanceOf(IllegalArgumentException.class) .hasMessageContaining("The feature pack coordinate cannot be null"); - assertThatThrownBy(()->getFeaturesAddAction().addFeaturePack("only_group", Collections.emptySet(), NO_MODEL, NO_CONFIG)) + assertThatThrownBy(()->getFeaturesAddAction().addFeaturePack("only_group", Collections.emptySet(), NO_CONFIG)) .isInstanceOf(IllegalArgumentException.class) .hasMessageContaining("The feature pack coordinate has to consist of :"); assertThatThrownBy(()->getFeaturesAddAction().isFeaturePackAvailable("only_group")) .isInstanceOf(IllegalArgumentException.class) .hasMessageContaining("The feature pack coordinate has to consist of :"); - assertThatThrownBy(()->getFeaturesAddAction().addFeaturePack("too:many:parts", Collections.emptySet(), NO_MODEL, NO_CONFIG)) + assertThatThrownBy(()->getFeaturesAddAction().addFeaturePack("too:many:parts", Collections.emptySet(), NO_CONFIG)) .isInstanceOf(IllegalArgumentException.class) .hasMessageContaining("The feature pack coordinate has to consist of :"); assertThatThrownBy(()->getFeaturesAddAction().isFeaturePackAvailable("too:many:parts")) @@ -586,7 +587,7 @@ public void existingFeaturePackCannotBeInstalled() throws Exception { installFeaturePack(installDir, "org.test:base-pack:1.0.0:zip"); assertThatThrownBy(()->getFeaturesAddAction().addFeaturePack( - "org.test:base-pack", Collections.emptySet(), null, null)) + "org.test:base-pack", Collections.emptySet(), NO_CONFIG)) .isInstanceOf(FeaturesAddAction.FeaturePackAlreadyInstalledException.class); } @@ -605,7 +606,7 @@ public void installDefaultPackagesIfNoLayersAreSpecified() throws Exception { installFeaturePack(installDir, "org.test:base-pack:1.0.0:zip"); getFeaturesAddAction().addFeaturePack( - "org.test:added-pack", Collections.emptySet(), null, null); + "org.test:added-pack", Collections.emptySet(), NO_CONFIG); final ArgumentCaptor provisioningConfigArgumentCaptor = ArgumentCaptor.forClass(ProvisioningConfig.class); verify(prepareCandidateAction).buildCandidate(any(), any(), eq(ApplyCandidateAction.Type.FEATURE_ADD), provisioningConfigArgumentCaptor.capture()); @@ -652,7 +653,7 @@ public void installSelectedConfigsIfNoLayersAreSpecified() throws Exception { installFeaturePack(installDir, "org.test:base-pack:1.0.0:zip"); getFeaturesAddAction().addFeaturePack( - "org.test:added-pack", Collections.emptySet(), "model1", "config2"); + "org.test:added-pack", Collections.emptySet(), new ConfigId("model1", "config2")); final ArgumentCaptor provisioningConfigArgumentCaptor = ArgumentCaptor.forClass(ProvisioningConfig.class); verify(prepareCandidateAction).buildCandidate(any(), any(), eq(ApplyCandidateAction.Type.FEATURE_ADD), provisioningConfigArgumentCaptor.capture()); @@ -706,7 +707,7 @@ public void installSelectedConfigsIfLayersAreSpecified() throws Exception { installFeaturePack(installDir, "org.test:base-pack:1.0.0:zip"); getFeaturesAddAction().addFeaturePack( - "org.test:added-pack", Set.of("layer1"), null, null); + "org.test:added-pack", Set.of("layer1"), NO_CONFIG); final ArgumentCaptor provisioningConfigArgumentCaptor = ArgumentCaptor.forClass(ProvisioningConfig.class); verify(prepareCandidateAction).buildCandidate(any(), any(), eq(ApplyCandidateAction.Type.FEATURE_ADD), provisioningConfigArgumentCaptor.capture()); @@ -744,7 +745,7 @@ public void nonExistingConfigNameThrowsException() throws Exception { installFeaturePack(installDir, "org.test:base-pack:1.0.0:zip"); assertThatThrownBy(()->getFeaturesAddAction().addFeaturePack( - "org.test:added-pack", Set.of("layer1"), "model1", "idontexist")) + "org.test:added-pack", Set.of("layer1"), new ConfigId("model1", "idontexist"))) .isInstanceOf(FeaturesAddAction.ConfigurationNotFoundException.class) .hasFieldOrPropertyWithValue("model", "model1") .hasFieldOrPropertyWithValue("name", "idontexist");