Search in sources :

Example 66 with FeatureConfig

use of org.jboss.galleon.config.FeatureConfig in project galleon by wildfly.

the class AdvancedLayersTestCase method buildFPWithOptionalLayers.

public static void buildFPWithOptionalLayers(CliWrapper cli, UniverseSpec universeSpec, String producer, String version) throws ProvisioningException {
    FeaturePackCreator creator = FeaturePackCreator.getInstance().addArtifactResolver(cli.getSession().getMavenRepoManager());
    FeaturePackLocation fp1 = new FeaturePackLocation(universeSpec, producer, "1", null, version);
    creator.newFeaturePack(fp1.getFPID()).addFeatureSpec(FeatureSpec.builder(producer + "-FeatureA").addParam(FeatureParameterSpec.createId("id")).build()).addConfigLayer(ConfigLayerSpec.builder().setModel("testmodel").setName("base-" + producer).addFeature(new FeatureConfig(producer + "-FeatureA").setParam("id", "base")).build()).addConfigLayer(ConfigLayerSpec.builder().setModel("testmodel").setName("layerA-" + producer).addLayerDep("base-" + producer).build()).addConfigLayer(ConfigLayerSpec.builder().setModel("testmodel").setName("layerB-" + producer).addLayerDep("layerA-" + producer, true).build()).addConfigLayer(ConfigLayerSpec.builder().setModel("testmodel").setName("layerC-" + producer).addLayerDep("layerB-" + producer, true).build());
    creator.install();
}
Also used : FeaturePackCreator(org.jboss.galleon.creator.FeaturePackCreator) FeatureConfig(org.jboss.galleon.config.FeatureConfig) FeaturePackLocation(org.jboss.galleon.universe.FeaturePackLocation)

Example 67 with FeatureConfig

use of org.jboss.galleon.config.FeatureConfig in project galleon by wildfly.

the class BasicConfigLayerTestCase method createFeaturePacks.

@Override
protected void createFeaturePacks(FeaturePackCreator creator) throws ProvisioningException {
    fp1 = newFpl("prod1", "1", "1.0.0.Final");
    creator.newFeaturePack(fp1.getFPID()).addFeatureSpec(FeatureSpec.builder("specA").addParam(FeatureParameterSpec.createId("id")).addParam(FeatureParameterSpec.create("p1", "fp1")).addParam(FeatureParameterSpec.create("p2", "fp1")).build()).addConfigLayer(ConfigLayerSpec.builder().setModel("model1").setName("layer1").addFeature(new FeatureConfig("specA").setParam("id", "1").setParam("p1", "layer1")).build()).addConfig(ConfigModel.builder("model1", "name1").includeLayer("layer1").build());
    fp1Patch1 = newFpl("prod1", "1", "1.0.0.Patch1.Final");
    creator.newFeaturePack(fp1Patch1.getFPID()).setPatchFor(fp1.getFPID()).addConfigLayer(ConfigLayerSpec.builder().setModel("model1").setName("layer1").addFeature(new FeatureConfig("specA").setParam("id", "2").setParam("p1", "patched")).build());
}
Also used : FeatureConfig(org.jboss.galleon.config.FeatureConfig)

Example 68 with FeatureConfig

use of org.jboss.galleon.config.FeatureConfig in project galleon by wildfly.

the class BasicConfigPatchingTestCase method createFeaturePacks.

@Override
protected void createFeaturePacks(FeaturePackCreator creator) throws ProvisioningException {
    fp1 = newFpl("prod1", "1", "1.0.0.Final");
    creator.newFeaturePack(fp1.getFPID()).addFeatureSpec(FeatureSpec.builder("specA").addParam(FeatureParameterSpec.createId("id")).addParam(FeatureParameterSpec.create("p1", "fp1")).addParam(FeatureParameterSpec.create("p2", "fp1")).build()).addConfig(ConfigModel.builder("model1", "name1").addFeature(new FeatureConfig("specA").setParam("id", "1").setParam("p1", "config")).build());
    fp1Patch1 = newFpl("prod1", "1", "1.0.0.Patch1.Final");
    creator.newFeaturePack(fp1Patch1.getFPID()).setPatchFor(fp1.getFPID()).addConfig(ConfigModel.builder("model1", "name1").addFeature(new FeatureConfig("specA").setParam("id", "2").setParam("p1", "patched")).build());
}
Also used : FeatureConfig(org.jboss.galleon.config.FeatureConfig)

Example 69 with FeatureConfig

use of org.jboss.galleon.config.FeatureConfig in project galleon by wildfly.

the class BasicFeatureGroupPatchingTestCase method createFeaturePacks.

