use of org.jboss.galleon.layout.FeaturePackLayout in project galleon by wildfly.
the class UninstallCommand method getDynamicOptions.
@Override
protected List<DynamicOption> getDynamicOptions(State state) throws Exception {
String fpid = getFPID();
Path dir = getAbsolutePath(getUninstallDir(), pmSession.getAeshContext());
// Build layout from this directory.
ProvisioningConfig config = ProvisioningXmlParser.parse(PathsUtils.getProvisioningXml(dir));
if (config != null) {
// Silent resolution.
pmSession.unregisterTrackers();
try {
try (ProvisioningLayout<FeaturePackLayout> layout = pmSession.getLayoutFactory().newConfigLayout(config)) {
layout.uninstall(pmSession.getResolvedLocation(getInstallationDirectory(pmSession.getAeshContext()), fpid).getFPID());
Set<ProvisioningOption> opts = PluginResolver.newResolver(pmSession, layout).resolve().getInstall();
List<DynamicOption> options = new ArrayList<>();
for (ProvisioningOption opt : opts) {
DynamicOption dynOption = new DynamicOption(opt.getName(), opt.isRequired());
options.add(dynOption);
}
return options;
}
} finally {
pmSession.registerTrackers();
}
} else {
return Collections.emptyList();
}
}
use of org.jboss.galleon.layout.FeaturePackLayout in project galleon by wildfly.
the class BasicPatchLayoutTestCase method assertLayout.
@Override
protected void assertLayout(ProvisioningLayout<FeaturePackLayout> layout) throws Exception {
final List<FeaturePackLayout> featurePacks = layout.getOrderedFeaturePacks();
assertEquals(3, featurePacks.size());
FeaturePackLayout fp = featurePacks.get(0);
assertEquals(fp1.getFPID(), fp.getFPID());
assertTrue(fp.isTransitiveDep());
fp = featurePacks.get(1);
assertEquals(fp2.getFPID(), fp.getFPID());
assertTrue(fp.isDirectDep());
fp = featurePacks.get(2);
assertEquals(fp3.getFPID(), fp.getFPID());
assertTrue(fp.isDirectDep());
List<FeaturePackLayout> patches = layout.getPatches(fp1.getFPID());
assertEquals(2, patches.size());
fp = patches.get(0);
assertEquals(fp1Patch1.getFPID(), fp.getFPID());
assertTrue(fp.isPatch());
fp = patches.get(1);
assertEquals(fp1Patch2.getFPID(), fp.getFPID());
assertTrue(fp.isPatch());
patches = layout.getPatches(fp2.getFPID());
assertEquals(2, patches.size());
assertEquals(fp2Patch1.getFPID(), patches.get(0).getFPID());
assertEquals(fp2Patch2.getFPID(), patches.get(1).getFPID());
patches = layout.getPatches(fp3.getFPID());
assertEquals(0, patches.size());
}
Aggregations