ContentModification fileModified = ContentModificationUtils.modifyMisc(patchDir, patchID, "updated script", standaloneShellFile, "bin", "standalone.sh"); InstalledIdentity installedIdentity = loadInstalledIdentity(); File zippedPatch = createZippedPatchFile(patchDir, patchID); Identity identityBeforePatch = loadInstalledIdentity().getIdentity(); PatchingResult result = executePatch(zippedPatch); assertPatchHasBeenApplied(result, patch); assertFileContent(fileModified.getItem().getContentHash(), standaloneShellFile); InstalledIdentity updatedInstalledIdentity = loadInstalledIdentity(); File modulePatchDirectory = updatedInstalledIdentity.getLayers().get(0).loadTargetInfo().getDirectoryStructure().getModulePatchDirectory(layerPatchID); assertDirExists(modulePatchDirectory); PatchingResult rollbackResult = rollback(patchID);
@Test public void testApplyReleasePatch() throws Exception { // build a Release patch for the base installation // with 1 added module String patchID = randomString(); String layerPatchID = randomString(); File patchDir = mkdir(tempDir, patchID); String moduleName = randomString(); ContentModification moduleAdded = ContentModificationUtils.addModule(patchDir, layerPatchID, moduleName); InstalledIdentity installedIdentity = loadInstalledIdentity(); Patch patch = PatchBuilder.create() .setPatchId(patchID) .setDescription(randomString()) .upgradeIdentity(installedIdentity.getIdentity().getName(), installedIdentity.getIdentity().getVersion(), productConfig.getProductVersion() + "-Release1") .getParent() .upgradeElement(layerPatchID, BASE, false) .addContentModification(moduleAdded) .getParent() .build(); createPatchXMLFile(patchDir, patch); File zippedPatch = createZippedPatchFile(patchDir, patchID); PatchingResult result = executePatch(zippedPatch); assertPatchHasBeenApplied(result, patch); InstalledIdentity updatedInstalledIdentity = loadInstalledIdentity(); File modulePatchDirectory = updatedInstalledIdentity.getLayers().get(0).loadTargetInfo().getDirectoryStructure().getModulePatchDirectory(layerPatchID); assertDirExists(modulePatchDirectory); assertDefinedModule(modulePatchDirectory, moduleName, moduleAdded.getItem().getContentHash()); }
InstalledIdentity installedIdentity = loadInstalledIdentity(); final String resultingVersion = productConfig.getProductVersion() + "-Release1"; Patch releasePatch = PatchBuilder.create() File zippedReleasePatch = createZippedPatchFile(releasePatchDir, releasePatchID); PatchingResult resultOfReleasePatch = executePatch(zippedReleasePatch); assertPatchHasBeenApplied(resultOfReleasePatch, releasePatch); InstalledIdentity updatedInstalledIdentity = loadInstalledIdentity(); File zippedOneOffPatch = createZippedPatchFile(oneOffPatchDir, oneOffPatchID); PatchingResult resultOfOneOffPatch = executePatch(zippedOneOffPatch); assertPatchHasBeenApplied(resultOfOneOffPatch, oneOffPatch); InstalledIdentity installedIdentityAfterOneOffPatch = loadInstalledIdentity(); modulePatchDirectory = installedIdentityAfterOneOffPatch.getLayers().get(0).loadTargetInfo().getDirectoryStructure().getModulePatchDirectory(oneOffLayerPatchID); assertDirExists(modulePatchDirectory);
InstalledIdentity identityBeforePatch = loadInstalledIdentity(); final String resultingVersion = identityBeforePatch.getIdentity().getVersion() + "-Release1"; Patch releasePatch = PatchBuilder.create() File zippedReleasePatch = createZippedPatchFile(releasePatchDir, releasePatchID); PatchingResult resultOfReleasePatch = executePatch(zippedReleasePatch); assertPatchHasBeenApplied(resultOfReleasePatch, releasePatch); InstalledIdentity updatedInstalledIdentity = loadInstalledIdentity(); File modulePatchDirectory = updatedInstalledIdentity.getLayers().get(0).loadTargetInfo().getDirectoryStructure().getModulePatchDirectory(releaseLayerPatchID); assertDirExists(modulePatchDirectory); File zippedOneOffPatch = createZippedPatchFile(oneOffPatchDir, oneOffPatchID); PatchingResult resultOfOneOffPatch = executePatch(zippedOneOffPatch); assertPatchHasBeenApplied(resultOfOneOffPatch, oneOffPatch); InstalledIdentity installedIdentityAfterOneOffPatch = loadInstalledIdentity(); modulePatchDirectory = installedIdentityAfterOneOffPatch.getLayers().get(0).loadTargetInfo().getDirectoryStructure().getModulePatchDirectory(oneOffLayerPatchID); assertDirExists(modulePatchDirectory); PatchingResult resultOfReleasePatchRollback = rollback(releasePatchID); updatedInstalledIdentity = loadInstalledIdentity(); File layerModuleRoot = updatedInstalledIdentity.getLayers().get(0).loadTargetInfo().getDirectoryStructure().getModuleRoot(); assertDirDoesNotExist(newFile(layerModuleRoot, moduleName));
InstalledIdentity identityBeforePatch = loadInstalledIdentity(); File zippedOneOffPatch = createZippedPatchFile(oneOffPatchDir, oneOffPatchID); PatchingResult resultOfOneOffPatch = executePatch(zippedOneOffPatch); assertPatchHasBeenApplied(resultOfOneOffPatch, oneOffPatch); InstalledIdentity installedIdentityAfterOneOffPatch = loadInstalledIdentity(); File modulePatchDirectory = installedIdentityAfterOneOffPatch.getLayers().get(0).loadTargetInfo().getDirectoryStructure().getModulePatchDirectory(oneOffLayerPatchID); assertDirExists(modulePatchDirectory); File zippedReleasePatch = createZippedPatchFile(releasePatchDir, releasePatchID); PatchingResult resultOfReleasePatch = executePatch(zippedReleasePatch); assertPatchHasBeenApplied(resultOfReleasePatch, releasePatch);