SF.net SVN: mx4j: [2265] trunk/mx4j

[email protected] Wed, 21 Mar 2007 02:53:31 -0700
Newsgroups gmane.comp.java.mx4j.cvs
Message-ID <[email protected]>
Revision: 2265
          http://svn.sourceforge.net/mx4j/?rev=2265&view=rev
Author:   simonebordet
Date:     2007-03-21 02:53:30 -0700 (Wed, 21 Mar 2007)

Log Message:
-----------
Tests package reorganization.

Modified Paths:
--------------
    trunk/mx4j/jsr003/pom.xml
    trunk/mx4j/jsr160/pom.xml
    trunk/mx4j/pom.xml
    trunk/mx4j/tools/pom.xml

Added Paths:
-----------
    trunk/mx4j/jsr003/src/test/java/test/mx4j/MX4JClassLoadingTestCase.java
    trunk/mx4j/jsr003/src/test/java/test/mx4j/MX4JTestCase.java
    trunk/mx4j/jsr003/src/test/java/test/mx4j/MultiThreadTestRunner.java
    trunk/mx4j/jsr003/src/test/java/test/mx4j/MutableBoolean.java
    trunk/mx4j/jsr003/src/test/java/test/mx4j/MutableInteger.java
    trunk/mx4j/jsr003/src/test/java/test/mx4j/MutableLong.java
    trunk/mx4j/jsr003/src/test/java/test/mx4j/MutableObject.java
    trunk/mx4j/jsr003/src/test/java/test/mx4j/compliance/

Removed Paths:
-------------
    trunk/mx4j/tests-support/

Modified: trunk/mx4j/jsr003/pom.xml
===================================================================
--- trunk/mx4j/jsr003/pom.xml	2007-03-21 01:13:36 UTC (rev 2264)
+++ trunk/mx4j/jsr003/pom.xml	2007-03-21 09:53:30 UTC (rev 2265)
@@ -19,12 +19,21 @@
                 <artifactId>maven-compiler-plugin</artifactId>
                 <configuration>
                     <testExcludes>
-                        <exclude>**/MultiThreadMBeanServerTest.java</exclude>
                         <exclude>**/SecurityManagerTestCase.java</exclude>
                         <exclude>**/LocalSecurityManagerTest.java</exclude>
                     </testExcludes>
                 </configuration>
             </plugin>
+            <plugin>
+                <artifactId>maven-jar-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>test-jar</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
         </plugins>
     </build>
 
@@ -44,9 +53,10 @@
             <artifactId>bcel</artifactId>
             <optional>true</optional>
         </dependency>
+
         <dependency>
-            <groupId>mx4j</groupId>
-            <artifactId>mx4j-tests-support</artifactId>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
             <scope>test</scope>
         </dependency>
     </dependencies>

