@Override public void handleResult(OperationContext.ResultAction resultAction, OperationContext context, ModelNode operation) { if(resultAction == OperationContext.ResultAction.KEEP) { result.commit(); } else { installationManager.clearRestartRequired(); context.revertRestartRequired(); result.rollback(); } } });
@Override public PatchInfo getPatchInfo() { return last.getPatchInfo(); }
@Override public String getPatchId() { return last.getPatchId(); }
@Override public void commit() { last.commit(); }
final PatchTool patchTool = PatchTool.Factory.create(mgr); final PatchingResult result = patchTool.applyPatch(multiPatch, ContentVerificationPolicy.STRICT); result.rollback();
@Override public void commit() { last.commit(); }
@Override public void handleResult(OperationContext.ResultAction resultAction, OperationContext context, ModelNode operation) { if (resultAction == OperationContext.ResultAction.KEEP) { result.commit(); } else { installationManager.clearRestartRequired(); context.revertRestartRequired(); result.rollback(); } }
@Override protected ModelNode applyPatch(final File file, final ContentPolicyBuilderImpl builder) { final ContentVerificationPolicy policy = builder.createPolicy(); ModelNode result = new ModelNode(); try { PatchingResult apply = tool.applyPatch(file, policy); apply.commit(); result.get(OUTCOME).set(SUCCESS); result.get(RESULT).setEmptyObject(); } catch (PatchingException e) { return formatFailedResponse(e); } return result; }
@Override public PatchInfo getPatchInfo() { return last.getPatchInfo(); }
@Override public String getPatchId() { return last.getPatchId(); }
@Override public void handleResult(OperationContext.ResultAction resultAction, OperationContext context, ModelNode operation) { if(resultAction == OperationContext.ResultAction.KEEP) { result.commit(); } else { installationManager.clearRestartRequired(); context.revertRestartRequired(); result.rollback(); } }
@Override protected ModelNode rollback(final String streamName, final String patchId, final ContentPolicyBuilderImpl builder, boolean rollbackTo, boolean resetConfiguration) { final ContentVerificationPolicy policy = builder.createPolicy(); ModelNode result = new ModelNode(); try { PatchingResult rollback = tool.rollback(streamName, patchId, policy, rollbackTo, resetConfiguration); rollback.commit(); result.get(OUTCOME).set(SUCCESS); result.get(RESULT).setEmptyObject(); } catch (PatchingException e) { return formatFailedResponse(e); } return result; }
public static void assertPatchHasBeenRolledBack(PatchingResult result, Patch patch, PatchInfo expectedPatchInfo) { assertEquals(expectedPatchInfo.getVersion(), result.getPatchInfo().getVersion()); assertEquals(expectedPatchInfo.getCumulativePatchID(), result.getPatchInfo().getCumulativePatchID()); assertEquals(expectedPatchInfo.getPatchIDs(), result.getPatchInfo().getPatchIDs()); // assertNoResourcesForPatch(result.getPatchInfo(), patch); }
@Override public void handleResult(OperationContext.ResultAction resultAction, OperationContext context, ModelNode operation) { if(resultAction == OperationContext.ResultAction.KEEP) { result.commit(); } else { installationManager.clearRestartRequired(); context.revertRestartRequired(); result.rollback(); } }
@Override protected ModelNode rollbackLast(final String streamName, final ContentPolicyBuilderImpl builder, boolean restoreConfiguration) { final ContentVerificationPolicy policy = builder.createPolicy(); ModelNode result = new ModelNode(); try { PatchingResult rollback = tool.rollbackLast(streamName, policy, restoreConfiguration); rollback.commit(); result.get(OUTCOME).set(SUCCESS); result.get(RESULT).setEmptyObject(); } catch (PatchingException e) { return formatFailedResponse(e); } return result; }
public static void assertPatchHasBeenRolledBack(PatchingResult result, Patch patch, PatchableTarget.TargetInfo expectedPatchInfo) { assertEquals(expectedPatchInfo.getCumulativePatchID(), result.getPatchInfo().getCumulativePatchID()); assertEquals(expectedPatchInfo.getPatchIDs(), result.getPatchInfo().getPatchIDs()); // assertNoResourcesForPatch(result.getPatchInfo(), patch); }
@Override public void handleResult(OperationContext.ResultAction resultAction, OperationContext context, ModelNode operation) { if(resultAction == OperationContext.ResultAction.KEEP) { result.commit(); } else { installationManager.clearRestartRequired(); context.revertRestartRequired(); result.rollback(); } } });
@Override protected ModelNode rollback(final String streamName, final String patchId, final ContentPolicyBuilderImpl builder, boolean rollbackTo, boolean resetConfiguration) { final ContentVerificationPolicy policy = builder.createPolicy(); ModelNode result = new ModelNode(); try { PatchingResult rollback = tool.rollback(streamName, patchId, policy, rollbackTo, resetConfiguration); rollback.commit(); result.get(OUTCOME).set(SUCCESS); result.get(RESULT).setEmptyObject(); } catch (PatchingException e) { return formatFailedResponse(e); } return result; }
public static void assertPatchHasBeenApplied(PatchingResult result, Patch patch) { if (CUMULATIVE == patch.getIdentity().getPatchType()) { assertEquals(patch.getPatchId(), result.getPatchInfo().getCumulativePatchID()); assertTrue(result.getPatchInfo().getPatchIDs().isEmpty()); assertEquals(patch.getIdentity().forType(CUMULATIVE, org.jboss.as.patching.metadata.Identity.IdentityUpgrade.class).getResultingVersion(), result.getPatchInfo().getVersion()); } else { assertTrue(result.getPatchInfo().getPatchIDs().contains(patch.getPatchId())); // applied one-off patch is at the top of the patchIDs assertEquals(patch.getPatchId(), result.getPatchInfo().getPatchIDs().get(0)); } }
@Override public void handleResult(OperationContext.ResultAction resultAction, OperationContext context, ModelNode operation) { if (resultAction == OperationContext.ResultAction.KEEP) { result.commit(); } else { installationManager.clearRestartRequired(); context.revertRestartRequired(); result.rollback(); } }