[jbpm-commits] JBoss JBPM SVN: r3912 - jbpm3/branches/jpdl-3.2.2-SOA-4.2/jpdl/jar/src/test/java/org/jbpm/perf.
do-not-reply at jboss.org
do-not-reply at jboss.org
Wed Feb 18 04:30:46 EST 2009
Author: mvecera at redhat.com
Date: 2009-02-18 04:30:46 -0500 (Wed, 18 Feb 2009)
New Revision: 3912
Added:
jbpm3/branches/jpdl-3.2.2-SOA-4.2/jpdl/jar/src/test/java/org/jbpm/perf/AsyncCallTest.java
Log:
jpdl, AsyncCallTest perf. test
Added: 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 (rev 0)
+++ jbpm3/branches/jpdl-3.2.2-SOA-4.2/jpdl/jar/src/test/java/org/jbpm/perf/AsyncCallTest.java 2009-02-18 09:30:46 UTC (rev 3912)
@@ -0,0 +1,99 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, 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.jbpm.perf;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jbpm.command.CommandService;
+import org.jbpm.command.StartProcessInstanceCommand;
+import org.jbpm.command.impl.CommandServiceImpl;
+import org.jbpm.db.AbstractDbTestCase;
+import org.jbpm.graph.def.ActionHandler;
+import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.graph.exe.ExecutionContext;
+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.
+ *
+ * @author mvecera at redhat.com, pmacik at redhat.com
+ */
+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 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 tearDown() throws Exception {
+ beginSessionTransaction();
+ jbpmContext.getGraphSession().deleteProcessDefinition(processDefinition.getId());
+ super.tearDown();
+ }
+
+ public void testAsyncCall() {
+ log.info("");
+ log.info("=== EXECUTING PERFORMANCE TEST ================================================");
+ log.info("");
+
+ long start = System.currentTimeMillis();
+
+ 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();
+
+ 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 void execute(ExecutionContext executionContext) throws Exception {
+ // no-op
+ }
+}
More information about the jbpm-commits
mailing list