Copied: trunk/mx4j/jsr003/src/test/java/test/mx4j/MX4JClassLoadingTestCase.java (from rev 2262, trunk/mx4j/tests-support/src/main/java/test/mx4j/MX4JClassLoadingTestCase.java)
===================================================================
--- trunk/mx4j/jsr003/src/test/java/test/mx4j/MX4JClassLoadingTestCase.java	                        (rev 0)
+++ trunk/mx4j/jsr003/src/test/java/test/mx4j/MX4JClassLoadingTestCase.java	2007-03-21 09:53:30 UTC (rev 2265)
@@ -0,0 +1,84 @@
+package test.mx4j;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+
+/**
+ * @version $Revision$ $Date$
+ */
+public abstract class MX4JClassLoadingTestCase extends MX4JTestCase
+{
+    protected ClassLoader createMX4JClassLoader() throws MalformedURLException
+    {
+        File jmx = new File("dist/test/mx4j-jmx.jar");
+        File impl = new File("dist/test/mx4j-impl.jar");
+        return new URLClassLoader(new URL[]{jmx.toURL(), impl.toURL()}, getClass().getClassLoader().getParent());
+    }
+
+    protected ClassLoader createJMXRIClassLoader() throws MalformedURLException
+    {
+        File jmxri = new File("dist/test/jmxri.jar");
+        if (!jmxri.exists()) fail("JMXRI jar is not available");
+        return new URLClassLoader(new URL[]{jmxri.toURL()}, getClass().getClassLoader().getParent());
+    }
+
+    protected ClassLoader createJMXRIWithMX4JImplClassLoader() throws MalformedURLException
+    {
+        File jmxri = new File("dist/test/jmxri.jar");
+        if (!jmxri.exists()) fail("JMXRI jar is not available");
+        File mx4j = new File("dist/test/mx4j-impl.jar");
+        return new URLClassLoader(new URL[]{jmxri.toURL(), mx4j.toURL()}, getClass().getClassLoader().getParent());
+    }
+
+    protected ClassLoader createMX4JWithTestsClassLoader() throws MalformedURLException
+    {
+        File jmx = new File("dist/test/mx4j-jmx.jar");
+        File impl = new File("dist/test/mx4j-impl.jar");
+        File tests = new File("dist/test/mx4j-tests.jar");
+        return new URLClassLoader(new URL[]{jmx.toURL(), impl.toURL(), tests.toURL()}, getClass().getClassLoader().getParent());
+    }
+
+    protected ClassLoader createRemoteMX4JWithTestsClassLoader() throws MalformedURLException
+    {
+        File jmx = new File("dist/test/mx4j-jmx.jar");
+        File impl = new File("dist/test/mx4j-impl.jar");
+        File rjmx = new File("dist/test/mx4j-rjmx.jar");
+        File rimpl = new File("dist/test/mx4j-rimpl.jar");
+        File tests = new File("dist/test/mx4j-tests.jar");
+        File jaas = new File("dist/test/jaas.jar");
+        return new URLClassLoader(new URL[]{jaas.toURL(), jmx.toURL(), impl.toURL(), rjmx.toURL(), rimpl.toURL(), tests.toURL()}, getClass().getClassLoader().getParent());
+    }
+
+    protected ClassLoader createJMXRIWithTestsClassLoader() throws MalformedURLException
+    {
+        File jmxri = new File("dist/test/jmxri.jar");
+        if (!jmxri.exists()) fail("JMXRI jar is not available");
+        File tests = new File("dist/test/mx4j-tests.jar");
+        return new URLClassLoader(new URL[]{jmxri.toURL(), tests.toURL()}, getClass().getClassLoader().getParent());
+    }
+
+    protected ClassLoader createRemoteJMXRIWithTestsClassLoader() throws MalformedURLException
+    {
+        File jmx = new File("dist/test/jmxri.jar");
+        if (!jmx.exists()) fail("JMXRI jar is not available");
+        File rjmx = new File("dist/test/jmxremote.jar");
+        if (!rjmx.exists()) fail("JMX Remote jar is not available");
+        File tests = new File("dist/test/mx4j-tests.jar");
+        File jaas = new File("dist/test/jaas.jar");
+        return new URLClassLoader(new URL[]{jaas.toURL(), jmx.toURL(), rjmx.toURL(), tests.toURL()}, getClass().getClassLoader().getParent());
+    }
+
+    protected ClassLoader createOptionalRemoteJMXRIWithTestsClassLoader() throws MalformedURLException
+    {
+        File jmx = new File("dist/test/jmxri.jar");
+        if (!jmx.exists()) fail("JMXRI jar is not available");
+        File rjmx = new File("dist/test/jmxremote.jar");
+        if (!rjmx.exists()) fail("JMX Remote jar is not available");
+        File orjmx = new File("dist/test/jmxremote_optional.jar");
+        if (!orjmx.exists()) fail("JMX Optional Remote jar is not available");
+        File tests = new File("dist/test/mx4j-tests.jar");
+        return new URLClassLoader(new URL[]{jmx.toURL(), rjmx.toURL(), orjmx.toURL(), tests.toURL()}, getClass().getClassLoader().getParent());
+    }
+}


Property changes on: trunk/mx4j/jsr003/src/test/java/test/mx4j/MX4JClassLoadingTestCase.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Copied: trunk/mx4j/jsr003/src/test/java/test/mx4j/MX4JTestCase.java (from rev 2262, trunk/mx4j/tests-support/src/main/java/test/mx4j/MX4JTestCase.java)
===================================================================
--- trunk/mx4j/jsr003/src/test/java/test/mx4j/MX4JTestCase.java	                        (rev 0)
+++ trunk/mx4j/jsr003/src/test/java/test/mx4j/MX4JTestCase.java	2007-03-21 09:53:30 UTC (rev 2265)
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) The MX4J Contributors.
+ * All rights reserved.
+ *
+ * This software is distributed under the terms of the MX4J License version 1.0.
+ * See the terms of the MX4J License in the documentation provided with this software.
+ */
+
+package test.mx4j;
+
+import junit.framework.TestCase;
+
+/**
+ * Base class for MX4J tests
+ *
+ * @version $Revision$
+ */
+public abstract class MX4JTestCase extends TestCase
+{
+    protected void sleep(long time)
+    {
+        try
+        {
+            Thread.sleep(time);
+        }
+        catch (InterruptedException x)
+        {
+            Thread.currentThread().interrupt();
+        }
+    }
+}


