[jbpm-commits] JBoss JBPM SVN: r3935 - in jbpm3/branches/jpdl-3.2.2-SOA-4.2/jpdl/jar: src/test/config/mysql and 2 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Feb 19 03:55:58 EST 2009


Author: thomas.diesler at jboss.com
Date: 2009-02-19 03:55:58 -0500 (Thu, 19 Feb 2009)
New Revision: 3935

Added:
   jbpm3/branches/jpdl-3.2.2-SOA-4.2/jpdl/jar/src/test/config/mysql/mysql-connector-java-5.0.8.jar
Modified:
   jbpm3/branches/jpdl-3.2.2-SOA-4.2/jpdl/jar/build.xml
   jbpm3/branches/jpdl-3.2.2-SOA-4.2/jpdl/jar/src/test/java/org/jbpm/perf/AsyncCallTest.java
   jbpm3/branches/jpdl-3.2.2-SOA-4.2/jpdl/jar/src/test/resources/log4j.properties
Log:
[JBPM-2043] Fix the build to allow for a single test to run

Modified: jbpm3/branches/jpdl-3.2.2-SOA-4.2/jpdl/jar/build.xml
===================================================================
--- jbpm3/branches/jpdl-3.2.2-SOA-4.2/jpdl/jar/build.xml	2009-02-19 06:51:06 UTC (rev 3934)
+++ jbpm3/branches/jpdl-3.2.2-SOA-4.2/jpdl/jar/build.xml	2009-02-19 08:55:58 UTC (rev 3935)
@@ -181,6 +181,22 @@
     </junitreport>
   </target>
 
+  <!--
+    Run a single junit test
+
+	ant -Dcustom.db.config=mysql -Dtest=org.jbpm.perf.AsyncCallTest one-test
+  -->
+  <target name="one-test" 
+          depends="compile.test, test.dependencies"
+          description="run a single unit test">
+    <mkdir dir="target/test.results" />
+    <junit printsummary="yes" fork="no" showoutput="yes" maxmemory="500m">
+      <classpath refid="${test.classpath}" />
+      <formatter type="plain" />
+      <test name="${test}" todir="target/test.results"/>
+    </junit>
+  </target>
+
   <!-- OLD STUFF -->
   
   <target name="config.profile.default">

Added: jbpm3/branches/jpdl-3.2.2-SOA-4.2/jpdl/jar/src/test/config/mysql/mysql-connector-java-5.0.8.jar
===================================================================
(Binary files differ)


Property changes on: jbpm3/branches/jpdl-3.2.2-SOA-4.2/jpdl/jar/src/test/config/mysql/mysql-connector-java-5.0.8.jar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: jbpm3/branches/jpdl-3.2.2-SOA-4.2/jpdl/jar/src/test/java/org/jbpm/perf/AsyncCallTest.java
===================================================================
--- jbpm3/branches/jpdl-3.2.2-SOA-4.2/jpdl/jar/src/test/java/org/jbpm/perf/AsyncCallTest.java	2009-02-19 06:51:06 UTC (rev 3934)
+++ jbpm3/branches/jpdl-3.2.2-SOA-4.2/jpdl/jar/src/test/java/org/jbpm/perf/AsyncCallTest.java	2009-02-19 08:55:58 UTC (rev 3935)
@@ -21,6 +21,8 @@
  */
 package org.jbpm.perf;
 
+// $Id: AsyncCallTest.java 3930 2009-02-18 17:19:18Z thomas.diesler at jboss.com $
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.jbpm.command.CommandService;
@@ -33,67 +35,80 @@
 import org.jbpm.graph.exe.ProcessInstance;
 
 /**
- * This tests creates 10000 process instances. Every instance has an async call
- * to the test class. See JIRA bugs SOA-1175 and JBPM-2043.
+ * This tests creates a constant number of process instances. 
+ * Every instance has an async call to an ActionHandler. 
  *
- * @author mvecera at redhat.com, pmacik at redhat.com
+ * See JIRA bugs SOA-1175 and JBPM-2043.
+ *
+ * @author mvecera at redhat.com
+ * @author pmacik at redhat.com
+ * @author thomas.diesler at jboss.com
+ * @since 18-Feb-2009
  */
