geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n...@apache.org
Subject geode git commit: GEODE-3301: Cargo installs now delete left over directories
Date Thu, 27 Jul 2017 23:48:31 GMT
Repository: geode
Updated Branches:
  refs/heads/develop 9e87f5a99 -> 7dc15b27f


GEODE-3301: Cargo installs now delete left over directories

	* This should hopefully fix Jenkins build issues
	This closes #662


Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/7dc15b27
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/7dc15b27
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/7dc15b27

Branch: refs/heads/develop
Commit: 7dc15b27f114254a265757e085fbbce8cbfb0719
Parents: 9e87f5a
Author: David Anuta <david.r.anuta@gmail.com>
Authored: Thu Jul 27 12:23:15 2017 -0700
Committer: nabarun <nnag@pivotal.io>
Committed: Thu Jul 27 16:44:51 2017 -0700

----------------------------------------------------------------------
 .../geode/session/tests/ContainerInstall.java   | 45 +++++++++-----------
 .../geode/session/tests/ServerContainer.java    |  4 --
 .../geode/session/tests/TomcatContainer.java    |  3 +-
 .../geode/session/tests/TomcatInstall.java      | 24 +++++++++++
 4 files changed, 47 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/7dc15b27/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 490f586..45b8668 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
@@ -29,6 +29,7 @@ import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.stream.StreamResult;
 
+import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.FilenameUtils;
 import org.apache.logging.log4j.Logger;
 import org.codehaus.cargo.container.installer.Installer;
@@ -112,6 +113,9 @@ public abstract class ContainerInstall {
       String moduleName) throws IOException {
     this.connType = connType;
 
+    // Removes previous run stuff (modules, installs, etc.)
+    clearPreviousRuns();
+
     logger.info("Installing container from URL " + downloadURL);
 
     // Optional step to install the container from a URL pointing to its distribution
@@ -142,6 +146,23 @@ public abstract class ContainerInstall {
   }
 
   /**
+   * Cleans up the installation by deleting the extracted module and downloaded installation
folders
+   */
+  public void clearPreviousRuns() throws IOException {
+    File modulesFolder = new File(DEFAULT_MODULE_EXTRACTION_DIR);
+    File installsFolder = new File(DEFAULT_INSTALL_DIR);
+
+    // Remove default modules extraction from previous runs
+    if (modulesFolder.exists()) {
+      FileUtils.deleteDirectory(modulesFolder);
+    }
+    // Remove default installs from previous runs
+    if (installsFolder.exists()) {
+      FileUtils.deleteDirectory(installsFolder);
+    }
+  }
+
+  /**
    * Sets the default locator address and port
    */
   public void setDefaultLocator(String address, int port) {
@@ -219,30 +240,6 @@ public abstract class ContainerInstall {
   }
 
   /**
-   * Get the server life cycle class that should be used
-   *
-   * Generates the class based on whether the installation's connection type (@link #connType)
is
-   * client server or peer to peer.
-   */
-  public String getServerLifeCycleListenerClass() {
-    String className = "org.apache.geode.modules.session.catalina.";
-    switch (connType) {
-      case PEER_TO_PEER:
-        className += "PeerToPeer";
-        break;
-      case CLIENT_SERVER:
-        className += "ClientServer";
-        break;
-      default:
-        throw new IllegalArgumentException(
-            "Bad connection type. Must be either PEER_TO_PEER or CLIENT_SERVER");
-    }
-
-    className += "CacheLifecycleListener";
-    return className;
-  }
-
-  /**
    * Cargo specific string to identify the container with
    */
   public abstract String getInstallId();

http://git-wip-us.apache.org/repos/asf/geode/blob/7dc15b27/geode-assembly/src/test/java/org/apache/geode/session/tests/ServerContainer.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/org/apache/geode/session/tests/ServerContainer.java
b/geode-assembly/src/test/java/org/apache/geode/session/tests/ServerContainer.java
index ba635ac..94a13e9 100644
--- a/geode-assembly/src/test/java/org/apache/geode/session/tests/ServerContainer.java
+++ b/geode-assembly/src/test/java/org/apache/geode/session/tests/ServerContainer.java
@@ -211,10 +211,6 @@ public abstract class ServerContainer {
     File configDir = new File(getConfiguration().getHome());
 
     if (configDir.exists()) {
-      logger.info("Configuration in " + configDir.getAbsolutePath());
-      FileUtils.copyDirectory(configDir, new File(logDir.getAbsolutePath() + "/config"));
-      logger.info("Copied configuration to "
-          + new File(logDir.getAbsolutePath() + "/config").getAbsolutePath());
       logger.info("Deleting configuration folder " + configDir.getAbsolutePath());
       FileUtils.deleteDirectory(configDir);
     }

http://git-wip-us.apache.org/repos/asf/geode/blob/7dc15b27/geode-assembly/src/test/java/org/apache/geode/session/tests/TomcatContainer.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/org/apache/geode/session/tests/TomcatContainer.java
b/geode-assembly/src/test/java/org/apache/geode/session/tests/TomcatContainer.java
index 0edf0b3..d1bf714 100644
--- a/geode-assembly/src/test/java/org/apache/geode/session/tests/TomcatContainer.java
+++ b/geode-assembly/src/test/java/org/apache/geode/session/tests/TomcatContainer.java
@@ -99,7 +99,8 @@ public class TomcatContainer extends ServerContainer {
     ContainerInstall.editXMLFile(contextXMLFile.getAbsolutePath(), "Tomcat", "Manager", "Context",
         cacheProperties);
     writePropertiesToConfig(config, DEFAULT_TOMCAT_CONFIG_XML_DIR + "/" + serverXMLFile.getName(),
-        "//Server/Listener[@className='" + getInstall().getServerLifeCycleListenerClass()
+ "']",
+        "//Server/Listener[@className='"
+            + ((TomcatInstall) getInstall()).getServerLifeCycleListenerClass() + "']",
         systemProperties);
   }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/7dc15b27/geode-assembly/src/test/java/org/apache/geode/session/tests/TomcatInstall.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/org/apache/geode/session/tests/TomcatInstall.java
b/geode-assembly/src/test/java/org/apache/geode/session/tests/TomcatInstall.java
index 6a6f2df..ba5f6bc 100644
--- a/geode-assembly/src/test/java/org/apache/geode/session/tests/TomcatInstall.java
+++ b/geode-assembly/src/test/java/org/apache/geode/session/tests/TomcatInstall.java
@@ -167,6 +167,30 @@ public class TomcatInstall extends ContainerInstall {
   }
 
   /**
+   * Get the server life cycle class that should be used
+   *
+   * Generates the class based on whether the installation's connection type
+   * {@link ContainerInstall#connType} is client server or peer to peer.
+   */
+  public String getServerLifeCycleListenerClass() {
+    String className = "org.apache.geode.modules.session.catalina.";
+    switch (getConnectionType()) {
+      case PEER_TO_PEER:
+        className += "PeerToPeer";
+        break;
+      case CLIENT_SERVER:
+        className += "ClientServer";
+        break;
+      default:
+        throw new IllegalArgumentException(
+            "Bad connection type. Must be either PEER_TO_PEER or CLIENT_SERVER");
+    }
+
+    className += "CacheLifecycleListener";
+    return className;
+  }
+
+  /**
    * Location of the context XML file in the installation's 'conf' directory
    */
   public File getDefaultContextXMLFile() {


Mime
View raw message