Property changes on: trunk/mx4j/jsr003/src/test/java/test/mx4j/MX4JTestCase.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Copied: trunk/mx4j/jsr003/src/test/java/test/mx4j/MultiThreadTestRunner.java (from rev 2262, trunk/mx4j/tests-support/src/main/java/test/mx4j/MultiThreadTestRunner.java)
===================================================================
--- trunk/mx4j/jsr003/src/test/java/test/mx4j/MultiThreadTestRunner.java	                        (rev 0)
+++ trunk/mx4j/jsr003/src/test/java/test/mx4j/MultiThreadTestRunner.java	2007-03-21 09:53:30 UTC (rev 2265)
@@ -0,0 +1,106 @@
+/*
+ * Copyright (C) The MX4J Contributors.
+ * All rights reserved.
+ *
+ * This software is distributed under the terms of the MX4J License version 1.0.
+ * See the terms of the MX4J License in the documentation provided with this software.
+ */
+
+package test.mx4j;
+
+import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @version $Revision$
+ */
+public class MultiThreadTestRunner
+{
+   public abstract static class Test
+   {
+      private List throwables = new ArrayList();
+
+      public abstract void test() throws Exception;
+
+      private synchronized void addThrowable(Throwable x)
+      {
+         throwables.add(x);
+      }
+
+      private synchronized Throwable[] getThrowables()
+      {
+         return (Throwable[])throwables.toArray(new Throwable[throwables.size()]);
+      }
+   }
+
+   private class MultiThrowable extends Exception
+   {
+      private final Throwable[] throwables;
+
+      public MultiThrowable(Throwable[] throwables)
+      {
+         this.throwables = throwables;
+      }
+
+      public void printStackTrace(PrintStream stream)
+      {
+         synchronized (stream)
+         {
+            stream.println(this);
+            for (int i = 0; i < throwables.length; ++i) throwables[i].printStackTrace(stream);
+         }
+      }
+
+      public void printStackTrace(PrintWriter writer)
+      {
+         synchronized (writer)
+         {
+            writer.println(this);
+            for (int i = 0; i < throwables.length; ++i) throwables[i].printStackTrace(writer);
+         }
+      }
+   }
+
+   private final int threads;
+   private final int iterations;
+
+   public MultiThreadTestRunner(int threads, int iterations)
+   {
+      this.threads = threads;
+      this.iterations = iterations;
+   }
+
+   public void run(final Test test) throws Exception
+   {
+      Thread[] runners = new Thread[threads];
+      for (int i = 0; i < threads; ++i)
+      {
+         runners[i] = new Thread(new Runnable()
+         {
+            public void run()
+            {
+               for (int i = 0; i < iterations; ++i)
+               {
+                  try
+                  {
+                     test.test();
+                  }
+                  catch (Throwable x)
+                  {
+                     test.addThrowable(x);
+                  }
+               }
+            }
+         });
+      }
+
+      for (int i = 0; i < threads; ++i) runners[i].start();
+
+      for (int i = 0; i < threads; ++i) runners[i].join();
+
+      Throwable[] failures = test.getThrowables();
+      if (failures != null && failures.length > 0) throw new MultiThrowable(failures);
+   }
+}


Property changes on: trunk/mx4j/jsr003/src/test/java/test/mx4j/MultiThreadTestRunner.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Copied: trunk/mx4j/jsr003/src/test/java/test/mx4j/MutableBoolean.java (from rev 2262, trunk/mx4j/tests-support/src/main/java/test/mx4j/MutableBoolean.java)
===================================================================
--- trunk/mx4j/jsr003/src/test/java/test/mx4j/MutableBoolean.java	                        (rev 0)
+++ trunk/mx4j/jsr003/src/test/java/test/mx4j/MutableBoolean.java	2007-03-21 09:53:30 UTC (rev 2265)
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) The MX4J Contributors.
+ * All rights reserved.
+ *
+ * This software is distributed under the terms of the MX4J License version 1.0.
+ * See the terms of the MX4J License in the documentation provided with this software.
+ */
+
+package test.mx4j;
+
+/**
+ * @version $Revision$
+ */
+public class MutableBoolean
+{
+   private boolean m_value;
+
+   public MutableBoolean(boolean value)
+   {
+      set(value);
+   }
+
+   public boolean get()
+   {
+      return m_value;
+   }
+
+   public void set(boolean value)
+   {
+      m_value = value;
+   }
+}
\ No newline at end of file


