use of org.jboss.as.patching.DirectoryStructure in project wildfly-core by wildfly.
the class PatchStepAssertions method assertNotApplied.
static void assertNotApplied(final Patch.PatchType patchType, final String patchId, final PatchableTarget.TargetInfo targetInfo) {
if (patchType == Patch.PatchType.CUMULATIVE) {
Assert.assertNotEquals(patchId, targetInfo.getCumulativePatchID());
} else {
Assert.assertFalse(targetInfo.getPatchIDs().contains(patchId));
}
final DirectoryStructure structure = targetInfo.getDirectoryStructure();
assertDoesNotExists(structure.getBundlesPatchDirectory(patchId));
assertDoesNotExists(structure.getModulePatchDirectory(patchId));
}
use of org.jboss.as.patching.DirectoryStructure in project wildfly-core by wildfly.
the class PatchStepAssertions method assertIsApplied.
static void assertIsApplied(final Patch.PatchType patchType, final String patchId, final PatchableTarget.TargetInfo targetInfo) {
if (patchType == Patch.PatchType.CUMULATIVE) {
Assert.assertEquals(patchId, targetInfo.getCumulativePatchID());
Assert.assertTrue(targetInfo.getPatchIDs().isEmpty());
} else {
Assert.assertTrue(targetInfo.getPatchIDs().contains(patchId));
}
final DirectoryStructure structure = targetInfo.getDirectoryStructure();
assertExists(structure.getBundlesPatchDirectory(patchId));
assertExists(structure.getModulePatchDirectory(patchId));
}
use of org.jboss.as.patching.DirectoryStructure in project wildfly-core by wildfly.
the class PatchingOverlayDirArtifact method process.
@Override
public boolean process(PatchableTargetsArtifact.PatchableTargetState parent, PatchingArtifactProcessor processor) {
if (bundles && !parent.isCheckBundles()) {
return true;
} else if (!parent.isCheckModules()) {
return true;
}
final String patchID = parent.getPatchID();
final DirectoryStructure structure = parent.getStructure();
final File overlay = bundles ? structure.getBundlesPatchDirectory(patchID) : structure.getModulePatchDirectory(patchID);
final PatchingFileArtifact.DirectoryArtifactState state = new PatchingFileArtifact.DirectoryArtifactState(overlay, this);
return processor.process(this, state);
}
use of org.jboss.as.patching.DirectoryStructure in project wildfly-core by wildfly.
the class AddOnTestCase method installedAddOn.
@Test
public void installedAddOn() throws Exception {
String addOnName = randomString();
installAddOn(env.getModuleRoot(), addOnName);
TestUtils.tree(env.getInstalledImage().getJbossHome());
InstalledIdentity installedIdentity = loadInstalledIdentity();
Collection<AddOn> addOns = installedIdentity.getAddOns();
assertEquals(1, addOns.size());
AddOn addOn = addOns.iterator().next();
assertEquals(addOnName, addOn.getName());
PatchableTarget.TargetInfo targetInfo = addOn.loadTargetInfo();
assertEquals(BASE, targetInfo.getCumulativePatchID());
assertTrue(targetInfo.getPatchIDs().isEmpty());
DirectoryStructure directoryStructure = targetInfo.getDirectoryStructure();
assertEquals(newFile(env.getModuleRoot(), "system", ADD_ONS, addOnName), directoryStructure.getModuleRoot());
assertNull(directoryStructure.getBundleRepositoryRoot());
}
use of org.jboss.as.patching.DirectoryStructure in project wildfly-core by wildfly.
the class LayerTestCase method patchLayer.
@Test
public void patchLayer() throws Exception {
// add a layer
// randomString();
String layerName = "mylayer";
installLayers(layerName);
InstalledIdentity installedIdentity = loadInstalledIdentity();
// build a one-off patch for the layer with 1 added module
// and 1 add file
String patchID = randomString();
File patchDir = mkdir(tempDir, patchID);
// randomString();
String layerPatchId = "mylayerPatchID";
String moduleName = randomString();
ContentModification moduleAdded = ContentModificationUtils.addModule(patchDir, layerPatchId, moduleName);
ContentModification fileAdded = ContentModificationUtils.addMisc(patchDir, patchID, "new file resource", "bin", "my-new-standalone.sh");
Patch patch = PatchBuilder.create().setPatchId(patchID).oneOffPatchIdentity(installedIdentity.getIdentity().getName(), installedIdentity.getIdentity().getVersion()).getParent().oneOffPatchElement(layerPatchId, layerName, false).addContentModification(moduleAdded).getParent().addContentModification(fileAdded).build();
createPatchXMLFile(patchDir, patch);
File zippedPatch = createZippedPatchFile(patchDir, patchID);
// apply patch
PatchingResult result = executePatch(zippedPatch);
assertPatchHasBeenApplied(result, patch);
InstalledIdentity patchedInstalledIdentity = loadInstalledIdentity();
assertInstallationIsPatched(patch, patchedInstalledIdentity.getIdentity().loadTargetInfo());
assertFileExists(env.getInstalledImage().getJbossHome(), "bin", fileAdded.getItem().getName());
DirectoryStructure layerDirStructure = installedIdentity.getLayers().get(0).loadTargetInfo().getDirectoryStructure();
File modulesPatchDir = layerDirStructure.getModulePatchDirectory(layerPatchId);
assertDirExists(modulesPatchDir);
assertDefinedModule(modulesPatchDir, moduleName, moduleAdded.getItem().getContentHash());
}
Aggregations