/** * Validate the consistency of patches to the point we rollback. * * @param patchID the patch id which gets rolled back * @param identity the installed identity * @throws PatchingException */ public static void validateRollbackState(final String patchID, final InstalledIdentity identity) throws PatchingException { final Set<String> validHistory = processRollbackState(patchID, identity); if (patchID != null && !validHistory.contains(patchID)) { throw PatchLogger.ROOT_LOGGER.patchNotFoundInHistory(patchID); } }
protected void cannotRollbackPatch(final String patchID) throws Exception { try { validateRollbackState(patchID, updateInstallationManager().getDefaultIdentity()); Assert.fail("should not be able to rollback " + patchID); } catch (PatchingException e) { // ok } catch (Exception e) { throw e; } }
validateRollbackState(patchId, modification.getUnmodifiedInstallationState()); } catch (PatchingException e) { throw e;
@Test public void testSimpleValidRollbackOneOff() throws Exception { installOneOff(); validateRollbackState(ONE_OFF_1_ID, updateInstallationManager().getDefaultIdentity()); }
/** * Validate the consistency of patches to the point we rollback. * * @param patchID the patch id which gets rolled back * @param identity the installed identity * @throws PatchingException */ public static void validateRollbackState(final String patchID, final InstalledIdentity identity) throws PatchingException { final Set<String> validHistory = processRollbackState(patchID, identity); if (patchID != null && !validHistory.contains(patchID)) { throw PatchLogger.ROOT_LOGGER.patchNotFoundInHistory(patchID); } }
validateRollbackState(patchId, modification.getUnmodifiedInstallationState()); } catch (PatchingException e) { throw e;
@Test public void testMissingHistoryOneOff() throws Exception { final PatchingTestBuilder builder = installOneOffCpOneOff(); // Can rollback incl. the first one off validateRollbackState(ONE_OFF_1_ID, updateInstallationManager().getDefaultIdentity()); // Remove one off history final File oneOffHistory = getHistory(builder, ONE_OFF_1_ID); IoUtils.recursiveDelete(oneOffHistory); cannotRollbackPatch(ONE_OFF_1_ID); // Can rollback CP1 validateRollbackState(CP_1_ID, updateInstallationManager().getDefaultIdentity()); // Remove cp1 history final File cpHistory = getHistory(builder, CP_1_ID); IoUtils.recursiveDelete(cpHistory); cannotRollbackPatch(CP_1_ID); // Could still rollback 2nd one off validateRollbackState(ONE_OFF_2_ID, updateInstallationManager().getDefaultIdentity()); }
@Test public void testMissingOverlay() throws Exception { final PatchingTestBuilder builder = installOneOffCpOneOff(); // Can rollback incl. the first one off validateRollbackState(ONE_OFF_1_ID, updateInstallationManager().getDefaultIdentity()); final File overlays = getOverlays(builder, "base", "base-" + ONE_OFF_1_ID); IoUtils.recursiveDelete(overlays); cannotRollbackPatch(ONE_OFF_1_ID); cannotRollbackPatch(CP_1_ID); }
try { validateRollbackState(invalidation.get(invalidation.size() - 1), modification.getUnmodifiedInstallationState()); } catch (PatchingException e) {
try { validateRollbackState(invalidation.get(invalidation.size() - 1), modification.getUnmodifiedInstallationState()); } catch (PatchingException e) {