qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oru...@apache.org
Subject [2/3] qpid-jms-amqp-0-x git commit: QPID-8074: [JMS AMQP 0-x][System Tests] Run system tests as part of integration-test maven phase
Date Thu, 11 Jan 2018 15:44:40 GMT
QPID-8074: [JMS AMQP 0-x][System Tests] Run system tests as part of integration-test maven
phase

* Change surefire settings to run system tests as part of integration-test maven phase
* Change surefire settings to have separate working directories per amqp protocol
* Describe how to run system tests in README.txt
* Fix typos
* Miscellaneous minor improvements


Project: http://git-wip-us.apache.org/repos/asf/qpid-jms-amqp-0-x/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms-amqp-0-x/commit/450005bf
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms-amqp-0-x/tree/450005bf
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms-amqp-0-x/diff/450005bf

Branch: refs/heads/master
Commit: 450005bf555c51e688e5c046f4a9684017a73a55
Parents: 9374adf
Author: Alex Rudyy <orudyy@apache.org>
Authored: Thu Jan 11 15:38:38 2018 +0000
Committer: Alex Rudyy <orudyy@apache.org>
Committed: Thu Jan 11 15:38:38 2018 +0000

----------------------------------------------------------------------
 README.txt                                      | 12 +++++++++
 systests/pom.xml                                | 28 ++++++++++++++------
 .../core/brokerj/SpawnQpidBrokerAdmin.java      | 27 ++++++++-----------
 .../core/brokerj/SpawnQpidBrokerAdminTest.java  | 11 +++-----
 4 files changed, 47 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-jms-amqp-0-x/blob/450005bf/README.txt
----------------------------------------------------------------------
diff --git a/README.txt b/README.txt
index 9766138..ad0f65b 100644
--- a/README.txt
+++ b/README.txt
@@ -18,6 +18,18 @@ Perform a subset of the tests
 
   mvn verify -Dtest=TestNamePattern* -DfailIfNoTests=false
 
+Execute system tests against Broker-J using Java 8 or above
+
+  mvn verify -Pbroker-j
+
+Execute system tests with AMQP 0-9-1 against Broker-J using Java 8 and above
+
+  mvn verify -Pbroker-j  -Dqpid.amqp.version=0-9-1
+
+Execute system tests against Broker-J using Java 7 and specifying a path to Java 8 executable
to run the broker
+
+  mvn verify -Pbroker-j -Dqpid.systest.java8.executable=/usr/java/jdk1.8.0_121/bin/java
+
 Execute the unit tests and then produce the code coverage report
 
   mvn test jacoco:report

http://git-wip-us.apache.org/repos/asf/qpid-jms-amqp-0-x/blob/450005bf/systests/pom.xml
----------------------------------------------------------------------
diff --git a/systests/pom.xml b/systests/pom.xml
index 7d8cdc1..1ace38f 100644
--- a/systests/pom.xml
+++ b/systests/pom.xml
@@ -30,10 +30,6 @@
     <name>Apache Qpid JMS AMQP 0-x System Tests</name>
     <description>Apache Qpid JMS AMQP 0-x System Tests</description>
 
-    <properties>
-        <qpid.amqp.version>0-10</qpid.amqp.version>
-    </properties>
-
     <dependencies>
 
         <dependency>
@@ -120,11 +116,23 @@
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-surefire-plugin</artifactId>
                 <configuration>
+                    <skip>true</skip>
                     <systemPropertyVariables>
-                       <qpid.amqp.version>${qpid.amqp.version}</qpid.amqp.version>
                         <qpid.dest_syntax>BURL</qpid.dest_syntax>
                     </systemPropertyVariables>
                 </configuration>
+                <executions>
+                    <execution>
+                        <id>integration-test</id>
+                        <phase>integration-test</phase>
+                        <goals>
+                            <goal>test</goal>
+                        </goals>
+                        <configuration>
+                            <skip>false</skip>
+                        </configuration>
+                    </execution>
+                </executions>
             </plugin>
         </plugins>
     </build>
@@ -144,13 +152,15 @@
             For example, -Dqpid.amqp.version=0-9-1 can be set to test 0-9-1.
 
             Examples of running tests:
