[jbpm-commits] JBoss JBPM SVN: r3902 - jbpm3/tags/jbpm-3.2.5.SP1/modules/core/src/test/java/org/jbpm/perf.
do-not-reply at jboss.org
do-not-reply at jboss.org
Tue Feb 17 09:34:54 EST 2009
Author: mvecera at redhat.com
Date: 2009-02-17 09:34:54 -0500 (Tue, 17 Feb 2009)
New Revision: 3902
Added:
jbpm3/tags/jbpm-3.2.5.SP1/modules/core/src/test/java/org/jbpm/perf/AsyncCallTest.java
Log:
core, AsyncCallTest
Added: jbpm3/tags/jbpm-3.2.5.SP1/modules/core/src/test/java/org/jbpm/perf/AsyncCallTest.java
===================================================================
--- jbpm3/tags/jbpm-3.2.5.SP1/modules/core/src/test/java/org/jbpm/perf/AsyncCallTest.java (rev 0)
+++ jbpm3/tags/jbpm-3.2.5.SP1/modules/core/src/test/java/org/jbpm/perf/AsyncCallTest.java 2009-02-17 14:34:54 UTC (rev 3902)
@@ -0,0 +1,91 @@
+/*
+ * 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;
+
+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 = 1;
+ ProcessDefinition processDefinition;
+
+ @Override
+ protected 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);
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ jbpmContext.getGraphSession().deleteProcessDefinition(processDefinition.getId());
+ super.tearDown();
+ }
+
+ public void testAsyncCall() {
+ log.info("");
+ log.info("=== EXECUTING PERFORMANCE TEST ================================================");
+ log.info("");
+
+ startJobExecutor();
+
+ long start = System.currentTimeMillis();
+
+ for (int i = 0; i < INSTANCES; i++) {
+ StartProcessInstanceCommand startCommand = new StartProcessInstanceCommand();
+ startCommand.setProcessDefinitionId(processDefinition.getId());
+ startCommand.setProcessDefinitionName("processDefinition1");
+ ProcessInstance pi = (ProcessInstance) commandService.execute(startCommand);
+ }
+
+ long stop = System.currentTimeMillis();
+ log.info("TEST FINISHED PROCESSING " + INSTANCES + " INSTANCES IN " + (stop - start) + " MILLIS");
+ log.info("THIS IS " + INSTANCES + " INSTANCES IN " + ((double) (stop - start) / INSTANCES) / 1000 + " PROCESSES PER SECOND");
+
+ stopJobExecutor();
+ }
+
+ public void execute(ExecutionContext executionContext) throws Exception {
+ log.info("Action called, current ExecutionContext: " + executionContext);
+ }
+}
More information about the jbpm-commits
mailing list