[jbpm-commits] JBoss JBPM SVN: r3153 - in projects/spec/trunk: modules/api/src/main/java/org/jboss/bpm/api/test and 2 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Fri Nov 28 11:40:35 EST 2008


Author: thomas.diesler at jboss.com
Date: 2008-11-28 11:40:34 -0500 (Fri, 28 Nov 2008)
New Revision: 3153

Modified:
   projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/test/APITestCase.java
   projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/test/APITestHelper.java
   projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/test/IntegrationTestCase.java
   projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/test/IntegrationTestHelper.java
   projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/test/IntegrationTestSetup.java
   projects/spec/trunk/modules/cts/src/test/java/org/jboss/bpm/test/incubator/task/user/UserTaskTest.java
   projects/spec/trunk/modules/ri/src/test/java/org/jbpm/test/
   projects/spec/trunk/pom.xml
Log:
Refactor IntegrationTestHelper

Modified: projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/test/APITestCase.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/test/APITestCase.java	2008-11-28 16:13:19 UTC (rev 3152)
+++ projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/test/APITestCase.java	2008-11-28 16:40:34 UTC (rev 3153)
@@ -63,16 +63,6 @@
     log.debug("### END " + getLongName());
   }
 
-  protected URL getResourceURL(String resource) throws MalformedURLException
-  {
-    return delegate.getResourceURL(resource);
-  }
-
-  protected File getResourceFile(String resource)
-  {
-    return delegate.getResourceFile(resource);
-  }
-
   protected String getShortName()
   {
     String shortName = getClass().getName();
@@ -97,4 +87,24 @@
   {
     return Configuration.getProcessEngine();
   }
+
+  protected URL getResourceURL(String resource) throws MalformedURLException
+  {
+    return delegate.getResourceURL(resource);
+  }
+
+  protected File getResourceFile(String resource)
+  {
+    return delegate.getResourceFile(resource);
+  }
+
+  public File getTestArchiveFile(String archive)
+  {
+    return delegate.getTestArchiveFile(archive);
+  }
+
+  public URL getTestArchiveURL(String archive) throws MalformedURLException
+  {
+    return delegate.getTestArchiveFile(archive).toURI().toURL();
+  }
 }

Modified: projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/test/APITestHelper.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/test/APITestHelper.java	2008-11-28 16:13:19 UTC (rev 3152)
+++ projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/test/APITestHelper.java	2008-11-28 16:40:34 UTC (rev 3153)
@@ -34,8 +34,10 @@
 public class APITestHelper
 {
   private static final String SYSPROP_TEST_RESOURCES_DIRECTORY = "test.resources.directory";
+  private static final String SYSPROP_TEST_ARCHIVE_DIRECTORY = "test.archive.directory";
 
   private static String testResourcesDir;
+  private static String testArchiveDir;
 
   /** Try to discover the URL for the test resource */
   public URL getResourceURL(String resource) throws MalformedURLException
@@ -64,4 +66,33 @@
 
     return testResourcesDir;
   }
+
+  /** Try to discover the URL for the deployment archive */
+  public URL getTestArchiveURL(String archive) throws MalformedURLException
+  {
+    return getTestArchiveFile(archive).toURI().toURL();
+  }
+
+  /** Try to discover the File for the deployment archive */
+  public File getTestArchiveFile(String archive)
+  {
+    File file = new File(archive);
+    if (file.exists())
+      return file;
+  
+    file = new File(getTestArchiveDir() + "/" + archive);
+    if (file.exists())
+      return file;
+  
+    String notSet = (getTestArchiveDir() == null ? " System property '" + SYSPROP_TEST_ARCHIVE_DIRECTORY + "' not set." : "");
+    throw new IllegalArgumentException("Cannot obtain '" + getTestArchiveDir() + "/" + archive + "'." + notSet);
+  }
+
+  public String getTestArchiveDir()
+  {
+    if (testArchiveDir == null)
+      testArchiveDir = System.getProperty(SYSPROP_TEST_ARCHIVE_DIRECTORY, "target/test-libs");
+  
+    return testArchiveDir;
+  }
 }

Modified: projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/test/IntegrationTestCase.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/test/IntegrationTestCase.java	2008-11-28 16:13:19 UTC (rev 3152)
+++ projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/test/IntegrationTestCase.java	2008-11-28 16:40:34 UTC (rev 3153)
@@ -23,8 +23,6 @@
 
 // $Id$
 
-import java.io.File;
-import java.net.MalformedURLException;
 import java.net.URL;
 
 import javax.management.MBeanServerConnection;
@@ -43,18 +41,8 @@
   // Provide logging
   final Logger log = LoggerFactory.getLogger(IntegrationTestCase.class);
 
-  private IntegrationTestHelper delegate = new IntegrationTestHelper();
+  IntegrationTestHelper delegate = new IntegrationTestHelper();
   