-             mvn test -Pbroker-j
-             mvn test -Pbroker-j -Dqpid.amqp.version=0-9-1 -Dqpid.systest.java8.executable=/usr/java/jdk1.8.0_121/bin/java
+             mvn verify -Pbroker-j
+             mvn verify -Pbroker-j -Dqpid.amqp.version=0-9-1 -Dqpid.systest.java8.executable=/usr/java/jdk1.8.0_121/bin/java
         -->
         <profile>
             <id>broker-j</id>
 
             <properties>
+                <qpid.amqp.version>0-10</qpid.amqp.version>
+                <surefire.working.directory>${project.build.directory}${file.separator}surefire-reports${file.separator}${qpid.amqp.version}</surefire.working.directory>
                 <qpid-broker-j-version>7.0.0</qpid-broker-j-version>
                 <qpid.systest.broker_admin>org.apache.qpid.systest.core.brokerj.SpawnQpidBrokerAdmin</qpid.systest.broker_admin>
                 <qpid.systest.java8.executable>java</qpid.systest.java8.executable>
@@ -163,7 +173,9 @@
                         <groupId>org.apache.maven.plugins</groupId>
                         <artifactId>maven-surefire-plugin</artifactId>
                         <configuration>
+                            <workingDirectory>${surefire.working.directory}</workingDirectory>
                             <systemPropertyVariables>
+                                <qpid.amqp.version>${qpid.amqp.version}</qpid.amqp.version>
                                 <qpid.systest.brokerj.dependencies>${qpid.systest.brokerj.dependencies}</qpid.systest.brokerj.dependencies>
                                 <qpid.systest.java8.executable>${qpid.systest.java8.executable}</qpid.systest.java8.executable>
                                 <qpid.systest.build.classpath.file>${project.build.directory}/qpid.build.classpath.txt</qpid.systest.build.classpath.file>
@@ -171,7 +183,7 @@
                                 <qpid.systest.broker_admin>${qpid.systest.broker_admin}</qpid.systest.broker_admin>
                                 <qpid.systest.virtualhostnode.type>JSON</qpid.systest.virtualhostnode.type>
                                 <qpid.systest.virtualhost.blueprint>${qpid.systest.virtualhost.blueprint}</qpid.systest.virtualhost.blueprint>
-                                <qpid.systest.logback.logs_dir>${project.basedir}${file.separator}target${file.separator}surefire-reports</qpid.systest.logback.logs_dir>
+                                <qpid.systest.logback.logs_dir>${surefire.working.directory}</qpid.systest.logback.logs_dir>
                                 <qpid.systest.broker.clean.between.tests>true</qpid.systest.broker.clean.between.tests>
                             </systemPropertyVariables>
                         </configuration>

http://git-wip-us.apache.org/repos/asf/qpid-jms-amqp-0-x/blob/450005bf/systests/src/main/java/org/apache/qpid/systest/core/brokerj/SpawnQpidBrokerAdmin.java
----------------------------------------------------------------------
diff --git a/systests/src/main/java/org/apache/qpid/systest/core/brokerj/SpawnQpidBrokerAdmin.java
b/systests/src/main/java/org/apache/qpid/systest/core/brokerj/SpawnQpidBrokerAdmin.java
index 913b018..1569854 100644
--- a/systests/src/main/java/org/apache/qpid/systest/core/brokerj/SpawnQpidBrokerAdmin.java
+++ b/systests/src/main/java/org/apache/qpid/systest/core/brokerj/SpawnQpidBrokerAdmin.java
@@ -23,7 +23,6 @@ package org.apache.qpid.systest.core.brokerj;
 import static java.nio.charset.StandardCharsets.UTF_8;
 
 import java.io.BufferedReader;
-import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
@@ -74,8 +73,8 @@ import org.apache.qpid.systest.core.BrokerAdmin;
 import org.apache.qpid.systest.core.BrokerAdminException;
 import org.apache.qpid.systest.core.dependency.ClasspathQuery;
 import org.apache.qpid.systest.core.logback.LogbackPropertyValueDiscriminator;
-import org.apache.qpid.systest.core.util.FileUtils;
 import org.apache.qpid.systest.core.logback.LogbackSocketPortNumberDefiner;