@Override
protected void createFeaturePacks(FeaturePackCreator creator) throws ProvisioningException {
    fp1 = newFpl("prod1", "1", "1.0.0.Final");
    creator.newFeaturePack(fp1.getFPID()).addFeatureSpec(FeatureSpec.builder("specA").addParam(FeatureParameterSpec.createId("id")).addParam(FeatureParameterSpec.create("p1", "fp1")).addParam(FeatureParameterSpec.create("p2", "fp1")).build()).addFeatureGroup(FeatureGroup.builder("group1").addFeature(new FeatureConfig("specA").setParam("id", "1").setParam("p1", "config")).build()).addConfig(ConfigModel.builder("model1", "name1").addFeatureGroup(FeatureGroup.forGroup("group1")).build());
    fp1Patch1 = newFpl("prod1", "1", "1.0.0.Patch1.Final");
    creator.newFeaturePack(fp1Patch1.getFPID()).setPatchFor(fp1.getFPID()).addFeatureGroup(FeatureGroup.builder("group1").addFeature(new FeatureConfig("specA").setParam("id", "1").setParam("p1", "patched")).build());
}
Also used : FeatureConfig(org.jboss.galleon.config.FeatureConfig)

Example 70 with FeatureConfig

use of org.jboss.galleon.config.FeatureConfig in project galleon by wildfly.

the class FeatureGroupXml method readFeatureConfig.

public static void readFeatureConfig(XMLExtendedStreamReader reader, FeatureConfig config) throws XMLStreamException {
    for (int i = 0; i < reader.getAttributeCount(); i++) {
        final Attribute attribute = Attribute.of(reader.getAttributeName(i));
        switch(attribute) {
            case SPEC:
                try {
                    config.setSpecName(reader.getAttributeValue(i));
                } catch (ProvisioningDescriptionException e) {
                    throw new XMLStreamException("Failed to parse config", e);
                }
                break;
            case PARENT_REF:
                config.setParentRef(reader.getAttributeValue(i));
                break;
            default:
                throw ParsingUtils.unexpectedAttribute(reader, i);
        }
    }
    if (config.getSpecId() == null) {
        throw ParsingUtils.missingAttributes(reader.getLocation(), Collections.singleton(Attribute.SPEC));
    }
    while (reader.hasNext()) {
        switch(reader.nextTag()) {
            case XMLStreamConstants.END_ELEMENT:
                return;
            case XMLStreamConstants.START_ELEMENT:
                final Element element = Element.of(reader.getName().getLocalPart());
                switch(element) {
                    case DEPENDS:
                        readFeatureDependency(reader, config);
                        break;
                    case PARAM:
                        readParameter(reader, config);
                        break;
                    case FEATURE:
                        final FeatureConfig child = new FeatureConfig();
                        readFeatureConfig(reader, child);
                        config.addFeature(child);
                        break;
                    case FEATURE_GROUP:
                        config.addFeatureGroup(readFeatureGroupDependency(null, reader));
                        break;
                    case ORIGIN:
                        readOrigin(reader, config);
                        break;
                    case RESET_PARAM:
                        config.resetParam(readParamAttr(reader));
                        break;
                    case UNSET_PARAM:
                        config.unsetParam(readParamAttr(reader));
                        break;
                    default:
                        throw ParsingUtils.unexpectedContent(reader);
                }
                break;
            default:
                throw ParsingUtils.unexpectedContent(reader);
        }
    }
    throw ParsingUtils.endOfDocument(reader.getLocation());
}
Also used : XMLStreamException(javax.xml.stream.XMLStreamException) FeatureConfig(org.jboss.galleon.config.FeatureConfig) ProvisioningDescriptionException(org.jboss.galleon.ProvisioningDescriptionException)

Aggregations

FeatureConfig (org.jboss.galleon.config.FeatureConfig)76 StateDiffPlugin (org.jboss.galleon.plugin.StateDiffPlugin)8 FeaturePackLocation (org.jboss.galleon.universe.FeaturePackLocation)6 FeaturePackCreator (org.jboss.galleon.creator.FeaturePackCreator)5 Test (org.junit.Test)4 Map (java.util.Map)3 FeatureId (org.jboss.galleon.spec.FeatureId)3 LinkedHashMap (java.util.LinkedHashMap)2 XMLStreamException (javax.xml.stream.XMLStreamException)2 ProvisioningDescriptionException (org.jboss.galleon.ProvisioningDescriptionException)2 ProvisioningConfig (org.jboss.galleon.config.ProvisioningConfig)2 HashMap (java.util.HashMap)1 ProvisioningException (org.jboss.galleon.ProvisioningException)1 ConfigId (org.jboss.galleon.config.ConfigId)1 FeatureGroup (org.jboss.galleon.config.FeatureGroup)1 FeaturePackConfig (org.jboss.galleon.config.FeaturePackConfig)1 ResolvedSpecId (org.jboss.galleon.runtime.ResolvedSpecId)1 FeaturePackSpec (org.jboss.galleon.spec.FeaturePackSpec)1 SpecId (org.jboss.galleon.spec.SpecId)1 BasicStateDiffPlugin (org.jboss.galleon.userchanges.persist.test.BasicStateDiffPlugin)1