Property changes on: trunk/mx4j/jsr003/src/test/java/test/mx4j/MutableBoolean.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Copied: trunk/mx4j/jsr003/src/test/java/test/mx4j/MutableInteger.java (from rev 2262, trunk/mx4j/tests-support/src/main/java/test/mx4j/MutableInteger.java)
===================================================================
--- trunk/mx4j/jsr003/src/test/java/test/mx4j/MutableInteger.java	                        (rev 0)
+++ trunk/mx4j/jsr003/src/test/java/test/mx4j/MutableInteger.java	2007-03-21 09:53:30 UTC (rev 2265)
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) The MX4J Contributors.
+ * All rights reserved.
+ *
+ * This software is distributed under the terms of the MX4J License version 1.0.
+ * See the terms of the MX4J License in the documentation provided with this software.
+ */
+
+package test.mx4j;
+
+/**
+ * @version $Revision$
+ */
+public class MutableInteger
+{
+   private int m_value;
+
+   public MutableInteger(int value)
+   {
+      m_value = value;
+   }
+
+   public int get()
+   {
+      return m_value;
+   }
+
+   public void set(int value)
+   {
+      m_value = value;
+   }
+}


Property changes on: trunk/mx4j/jsr003/src/test/java/test/mx4j/MutableInteger.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Copied: trunk/mx4j/jsr003/src/test/java/test/mx4j/MutableLong.java (from rev 2262, trunk/mx4j/tests-support/src/main/java/test/mx4j/MutableLong.java)
===================================================================
--- trunk/mx4j/jsr003/src/test/java/test/mx4j/MutableLong.java	                        (rev 0)
+++ trunk/mx4j/jsr003/src/test/java/test/mx4j/MutableLong.java	2007-03-21 09:53:30 UTC (rev 2265)
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) The MX4J Contributors.
+ * All rights reserved.
+ *
+ * This software is distributed under the terms of the MX4J License version 1.0.
+ * See the terms of the MX4J License in the documentation provided with this software.
+ */
+
+package test.mx4j;
+
+/**
+ * @version $Revision$
+ */
+public class MutableLong
+{
+   private long m_value;
+
+   public MutableLong(long value)
+   {
+      m_value = value;
+   }
+
+   public long get()
+   {
+      return m_value;
+   }
+
+   public void set(long value)
+   {
+      m_value = value;
+   }
+}


Property changes on: trunk/mx4j/jsr003/src/test/java/test/mx4j/MutableLong.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Copied: trunk/mx4j/jsr003/src/test/java/test/mx4j/MutableObject.java (from rev 2262, trunk/mx4j/tests-support/src/main/java/test/mx4j/MutableObject.java)
===================================================================
--- trunk/mx4j/jsr003/src/test/java/test/mx4j/MutableObject.java	                        (rev 0)
+++ trunk/mx4j/jsr003/src/test/java/test/mx4j/MutableObject.java	2007-03-21 09:53:30 UTC (rev 2265)
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) The MX4J Contributors.
+ * All rights reserved.
+ *
+ * This software is distributed under the terms of the MX4J License version 1.0.
+ * See the terms of the MX4J License in the documentation provided with this software.
+ */
+
+package test.mx4j;
+
+/**
+ * @version $Revision$
+ */
+public class MutableObject
+{
+   private Object object;
+
+   public MutableObject(Object object)
+   {
+      this.object = object;
+   }
+
+   public synchronized Object get()
+   {
+      return object;
+   }
+
+   public synchronized void set(Object object)
+   {
+      this.object = object;
+   }
+}


Property changes on: trunk/mx4j/jsr003/src/test/java/test/mx4j/MutableObject.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Copied: trunk/mx4j/jsr003/src/test/java/test/mx4j/compliance (from rev 2262, trunk/mx4j/tests-support/src/main/java/test/mx4j/compliance)

Modified: trunk/mx4j/jsr160/pom.xml
===================================================================
--- trunk/mx4j/jsr160/pom.xml	2007-03-21 01:13:36 UTC (rev 2264)
+++ trunk/mx4j/jsr160/pom.xml	2007-03-21 09:53:30 UTC (rev 2265)
@@ -19,12 +19,21 @@
                 <artifactId>maven-compiler-plugin</artifactId>
                 <configuration>
                     <testExcludes>
