use of org.jboss.as.patching.metadata.PatchElementBuilder in project wildfly-core by wildfly.
the class MergingPatchMetadataTestCase method generateCP.
protected Patch generateCP(final String currentCP, final String nextCP, ModificationType type) {
final PatchBuilder patchBuilder = PatchBuilder.create().setPatchId(nextCP).setDescription(nextCP + " description");
patchBuilder.upgradeIdentity("identity", currentCP, nextCP);
final PatchElementBuilder elementBuilder = patchBuilder.upgradeElement("base-" + nextCP, "base", false);
if (ModificationType.ADD.equals(type)) {
elementBuilder.addModule("org.jboss.test", "main", moduleHash(nextCP)).addBundle("org.jboss.test", "main", bundleHash(nextCP)).addFile("test.txt", Arrays.asList(new String[] { "org", "jboss", "test" }), miscHash(nextCP), false);
} else if (ModificationType.MODIFY.equals(type)) {
elementBuilder.modifyModule("org.jboss.test", "main", moduleHash(currentCP), moduleHash(nextCP)).modifyBundle("org.jboss.test", "main", bundleHash(currentCP), bundleHash(nextCP)).modifyFile("test.txt", Arrays.asList(new String[] { "org", "jboss", "test" }), miscHash(currentCP), miscHash(nextCP), false);
} else {
elementBuilder.removeModule("org.jboss.test", "main", moduleHash(currentCP)).removeBundle("org.jboss.test", "main", bundleHash(currentCP)).removeFile("test.txt", Arrays.asList(new String[] { "org", "jboss", "test" }), miscHash(currentCP), false);
}
return patchBuilder.build();
}
Aggregations