Repository: geode Updated Branches: refs/heads/develop 987f20326 -> e892a55fa
GEODE-3179: Changed extract directory of the Tomcat module This fixes the failing verify bundled jars test, caused by an unexpected slf4j-jdk jar coming from the tomcat module folder when extracted. This closes #626 Project: http://git-wip-us.apache.org/repos/asf/geode/repo Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/e892a55f Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/e892a55f Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/e892a55f Branch: refs/heads/develop Commit: e892a55fa17525fff180b14051fb6870be83d0bd Parents: 987f203 Author: David Anuta <[email protected]> Authored: Mon Jul 10 16:40:07 2017 -0700 Committer: Dan Smith <[email protected]> Committed: Wed Jul 12 10:55:16 2017 -0700 ---------------------------------------------------------------------- .../geode/session/tests/ContainerInstall.java | 27 +++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/geode/blob/e892a55f/geode-assembly/src/test/java/org/apache/geode/session/tests/ContainerInstall.java ---------------------------------------------------------------------- diff --git a/geode-assembly/src/test/java/org/apache/geode/session/tests/ContainerInstall.java b/geode-assembly/src/test/java/org/apache/geode/session/tests/ContainerInstall.java index d4f76c3..490f586 100644 --- a/geode-assembly/src/test/java/org/apache/geode/session/tests/ContainerInstall.java +++ b/geode-assembly/src/test/java/org/apache/geode/session/tests/ContainerInstall.java @@ -64,7 +64,8 @@ public abstract class ContainerInstall { public static final String GEODE_BUILD_HOME = System.getenv("GEODE_HOME"); public static final String DEFAULT_INSTALL_DIR = "/tmp/cargo_containers/"; - public static final String DEFAULT_MODULE_DIR = GEODE_BUILD_HOME + "/tools/Modules/"; + private static final String DEFAULT_MODULE_LOCATION = GEODE_BUILD_HOME + "/tools/Modules/"; + public static final String DEFAULT_MODULE_EXTRACTION_DIR = "/tmp/cargo_modules/"; /** * Represents the type of connection used in this installation @@ -121,6 +122,7 @@ public abstract class ContainerInstall { INSTALL_PATH = installer.getHome(); // Find and extract the module path MODULE_PATH = findAndExtractModule(moduleName); + logger.info("Extracted module " + moduleName + " to " + MODULE_PATH); // Find the session testing war path WAR_FILE_PATH = findSessionTestingWar(); @@ -306,17 +308,17 @@ public abstract class ContainerInstall { * @throws IOException */ protected static String findAndExtractModule(String moduleName) throws IOException { - String modulePath = null; - String modulesDir = DEFAULT_MODULE_DIR; + File modulePath = null; + File modulesDir = new File(DEFAULT_MODULE_LOCATION); boolean archive = false; logger.info("Trying to access build dir " + modulesDir); // Search directory for tomcat module folder/zip - for (File file : (new File(modulesDir)).listFiles()) { + for (File file : modulesDir.listFiles()) { if (file.getName().toLowerCase().contains(moduleName)) { - modulePath = file.getAbsolutePath(); + modulePath = file; archive = !file.isDirectory(); if (!archive) @@ -326,19 +328,26 @@ public abstract class ContainerInstall { // Unzip if it is a zip file if (archive) { - if (!FilenameUtils.getExtension(modulePath).equals("zip")) { + if (!FilenameUtils.getExtension(modulePath.getAbsolutePath()).equals("zip")) { throw new IOException("Bad module archive " + modulePath); } - ZipUtils.unzip(modulePath, modulePath.substring(0, modulePath.length() - 4)); + // Get the name of the new module folder within the extraction directory + File newModuleFolder = new File(DEFAULT_MODULE_EXTRACTION_DIR + + modulePath.getName().substring(0, modulePath.getName().length() - 4)); - modulePath = modulePath.substring(0, modulePath.length() - 4); + // Extract folder to location if not already there + if (!newModuleFolder.exists()) { + ZipUtils.unzip(modulePath.getAbsolutePath(), newModuleFolder.getAbsolutePath()); + } + + modulePath = newModuleFolder; } // No module found within directory throw IOException if (modulePath == null) throw new IOException("No module found in " + modulesDir); - return modulePath; + return modulePath.getAbsolutePath(); } /**
