private static List<File> getModulePath(final InstalledImage image) { final Set<File> path = new LinkedHashSet<>(); final String modulePath = SecurityActions.getSystemProperty(MODULE_PATH, SecurityActions.getEnv("JAVA_MODULEPATH")); if (modulePath != null) { final String[] paths = modulePath.split(Pattern.quote(File.pathSeparator)); for (final String s : paths) { final File file = new File(s); path.add(file); } } else { path.add(image.getModulesDir()); } return new ArrayList<>(path); }
private static List<File> getModulePath(final InstalledImage image) { final Set<File> path = new LinkedHashSet<>(); final String modulePath = SecurityActions.getSystemProperty(MODULE_PATH, SecurityActions.getEnv("JAVA_MODULEPATH")); if (modulePath != null) { final String[] paths = modulePath.split(Pattern.quote(File.pathSeparator)); for (final String s : paths) { final File file = new File(s); path.add(file); } } else { path.add(image.getModulesDir()); } return new ArrayList<>(path); }
@Override public File getModuleRoot() { return getInstalledImage().getModulesDir(); } }
private InstallationManager loadInstallationManager() throws IOException { List<File> moduleRoots = new ArrayList<File>(); moduleRoots.add(env.getInstalledImage().getModulesDir()); List<File> bundleRoots = new ArrayList<File>(); bundleRoots.add(env.getInstalledImage().getBundlesDir()); return new InstallationManagerImpl(env.getInstalledImage(), moduleRoots, bundleRoots, productConfig); }
final File modulesDir = newFile(env.getInstalledImage().getModulesDir(), SYSTEM, LAYERS, BASE); if(!modulesDir.exists()) { modulesDir.mkdirs();
File baseModuleDir = newFile(env.getInstalledImage().getModulesDir(), SYSTEM, LAYERS, BASE); String moduleName = "module-test"; File moduleDir = createModule0(baseModuleDir, moduleName);
File baseModuleDir = newFile(env.getInstalledImage().getModulesDir(), SYSTEM, LAYERS, BASE); String moduleName = "module-test"; File moduleDir = createModule0(baseModuleDir, moduleName);
File baseModuleDir = newFile(env.getInstalledImage().getModulesDir(), SYSTEM, LAYERS, BASE); String moduleName = "module-test"; File moduleDir = createModule0(baseModuleDir, moduleName);
File baseModuleDir = newFile(env.getInstalledImage().getModulesDir(), SYSTEM, LAYERS, BASE); String moduleConflictName = "module-conflict"; File moduleConflictDir = createModule0(baseModuleDir, moduleConflictName);
File baseModuleDir = newFile(env.getInstalledImage().getModulesDir(), SYSTEM, LAYERS, BASE); String moduleConflictName = "module-conflict"; File moduleConflictDir = createModule0(baseModuleDir, moduleConflictName);
@Test public void testRemoveModule() throws Exception { String moduleName = randomString(); // create an empty module in the AS7 installation File baseModuleDir = newFile(env.getInstalledImage().getModulesDir(), SYSTEM, LAYERS, BASE); File moduleDir = createModule0(baseModuleDir, moduleName); // build a one-off patch for the installation base layer // with 1 module removed String baseLayerPatchID = randomString(); Patch patch = PatchBuilder.create() .setPatchId(randomString()) .setDescription(randomString()) .oneOffPatchIdentity(productConfig.getProductName(), productConfig.getProductVersion()) .getParent() .oneOffPatchElement(baseLayerPatchID, BASE, false) .addContentModification(ContentModificationUtils.removeModule(moduleDir)) .getParent() .build(); // create the patch File patchDir = mkdir(tempDir, patch.getPatchId()); createPatchXMLFile(patchDir, patch); File zippedPatch = createZippedPatchFile(patchDir, patch.getPatchId()); PatchingResult result = executePatch(zippedPatch); assertPatchHasBeenApplied(result, patch); InstalledIdentity installedIdentity = loadInstalledIdentity(); File modulesPatchDir = installedIdentity.getLayers().get(0).loadTargetInfo().getDirectoryStructure().getModulePatchDirectory(baseLayerPatchID); assertDirExists(modulesPatchDir); assertDefinedAbsentModule(modulesPatchDir, moduleName); }
assertPatchHasBeenApplied(patchResult, patch); InstalledIdentity patchedInstalledIdentity = InstalledIdentity.load(env.getInstalledImage().getJbossHome(), productConfig, env.getInstalledImage().getModulesDir()); assertInstallationIsPatched(patch, patchedInstalledIdentity.getIdentity().loadTargetInfo()); assertFileExists(env.getInstalledImage().getJbossHome(), "bin", fileAdded.getItem().getName()); assertPatchHasBeenRolledBack(rollbackResult, identityBeforePatch); InstalledIdentity rolledBackInstalledIdentity = InstalledIdentity.load(env.getInstalledImage().getJbossHome(), productConfig, env.getInstalledImage().getModulesDir()); PatchingAssert.assertFileDoesNotExist(env.getInstalledImage().getJbossHome(), "bin", fileAdded.getItem().getName()); if (File.separatorChar != '\\') {
InstalledIdentity patchedInstalledIdentity = InstalledIdentity.load(env.getInstalledImage().getJbossHome(), productConfig, env.getInstalledImage().getModulesDir()); assertInstallationIsPatched(patch, patchedInstalledIdentity.getIdentity().loadTargetInfo()); assertFileExists(env.getInstalledImage().getJbossHome(), "bin", fileAdded.getItem().getName());
File baseModuleDir = newFile(env.getInstalledImage().getModulesDir(), SYSTEM, LAYERS, BASE); File moduleDir = createModule0(baseModuleDir, moduleName);
InstalledIdentity patchedInstalledIdentity = InstalledIdentity.load(env.getInstalledImage().getJbossHome(), productConfig, env.getInstalledImage().getModulesDir()); assertInstallationIsPatched(patch, patchedInstalledIdentity.getIdentity().loadTargetInfo()); assertFileExists(env.getInstalledImage().getJbossHome(), "bin", fileAdded.getItem().getName());
assertPatchHasBeenApplied(patchResult, patch); InstalledIdentity patchedInstalledIdentity = InstalledIdentity.load(env.getInstalledImage().getJbossHome(), productConfig, env.getInstalledImage().getModulesDir()); assertInstallationIsPatched(patch, patchedInstalledIdentity.getIdentity().loadTargetInfo()); assertFileExists(env.getInstalledImage().getJbossHome(), "bin", fileAdded.getItem().getName());