[jboss-svn-commits] JBL Code SVN: r26067 - in labs/jbosstm/trunk/XTS/localjunit: src/com/arjuna/qa/junit and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Apr 16 09:29:43 EDT 2009


Author: istudens at redhat.com
Date: 2009-04-16 09:29:43 -0400 (Thu, 16 Apr 2009)
New Revision: 26067

Added:
   labs/jbosstm/trunk/XTS/localjunit/run-interop-tests.xml
   labs/jbosstm/trunk/XTS/localjunit/src/com/arjuna/qa/junit/LocalJUnitInteropRunner.java
Modified:
   labs/jbosstm/trunk/XTS/localjunit/src/com/arjuna/qa/junit/LocalJUnitRunner.java
Log:
JBQA-2076, new runner for XTS Interop tests

Added: labs/jbosstm/trunk/XTS/localjunit/run-interop-tests.xml
===================================================================
--- labs/jbosstm/trunk/XTS/localjunit/run-interop-tests.xml	                        (rev 0)
+++ labs/jbosstm/trunk/XTS/localjunit/run-interop-tests.xml	2009-04-16 13:29:43 UTC (rev 26067)
@@ -0,0 +1,76 @@
+<!--
+  JBoss, Home of Professional Open Source
+  Copyright 2008, Red Hat Middleware LLC, and individual contributors
+  as indicated by the @author tags.
+  See the copyright.txt in the distribution for a
+  full listing of individual contributors.
+  This copyrighted material is made available to anyone wishing to use,
+  modify, copy, or redistribute it subject to the terms and conditions
+  of the GNU Lesser General Public License, v. 2.1.
+  This program is distributed in the hope that it will be useful, but WITHOUT A
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+  PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+  You should have received a copy of the GNU Lesser General Public License,
+  v.2.1 along with this distribution; if not, write to the Free Software
+  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+  MA  02110-1301, USA.
+
+  (C) 2008,
+  @author JBoss Inc.
+-->
+
+<project name="Local JUnit Test for basic XTS testsuite" default="interop-tests" basedir=".">
+
+    <property environment="env"/>
+    <property name="server.hostname" value="${env.MYTESTIP_1}"/>
+    <property name="base.url" value="http://${server.hostname}:8080"/>
+    <property name="reports.dir" value="reports"/>
+    <property name="localjunit.lib.dir" value="build" />
+    <property name="apache.httpclient.lib.dir" value="ext" />
+    <property name="apache.logging.lib.dir" value="ext" />
+    <property name="apache.codec.lib.dir" value="ext" />
+    <property name="junit.lib.dir" value="../ext" />
+    <property name="testtype" value="tests-both" />
+
+    <path id="tests.classpath">
+        <pathelement location="${localjunit.lib.dir}/localjunit.jar"/>
+        <pathelement location="${apache.httpclient.lib.dir}/commons-httpclient.jar"/>
+        <pathelement location="${apache.logging.lib.dir}/commons-logging.jar"/>
+        <pathelement location="${apache.codec.lib.dir}/commons-codec.jar"/>
+        <pathelement location="${junit.lib.dir}/junit.jar"/>
+    </path>
+
+    <target name="interop-tests" depends="wstf-interop-tests,wstx11-interop-tests"/>
+
+    <target name="wstf-interop-tests">
+        <run-localjunit-test serverUrl="${base.url}/sc007/test?serviceuri=${base.url}/sc007/ParticipantService&amp;testTimeout=120000&amp;test=allTests&amp;resultPage=/xmlresults" outfile="TEST-sc007-test.xml" />
+    </target>
+
+    <target name="wstx11-interop-tests">
+        <run-localjunit-test serverUrl="${base.url}/interop11/test?serviceuri=${base.url}/interop11/ATParticipantService&amp;testTimeout=120000&amp;test=allATTests&amp;resultPage=/xmlresults" outfile="TEST-interop11-AT-test.xml" />
+        <run-localjunit-test serverUrl="${base.url}/interop11/test?serviceuri=${base.url}/interop11/BAParticipantService&amp;testTimeout=120000&amp;test=allBATests&amp;resultPage=/xmlresults" outfile="TEST-interop11-BA-test.xml" />
+    </target>
+
+    <macrodef name="run-localjunit-test">
+        <attribute name="serverUrl" />
+        <attribute name="outfile" />
+        <sequential>
+            <junit printsummary="yes" haltonfailure="no" fork="true" dir="." maxmemory="256m" showoutput="yes">
+                <classpath>
+                    <path refid="tests.classpath"/>
+                </classpath>
+
+                <formatter type="xml"/>
+
+                <sysproperty key="serverUrl" value="@{serverUrl}" />
+                <sysproperty key="outfile" value="${reports.dir}/@{outfile}" />
+
+                <test name="com.arjuna.qa.junit.LocalJUnitInteropRunner" />
+
+                <!--jvmarg value="-Xdebug"/>
+                <jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"/-->
+            </junit>
+        </sequential>
+     </macrodef>
+
+</project>

