Search in sources :

Example 1 with HashUtils.hashFile

use of org.jboss.as.patching.HashUtils.hashFile in project wildfly-core by wildfly.

the class MergingPatchContentTestCase method prepareCP3.

private void prepareCP3(final InstalledIdentity installedIdentity) throws IOException, Exception {
    final String cp3ID = "CP3";
    final File cp3Dir = mkdir(tempDir, cp3ID);
    cp3StandaloneModified = ContentModificationUtils.modifyMisc(cp3Dir, cp3ID, "updated by cp3", standaloneSh, "bin", standaloneSh.getName());
    cp3BaseModuleModified = ContentModificationUtils.modifyModule(cp3Dir, baseCP3ID, moduleName, cp2BaseModuleModified.getItem().getContentHash(), "cp3 content");
    // cp3BaseModule2Added = ContentModificationUtils.addModule(cp3Dir, baseCP3ID, moduleName + "2"); the patchgen tool
    // would generate an update instead
    final File absentModuleXml = IoUtils.newFile(installedIdentity.getLayer("base").loadTargetInfo().getDirectoryStructure().getModulePatchDirectory(baseCP2ID), "org", "jboss", "test2", "main", "module.xml");
    cp3BaseModule2Added = ContentModificationUtils.modifyModule(cp3Dir, baseCP3ID, moduleName + "2", HashUtils.hashFile(absentModuleXml), "cp3 content");
    final ContentModification cp3AddedByCP1RemovedByCP3Removed = ContentModificationUtils.removeMisc(addedByCP1RemovedByCP3, "bin", addedByCP1RemovedByCP3.getName());
    cp3 = PatchBuilder.create().setPatchId(cp3ID).setDescription(randomString()).upgradeIdentity(installedIdentity.getIdentity().getName(), productConfig.getProductVersion() + "_CP2", productConfig.getProductVersion() + "_CP3").getParent().upgradeElement(baseCP3ID, BASE, false).addContentModification(cp3BaseModuleModified).addContentModification(cp3BaseModule2Added).getParent().addContentModification(cp3StandaloneModified).addContentModification(cp3AddedByCP1RemovedByCP3Removed).build();
    createPatchXMLFile(cp3Dir, cp3);
    cp3Zip = createZippedPatchFile(cp3Dir, cp3ID);
}
Also used : TestUtils.randomString(org.jboss.as.patching.runner.TestUtils.randomString) TestUtils.createPatchXMLFile(org.jboss.as.patching.runner.TestUtils.createPatchXMLFile) HashUtils.hashFile(org.jboss.as.patching.HashUtils.hashFile) File(java.io.File) TestUtils.createZippedPatchFile(org.jboss.as.patching.runner.TestUtils.createZippedPatchFile) ContentModification(org.jboss.as.patching.metadata.ContentModification)

Aggregations

File (java.io.File)1 HashUtils.hashFile (org.jboss.as.patching.HashUtils.hashFile)1 ContentModification (org.jboss.as.patching.metadata.ContentModification)1 TestUtils.createPatchXMLFile (org.jboss.as.patching.runner.TestUtils.createPatchXMLFile)1 TestUtils.createZippedPatchFile (org.jboss.as.patching.runner.TestUtils.createZippedPatchFile)1 TestUtils.randomString (org.jboss.as.patching.runner.TestUtils.randomString)1