JBoss JBPM SVN: r1831 - jbpm3/trunk/modules/console/src/main/webapp/sa.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2008-08-06 03:15:57 -0400 (Wed, 06 Aug 2008)
New Revision: 1831
Modified:
jbpm3/trunk/modules/console/src/main/webapp/sa/procins.xhtml
Log:
display local time instead of GMT time in process instance page; still have to check whether client or server time is shown: JBPM-1446
Modified: jbpm3/trunk/modules/console/src/main/webapp/sa/procins.xhtml
===================================================================
--- jbpm3/trunk/modules/console/src/main/webapp/sa/procins.xhtml 2008-08-06 07:11:15 UTC (rev 1830)
+++ jbpm3/trunk/modules/console/src/main/webapp/sa/procins.xhtml 2008-08-06 07:15:57 UTC (rev 1831)
@@ -97,7 +97,7 @@
<th>Start Date</th>
<td>
<h:outputText value="#{pi.start}">
- <f:convertDateTime type="both"/>
+ <f:convertDateTime type="both" timeZone="#{java.util.TimeZone.getDefault()}"/>
</h:outputText>
</td>
</tr>
@@ -105,7 +105,7 @@
<th>End Date</th>
<td>
<h:outputText value="#{pi.end}">
- <f:convertDateTime type="both"/>
+ <f:convertDateTime type="both" timeZone="#{java.util.TimeZone.getDefault()}"/>
</h:outputText>
</td>
</tr>
17 years, 8 months
JBoss JBPM SVN: r1830 - in jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm: web and 1 other directory.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2008-08-06 03:11:15 -0400 (Wed, 06 Aug 2008)
New Revision: 1830
Modified:
jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/job/executor/JobExecutorServlet.java
jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/web/CloseJbpmConfigurationServlet.java
jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/web/JbpmConfigurationCloser.java
Log:
added deprecated tags to utility servlets which were replaced by servlet context listeners: JBPM-1446
Modified: jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/job/executor/JobExecutorServlet.java
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/job/executor/JobExecutorServlet.java 2008-08-06 07:05:21 UTC (rev 1829)
+++ jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/job/executor/JobExecutorServlet.java 2008-08-06 07:11:15 UTC (rev 1830)
@@ -39,7 +39,7 @@
* jbpm configuration will also shut down the job executor
* thread pool.
* <h1>Config parameters</h1>
- * <table>
+ * <table border="1">
* <tr>
* <th>Name</th>
* <th>Description</th>
@@ -71,6 +71,7 @@
* </web-app>
* </pre>
* </p>
+ * @deprecated Replaced by {@link org.jbpm.web.JobExecutorLauncher}
*/
public class JobExecutorServlet extends HttpServlet {
Modified: jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/web/CloseJbpmConfigurationServlet.java
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/web/CloseJbpmConfigurationServlet.java 2008-08-06 07:05:21 UTC (rev 1829)
+++ jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/web/CloseJbpmConfigurationServlet.java 2008-08-06 07:11:15 UTC (rev 1830)
@@ -5,6 +5,25 @@
import org.jbpm.JbpmConfiguration;
+/**
+ * Closes the jBPM configuration on servlet context destruction.
+ * <h1>Config parameters</h1>
+ * <table border="1">
+ * <tr>
+ * <th>Name</th>
+ * <th>Description</th>
+ * <th>Type</th>
+ * <th>Default value</th>
+ * </tr>
+ * <tr>
+ * <td>jbpm.configuration.resource</td>
+ * <td>resource location of the jbpm.cfg.xml</td>
+ * <td>String</td>
+ * <td>jbpm.cfg.xml</td>
+ * </tr>
+ * </table>
+ * @deprecated Replaced by {@link org.jbpm.web.JbpmConfigurationCloser}
+ */
public class CloseJbpmConfigurationServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
Modified: jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/web/JbpmConfigurationCloser.java
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/web/JbpmConfigurationCloser.java 2008-08-06 07:05:21 UTC (rev 1829)
+++ jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/web/JbpmConfigurationCloser.java 2008-08-06 07:11:15 UTC (rev 1830)
@@ -27,7 +27,7 @@
import org.jbpm.JbpmConfiguration;
/**
- * Closes the jBPM configuration on servlet context destruction. *
+ * Closes the jBPM configuration on servlet context destruction.
* <h3>Configuration</h3>
* Servlet context init parameters
* <table border="1">
17 years, 8 months
JBoss JBPM SVN: r1829 - jbpm3/trunk/modules/jpdl/core/src/test/java/org/jbpm/job/executor.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2008-08-06 03:05:21 -0400 (Wed, 06 Aug 2008)
New Revision: 1829
Added:
jbpm3/trunk/modules/jpdl/core/src/test/java/org/jbpm/job/executor/NoJobExecutorDbTest.java
Log:
wrote test case to reproduce exception described in JBPM-1452
Added: jbpm3/trunk/modules/jpdl/core/src/test/java/org/jbpm/job/executor/NoJobExecutorDbTest.java
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/test/java/org/jbpm/job/executor/NoJobExecutorDbTest.java (rev 0)
+++ jbpm3/trunk/modules/jpdl/core/src/test/java/org/jbpm/job/executor/NoJobExecutorDbTest.java 2008-08-06 07:05:21 UTC (rev 1829)
@@ -0,0 +1,60 @@
+/*
+ * 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.job.executor;
+
+import junit.framework.TestCase;
+
+import org.jbpm.JbpmConfiguration;
+import org.jbpm.JbpmContext;
+import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.graph.exe.ProcessInstance;
+
+/**
+ * Test case or JBPM-1452
+ * @author Alejandro Guizar
+ */
+public class NoJobExecutorDbTest extends TestCase {
+
+ private JbpmContext jbpmContext;
+
+ private static JbpmConfiguration jbpmConfiguration = JbpmConfiguration.parseXmlString(
+ "<jbpm-configuration>" +
+ " <null name='jbpm.job.executor' />" +
+ "</jbpm-configuration>");
+
+ public void setUp() throws Exception {
+ jbpmContext = jbpmConfiguration.createJbpmContext();
+ }
+
+ public void tearDown() throws Exception {
+ jbpmContext.close();
+ }
+
+ public void testJobExecutorDoesNotExist() {
+ // check the job executor is properly nullified
+ assertNull(jbpmContext.getObjectFactory().createObject("jbpm.job.executor"));
+ // start and end a process instance, confirm no exception gets thrown
+ jbpmContext.deployProcessDefinition(new ProcessDefinition("Audit"));
+ ProcessInstance processInstance = jbpmContext.newProcessInstanceForUpdate("Audit");
+ processInstance.end();
+ }
+}
17 years, 8 months
JBoss JBPM SVN: r1828 - in jbpm4/pvm/trunk/modules/core/src: test/java/org/jbpm/pvm and 1 other directories.
by do-not-reply@jboss.org
Author: porcherg
Date: 2008-08-06 03:03:33 -0400 (Wed, 06 Aug 2008)
New Revision: 1828
Added:
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/test/base/EnvironmentFactoryTestSetup.java
Removed:
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/db/langext/language.extensions.hbm.xml
Modified:
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/test/base/EnvironmentFactoryTestCase.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/DbTests.java
Log:
introduce TestSetup to create/close one environmentFactory before/after running a test suite - JBPM-1417
Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/test/base/EnvironmentFactoryTestCase.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/test/base/EnvironmentFactoryTestCase.java 2008-08-05 19:47:06 UTC (rev 1827)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/test/base/EnvironmentFactoryTestCase.java 2008-08-06 07:03:33 UTC (rev 1828)
@@ -58,6 +58,10 @@
}
EnvironmentFactory createEnvironmentFactory() {
+ return createEnvironmentFactory(configResource);
+ }
+
+ static EnvironmentFactory createEnvironmentFactory(String configResource) {
try {
log.debug("creating environment factory for ["+configResource+"]");
EnvironmentFactory newEnvironmentFactory = new PvmEnvironmentFactory(configResource);
@@ -68,6 +72,14 @@
}
}
+ static void closeEnvironmentFactory(String configResource) {
+ EnvironmentFactory environmentFactory = environmentFactories.remove(configResource);
+ if (environmentFactory!=null) {
+ log.debug("closing environment factory for ["+configResource+"]");
+ environmentFactory.close();
+ }
+ }
+
/*
static String getConfigResource(Package p) {
return p.getName().replace('.','/')+"/environment.cfg.xml";
Added: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/test/base/EnvironmentFactoryTestSetup.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/test/base/EnvironmentFactoryTestSetup.java (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/test/base/EnvironmentFactoryTestSetup.java 2008-08-06 07:03:33 UTC (rev 1828)
@@ -0,0 +1,51 @@
+/**
+ * Copyright (C) 2007 Bull S. A. S.
+ * Bull, Rue Jean Jaures, B.P.68, 78340, Les Clayes-sous-Bois
+ * This library 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
+ * version 2.1 of the License.
+ * This library 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
+ * program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
+ * Floor, Boston, MA 02110-1301, USA.
+ **/
+package org.jbpm.pvm.test.base;
+
+
+import org.jbpm.pvm.PvmException;
+import org.jbpm.pvm.env.EnvironmentFactory;
+import org.jbpm.pvm.env.PvmEnvironmentFactory;
+
+import junit.extensions.TestSetup;
+import junit.framework.Test;
+
+
+/**
+ * @author Guillaume Porcher
+ *
+ */
+public class EnvironmentFactoryTestSetup extends TestSetup {
+
+ private String configResource;
+ /**
+ * @param test
+ */
+ public EnvironmentFactoryTestSetup(Test test, String configResource) {
+ super(test);
+ this.configResource = configResource;
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ EnvironmentFactoryTestCase.createEnvironmentFactory(configResource);
+ super.setUp();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ EnvironmentFactoryTestCase.closeEnvironmentFactory(configResource);
+ }
+}
Property changes on: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/test/base/EnvironmentFactoryTestSetup.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/DbTests.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/DbTests.java 2008-08-05 19:47:06 UTC (rev 1827)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/DbTests.java 2008-08-06 07:03:33 UTC (rev 1828)
@@ -30,6 +30,7 @@
import org.jbpm.pvm.internal.db.langext.DbLangExtTests;
import org.jbpm.pvm.internal.db.model.DbModelTests;
import org.jbpm.pvm.internal.jobexecutor.JobExecutorTests;
+import org.jbpm.pvm.test.base.EnvironmentFactoryTestSetup;
/**
@@ -42,23 +43,18 @@
//$JUnit-BEGIN$
TestSuite defaultConfigTests = new TestSuite("default config tests");
- defaultConfigTests.addTest(DbLangExtTests.suite());
defaultConfigTests.addTest(DbModelTests.suite());
defaultConfigTests.addTest(DbSvcTests.suite());
- defaultConfigTests.addTest(SpringTests.suite());
defaultConfigTests.addTest(JobExecutorTests.suite());
// defaultConfigTests.addTest(ContinuationTests.suite());
- // TODO wrap the suite with a test setup that creates and closes the environment factory
- // something like this:
- // suite.addTest(new JbpmTestSetup(defaultConfigTests, "environment.cfg.xml");
+ suite.addTest(new EnvironmentFactoryTestSetup(defaultConfigTests, "environment.cfg.xml"));
+ suite.addTest(new EnvironmentFactoryTestSetup(DbLangExtTests.suite(), "org/jbpm/pvm/internal/db/langext/environment.cfg.xml"));
+ // Spring tests do not use EnvironmentFactoryTestCase
+ suite.addTest(SpringTests.suite());
- // TestSuite customConfigTest1 = new TestSuite("default config tests");
- // customConfigTest1.addTest(CustomDbConfigTest.suite());
- // suite.addTest(new JbpmTestSetup(customConfigTest1, "custom/environment.cfg.xml");
-
//$JUnit-END$
- return defaultConfigTests;
+ return suite;
}
}
Deleted: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/db/langext/language.extensions.hbm.xml
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/db/langext/language.extensions.hbm.xml 2008-08-05 19:47:06 UTC (rev 1827)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/db/langext/language.extensions.hbm.xml 2008-08-06 07:03:33 UTC (rev 1828)
@@ -1,15 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
-
-<hibernate-mapping package="org.jbpm.pvm" default-access="field">
-
- <class name="org.jbpm.pvm.internal.db.langext.AddressActivity">
- <id name="id" column="DBID_" type="long">
- <generator class="native" />
- </id>
- <version name="version" />
- <property name="street" />
- <property name="number" />
- </class>
-
-</hibernate-mapping>
\ No newline at end of file
17 years, 8 months
JBoss JBPM SVN: r1827 - in jbossbpm/spec/trunk/modules: api/src/main/java/org/jboss/bpm/runtime and 15 other directories.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-08-05 15:47:06 -0400 (Tue, 05 Aug 2008)
New Revision: 1827
Modified:
jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/ProcessBuilder.java
jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/ExecutionHandler.java
jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/Token.java
jbossbpm/spec/trunk/modules/dialects/api10/src/main/java/org/jboss/bpm/dialect/api10/ProcessUnmarshaller.java
jbossbpm/spec/trunk/modules/dialects/api10/src/test/java/org/jboss/bpm/dialect/api10/message/ProcessMessageTest.java
jbossbpm/spec/trunk/modules/dialects/jpdl32/src/main/java/org/jboss/bpm/dialect/jpdl32/ProcessDefinitionAdapter.java
jbossbpm/spec/trunk/modules/dialects/stp/src/main/java/org/jboss/bpm/dialect/stp/ProcessUnmarshaller.java
jbossbpm/spec/trunk/modules/dialects/xpdl21/src/main/java/org/jboss/bpm/dialect/xpdl21/WorkflowProcessAdapter.java
jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/client/internal/ExecutionManagerImpl.java
jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ActivityImpl.java
jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/GatewayImpl.java
jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/InputSetImpl.java
jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/IntermediateEventImpl.java
jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/OutputSetImpl.java
jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ProcessBuilderImpl.java
jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/SendTaskImpl.java
jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/StartEventImpl.java
jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/runtime/internal/TokenImpl.java
jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/AirticketProcessBuilder.java
jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/AvailabilityHandler.java
jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/ValidationHandler.java
jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/cts/process/ProcessIntegrityTest.java
jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/cts/process/ProcessStartTest.java
jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/cts/processmanager/ProcessRegistryTest.java
jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/cts/task/TaskMessageTest.java
jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/parallelsplit/ParallelSplitTest.java
jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/sequence/BasicSequenceTest.java
jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/task/BasicTaskTest.java
jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/task/TaskA.java
Log:
Move access to inputSet/outputSet to Token
Modified: jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/ProcessBuilder.java
===================================================================
--- jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/ProcessBuilder.java 2008-08-05 17:18:46 UTC (rev 1826)
+++ jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/ProcessBuilder.java 2008-08-05 19:47:06 UTC (rev 1827)
@@ -53,11 +53,19 @@
* Get the {@link Process}.
* <p/>
* This is the final call to the ProcessBuilder after all elements have been added.
- * @param initProcess If true the builder initializes the process
+ * The {@link Process} is initialized and put in state READY
*/
- Process getProcess(boolean initProcess);
+ Process getProcess();
/**
+ * Get the {@link Process} for inclusion in another.
+ * <p/>
+ * This is the final call to the ProcessBuilder after all elements have been added.
+ * The {@link Process} is not initialized and put in state READY
+ */
+ Process getProcessForInclude();
+
+ /**
* Add a {@link SequenceFlow} with a given name
*/
ProcessBuilder addSequenceFlow(String targetName);
Modified: jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/ExecutionHandler.java
===================================================================
--- jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/ExecutionHandler.java 2008-08-05 17:18:46 UTC (rev 1826)
+++ jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/ExecutionHandler.java 2008-08-05 19:47:06 UTC (rev 1827)
@@ -25,8 +25,6 @@
import org.jboss.bpm.client.ProcessEngine;
import org.jboss.bpm.model.FlowObject;
-import org.jboss.bpm.model.InputSet;
-import org.jboss.bpm.model.OutputSet;
/**
* The {@link ProcessEngine} invokes the ExecutionHandler on a
@@ -40,6 +38,6 @@
/**
* Execute the associated business logic.
*/
- void execute(Token token, InputSet input, OutputSet output);
+ void execute(Token token);
}
\ No newline at end of file
Modified: jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/Token.java
===================================================================
--- jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/Token.java 2008-08-05 17:18:46 UTC (rev 1826)
+++ jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/Token.java 2008-08-05 19:47:06 UTC (rev 1827)
@@ -24,7 +24,8 @@
//$Id$
import org.jboss.bpm.model.ConnectingObject;
-import org.jboss.bpm.model.Process;
+import org.jboss.bpm.model.InputSet;
+import org.jboss.bpm.model.OutputSet;
import org.jboss.bpm.model.SequenceFlow;
/**
@@ -47,11 +48,6 @@
String getTokenID();
/**
- * Get the associated {@link Process}
- */
- Process getProcess();
-
- /**
* Get the associated {@link ExecutionContext}
*/
ExecutionContext getExecutionContext();
@@ -62,6 +58,18 @@
ConnectingObject getFlow();
/**
+ * Get the active {@link InputSet}
+ * @return null if the {@link Activity} does not define one
+ */
+ InputSet getInputSet();
+
+ /**
+ * Get the active {@link OutputSet}
+ * @return null if the {@link Activity} does not define one
+ */
+ OutputSet getOutputSet();
+
+ /**
* Create a schallow copy of this Token.
* <p/>
* The content in the {@link ExecutionContext} will be copied by reference.
Modified: jbossbpm/spec/trunk/modules/dialects/api10/src/main/java/org/jboss/bpm/dialect/api10/ProcessUnmarshaller.java
===================================================================
--- jbossbpm/spec/trunk/modules/dialects/api10/src/main/java/org/jboss/bpm/dialect/api10/ProcessUnmarshaller.java 2008-08-05 17:18:46 UTC (rev 1826)
+++ jbossbpm/spec/trunk/modules/dialects/api10/src/main/java/org/jboss/bpm/dialect/api10/ProcessUnmarshaller.java 2008-08-05 19:47:06 UTC (rev 1827)
@@ -126,7 +126,7 @@
}
}
- Process proc = procBuilder.getProcess(!isInclude);
+ Process proc = (isInclude ? procBuilder.getProcessForInclude() : procBuilder.getProcess());
return proc;
}
Modified: jbossbpm/spec/trunk/modules/dialects/api10/src/test/java/org/jboss/bpm/dialect/api10/message/ProcessMessageTest.java
===================================================================
--- jbossbpm/spec/trunk/modules/dialects/api10/src/test/java/org/jboss/bpm/dialect/api10/message/ProcessMessageTest.java 2008-08-05 17:18:46 UTC (rev 1826)
+++ jbossbpm/spec/trunk/modules/dialects/api10/src/test/java/org/jboss/bpm/dialect/api10/message/ProcessMessageTest.java 2008-08-05 19:47:06 UTC (rev 1827)
@@ -51,7 +51,7 @@
procBuilder.addProcess(getName()).addStartEvent().addSequenceFlow("End").addEndEvent("End");
MessageBuilder msgBuilder = procBuilder.addMessage("FooMsg");
msgBuilder.addProperty("foo", "bar");
- Process expProc = procBuilder.getProcess(true);
+ Process expProc = procBuilder.getProcess();
ProcessManager pm = ProcessManager.locateProcessManager();
DialectHandler dh = pm.getDialectHandler(DialectHandler.DEFAULT_NAMESPACE_URI);
@@ -72,7 +72,7 @@
MessageBuilder msgBuilder = taskBuilder.addMessage("FooMsg");
msgBuilder.addProperty("foo", "bar");
procBuilder.addSequenceFlow("End").addEndEvent("End");
- Process expProc = procBuilder.getProcess(true);
+ Process expProc = procBuilder.getProcess();
ProcessManager pm = ProcessManager.locateProcessManager();
DialectHandler dh = pm.getDialectHandler(DialectHandler.DEFAULT_NAMESPACE_URI);
@@ -96,7 +96,7 @@
TaskBuilder taskBuilder = procBuilder.addTask("A", TaskType.Receive);
taskBuilder.addMessageRef("FooMsg");
procBuilder.addSequenceFlow("End").addEndEvent("End");
- Process expProc = procBuilder.getProcess(true);
+ Process expProc = procBuilder.getProcess();
ProcessManager pm = ProcessManager.locateProcessManager();
DialectHandler dh = pm.getDialectHandler(DialectHandler.DEFAULT_NAMESPACE_URI);
Modified: jbossbpm/spec/trunk/modules/dialects/jpdl32/src/main/java/org/jboss/bpm/dialect/jpdl32/ProcessDefinitionAdapter.java
===================================================================
--- jbossbpm/spec/trunk/modules/dialects/jpdl32/src/main/java/org/jboss/bpm/dialect/jpdl32/ProcessDefinitionAdapter.java 2008-08-05 17:18:46 UTC (rev 1826)
+++ jbossbpm/spec/trunk/modules/dialects/jpdl32/src/main/java/org/jboss/bpm/dialect/jpdl32/ProcessDefinitionAdapter.java 2008-08-05 19:47:06 UTC (rev 1827)
@@ -78,7 +78,7 @@
}
}
- Process proc = builder.getProcess(true);
+ Process proc = builder.getProcess();
return proc;
}
Modified: jbossbpm/spec/trunk/modules/dialects/stp/src/main/java/org/jboss/bpm/dialect/stp/ProcessUnmarshaller.java
===================================================================
--- jbossbpm/spec/trunk/modules/dialects/stp/src/main/java/org/jboss/bpm/dialect/stp/ProcessUnmarshaller.java 2008-08-05 17:18:46 UTC (rev 1826)
+++ jbossbpm/spec/trunk/modules/dialects/stp/src/main/java/org/jboss/bpm/dialect/stp/ProcessUnmarshaller.java 2008-08-05 19:47:06 UTC (rev 1827)
@@ -90,7 +90,7 @@
Element root = doc.getDocumentElement();
diagram = unmarshaller.unmarshal(root, BpmnDiagram.class).getValue();
- ProcessBuilder builder = adaptDiagram(diagram);
+ ProcessBuilder procBuilder = adaptDiagram(diagram);
// Initialize the list of sequence edges
Element poolEl = (Element)DOMUtils.getChildElements(root, "pools").next();
@@ -130,10 +130,10 @@
// Build the activities
for (Activity stpActivity : activities)
{
- adaptActivity(builder, stpActivity);
+ adaptActivity(procBuilder, stpActivity);
}
- Process proc = builder.getProcess(!isInclude);
+ Process proc = (isInclude ? procBuilder.getProcessForInclude() : procBuilder.getProcess());
return proc;
}
Modified: jbossbpm/spec/trunk/modules/dialects/xpdl21/src/main/java/org/jboss/bpm/dialect/xpdl21/WorkflowProcessAdapter.java
===================================================================
--- jbossbpm/spec/trunk/modules/dialects/xpdl21/src/main/java/org/jboss/bpm/dialect/xpdl21/WorkflowProcessAdapter.java 2008-08-05 17:18:46 UTC (rev 1826)
+++ jbossbpm/spec/trunk/modules/dialects/xpdl21/src/main/java/org/jboss/bpm/dialect/xpdl21/WorkflowProcessAdapter.java 2008-08-05 19:47:06 UTC (rev 1827)
@@ -70,7 +70,7 @@
}
}
- Process proc = builder.getProcess(true);
+ Process proc = builder.getProcess();
return proc;
}
}
Modified: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/client/internal/ExecutionManagerImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/client/internal/ExecutionManagerImpl.java 2008-08-05 17:18:46 UTC (rev 1826)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/client/internal/ExecutionManagerImpl.java 2008-08-05 19:47:06 UTC (rev 1827)
@@ -78,7 +78,7 @@
MutableFlowScheduler flowScheduler = rtProc.getFlowScheduler();
try
{
- Token initalToken = new TokenImpl(proc, att);
+ Token initalToken = new TokenImpl(att);
StartEvent start = proc.getStartEvent();
flowScheduler.scheduleTuple(new InitialFlow(start), initalToken);
Modified: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ActivityImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ActivityImpl.java 2008-08-05 17:18:46 UTC (rev 1826)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ActivityImpl.java 2008-08-05 19:47:06 UTC (rev 1827)
@@ -42,6 +42,7 @@
import org.jboss.bpm.runtime.FlowScheduler;
import org.jboss.bpm.runtime.MutablePropertySupport;
import org.jboss.bpm.runtime.Token;
+import org.jboss.bpm.runtime.internal.TokenImpl;
/**
* An activity is a generic term for work that a company or organization performs via business processes. An activity
@@ -52,7 +53,8 @@
* @since 08-Jul-2008
*/
@SuppressWarnings("serial")
-public abstract class ActivityImpl extends FlowObjectImpl implements Activity, MutablePropertySupport, SingleInFlowSetterSupport, SingleOutFlowSetterSupport
+public abstract class ActivityImpl extends FlowObjectImpl implements Activity, MutablePropertySupport,
+ SingleInFlowSetterSupport, SingleOutFlowSetterSupport
{
private String name;
private List<InputSet> inputSets = new ArrayList<InputSet>();
@@ -186,11 +188,12 @@
@Override
public void execute(Token token)
{
- OutputSetImpl outputSet = new OutputSetImpl();
- InputSet inputSet = getActiveInputSet(token);
- executeHandler(token, inputSet, outputSet);
- processOutputSet(token, outputSet);
- postProcessInputSet(token, inputSet);
+ TokenImpl tokenImpl = (TokenImpl)token;
+ tokenImpl.setOutputSet(getActiveOutputSet());
+ tokenImpl.setInputSet(getActiveInputSet(token));
+ executeHandler(token);
+ processOutputSet(token);
+ postProcessInputSet(token);
}
/**
@@ -236,55 +239,76 @@
}
/**
+ * Select the active outputSet
+ */
+ protected OutputSet getActiveOutputSet()
+ {
+ OutputSet outputSet = null;
+ if (outputSets.size() > 0)
+ {
+ if (outputSets.size() > 1)
+ throw new NotImplementedException("IORules and multiple outputSets not supported");
+
+ outputSet = new OutputSetImpl();
+ for (Property prop : outputSets.get(0).getProperties())
+ {
+ outputSet.addProperty(prop);
+ }
+ }
+
+ // Create an empty output set
+ if (outputSet == null)
+ outputSet = new OutputSetImpl();
+
+ return outputSet;
+ }
+
+ /**
* Execute external business logic
*/
- protected void executeHandler(Token token, InputSet inputSet, OutputSet outputSet)
+ protected void executeHandler(Token token)
{
// Call the execution handler with the InputSet
ExecutionHandler handler = getExecutionHandler();
if (handler != null)
{
- handler.execute(token, inputSet, outputSet);
+ handler.execute(token);
}
}
/**
* Transfer data from outputSet to Token
*/
- protected void processOutputSet(Token token, OutputSet outputSet)
+ protected void processOutputSet(Token token)
{
ExecutionContext exContext = token.getExecutionContext();
// Add the outputSet properties to the Token
- if (outputSet != null && outputSets.size() > 0)
+ OutputSet outputSet = token.getOutputSet();
+ for (Property prop : getActiveOutputSet().getProperties())
{
- if (outputSets.size() > 1)
- throw new NotImplementedException("IORules and multiple outputSets not supported");
+ Property outProp = outputSet.getProperty(prop.getName());
+ if (outProp == null)
+ throw new IllegalStateException("Cannot find outputSet property '" + prop.getName() + "' in Activity: " + getName());
- OutputSet auxSet = outputSets.get(0);
- for (Property prop : auxSet.getProperties())
- {
- Property outProp = outputSet.getProperty(prop.getName());
- if (outProp == null)
- throw new IllegalStateException("Cannot find required outputSet property '" + prop.getName()
- + "' in Activity: " + getName());
-
- exContext.addAttachment(outProp.getName(), outProp.getValue().getExpressionBody());
- }
+ String name = outProp.getName();
+ String value = outProp.getValue().getExpressionBody();
+ exContext.addAttachment(name, value);
}
}
/**
* Remove the inputSet properties
*/
- protected void postProcessInputSet(Token token, InputSet inputSet)
+ protected void postProcessInputSet(Token token)
{
-// ExecutionContext exContext = token.getExecutionContext();
-// for (Property prop : inputSet.getProperties())
-// {
-// // TODO: define proper scope for token data
-// exContext.removeAttachment(prop.getName());
-// }
+ // InputSet inputSet = token.getInputSet();
+ // ExecutionContext exContext = token.getExecutionContext();
+ // for (Property prop : inputSet.getProperties())
+ // {
+ // // TODO: define proper scope for token data
+ // exContext.removeAttachment(prop.getName());
+ // }
}
public FlowHandler getFlowHandler()
Modified: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/GatewayImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/GatewayImpl.java 2008-08-05 17:18:46 UTC (rev 1826)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/GatewayImpl.java 2008-08-05 19:47:06 UTC (rev 1827)
@@ -37,9 +37,7 @@
import org.jboss.bpm.model.Gate;
import org.jboss.bpm.model.Gateway;
import org.jboss.bpm.model.GraphicalElement;
-import org.jboss.bpm.model.InputSet;
import org.jboss.bpm.model.NameSupport;
-import org.jboss.bpm.model.OutputSet;
import org.jboss.bpm.model.SequenceFlow;
import org.jboss.bpm.model.Signal;
import org.jboss.bpm.model.SequenceFlow.ConditionType;
@@ -146,7 +144,7 @@
ExecutionHandler handler = getExecutionHandler();
if (handler != null)
{
- handler.execute(token, null, null);
+ handler.execute(token);
}
}
@@ -157,7 +155,7 @@
{
handler = new ExecutionHandler()
{
- public void execute(Token token, InputSet inputSet, OutputSet outputSet)
+ public void execute(Token token)
{
log.debug("Nothing to do in gateway: " + getName());
}
@@ -213,7 +211,7 @@
private Token mergeTokens(Token token)
{
- TokenImpl mergedToken = new TokenImpl(token.getProcess(), null);
+ TokenImpl mergedToken = new TokenImpl(null);
for (Token auxToken : mergeTokens)
mergedToken.mergeToken(auxToken);
Modified: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/InputSetImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/InputSetImpl.java 2008-08-05 17:18:46 UTC (rev 1826)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/InputSetImpl.java 2008-08-05 19:47:06 UTC (rev 1827)
@@ -25,7 +25,9 @@
import java.util.ArrayList;
import java.util.Collections;
+import java.util.LinkedHashMap;
import java.util.List;
+import java.util.Map;
import org.jboss.bpm.model.ArtifactInput;
import org.jboss.bpm.model.InputSet;
@@ -42,7 +44,7 @@
public class InputSetImpl extends SupportingElementImpl implements InputSet, MutablePropertySupport
{
private List<ArtifactInput> artInputs = new ArrayList<ArtifactInput>();
- private List<Property> props = new ArrayList<Property>();
+ private Map<String,Property> props = new LinkedHashMap<String,Property>();
public List<ArtifactInput> getArtifactInputs()
{
@@ -56,12 +58,7 @@
public Property getProperty(String name)
{
- for (Property prop : props)
- {
- if (prop.getName().equals(name))
- return prop;
- }
- return null;
+ return props.get(name);
}
public String getPropertyValue(String name)
@@ -72,21 +69,16 @@
public List<Property> getProperties()
{
- return Collections.unmodifiableList(props);
+ return Collections.unmodifiableList(new ArrayList<Property>(props.values()));
}
public List<String> getPropertyNames()
{
- List<String> names = new ArrayList<String>();
- for (Property prop : props)
- {
- names.add(prop.getName());
- }
- return names;
+ return new ArrayList<String>(props.keySet());
}
public void addProperty(Property prop)
{
- props.add(prop);
+ props.put(prop.getName(), prop);
}
}
Modified: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/IntermediateEventImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/IntermediateEventImpl.java 2008-08-05 17:18:46 UTC (rev 1826)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/IntermediateEventImpl.java 2008-08-05 19:47:06 UTC (rev 1827)
@@ -26,9 +26,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.bpm.model.ConnectingObject;
-import org.jboss.bpm.model.InputSet;
import org.jboss.bpm.model.IntermediateEvent;
-import org.jboss.bpm.model.OutputSet;
import org.jboss.bpm.model.Signal;
import org.jboss.bpm.runtime.ExecutionHandler;
import org.jboss.bpm.runtime.FlowHandler;
@@ -91,7 +89,7 @@
{
handler = new ExecutionHandler()
{
- public void execute(Token token, InputSet inputSet, OutputSet outputSet)
+ public void execute(Token token)
{
log.debug("Nothing to do in event");
}
Modified: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/OutputSetImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/OutputSetImpl.java 2008-08-05 17:18:46 UTC (rev 1826)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/OutputSetImpl.java 2008-08-05 19:47:06 UTC (rev 1827)
@@ -25,7 +25,9 @@
import java.util.ArrayList;
import java.util.Collections;
+import java.util.LinkedHashMap;
import java.util.List;
+import java.util.Map;
import org.jboss.bpm.model.ArtifactOutput;
import org.jboss.bpm.model.OutputSet;
@@ -42,7 +44,7 @@
public class OutputSetImpl extends SupportingElementImpl implements OutputSet, MutablePropertySupport
{
private List<ArtifactOutput> artOutputs = new ArrayList<ArtifactOutput>();
- private List<Property> props = new ArrayList<Property>();
+ private Map<String,Property> props = new LinkedHashMap<String,Property>();
public List<ArtifactOutput> getArtifactOutputs()
{
@@ -56,12 +58,7 @@
public Property getProperty(String name)
{
- for (Property prop : props)
- {
- if (prop.getName().equals(name))
- return prop;
- }
- return null;
+ return props.get(name);
}
public String getPropertyValue(String name)
@@ -72,21 +69,16 @@
public List<Property> getProperties()
{
- return Collections.unmodifiableList(props);
+ return Collections.unmodifiableList(new ArrayList<Property>(props.values()));
}
public List<String> getPropertyNames()
{
- List<String> names = new ArrayList<String>();
- for (Property prop : props)
- {
- names.add(prop.getName());
- }
- return names;
+ return new ArrayList<String>(props.keySet());
}
public void addProperty(Property prop)
{
- props.add(prop);
+ props.put(prop.getName(), prop);
}
}
Modified: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ProcessBuilderImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ProcessBuilderImpl.java 2008-08-05 17:18:46 UTC (rev 1826)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ProcessBuilderImpl.java 2008-08-05 19:47:06 UTC (rev 1827)
@@ -78,17 +78,21 @@
return this;
}
- public Process getProcess(boolean initProcess)
+ public Process getProcess()
{
if (proc == null)
throw new IllegalStateException("No process has been added");
-
- if (initProcess)
- proc.initialize();
-
+ proc.initialize();
return proc;
}
+ public Process getProcessForInclude()
+ {
+ if (proc == null)
+ throw new IllegalStateException("No process has been added");
+ return proc;
+ }
+
public ProcessBuilder addSequenceFlow(String targetName)
{
if (flowObject instanceof SingleOutFlowSetterSupport)
Modified: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/SendTaskImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/SendTaskImpl.java 2008-08-05 17:18:46 UTC (rev 1826)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/SendTaskImpl.java 2008-08-05 19:47:06 UTC (rev 1827)
@@ -27,11 +27,9 @@
import org.jboss.bpm.client.MessageManager;
import org.jboss.bpm.client.ObjectNameFactory;
import org.jboss.bpm.model.Entity;
-import org.jboss.bpm.model.InputSet;
import org.jboss.bpm.model.Message;
import org.jboss.bpm.model.MessageBuilder;
import org.jboss.bpm.model.MessageBuilderFactory;
-import org.jboss.bpm.model.OutputSet;
import org.jboss.bpm.model.Participant;
import org.jboss.bpm.model.Process;
import org.jboss.bpm.model.Property;
@@ -84,13 +82,13 @@
/**
* Execute external business logic
*/
- protected void executeHandler(Token token, InputSet inputSet, OutputSet outputSet)
+ protected void executeHandler(Token token)
{
// Call the execution handler with the InputSet
ExecutionHandler handler = getExecutionHandler();
if (handler != null)
{
- handler.execute(token, inputSet, outputSet);
+ handler.execute(token);
}
// Assume the the single IORule actually mapps the data
else
Modified: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/StartEventImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/StartEventImpl.java 2008-08-05 17:18:46 UTC (rev 1826)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/StartEventImpl.java 2008-08-05 19:47:06 UTC (rev 1827)
@@ -28,10 +28,8 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.bpm.NotImplementedException;
-import org.jboss.bpm.model.EventDetail;
import org.jboss.bpm.model.ConnectingObject;
-import org.jboss.bpm.model.InputSet;
-import org.jboss.bpm.model.OutputSet;
+import org.jboss.bpm.model.EventDetail;
import org.jboss.bpm.model.Signal;
import org.jboss.bpm.model.StartEvent;
import org.jboss.bpm.runtime.ExecutionHandler;
@@ -78,7 +76,7 @@
{
handler = new ExecutionHandler()
{
- public void execute(Token token, InputSet inputSet, OutputSet outputSet)
+ public void execute(Token token)
{
log.debug("Nothing to do in start-event");
}
Modified: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/runtime/internal/TokenImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/runtime/internal/TokenImpl.java 2008-08-05 17:18:46 UTC (rev 1826)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/runtime/internal/TokenImpl.java 2008-08-05 19:47:06 UTC (rev 1827)
@@ -24,6 +24,9 @@
//$Id$
import org.jboss.bpm.model.ConnectingObject;
+import org.jboss.bpm.model.FlowObject;
+import org.jboss.bpm.model.InputSet;
+import org.jboss.bpm.model.OutputSet;
import org.jboss.bpm.model.Process;
import org.jboss.bpm.runtime.Attachments;
import org.jboss.bpm.runtime.BasicAttachments;
@@ -35,11 +38,11 @@
/**
* A Token is a descriptive construct used to describe how the flow of a Process will proceed at runtime.
*
- * By tracking how the Token traverses the Flow Objects, gets diverted through alternative paths, and gets split into parallel paths, the normal Sequence Flow should be
- * completely definable.
+ * By tracking how the Token traverses the Flow Objects, gets diverted through alternative paths,
+ * and gets split into parallel paths, the normal Sequence Flow should be completely definable.
*
- * A Token will have a unique identity that can be used to separate multiple Tokens that may exist because of concurrent process instances or the splitting of the Token
- * for parallel processing within a single process instance.
+ * A Token will have a unique identity that can be used to separate multiple Tokens that may exist because of
+ * concurrent process instances or the splitting of the Token for parallel processing within a single process instance.
*
* @author Thomas.Diesler(a)jboss.com
* @since 20-Apr-2007
@@ -47,16 +50,16 @@
public class TokenImpl implements Token
{
private String id;
- private Process proc;
private ConnectingObject flow;
private ExecutionContext context;
+ private InputSet inputSet;
+ private OutputSet outputSet;
/**
* Construct a Token with a given {@link Process} and {@link Attachments}
*/
- public TokenImpl(Process proc, Attachments att)
+ public TokenImpl(Attachments att)
{
- this.proc = proc;
this.context = new InitialContext(att);
this.id = new UID().toString();
}
@@ -66,11 +69,6 @@
return id;
}
- public Process getProcess()
- {
- return proc;
- }
-
public ExecutionContext getExecutionContext()
{
return context;
@@ -86,6 +84,26 @@
this.flow = flow;
}
+ public InputSet getInputSet()
+ {
+ return inputSet;
+ }
+
+ public void setInputSet(InputSet inputSet)
+ {
+ this.inputSet = inputSet;
+ }
+
+ public OutputSet getOutputSet()
+ {
+ return outputSet;
+ }
+
+ public void setOutputSet(OutputSet outputSet)
+ {
+ this.outputSet = outputSet;
+ }
+
/**
* Create a schallow copy of this Token.
* <p/>
@@ -93,7 +111,7 @@
*/
public Token copyToken()
{
- return new TokenImpl(proc, context);
+ return new TokenImpl(context);
}
/**
@@ -115,7 +133,8 @@
public String toString()
{
- return "[proc=" + proc.getID() + ",ctx=" + context + "]";
+ FlowObject fo = (FlowObject)flow.getTargetRef();
+ return "[fo=" + fo + ",ctx=" + context + "]";
}
static class InitialContext extends BasicAttachments implements ExecutionContext
Modified: jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/AirticketProcessBuilder.java
===================================================================
--- jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/AirticketProcessBuilder.java 2008-08-05 17:18:46 UTC (rev 1826)
+++ jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/AirticketProcessBuilder.java 2008-08-05 19:47:06 UTC (rev 1827)
@@ -254,7 +254,7 @@
addProperty(PROPERTY_PRICE, null, true);
// Get the process
- Process proc = procBuilder.getProcess(true);
+ Process proc = procBuilder.getProcess();
return proc;
}
}
\ No newline at end of file
Modified: jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/AvailabilityHandler.java
===================================================================
--- jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/AvailabilityHandler.java 2008-08-05 17:18:46 UTC (rev 1826)
+++ jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/AvailabilityHandler.java 2008-08-05 19:47:06 UTC (rev 1827)
@@ -39,8 +39,10 @@
@SuppressWarnings("serial")
public class AvailabilityHandler implements ExecutionHandler
{
- public void execute(Token token, InputSet inputSet, OutputSet outputSet)
+ public void execute(Token token)
{
+ InputSet inputSet = token.getInputSet();
+ OutputSet outputSet = token.getOutputSet();
PropertyBuilder builder = PropertyBuilderFactory.newInstance().newPropertyBuilder();
Integer seats = Integer.valueOf(inputSet.getPropertyValue(AirticketProcessBuilder.PROPERTY_SEATS));
outputSet.addProperty(builder.newProperty(AirticketProcessBuilder.PROPERTY_IS_AVAILABLE, new Boolean(seats < 10).toString()));
Modified: jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/ValidationHandler.java
===================================================================
--- jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/ValidationHandler.java 2008-08-05 17:18:46 UTC (rev 1826)
+++ jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/ValidationHandler.java 2008-08-05 19:47:06 UTC (rev 1827)
@@ -39,8 +39,10 @@
@SuppressWarnings("serial")
public class ValidationHandler implements ExecutionHandler
{
- public void execute(Token token, InputSet inputSet, OutputSet outputSet)
+ public void execute(Token token)
{
+ InputSet inputSet = token.getInputSet();
+ OutputSet outputSet = token.getOutputSet();
String name = inputSet.getPropertyValue(AirticketProcessBuilder.PROPERTY_NAME);
String from = inputSet.getPropertyValue(AirticketProcessBuilder.PROPERTY_FROM);
String to = inputSet.getPropertyValue(AirticketProcessBuilder.PROPERTY_TO);
Modified: jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/cts/process/ProcessIntegrityTest.java
===================================================================
--- jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/cts/process/ProcessIntegrityTest.java 2008-08-05 17:18:46 UTC (rev 1826)
+++ jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/cts/process/ProcessIntegrityTest.java 2008-08-05 19:47:06 UTC (rev 1827)
@@ -48,7 +48,7 @@
// Create a Process through the ProcessBuilder
ProcessBuilder builder = ProcessBuilderFactory.newInstance().newProcessBuilder();
Process proc = builder.addProcess(null).addStartEvent().addSequenceFlow("taskA").addTask("taskA").
- addSequenceFlow("end").addEndEvent("end").getProcess(true);
+ addSequenceFlow("end").addEndEvent("end").getProcess();
assertEquals("AnonymousProcess#0", proc.getName());
StartEvent start = proc.getStartEvent();
@@ -68,7 +68,7 @@
{
// Create a Process through the ProcessBuilder
ProcessBuilder builder = ProcessBuilderFactory.newInstance().newProcessBuilder();
- builder.addProcess(null).addTask("taskA").addSequenceFlow("end").addEndEvent("end").getProcess(true);
+ builder.addProcess(null).addTask("taskA").addSequenceFlow("end").addEndEvent("end").getProcess();
fail("InvalidProcessException expected");
}
catch (InvalidProcessException ex)
@@ -84,7 +84,7 @@
// Create a Process through the ProcessBuilder
ProcessBuilder builder = ProcessBuilderFactory.newInstance().newProcessBuilder();
builder.addProcess(null).addStartEvent().addSequenceFlow("taskA").addTask("taskA").addSequenceFlow("end").
- addTask("end").getProcess(true);
+ addTask("end").getProcess();
fail("InvalidProcessException expected");
}
catch (InvalidProcessException ex)
Modified: jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/cts/process/ProcessStartTest.java
===================================================================
--- jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/cts/process/ProcessStartTest.java 2008-08-05 17:18:46 UTC (rev 1826)
+++ jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/cts/process/ProcessStartTest.java 2008-08-05 19:47:06 UTC (rev 1827)
@@ -66,7 +66,7 @@
{
ProcessBuilder builder = ProcessBuilderFactory.newInstance().newProcessBuilder();
Process proc = builder.addProcess(getName()).addStartEvent().addSequenceFlow("taskA").
- addTask("taskA").addSequenceFlow("end").addEndEvent("end").getProcess(true);
+ addTask("taskA").addSequenceFlow("end").addEndEvent("end").getProcess();
return proc;
}
}
Modified: jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/cts/processmanager/ProcessRegistryTest.java
===================================================================
--- jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/cts/processmanager/ProcessRegistryTest.java 2008-08-05 17:18:46 UTC (rev 1826)
+++ jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/cts/processmanager/ProcessRegistryTest.java 2008-08-05 19:47:06 UTC (rev 1827)
@@ -76,7 +76,7 @@
{
ProcessBuilder builder = ProcessBuilderFactory.newInstance().newProcessBuilder();
Process proc = builder.addProcess(getName()).addStartEvent().addSequenceFlow("taskA").
- addTask("taskA").addSequenceFlow("end").addEndEvent("end").getProcess(true);
+ addTask("taskA").addSequenceFlow("end").addEndEvent("end").getProcess();
return proc;
}
}
Modified: jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/cts/task/TaskMessageTest.java
===================================================================
--- jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/cts/task/TaskMessageTest.java 2008-08-05 17:18:46 UTC (rev 1826)
+++ jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/cts/task/TaskMessageTest.java 2008-08-05 19:47:06 UTC (rev 1827)
@@ -44,7 +44,7 @@
procBuilder.addTask("A", TaskType.Receive).addSequenceFlow("End").addEndEvent("End");
try
{
- procBuilder.getProcess(true);
+ procBuilder.getProcess();
fail("A Message for the MessageRef attribute MUST be entered");
}
catch (InvalidProcessException ex)
@@ -60,7 +60,7 @@
procBuilder.addTask("A", TaskType.Send).addSequenceFlow("End").addEndEvent("End");
try
{
- procBuilder.getProcess(true);
+ procBuilder.getProcess();
fail("A Message for the MessageRef attribute MUST be entered");
}
catch (InvalidProcessException ex)
Modified: jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/parallelsplit/ParallelSplitTest.java
===================================================================
--- jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/parallelsplit/ParallelSplitTest.java 2008-08-05 17:18:46 UTC (rev 1826)
+++ jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/parallelsplit/ParallelSplitTest.java 2008-08-05 19:47:06 UTC (rev 1827)
@@ -73,7 +73,7 @@
// Create a Process through the ProcessBuilder
ProcessBuilder procBuilder = ProcessBuilderFactory.newInstance().newProcessBuilder();
Process proc = procBuilder.addProcess(getName()).addStartEvent().addSequenceFlow("gateway").addGateway("gateway", GatewayType.Parallel).
- addSequenceFlow("endA").addSequenceFlow("endB").addEndEvent("endA").addEndEvent("endB").getProcess(true);
+ addSequenceFlow("endA").addSequenceFlow("endB").addEndEvent("endA").addEndEvent("endB").getProcess();
runProcess(proc);
}
Modified: jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/sequence/BasicSequenceTest.java
===================================================================
--- jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/sequence/BasicSequenceTest.java 2008-08-05 17:18:46 UTC (rev 1826)
+++ jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/sequence/BasicSequenceTest.java 2008-08-05 19:47:06 UTC (rev 1827)
@@ -73,7 +73,7 @@
// Create a Process through the ProcessBuilder
ProcessBuilder procBuilder = ProcessBuilderFactory.newInstance().newProcessBuilder();
Process proc = procBuilder.addProcess(getName()).addStartEvent().addSequenceFlow("stateA").addTask("stateA").
- addSequenceFlow("end").addEndEvent("end").getProcess(true);
+ addSequenceFlow("end").addEndEvent("end").getProcess();
runProcess(proc);
}
Modified: jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/task/BasicTaskTest.java
===================================================================
--- jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/task/BasicTaskTest.java 2008-08-05 17:18:46 UTC (rev 1826)
+++ jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/task/BasicTaskTest.java 2008-08-05 19:47:06 UTC (rev 1827)
@@ -73,7 +73,7 @@
// Create a Process through the ProcessBuilder
ProcessBuilder procBuilder = ProcessBuilderFactory.newInstance().newProcessBuilder();
Process proc = procBuilder.addProcess(getName()).addStartEvent().addSequenceFlow("stateA").addTask("stateA").
- addExecutionHandler(TaskA.class).addSequenceFlow("end").addEndEvent("end").getProcess(true);
+ addExecutionHandler(TaskA.class).addSequenceFlow("end").addEndEvent("end").getProcess();
runProcess(proc);
}
Modified: jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/task/TaskA.java
===================================================================
--- jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/task/TaskA.java 2008-08-05 17:18:46 UTC (rev 1826)
+++ jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/task/TaskA.java 2008-08-05 19:47:06 UTC (rev 1827)
@@ -23,11 +23,7 @@
// $Id$
-import org.jboss.bpm.model.InputSet;
-import org.jboss.bpm.model.OutputSet;
-import org.jboss.bpm.model.Property;
-import org.jboss.bpm.model.PropertyBuilder;
-import org.jboss.bpm.model.PropertyBuilderFactory;
+import org.jboss.bpm.runtime.ExecutionContext;
import org.jboss.bpm.runtime.ExecutionHandler;
import org.jboss.bpm.runtime.Token;
@@ -40,10 +36,9 @@
@SuppressWarnings("serial")
public class TaskA implements ExecutionHandler
{
- public void execute(Token token, InputSet inputSet, OutputSet outputSet)
+ public void execute(Token token)
{
- PropertyBuilder builder = PropertyBuilderFactory.newInstance().newPropertyBuilder();
- Property prop = builder.newProperty("SomeString", "Task: TaskA");
- outputSet.addProperty(prop);
+ ExecutionContext exContext = token.getExecutionContext();
+ exContext.addAttachment("SomeString", "Task: TaskA");
}
}
17 years, 9 months
JBoss JBPM SVN: r1826 - in jbpm4/pvm/trunk/modules/core/src: test/java/org/jbpm/pvm and 5 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2008-08-05 13:18:46 -0400 (Tue, 05 Aug 2008)
New Revision: 1826
Added:
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/ExclusiveTestCommand.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailOnceTestCommand.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailingTestCommand.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/TestMessageCommand.java
Removed:
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/ExclusiveTestMessage.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailOnceTestMessage.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailingTestMessage.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTimerSessionTest.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/TestMessage.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/TestTimer.java
Modified:
jbpm4/pvm/trunk/modules/core/src/main/resources/org/jbpm/pvm/hibernate.definition.hbm.xml
jbpm4/pvm/trunk/modules/core/src/main/resources/org/jbpm/pvm/hibernate.job.hbm.xml
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/DbTests.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/db/langext/LanguageExtensionsDbTest.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/db/model/WireDbTest.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTest.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTests.java
jbpm4/pvm/trunk/modules/core/src/test/resources/environment.cfg.xml
jbpm4/pvm/trunk/modules/core/src/test/resources/logging.properties
jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/internal/db/langext/environment.cfg.xml
Log:
updated job executor test to new test suite base classes
Modified: jbpm4/pvm/trunk/modules/core/src/main/resources/org/jbpm/pvm/hibernate.definition.hbm.xml
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/resources/org/jbpm/pvm/hibernate.definition.hbm.xml 2008-08-05 16:42:37 UTC (rev 1825)
+++ jbpm4/pvm/trunk/modules/core/src/main/resources/org/jbpm/pvm/hibernate.definition.hbm.xml 2008-08-05 17:18:46 UTC (rev 1826)
@@ -340,6 +340,7 @@
<column name="OBJ_ID_" />
</any>
<property name="expression" column="OBJ_EXPRESSION_"/>
+ <property name="expressionLanguage" column="OBJ_EXPRLANG_"/>
<subclass name="EventListenerReference" discriminator-value="evtlis">
<property name="isPropagationEnabled" column="PROPAGATE_" />
Modified: jbpm4/pvm/trunk/modules/core/src/main/resources/org/jbpm/pvm/hibernate.job.hbm.xml
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/resources/org/jbpm/pvm/hibernate.job.hbm.xml 2008-08-05 16:42:37 UTC (rev 1825)
+++ jbpm4/pvm/trunk/modules/core/src/main/resources/org/jbpm/pvm/hibernate.job.hbm.xml 2008-08-05 17:18:46 UTC (rev 1826)
@@ -31,6 +31,12 @@
cascade="none"
foreign-key="FK_JOB_EXE"
index="IDX_JOB_EXE"/>
+ <many-to-one name="commandDescriptor"
+ column="CMDDESCR_"
+ class="org.jbpm.pvm.internal.wire.descriptor.AbstractDescriptor"
+ cascade="all"
+ foreign-key="FK_JOB_CMDDESCR"
+ index="IDX_JOB_CMDDESCR"/>
<subclass name="MessageImpl" discriminator-value="Msg">
<subclass name="org.jbpm.pvm.internal.model.op.ExecuteNodeMessage" discriminator-value="ExeNodeMsg" />
@@ -43,6 +49,7 @@
</subclass>
<subclass name="org.jbpm.pvm.internal.model.op.TakeTransitionMessage" discriminator-value="TakeTrMsg" />
<subclass name="org.jbpm.pvm.internal.model.op.ProceedToDestinationMessage" discriminator-value="ProceedDestMsg" />
+ <subclass name="org.jbpm.pvm.internal.job.CommandMessage" discriminator-value="CmdMsg" />
</subclass>
<subclass name="TimerImpl" discriminator-value="Timer">
Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/DbTests.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/DbTests.java 2008-08-05 16:42:37 UTC (rev 1825)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/DbTests.java 2008-08-05 17:18:46 UTC (rev 1826)
@@ -47,7 +47,7 @@
defaultConfigTests.addTest(DbSvcTests.suite());
defaultConfigTests.addTest(SpringTests.suite());
defaultConfigTests.addTest(JobExecutorTests.suite());
- defaultConfigTests.addTest(ContinuationTests.suite());
+ // defaultConfigTests.addTest(ContinuationTests.suite());
// TODO wrap the suite with a test setup that creates and closes the environment factory
// something like this:
Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/db/langext/LanguageExtensionsDbTest.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/db/langext/LanguageExtensionsDbTest.java 2008-08-05 16:42:37 UTC (rev 1825)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/db/langext/LanguageExtensionsDbTest.java 2008-08-05 17:18:46 UTC (rev 1826)
@@ -35,8 +35,11 @@
/**
* @author Tom Baeyens
*/
-public class LanguageExtensionsDbTest extends EnvironmentDbTestCase
-{
+public class LanguageExtensionsDbTest extends EnvironmentDbTestCase {
+
+ public LanguageExtensionsDbTest() {
+ super("org/jbpm/pvm/internal/db/langext/environment.cfg.xml");
+ }
/**
* Defines a simple process: only nodes and transitions.
Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/db/model/WireDbTest.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/db/model/WireDbTest.java 2008-08-05 16:42:37 UTC (rev 1825)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/db/model/WireDbTest.java 2008-08-05 17:18:46 UTC (rev 1826)
@@ -107,7 +107,7 @@
descriptor = (ClassDescriptor) dbSession.get(AbstractDescriptor.class, descriptor.getDbid());
assertEquals("n", descriptor.getName());
- assertEquals(EventImpl.class, descriptor.construct(new WireContext()));
+ assertEquals(EventImpl.class, WireContext.create(descriptor));
}
public void testDoubleDescriptor() {
Copied: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/ExclusiveTestCommand.java (from rev 1819, jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/ExclusiveTestMessage.java)
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/ExclusiveTestCommand.java (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/ExclusiveTestCommand.java 2008-08-05 17:18:46 UTC (rev 1826)
@@ -0,0 +1,98 @@
+/*
+ * 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.pvm.internal.jobexecutor;
+
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Random;
+import java.util.Set;
+
+import org.hibernate.Session;
+import org.jbpm.pvm.env.Environment;
+import org.jbpm.pvm.internal.cmd.Command;
+import org.jbpm.pvm.internal.job.CommandMessage;
+import org.jbpm.pvm.internal.log.Log;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.wire.descriptor.LongDescriptor;
+import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
+import org.jbpm.pvm.model.OpenExecution;
+import org.jbpm.pvm.session.DbSession;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ExclusiveTestCommand implements Command<Object> {
+
+ private static final long serialVersionUID = 1L;
+ private static final Log log = Log.getLog(ExclusiveTestCommand.class.getName());
+ static Random random = new Random();
+
+ long executionId;
+
+ public ExclusiveTestCommand() {
+ }
+
+ public static CommandMessage createMessage(OpenExecution execution) {
+ CommandMessage commandMessage = new CommandMessage();
+ commandMessage.setExecution((ExecutionImpl) execution);
+ commandMessage.setExclusive(true);
+
+ ObjectDescriptor commandDescriptor = new ObjectDescriptor(ExclusiveTestCommand.class);
+ commandDescriptor.addInjection("executionId", new LongDescriptor(execution.getDbid()));
+ commandMessage.setCommandDescriptor(commandDescriptor);
+ return commandMessage;
+ }
+
+ public Object execute(Environment environment) throws Exception {
+ Long threadId = Thread.currentThread().getId();
+
+ Session session = environment.get(Session.class);
+ ExecutionImpl execution = (ExecutionImpl) session.get(ExecutionImpl.class, executionId);
+
+ String executionKey = execution.getKey();
+
+ // exclusiveMessageIds maps execution keys to a set of thread ids.
+ // the idea is that for each execution, all the exclusive jobs will
+ // be executed by 1 thread sequentially.
+
+ // in the end, each set should contain exactly 1 element
+ Set<Long> groupMessages = JobExecutorTest.exclusiveThreadIds.get(executionKey);
+ if (groupMessages==null) {
+ groupMessages = new HashSet<Long>();
+ JobExecutorTest.exclusiveThreadIds.put(executionKey, groupMessages);
+ }
+ groupMessages.add(threadId);
+
+ // let's assume that an average jobImpl takes between 0 and 150 millis to complete.
+ int workTime = random.nextInt(150);
+ log.debug("executing exclusive message for "+execution+". this is going to take "+workTime+"ms");
+ try {
+ Thread.sleep(workTime);
+ } catch (RuntimeException e) {
+ log.debug("sleeping was interrupted");
+ }
+
+ return null;
+ }
+
+}
Deleted: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/ExclusiveTestMessage.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/ExclusiveTestMessage.java 2008-08-05 16:42:37 UTC (rev 1825)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/ExclusiveTestMessage.java 2008-08-05 17:18:46 UTC (rev 1826)
@@ -1,87 +0,0 @@
-/*
- * 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.pvm.internal.jobexecutor;
-
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Random;
-import java.util.Set;
-
-import org.jbpm.pvm.env.Environment;
-import org.jbpm.pvm.internal.job.MessageImpl;
-import org.jbpm.pvm.internal.log.Log;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
-import org.jbpm.pvm.model.OpenExecution;
-import org.jbpm.pvm.session.DbSession;
-
-
-/**
- * @author Tom Baeyens
- */
-public class ExclusiveTestMessage extends MessageImpl<Object> {
-
- private static final long serialVersionUID = 1L;
- private static final Log log = Log.getLog(ExclusiveTestMessage.class.getName());
- static Random random = new Random();
-
- public ExclusiveTestMessage() {
- }
-
- public ExclusiveTestMessage(OpenExecution execution) {
- this.execution = (ExecutionImpl) execution;
- this.processInstance = (ExecutionImpl) execution.getProcessInstance();
- this.isExclusive = true;
- }
-
- public Object execute(Environment environment) throws Exception {
- Long threadId = Thread.currentThread().getId();
- String executionKey = execution.getKey();
-
- // exclusiveMessageIds maps execution keys to a set of thread ids.
- // the idea is that for each execution, all the exclusive jobs will
- // be executed by 1 thread sequentially.
-
- // in the end, each set should contain exactly 1 element
- Map<String, Set<Long>> exclusiveThreadIds = (Map<String, Set<Long>>) environment.get("exclusiveThreadIds");
- Set<Long> groupMessages = exclusiveThreadIds.get(executionKey);
- if (groupMessages==null) {
- groupMessages = new HashSet<Long>();
- exclusiveThreadIds.put(executionKey, groupMessages);
- }
- groupMessages.add(threadId);
-
- // let's assume that an average jobImpl takes between 0 and 150 millis to complete.
- int workTime = random.nextInt(150);
- log.debug("executing exclusive message for "+execution+". this is going to take "+workTime+"ms");
- try {
- Thread.sleep(workTime);
- } catch (RuntimeException e) {
- log.debug("sleeping was interrupted");
- }
-
- DbSession dbSession = environment.get(DbSession.class);
- dbSession.delete(this);
-
- return null;
- }
-
-}
Copied: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailOnceTestCommand.java (from rev 1819, jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailOnceTestMessage.java)
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailOnceTestCommand.java (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailOnceTestCommand.java 2008-08-05 17:18:46 UTC (rev 1826)
@@ -0,0 +1,78 @@
+/*
+ * 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.pvm.internal.jobexecutor;
+
+import org.jbpm.pvm.env.Environment;
+import org.jbpm.pvm.internal.cmd.Command;
+import org.jbpm.pvm.internal.job.CommandMessage;
+import org.jbpm.pvm.internal.job.MessageImpl;
+import org.jbpm.pvm.internal.log.Log;
+import org.jbpm.pvm.internal.model.CommentImpl;
+import org.jbpm.pvm.internal.wire.descriptor.IntegerDescriptor;
+import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
+import org.jbpm.pvm.model.Comment;
+import org.jbpm.pvm.session.DbSession;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class FailOnceTestCommand implements Command<Object> {
+
+ private static final long serialVersionUID = 1L;
+ private static final Log log = Log.getLog(FailOnceTestCommand.class.getName());
+
+ int messageId;
+
+ public FailOnceTestCommand() {
+ }
+
+ public static CommandMessage createMessage(int messageId) {
+ CommandMessage commandMessage = new CommandMessage();
+ ObjectDescriptor commandDescriptor = new ObjectDescriptor(FailOnceTestCommand.class);
+ commandDescriptor.addInjection("messageId", new IntegerDescriptor(messageId));
+ commandMessage.setCommandDescriptor(commandDescriptor);
+ return commandMessage;
+ }
+
+ public Object execute(Environment environment) throws Exception {
+ DbSession dbSession = environment.get(DbSession.class);
+
+ // this message execution should be rolled back
+ Comment comment = new CommentImpl(Integer.toString(messageId));
+ dbSession.save(comment);
+
+ if (!JobExecutorTest.failOnceMessageIds.contains(messageId)) {
+ // registering the failed message in a non-transactional resource
+ // so the messageId will still be added even after the transaction has rolled back
+ log.debug("adding failonce message "+messageId);
+ JobExecutorTest.failOnceMessageIds.add(messageId);
+
+ throw new RuntimeException("failing once");
+ }
+
+ log.debug("message "+messageId+" now succeeds");
+
+ return null;
+ }
+
+}
Deleted: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailOnceTestMessage.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailOnceTestMessage.java 2008-08-05 16:42:37 UTC (rev 1825)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailOnceTestMessage.java 2008-08-05 17:18:46 UTC (rev 1826)
@@ -1,75 +0,0 @@
-/*
- * 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.pvm.internal.jobexecutor;
-
-import java.util.List;
-
-import org.jbpm.pvm.env.Environment;
-import org.jbpm.pvm.internal.job.MessageImpl;
-import org.jbpm.pvm.internal.log.Log;
-import org.jbpm.pvm.internal.model.CommentImpl;
-import org.jbpm.pvm.model.Comment;
-import org.jbpm.pvm.session.DbSession;
-
-
-/**
- * @author Tom Baeyens
- */
-public class FailOnceTestMessage extends MessageImpl<Object> {
-
- private static final long serialVersionUID = 1L;
- private static final Log log = Log.getLog(FailOnceTestMessage.class.getName());
-
- int messageId;
-
- public FailOnceTestMessage() {
- }
-
- public FailOnceTestMessage(int messageId) {
- this.messageId = messageId;
- }
-
- public Object execute(Environment environment) throws Exception {
- DbSession dbSession = environment.get(DbSession.class);
-
- // this message execution should be rolled back
- Comment comment = new CommentImpl(Integer.toString(messageId));
- dbSession.save(comment);
-
- dbSession.delete(this);
-
- List<Integer> failOnceMessageIds = (List) environment.get("failOnceMessageIds");
- if (!failOnceMessageIds.contains(messageId)) {
- // registering the failed message in a non-transactional resource
- // so the messageId will still be added even after the transaction has rolled back
- log.debug("adding failonce message "+messageId);
- failOnceMessageIds.add(messageId);
-
- throw new RuntimeException("failing once");
- }
-
- log.debug("message "+messageId+" now succeeds");
-
- return null;
- }
-
-}
Copied: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailingTestCommand.java (from rev 1819, jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailingTestMessage.java)
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailingTestCommand.java (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailingTestCommand.java 2008-08-05 17:18:46 UTC (rev 1826)
@@ -0,0 +1,57 @@
+/*
+ * 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.pvm.internal.jobexecutor;
+
+import org.jbpm.pvm.env.Environment;
+import org.jbpm.pvm.internal.cmd.Command;
+import org.jbpm.pvm.internal.job.CommandMessage;
+import org.jbpm.pvm.internal.model.CommentImpl;
+import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
+import org.jbpm.pvm.model.Comment;
+import org.jbpm.pvm.session.DbSession;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class FailingTestCommand implements Command<Object> {
+
+ private static final long serialVersionUID = 1L;
+
+ public Object execute(Environment environment) throws Exception {
+ DbSession dbSession = environment.get(DbSession.class);
+
+ // this message execution should be rolled back
+ Comment comment = new CommentImpl("failing update");
+ dbSession.save(comment);
+
+ throw new RuntimeException("ooops");
+ }
+
+ public static CommandMessage createMessage() {
+ CommandMessage commandMessage = new CommandMessage();
+ ObjectDescriptor commandDescriptor = new ObjectDescriptor(FailingTestCommand.class);
+ commandMessage.setCommandDescriptor(commandDescriptor);
+ return commandMessage;
+ }
+
+}
Deleted: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailingTestMessage.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailingTestMessage.java 2008-08-05 16:42:37 UTC (rev 1825)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailingTestMessage.java 2008-08-05 17:18:46 UTC (rev 1826)
@@ -1,50 +0,0 @@
-/*
- * 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.pvm.internal.jobexecutor;
-
-import org.jbpm.pvm.env.Environment;
-import org.jbpm.pvm.internal.job.MessageImpl;
-import org.jbpm.pvm.internal.model.CommentImpl;
-import org.jbpm.pvm.model.Comment;
-import org.jbpm.pvm.session.DbSession;
-
-
-/**
- * @author Tom Baeyens
- */
-public class FailingTestMessage extends MessageImpl<Object> {
-
- private static final long serialVersionUID = 1L;
-
- public Object execute(Environment environment) throws Exception {
- DbSession dbSession = environment.get(DbSession.class);
-
- // this message execution should be rolled back
- Comment comment = new CommentImpl("failing update");
- dbSession.save(comment);
-
- dbSession.delete(this);
-
- throw new RuntimeException("ooops");
- }
-
-}
Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTest.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTest.java 2008-08-05 16:42:37 UTC (rev 1825)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTest.java 2008-08-05 17:18:46 UTC (rev 1826)
@@ -21,6 +21,8 @@
*/
package org.jbpm.pvm.internal.jobexecutor;
+import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -28,79 +30,51 @@
import java.util.TimerTask;
import org.hibernate.Session;
-import org.jbpm.pvm.test.base.EnvironmentFactoryTestCase;
import org.jbpm.pvm.client.ClientProcessDefinition;
import org.jbpm.pvm.client.ClientProcessInstance;
import org.jbpm.pvm.env.Environment;
import org.jbpm.pvm.env.Transaction;
+import org.jbpm.pvm.internal.cmd.Command;
+import org.jbpm.pvm.internal.job.CommandMessage;
import org.jbpm.pvm.internal.job.JobImpl;
-import org.jbpm.pvm.internal.jobexecutor.JobDbSession;
-import org.jbpm.pvm.internal.jobexecutor.JobExecutor;
import org.jbpm.pvm.internal.log.Log;
import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
import org.jbpm.pvm.job.Job;
import org.jbpm.pvm.model.Comment;
import org.jbpm.pvm.session.MessageSession;
import org.jbpm.pvm.session.PvmDbSession;
+import org.jbpm.pvm.test.base.DbTestCase;
/**
* @author Tom Baeyens
*/
-public class JobExecutorTest extends EnvironmentFactoryTestCase {
+public class JobExecutorTest extends DbTestCase {
private static final Log log = Log.getLog(JobExecutorTest.class.getName());
- public JobExecutorTest() {
- super("org/jbpm/pvm/internal/jobexecutor/environment.cfg.xml");
+ static List<Integer> processedMessageIds;
+ static Map<String, Set<Long>> exclusiveThreadIds;
+ static List<Integer> failOnceMessageIds;
+
+ static int nbrOfTestMessages = 10;
+ static int timeoutMillis = 10000;
+ static int checkInterval = 400;
+ static int nbrOfTestMessagesPerExecution = 7;
+ static int nbrOfTestExecutions = 5;
+
+ public void setUp() throws Exception {
+ super.setUp();
+ processedMessageIds = new ArrayList<Integer>();
+ exclusiveThreadIds = new HashMap<String, Set<Long>>();
+ failOnceMessageIds = new ArrayList<Integer>();
}
-
- /**
- * test the case where the jobExecutor is start and shortly after stopped.
- * It can appears for example in other tests with auto-start activated
- * if the test is too short.
- *
- * The jobExecutor is registered as active when the run method is invoked.
- * It happens only after a system context switching. If the jobExecutor is
- * stopped before that, it won't really be stopped because it has not been
- * started yet.
- */
- public void testImmediateJobExecutorShutdown() throws InterruptedException {
-
- // if the test fail, there can be a live lock
- // install a timer that will interrupt if it takes too long
- // if that happens, it will lead to an interrupted exception and the test will fail
- final Thread testThread = Thread.currentThread();
- TimerTask interruptTask = new TimerTask() {
- public void run() {
- log.debug("test "+getName()+" took too long. going to interrupt..."+testThread);
- testThread.interrupt();
- }
- };
- Timer timer = new Timer();
- timer.schedule(interruptTask, 10000);
- final JobExecutor jobExecutor = getEnvironmentFactory().get(JobExecutor.class);
- jobExecutor.setIdleInterval(1000);
- assertFalse(jobExecutor.isActive());
- jobExecutor.start();
- jobExecutor.stop();
- Thread.sleep(800);
- assertFalse(jobExecutor.isActive());
- }
-
public void testSuccessfulMessageProcessing() {
- int nbrOfTestMessages = 5;
- int testTimeoutMillis = 10000;
- int checkInterval = 500;
-
- List<Integer> processedMessageIds = (List<Integer>) getEnvironmentFactory().get("processedMessageIds");
- processedMessageIds.clear();
-
JobExecutor jobExecutor = getEnvironmentFactory().get(JobExecutor.class);
jobExecutor.start();
try {
- insertTestMessages(nbrOfTestMessages);
- waitTillNoMoreMessages(jobExecutor, testTimeoutMillis, checkInterval);
+ insertTestMessages();
+ waitTillNoMoreMessages(jobExecutor);
} finally {
jobExecutor.stop(true);
@@ -112,19 +86,13 @@
}
public void testMessagesPresentUponJobExecutorStartUp() {
- int nbrOfTestMessages = 2;
- int testTimeoutMillis = 5000;
- int checkInterval = 400;
- insertTestMessages(nbrOfTestMessages);
+ insertTestMessages();
- List<Integer> processedMessageIds = (List<Integer>) getEnvironmentFactory().get("processedMessageIds");
- processedMessageIds.clear();
-
JobExecutor jobExecutor = getEnvironmentFactory().get(JobExecutor.class);
jobExecutor.start();
try {
- waitTillNoMoreMessages(jobExecutor, testTimeoutMillis, checkInterval);
+ waitTillNoMoreMessages(jobExecutor);
} finally {
jobExecutor.stop(true);
@@ -136,60 +104,46 @@
}
public void testExclusiveMessageProcessing() {
- int testTimeoutMillis = 10000;
- int checkInterval = 500;
- int nbrOfTestMessagesPerExecution = 5;
- int nbrOfTestExecutions = 1;
+ insertExclusiveTestMessages();
- insertExclusiveTestMessages(nbrOfTestExecutions, nbrOfTestMessagesPerExecution);
-
JobExecutor jobExecutor = getEnvironmentFactory().get(JobExecutor.class);
jobExecutor.start();
try {
- waitTillNoMoreMessages(jobExecutor, testTimeoutMillis, checkInterval);
+ waitTillNoMoreMessages(jobExecutor);
} finally {
jobExecutor.stop(true);
}
- Environment environment = getEnvironmentFactory().openEnvironment();
- try {
- // exclusiveMessageIds maps execution keys to a set of thread ids.
- // the idea is that for each execution, all the exclusive jobs will
- // be executed by 1 thread sequentially.
-
- // in the end, each set should contain exactly 1 element
- Map<String, Set<Long>> exclusiveThreadIds = (Map) environment.get("exclusiveThreadIds");
-
- for (int i=0; i<nbrOfTestExecutions; i++) {
- String executionKey = "execution-"+i;
- Set<Long> threadIds = exclusiveThreadIds.get(executionKey);
- assertNotNull("no thread id set for "+executionKey+" in: "+exclusiveThreadIds, threadIds);
- assertEquals("exclusive messages for "+executionKey+" have been executed by multiple threads: "+threadIds,
- 1,
- threadIds.size());
+ commandService.execute(new Command<Object>() {
+ public Object execute(Environment environment) throws Exception {
+ // exclusiveMessageIds maps execution keys to a set of thread ids.
+ // the idea is that for each execution, all the exclusive jobs will
+ // be executed by 1 thread sequentially.
+
+ for (int i=0; i<nbrOfTestExecutions; i++) {
+ String executionKey = "execution-"+i;
+ Set<Long> threadIds = exclusiveThreadIds.get(executionKey);
+ assertNotNull("no thread id set for "+executionKey+" in: "+exclusiveThreadIds, threadIds);
+ assertEquals("exclusive messages for "+executionKey+" have been executed by multiple threads: "+threadIds,
+ 1,
+ threadIds.size());
+ }
+ return null;
}
- } finally {
- environment.close();
- }
-
+ });
}
public void testFailOnceMessages() {
- int nbrOfTestMessages = 7;
- int testTimeoutMillis = 10000;
- int checkInterval = 500;
-
- List<Integer> failOnceMessageIds = (List<Integer>) getEnvironmentFactory().get("failOnceMessageIds");
failOnceMessageIds.clear();
JobExecutor jobExecutor = getEnvironmentFactory().get(JobExecutor.class);
jobExecutor.start();
try {
- insertFailOnceTestMessages(nbrOfTestMessages);
- waitTillNoMoreMessages(jobExecutor, testTimeoutMillis, checkInterval);
+ insertFailOnceTestMessages();
+ waitTillNoMoreMessages(jobExecutor);
} finally {
jobExecutor.stop(true);
@@ -200,122 +154,110 @@
}
assertEquals(nbrOfTestMessages, failOnceMessageIds.size());
- Environment environment = getEnvironmentFactory().openEnvironment();
- try {
- Session session = environment.get(Session.class);
- List<Comment> comments = session.createQuery("from org.jbpm.pvm.internal.model.CommentImpl").list();
-
- for (Comment comment: comments) {
- Integer messageId = new Integer(comment.getMessage());
- assertTrue("message "+messageId+" committed twice", failOnceMessageIds.remove(messageId));
- // clean up for next tests
- session.delete(comment);
- }
+ commandService.execute(new Command<Object>() {
+ public Object execute(Environment environment) throws Exception {
+ Session session = environment.get(Session.class);
+ List<Comment> comments = session.createQuery("from org.jbpm.pvm.internal.model.CommentImpl").list();
+
+ for (Comment comment: comments) {
+ Integer messageId = new Integer(comment.getMessage());
+ assertTrue("message "+messageId+" committed twice", failOnceMessageIds.remove(messageId));
+ // clean up for next tests
+ session.delete(comment);
+ }
- assertTrue("not all messages made a successful commit: "+failOnceMessageIds, failOnceMessageIds.isEmpty());
- } finally {
- environment.close();
- }
+ assertTrue("not all messages made a successful commit: "+failOnceMessageIds, failOnceMessageIds.isEmpty());
+ return null;
+ }
+ });
}
public void testFailedMessageProcessing() {
- int testTimeoutMillis = 3000;
- int checkInterval = 400;
-
JobExecutor jobExecutor = getEnvironmentFactory().get(JobExecutor.class);
jobExecutor.start();
try {
- Environment environment = getEnvironmentFactory().openEnvironment();
- try {
- MessageSession messageSession = environment.get(MessageSession.class);
- messageSession.send(new FailingTestMessage());
- } finally {
- environment.close();
- }
+ commandService.execute(new Command<Object>() {
+ public Object execute(Environment environment) throws Exception {
+ MessageSession messageSession = environment.get(MessageSession.class);
+ CommandMessage commandMessage = FailingTestCommand.createMessage();
+ messageSession.send(commandMessage);
+ return null;
+ }
+ });
- waitTillNoMoreMessages(jobExecutor, testTimeoutMillis, checkInterval);
+ waitTillNoMoreMessages(jobExecutor);
} finally {
jobExecutor.stop(true);
}
- Environment environment = getEnvironmentFactory().openEnvironment();
- try {
- PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
- List<Job> deadJobs = pvmDbSession.findDeadJobs();
- assertEquals("there should be one dead jobImpl", 1, deadJobs.size());
+ commandService.execute(new Command<Object>() {
+ public Object execute(Environment environment) throws Exception {
+ PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
+ List<Job> deadJobs = pvmDbSession.findDeadJobs();
+ assertEquals("there should be one dead jobImpl", 1, deadJobs.size());
- Session session = environment.get(Session.class);
- List commands = session.createQuery("from org.jbpm.pvm.internal.model.CommentImpl").list();
- assertTrue("command insertion should have been rolled back", commands.isEmpty());
- } finally {
- environment.close();
- }
+ Session session = environment.get(Session.class);
+ List commands = session.createQuery("from org.jbpm.pvm.internal.model.CommentImpl").list();
+ assertTrue("command insertion should have been rolled back", commands.isEmpty());
+ return null;
+ }
+ });
}
// helper methods ///////////////////////////////////////////////////////////
- void insertTestMessages(int nbrOfTestMessages) {
- Environment environment = getEnvironmentFactory().openEnvironment();
- try {
- MessageSession messageSession = environment.get(MessageSession.class);
- for (int i=0; i<nbrOfTestMessages; i++) {
- TestMessage testMessage = new TestMessage(i);
- messageSession.send(testMessage);
+ void insertTestMessages() {
+ commandService.execute(new Command<Object>() {
+ public Object execute(Environment environment) throws Exception {
+ MessageSession messageSession = environment.get(MessageSession.class);
+ for (int i=0; i<nbrOfTestMessages; i++) {
+ CommandMessage commandMessage = TestMessageCommand.createMessage(i);
+ messageSession.send(commandMessage);
+ }
+ return null;
}
- } catch (RuntimeException e) {
- environment.get(Transaction.class).setRollbackOnly();
- throw e;
- } finally {
- environment.close();
- }
+ });
}
- void insertExclusiveTestMessages(int nbrOfTestExecutions, int nbrOfTestMessagesPerExecution) {
- Environment environment = getEnvironmentFactory().openEnvironment();
- try {
- PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
- ClientProcessDefinition processDefinition = new ProcessDefinitionImpl();
- pvmDbSession.save(processDefinition);
-
- MessageSession messageSession = environment.get(MessageSession.class);
- for (int i=0; i<nbrOfTestExecutions; i++) {
- ClientProcessInstance execution = processDefinition.beginProcessInstance("execution-"+i);
- pvmDbSession.save(execution);
+ void insertExclusiveTestMessages() {
+ commandService.execute(new Command<Object>() {
+ public Object execute(Environment environment) throws Exception {
+ PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
+ ClientProcessDefinition processDefinition = new ProcessDefinitionImpl();
+ pvmDbSession.save(processDefinition);
- for (int j=0; j<nbrOfTestMessagesPerExecution; j++) {
+ MessageSession messageSession = environment.get(MessageSession.class);
+ for (int i=0; i<nbrOfTestExecutions; i++) {
+ ClientProcessInstance execution = processDefinition.beginProcessInstance("execution-"+i);
+ pvmDbSession.save(execution);
- ExclusiveTestMessage testMessage = new ExclusiveTestMessage(execution);
- messageSession.send(testMessage);
+ for (int j=0; j<nbrOfTestMessagesPerExecution; j++) {
+ CommandMessage exclusiveTestMessage = ExclusiveTestCommand.createMessage(execution);
+ messageSession.send(exclusiveTestMessage);
+ }
}
+ return null;
}
- } catch (RuntimeException e) {
- environment.get(Transaction.class).setRollbackOnly();
- throw e;
- } finally {
- environment.close();
- }
+ });
+ Environment environment = getEnvironmentFactory().openEnvironment();
}
- void insertFailOnceTestMessages(int nbrOfTestMessages) {
- Environment environment = getEnvironmentFactory().openEnvironment();
- try {
- MessageSession messageSession = environment.get(MessageSession.class);
- for (int i=0; i<nbrOfTestMessages; i++) {
- FailOnceTestMessage testMessage = new FailOnceTestMessage(i);
- messageSession.send(testMessage);
+ void insertFailOnceTestMessages() {
+ commandService.execute(new Command<Object>() {
+ public Object execute(Environment environment) throws Exception {
+ MessageSession messageSession = environment.get(MessageSession.class);
+ for (int i=0; i<nbrOfTestMessages; i++) {
+ CommandMessage commandMessage = FailOnceTestCommand.createMessage(i);
+ messageSession.send(commandMessage);
+ }
+ return null;
}
- } catch (RuntimeException e) {
- environment.get(Transaction.class).setRollbackOnly();
- throw e;
- } finally {
- environment.close();
- }
+ });
}
+ private void waitTillNoMoreMessages(JobExecutor jobExecutor) {
- private void waitTillNoMoreMessages(JobExecutor jobExecutor, int maxWait, int checkInterval) {
-
// install a timer that will interrupt if it takes too long
// if that happens, it will lead to an interrupted exception and the test will fail
TimerTask interruptTask = new TimerTask() {
@@ -326,7 +268,7 @@
}
};
Timer timer = new Timer();
- timer.schedule(interruptTask, maxWait);
+ timer.schedule(interruptTask, timeoutMillis);
try {
boolean jobsAvailable = true;
@@ -337,7 +279,7 @@
}
} catch (InterruptedException e) {
- fail("test execution exceeded treshold of "+maxWait+" milliseconds");
+ fail("test execution exceeded treshold of "+timeoutMillis+" milliseconds");
} finally {
timer.cancel();
}
Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTests.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTests.java 2008-08-05 16:42:37 UTC (rev 1825)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTests.java 2008-08-05 17:18:46 UTC (rev 1826)
@@ -33,7 +33,6 @@
public static Test suite() {
TestSuite suite = new TestSuite("Test for org.jbpm.pvm.jobexecutor");
//$JUnit-BEGIN$
- suite.addTestSuite(JobExecutorTimerSessionTest.class);
suite.addTestSuite(JobExecutorTest.class);
//$JUnit-END$
return suite;
Deleted: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTimerSessionTest.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTimerSessionTest.java 2008-08-05 16:42:37 UTC (rev 1825)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTimerSessionTest.java 2008-08-05 17:18:46 UTC (rev 1826)
@@ -1,398 +0,0 @@
-/**
- * Copyright (C) 2007 Bull S. A. S.
- * Bull, Rue Jean Jaures, B.P.68, 78340, Les Clayes-sous-Bois
- * This library 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
- * version 2.1 of the License.
- * This library 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
- * program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
- * Floor, Boston, MA 02110-1301, USA.
- **/
-package org.jbpm.pvm.internal.jobexecutor;
-
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.jbpm.pvm.test.base.EnvironmentDbTestCase;
-import org.jbpm.pvm.PvmException;
-import org.jbpm.pvm.env.Environment;
-import org.jbpm.pvm.internal.job.JobImpl;
-import org.jbpm.pvm.internal.job.TimerImpl;
-import org.jbpm.pvm.internal.jobexecutor.JobDbSession;
-import org.jbpm.pvm.internal.jobexecutor.JobExecutor;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
-import org.jbpm.pvm.job.Job;
-import org.jbpm.pvm.job.Timer;
-import org.jbpm.pvm.session.PvmDbSession;
-import org.jbpm.pvm.session.TimerSession;
-
-/**
- * @author Pascal Verdage
- */
-public class JobExecutorTimerSessionTest extends EnvironmentDbTestCase
-{
-
- public void setUp() throws Exception {
- super.setUp();
- getVariables().clear();
- // launch jobExecutor
- Environment.getCurrent().get(JobExecutor.class).setIdleInterval(500000);
- Environment.getCurrent().get(JobExecutor.class).start();
- }
-
- public void tearDown() throws Exception {
- Environment.getCurrent().get(JobExecutor.class).stop();
- super.tearDown();
- }
-
- /* GETTERS */
- @SuppressWarnings("unchecked")
- public static Map<String, Integer> getVariables() {
- return (Map<String, Integer>) Environment.getCurrent()
- .getEnvironmentFactory().get("timerVariables");
- }
-
- /** get TimerSession if an environment is open */
- protected static TimerSession getTimerSession() {
- assertNotNull(Environment.getCurrent());
- return Environment.getCurrent().get(TimerSession.class);
- }
-
- /** get JobDbSession if an environment is open */
- protected static JobDbSession getJobDbSession() {
- assertNotNull(Environment.getCurrent());
- return Environment.getCurrent().get(JobDbSession.class);
- }
-
- /** get PvmDbSession if an environment is open */
- protected static PvmDbSession getPvmDbSession() {
- assertNotNull(Environment.getCurrent());
- return Environment.getCurrent().get(PvmDbSession.class);
- }
-
- /* Test assertion tools */
- /** return the number of timers among active jobs */
- private static int getNbTimer() {
- int result = 0;
- List<Timer> timers = getPvmDbSession().findTimers();
- if (timers != null) {
- for (Job job : timers) {
- if (job instanceof TimerImpl) {
- result++;
- }
- }
- }
- // List<JobImpl<?>> deadJobs = getPvmDbSession().findAllJobs();
- // if (deadJobs != null) {
- // for (JobImpl<?> jobImpl : deadJobs) {
- // if (jobImpl instanceof TimerImpl) {
- // result++;
- // }
- // }
- // }
- return result;
- }
-
- private static int TIMEOUT = 60 * 1000; // 1 minutes
-
- /** This method change the transaction */
- protected void waitUntilNbTimerEquals(int expected) {
- int rate = 500; // check every rate millis
- int result = Integer.MAX_VALUE;
-
- for (int i = 0; i < TIMEOUT / rate; i++) {
- try {
- Thread.sleep(rate);
- } catch (InterruptedException e) {
- e.printStackTrace();
- fail();
- }
- newTransaction();
- result = getNbTimer();
- if (result == expected) {
- break;
- }
- }
- // if false, then the timeout occurred
- assertEquals(expected, result);
- }
-
- protected static void assertNbTimersEquals(int expected) {
- assertEquals(expected, getNbTimer());
- }
-
- /* TimerImpl manipulation tools */
-
- /** @return the first due timer or null if none */
- protected TimerImpl findFirstDueTimer() {
- TimerImpl result = null;
- JobImpl<?> firstJob = getJobDbSession().findFirstDueJob();
- if (firstJob instanceof TimerImpl) {
- result = (TimerImpl) firstJob;
- } else {
- List<Timer> timers = getPvmDbSession().findTimers();
- if (timers != null) {
- Date dueDate = new Date(Long.MAX_VALUE);
- for (Timer timer : timers) {
- if (timer instanceof TimerImpl && timer.getDueDate().before(dueDate)) {
- dueDate = timer.getDueDate();
- result = (TimerImpl) timer;
- }
- }
- }
- }
- return result;
- }
-
- /** create a timer that should not be executed */
- private TimerImpl createForbiddenTimer(String name, long delay) {
- return new TestTimer(name, delay, 0);
- }
- /** create a timer that should be executed once */
- private TimerImpl createTimer(String name, Date dueDate) {
- return new TestTimer(name, dueDate, 1);
- }
- /** create a timer that should be executed once */
- private TimerImpl createTimer(String name, long delay) {
- return new TestTimer(name, delay, 1);
- }
- /** create a timer that should be executed nbExecution times */
- private TimerImpl createTimer(String name, long delay, long repeatDelay, int nbExecution) {
- TimerImpl timerImpl = new TestTimer(name, delay, nbExecution);
- timerImpl.setRepeat(Long.toString(repeatDelay) + " millis");
- return timerImpl;
- }
-
- /* Functionnal tests */
-
- /** Test all use cases that should throw PvmException for method schedule */
- public void testScheduleIllegalArgument() {
- TimerSession timerSession = getTimerSession();
- TimerImpl timerImpl;
-
- // null TimerImpl
- try {
- timerSession.schedule(null);
- fail("Should not happen");
- } catch (PvmException e) {
- assertTextPresent("null timer", e.getMessage());
- }
-
- // no execution
- try {
- timerImpl = new TimerImpl();
- timerSession.schedule(timerImpl);
- // clean before failure
- timerSession.cancel(timerImpl);
- fail("Should not happen");
- } catch (PvmException e) {
- assertTextPresent("no execution", e.getMessage());
- }
-
- ExecutionImpl execution = new ExecutionImpl();
-
- // no signal or event
- try {
- timerImpl = new TimerImpl();
- timerImpl.setExecution(execution);
- timerSession.schedule(timerImpl);
- // clean before failure
- timerSession.cancel(timerImpl);
- fail("Should not happen");
- } catch (PvmException e) {
- assertTextPresent("no signalName or eventName", e.getMessage());
- }
-
- // a signalName with no activityInstance to signal is valid
-
- // null dueDate
- try {
- timerImpl = createTimer("schedule error 1", null);
- timerImpl.setExecution(execution);
-
- timerImpl.setSignalName("timeout");
- timerSession.schedule(timerImpl);
- // clean before failure
- timerSession.cancel(timerImpl);
- fail("Should not happen");
- } catch (PvmException e) {
- assertTextPresent("null date", e.getMessage());
- }
-
- // date.getTime() negative
- try {
- timerImpl = createTimer("schedule error 2", new Date(-10));
- timerImpl.setExecution(execution);
-
- timerImpl.setSignalName("timeout");
- timerSession.schedule(timerImpl);
- // clean before failure
- timerSession.cancel(timerImpl);
- fail("Should not happen");
- } catch (PvmException e) {
- assertTextPresent("negative date", e.getMessage());
- }
- }
-
- /** Test the method cancel */
- public void testCancel() {
- TimerSession timerSession;
- TimerImpl timerImpl;
-
- // null jobImpl
- try {
- getTimerSession().cancel(null);
- fail();
- } catch (PvmException e) {
- // OK
- }
-
- // non scheduled jobImpl
- timerSession = getTimerSession();
- timerImpl = createForbiddenTimer("cancel 1", 500);
- timerSession.cancel(timerImpl);
- assertNbTimersEquals(0);
-
- // scheduled non-executed jobImpl
- ExecutionImpl execution = new ExecutionImpl();
- getPvmDbSession().save(execution);
-
- timerSession = getTimerSession();
- timerImpl = createForbiddenTimer("cancel 2", 500);
- timerImpl.setSignalName("timeout");
- timerImpl.setExecution(execution);
-
- timerSession.schedule(timerImpl);
- newTransaction();
- assertNbTimersEquals(1);
- timerSession = getTimerSession();
- timerSession.cancel(findFirstDueTimer());
-
- newTransaction();
- assertNbTimersEquals(0);
-
- execution = getPvmDbSession().get(ExecutionImpl.class, execution.getDbid());
- getPvmDbSession().delete(execution);
-
- /*
- * scheduled jobImpl with repeat
- * This is not necessary because in the test, a timer scheduled with
- * a repeat will be deleted by the instance. So this case is covered
- * by the test testScheduleRepeatDelay
- */
- }
-
- /** Schedule a jobImpl in the past */
- public void testSchedulePastJob() {
- ExecutionImpl execution = new ExecutionImpl();
- execution = reload(execution);
- try {
- TimerImpl timerImpl = createTimer("schedule past jobImpl", -500);
- timerImpl.setExecution(execution);
- timerImpl.setEventName("timeout");
- getTimerSession().schedule(timerImpl);
- assertNbTimersEquals(1);
- newTransaction();
- waitUntilNbTimerEquals(0);
- } finally {
- execution = getPvmDbSession().get(ExecutionImpl.class, execution.getDbid());
- getPvmDbSession().delete(execution);
- newTransaction();
- }
- }
-
- /** Schedule a jobImpl in the future */
- public void testScheduleFutureJob() {
- ExecutionImpl execution = new ExecutionImpl();
- execution = reload(execution);
- try {
- TimerImpl timerImpl = createTimer("schedule future jobImpl", 500);
- timerImpl.setExecution(execution);
- timerImpl.setEventName("timeout");
- getTimerSession().schedule(timerImpl);
- assertNbTimersEquals(1);
- newTransaction();
- waitUntilNbTimerEquals(0);
- } finally {
- execution = getPvmDbSession().get(ExecutionImpl.class, execution.getDbid());
- getPvmDbSession().delete(execution);
- newTransaction();
- }
- }
-
- /** Test the method schedule with a repeated jobImpl */
- public void testScheduleRepeatDelay() {
- ExecutionImpl execution = new ExecutionImpl();
- execution = reload(execution);
- try {
- TimerImpl timerImpl = createTimer("schedule repeat delay", 200, 400, 3);
- timerImpl.setExecution(execution);
- timerImpl.setEventName("timeout");
- getTimerSession().schedule(timerImpl);
- assertNbTimersEquals(1);
- newTransaction();
- waitUntilNbTimerEquals(0);
- } finally {
- execution = getPvmDbSession().get(ExecutionImpl.class, execution.getDbid());
- getPvmDbSession().delete(execution);
- newTransaction();
- }
- }
-
-
- /* Concurrent tests */
-
- /** create a timer that should be executed once and increment a variable */
- private TimerImpl createIncrementingTimer(String name, Date dueDate, String variable) {
- TestTimer timer = new TestTimer(name, dueDate, 1);
- timer.setVariableName(variable);
- timer.setEventName("incrementation");
- return timer;
- }
-
- private void testManyTimers(int nbTimer, long delayBetweenTimers) {
- ExecutionImpl execution = new ExecutionImpl();
- execution = reload(execution);
- try {
- long startTime = System.currentTimeMillis();
- for (int i=0; i<nbTimer; i++) {
- Date dueDate = new Date(startTime + 1000 + i*delayBetweenTimers);
- String name = "timer " + i;
- TimerImpl timerImpl = createIncrementingTimer(name, dueDate, name);
- timerImpl.setExecution(execution);
- getTimerSession().schedule(timerImpl);
- }
-
- newTransaction();
- assertNbTimersEquals(nbTimer);
- waitUntilNbTimerEquals(0);
- int sum = 0;
- Map<String, Integer> variables = getVariables();
- if (variables != null) {
- for (Entry<String, Integer> variable : variables.entrySet()) {
- assertEquals(variable.getKey(), 1, (int)variable.getValue());
- sum += variable.getValue();
- }
- }
- assertEquals(nbTimer, sum);
- } finally {
- execution = getPvmDbSession().get(ExecutionImpl.class, execution.getDbid());
- getPvmDbSession().delete(execution);
- newTransaction();
- }
- }
-
- public void testSeveralTimer() {
- testManyTimers(20, 100);
- }
-
- public void testSimultaneousTimer() {
- testManyTimers(20, 0);
- }
-
-}
Deleted: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/TestMessage.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/TestMessage.java 2008-08-05 16:42:37 UTC (rev 1825)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/TestMessage.java 2008-08-05 17:18:46 UTC (rev 1826)
@@ -1,67 +0,0 @@
-/*
- * 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.pvm.internal.jobexecutor;
-
-import java.util.List;
-import java.util.Random;
-
-import org.jbpm.pvm.env.Environment;
-import org.jbpm.pvm.internal.job.MessageImpl;
-import org.jbpm.pvm.internal.log.Log;
-import org.jbpm.pvm.session.DbSession;
-
-/**
- * @author Tom Baeyens
- */
-public class TestMessage extends MessageImpl<Object> {
-
- private static final long serialVersionUID = 1L;
- private static final Log log = Log.getLog(TestMessage.class.getName());
- static Random random = new Random();
-
- int messageId;
-
- public TestMessage() {
- }
-
- public TestMessage(int messageId) {
- this.messageId = messageId;
- }
-
- public Object execute(Environment environment) throws Exception {
- List<Integer> messageNumberCollector = (List<Integer>) environment.get("processedMessageIds");
- messageNumberCollector.add(messageId);
-
- // let's assume that an average jobImpl takes between 0 and 150 millis to complete.
- int workTime = random.nextInt(150);
- log.debug("executing test message "+messageId+". this is going to take "+workTime+"ms");
- try {
- Thread.sleep(workTime);
- } catch (RuntimeException e) {
- log.debug("sleeping was interrupted");
- }
-
- DbSession dbSession = environment.get(DbSession.class);
- dbSession.delete(this);
- return null;
- }
-}
Copied: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/TestMessageCommand.java (from rev 1819, jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/TestMessage.java)
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/TestMessageCommand.java (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/TestMessageCommand.java 2008-08-05 17:18:46 UTC (rev 1826)
@@ -0,0 +1,75 @@
+/*
+ * 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.pvm.internal.jobexecutor;
+
+import java.util.List;
+import java.util.Random;
+
+import org.jbpm.pvm.env.Environment;
+import org.jbpm.pvm.internal.cmd.Command;
+import org.jbpm.pvm.internal.job.CommandMessage;
+import org.jbpm.pvm.internal.log.Log;
+import org.jbpm.pvm.internal.wire.descriptor.IntegerDescriptor;
+import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
+import org.jbpm.pvm.session.DbSession;
+
+/**
+ * @author Tom Baeyens
+ */
+public class TestMessageCommand implements Command<Object> {
+
+ private static final long serialVersionUID = 1L;
+ private static final Log log = Log.getLog(TestMessageCommand.class.getName());
+ static Random random = new Random();
+
+ int messageId;
+
+ public TestMessageCommand() {
+ }
+
+ public TestMessageCommand(int messageId) {
+ this.messageId = messageId;
+ }
+
+ public Object execute(Environment environment) throws Exception {
+ JobExecutorTest.processedMessageIds.add(messageId);
+
+ // let's assume that an average jobImpl takes between 0 and 150 millis to complete.
+ int workTime = random.nextInt(150);
+ log.debug("executing test message "+messageId+". this is going to take "+workTime+"ms");
+ try {
+ Thread.sleep(workTime);
+ } catch (RuntimeException e) {
+ log.debug("sleeping was interrupted");
+ }
+
+ return null;
+ }
+
+ public static CommandMessage createMessage(int i) {
+ CommandMessage commandMessage = new CommandMessage();
+ ObjectDescriptor commandDescriptor = new ObjectDescriptor(TestMessageCommand.class);
+ commandDescriptor.addInjection("messageId", new IntegerDescriptor(i));
+ commandMessage.setCommandDescriptor(commandDescriptor);
+ return commandMessage;
+ }
+}
Deleted: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/TestTimer.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/TestTimer.java 2008-08-05 16:42:37 UTC (rev 1825)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/TestTimer.java 2008-08-05 17:18:46 UTC (rev 1826)
@@ -1,95 +0,0 @@
-/*
- * 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.pvm.internal.jobexecutor;
-
-import java.util.Date;
-import java.util.Map;
-
-import org.jbpm.pvm.test.base.JbpmTestCase;
-import org.jbpm.pvm.env.Environment;
-import org.jbpm.pvm.internal.job.TimerImpl;
-import org.jbpm.pvm.session.TimerSession;
-
-/**
- * @author Tom Baeyens
- * @author Pascal Verdage
- */
-public class TestTimer extends TimerImpl {
- private static final long serialVersionUID = 1L;
-
- private String name;
- private int nbMaxExecution;
- // used to increment a variable
- private String variableName;
-
- private int nbExecution = 0;
-
- protected TestTimer() {}
-
- public TestTimer(String name, long delay, int nbMaxExecution) {
- this(name, new Date(System.currentTimeMillis() + delay), nbMaxExecution);
- }
-
- public TestTimer(String name, Date dueDate, int nbMaxExecution) {
- this.name = name;
- this.dueDate = dueDate;
- this.nbMaxExecution = nbMaxExecution;
- }
-
- public Boolean execute(Environment environment) throws Exception {
- Date now = new Date();
- JbpmTestCase.assertTrue(name+" is executing too soon", now.after(dueDate));
- nbExecution++;
- JbpmTestCase.assertTrue(name+" should not be executed",
- nbExecution <= nbMaxExecution);
-
- if (variableName != null) {
- Map<String, Integer> variables =
- JobExecutorTimerSessionTest.getVariables();
- if (variables != null) {
- Integer n = variables.get(variableName);
- if (n == null) {
- n = 0;
- }
- n++;
- variables.put(variableName, n);
- }
- }
-
- // reschedule if necessary
- boolean deleteThisJob = super.execute(environment);
-
- // cancel the timer if necessary
- if (nbExecution == nbMaxExecution) {
- JbpmTestCase.assertNotNull(Environment.getCurrent());
- TimerSession timerSession = Environment.getCurrent().get(TimerSession.class);
- JbpmTestCase.assertNotNull(timerSession);
- timerSession.cancel(this);
- }
-
- return deleteThisJob;
- }
-
- public void setVariableName(String variableName) {
- this.variableName = variableName;
- }
-}
Modified: jbpm4/pvm/trunk/modules/core/src/test/resources/environment.cfg.xml
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/resources/environment.cfg.xml 2008-08-05 16:42:37 UTC (rev 1825)
+++ jbpm4/pvm/trunk/modules/core/src/test/resources/environment.cfg.xml 2008-08-05 17:18:46 UTC (rev 1826)
@@ -21,6 +21,8 @@
<hibernate-session-interceptor />
<hibernate-transaction-interceptor />
</command-service>
+
+ <job-executor threads="1" auto-start="false" />
<hibernate-configuration>
<properties resource="hibernate.properties" />
@@ -38,6 +40,8 @@
<hibernate-session />
<hibernate-transaction />
<pvm-db-session />
+ <job-db-session />
+ <message-session />
</environment>
</contexts>
Modified: jbpm4/pvm/trunk/modules/core/src/test/resources/logging.properties
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/resources/logging.properties 2008-08-05 16:42:37 UTC (rev 1825)
+++ jbpm4/pvm/trunk/modules/core/src/test/resources/logging.properties 2008-08-05 17:18:46 UTC (rev 1826)
@@ -22,7 +22,7 @@
org.hibernate.cfg.HbmBinder.level=SEVERE
org.hibernate.cfg.SettingsFactory.level=SEVERE
# org.hibernate.level=FINE
-org.hibernate.SQL.level=FINEST
+# org.hibernate.SQL.level=FINEST
# org.hibernate.type.level=FINEST
# org.hibernate.tool.hbm2ddl.SchemaExport.level=FINEST
# org.hibernate.transaction.level=FINEST
Modified: jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/internal/db/langext/environment.cfg.xml
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/internal/db/langext/environment.cfg.xml 2008-08-05 16:42:37 UTC (rev 1825)
+++ jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/internal/db/langext/environment.cfg.xml 2008-08-05 17:18:46 UTC (rev 1826)
@@ -1,7 +1,27 @@
-<contexts>
+<?xml version="1.0" encoding="UTF-8"?>
- <environment-factory>
-
+<contexts xmlns="http://jbpm.org/pvm/1.0/wire">
+
+ <environment-factory>
+
+ <deployer-manager resource="pvm.language.deployers.xml">
+ <language name="api">
+ <verify-version />
+ <save-process />
+ </language>
+ </deployer-manager>
+
+ <process-service />
+ <execution-service />
+ <management-service />
+
+ <command-service>
+ <retry-interceptor />
+ <environment-interceptor />
+ <hibernate-session-interceptor />
+ <hibernate-transaction-interceptor />
+ </command-service>
+
<hibernate-configuration>
<properties resource="hibernate.properties" />
<mappings resource="org/jbpm/pvm/pvm.hibernate.mappings.xml" />
@@ -10,17 +30,16 @@
</hibernate-configuration>
<hibernate-session-factory />
+
<variable-types resource="org/jbpm/pvm/pvm.types.xml" />
</environment-factory>
<environment>
-
- <transaction />
<hibernate-session />
+ <hibernate-transaction />
<pvm-db-session />
<object class="org.jbpm.pvm.internal.db.langext.AddressSession" />
-
</environment>
</contexts>
17 years, 9 months
JBoss JBPM SVN: r1825 - in jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm: internal/model and 2 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2008-08-05 12:42:37 -0400 (Tue, 05 Aug 2008)
New Revision: 1825
Added:
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/job/CommandMessage.java
Modified:
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/job/JobImpl.java
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/model/ObjectReference.java
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/model/VariableDefinitionImpl.java
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/wire/WireContext.java
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/test/base/EnvironmentDbTestCase.java
Log:
updated job executor test to new test suite base classes
Added: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/job/CommandMessage.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/job/CommandMessage.java (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/job/CommandMessage.java 2008-08-05 16:42:37 UTC (rev 1825)
@@ -0,0 +1,50 @@
+/*
+ * 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.pvm.internal.job;
+
+import org.jbpm.pvm.env.Environment;
+import org.jbpm.pvm.internal.cmd.Command;
+import org.jbpm.pvm.internal.wire.Descriptor;
+import org.jbpm.pvm.internal.wire.WireContext;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class CommandMessage extends MessageImpl<Object> {
+
+ private static final long serialVersionUID = 1L;
+
+ public CommandMessage() {
+ }
+
+ public CommandMessage(Descriptor commandDescriptor) {
+ this.commandDescriptor = commandDescriptor;
+ }
+
+ public Object execute(Environment environment) throws Exception {
+ Command<Object> command = (Command<Object>) WireContext.create(commandDescriptor);
+ command.execute(environment);
+ return null;
+ }
+
+}
Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/job/JobImpl.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/job/JobImpl.java 2008-08-05 13:32:22 UTC (rev 1824)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/job/JobImpl.java 2008-08-05 16:42:37 UTC (rev 1825)
@@ -5,6 +5,7 @@
import org.jbpm.pvm.internal.cmd.Command;
import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.wire.Descriptor;
import org.jbpm.pvm.job.Job;
public abstract class JobImpl<T> implements Command<T>, Serializable, Job {
@@ -49,6 +50,9 @@
/** number of attempts left to try. Should be decremented each time an exception
* occurs during command execution. */
protected int retries = 3;
+
+ /** a command that can be used as the behaviour of this job */
+ protected Descriptor commandDescriptor;
public JobImpl() {
}
@@ -112,4 +116,10 @@
public void setLockExpirationTime(Date lockExpirationTime) {
this.lockExpirationTime = lockExpirationTime;
}
+ public Descriptor getCommandDescriptor() {
+ return commandDescriptor;
+ }
+ public void setCommandDescriptor(Descriptor commandDescriptor) {
+ this.commandDescriptor = commandDescriptor;
+ }
}
Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/model/ObjectReference.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/model/ObjectReference.java 2008-08-05 13:32:22 UTC (rev 1824)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/model/ObjectReference.java 2008-08-05 16:42:37 UTC (rev 1825)
@@ -32,6 +32,7 @@
// private static final Log log = Log.getLog(ObjectReference.class.getName());
protected String expression;
+ protected String expressionLanguage;
protected Descriptor descriptor;
protected T object;
@@ -83,10 +84,7 @@
// object builders //////////////////////////////////////////////////////////
protected T constructFromDescriptor() {
- WireDefinition wireDefinition = new WireDefinition();
- wireDefinition.addDescriptor("o", descriptor);
- WireContext wireContext = new WireContext(wireDefinition);
- return (T) wireContext.get("o");
+ return (T) WireContext.create(descriptor);
}
protected T resolveValueExpression() {
Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/model/VariableDefinitionImpl.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/model/VariableDefinitionImpl.java 2008-08-05 13:32:22 UTC (rev 1824)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/model/VariableDefinitionImpl.java 2008-08-05 16:42:37 UTC (rev 1825)
@@ -60,7 +60,7 @@
public Object getSourceValue(ExecutionImpl execution) {
if (sourceDescriptor!=null) {
- return sourceDescriptor.construct(new WireContext());
+ return WireContext.create(sourceDescriptor);
}
if (source!=null) {
return execution.getVariable(key);
Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/wire/WireContext.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/wire/WireContext.java 2008-08-05 13:32:22 UTC (rev 1824)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/wire/WireContext.java 2008-08-05 16:42:37 UTC (rev 1825)
@@ -260,6 +260,12 @@
create();
}
}
+
+ /** convenience method that wires the object for a given descriptor. */
+ public static Object create(Descriptor descriptor) {
+ WireContext wireContext = new WireContext();
+ return wireContext.create(descriptor, false);
+ }
/**
* initializes the eager objects and then fires the create event. This method
@@ -619,14 +625,16 @@
WireObjectEventInfo wireEvent = null;
// first fire the event on the descriptor for object specific listeners
- Map<String, Descriptor> descriptors = wireDefinition.getDescriptors();
- if (descriptors!=null) {
- Descriptor descriptor = descriptors.get(objectName);
- if (descriptor!=null) {
- if (wireEvent==null) {
- wireEvent = new WireObjectEventInfo(eventName, objectName, object);
+ if (wireDefinition!=null) {
+ Map<String, Descriptor> descriptors = wireDefinition.getDescriptors();
+ if (descriptors!=null) {
+ Descriptor descriptor = descriptors.get(objectName);
+ if (descriptor!=null) {
+ if (wireEvent==null) {
+ wireEvent = new WireObjectEventInfo(eventName, objectName, object);
+ }
+ descriptor.fire(eventName, wireEvent);
}
- descriptor.fire(eventName, wireEvent);
}
}
Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/test/base/EnvironmentDbTestCase.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/test/base/EnvironmentDbTestCase.java 2008-08-05 13:32:22 UTC (rev 1824)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/test/base/EnvironmentDbTestCase.java 2008-08-05 16:42:37 UTC (rev 1825)
@@ -47,6 +47,13 @@
Transaction transaction = null;
+ public EnvironmentDbTestCase() {
+ }
+
+ public EnvironmentDbTestCase(String configResource) {
+ super(configResource);
+ }
+
public void setUp() throws Exception {
if (isEnvironmentFactoryCached()) {
Db.clean(getEnvironmentFactory());
17 years, 9 months
JBoss JBPM SVN: r1824 - jbpm3/trunk/modules/gwt-console/war/src/main/resources/org/jboss/bpm/console.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2008-08-05 09:32:22 -0400 (Tue, 05 Aug 2008)
New Revision: 1824
Modified:
jbpm3/trunk/modules/gwt-console/war/src/main/resources/org/jboss/bpm/console/Application.gwt.xml
Log:
Remove legacy css
Modified: jbpm3/trunk/modules/gwt-console/war/src/main/resources/org/jboss/bpm/console/Application.gwt.xml
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/resources/org/jboss/bpm/console/Application.gwt.xml 2008-08-05 13:12:10 UTC (rev 1823)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/resources/org/jboss/bpm/console/Application.gwt.xml 2008-08-05 13:32:22 UTC (rev 1824)
@@ -7,8 +7,7 @@
<!-- Specify the app entry point class. -->
<entry-point class='org.jboss.bpm.console.client.Application' />
- <!-- Specify a css to load into your gwt application -->
- <stylesheet src='GWT-default.css' />
+ <!-- Specify a css to load into your gwt application -->
<stylesheet src='console.css' />
<stylesheet src="js/ext/resources/css/ext-all.css" />
<script src="js/ext/adapter/ext/ext-base.js" />
17 years, 9 months
JBoss JBPM SVN: r1823 - in jbpm3/trunk/modules/gwt-console/war: src/main/java/org/jboss/bpm/console/client and 5 other directories.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2008-08-05 09:12:10 -0400 (Tue, 05 Aug 2008)
New Revision: 1823
Added:
jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionListEditor.java
jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessImageView.java
jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceListEditor.java
jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/widgets/BareEditorView.java
jbpm3/trunk/modules/gwt-console/war/src/main/resources/org/jboss/bpm/console/public/images/processSample.jpg
Removed:
jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessListEditor.java
jbpm3/trunk/modules/gwt-console/war/src/main/resources/org/jboss/bpm/console/public/GWT-default.css
Modified:
jbpm3/trunk/modules/gwt-console/war/pom.xml
jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/Application.java
jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/ConsoleView.java
jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/EditorPanel.java
jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/HeaderPanel.java
jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/model/MockProcessDefinitionDAO.java
jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/model/MockProcessInstanceDAO.java
jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionList.java
jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceEditor.java
jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceList.java
jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/widgets/EditorView.java
jbpm3/trunk/modules/gwt-console/war/src/main/resources/org/jboss/bpm/console/public/Application.html
jbpm3/trunk/modules/gwt-console/war/src/main/resources/org/jboss/bpm/console/public/console.css
Log:
Switch editor views by component id. Make sure specific views are only created once and reused (set focus)
Modified: jbpm3/trunk/modules/gwt-console/war/pom.xml
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/pom.xml 2008-08-05 10:38:38 UTC (rev 1822)
+++ jbpm3/trunk/modules/gwt-console/war/pom.xml 2008-08-05 13:12:10 UTC (rev 1823)
@@ -52,11 +52,18 @@
<style>DETAILED</style>
<generateGettersAndSetters>true</generateGettersAndSetters>
<noServer>false</noServer>
- <extraJvmArgs>-Dgwt.coverage.enable=true</extraJvmArgs>
+ <extraJvmArgs>-Dgwt.coverage.enable=true -Xmx256M -Xms256M</extraJvmArgs>
</configuration>
<executions>
<execution>
+ <id>compile</id>
+ <phase>process-classes</phase>
<goals>
+ <goal>compile</goal>
+ </goals>
+ </execution>
+ <execution>
+ <goals>
<!--
autoconfig gwt (download and unzip GWT itself)
*note* you can also use manual config, if you already have GWT installed
Modified: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/Application.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/Application.java 2008-08-05 10:38:38 UTC (rev 1822)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/Application.java 2008-08-05 13:12:10 UTC (rev 1823)
@@ -1,13 +1,6 @@
package org.jboss.bpm.console.client;
import com.google.gwt.core.client.EntryPoint;
-import com.gwtext.client.widgets.layout.BorderLayoutData;
-import com.gwtext.client.widgets.layout.FitLayout;
-import com.gwtext.client.widgets.layout.BorderLayout;
-import com.gwtext.client.widgets.Panel;
-import com.gwtext.client.widgets.Viewport;
-import com.gwtext.client.core.RegionPosition;
-import com.gwtext.client.core.Margins;
/**
* Entry point classes define <code>onModuleLoad()</code>.
Modified: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/ConsoleView.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/ConsoleView.java 2008-08-05 10:38:38 UTC (rev 1822)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/ConsoleView.java 2008-08-05 13:12:10 UTC (rev 1823)
@@ -23,15 +23,14 @@
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
+import com.gwtext.client.core.Margins;
import com.gwtext.client.core.RegionPosition;
-import com.gwtext.client.core.Margins;
import com.gwtext.client.widgets.Panel;
import com.gwtext.client.widgets.Viewport;
import com.gwtext.client.widgets.layout.BorderLayout;
import com.gwtext.client.widgets.layout.BorderLayoutData;
import com.gwtext.client.widgets.layout.FitLayout;
-import org.jboss.bpm.console.client.model.DAOFactory;
-import org.jboss.bpm.console.client.process.ProcessListEditor;
+import org.jboss.bpm.console.client.process.ProcessDefinitionListEditor;
import org.jboss.bpm.console.client.widgets.EditorView;
/**
@@ -52,7 +51,7 @@
{
mainPanel.setBorder(false);
mainPanel.setPaddings(15);
- mainPanel.setLayout(new FitLayout());
+ mainPanel.setLayout(new FitLayout());
initWidget( mainPanel );
@@ -78,24 +77,31 @@
editorPanel = new EditorPanel();
borderPanel.add(editorPanel, new BorderLayoutData(RegionPosition.CENTER));
- setupEditors();
+ // ------------------------------------------
+
+ editorPanel.addEditor( new ProcessDefinitionListEditor(this), false );
// ------------------------------------------
mainPanel.add(borderPanel);
Viewport viewport = new Viewport(mainPanel);
}
-
- private void setupEditors()
- {
- editorPanel.addEditor( new ProcessListEditor(this), false );
- }
public void addEditorView(EditorView editorView)
{
editorPanel.addEditor(editorView, true);
}
+ public boolean hasEditorView(String id)
+ {
+ return editorPanel.hasEditor(id);
+ }
+
+ public void showEditor(String id)
+ {
+ editorPanel.showTab(id);
+ }
+
public void setError(String error)
{
status.setText(error);
Modified: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/EditorPanel.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/EditorPanel.java 2008-08-05 10:38:38 UTC (rev 1822)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/EditorPanel.java 2008-08-05 13:12:10 UTC (rev 1823)
@@ -21,10 +21,10 @@
*/
package org.jboss.bpm.console.client;
+import com.gwtext.client.widgets.Component;
import com.gwtext.client.widgets.Panel;
import com.gwtext.client.widgets.TabPanel;
import com.gwtext.client.widgets.layout.FitLayout;
-
import org.jboss.bpm.console.client.widgets.EditorView;
/**
@@ -41,26 +41,56 @@
this.setResizeTabs(true);
this.setMinTabWidth(115);
this.setTabWidth(135);
- this.setEnableTabScroll(true);
- this.setWidth("100%");
- this.setHeight("100%");
+ this.setEnableTabScroll(true);
this.setActiveTab(0);
}
- private Panel addTab(String title, boolean closeable) {
- Panel tab = new Panel();
+ private Panel addTab(EditorView editorView, boolean closeable) {
+ Panel tab = new WrapperPanel(editorView.getId()+".tab");
tab.setAutoScroll(true);
- tab.setTitle(title);
+ tab.setTitle(editorView.getTitle());
tab.setClosable(closeable);
- tab.setLayout(new FitLayout());
+ tab.setLayout(new FitLayout());
this.add(tab);
return tab;
}
public void addEditor(EditorView editorView, boolean closeable)
{
- Panel tab = addTab(editorView.getTitle(), closeable);
+ Panel tab = addTab(editorView, closeable);
tab.add(editorView);
this.setActiveTab(tab.getId());
}
+
+ public boolean hasEditor(String id)
+ {
+ boolean b = false;
+ Component[] tabs = this.getItems();
+ for(int i=0; i<tabs.length; i++)
+ {
+ Component tab = tabs[i];
+ if(tab.getId().equals(id))
+ {
+ b=true;
+ break;
+ }
+ }
+
+ return b;
+ }
+
+ public void showTab(String id)
+ {
+ this.setActiveTab(id);
+ }
+
+ class WrapperPanel extends Panel
+ {
+
+ public WrapperPanel(String id)
+ {
+ super();
+ setId(id);
+ }
+ }
}
Modified: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/HeaderPanel.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/HeaderPanel.java 2008-08-05 10:38:38 UTC (rev 1822)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/HeaderPanel.java 2008-08-05 13:12:10 UTC (rev 1823)
@@ -21,13 +21,9 @@
*/
package org.jboss.bpm.console.client;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Label;
import com.gwtext.client.widgets.Panel;
-import com.gwtext.client.widgets.layout.BorderLayoutData;
import com.gwtext.client.widgets.layout.VerticalLayout;
-import com.gwtext.client.core.RegionPosition;
/**
* @author Heiko.Braun <heiko.braun(a)jboss.com>
Modified: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/model/MockProcessDefinitionDAO.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/model/MockProcessDefinitionDAO.java 2008-08-05 10:38:38 UTC (rev 1822)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/model/MockProcessDefinitionDAO.java 2008-08-05 13:12:10 UTC (rev 1823)
@@ -21,8 +21,8 @@
*/
package org.jboss.bpm.console.client.model;
+import java.util.ArrayList;
import java.util.List;
-import java.util.ArrayList;
/**
* @author Heiko.Braun <heiko.braun(a)jboss.com>
Modified: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/model/MockProcessInstanceDAO.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/model/MockProcessInstanceDAO.java 2008-08-05 10:38:38 UTC (rev 1822)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/model/MockProcessInstanceDAO.java 2008-08-05 13:12:10 UTC (rev 1823)
@@ -21,9 +21,9 @@
*/
package org.jboss.bpm.console.client.model;
-import java.util.List;
import java.util.ArrayList;
import java.util.Date;
+import java.util.List;
/**
* @author Heiko.Braun <heiko.braun(a)jboss.com>
Modified: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionList.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionList.java 2008-08-05 10:38:38 UTC (rev 1822)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionList.java 2008-08-05 13:12:10 UTC (rev 1823)
@@ -28,8 +28,8 @@
import com.gwtext.client.widgets.grid.ColumnModel;
import org.jboss.bpm.console.client.ConsoleView;
import org.jboss.bpm.console.client.model.DAOFactory;
+import org.jboss.bpm.console.client.model.ProcessDefinition;
import org.jboss.bpm.console.client.model.ProcessDefinitionDAO;
-import org.jboss.bpm.console.client.model.ProcessDefinition;
import org.jboss.bpm.console.client.widgets.ListView;
import java.util.HashMap;
@@ -87,11 +87,12 @@
protected void onExamine(final Integer row)
{
ProcessDefinition proc = (ProcessDefinition)row2ProcessMap.get(row);
- ProcessInstanceList list = new ProcessInstanceList(
- proc, "Process Instances", view
- );
-
- view.addEditorView( new ProcessInstanceEditor( list ));
+ String editorId = ProcessInstanceEditor.ID+"."+proc.getName()+".tab";
+
+ if(view.hasEditorView(editorId))
+ view.showEditor(editorId);
+ else
+ view.addEditorView( new ProcessInstanceListEditor(proc, view) );
}
protected void onDelete(final Integer row)
Added: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionListEditor.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionListEditor.java (rev 0)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionListEditor.java 2008-08-05 13:12:10 UTC (rev 1823)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.jboss.bpm.console.client.process;
+
+import org.jboss.bpm.console.client.ConsoleView;
+import org.jboss.bpm.console.client.widgets.EditorView;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class ProcessDefinitionListEditor extends EditorView
+{
+ public final static String ID = "org.jboss.bpm.process.ProcessList";
+
+ private ProcessDefinitionList processDefinitions;
+
+ private ConsoleView view;
+
+ public ProcessDefinitionListEditor(ConsoleView view)
+ {
+ super();
+ this.setId(ID);
+
+ this.view = view;
+
+ processDefinitions = new ProcessDefinitionList("Process Definitions", view);
+ this.add(processDefinitions);
+ }
+
+
+ public String getEditorId()
+ {
+ return ID;
+ }
+
+ public String getTitle()
+ {
+ return "Processes";
+ }
+}
Property changes on: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionListEditor.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessImageView.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessImageView.java (rev 0)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessImageView.java 2008-08-05 13:12:10 UTC (rev 1823)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.jboss.bpm.console.client.process;
+
+import com.google.gwt.user.client.ui.Image;
+import com.gwtext.client.widgets.Panel;
+import org.jboss.bpm.console.client.model.ProcessInstance;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class ProcessImageView extends Panel
+{
+
+ private ProcessInstance parent;
+
+ public ProcessImageView(ProcessInstance parent)
+ {
+ super();
+ this.parent = parent;
+
+ final Image image = new Image("images/processSample.jpg");
+ image.setStyleName("bpm-ProcessImage");
+
+ this.setHeader(false);
+ this.setBorder(false);
+
+ this.add(image);
+
+ }
+}
Property changes on: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessImageView.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceEditor.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceEditor.java 2008-08-05 10:38:38 UTC (rev 1822)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceEditor.java 2008-08-05 13:12:10 UTC (rev 1823)
@@ -21,34 +21,57 @@
*/
package org.jboss.bpm.console.client.process;
+import com.gwtext.client.widgets.Panel;
+import com.gwtext.client.widgets.layout.HorizontalLayout;
+import org.jboss.bpm.console.client.ConsoleView;
import org.jboss.bpm.console.client.model.ProcessDefinition;
+import org.jboss.bpm.console.client.model.ProcessInstance;
import org.jboss.bpm.console.client.widgets.EditorView;
/**
* @author Heiko.Braun <heiko.braun(a)jboss.com>
+ *
+ * @see ProcessInstanceList#onExamine(Integer)
*/
public class ProcessInstanceEditor extends EditorView
{
+ public final static String ID = "org.jboss.bpm.process.ProcessInstance";
- public final static String ID = "org.jboss.bpm.process.ProcessInstanceList";
+ private ProcessDefinition processDefinition;
+
+ private ProcessInstance processInstance;
- private ProcessDefinition parent;
-
- public ProcessInstanceEditor(ProcessInstanceList instanceList)
+ private ConsoleView view;
+
+ public ProcessInstanceEditor(ProcessDefinition proc, ProcessInstance instance, ConsoleView view)
{
super();
- parent = instanceList.getProcessDefinition();
- this.add( instanceList );
+ this.setId(ProcessInstanceEditor.ID+"."+instance.getId());
+
+ this.processDefinition = proc;
+ this.processInstance = instance;
+ this.view = view;
+
+ this.setPaddings(15);
+ this.setWidth(800);
+
+ this.setBorder(false);
+ this.setHeader(false);
+
+ this.setLayout( new HorizontalLayout(10) );
+
+ this.add( new Panel("A", 220, 250) );
+ this.add( new Panel("B", 200, 150) );
+
}
-
- public String getId()
+ public String getEditorId()
{
return ID;
}
public String getTitle()
{
- return parent.getName();
+ return processDefinition.getName() + " #"+processInstance.getId();
}
}
Modified: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceList.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceList.java 2008-08-05 10:38:38 UTC (rev 1822)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceList.java 2008-08-05 13:12:10 UTC (rev 1823)
@@ -21,17 +21,20 @@
*/
package org.jboss.bpm.console.client.process;
-import org.jboss.bpm.console.client.widgets.ListView;
-import org.jboss.bpm.console.client.ConsoleView;
-import org.jboss.bpm.console.client.model.*;
import com.gwtext.client.data.*;
+import com.gwtext.client.widgets.grid.ColumnConfig;
import com.gwtext.client.widgets.grid.ColumnModel;
-import com.gwtext.client.widgets.grid.ColumnConfig;
+import org.jboss.bpm.console.client.ConsoleView;
+import org.jboss.bpm.console.client.model.DAOFactory;
+import org.jboss.bpm.console.client.model.ProcessDefinition;
+import org.jboss.bpm.console.client.model.ProcessInstance;
+import org.jboss.bpm.console.client.model.ProcessInstanceDAO;
+import org.jboss.bpm.console.client.widgets.ListView;
+import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
-import java.util.Iterator;
import java.util.Map;
-import java.util.HashMap;
/**
* @author Heiko.Braun <heiko.braun(a)jboss.com>
@@ -87,51 +90,52 @@
ProcessDefinition getProcessDefinition()
{
- return parent;
+ return parent;
}
protected final Store createStore(RecordDef recordDef)
- {
- MemoryProxy proxy = new MemoryProxy( getData() );
- ArrayReader reader = new ArrayReader(recordDef);
- Store store = new Store(proxy, reader);
- return store;
- }
+ {
+ MemoryProxy proxy = new MemoryProxy( getData() );
+ ArrayReader reader = new ArrayReader(recordDef);
+ Store store = new Store(proxy, reader);
+ return store;
+ }
- protected Object[][] getData()
- {
- ProcessInstanceDAO dao = DAOFactory.createProcessInstanceDAO();
- List processDefs = dao.getInstanceByProcessDefinitionId(parent.getId());
+ protected Object[][] getData()
+ {
+ ProcessInstanceDAO dao = DAOFactory.createProcessInstanceDAO();
+ List processDefs = dao.getInstanceByProcessDefinitionId(parent.getId());
- Object[][] records = new Object[processDefs.size()][];
+ Object[][] records = new Object[processDefs.size()][];
- Iterator it = processDefs.iterator();
- int row = 0;
- while(it.hasNext())
- {
- ProcessInstance pd = (ProcessInstance)it.next();
- records[row] = new Object[5];
- records[row][0] = new Long(pd.getId());
- records[row][1] = pd.getKey();
- records[row][2] = pd.getStatus();
- records[row][3] = pd.getStartDate();
- records[row][4] = pd.getEndDate();
+ Iterator it = processDefs.iterator();
+ int row = 0;
+ while(it.hasNext())
+ {
+ ProcessInstance pd = (ProcessInstance)it.next();
+ records[row] = new Object[5];
+ records[row][0] = new Long(pd.getId());
+ records[row][1] = pd.getKey();
+ records[row][2] = pd.getStatus();
+ records[row][3] = pd.getStartDate();
+ records[row][4] = pd.getEndDate();
- row2InstanceMap.put(new Integer(row), pd);
+ row2InstanceMap.put(new Integer(row), pd);
- row++;
- }
+ row++;
+ }
- return records;
- }
+ return records;
+ }
-
-
-
-
protected void onExamine(final Integer row)
{
-
+ ProcessInstance instance = (ProcessInstance)row2InstanceMap.get(row);
+ String id = ProcessInstanceEditor.ID+"."+instance.getId()+".tab";
+ if(view.hasEditorView(id))
+ view.showEditor(id);
+ else
+ view.addEditorView( new ProcessInstanceEditor(parent, instance, view) );
}
protected void onDelete(final Integer row)
Added: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceListEditor.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceListEditor.java (rev 0)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceListEditor.java 2008-08-05 13:12:10 UTC (rev 1823)
@@ -0,0 +1,62 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.jboss.bpm.console.client.process;
+
+import org.jboss.bpm.console.client.ConsoleView;
+import org.jboss.bpm.console.client.model.ProcessDefinition;
+import org.jboss.bpm.console.client.widgets.EditorView;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ *
+ * @see org.jboss.bpm.console.client.process.ProcessDefinitionList#onExamine(Integer)
+ */
+public class ProcessInstanceListEditor extends EditorView
+{
+
+ public final static String ID = "org.jboss.bpm.process.ProcessInstanceList";
+
+ private ProcessDefinition parent;
+
+ public ProcessInstanceListEditor(ProcessDefinition proc, ConsoleView view)
+ {
+ super();
+ this.setId(ProcessInstanceEditor.ID+"."+proc.getName());
+
+ parent = proc;
+ ProcessInstanceList list = new ProcessInstanceList(
+ proc, "Process Instances", view
+ );
+ this.add( list );
+ }
+
+
+ public String getEditorId()
+ {
+ return ID;
+ }
+
+ public String getTitle()
+ {
+ return parent.getName();
+ }
+}
Property changes on: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceListEditor.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessListEditor.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessListEditor.java 2008-08-05 10:38:38 UTC (rev 1822)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessListEditor.java 2008-08-05 13:12:10 UTC (rev 1823)
@@ -1,57 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.jboss.bpm.console.client.process;
-
-import org.jboss.bpm.console.client.ConsoleView;
-import org.jboss.bpm.console.client.widgets.EditorView;
-
-/**
- * @author Heiko.Braun <heiko.braun(a)jboss.com>
- */
-public class ProcessListEditor extends EditorView
-{
- public final static String ID = "org.jboss.bpm.process.ProcessList";
-
- private ProcessDefinitionList processDefinitions;
-
- private ConsoleView view;
-
- public ProcessListEditor(ConsoleView view)
- {
- super();
- this.view = view;
-
- processDefinitions = new ProcessDefinitionList("Process Definitions", view);
- this.add(processDefinitions);
- }
-
-
- public String getId()
- {
- return ID;
- }
-
- public String getTitle()
- {
- return "Processes";
- }
-}
Added: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/widgets/BareEditorView.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/widgets/BareEditorView.java (rev 0)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/widgets/BareEditorView.java 2008-08-05 13:12:10 UTC (rev 1823)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.jboss.bpm.console.client.widgets;
+
+import com.gwtext.client.widgets.Component;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class BareEditorView extends EditorView
+{
+
+ private Component comp;
+
+ public BareEditorView(Component comp)
+ {
+ this.add(comp);
+ }
+
+ public String getEditorId()
+ {
+ return super.getId();
+ }
+
+ public String getTitle()
+ {
+ return "";
+ }
+}
Property changes on: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/widgets/BareEditorView.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/widgets/EditorView.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/widgets/EditorView.java 2008-08-05 10:38:38 UTC (rev 1822)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/widgets/EditorView.java 2008-08-05 13:12:10 UTC (rev 1823)
@@ -28,6 +28,6 @@
*/
public abstract class EditorView extends Panel
{
- public abstract String getId();
+ public abstract String getEditorId();
public abstract String getTitle();
}
Modified: jbpm3/trunk/modules/gwt-console/war/src/main/resources/org/jboss/bpm/console/public/Application.html
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/resources/org/jboss/bpm/console/public/Application.html 2008-08-05 10:38:38 UTC (rev 1822)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/resources/org/jboss/bpm/console/public/Application.html 2008-08-05 13:12:10 UTC (rev 1823)
@@ -9,7 +9,6 @@
<script language='javascript'
src='org.jboss.bpm.console.Application.nocache.js'></script>
<link rel="stylesheet" href="console.css" type="text/css">
- <link rel="stylesheet" href="GWT-default.css" type="text/css">
</head>
<!-- -->
Deleted: jbpm3/trunk/modules/gwt-console/war/src/main/resources/org/jboss/bpm/console/public/GWT-default.css
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/resources/org/jboss/bpm/console/public/GWT-default.css 2008-08-05 10:38:38 UTC (rev 1822)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/resources/org/jboss/bpm/console/public/GWT-default.css 2008-08-05 13:12:10 UTC (rev 1823)
@@ -1,595 +0,0 @@
-/**
- * Applied to the entire page.
- */
-body {
- color: black;
- font-family: Helvetica, Arial, sans-serif;
- font-size: 10pt;
- line-height: 12pt;
- margin: 0px;
- border: 0px;
- padding: 0px;
- overflow: visible;
- background: #E1E7F2 url(images/bg_gradient.gif) repeat-x;
- direction: ltr;
-}
-
-table {
- font-size: 100%;
-}
-
-a, a:visited, a:hover {
- color: #0000AA;
-}
-
-/**
- * Applied to buttons.
- */
-.gwt-Button {
- width: 10em;
-}
-
-.gwt-Button:active {
-}
-
-.gwt-Button[disabled] {
- color: #888;
-}
-
-/**
- * Applied to the checkbox and text next to the checkbox.
- */
-.gwt-CheckBox {
-}
-
-.gwt-CheckBox-disabled {
- color: #888;
-}
-
-/**
- * Applied to the dialog box.
- */
-.gwt-DialogBox {
- border: 1px solid #bbbbbb;
-}
-
-.gwt-DialogBox .Caption {
- background: #e3e8f3 url(images/bg_headergradient.gif) repeat-x;
- padding: 4px 4px 4px 8px;
- cursor: default;
- border-bottom: 1px solid #bbbbbb;
-}
-
-.gwt-DialogBox .Content {
- background: white;
-}
-
-.gwt-DialogBox .Content table {
- filter: alpha(opacity=100); /* Fixes rendering issues in IE7 */
-}
-
-/**
- * Applied to the disclosure panel, which shows or hides content when the user
- * toggles the header.
- */
-.gwt-DisclosurePanel {
-}
-
-.gwt-DisclosurePanel a {
- text-decoration: none; /* Remove underline from header */
-}
-
-.gwt-DisclosurePanel-open {
-}
-
-.gwt-DisclosurePanel-closed {
-}
-
-.gwt-DisclosurePanel .header {
-}
-
-.gwt-DisclosurePanel .content {
- border-left: 3px solid #e8eef7;
- padding: 4px 0px 4px 8px;
- margin-left: 6px;
-}
-
-/**
- * Applied to the File Upload.
- */
-.gwt-FileUpload {
-}
-
-/**
- * Applied to the Frame widget, which is an iframe wrapper.
- */
-.gwt-Frame {
-}
-
-/**
- * Applied to split panels.
- */
-.gwt-HorizontalSplitPanel {
- border: 4px solid #E1E7F2;
-}
-
-.gwt-HorizontalSplitPanel .hsplitter {
- cursor: move;
- background-color: #E1E7F2;
- border-right: 1px solid #BBBBBB;
- border-left: 1px solid #BBBBBB;
-}
-
-.gwt-VerticalSplitPanel {
- border: 4px solid #E1E7F2;
-}
-
-.gwt-VerticalSplitPanel .vsplitter {
- cursor: move;
- background-color: #E1E7F2;
- border-top: 1px solid #BBBBBB;
- border-bottom: 1px solid #BBBBBB;
-}
-
-/**
- * Applied to all HTML label elements.
- */
-.gwt-HTML {
-}
-
-/**
- * Applied to all Hyperlinks.
- */
-.gwt-Hyperlink {
-}
-
-/**
- * Applied to all Images
- */
-.gwt-Image {
-}
-
-/**
- * Applied to all Label elements.
- */
-.gwt-Label {
-}
-
-/**
- * Applied to list boxes.
- */
-.gwt-ListBox {
-}
-
-/**
- * Applied to the menu bar.
- */
-.gwt-MenuBar {
- cursor: default;
- border: 1px solid #BBBBBB;
-}
-
-.gwt-MenuBar .gwt-MenuItem {
- cursor: default;
-}
-
-.gwt-MenuBar .gwt-MenuItem-selected {
- background: #E0EDFE;
-}
-
-.gwt-MenuBar-horizontal {
- background: #e3e8f3 url(images/bg_headergradient.gif) repeat-x;
-}
-
-.gwt-MenuBar-horizontal .gwt-MenuItem {
- padding: 0px 10px;
- vertical-align: bottom;
- color: #666666;
- font-weight: bold;
-}
-
-.gwt-MenuBar-vertical {
- background-color: white;
- margin-top: 2px;
- margin-left: 2px;
-}
-
-.gwt-MenuBar-vertical .gwt-MenuItem {
- padding: 4px 20px 4px 8px;
-}
-
-/**
- * Applied to the password input box.
- */
-.gwt-PasswordTextBox {
- padding: 2px;
-}
-.gwt-PasswordTextBox-readonly {
- color: #888;
-}
-
-/**
- * Applied to the push button, a customizable button that can be pressed
- * and released.
- */
-.gwt-PushButton-up {
- padding: 2px;
- background-color: #efebe7;
- border: 2px solid #faf9f7;
- border-right: 2px solid #848280;
- border-bottom: 2px solid #848280;
- cursor: pointer;
- cursor: hand;
-}
-
-.gwt-PushButton-up-hovering {
- padding: 2px;
- background-color: #efebe7;
- border: 2px solid #faf9f7;
- border-right: 2px solid #848280;
- border-bottom: 2px solid #848280;
- cursor: pointer;
- cursor: hand;
-}
-
-.gwt-PushButton-up-disabled {
- padding: 2px;
- background-color: #efebe7;
- border: 2px solid #e7e4e0;
- border-right: 2px solid #625b54;
- border-bottom: 2px solid #625b54;
- cursor: default;
- opacity: 0.5;
-}
-
-.gwt-PushButton-up-disabled .gwt-Image {
- filter: alpha(opacity=30);
-}
-
-.gwt-PushButton-down {
- padding: 2px 1px 2px 3px;
- background-color: #efebe7;
- border: 2px solid #848280;
- border-right: 2px solid #faf9f7;
- border-bottom: 2px solid #faf9f7;
- cursor: pointer;
- cursor: hand;
-}
-
-.gwt-PushButton-down-hovering {
- padding: 2px 1px 2px 3px;
- background-color: #efebe7;
- border: 2px solid #848280;
- border-right: 2px solid #faf9f7;
- border-bottom: 2px solid #faf9f7;
- cursor: pointer;
- cursor: hand;
-}
-
-.gwt-PushButton-down-disabled {
- padding: 2px 1px 2px 3px;
- background-color: #efebe7;
- border: 2px solid #e7e4e0;
- border-right: 2px solid #625b54;
- border-bottom: 2px solid #625b54;
- cursor: default;
- opacity: 0.5;
-}
-
-.gwt-PushButton-down-disabled .gwt-Image {
- filter: alpha(opacity=30);
-}
-
-/**
- * Applied to radio buttons and the text next to them.
- */
-.gwt-RadioButton {
- padding: 4px 4px 3px 3px;
-}
-
-.gwt-RadioButton-disabled {
- color: #888;
-}
-
-/**
- * Applied to the Rich Text Area.
- */
-.gwt-RichTextArea {
-}
-
-.hasRichTextToolbar {
- border: 0px;
-}
-
-.gwt-RichTextToolbar {
- background: #e3e8f3 url(images/bg_headergradient.gif) repeat-x;
- border-bottom: 1px solid #BBBBBB;
- padding: 3px;
- margin: 0px;
-}
-
-.gwt-RichTextToolbar .gwt-PushButton-up {
- padding: 0px 1px 0px 0px;
- margin-right: 4px;
- margin-bottom: 4px;
- border-width: 1px;
-}
-
-.gwt-RichTextToolbar .gwt-PushButton-up-hovering {
- margin-right: 4px;
- margin-bottom: 4px;
- padding: 0px 1px 0px 0px;
- border-width: 1px;
-}
-
-.gwt-RichTextToolbar .gwt-PushButton-down {
- margin-right: 4px;
- margin-bottom: 4px;
- padding: 0px 0px 0px 1px;
- border-width: 1px;
-}
-
-.gwt-RichTextToolbar .gwt-PushButton-down-hovering {
- margin-right: 4px;
- margin-bottom: 4px;
- padding: 0px 0px 0px 1px;
- border-width: 1px;
-}
-
-.gwt-RichTextToolbar .gwt-ToggleButton-up {
- margin-right: 4px;
- margin-bottom: 4px;
- padding: 0px 1px 0px 0px;
- border-width: 1px;
-}
-
-.gwt-RichTextToolbar .gwt-ToggleButton-up-hovering {
- margin-right: 4px;
- margin-bottom: 4px;
- padding: 0px 1px 0px 0px;
- border-width: 1px;
-}
-
-.gwt-RichTextToolbar .gwt-ToggleButton-down {
- margin-right: 4px;
- margin-bottom: 4px;
- padding: 0px 0px 0px 1px;
- border-width: 1px;
-}
-
-.gwt-RichTextToolbar .gwt-ToggleButton-down-hovering {
- margin-right: 4px;
- margin-bottom: 4px;
- padding: 0px 0px 0px 1px;
- border-width: 1px;
-}
-
-/**
- * Applied to the stack panel, a vertical menu widget that reveals one
- * category at a time.
- */
-.gwt-StackPanel {
- border-spacing: 0px;
- border: 1px solid #666666;
-}
-
-.gwt-StackPanel .gwt-StackPanelItem {
- font-weight: bold;
- font-size: 1.3em;
- background: #e3e8f3 url(images/bg_headergradient.gif) repeat-x;
- color: #666666;
- border: 1px solid #e3e8f3;
- padding: 5px 3px 5px 10px;
- cursor: pointer;
- cursor: hand;
-}
-
-.gwt-StackPanel .gwt-StackPanelItem-selected {
- color: black;
- cursor: default;
-}
-
-.gwt-StackPanel .gwt-StackPanelContent {
- padding: 2px 2px 10px 5px;
-}
-
-/**
- * Applied to the suggest box.
- */
-.gwt-SuggestBox {
- padding: 2px;
-}
-
-.gwt-SuggestBoxPopup {
- background: #E0ECFF;
- margin-left: 2px;
- padding: 2px;
- background: #eaeff6 url(images/bg_suggestgradient.gif) repeat-x;
- border: 1px solid #bbbbbb;
-}
-
-.gwt-SuggestBoxPopup .item {
- padding: 2px 6px;
- color: #424242;
- cursor: default;
-}
-
-.gwt-SuggestBoxPopup .item-selected {
- background-color: #E0EDFE;
- background: #eaeff6 url(images/bg_listgradient.gif) repeat-x;
-}
-
-/**
- * Applied to the tab panel. The tab panel provides CSS access to
- * the tab bar element and the table cell that wraps the tab bar element,
- * which allows for rounded edges via the sliding window method.
- */
-.gwt-TabBar {
-}
-
-.gwt-TabBar .gwt-TabBarFirst {
- width: 5px; /* first tab distance from the left */
-}
-
-.gwt-TabBar .gwt-TabBarRest {
-}
-
-.gwt-TabBar .gwt-TabBarItem {
- padding: 3px 4px 2px 4px;
- cursor: pointer;
- cursor: hand;
- color: #666666;
- font-weight: bold;
- background: white url(images/tab.gif) no-repeat right top;
- margin-left: 6px; /* Size of right image, used for sliding window */
- padding-right: 10px; /* +6px to balance margin-left */
- text-align: center;
-}
-
-.gwt-TabBar .gwt-TabBarItem-wrapper {
- padding: 0px;
- background: white url(images/tab.gif) no-repeat left top;
- border-left: 5px solid white; /* Spacing between tabs */
-}
-
-.gwt-TabBar .gwt-TabBarItem-selected {
- cursor: default;
- color: black;
- background: white url(images/tab.gif) no-repeat right -100px;
-}
-
-.gwt-TabBar .gwt-TabBarItem-wrapper-selected {
- background: white url(images/tab.gif) no-repeat left -100px;
-}
-
-.gwt-TabPanel {
-}
-
-.gwt-TabPanelBottom {
- border-color: #BBBBBB;
- border-style: solid;
- border-width: 3px 2px 5px;
- width: 100%;
-}
-
-/**
- * Applied to general text areas.
- */
-.gwt-TextArea {
- padding: 2px;
-}
-
-.gwt-TextArea-readonly {
- color: #888;
-}
-
-/**
- * Applied to text boxes.
- */
-.gwt-TextBox {
- padding: 2px;
-}
-
-.gwt-TextBox-readonly {
- color: #888;
-}
-
-/**
- * Applied to toggle buttons, a customizable button that can be toggled
- * between two states (similar to a checkbox).
- */
-.gwt-ToggleButton-up {
- padding: 2px;
- background-color: #efebe7;
- border: 2px solid #faf9f7;
- border-right: 2px solid #848280;
- border-bottom: 2px solid #848280;
- cursor: pointer;
- cursor: hand;
-}
-
-.gwt-ToggleButton-up-hovering {
- padding: 2px;
- background-color: #efebe7;
- border: 2px solid #faf9f7;
- border-right: 2px solid #848280;
- border-bottom: 2px solid #848280;
- cursor: pointer;
- cursor: hand;
-}
-
-.gwt-ToggleButton-up-disabled {
- padding: 2px;
- background-color: #efebe7;
- border: 2px solid #e7e4e0;
- border-right: 2px solid #625b54;
- border-bottom: 2px solid #625b54;
- cursor: default;
- opacity: 0.5;
-}
-
-.gwt-ToggleButton-up-disabled .gwt-Image {
- filter: alpha(opacity=30);
-}
-
-.gwt-ToggleButton-down {
- padding: 2px 1px 2px 3px;
- background-color: #f5f5f5;
- border: 2px solid #848280;
- border-right: 2px solid #faf9f7;
- border-bottom: 2px solid #faf9f7;
- cursor: pointer;
- cursor: hand;
-}
-
-.gwt-ToggleButton-down-hovering {
- padding: 2px 1px 2px 3px;
- background-color: #f5f5f5;
- border: 2px solid #848280;
- border-right: 2px solid #faf9f7;
- border-bottom: 2px solid #faf9f7;
- cursor: pointer;
- cursor: hand;
-}
-
-.gwt-ToggleButton-down-disabled {
- padding: 2px 1px 2px 3px;
- background-color: #efebe7;
- border: 2px solid #e7e4e0;
- border-right: 2px solid #625b54;
- border-bottom: 2px solid #625b54;
- cursor: default;
- opacity: 0.5;
-}
-
-.gwt-ToggleButton-down-disabled .gwt-Image {
- filter: alpha(opacity=30);
-}
-
-/**
- * Applied to the Tree.
- */
-.gwt-Tree {
- background: white;
-}
-
-.gwt-Tree .gwt-TreeItem-wrapper {
- margin: 0px 0px 0px 20px; // Indentation
-}
-
-.gwt-Tree .gwt-TreeItem {
- padding: 0px;
- margin: 0px;
- border: 1px solid white;
- white-space: nowrap;
- cursor: hand;
- cursor: pointer;
-}
-
-.gwt-Tree .gwt-TreeItem-hovering {
-}
-
-.gwt-Tree .gwt-TreeItem-selected {
- background: #93c2f1 url(images/bg_listgradient.gif) repeat-x;
- border: 1px dotted #888;
-}
Modified: jbpm3/trunk/modules/gwt-console/war/src/main/resources/org/jboss/bpm/console/public/console.css
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/resources/org/jboss/bpm/console/public/console.css 2008-08-05 10:38:38 UTC (rev 1822)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/resources/org/jboss/bpm/console/public/console.css 2008-08-05 13:12:10 UTC (rev 1823)
@@ -34,4 +34,18 @@
.bpm-EditorHeader {
-}
\ No newline at end of file
+}
+
+.bpm-ProcessImage {
+ border: 0px;
+}
+
+.div {
+ border: 1px dashed red;
+}
+
+.bpm-SplitPanel {
+ border: 1px dashed green;
+ vertical-align: top;
+ position:relative; top:5px; left:5px;
+}
Added: jbpm3/trunk/modules/gwt-console/war/src/main/resources/org/jboss/bpm/console/public/images/processSample.jpg
===================================================================
(Binary files differ)
Property changes on: jbpm3/trunk/modules/gwt-console/war/src/main/resources/org/jboss/bpm/console/public/images/processSample.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
17 years, 9 months
JBoss JBPM SVN: r1822 - in jbpm4/pvm/trunk/modules/core/src: main/java/org/jbpm/pvm/test/base and 2 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2008-08-05 06:38:38 -0400 (Tue, 05 Aug 2008)
New Revision: 1822
Modified:
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/env/PvmEnvironment.java
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/test/base/EnvironmentDbTestCase.java
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/test/base/EnvironmentTestCase.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/db/tx/BasicTransactionTest.java
jbpm4/pvm/trunk/modules/core/src/test/resources/logging.properties
Log:
fixed the EnvironmentDbTestCases
Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/env/PvmEnvironment.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/env/PvmEnvironment.java 2008-08-05 07:36:52 UTC (rev 1821)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/env/PvmEnvironment.java 2008-08-05 10:38:38 UTC (rev 1822)
@@ -193,7 +193,7 @@
// close ////////////////////////////////////////////////////////////////////
public void close() {
- log.debug("closing "+this+"...");
+ log.trace("closing "+this);
pvmEnvironmentFactory.getApplicationWireContext().fire(PvmEnvironment.EVENT_CLOSEENVIRONMENT, this);
Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/test/base/EnvironmentDbTestCase.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/test/base/EnvironmentDbTestCase.java 2008-08-05 07:36:52 UTC (rev 1821)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/test/base/EnvironmentDbTestCase.java 2008-08-05 10:38:38 UTC (rev 1822)
@@ -23,9 +23,10 @@
import java.lang.reflect.Field;
+import org.hibernate.Session;
import org.hibernate.SessionFactory;
+import org.hibernate.Transaction;
import org.jbpm.pvm.Execution;
-import org.jbpm.pvm.env.Transaction;
import org.jbpm.pvm.internal.model.ExecutionImpl;
import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
import org.jbpm.pvm.internal.util.ReflectUtil;
@@ -44,33 +45,57 @@
*/
public class EnvironmentDbTestCase extends EnvironmentTestCase {
+ Transaction transaction = null;
+
public void setUp() throws Exception {
if (isEnvironmentFactoryCached()) {
Db.clean(getEnvironmentFactory());
}
- super.setUp();
+ super.setUp();
+ beginTransaction();
}
+
+ public void tearDown() throws Exception {
+ commitTransaction();
+ super.tearDown();
+ }
+ void beginTransaction() {
+ Session session = environment.get(Session.class);
+ transaction = session.beginTransaction();
+ }
+
+ void commitTransaction() {
+ transaction.commit();
+ transaction = null;
+ }
+
+ void rollbackTransaction() {
+ transaction.rollback();
+ transaction = null;
+ }
+
public DbSession getDbSession() {
return environment.get(DbSession.class);
}
public void rollbackAndBeginNewTransaction() {
- Transaction transaction = environment.get(Transaction.class);
- transaction.setRollbackOnly();
- environment.close();
- environment = null;
+ rollbackTransaction();
+ closeEnvironment();
+ openEnvironment();
+ beginTransaction();
}
public void newTransaction() {
try {
- environment.close();
+ commitTransaction();
+ closeEnvironment();
} finally {
- log.debug("### new transaction ###################################################");
- environment = getEnvironmentFactory().openEnvironment();
+ openEnvironment();
+ beginTransaction();
}
}
-
+
public void beginCacheTest() {
SessionFactory sessionFactory = environment.get(SessionFactory.class);
if (sessionFactory != null) {
Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/test/base/EnvironmentTestCase.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/test/base/EnvironmentTestCase.java 2008-08-05 07:36:52 UTC (rev 1821)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/test/base/EnvironmentTestCase.java 2008-08-05 10:38:38 UTC (rev 1822)
@@ -39,12 +39,20 @@
public void setUp() throws Exception {
super.setUp();
- environment = getEnvironmentFactory().openEnvironment();
+ openEnvironment();
}
public void tearDown() throws Exception {
+ closeEnvironment();
+ super.tearDown();
+ }
+
+ void closeEnvironment() {
environment.close();
environment = null;
- super.tearDown();
}
+
+ void openEnvironment() {
+ environment = getEnvironmentFactory().openEnvironment();
+ }
}
Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/db/tx/BasicTransactionTest.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/db/tx/BasicTransactionTest.java 2008-08-05 07:36:52 UTC (rev 1821)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/db/tx/BasicTransactionTest.java 2008-08-05 10:38:38 UTC (rev 1822)
@@ -23,11 +23,15 @@
import java.util.List;
+import javax.transaction.Synchronization;
+
import org.hibernate.Session;
import org.jbpm.pvm.PvmException;
import org.jbpm.pvm.env.Environment;
+import org.jbpm.pvm.env.Transaction;
import org.jbpm.pvm.internal.cmd.Command;
import org.jbpm.pvm.internal.model.CommentImpl;
+import org.jbpm.pvm.internal.type.variable.StringVariable;
import org.jbpm.pvm.test.base.DbTestCase;
/**
@@ -109,4 +113,79 @@
}
});
}
+
+
+ public static class SuccessfulSynchronization implements Synchronization {
+ public void beforeCompletion() {
+ Environment environment = Environment.getCurrent();
+ Session session = environment.get(Session.class);
+ StringVariable stringVariable = new StringVariable();
+ stringVariable.setValue("hello");
+ session.save(stringVariable);
+ }
+ public void afterCompletion(int arg0) {
+ }
+ }
+
+ public void testSuccessfulSynchronization() {
+ commandService.execute(new Command<Object>(){
+ public Object execute(Environment environment) throws Exception {
+ Session session = environment.get(Session.class);
+ session.save(new CommentImpl("if i only had the time to write code"));
+ Transaction transaction = environment.get(Transaction.class);
+ SuccessfulSynchronization successfulSynchronization = new SuccessfulSynchronization();
+ transaction.registerSynchronization(successfulSynchronization);
+ return null;
+ }
+ });
+
+ commandService.execute(new Command<Object>(){
+ public Object execute(Environment environment) {
+ Session session = environment.get(Session.class);
+ List<CommentImpl> comments = session.createQuery("from "+CommentImpl.class.getName()).list();
+ assertEquals("if i only had the time to write code", comments.get(0).getMessage());
+ List<StringVariable> stringVariables = session.createQuery("from "+StringVariable.class.getName()).list();
+ assertEquals("hello", stringVariables.get(0).getValue());
+ return null;
+ }
+ });
+ }
+
+ public static class UnsuccessfulSynchronization implements Synchronization {
+ public void beforeCompletion() {
+ Environment environment = Environment.getCurrent();
+ Session session = environment.get(Session.class);
+ StringVariable stringVariable = new StringVariable();
+ stringVariable.setValue("hello");
+ session.save(stringVariable);
+ throw new MyOwnRuntimeException();
+ }
+ public void afterCompletion(int arg0) {
+ }
+ }
+
+ public void testUnsuccessfulSynchronization() {
+ commandService.execute(new Command<Object>(){
+ public Object execute(Environment environment) throws Exception {
+ Session session = environment.get(Session.class);
+ session.save(new CommentImpl("if i only had the time to write code"));
+ Transaction transaction = environment.get(Transaction.class);
+ UnsuccessfulSynchronization unsuccessfulSynchronization = new UnsuccessfulSynchronization();
+ transaction.registerSynchronization(unsuccessfulSynchronization);
+ return null;
+ }
+ });
+
+ commandService.execute(new Command<Object>(){
+ public Object execute(Environment environment) {
+ Session session = environment.get(Session.class);
+ List<CommentImpl> comments = session.createQuery("from "+CommentImpl.class.getName()).list();
+ assertEquals(0, comments.size());
+ List<StringVariable> stringVariables = session.createQuery("from "+StringVariable.class.getName()).list();
+ assertEquals(0, stringVariables.size());
+ return null;
+ }
+ });
+ }
+
}
Modified: jbpm4/pvm/trunk/modules/core/src/test/resources/logging.properties
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/resources/logging.properties 2008-08-05 07:36:52 UTC (rev 1821)
+++ jbpm4/pvm/trunk/modules/core/src/test/resources/logging.properties 2008-08-05 10:38:38 UTC (rev 1822)
@@ -22,7 +22,7 @@
org.hibernate.cfg.HbmBinder.level=SEVERE
org.hibernate.cfg.SettingsFactory.level=SEVERE
# org.hibernate.level=FINE
-# org.hibernate.SQL.level=FINEST
+org.hibernate.SQL.level=FINEST
# org.hibernate.type.level=FINEST
# org.hibernate.tool.hbm2ddl.SchemaExport.level=FINEST
# org.hibernate.transaction.level=FINEST
17 years, 9 months