Copied: labs/jbosstm/trunk/XTS/localjunit/src/com/arjuna/qa/junit/LocalJUnitInteropRunner.java (from rev 25984, labs/jbosstm/trunk/XTS/localjunit/src/com/arjuna/qa/junit/LocalJUnitRunner.java)
===================================================================
--- labs/jbosstm/trunk/XTS/localjunit/src/com/arjuna/qa/junit/LocalJUnitInteropRunner.java	                        (rev 0)
+++ labs/jbosstm/trunk/XTS/localjunit/src/com/arjuna/qa/junit/LocalJUnitInteropRunner.java	2009-04-16 13:29:43 UTC (rev 26067)
@@ -0,0 +1,64 @@
+package com.arjuna.qa.junit;
+
+import junit.framework.TestCase;
+import org.apache.commons.httpclient.HttpMethodBase;
+import org.apache.commons.httpclient.Header;
+
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.io.FileWriter;
+import java.io.BufferedWriter;
+
+/**
+ * Runs XTS Interop Testsuite at a serveruURL and writes the test result into an outfile.
+ * @author <a href="mailto:istudens at redhat.com">Ivo Studensky</a>
+ * @version <tt>$Revision$</tt>
+ */
+public class LocalJUnitInteropRunner extends TestCase
+{
+    private String serverUrl    = null;
+    private String outfile      = null;
+
+    protected void setUp() throws Exception
+    {
+        serverUrl   = System.getProperty("serverUrl");
+        outfile     = System.getProperty("outfile");
+        System.err.println("serverUrl=" + serverUrl);
+        System.err.println("outfile=" + outfile);
+    }
+
+    public void testCallServlet()
+    {
+        boolean result = true;
+        try
+        {
+            // run tests by calling a servlet
+            Header runParam = new Header("Execute", "run");
+            HttpMethodBase request = HttpUtils.accessURL(
+                    new URL(serverUrl), null,
+                    HttpURLConnection.HTTP_OK,
+                    new Header[] {runParam},
+                    HttpUtils.POST);
+
+           String response = request.getResponseBodyAsString();
+
+            System.err.println("======================================================");
+            System.err.println("====================   RESULT    =====================");
+            System.err.println("======================================================");
+            System.err.println(response);
+
+            // writes response to the outfile
+            BufferedWriter writer = new BufferedWriter(new FileWriter(outfile));
+            writer.write(response);
+            writer.close();
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+            result = false;
+        }
+
+        assertTrue(result);
+    }
+
+}
\ No newline at end of file


Property changes on: labs/jbosstm/trunk/XTS/localjunit/src/com/arjuna/qa/junit/LocalJUnitInteropRunner.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Modified: labs/jbosstm/trunk/XTS/localjunit/src/com/arjuna/qa/junit/LocalJUnitRunner.java
===================================================================
--- labs/jbosstm/trunk/XTS/localjunit/src/com/arjuna/qa/junit/LocalJUnitRunner.java	2009-04-16 13:28:16 UTC (rev 26066)
+++ labs/jbosstm/trunk/XTS/localjunit/src/com/arjuna/qa/junit/LocalJUnitRunner.java	2009-04-16 13:29:43 UTC (rev 26067)
@@ -10,11 +10,10 @@
 import java.io.BufferedWriter;
 
 /**
- * Created by IntelliJ IDEA.
- * User: studensky
- * Date: 30.1.2009
- * Time: 14:09:23
- * To change this template use File | Settings | File Templates.
+ * Runs XTS Testsuite at a serveruURL, waits until it finishes
+ * and writes the test result into an outfile.
+ * @author <a href="mailto:istudens at redhat.com">Ivo Studensky</a>
+ * @version <tt>$Revision$</tt>
  */
 public class LocalJUnitRunner extends TestCase
 {




More information about the jboss-svn-commits mailing list