+import org.apache.qpid.systest.core.util.FileUtils;
 import org.apache.qpid.systest.core.util.SystemUtils;
 
 public class SpawnQpidBrokerAdmin implements BrokerAdmin
@@ -89,13 +88,13 @@ public class SpawnQpidBrokerAdmin implements BrokerAdmin
     private static final String SYSTEST_PROPERTY_BROKER_PROCESS = "qpid.systest.broker.process";
     private static final String SYSTEST_PROPERTY_SPAWN_BROKER_STARTUP_TIME = "qpid.systest.broker_startup_time";
     private static final String SYSTEST_PROPERTY_BROKER_CLEAN_BETWEEN_TESTS = "qpid.systest.broker.clean.between.tests";
+    private static final String SYSTEST_PROPERTY_JAVA_EXECUTABLE = "qpid.systest.java8.executable";
 
     static final String SYSTEST_PROPERTY_VIRTUALHOSTNODE_TYPE = "qpid.systest.virtualhostnode.type";
     static final String SYSTEST_PROPERTY_VIRTUALHOST_BLUEPRINT = "qpid.systest.virtualhost.blueprint";
     static final String SYSTEST_PROPERTY_INITIAL_CONFIGURATION_LOCATION = "qpid.systest.initialConfigurationLocation";
     static final String SYSTEST_PROPERTY_BUILD_CLASSPATH_FILE = "qpid.systest.build.classpath.file";
-    static final String SYSTEST_PROPERTY_JAVA8_EXECUTABLE = "qpid.systest.java8.executable";
-    static final String SYSTEST_PROPERTY_BROKERJ_DEPENDECIES = "qpid.systest.brokerj.dependencies";
+    static final String SYSTEST_PROPERTY_BROKERJ_DEPENDENCIES = "qpid.systest.brokerj.dependencies";
 
     private final static AtomicLong BROKER_INSTANCE_COUNTER = new AtomicLong();
 
@@ -305,7 +304,7 @@ public class SpawnQpidBrokerAdmin implements BrokerAdmin
         File file = new File(System.getProperty(SYSTEST_PROPERTY_BUILD_CLASSPATH_FILE));
         if (!file.exists())
         {
-            String dependencies = System.getProperty(SYSTEST_PROPERTY_BROKERJ_DEPENDECIES);
+            String dependencies = System.getProperty(SYSTEST_PROPERTY_BROKERJ_DEPENDENCIES);
             final ClasspathQuery classpathQuery = new ClasspathQuery(SpawnQpidBrokerAdmin.class,
                                                                      Arrays.asList(dependencies.split(",")));
             classpath = classpathQuery.getClasspath();
@@ -328,7 +327,7 @@ public class SpawnQpidBrokerAdmin implements BrokerAdmin
             }
         }
 
-        jvmArguments.add(0, System.getProperty(SYSTEST_PROPERTY_JAVA8_EXECUTABLE, "/usr/bin/java"));
+        jvmArguments.add(0, System.getProperty(SYSTEST_PROPERTY_JAVA_EXECUTABLE, "java"));
         jvmArguments.add(1, "-cp");
         jvmArguments.add(2, classpath);
         jvmArguments.add("-Dqpid.systest.logback.socket.port="
@@ -587,7 +586,7 @@ public class SpawnQpidBrokerAdmin implements BrokerAdmin
         }
         catch (JMSException e)
         {
-            throw new BrokerAdminException(String.format("Cannot create virtual host %s",
virtualHostNodeName), e);
+            throw new BrokerAdminException(String.format("Cannot create virtual host '%s'",
virtualHostNodeName), e);
         }
     }
 