-                        <exclude>**/RMIJRMPMultiThreadMBeanServerConnectionTest.java</exclude>
                         <exclude>**/RemoteSecurityManagerTestCase.java</exclude>
                         <exclude>**/RMIJRMPRemoteSecurityManagerTest.java</exclude>
                     </testExcludes>
                 </configuration>
             </plugin>
+            <plugin>
+                <artifactId>maven-jar-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>test-jar</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
         </plugins>
     </build>
 
@@ -33,9 +42,17 @@
             <groupId>mx4j</groupId>
             <artifactId>mx4j-jsr003</artifactId>
         </dependency>
+
         <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>mx4j</groupId>
-            <artifactId>mx4j-tests-support</artifactId>
+            <artifactId>mx4j-jsr003</artifactId>
+            <version>${mx4jVersion}</version>
+            <type>test-jar</type>
             <scope>test</scope>
         </dependency>
     </dependencies>

Modified: trunk/mx4j/pom.xml
===================================================================
--- trunk/mx4j/pom.xml	2007-03-21 01:13:36 UTC (rev 2264)
+++ trunk/mx4j/pom.xml	2007-03-21 09:53:30 UTC (rev 2265)
@@ -72,7 +72,6 @@
     <profiles />
 
     <modules>
-        <module>tests-support</module>
         <module>jsr003</module>
         <module>jsr160</module>
         <module>tools</module>
@@ -164,11 +163,6 @@
 
             <dependency>
                 <groupId>mx4j</groupId>
-                <artifactId>mx4j-tests-support</artifactId>
-                <version>${mx4jVersion}</version>
-            </dependency>
-            <dependency>
-                <groupId>mx4j</groupId>
                 <artifactId>mx4j-jsr003</artifactId>
                 <version>${mx4jVersion}</version>
             </dependency>

Modified: trunk/mx4j/tools/pom.xml
===================================================================
--- trunk/mx4j/tools/pom.xml	2007-03-21 01:13:36 UTC (rev 2264)
+++ trunk/mx4j/tools/pom.xml	2007-03-21 09:53:30 UTC (rev 2265)
@@ -13,43 +13,31 @@
     <name>MX4J :: Tools</name>
     <packaging>jar</packaging>
 
-    <build>
-        <plugins>
-            <plugin>
-                <artifactId>maven-compiler-plugin</artifactId>
-                <configuration>
-                    <testExcludes>
-                        <exclude>**/burlap/*.java</exclude>
-                        <exclude>**/hessian/*.java</exclude>
-                        <exclude>**/local/*.java</exclude>
-                        <exclude>**/soap/*.java</exclude>
-                        <exclude>**/HTTPConnectorServerTestCase.java</exclude>
-                    </testExcludes>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-
     <dependencies>
         <dependency>
             <groupId>axis</groupId>
             <artifactId>axis</artifactId>
+            <optional>true</optional>
         </dependency>
         <dependency>
             <groupId>jython</groupId>
             <artifactId>jython</artifactId>
+            <optional>true</optional>
         </dependency>
         <dependency>
             <groupId>javax.mail</groupId>
             <artifactId>mail</artifactId>
+            <optional>true</optional>
         </dependency>
         <dependency>
             <groupId>com.caucho</groupId>
             <artifactId>hessian</artifactId>
+            <optional>true</optional>
         </dependency>
         <dependency>
             <groupId>org.mortbay.jetty</groupId>
             <artifactId>org.mortbay.jetty</artifactId>
+            <optional>true</optional>
         </dependency>
         <dependency>
             <groupId>mx4j</groupId>
@@ -59,9 +47,10 @@
             <groupId>mx4j</groupId>
             <artifactId>mx4j-jsr160</artifactId>
         </dependency>
+
         <dependency>
-            <groupId>mx4j</groupId>
-            <artifactId>mx4j-tests-support</artifactId>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
             <scope>test</scope>
         </dependency>
         <dependency>
@@ -69,6 +58,20 @@
             <artifactId>xmlunit</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>mx4j</groupId>
+            <artifactId>mx4j-jsr003</artifactId>
+            <version>${mx4jVersion}</version>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>mx4j</groupId>
+            <artifactId>mx4j-jsr160</artifactId>
+            <version>${mx4jVersion}</version>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
 </project>


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV