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();
}
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());
}
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());
}
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());
}
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());
}
Aggregations