Search in sources :

Example 1 with InstallationManagerImpl

use of org.jboss.as.patching.installation.InstallationManagerImpl in project wildfly-core by wildfly.

the class AbstractPatchingTest method apply.

protected PatchingResult apply(final PatchingTestStepBuilder builder, final ContentVerificationPolicy verificationPolicy, final PatchStepAssertions assertions) throws PatchingException {
    final Patch patch = builder.build();
    final File installation = new File(tempDir, JBOSS_INSTALLATION);
    try {
        assertions.before(installation, patch, installationManager);
    } catch (IOException e) {
        throw new PatchingException(e);
    }
    // Write patch
    writePatch(builder.getPatchDir(), patch);
    // Create the patch tool and apply the patch
    final PatchTool patchTool = PatchTool.Factory.create(installationManager);
    final PatchingResult result = patchTool.applyPatch(builder.getPatchDir(), verificationPolicy);
    result.commit();
    final InstalledIdentity identity = ((InstallationManagerImpl) installationManager).getInstalledIdentity(patch.getIdentity().getName(), null);
    Assert.assertTrue(identity.getAllInstalledPatches().contains(patch.getPatchId()));
    try {
        assertions.after(installation, patch, installationManager);
    } catch (IOException e) {
        throw new PatchingException(e);
    }
    return result;
}
Also used : InstalledIdentity(org.jboss.as.patching.installation.InstalledIdentity) PatchingException(org.jboss.as.patching.PatchingException) PatchingResult(org.jboss.as.patching.tool.PatchingResult) InstallationManagerImpl(org.jboss.as.patching.installation.InstallationManagerImpl) PatchTool(org.jboss.as.patching.tool.PatchTool) IOException(java.io.IOException) Patch(org.jboss.as.patching.metadata.Patch) File(java.io.File)

Aggregations

File (java.io.File)1 IOException (java.io.IOException)1 PatchingException (org.jboss.as.patching.PatchingException)1 InstallationManagerImpl (org.jboss.as.patching.installation.InstallationManagerImpl)1 InstalledIdentity (org.jboss.as.patching.installation.InstalledIdentity)1 Patch (org.jboss.as.patching.metadata.Patch)1 PatchTool (org.jboss.as.patching.tool.PatchTool)1 PatchingResult (org.jboss.as.patching.tool.PatchingResult)1