-public class AsyncCallTest extends AbstractDbTestCase implements ActionHandler {
-   private static final Log log = LogFactory.getLog(AsyncCallTest.class);
-   private static final long serialVersionUID = -2962894670623757448L;
-   private CommandService commandService = new CommandServiceImpl(getJbpmConfiguration());
-   private static final int INSTANCES = 10000;
-   ProcessDefinition processDefinition;
+public class AsyncCallTest extends AbstractDbTestCase
+{
+  private static final Log log = LogFactory.getLog(AsyncCallTest.class);
+  
+  private CommandService commandService = new CommandServiceImpl(getJbpmConfiguration());
+  private static final int INSTANCES = 1000;
+  private static int count;
+  
+  ProcessDefinition processDefinition;
 
-   public void setUp() throws Exception {
-      super.setUp();
-      createSchema();
-      processDefinition = ProcessDefinition.parseXmlString(
-              "<process-definition xmlns=\"urn:jbpm.org:jpdl-3.1\" name=\"processDefinition1\">" +
-              "<start-state name=\"start\">" +
-              "<transition name=\"to_state\" to=\"end\">" +
-              "<action class=\"org.jbpm.perf.AsyncCallTest\" />" +
-              "</transition>" +
-              "</start-state>" +
-              "<end-state name=\"end\">" +
-              "</end-state>" +
-              "</process-definition>");
-      saveAndReload(processDefinition);
-   }
+  public void setUp() throws Exception
+  {
+    super.setUp();
+    
+    processDefinition = ProcessDefinition.parseXmlString(
+        "<process-definition xmlns='urn:jbpm.org:jpdl-3.1' name='processDefinition1'>" + 
+        "  <start-state name='start'>" + 
+        "    <transition name='to_state' to='end'>" + 
+        "      <action class='" + PerfActionHandler.class.getName() + "'/>" + 
+        "    </transition>" + 
+        "  </start-state>" + 
+        "  <end-state name='end'/>" + 
+        "</process-definition>");
+    
+    saveAndReload(processDefinition);
+  }
 
-   public void tearDown() throws Exception {
-      beginSessionTransaction();
-      jbpmContext.getGraphSession().deleteProcessDefinition(processDefinition.getId());
-      super.tearDown();
-   }
+  public void tearDown() throws Exception
+  {
+    beginSessionTransaction();
+    jbpmContext.getGraphSession().deleteProcessDefinition(processDefinition.getId());
+    super.tearDown();
+  }
 
-   public void testAsyncCall() {
-      log.info("");
-      log.info("=== EXECUTING PERFORMANCE TEST ================================================");
-      log.info("");
+  public void testAsyncCall()
+  {
+    long start = System.currentTimeMillis();
 
-      long start = System.currentTimeMillis();
+    commitAndCloseSession();
+    startJobExecutor();
 
+    for (count = 0; count < INSTANCES; count++)
+    {
+      beginSessionTransaction();
+      StartProcessInstanceCommand startCommand = new StartProcessInstanceCommand();
+      startCommand.setProcessId(processDefinition.getId());
+      startCommand.setProcessName("processDefinition1");
+      ProcessInstance pi = (ProcessInstance)commandService.execute(startCommand);
       commitAndCloseSession();
-      startJobExecutor();
+    }
 
-      for (int i = 0; i < INSTANCES; i++) {
-         beginSessionTransaction();
-         StartProcessInstanceCommand startCommand = new StartProcessInstanceCommand();
-         startCommand.setProcessId(processDefinition.getId());
-         startCommand.setProcessName("processDefinition1");
-         ProcessInstance pi = (ProcessInstance) commandService.execute(startCommand);
-         commitAndCloseSession();
-      }
+    stopJobExecutor();
 
-      stopJobExecutor();
+    long stop = System.currentTimeMillis();
+    System.out.println("=== Test finished processing " + INSTANCES + " instances in " + (stop - start) + "ms ===");
+    System.out.println("=== This is " + Math.round(1000 * INSTANCES / (stop - start)) + " instances per second ===");
+  }
 
-      long stop = System.currentTimeMillis();
-      log.info("=== TEST FINISHED PROCESSING " + INSTANCES + " INSTANCES IN " + (stop - start) + " MILLIS ===");
-      log.info("=== THIS IS " + INSTANCES / ((double) (stop - start) / 1000) + " PROCESSES PER SECOND ===");
-   }
+  public static class PerfActionHandler implements ActionHandler
+  {
+    public void execute(ExecutionContext executionContext) throws Exception
+    {
+      //System.out.println(count);
+    }
+  }
+}
 
-   public void execute(ExecutionContext executionContext) throws Exception {
-      // no-op
-   }
-}

Modified: jbpm3/branches/jpdl-3.2.2-SOA-4.2/jpdl/jar/src/test/resources/log4j.properties
===================================================================
--- jbpm3/branches/jpdl-3.2.2-SOA-4.2/jpdl/jar/src/test/resources/log4j.properties	2009-02-19 06:51:06 UTC (rev 3934)
+++ jbpm3/branches/jpdl-3.2.2-SOA-4.2/jpdl/jar/src/test/resources/log4j.properties	2009-02-19 08:55:58 UTC (rev 3935)
@@ -1,11 +1,20 @@
 # Set root logger level to DEBUG and its only appender to CONSOLE.
-log4j.rootLogger=DEBUG, CONSOLE
+log4j.rootLogger=DEBUG, LOGFILE
 
 # CONSOLE
 log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
 log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
 log4j.appender.CONSOLE.layout.ConversionPattern=%d{HH:mm:ss,SSS} [%t] %-5p %C{1} : %m%n
+log4j.appender.CONSOLE.Threshold=INFO
 
+# LOGFILE is set to be a File appender using a PatternLayout.
+log4j.appender.LOGFILE=org.apache.log4j.FileAppender
+log4j.appender.LOGFILE.File=target/test.log
+log4j.appender.LOGFILE.Append=true
+log4j.appender.LOGFILE.Threshold=DEBUG
+log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout
+log4j.appender.LOGFILE.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
+
 # LIMIT CATEGORIES
 log4j.logger.org.jbpm=DEBUG
 #log4j.logger.org.jbpm.graph=DEBUG




More information about the jbpm-commits mailing list