Search in sources :

Example 1 with PatchElementBuilder

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();
}
Also used : PatchBuilder(org.jboss.as.patching.metadata.PatchBuilder) PatchElementBuilder(org.jboss.as.patching.metadata.PatchElementBuilder)

Aggregations

PatchBuilder (org.jboss.as.patching.metadata.PatchBuilder)1 PatchElementBuilder (org.jboss.as.patching.metadata.PatchElementBuilder)1