Search in sources :

Example 11 with ResolvedSpecId

use of org.jboss.galleon.runtime.ResolvedSpecId in project galleon by wildfly.

the class ProvisionedStateXmlWriterTestCase method testFeatureParams.

@Test
public void testFeatureParams() throws Exception {
    ProvisionedState originalState = ProvisionedState.builder().addConfig(ProvisionedConfigBuilder.builder().addFeature(ProvisionedFeatureBuilder.builder(new ResolvedSpecId(LegacyGalleon1Universe.newFPID("org.jboss.group", "fp", "1.0").getProducer(), "spec")).setIdParam("id-param", "config").setIdParam("id-param2", "config").setConfigParam("param", "config").build()).addFeature(ProvisionedFeatureBuilder.builder(ResolvedFeatureId.builder(LegacyGalleon1Universe.newFPID("org.jboss.group", "fp", "1.0").getProducer(), "spec2").setParam("id-param", // TODO: this resolved value will not have config representation
    "resolved").build()).setConfigParam("param", "config").build())).build();
    // marshall and unmarshall
    Path path = marshallToTempFile(originalState);
    ProvisionedState newState = validator.validateAndParse(path);
    // retrieve the parsedFeature
    ReadFeaturesHandler readFeaturesHandler = new ReadFeaturesHandler();
    newState.getConfigs().get(0).handle(readFeaturesHandler);
    ProvisionedFeature parsedFeature = readFeaturesHandler.features.get(0);
    Assert.assertEquals("config", parsedFeature.getConfigParam("id-param"));
    Assert.assertEquals("config", parsedFeature.getConfigParam("id-param2"));
    Assert.assertEquals("config", parsedFeature.getConfigParam("param"));
    parsedFeature = readFeaturesHandler.features.get(1);
    Assert.assertEquals("resolved", parsedFeature.getConfigParam("id-param"));
    Assert.assertEquals("config", parsedFeature.getConfigParam("param"));
}
Also used : Path(java.nio.file.Path) ProvisionedFeature(org.jboss.galleon.state.ProvisionedFeature) ResolvedSpecId(org.jboss.galleon.runtime.ResolvedSpecId) ProvisionedState(org.jboss.galleon.state.ProvisionedState) Test(org.junit.Test)

Aggregations

ResolvedSpecId (org.jboss.galleon.runtime.ResolvedSpecId)11 ProvisionedFeature (org.jboss.galleon.state.ProvisionedFeature)4 Path (java.nio.file.Path)3 HashSet (java.util.HashSet)3 ProvisionedState (org.jboss.galleon.state.ProvisionedState)3 Test (org.junit.Test)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 List (java.util.List)2 Group (org.jboss.galleon.cli.model.Group)2 PackageInfo (org.jboss.galleon.cli.model.PackageInfo)2 ResolvedFeatureSpec (org.jboss.galleon.runtime.ResolvedFeatureSpec)2 FeatureSpec (org.jboss.galleon.spec.FeatureSpec)2 PackageDependencySpec (org.jboss.galleon.spec.PackageDependencySpec)2 Map (java.util.Map)1 Set (java.util.Set)1 ProvisioningException (org.jboss.galleon.ProvisioningException)1 FeatureInfo (org.jboss.galleon.cli.model.FeatureInfo)1 FeatureSpecInfo (org.jboss.galleon.cli.model.FeatureSpecInfo)1 Identity (org.jboss.galleon.cli.model.Identity)1