public static ContentModification addMisc(File patchDir, String patchElementID, String content, String... fileSegments) throws IOException { return addMisc(patchDir, patchElementID, content, fileSegments, null); }
public T addFile(byte[] resultingHash, final String content, String[] path, String[] requiredPath) throws IOException { final ContentModification modification = ContentModificationUtils.addMisc(getPatchDir(), getPatchId(), content, path, requiredPath); return addContentModification(modification, resultingHash); }
cp1Layer2Module2Added = ContentModificationUtils.addModule(cp1Dir, layer2CP1ID, moduleName + "2"); cp1StandaloneModified = ContentModificationUtils.modifyMisc(cp1Dir, cp1ID, "updated by cp1", standaloneSh, "bin", standaloneSh.getName()); cp1AddedByCP1Added = ContentModificationUtils.addMisc(cp1Dir, cp1ID, "added by cp1", "bin", addedByCP1.getName()); final ContentModification cp1AddedByCP1RemovedByCP3Added = ContentModificationUtils.addMisc(cp1Dir, cp1ID, "added by cp1", "bin", addedByCP1RemovedByCP3.getName());
@Test public void testWrongMiscContent() throws Exception { final PatchingTestBuilder builder = createDefaultBuilder(); ContentModificationUtils.addMisc(builder.getRoot(), "oo2", "test-content", "wrong-content"); final MiscContentItem item = new MiscContentItem("wrong-content", new String[0], WRONG_HASH); final ContentModification wrongModification = new ContentModification(item, IoUtils.NO_CONTENT, ModificationType.ADD); final PatchingTestStepBuilder step1 = builder.createStepBuilder(); step1.oneOffPatchIdentity(PRODUCT_VERSION) .setPatchId("oo2") .oneOffPatchElement("base-patch-002", "base", false) .addModuleWithRandomContent("other.test", null) .getParent() .addFileWithRandomContent(null, "test", "content") .addContentModification(wrongModification) ; // try { apply(step1); Assert.fail("should have failed"); } catch (PatchingException e) { Assert.assertFalse(builder.hasFile("test", "content")); Assert.assertFalse(builder.hasFile("wrong-content")); final InstalledIdentity identity = loadInstallationManager().getDefaultIdentity(); final PatchableTarget base = identity.getLayer("base"); Assert.assertFalse(base.getDirectoryStructure().getModulePatchDirectory("base-patch-002").exists()); Assert.assertFalse(identity.getInstalledImage().getPatchHistoryDir("oo2").exists()); } }
cp2AddedByCp2Added = ContentModificationUtils.addMisc(cp2Dir, cp2ID, "added by cp2", "bin", addedByCP2.getName());
@Test public void testAddFile() throws Exception { // build a one-off patch for the base installation // with 1 added file String patchID = randomString(); File patchDir = mkdir(tempDir, patchID); ContentModification fileAdded = ContentModificationUtils.addMisc(patchDir, patchID, "new file resource", "bin", "my-new-standalone.sh"); Patch patch = PatchBuilder.create() .setPatchId(patchID) .setDescription(randomString()) .oneOffPatchIdentity(productConfig.getProductName(), productConfig.getProductVersion()) .getParent() .addContentModification(fileAdded) .build(); assertFileDoesNotExist(env.getInstalledImage().getJbossHome(), "bin", fileAdded.getItem().getName()); createPatchXMLFile(patchDir, patch); File zippedPatch = createZippedPatchFile(patchDir, patch.getPatchId()); PatchingResult result = executePatch(zippedPatch); assertPatchHasBeenApplied(result, patch); assertFileExists(env.getInstalledImage().getJbossHome(), "bin", fileAdded.getItem().getName()); }
final PatchingTestBuilder builder = createDefaultBuilder(); ContentModificationUtils.addMisc(builder.getRoot(), "oo2", "test-content", "wrong-content"); final MiscContentItem item = new MiscContentItem("wrong-content", new String[0], WRONG_HASH); final ContentModification wrongModification = new ContentModification(item, IoUtils.NO_CONTENT, ModificationType.ADD);
String moduleName = randomString(); ContentModification moduleAdded = ContentModificationUtils.addModule(patchDir, addOnPatchID, moduleName); ContentModification fileAdded = ContentModificationUtils.addMisc(patchDir, patchID, "new file resource", "bin", "my-new-standalone.sh");
String moduleName = randomString(); ContentModification moduleAdded = ContentModificationUtils.addModule(patchDir, layerPatchId, moduleName); ContentModification fileAdded = ContentModificationUtils.addMisc(patchDir, patchID, "new file resource", "bin", "my-new-standalone.sh");
String moduleName = randomString(); ContentModification moduleAdded = ContentModificationUtils.addModule(patchDir, addOnPatchID, moduleName); ContentModification fileAdded = ContentModificationUtils.addMisc(patchDir, patchID, "new file resource", "bin", "my-new-standalone.sh");
String moduleName = randomString(); ContentModification moduleAdded = ContentModificationUtils.addModule(patchDir, layerPatchId, moduleName); ContentModification fileAdded = ContentModificationUtils.addMisc(patchDir, patchID, "new file resource", "bin", "my-new-standalone.sh");
String moduleName = randomString(); ContentModification moduleAdded = ContentModificationUtils.addModule(patchDir, layerPatchId, moduleName); ContentModification fileAdded = ContentModificationUtils.addMisc(patchDir, patchID, "new file resource", "bin", "my-new-standalone.sh");