[jboss-remoting-commits] JBoss Remoting SVN: r4354 - in remoting3/trunk: core/src and 8 other directories.

jboss-remoting-commits at lists.jboss.org jboss-remoting-commits at lists.jboss.org
Thu Jul 3 20:30:16 EDT 2008


Author: david.lloyd at jboss.com
Date: 2008-07-03 20:30:16 -0400 (Thu, 03 Jul 2008)
New Revision: 4354

Added:
   remoting3/trunk/core/src/test/
   remoting3/trunk/core/src/test/java/
   remoting3/trunk/core/src/test/java/org/
   remoting3/trunk/core/src/test/java/org/jboss/
   remoting3/trunk/core/src/test/java/org/jboss/cx/
   remoting3/trunk/core/src/test/java/org/jboss/cx/remoting/
   remoting3/trunk/core/src/test/java/org/jboss/cx/remoting/core/
   remoting3/trunk/core/src/test/java/org/jboss/cx/remoting/core/EndpointTestCase.java
Modified:
   remoting3/trunk/build.xml
   remoting3/trunk/testing-support/src/main/resources/testing.policy
Log:
Framework for core tests

Modified: remoting3/trunk/build.xml
===================================================================
--- remoting3/trunk/build.xml	2008-07-03 23:47:24 UTC (rev 4353)
+++ remoting3/trunk/build.xml	2008-07-04 00:30:16 UTC (rev 4354)
@@ -373,6 +373,81 @@
         <touch file="core/target/main/.lastcompile" verbose="false"/>
     </target>
 
+    <target name="core.test.compile.depcheck">
+        <mkdir dir="core/target/test"/>
+        <uptodate property="core.compile.uptodate" targetfile="core/target/test/.lastcompile">
+            <srcfiles dir="core/src/test/java">
+                <include name="**/"/>
+                <include name="**/*.java"/>
+                <exclude name="**/.*"/>
+            </srcfiles>
+        </uptodate>
+    </target>
+
+    <target name="core.test.compile" depends="lib.junit,core.compile,core.test.compile.depcheck" unless="core.test.compile.uptodate">
+        <mkdir dir="core/target/test/classes"/>
+        <javac
+                source="${javac.source}"
+                target="${javac.target}"
+                srcdir="core/src/test/java"
+                destdir="core/target/test/classes"
+                debug="true">
+            <compilerarg value="-Xlint:unchecked"/>
+            <classpath>
+                <path refid="api.classpath"/>
+                <path refid="core.classpath"/>
+                <path refid="util.classpath"/>
+                <path refid="testing-support.classpath"/>
+                <pathelement location="${lib.junit.local}"/>
+                <pathelement location="${lib.xnio-api.local}"/>
+            </classpath>
+        </javac>
+        <touch file="core/target/test/.lastcompile" verbose="false"/>
+    </target>
+
+    <target name="core.test.pseudotarget">
+        <echo message="============================================="/>
+        <echo message="${message}"/>
+        <echo message="============================================="/>
+        <mkdir dir="core/target/test-results"/>
+        <junit printsummary="true" fork="yes" includeantruntime="true">
+            <sysproperty key="build.home" value="${basedir}"/>
+            <sysproperty key="ant.library.dir" value="${ant.home}/lib"/>
+            <sysproperty key="lib.junit.local" value="${lib.junit.local}"/>
+            <sysproperty key="lib.xnio-api.local" value="${lib.xnio-api.local}"/>
+            <jvmarg line="${test.jvmargs}"/>
+            <formatter type="plain" extension="${extension}"/>
+            <classpath>
+                <path refid="api.classpath"/>
+                <path refid="core.classpath"/>
+                <path refid="testing-support.classpath"/>
+                <path refid="util.classpath"/>
+                <pathelement location="core/target/test/classes"/>
+                <pathelement location="${lib.junit.local}"/>
+                <pathelement location="${lib.xnio-api.local}"/>
+            </classpath>
+            <batchtest fork="yes" todir="core/target/test-results"
+                       haltonfailure="no">
+               <fileset dir="core/target/test/classes">
+                   <include name="**/*TestCase.class"/>
+               </fileset>
+            </batchtest>
+        </junit>
+    </target>
+
+    <target name="core.test" depends="api,core,testing-support,util,core.test.compile">
+        <antcall inheritall="true" inheritrefs="true" target="core.test.pseudotarget">
+            <param name="extension" value=".txt"/>
+            <param name="message" value="Running with no security manager"/>
+            <param name="test.jvmargs" value="-Ddummy=dummy"/>
+        </antcall>
+        <antcall inheritall="true" inheritrefs="true" target="core.test.pseudotarget">
+            <param name="extension" value="-security.txt"/>
+            <param name="message" value="Running with security manager"/>
+            <param name="test.jvmargs" value="-Djava.security.manager=org.jboss.cx.remoting.test.support.LoggingSecurityManager -Djava.security.policy=${basedir}/testing-support/src/main/resources/testing.policy"/>
+        </antcall>
+    </target>
+
     <target name="core.clean">
         <delete dir="core/target"/>
     </target>
@@ -1108,6 +1183,6 @@
 
     <target name="clean" description="Clean out all build files" depends="clean-core,clean-http"/>
 
-    <target name="test" description="Run all tests" depends="api.test"/>
+    <target name="test" description="Run all tests" depends="api.test,core.test"/>
 
 </project>

Added: remoting3/trunk/core/src/test/java/org/jboss/cx/remoting/core/EndpointTestCase.java
===================================================================
--- remoting3/trunk/core/src/test/java/org/jboss/cx/remoting/core/EndpointTestCase.java	                        (rev 0)
+++ remoting3/trunk/core/src/test/java/org/jboss/cx/remoting/core/EndpointTestCase.java	2008-07-04 00:30:16 UTC (rev 4354)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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 along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.cx.remoting.core;
+
+import junit.framework.TestCase;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ExecutorService;
+
+/**
+ *
+ */
+public final class EndpointTestCase extends TestCase {
+    public void testCreate() {
+        final EndpointImpl endpoint = new EndpointImpl();
+        final ExecutorService executorService = Executors.newCachedThreadPool();
+        endpoint.setExecutor(executorService);
+        endpoint.start();
+        endpoint.stop();
+        executorService.shutdown();
+    }
+}

Modified: remoting3/trunk/testing-support/src/main/resources/testing.policy
===================================================================
--- remoting3/trunk/testing-support/src/main/resources/testing.policy	2008-07-03 23:47:24 UTC (rev 4353)
+++ remoting3/trunk/testing-support/src/main/resources/testing.policy	2008-07-04 00:30:16 UTC (rev 4354)
@@ -1,16 +1,11 @@
 
-// Permissions to grant to modules
+// Permissions for the core tests
 
-grant codeBase "file:${build.home}/api/target/main/classes/-"
+grant codeBase "file:${build.home}/core/target/test/classes/-"
 {
+    permission java.lang.RuntimePermission "modifyThread"; // for executor control
 };
 
-// Permissions to run the api test suite
-
-grant codeBase "file:${build.home}/api/target/main/classes/-"
-{
-};
-
 // Support classes
 
 grant codeBase "file:${build.home}/testing-support/target/main/classes/-"




More information about the jboss-remoting-commits mailing list