@@ -605,7 +604,7 @@ public class SpawnQpidBrokerAdmin implements BrokerAdmin
         }
         catch (AmqpManagementFacade.OperationUnsuccessfulException e)
         {
-            throw new BrokerAdminException(String.format("Cannot create test virtual host
'%s'", virtualHostNodeName),
+            throw new BrokerAdminException(String.format("Cannot update test virtual host
'%s'", virtualHostNodeName),
                                            e);
         }
         finally
@@ -757,23 +756,19 @@ public class SpawnQpidBrokerAdmin implements BrokerAdmin
 
     private String dumpThreads()
     {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
         try
         {
             Process process = Runtime.getRuntime().exec("jstack " + _pid);
-            InputStream is = process.getInputStream();
-            byte[] buffer = new byte[1024];
-            int length;
-            while ((length = is.read(buffer)) != -1)
+            try (InputStream is = process.getInputStream())
             {
-                baos.write(buffer, 0, length);
+                return new String(ByteStreams.toByteArray(is));
             }
         }
-        catch (Exception e)
+        catch (IOException e)
         {
             LOGGER.error("Error whilst collecting thread dump for " + _pid, e);
         }
-        return new String(baos.toByteArray());
+        return "";
     }
 
 

http://git-wip-us.apache.org/repos/asf/qpid-jms-amqp-0-x/blob/450005bf/systests/src/test/java/org/apache/qpid/systest/core/brokerj/SpawnQpidBrokerAdminTest.java
----------------------------------------------------------------------
diff --git a/systests/src/test/java/org/apache/qpid/systest/core/brokerj/SpawnQpidBrokerAdminTest.java
b/systests/src/test/java/org/apache/qpid/systest/core/brokerj/SpawnQpidBrokerAdminTest.java
index c4140a2..f33e714 100644
--- a/systests/src/test/java/org/apache/qpid/systest/core/brokerj/SpawnQpidBrokerAdminTest.java
+++ b/systests/src/test/java/org/apache/qpid/systest/core/brokerj/SpawnQpidBrokerAdminTest.java
@@ -20,19 +20,16 @@
  */
 package org.apache.qpid.systest.core.brokerj;
 
-import static org.apache.qpid.systest.core.brokerj.SpawnQpidBrokerAdmin.SYSTEST_PROPERTY_BROKERJ_DEPENDECIES;
+import static org.apache.qpid.systest.core.brokerj.SpawnQpidBrokerAdmin.SYSTEST_PROPERTY_BROKERJ_DEPENDENCIES;
 import static org.apache.qpid.systest.core.brokerj.SpawnQpidBrokerAdmin.SYSTEST_PROPERTY_BUILD_CLASSPATH_FILE;
 import static org.apache.qpid.systest.core.brokerj.SpawnQpidBrokerAdmin.SYSTEST_PROPERTY_INITIAL_CONFIGURATION_LOCATION;
-import static org.apache.qpid.systest.core.brokerj.SpawnQpidBrokerAdmin.SYSTEST_PROPERTY_JAVA8_EXECUTABLE;
 import static org.apache.qpid.systest.core.brokerj.SpawnQpidBrokerAdmin.SYSTEST_PROPERTY_VIRTUALHOST_BLUEPRINT;
 import static org.apache.qpid.systest.core.brokerj.SpawnQpidBrokerAdmin.SYSTEST_PROPERTY_VIRTUALHOSTNODE_TYPE;
-import static org.hamcrest.CoreMatchers.equalTo;
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.CoreMatchers.notNullValue;
 import static org.junit.Assert.fail;
 import static org.junit.Assume.assumeThat;
 
-import java.io.File;
 import java.util.Hashtable;
 
 import javax.jms.Connection;
@@ -270,9 +267,9 @@ public class SpawnQpidBrokerAdminTest
     {
         assumeThat(String.format("Broker-J classpath property (%s) is not set", SYSTEST_PROPERTY_BUILD_CLASSPATH_FILE),
                    System.getProperty(SYSTEST_PROPERTY_BUILD_CLASSPATH_FILE), is(notNullValue()));
-        assumeThat(String.format("Broker dependencies property (%s) is not set", SYSTEST_PROPERTY_BROKERJ_DEPENDECIES),
-                   System.getProperty(SYSTEST_PROPERTY_BROKERJ_DEPENDECIES), is(notNullValue()));
+        assumeThat(String.format("Broker dependencies property (%s) is not set", SYSTEST_PROPERTY_BROKERJ_DEPENDENCIES),
+                   System.getProperty(SYSTEST_PROPERTY_BROKERJ_DEPENDENCIES), is(notNullValue()));
         assumeThat(String.format("Broker-J initial configuration property (%s) is not set",
SYSTEST_PROPERTY_INITIAL_CONFIGURATION_LOCATION),
                    System.getProperty(SYSTEST_PROPERTY_INITIAL_CONFIGURATION_LOCATION), is(notNullValue()));
     }
-}
\ No newline at end of file
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message