chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1786190 - in /chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit: ./ src/test/java/org/apache/chemistry/opencmis/fit/tck/
Date Thu, 09 Mar 2017 15:42:17 GMT
Author: fmui
Date: Thu Mar  9 15:42:17 2017
New Revision: 1786190

URL: http://svn.apache.org/viewvc?rev=1786190&view=rev
Log:
FIT: fixed test execution on some OSs

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/pom.xml
    chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/tck/AbstractAtomPubTckIT.java
    chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/tck/AbstractBrowserTckIT.java
    chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/tck/AbstractTckIT.java
    chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/tck/AbstractWebServicesTckIT.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/pom.xml
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/pom.xml?rev=1786190&r1=1786189&r2=1786190&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/pom.xml (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/pom.xml Thu
Mar  9 15:42:17 2017
@@ -35,7 +35,7 @@
 
     <properties>
         <parentBasedir>../../</parentBasedir>
-        <tomcat.version>7.0.70</tomcat.version>
+        <tomcat.version>7.0.75</tomcat.version>
         <overlay.groupId />
         <overlay.artifactId />
         <factory.class />

Modified: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/tck/AbstractAtomPubTckIT.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/tck/AbstractAtomPubTckIT.java?rev=1786190&r1=1786189&r2=1786190&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/tck/AbstractAtomPubTckIT.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/tck/AbstractAtomPubTckIT.java
Thu Mar  9 15:42:17 2017
@@ -31,7 +31,7 @@ public abstract class AbstractAtomPubTck
     public Map<String, String> getSessionParameters() {
         Map<String, String> parameters = getBaseSessionParameters();
 
-        String url = "http://" + HOST + ":" + PORT + getAtomPubPath();
+        String url = "http://" + HOST + ":" + getPort() + getAtomPubPath();
 
         parameters.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
         parameters.put(SessionParameter.ATOMPUB_URL, url);

Modified: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/tck/AbstractBrowserTckIT.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/tck/AbstractBrowserTckIT.java?rev=1786190&r1=1786189&r2=1786190&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/tck/AbstractBrowserTckIT.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/tck/AbstractBrowserTckIT.java
Thu Mar  9 15:42:17 2017
@@ -32,7 +32,7 @@ public abstract class AbstractBrowserTck
     public Map<String, String> getSessionParameters() {
         Map<String, String> parameters = getBaseSessionParameters();
 
-        String url = "http://" + HOST + ":" + PORT + BROWSER_PATH;
+        String url = "http://" + HOST + ":" + getPort() + BROWSER_PATH;
 
         parameters.put(SessionParameter.BINDING_TYPE, BindingType.BROWSER.value());
         parameters.put(SessionParameter.BROWSER_URL, url);

Modified: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/tck/AbstractTckIT.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/tck/AbstractTckIT.java?rev=1786190&r1=1786189&r2=1786190&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/tck/AbstractTckIT.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/tck/AbstractTckIT.java
Thu Mar  9 15:42:17 2017
@@ -28,7 +28,10 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.catalina.LifecycleEvent;
 import org.apache.catalina.LifecycleException;
+import org.apache.catalina.LifecycleListener;
+import org.apache.catalina.LifecycleState;
 import org.apache.catalina.startup.Tomcat;
 import org.apache.chemistry.opencmis.commons.SessionParameter;
 import org.apache.chemistry.opencmis.commons.enums.BindingType;
@@ -61,7 +64,8 @@ public abstract class AbstractTckIT exte
     public static final String DEFAULT_VERSIONABLE_DOCUMENT_TYPE_VALUE = "VersionableType";
// InMemory
 
     public static final String HOST = "localhost";
-    public static final int PORT = 19080;
+    private static final int BASEPORT = 19080;
+    private static int portCounter = -1;
 
     public static final String REPOSITORY_ID = "test";
     public static final String USER = "test";
@@ -75,6 +79,10 @@ public abstract class AbstractTckIT exte
 
     public abstract boolean usesVersionableDocumentType();
 
+    public static int getPort() {
+        return BASEPORT + portCounter;
+    }
+
     public Map<String, String> getBaseSessionParameters() {
         Map<String, String> parameters = new HashMap<String, String>();
 
@@ -87,8 +95,8 @@ public abstract class AbstractTckIT exte
             parameters.put(TestParameters.DEFAULT_DOCUMENT_TYPE,
                     System.getProperty(DEFAULT_VERSIONABLE_DOCUMENT_TYPE, DEFAULT_VERSIONABLE_DOCUMENT_TYPE_VALUE));
         } else {
-            parameters.put(TestParameters.DEFAULT_DOCUMENT_TYPE, System.getProperty(
-                    TestParameters.DEFAULT_DOCUMENT_TYPE, TestParameters.DEFAULT_DOCUMENT_TYPE_VALUE));
+            parameters.put(TestParameters.DEFAULT_DOCUMENT_TYPE, System
+                    .getProperty(TestParameters.DEFAULT_DOCUMENT_TYPE, TestParameters.DEFAULT_DOCUMENT_TYPE_VALUE));
         }
 
         parameters.put(TestParameters.DEFAULT_FOLDER_TYPE,
@@ -115,33 +123,53 @@ public abstract class AbstractTckIT exte
             throw new RuntimeException("OpenCMIS WAR file not found!");
         }
 
-        tomcateBaseDir = new File(targetDir, "tomcat.base");
+        portCounter++;
+
+        tomcateBaseDir = new File(targetDir, "tomcat.base." + getPort());
         if (!tomcateBaseDir.exists()) {
             tomcateBaseDir.mkdir();
         }
 
-        // Logger.getLogger("").setLevel(Level.WARNING);
+        // Logger.getLogger("").setLevel(Level.INFO);
         System.setProperty("java.util.logging.manager", "org.apache.logging.log4j.jul.LogManager");
 
         tomcat = new Tomcat();
         tomcat.setBaseDir(tomcateBaseDir.getAbsolutePath());
-        tomcat.setPort(PORT);
+        tomcat.setPort(getPort());
         // tomcat.setSilent(true);
         tomcat.getHost().setCreateDirs(true);
         tomcat.getHost().setDeployOnStartup(true);
         tomcat.getHost().setAutoDeploy(false);
 
+        tomcat.getServer().addLifecycleListener(new LifecycleListener() {
+            @Override
+            public void lifecycleEvent(LifecycleEvent event) {
+                if (event.getLifecycle().getState() == LifecycleState.DESTROYED) {
+                    if (!deleteDirectory(tomcateBaseDir)) {
+                        markDirectoryForDelete(tomcateBaseDir);
+                    }
+                }
+            }
+        });
+
         File appDir = new File(tomcateBaseDir, tomcat.getHost().getAppBase());
         if (!appDir.exists()) {
             appDir.mkdir();
         }
 
-        // Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).setLevel(Level.WARNING);
-
         tomcat.addWebapp(null, "/opencmis", warFile.getAbsolutePath());
         tomcat.init();
         tomcat.start();
 
+        int count = 60;
+        while (count > 0) {
+            count--;
+            if (tomcat.getServer().getState() == LifecycleState.STARTED) {
+                break;
+            }
+            Thread.sleep(500);
+        }
+
         Thread.sleep(5000);
     }
 
@@ -149,7 +177,6 @@ public abstract class AbstractTckIT exte
     public static void stopTomcat() throws LifecycleException, InterruptedException {
         tomcat.stop();
         tomcat.destroy();
-        deleteDirectory(tomcateBaseDir);
     }
 
     private static boolean deleteDirectory(File dir) {
@@ -168,6 +195,22 @@ public abstract class AbstractTckIT exte
         return dir.delete();
     }
 
+    private static void markDirectoryForDelete(File dir) {
+        if (!dir.exists()) {
+            return;
+        }
+
+        dir.deleteOnExit();
+
+        for (File file : dir.listFiles()) {
+            if (file.isDirectory()) {
+                markDirectoryForDelete(file);
+            } else {
+                file.deleteOnExit();
+            }
+        }
+    }
+
     @Before
     public void checkTest() {
         assumeTrue("Skipping all TCK tests.", getSystemPropertyBoolean(TEST));
@@ -212,9 +255,9 @@ public abstract class AbstractTckIT exte
         target.mkdir();
 
         CmisTestReport report = new TextReport();
-        report.createReport(getParameters(), getGroups(), new File(target, "tck-result-"
+ getBindingType().value()
-                + "-" + getCmisVersion().value() + "-"
-                + (usesVersionableDocumentType() ? "versionable" : "nonversionable") + ".txt"));
+        report.createReport(getParameters(), getGroups(),
+                new File(target, "tck-result-" + getBindingType().value() + "-" + getCmisVersion().value()
+ "-"
+                        + (usesVersionableDocumentType() ? "versionable" : "nonversionable")
+ ".txt"));
 
         // find failures
         for (CmisTestGroup group : getGroups()) {

Modified: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/tck/AbstractWebServicesTckIT.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/tck/AbstractWebServicesTckIT.java?rev=1786190&r1=1786189&r2=1786190&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/tck/AbstractWebServicesTckIT.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/tck/AbstractWebServicesTckIT.java
Thu Mar  9 15:42:17 2017
@@ -31,7 +31,7 @@ public abstract class AbstractWebService
     public Map<String, String> getSessionParameters() {
         Map<String, String> parameters = getBaseSessionParameters();
 
-        String url = "http://" + HOST + ":" + PORT + getWebServicesPath() + "/";
+        String url = "http://" + HOST + ":" + getPort() + getWebServicesPath() + "/";
 
         parameters.put(SessionParameter.BINDING_TYPE, BindingType.WEBSERVICES.value());
         parameters.put(SessionParameter.WEBSERVICES_REPOSITORY_SERVICE, url + "RepositoryService?wsdl");



Mime
View raw message