-  public File getArchiveFile(String archive)
-  {
-    return delegate.getArchiveFile(archive);
-  }
-
-  public URL getArchiveURL(String archive) throws MalformedURLException
-  {
-    return delegate.getArchiveFile(archive).toURI().toURL();
-  }
-
   public boolean isTargetJBoss500()
   {
     return delegate.isTargetJBoss500();

Modified: projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/test/IntegrationTestHelper.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/test/IntegrationTestHelper.java	2008-11-28 16:13:19 UTC (rev 3152)
+++ projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/test/IntegrationTestHelper.java	2008-11-28 16:40:34 UTC (rev 3153)
@@ -21,8 +21,6 @@
  */
 package org.jboss.bpm.api.test;
 
-import java.io.File;
-import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.Hashtable;
 
@@ -41,15 +39,12 @@
  */
 public class IntegrationTestHelper extends APITestHelper
 {
-  private static final String SYSPROP_TEST_ARCHIVE_DIRECTORY = "test.archive.directory";
-
   private static MBeanServerConnection server;
-  private static String testArchiveDir;
   private String integrationTarget;
 
   public void deploy(String archive) throws Exception
   {
-    URL url = getArchiveFile(archive).toURI().toURL();
+    URL url = getTestArchiveFile(archive).toURI().toURL();
     deploy(url);
   }
 
@@ -60,7 +55,7 @@
 
   public void undeploy(String archive) throws Exception
   {
-    URL url = getArchiveFile(archive).toURI().toURL();
+    URL url = getTestArchiveFile(archive).toURI().toURL();
     undeploy(url);
   }
 
@@ -138,33 +133,4 @@
   {
     return new JBossArchiveDeployer(getServer());
   }
-
-  /** Try to discover the URL for the deployment archive */
-  public URL getArchiveURL(String archive) throws MalformedURLException
-  {
-    return getArchiveFile(archive).toURI().toURL();
-  }
-
-  /** Try to discover the File for the deployment archive */
-  public File getArchiveFile(String archive)
-  {
-    File file = new File(archive);
-    if (file.exists())
-      return file;
-
-    file = new File(getTestArchiveDir() + "/" + archive);
-    if (file.exists())
-      return file;
-
-    String notSet = (getTestArchiveDir() == null ? " System property '" + SYSPROP_TEST_ARCHIVE_DIRECTORY + "' not set." : "");
-    throw new IllegalArgumentException("Cannot obtain '" + getTestArchiveDir() + "/" + archive + "'." + notSet);
-  }
-
-  public String getTestArchiveDir()
-  {
-    if (testArchiveDir == null)
-      testArchiveDir = System.getProperty(SYSPROP_TEST_ARCHIVE_DIRECTORY, "target/test-libs");
-
-    return testArchiveDir;
-  }
 }

Modified: projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/test/IntegrationTestSetup.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/test/IntegrationTestSetup.java	2008-11-28 16:13:19 UTC (rev 3152)
+++ projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/test/IntegrationTestSetup.java	2008-11-28 16:40:34 UTC (rev 3153)
@@ -51,12 +51,12 @@
 
   public File getArchiveFile(String archive)
   {
-    return delegate.getArchiveFile(archive);
+    return delegate.getTestArchiveFile(archive);
   }
 
   public URL getArchiveURL(String archive) throws MalformedURLException
   {
-    return delegate.getArchiveFile(archive).toURI().toURL();
+    return delegate.getTestArchiveFile(archive).toURI().toURL();
   }
 
   public boolean isTargetJBoss500()

Modified: projects/spec/trunk/modules/cts/src/test/java/org/jboss/bpm/test/incubator/task/user/UserTaskTest.java
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jboss/bpm/test/incubator/task/user/UserTaskTest.java	2008-11-28 16:13:19 UTC (rev 3152)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jboss/bpm/test/incubator/task/user/UserTaskTest.java	2008-11-28 16:40:34 UTC (rev 3153)
@@ -33,10 +33,8 @@
 import org.jboss.bpm.api.model.Event.EventDetailType;
 import org.jboss.bpm.api.model.Task.TaskType;
 import org.jboss.bpm.api.model.builder.ObjectNameFactory;
-import org.jboss.bpm.api.model.builder.ProcessBuilder;
 import org.jboss.bpm.api.runtime.BasicAttachments;
 import org.jboss.bpm.api.service.ProcessBuilderService;
-import org.jboss.bpm.api.service.ProcessDefinitionService;
 import org.jboss.bpm.api.service.ProcessService;
 import org.jboss.bpm.api.test.CTSTestCase;
 import org.jboss.bpm.incubator.client.MessageListener;


Property changes on: projects/spec/trunk/modules/ri/src/test/java/org/jbpm/test
___________________________________________________________________
Name: svn:ignore
   - cts
pattern
incubator


Modified: projects/spec/trunk/pom.xml
===================================================================
--- projects/spec/trunk/pom.xml	2008-11-28 16:13:19 UTC (rev 3152)
+++ projects/spec/trunk/pom.xml	2008-11-28 16:40:34 UTC (rev 3153)
@@ -37,7 +37,7 @@
     <module>modules/dialects</module>
     <module>modules/ri</module>
     <module>modules/cts</module>
-    <module>modules/samples/airticket</module>
+    <!-- module>modules/samples/airticket</module -->
   </modules>
   
   <!-- Properties -->




More information about the jbpm-commits mailing list