JBoss JBPM SVN: r7068 - in jbpm3/branches/jbpm-3.2-soa: db and 3 other directories.
by do-not-reply@jboss.org
Author: marco.rietveld
Date: 2012-02-22 11:56:34 -0500 (Wed, 22 Feb 2012)
New Revision: 7068
Modified:
jbpm3/branches/jbpm-3.2-soa/db/pom.xml
jbpm3/branches/jbpm-3.2-soa/distribution/pom.xml
jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/examples/module/pom.xml
jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/examples/pom.xml
jbpm3/branches/jbpm-3.2-soa/pom.xml
Log:
Updating pom versions to 3.2.12-SNAPSHOT
Modified: jbpm3/branches/jbpm-3.2-soa/db/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/db/pom.xml 2012-02-22 16:54:19 UTC (rev 7067)
+++ jbpm3/branches/jbpm-3.2-soa/db/pom.xml 2012-02-22 16:56:34 UTC (rev 7068)
@@ -18,7 +18,7 @@
<parent>
<groupId>org.jbpm.jbpm3</groupId>
<artifactId>jbpm</artifactId>
- <version>3.2.11.SP2-SNAPSHOT</version>
+ <version>3.2.12-SNAPSHOT</version>
</parent>
<properties>
Modified: jbpm3/branches/jbpm-3.2-soa/distribution/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/distribution/pom.xml 2012-02-22 16:54:19 UTC (rev 7067)
+++ jbpm3/branches/jbpm-3.2-soa/distribution/pom.xml 2012-02-22 16:56:34 UTC (rev 7068)
@@ -18,7 +18,7 @@
<parent>
<groupId>org.jbpm.jbpm3</groupId>
<artifactId>jbpm</artifactId>
- <version>3.2.11.SP2-SNAPSHOT</version>
+ <version>3.2.12-SNAPSHOT</version>
</parent>
<!-- Properties -->
Modified: jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/examples/module/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/examples/module/pom.xml 2012-02-22 16:54:19 UTC (rev 7067)
+++ jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/examples/module/pom.xml 2012-02-22 16:56:34 UTC (rev 7068)
@@ -18,7 +18,7 @@
<parent>
<artifactId>jbpm-examples-dist</artifactId>
<groupId>org.jbpm.jbpm3</groupId>
- <version>3.2.11.SP2-SNAPSHOT</version>
+ <version>3.2.12-SNAPSHOT</version>
</parent>
<build>
Modified: jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/examples/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/examples/pom.xml 2012-02-22 16:54:19 UTC (rev 7067)
+++ jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/examples/pom.xml 2012-02-22 16:56:34 UTC (rev 7068)
@@ -19,7 +19,7 @@
<parent>
<groupId>org.jbpm.jbpm3</groupId>
<artifactId>jbpm</artifactId>
- <version>3.2.11.SP2-SNAPSHOT</version>
+ <version>3.2.12-SNAPSHOT</version>
</parent>
<modules>
Modified: jbpm3/branches/jbpm-3.2-soa/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/pom.xml 2012-02-22 16:54:19 UTC (rev 7067)
+++ jbpm3/branches/jbpm-3.2-soa/pom.xml 2012-02-22 16:56:34 UTC (rev 7068)
@@ -39,7 +39,7 @@
<module>tomcat</module>
<module>userguide</module>
</modules>
-
+
<!-- Properties -->
<properties>
<maven.compiler.source>1.4</maven.compiler.source>
@@ -47,7 +47,7 @@
<!-- Dependency versions -->
<cargo.version>1.0.3</cargo.version>
- <jsf.console.version>3.2.11.SP2-SNAPSHOT</jsf.console.version>
+ <jsf.console.version>3.2.12-SNAPSHOT</jsf.console.version>
<!-- Database Driver Versions -->
<db2jcc.version>3.1.57</db2jcc.version>
@@ -304,7 +304,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <version>3.8.1</version>
+ <version>3.8.2</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
12 years, 2 months
JBoss JBPM SVN: r7067 - in jbpm3/branches/jbpm-3.2-soa/core/src: main/java/org/jbpm/persistence and 5 other directories.
by do-not-reply@jboss.org
Author: marco.rietveld
Date: 2012-02-22 11:54:19 -0500 (Wed, 22 Feb 2012)
New Revision: 7067
Modified:
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/command/AbstractGetObjectBaseCommand.java
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/persistence/PersistenceService.java
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/Jbpm3430/JBPM3430Test.java
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/command/ChangeProcessInstanceVersionCommandTest.java
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm3235/JBPM3235Test.java
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/persistence/db/custom.hibernate.cfg.xml
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/seam/custom.job.executor.jbpm.cfg.xml
Log:
Test and NPE fixes.
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/command/AbstractGetObjectBaseCommand.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/command/AbstractGetObjectBaseCommand.java 2012-02-22 02:27:13 UTC (rev 7066)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/command/AbstractGetObjectBaseCommand.java 2012-02-22 16:54:19 UTC (rev 7067)
@@ -113,15 +113,19 @@
retrieveNode(token.getNode());
// Hibernate.initialize(token.getAvailableTransitions());
- for (Iterator iter = token.getChildren().values().iterator(); iter.hasNext();) {
- retrieveToken((Token) iter.next());
+ if( token.getChildren() != null ) {
+ for (Iterator iter = token.getChildren().values().iterator(); iter.hasNext();) {
+ retrieveToken((Token) iter.next());
+ }
}
}
protected void retrieveNode(Node node) {
- Hibernate.initialize(node);
- // Hibernate.initialize(node.getLeavingTransitions());
- if (node.getSuperState() != null) retrieveNode(node.getSuperState());
+ if( node != null ) {
+ Hibernate.initialize(node);
+ // Hibernate.initialize(node.getLeavingTransitions());
+ if (node.getSuperState() != null) retrieveNode(node.getSuperState());
+ }
}
public void retrieveVariables(ProcessInstance pi) {
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/persistence/PersistenceService.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/persistence/PersistenceService.java 2012-02-22 02:27:13 UTC (rev 7066)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/persistence/PersistenceService.java 2012-02-22 16:54:19 UTC (rev 7067)
@@ -27,7 +27,6 @@
import org.jbpm.db.LoggingSession;
import org.jbpm.db.TaskMgmtSession;
import org.jbpm.svc.Service;
-import org.jbpm.tx.TxService;
public interface PersistenceService extends Service {
@@ -40,13 +39,6 @@
TaskMgmtSession getTaskMgmtSession();
Object getCustomSession(Class sessionClass);
- /** @deprecated call {@link TxService#isRollbackOnly()} instead */
- boolean isRollbackOnly();
- /** @deprecated call {@link TxService#setRollbackOnly()} instead */
- void setRollbackOnly();
- /** @deprecated call {@link TxService#setRollbackOnly()} instead */
- void setRollbackOnly(boolean isRollbackOnly);
-
void setGraphSession(GraphSession graphSession);
void setLoggingSession(LoggingSession loggingSession);
void setJobSession(JobSession jobSession);
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/Jbpm3430/JBPM3430Test.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/Jbpm3430/JBPM3430Test.java 2012-02-22 02:27:13 UTC (rev 7066)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/Jbpm3430/JBPM3430Test.java 2012-02-22 16:54:19 UTC (rev 7067)
@@ -66,7 +66,13 @@
private static final String PROCESS_NAME = "jbpm3430";
+ boolean doNotRunUnlessManually = true;
+
protected void setUp() throws Exception {
+ if( doNotRunUnlessManually ) {
+ return;
+ }
+
super.setUp();
setUpAndEnsureCleanDatabase();
@@ -174,9 +180,8 @@
// DBG
private static final SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss,SSS");
+
- boolean doNotRunUnlessManually = true;
-
public void testTimerScheduling() throws Exception {
if( doNotRunUnlessManually ) {
return;
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/command/ChangeProcessInstanceVersionCommandTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/command/ChangeProcessInstanceVersionCommandTest.java 2012-02-22 02:27:13 UTC (rev 7066)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/command/ChangeProcessInstanceVersionCommandTest.java 2012-02-22 16:54:19 UTC (rev 7067)
@@ -401,7 +401,7 @@
fail("Exception expected, saying that theTask2 is missing in new version");
}
catch (JbpmException ex) {
- assert ex.getMessage().indexOf("theTask2") != -1 : ex.getMessage();
+ assertTrue( ex.getMessage(), ex.getMessage().indexOf("theTask2") != -1 );
}
// now supply a mapping for the missing task
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm3235/JBPM3235Test.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm3235/JBPM3235Test.java 2012-02-22 02:27:13 UTC (rev 7066)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm3235/JBPM3235Test.java 2012-02-22 16:54:19 UTC (rev 7067)
@@ -33,6 +33,7 @@
import org.jbpm.db.AbstractDbTestCase;
import org.jbpm.db.JobSession;
import org.jbpm.db.hibernate.HibernateHelper;
+import org.jbpm.graph.def.EventCallback;
import org.jbpm.graph.def.ProcessDefinition;
import org.jbpm.graph.exe.ProcessInstance;
import org.jbpm.graph.exe.Token;
@@ -65,7 +66,7 @@
private int numJobsToAdd = 10;
// Make sure this test does not run in Hudson
- private boolean thisIsAnAutomatedTest = false;
+ private boolean thisIsAnAutomatedTest = true;
private boolean startWithCleanDatabase = false;
private boolean cleanDatabaseAfterTest = false;
@@ -119,6 +120,8 @@
closeJbpmContext();
log.info("### END " + getName() + " ####################");
+ EventCallback.clear();
+ super.tearDown();
}
//
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/persistence/db/custom.hibernate.cfg.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/persistence/db/custom.hibernate.cfg.xml 2012-02-22 02:27:13 UTC (rev 7066)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/persistence/db/custom.hibernate.cfg.xml 2012-02-22 16:54:19 UTC (rev 7067)
@@ -13,6 +13,7 @@
<property name="hibernate.connection.url">jdbc:hsqldb:.</property>
<property name="hibernate.connection.username">sa</property>
<property name="hibernate.connection.password"></property>
+ <property name="hibernate.show_sql">false</property>
<property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>
</session-factory>
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/seam/custom.job.executor.jbpm.cfg.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/seam/custom.job.executor.jbpm.cfg.xml 2012-02-22 02:27:13 UTC (rev 7066)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/seam/custom.job.executor.jbpm.cfg.xml 2012-02-22 16:54:19 UTC (rev 7067)
@@ -5,9 +5,7 @@
<field name="nbrOfThreads"><int value="1" /></field>
<field name="idleInterval"><int value="5000" /></field>
<field name="maxIdleInterval"><int value="3600000" /></field> <!-- 1 hour -->
- <field name="historyMaxSize"><int value="20" /></field>
<field name="maxLockTime"><int value="600000" /></field> <!-- 10 minutes -->
<field name="lockMonitorInterval"><int value="60000" /></field> <!-- 1 minute -->
- <field name="lockBufferTime"><int value="5000" /></field> <!-- 5 seconds -->
</bean>
</jbpm-configuration>
\ No newline at end of file
12 years, 2 months
JBoss JBPM SVN: r7066 - in jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm: mail and 1 other directory.
by do-not-reply@jboss.org
Author: marco.rietveld
Date: 2012-02-21 21:27:13 -0500 (Tue, 21 Feb 2012)
New Revision: 7066
Modified:
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/jpdl/xml/JpdlXmlReader.java
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/mail/Mail.java
Log:
Last of the import clean ups.
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/jpdl/xml/JpdlXmlReader.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/jpdl/xml/JpdlXmlReader.java 2012-02-22 02:26:34 UTC (rev 7065)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/jpdl/xml/JpdlXmlReader.java 2012-02-22 02:27:13 UTC (rev 7066)
@@ -68,8 +68,6 @@
public class JpdlXmlReader implements ProblemListener {
- private static final long serialVersionUID = 1L;
-
protected InputSource inputSource;
protected List problems = new ArrayList();
protected ProblemListener problemListener;
@@ -741,7 +739,7 @@
nodeClass = node.getClass();
}
String simpleClassName = nodeClass.getName();
- simpleClassName = simpleClassName.substring(simpleClassName.lastIndexOf('.'));
+ simpleClassName = simpleClassName.substring(simpleClassName.lastIndexOf('.') + 1);
addError("conditions on transitions used leaving a " + simpleClassName
+ ", conditions on transitions only usable leaving decisions." );
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/mail/Mail.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/mail/Mail.java 2012-02-22 02:26:34 UTC (rev 7065)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/mail/Mail.java 2012-02-22 02:27:13 UTC (rev 7066)
@@ -21,8 +21,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.w3c.dom.Element;
-
import org.jbpm.JbpmConfiguration.Configs;
import org.jbpm.JbpmException;
import org.jbpm.graph.def.ActionHandler;
@@ -31,8 +29,6 @@
import org.jbpm.jpdl.el.VariableResolver;
import org.jbpm.jpdl.el.impl.JbpmExpressionEvaluator;
import org.jbpm.util.ClassLoaderUtil;
-import org.jbpm.util.XmlUtil;
-import org.pdfbox.filter.CCITTFaxDecodeFilter;
public class Mail implements ActionHandler {
12 years, 2 months
JBoss JBPM SVN: r7065 - in jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm: jbpm2036 and 4 other directories.
by do-not-reply@jboss.org
Author: marco.rietveld
Date: 2012-02-21 21:26:34 -0500 (Tue, 21 Feb 2012)
New Revision: 7065
Modified:
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/Jbpm3386/JBPM3386Test.java
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm2036/JBPM2036Test.java
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm3171/JBPM3171Test.java
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm3218/JBPM3218Test.java
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jpdl/xml/TaskNodeXmlTest.java
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/logging/exe/CompositeLogTest.java
Log:
Random clean up: imports, spacing, etc.
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/Jbpm3386/JBPM3386Test.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/Jbpm3386/JBPM3386Test.java 2012-02-22 02:24:34 UTC (rev 7064)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/Jbpm3386/JBPM3386Test.java 2012-02-22 02:26:34 UTC (rev 7065)
@@ -31,8 +31,6 @@
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
-import junit.framework.Test;
-
import org.apache.log4j.Logger;
import org.jbpm.AbstractJbpmTestCase;
import org.jbpm.JbpmConfiguration;
@@ -41,7 +39,6 @@
import org.jbpm.context.exe.ContextInstance;
import org.jbpm.graph.def.ProcessDefinition;
import org.jbpm.graph.exe.ProcessInstance;
-import org.jbpm.mail.MailTestSetup;
import org.subethamail.smtp.AuthenticationHandler;
import org.subethamail.smtp.AuthenticationHandlerFactory;
import org.subethamail.smtp.auth.LoginAuthenticationHandler;
@@ -65,7 +62,7 @@
private JbpmContext jbpmContext;
private ProcessInstance processInstance;
- private static JbpmConfiguration jbpmConfiguration = JbpmConfiguration.parseResource("org/jbpm/jbpm3386/jbpm.cfg.xml");
+ private static JbpmConfiguration jbpmConfiguration = null;
private static Wiser wiser;
private static String authUsername = "doug(a)newcastle.uk";
@@ -74,6 +71,9 @@
private static final String toAddress = "tester(a)jboss.org";
protected void setUp() throws Exception {
+ if( jbpmConfiguration == null ) {
+ jbpmConfiguration = JbpmConfiguration.parseResource("org/jbpm/jbpm3386/jbpm.cfg.xml");
+ }
wiser = new Wiser();
MessageListenerAdapter serverMessageListenerAdapter = (MessageListenerAdapter) wiser.getServer()
.getMessageHandlerFactory();
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm2036/JBPM2036Test.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm2036/JBPM2036Test.java 2012-02-22 02:24:34 UTC (rev 7064)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm2036/JBPM2036Test.java 2012-02-22 02:26:34 UTC (rev 7065)
@@ -43,17 +43,13 @@
+ " </start-state>"
+ " <task-node name='midway' end-tasks='yes'>"
+ " <timer name='chaos' duedate='2 seconds' repeat='5 seconds'>"
- + " <action class='"
- + TimerAction.class.getName()
- + "'>"
+ + " <action class='" + TimerAction.class.getName() + "'>"
+ " <leave>true</leave>"
+ " </action>"
+ " </timer>"
+ " <task name='doit'>"
+ " <timer name='undead' duedate='1 second' repeat='5 seconds'>"
- + " <action class='"
- + TimerAction.class.getName()
- + "'/>"
+ + " <action class='" + TimerAction.class.getName() + "'/>"
+ " </timer>"
+ " </task>"
+ " <transition to='end'/>"
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm3171/JBPM3171Test.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm3171/JBPM3171Test.java 2012-02-22 02:24:34 UTC (rev 7064)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm3171/JBPM3171Test.java 2012-02-22 02:26:34 UTC (rev 7065)
@@ -21,8 +21,6 @@
*/
package org.jbpm.jbpm3171;
-import java.util.Date;
-
import org.jbpm.AbstractJbpmTestCase;
import org.jbpm.context.exe.ContextInstance;
import org.jbpm.graph.def.ProcessDefinition;
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm3218/JBPM3218Test.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm3218/JBPM3218Test.java 2012-02-22 02:24:34 UTC (rev 7064)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm3218/JBPM3218Test.java 2012-02-22 02:26:34 UTC (rev 7065)
@@ -26,7 +26,6 @@
import java.util.Date;
import org.jbpm.JbpmConfiguration.Configs;
-import org.jbpm.JbpmContext;
import org.jbpm.command.CommandService;
import org.jbpm.command.ExecuteJobsCommand;
import org.jbpm.command.impl.CommandServiceImpl;
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jpdl/xml/TaskNodeXmlTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jpdl/xml/TaskNodeXmlTest.java 2012-02-22 02:24:34 UTC (rev 7064)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jpdl/xml/TaskNodeXmlTest.java 2012-02-22 02:26:34 UTC (rev 7065)
@@ -135,7 +135,7 @@
" <task-node name='a'>" +
" <task name='clean ceiling'>" +
" <event type='task-create'>" +
- " <action class='org.jbpm.taskmgmt.exe.TaskEventTest$PlusPlus' />" +
+ " <action class='org.jbpm.taskmgmt.exe.TaskEventExecutionTest$PlusPlus' />" +
" </event>" +
" </task>" +
" </task-node>" +
@@ -152,7 +152,7 @@
" <task-node name='a'>" +
" <task name='clean ceiling'>" +
" <event type='task-start'>" +
- " <action class='org.jbpm.taskmgmt.exe.TaskEventTest$PlusPlus' />" +
+ " <action class='org.jbpm.taskmgmt.exe.TaskEventExecutionTest$PlusPlus' />" +
" </event>" +
" </task>" +
" </task-node>" +
@@ -169,7 +169,7 @@
" <task-node name='a'>" +
" <task name='clean ceiling'>" +
" <event type='task-assign'>" +
- " <action class='org.jbpm.taskmgmt.exe.TaskEventTest$PlusPlus' />" +
+ " <action class='org.jbpm.taskmgmt.exe.TaskEventExecutionTest$PlusPlus' />" +
" </event>" +
" </task>" +
" </task-node>" +
@@ -186,7 +186,7 @@
" <task-node name='a'>" +
" <task name='clean ceiling'>" +
" <event type='task-end'>" +
- " <action class='org.jbpm.taskmgmt.exe.TaskEventTest$PlusPlus' />" +
+ " <action class='org.jbpm.taskmgmt.exe.TaskEventExecutionTest$PlusPlus' />" +
" </event>" +
" </task>" +
" </task-node>" +
@@ -203,7 +203,7 @@
" <task-node name='a'>" +
" <task name='clean ceiling'>" +
" <timer duedate='2 business minutes'>" +
- " <action class='org.jbpm.taskmgmt.exe.TaskEventTest$PlusPlus' />" +
+ " <action class='org.jbpm.taskmgmt.exe.TaskEventExecutionTest$PlusPlus' />" +
" </timer>" +
" </task>" +
" </task-node>" +
@@ -230,7 +230,7 @@
" <task-node name='a'>" +
" <task name='clean ceiling'>" +
" <timer duedate='2 business minutes' cancel-event='task-start, task-assign, task-end'>" +
- " <action class='org.jbpm.taskmgmt.exe.TaskEventTest$PlusPlus' />" +
+ " <action class='org.jbpm.taskmgmt.exe.TaskEventExecutionTest$PlusPlus' />" +
" </timer>" +
" </task>" +
" </task-node>" +
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/logging/exe/CompositeLogTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/logging/exe/CompositeLogTest.java 2012-02-22 02:24:34 UTC (rev 7064)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/logging/exe/CompositeLogTest.java 2012-02-22 02:26:34 UTC (rev 7065)
@@ -43,6 +43,7 @@
assertNull(one.getParent());
assertSame(one, li.getLogs().get(1));
assertEquals(2, li.getLogs().size());
+
assertEquals(0, li.getCompositeLogStack().size());
CompositeLog two = new CompositeLog();
12 years, 2 months
JBoss JBPM SVN: r7064 - jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/logging/exe.
by do-not-reply@jboss.org
Author: marco.rietveld
Date: 2012-02-21 21:24:34 -0500 (Tue, 21 Feb 2012)
New Revision: 7064
Modified:
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/logging/exe/LoggingConfigDbTest.java
Log:
JBPM-1118: fixing the LoggingConfigDbTest
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/logging/exe/LoggingConfigDbTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/logging/exe/LoggingConfigDbTest.java 2012-02-22 02:22:55 UTC (rev 7063)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/logging/exe/LoggingConfigDbTest.java 2012-02-22 02:24:34 UTC (rev 7064)
@@ -23,12 +23,24 @@
}
public void testLoggingconfiguration() {
- ProcessDefinition processDefinition = new ProcessDefinition("logging");
+ ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
+ "<process-definition name='test-log-process'>" +
+ " <start-state>" +
+ " <transition to='s' />" +
+ " </start-state>" +
+ " <state name='s'>" +
+ " <transition to='s' />" +
+ " </state>" +
+ "</process-definition>"
+ );
deployProcessDefinition(processDefinition);
- ProcessInstance processInstance = jbpmContext.newProcessInstance("logging");
+ ProcessInstance processInstance = jbpmContext.newProcessInstance("test-log-process");
processInstance.getContextInstance().setVariable("a", "1");
+ processInstance.signal();
+ processInstance = saveAndReload(processInstance);
+
newTransaction();
List logs = session.createCriteria(ProcessLog.class).list();
assertEquals(0, logs.size());
12 years, 2 months
JBoss JBPM SVN: r7063 - in jbpm3/branches/jbpm-3.2-soa/core/src/test: resources/org/jbpm/jbpm3235 and 1 other directory.
by do-not-reply@jboss.org
Author: marco.rietveld
Date: 2012-02-21 21:22:55 -0500 (Tue, 21 Feb 2012)
New Revision: 7063
Added:
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3235/hibernate.hsql.properties
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3235/spy.properties
Removed:
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3235/spy.properties
Modified:
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm3235/JBPM3235Test.java
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3235/hibernate.postgresql.properties
Log:
Refactored because of JBPM-3430
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm3235/JBPM3235Test.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm3235/JBPM3235Test.java 2012-02-22 02:17:23 UTC (rev 7062)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm3235/JBPM3235Test.java 2012-02-22 02:22:55 UTC (rev 7063)
@@ -21,12 +21,15 @@
*/
package org.jbpm.jbpm3235;
-import java.util.ArrayList;
+import java.text.SimpleDateFormat;
import java.util.Calendar;
-import java.util.Collection;
import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+import org.hibernate.Query;
import org.hibernate.cfg.Configuration;
+import org.hibernate.cfg.Environment;
import org.jbpm.db.AbstractDbTestCase;
import org.jbpm.db.JobSession;
import org.jbpm.db.hibernate.HibernateHelper;
@@ -36,6 +39,7 @@
import org.jbpm.job.ExecuteActionJob;
import org.jbpm.job.Job;
import org.jbpm.persistence.db.DbPersistenceServiceFactory;
+import org.jbpm.svc.Services;
/**
* JobSession.getFirstDueJob was not performing due to the queries having to sort the duedate field without an index.
@@ -49,6 +53,7 @@
private long[] monitoredJobIds = null;
private String postgresDatabaseProperties = "org/jbpm/jbpm3235/hibernate.postgresql.properties";
+ private String hsqlDatabaseProperties = "org/jbpm/jbpm3235/hibernate.hsql.properties";
/**
* Feel free to make your own database properties file
* and fill it appropriately: see the above file for necessary fields.
@@ -57,21 +62,26 @@
*/
// Number of rows to add to the Job table
- private int numJobsToAdd = 5000;
+ private int numJobsToAdd = 10;
// Make sure this test does not run in Hudson
- private boolean thisIsAnAutomatedTest = true;
- private boolean startWithCleanDatabase = true;
- private boolean cleanDatabaseAfterTest = true;
+ private boolean thisIsAnAutomatedTest = false;
+ private boolean startWithCleanDatabase = false;
+ private boolean cleanDatabaseAfterTest = false;
+ private boolean usingHSQLDB = false;
+
/**
* Setup the test case.
*/
protected void setUp() throws Exception {
if( thisIsAnAutomatedTest ) return;
+ DbPersistenceServiceFactory persistenceServiceFactory = (DbPersistenceServiceFactory) getJbpmConfiguration().getServiceFactory(Services.SERVICENAME_PERSISTENCE);
+ String dialect = persistenceServiceFactory.getConfiguration().getProperty(Environment.DIALECT);
+
setUpDatabase();
- if( startWithCleanDatabase ) {
+ if( startWithCleanDatabase && ! usingHSQLDB ) {
ensureCleanDatabase();
}
super.setUp();
@@ -81,12 +91,18 @@
}
private void setUpDatabase() {
- String hibernateCfgXmlResource = null;
- String propertiesResource = postgresDatabaseProperties;
-
+ String propertiesResource = null;
+ if (usingHSQLDB) {
+ propertiesResource = hsqlDatabaseProperties;
+ }
+ else {
+ propertiesResource = postgresDatabaseProperties;
+ }
+
// Ensure that the hibernate session uses the properties we configured (see propertiesResource above)
- DbPersistenceServiceFactory persistenceServiceFactory = (DbPersistenceServiceFactory) getJbpmConfiguration().getServiceFactory("persistence");
- Configuration configuration = HibernateHelper.createConfiguration(hibernateCfgXmlResource, propertiesResource);
+ Configuration configuration = HibernateHelper.createConfiguration(null, propertiesResource);
+
+ DbPersistenceServiceFactory persistenceServiceFactory = (DbPersistenceServiceFactory) getJbpmConfiguration().getServiceFactory(Services.SERVICENAME_PERSISTENCE);
persistenceServiceFactory.setConfiguration(configuration);
}
@@ -95,7 +111,8 @@
*/
protected void tearDown() throws Exception {
if( thisIsAnAutomatedTest ) { return; }
- if( cleanDatabaseAfterTest ) {
+
+ if( cleanDatabaseAfterTest && ! usingHSQLDB ) {
ensureCleanDatabase();
deleteProcessDefinitions();
}
@@ -108,37 +125,49 @@
// ACTUAL TESTS
//
- public void testFirstDueJobQueries() {
+ private SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss.SSS yyyy-MM-dd");
+ private boolean debug = false;
+ public void testQueries() {
if( thisIsAnAutomatedTest ) { return; }
- // This test has to do with the performance on an actual DB
- // (not that Hypersonic _isn't_, but.. you know what I mean!
- if (getHibernateDialect().indexOf("HSQL") != -1) { return; }
addJobsToDb();
JobSession jobSession = jbpmContext.getJobSession();
- Job result = null;
+ if( debug ) {
+ Query query = session.createQuery("select job from org.jbpm.job.Job job");
+ List jobList = query.list();
+ assertTrue( "WTF!?!", jobList.size() > 0 );
+
+ Iterator iter = jobList.iterator();
+ while( iter.hasNext() ) {
+ Job job = (Job) iter.next();
+ log.info("RET: [" + job.getLockOwner() + "/" + job.getRetries() + "]: " + sdf.format(job.getDueDate()) );
+ }
+ }
+
// Query: JobSession.getFirstUnownedDueJob
- result = jobSession.getFirstDueJob(null, null);
- assertTrue(result != null);
-
- // Query: JobSession.getFirstDueJob
- String lockOwner = PROCESS_NAME;
- result = jobSession.getFirstDueJob(lockOwner, null);
- assertTrue(result != null);
-
- // Query: JobSession.getFirstDueJobExcludingMonitoredJobs
- Collection monitoredJobs = new ArrayList(numJobsToAdd/2);
- for (int i = 0; i < monitoredJobIds.length / 2; ++i) {
- monitoredJobs.add(new Long(monitoredJobIds[i]));
+ Date wakeUpDate = new Date();
+ log.trace( "Wake Up Date: " + sdf.format(wakeUpDate) );
+ Date nextDueDate = null;
+ if( ! debug ) {
+ nextDueDate = jobSession.getNextUnownedDueJobDueDate(wakeUpDate);
}
- result = jobSession.getFirstDueJob(lockOwner, monitoredJobs);
- assertTrue(result != null);
-
- // Query: JobSession.getFirstDueJobExcludingMonitoredJobs WITH NULL LockOwner
- result = jobSession.getFirstDueJob(null, monitoredJobs);
- assertTrue(result != null);
+ else {
+ Query query = session.getNamedQuery("JobSession.getNextUnownedDueJobDueDate") .setTimestamp("wakeUpDate", wakeUpDate);
+ List dateList = query.list();
+ assertTrue( "No Dates!!?!", dateList.size() > 0 );
+ assertTrue( "TOO MANY Dates!!?!", dateList.size() > 1 );
+
+ nextDueDate = (Date) dateList.get(0);
+ Iterator iter = dateList.iterator();
+ while( iter.hasNext() ) {
+ Date ndt = (Date) iter.next();
+ log.info( "- ndt: " + sdf.format(ndt));
+ }
+ }
+ assertTrue("Next due date was NOT found!!", nextDueDate != null);
+ log.info( "Next Due Date: " + sdf.format(nextDueDate) );
}
protected void addJobsToDb() {
@@ -148,7 +177,7 @@
Token rootToken = processInstance.getRootToken();
int i = 0;
for (; i < (numJobsToAdd/2); ++i) {
- jobs[i] = createJob(rootToken, null, i);
+ jobs[i] = createJob(rootToken, i);
jbpmContext.getJobSession().saveJob(jobs[i]);
}
for (; i < numJobsToAdd; ++i) {
@@ -164,14 +193,31 @@
}
}
+ /**
+ * select min(job.dueDate)
+ * from org.jbpm.job.Job job
+ * where job.dueDate <= :wakeUpDate
+ * and job.lockOwner is null
+ * and job.retries > 0
+ * and job.isSuspended = false
+ */
+ private Job createJob(Token token, int i) {
+ return createJob(token, null, i);
+ }
+
private Job createJob(Token token, String lockOwner, int i) {
Job job = new ExecuteActionJob(token);
// Add information used for querying
job.setLockOwner(lockOwner);
+ job.setRetries(i+1);
+ job.setSuspended(false);
// Fields used in query for sorting
job.setDueDate(getOneHourAgoMinus(i));
+ if( debug ) {
+ log.info("Job [" + lockOwner + "/" + job.getRetries() + "]: " + sdf.format(job.getDueDate()) );
+ }
// Other fields
job.setException("Simulated Exception");
@@ -181,6 +227,7 @@
}
+
private Date getOneHourAgoMinus(int seconds) {
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.HOUR, -1);
Added: jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3235/hibernate.hsql.properties
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3235/hibernate.hsql.properties (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3235/hibernate.hsql.properties 2012-02-22 02:22:55 UTC (rev 7063)
@@ -0,0 +1,11 @@
+# hibernate.connection.driver_class=org.hsqldb.Driver
+hibernate.connection.driver_class=com.p6spy.engine.spy.P6SpyDriver
+
+hibernate.dialect=org.hibernate.dialect.HSQLDialect
+hibernate.connection.url=jdbc\:hsqldb\:.
+hibernate.connection.username=sa
+hibernate.connection.password=
+
+hibernate.hbm2ddl.auto=create
+hibernate.show_sql=false
+
Property changes on: jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3235/hibernate.hsql.properties
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3235/hibernate.postgresql.properties
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3235/hibernate.postgresql.properties 2012-02-22 02:17:23 UTC (rev 7062)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3235/hibernate.postgresql.properties 2012-02-22 02:22:55 UTC (rev 7063)
@@ -1,7 +1,8 @@
-hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
# hibernate.connection.driver_class=org.postgresql.Driver
hibernate.connection.driver_class=com.p6spy.engine.spy.P6SpyDriver
+
+hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
hibernate.connection.url=jdbc\:postgresql\://localhost\:5432/jbpm3
hibernate.connection.username=jbpm3
hibernate.connection.password=jbpm3
Deleted: jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3235/spy.properties
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3235/spy.properties 2012-02-22 02:17:23 UTC (rev 7062)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3235/spy.properties 2012-02-22 02:22:55 UTC (rev 7063)
@@ -1,249 +0,0 @@
-#################################################################
-# P6Spy 2.0-SNAPSHOT Options File #
-# See documentation for detailed instructions #
-# #
-# PLACE IN src/test/resources when using!!! #
-# #
-#################################################################
-
-#################################################################
-# MODULES #
-# #
-# Modules provide the P6Spy functionality. If a module, such #
-# as module_log is commented out, that functionality will not #
-# be available. If it is not commented out (if it is active), #
-# the functionality will be active. #
-# #
-# Values set in Modules cannot be reloaded using the #
-# reloadproperties variable. Once they are loaded, they remain #
-# in memory until the application is restarted. #
-# #
-#################################################################
-
-module.log=com.p6spy.engine.logging.P6LogFactory
-#module.outage=com.p6spy.engine.outage.P6OutageFactory
-
-#################################################################
-# REALDRIVER(s) #
-# #
-# In your application server configuration file you replace the #
-# "real driver" name with com.p6spy.engine.spy.P6SpyDriver. This#
-# is where you put the name of your real driver P6Spy can find #
-# and register your real driver to do the database work. #
-# #
-# If your application uses several drivers specify them in #
-# realdriver2, realdriver3. See the documentation for more #
-# details. #
-# #
-# Values set in REALDRIVER(s) cannot be reloaded using the #
-# reloadproperties variable. Once they are loaded, they remain #
-# in memory until the application is restarted. #
-# #
-#################################################################
-
-# oracle driver
-# realdriver=oracle.jdbc.driver.OracleDriver
-
-# mysql Connector/J driver
-# realdriver=com.mysql.jdbc.Driver
-
-# informix driver
-# realdriver=com.informix.jdbc.IfxDriver
-
-# ibm db2 driver
-# realdriver=COM.ibm.db2.jdbc.net.DB2Driver
-
-# the mysql open source driver
-realdriver=org.postgresql.Driver
-
-#specifies another driver to use
-realdriver2=
-#specifies a third driver to use
-realdriver3=
-
-
-#the DriverManager class sequentially tries every driver that is
-#registered to find the right driver. In some instances, it's possible to
-#load up the realdriver before the p6spy driver, in which case your connections
-#will not get wrapped as the realdriver will "steal" the connection before
-#p6spy sees it. Set the following property to "true" to cause p6spy to
-#explicitily deregister the realdrivers
-deregisterdrivers=true
-
-################################################################
-# P6LOG SPECIFIC PROPERTIES #
-################################################################
-# no properties currently available
-
-################################################################
-# EXECUTION THRESHOLD PROPERTIES #
-################################################################
-# This feature applies to the standard logging of P6Spy. #
-# While the standard logging logs out every statement #
-# regardless of its execution time, this feature puts a time #
-# condition on that logging. Only statements that have taken #
-# longer than the time specified (in milliseconds) will be #
-# logged. This way it is possible to see only statements that #
-# have exceeded some high water mark. #
-# This time is reloadable. #
-#
-# executionthreshold=integer time (milliseconds)
-#
-executionthreshold=
-
-################################################################
-# P6OUTAGE SPECIFIC PROPERTIES #
-################################################################
-# Outage Detection
-#
-# This feature detects long-running statements that may be indicative of
-# a database outage problem. If this feature is turned on, it will log any
-# statement that surpasses the configurable time boundary during its execution.
-# When this feature is enabled, no other statements are logged except the long
-# running statements. The interval property is the boundary time set in seconds.
-# For example, if this is set to 2, then any statement requiring at least 2
-# seconds will be logged. Note that the same statement will continue to be logged
-# for as long as it executes. So if the interval is set to 2, and the query takes
-# 11 seconds, it will be logged 5 times (at the 2, 4, 6, 8, 10 second intervals).
-#
-# outagedetection=true|false
-# outagedetectioninterval=integer time (seconds)
-#
-outagedetection=false
-outagedetectioninterval=
-
-################################################################
-# COMMON PROPERTIES #
-################################################################
-
-# filter what is logged
-filter=false
-
-# comma separated list of tables to include when filtering
-include =
-# comma separated list of tables to exclude when filtering
-exclude =
-
-# sql expression to evaluate if using regex filtering
-sqlexpression =
-
-
-# turn on tracing
-autoflush = true
-
-# sets the date format using Java's SimpleDateFormat routine
-dateformat=yy.MM.dd HH:mm:ss
-
-#list of categories to explicitly include
-includecategories=
-
-#list of categories to exclude: error, info, batch, debug, statement, resultset
-#commit, rollback and result are valid values
-excludecategories=info,debug,result,batch
-
-
-#allows you to use a regex engine or your own matching engine to determine
-#which statements to log
-#
-#stringmatcher=com.p6spy.engine.common.GnuRegexMatcher
-#stringmatcher=com.p6spy.engine.common.JakartaRegexMatcher
-stringmatcher=
-
-# prints a stack trace for every statement logged
-stacktrace=false
-# if stacktrace=true, specifies the stack trace to print
-stacktraceclass=
-
-# determines if property file should be reloaded
-reloadproperties=false
-# determines how often should be reloaded in seconds
-reloadpropertiesinterval=60
-
-#if=true then url must be prefixed with p6spy:
-useprefix=false
-
-#specifies the appender to use for logging
-#appender=com.p6spy.engine.logging.appender.Log4jLogger
-#appender=com.p6spy.engine.logging.appender.StdoutLogger
-appender=com.p6spy.engine.logging.appender.StdoutLogger
-
-# name of logfile to use, note Windows users should make sure to use forward slashes in their pathname (e:/test/spy.log) (used for file logger only)
-logfile = spy.log
-
-# append to the p6spy log file. if this is set to false the
-# log file is truncated every time. (file logger only)
-append=true
-
-#The following are for log4j logging only
-log4j.appender.STDOUT=org.apache.log4j.ConsoleAppender
-log4j.appender.STDOUT.layout=org.apache.log4j.PatternLayout
-log4j.appender.STDOUT.layout.ConversionPattern=p6spy - %m%n
-
-#log4j.appender.CHAINSAW_CLIENT=org.apache.log4j.net.SocketAppender
-#log4j.appender.CHAINSAW_CLIENT.RemoteHost=localhost
-#log4j.appender.CHAINSAW_CLIENT.Port=4445
-#log4j.appender.CHAINSAW_CLIENT.LocationInfo=true
-
-log4j.logger.p6spy=INFO,STDOUT
-
-
-#################################################################
-# DataSource replacement #
-# #
-# Replace the real DataSource class in your application server #
-# configuration with the name com.p6spy.engine.spy.P6DataSource,#
-# then add the JNDI name and class name of the real #
-# DataSource here #
-# #
-# Values set in this item cannot be reloaded using the #
-# reloadproperties variable. Once it is loaded, it remains #
-# in memory until the application is restarted. #
-# #
-#################################################################
-#realdatasource=/RealMySqlDS
-#realdatasourceclass=com.mysql.jdbc.jdbc2.optional.MysqlDataSource
-
-#################################################################
-# DataSource properties #
-# #
-# If you are using the DataSource support to intercept calls #
-# to a DataSource that requires properties for proper setup, #
-# define those properties here. Use name value pairs, separate #
-# the name and value with a semicolon, and separate the #
-# pairs with commas. #
-# #
-# The example shown here is for mysql #
-# #
-#################################################################
-#realdatasourceproperties=port;3306,serverName;ibmhost,databaseName;mydb
-
-
-#################################################################
-# JNDI DataSource lookup #
-# #
-# If you are using the DataSource support outside of an app #
-# server, you will probably need to define the JNDI Context #
-# environment. #
-# #
-# If the P6Spy code will be executing inside an app server then #
-# do not use these properties, and the DataSource lookup will #
-# use the naming context defined by the app server. #
-# #
-# The two standard elements of the naming environment are #
-# jndicontextfactory and jndicontextproviderurl. If you need #
-# additional elements, use the jndicontextcustom property. #
-# You can define multiple properties in jndicontextcustom, #
-# in name value pairs. Separate the name and value with a #
-# semicolon, and separate the pairs with commas. #
-# #
-# The example shown here is for a standalone program running on #
-# a machine that is also running JBoss, so the JDNI context #
-# is configured for JBoss (3.0.4). #
-# #
-#################################################################
-#jndicontextfactory=org.jnp.interfaces.NamingContextFactory
-#jndicontextproviderurl=localhost:1099
-#jndicontextcustom=java.naming.factory.url.pkgs;org.jboss.nameing:org.jnp.interfaces
-
-#jndicontextfactory=com.ibm.websphere.naming.WsnInitialContextFactory
-#jndicontextproviderurl=iiop://localhost:900
Added: jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3235/spy.properties
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3235/spy.properties (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3235/spy.properties 2012-02-22 02:22:55 UTC (rev 7063)
@@ -0,0 +1,249 @@
+#################################################################
+# P6Spy 2.0-SNAPSHOT Options File #
+# See documentation for detailed instructions #
+# #
+# PLACE IN src/test/resources when using!!! #
+# #
+#################################################################
+
+#################################################################
+# MODULES #
+# #
+# Modules provide the P6Spy functionality. If a module, such #
+# as module_log is commented out, that functionality will not #
+# be available. If it is not commented out (if it is active), #
+# the functionality will be active. #
+# #
+# Values set in Modules cannot be reloaded using the #
+# reloadproperties variable. Once they are loaded, they remain #
+# in memory until the application is restarted. #
+# #
+#################################################################
+
+module.log=com.p6spy.engine.logging.P6LogFactory
+#module.outage=com.p6spy.engine.outage.P6OutageFactory
+
+#################################################################
+# REALDRIVER(s) #
+# #
+# In your application server configuration file you replace the #
+# "real driver" name with com.p6spy.engine.spy.P6SpyDriver. This#
+# is where you put the name of your real driver P6Spy can find #
+# and register your real driver to do the database work. #
+# #
+# If your application uses several drivers specify them in #
+# realdriver2, realdriver3. See the documentation for more #
+# details. #
+# #
+# Values set in REALDRIVER(s) cannot be reloaded using the #
+# reloadproperties variable. Once they are loaded, they remain #
+# in memory until the application is restarted. #
+# #
+#################################################################
+
+# oracle driver
+# realdriver=oracle.jdbc.driver.OracleDriver
+
+# mysql Connector/J driver
+# realdriver=com.mysql.jdbc.Driver
+
+# informix driver
+# realdriver=com.informix.jdbc.IfxDriver
+
+# ibm db2 driver
+# realdriver=COM.ibm.db2.jdbc.net.DB2Driver
+
+# the mysql open source driver
+realdriver=org.postgresql.Driver
+
+#specifies another driver to use
+realdriver2=
+#specifies a third driver to use
+realdriver3=
+
+
+#the DriverManager class sequentially tries every driver that is
+#registered to find the right driver. In some instances, it's possible to
+#load up the realdriver before the p6spy driver, in which case your connections
+#will not get wrapped as the realdriver will "steal" the connection before
+#p6spy sees it. Set the following property to "true" to cause p6spy to
+#explicitily deregister the realdrivers
+deregisterdrivers=true
+
+################################################################
+# P6LOG SPECIFIC PROPERTIES #
+################################################################
+# no properties currently available
+
+################################################################
+# EXECUTION THRESHOLD PROPERTIES #
+################################################################
+# This feature applies to the standard logging of P6Spy. #
+# While the standard logging logs out every statement #
+# regardless of its execution time, this feature puts a time #
+# condition on that logging. Only statements that have taken #
+# longer than the time specified (in milliseconds) will be #
+# logged. This way it is possible to see only statements that #
+# have exceeded some high water mark. #
+# This time is reloadable. #
+#
+# executionthreshold=integer time (milliseconds)
+#
+executionthreshold=
+
+################################################################
+# P6OUTAGE SPECIFIC PROPERTIES #
+################################################################
+# Outage Detection
+#
+# This feature detects long-running statements that may be indicative of
+# a database outage problem. If this feature is turned on, it will log any
+# statement that surpasses the configurable time boundary during its execution.
+# When this feature is enabled, no other statements are logged except the long
+# running statements. The interval property is the boundary time set in seconds.
+# For example, if this is set to 2, then any statement requiring at least 2
+# seconds will be logged. Note that the same statement will continue to be logged
+# for as long as it executes. So if the interval is set to 2, and the query takes
+# 11 seconds, it will be logged 5 times (at the 2, 4, 6, 8, 10 second intervals).
+#
+# outagedetection=true|false
+# outagedetectioninterval=integer time (seconds)
+#
+outagedetection=false
+outagedetectioninterval=
+
+################################################################
+# COMMON PROPERTIES #
+################################################################
+
+# filter what is logged
+filter=false
+
+# comma separated list of tables to include when filtering
+include =
+# comma separated list of tables to exclude when filtering
+exclude =
+
+# sql expression to evaluate if using regex filtering
+sqlexpression =
+
+
+# turn on tracing
+autoflush = true
+
+# sets the date format using Java's SimpleDateFormat routine
+dateformat=yy.MM.dd HH:mm:ss
+
+#list of categories to explicitly include
+includecategories=
+
+#list of categories to exclude: error, info, batch, debug, statement, resultset
+#commit, rollback and result are valid values
+excludecategories=info,debug,result,batch
+
+
+#allows you to use a regex engine or your own matching engine to determine
+#which statements to log
+#
+#stringmatcher=com.p6spy.engine.common.GnuRegexMatcher
+#stringmatcher=com.p6spy.engine.common.JakartaRegexMatcher
+stringmatcher=
+
+# prints a stack trace for every statement logged
+stacktrace=false
+# if stacktrace=true, specifies the stack trace to print
+stacktraceclass=
+
+# determines if property file should be reloaded
+reloadproperties=false
+# determines how often should be reloaded in seconds
+reloadpropertiesinterval=60
+
+#if=true then url must be prefixed with p6spy:
+useprefix=false
+
+#specifies the appender to use for logging
+#appender=com.p6spy.engine.logging.appender.Log4jLogger
+#appender=com.p6spy.engine.logging.appender.StdoutLogger
+appender=com.p6spy.engine.logging.appender.StdoutLogger
+
+# name of logfile to use, note Windows users should make sure to use forward slashes in their pathname (e:/test/spy.log) (used for file logger only)
+logfile = spy.log
+
+# append to the p6spy log file. if this is set to false the
+# log file is truncated every time. (file logger only)
+append=true
+
+#The following are for log4j logging only
+log4j.appender.STDOUT=org.apache.log4j.ConsoleAppender
+log4j.appender.STDOUT.layout=org.apache.log4j.PatternLayout
+log4j.appender.STDOUT.layout.ConversionPattern=p6spy - %m%n
+
+#log4j.appender.CHAINSAW_CLIENT=org.apache.log4j.net.SocketAppender
+#log4j.appender.CHAINSAW_CLIENT.RemoteHost=localhost
+#log4j.appender.CHAINSAW_CLIENT.Port=4445
+#log4j.appender.CHAINSAW_CLIENT.LocationInfo=true
+
+log4j.logger.p6spy=INFO,STDOUT
+
+
+#################################################################
+# DataSource replacement #
+# #
+# Replace the real DataSource class in your application server #
+# configuration with the name com.p6spy.engine.spy.P6DataSource,#
+# then add the JNDI name and class name of the real #
+# DataSource here #
+# #
+# Values set in this item cannot be reloaded using the #
+# reloadproperties variable. Once it is loaded, it remains #
+# in memory until the application is restarted. #
+# #
+#################################################################
+#realdatasource=/RealMySqlDS
+#realdatasourceclass=com.mysql.jdbc.jdbc2.optional.MysqlDataSource
+
+#################################################################
+# DataSource properties #
+# #
+# If you are using the DataSource support to intercept calls #
+# to a DataSource that requires properties for proper setup, #
+# define those properties here. Use name value pairs, separate #
+# the name and value with a semicolon, and separate the #
+# pairs with commas. #
+# #
+# The example shown here is for mysql #
+# #
+#################################################################
+#realdatasourceproperties=port;3306,serverName;ibmhost,databaseName;mydb
+
+
+#################################################################
+# JNDI DataSource lookup #
+# #
+# If you are using the DataSource support outside of an app #
+# server, you will probably need to define the JNDI Context #
+# environment. #
+# #
+# If the P6Spy code will be executing inside an app server then #
+# do not use these properties, and the DataSource lookup will #
+# use the naming context defined by the app server. #
+# #
+# The two standard elements of the naming environment are #
+# jndicontextfactory and jndicontextproviderurl. If you need #
+# additional elements, use the jndicontextcustom property. #
+# You can define multiple properties in jndicontextcustom, #
+# in name value pairs. Separate the name and value with a #
+# semicolon, and separate the pairs with commas. #
+# #
+# The example shown here is for a standalone program running on #
+# a machine that is also running JBoss, so the JDNI context #
+# is configured for JBoss (3.0.4). #
+# #
+#################################################################
+#jndicontextfactory=org.jnp.interfaces.NamingContextFactory
+#jndicontextproviderurl=localhost:1099
+#jndicontextcustom=java.naming.factory.url.pkgs;org.jboss.nameing:org.jnp.interfaces
+
+#jndicontextfactory=com.ibm.websphere.naming.WsnInitialContextFactory
+#jndicontextproviderurl=iiop://localhost:900
Property changes on: jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3235/spy.properties
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
12 years, 2 months
JBoss JBPM SVN: r7062 - in jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm: jbpm3421 and 1 other directory.
by do-not-reply@jboss.org
Author: marco.rietveld
Date: 2012-02-21 21:17:23 -0500 (Tue, 21 Feb 2012)
New Revision: 7062
Added:
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3421/
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3421/processdef.xml
Log:
JBPM-3421: adding cancel-event attribute to (3.1,3.2) XSD.
Added: jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3421/processdef.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3421/processdef.xml (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3421/processdef.xml 2012-02-22 02:17:23 UTC (rev 7062)
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<process-definition name="jbpm3421" xmlns="urn:jbpm.org:jpdl-3.2"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jbpm.org:jpdl-3.2 http://jbpm.org/xsd/jpdl-3.2.xsd">
+
+ <event type="process-end">
+ <action expression="#{eventCallback.processEnd}"/>
+ </event>
+ <event type="timer">
+ <action expression="#{eventCallback.timer}" />
+ </event>
+
+ <start-state name="start">
+ <transition name="doneStart" to="firstNode" />
+ </start-state>
+
+ <task-node name="firstNode">
+ <task name="firstTask">
+ <timer duedate="1 seconds" repeat="true" >
+ <script>System.out.println("Fire!");</script>
+ </timer>
+ </task>
+ <transition name="done" to="end" />
+ </task-node>
+
+ <end-state name="end" />
+
+</process-definition>
+ <!--
+ <timer duedate="1 seconds" repeat="true" cancel-event="timer">
+ -->
Property changes on: jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3421/processdef.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
12 years, 2 months
JBoss JBPM SVN: r7061 - in jbpm3/branches/jbpm-3.2-soa/core/src: test/java/org/jbpm and 1 other directories.
by do-not-reply@jboss.org
Author: marco.rietveld
Date: 2012-02-21 21:17:01 -0500 (Tue, 21 Feb 2012)
New Revision: 7061
Added:
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/Jbpm3421/
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/Jbpm3421/JBPM3421Test.java
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/Jbpm3421/JBPM3421TimerTest.java
Modified:
jbpm3/branches/jbpm-3.2-soa/core/src/main/resources/org/jbpm/jpdl/xml/jpdl-3.1.xsd
jbpm3/branches/jbpm-3.2-soa/core/src/main/resources/org/jbpm/jpdl/xml/jpdl-3.2.xsd
Log:
JBPM-3421: adding cancel-event attribute to (3.1,3.2) XSD.
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/resources/org/jbpm/jpdl/xml/jpdl-3.1.xsd
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/resources/org/jbpm/jpdl/xml/jpdl-3.1.xsd 2012-02-22 02:14:43 UTC (rev 7060)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/resources/org/jbpm/jpdl/xml/jpdl-3.1.xsd 2012-02-22 02:17:01 UTC (rev 7061)
@@ -351,6 +351,7 @@
<xs:attribute name="name" type="xs:string" />
<xs:attribute name="repeat" type="xs:string" />
<xs:attribute name="transition" type="xs:string" />
+ <xs:attribute name="cancel-event" type="xs:string" use="optional" default="task-end"/>
</xs:complexType>
</xs:element>
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/resources/org/jbpm/jpdl/xml/jpdl-3.2.xsd
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/resources/org/jbpm/jpdl/xml/jpdl-3.2.xsd 2012-02-22 02:14:43 UTC (rev 7060)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/resources/org/jbpm/jpdl/xml/jpdl-3.2.xsd 2012-02-22 02:17:01 UTC (rev 7061)
@@ -391,6 +391,7 @@
<xs:attribute name="name" type="xs:string" />
<xs:attribute name="repeat" type="xs:string" />
<xs:attribute name="transition" type="xs:string" />
+ <xs:attribute name="cancel-event" type="xs:string" use="optional" default="task-end"/>
</xs:complexType>
</xs:element>
Added: jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/Jbpm3421/JBPM3421Test.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/Jbpm3421/JBPM3421Test.java (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/Jbpm3421/JBPM3421Test.java 2012-02-22 02:17:01 UTC (rev 7061)
@@ -0,0 +1,64 @@
+package org.jbpm.Jbpm3421;
+
+import java.util.Iterator;
+
+import junit.framework.TestCase;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.jpdl.JpdlException;
+import org.jbpm.jpdl.xml.Problem;
+
+public class JBPM3421Test extends TestCase {
+
+ private static final Log log = LogFactory.getLog(JBPM3421Test.class);
+
+ private static final String[] jpdlNamespaces = {
+ "urn:jbpm.org:jpdl-3.0", "urn:jbpm.org:jpdl-3.1", "urn:jbpm.org:jpdl-3.2",
+ };
+
+ public void testCancelEventTimerAttributeIsvalid() {
+ for (int i = 0; i < 3; ++i) {
+ try {
+ ProcessDefinition.parseXmlString(
+ "<process-definition xmlns='" + jpdlNamespaces[i] + "' name='pd'>"
+ + " <task-node name='a'>"
+ + " <task name='clean ceiling'>"
+ + " <timer duedate='2 business minutes' cancel-event='task-end'>"
+ + " <action class='org.jbpm.taskmgmt.exe.TaskEventExecutionTest$PlusPlus' />"
+ + " </timer>"
+ + " </task>"
+ + " </task-node>"
+ + "</process-definition>");
+ }
+ catch (JpdlException je) {
+ Iterator iter = je.getProblems().iterator();
+ while (iter.hasNext()) {
+ Problem xmlProb = (Problem) iter.next();
+ log.error("jpdl 3." + i + ": " + getTypeDescription(xmlProb.getLevel()) + ": "
+ + xmlProb.getDescription());
+ }
+ fail("Exception thrown with jpdl 3." + i + ": " + je.getMessage());
+ }
+ }
+ }
+
+ static String getTypeDescription(int level) {
+ switch (level) {
+ case Problem.LEVEL_FATAL:
+ return "FATAL";
+ case Problem.LEVEL_ERROR:
+ return "ERROR";
+ case Problem.LEVEL_WARNING:
+ return "WARNING";
+ case Problem.LEVEL_INFO:
+ return "INFO";
+ }
+ return null;
+ }
+
+
+
+
+}
Property changes on: jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/Jbpm3421/JBPM3421Test.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
Added: jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/Jbpm3421/JBPM3421TimerTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/Jbpm3421/JBPM3421TimerTest.java (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/Jbpm3421/JBPM3421TimerTest.java 2012-02-22 02:17:01 UTC (rev 7061)
@@ -0,0 +1,46 @@
+package org.jbpm.Jbpm3421;
+
+import org.jbpm.db.AbstractDbTestCase;
+import org.jbpm.graph.def.Event;
+import org.jbpm.graph.def.EventCallback;
+import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.graph.exe.ProcessInstance;
+
+public class JBPM3421TimerTest extends AbstractDbTestCase {
+
+ public void testCancelEventExecutionInTaskTimer() {
+ // setup
+ ProcessDefinition processDefinition = ProcessDefinition.parseXmlResource("org/jbpm/jbpm3421/processdef.xml");
+ deployProcessDefinition(processDefinition);
+ startJobExecutor();
+
+ // test
+ ProcessInstance processInstance = jbpmContext.newProcessInstanceForUpdate("jbpm3421");
+ processInstance.getContextInstance().setVariable("eventCallback", new EventCallback());
+ processInstance.signal();
+ assertEquals("firstNode", processInstance.getRootToken().getNode().getName());
+
+ // Wait for timer and verify that it fired..
+ newTransaction();
+ EventCallback.waitForEvent(Event.EVENTTYPE_TIMER);
+ long processInstanceId = processInstance.getId();
+ assertEquals("firstNode", jbpmContext.loadProcessInstance(processInstanceId)
+ .getRootToken()
+ .getNode()
+ .getName());
+
+ // Task timer does not have a transition (timer fires == do nothing)
+ // so we signal again
+ jbpmContext.loadProcessInstance(processInstanceId).signal();
+
+ // Wait for process to end
+ newTransaction();
+ EventCallback.waitForEvent(Event.EVENTTYPE_PROCESS_END);
+ assertTrue(jbpmContext.loadProcessInstance(processInstanceId).hasEnded());
+
+ // clean up
+ stopJobExecutor();
+ EventCallback.clear();
+ }
+
+}
Property changes on: jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/Jbpm3421/JBPM3421TimerTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
12 years, 2 months
JBoss JBPM SVN: r7060 - in jbpm3/branches/jbpm-3.2-soa/core/src: test/java/org/jbpm and 1 other directories.
by do-not-reply@jboss.org
Author: marco.rietveld
Date: 2012-02-21 21:14:43 -0500 (Tue, 21 Feb 2012)
New Revision: 7060
Added:
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm3416/
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm3416/JBPM3416Test.java
Modified:
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/logging/exe/LoggingInstance.java
Log:
JBPM-3416: LoggingInstance concurrency issue.
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/logging/exe/LoggingInstance.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/logging/exe/LoggingInstance.java 2012-02-22 02:13:14 UTC (rev 7059)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/logging/exe/LoggingInstance.java 2012-02-22 02:14:43 UTC (rev 7060)
@@ -25,6 +25,7 @@
import java.io.ObjectInputStream;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.Iterator;
import java.util.List;
@@ -51,16 +52,16 @@
public LoggingInstance() {
}
- public void startCompositeLog(CompositeLog compositeLog) {
+ public synchronized void startCompositeLog(CompositeLog compositeLog) {
addLog(compositeLog);
compositeLogStack.add(compositeLog);
}
- public void endCompositeLog() {
+ public synchronized void endCompositeLog() {
compositeLogStack.remove(compositeLogStack.size() - 1);
}
- public void addLog(ProcessLog processLog) {
+ public synchronized void addLog(ProcessLog processLog) {
if (!compositeLogStack.isEmpty()) {
CompositeLog compositeLog = (CompositeLog) compositeLogStack.get(compositeLogStack.size() - 1);
compositeLog.addChild(processLog);
@@ -71,14 +72,14 @@
}
public List getLogs() {
- return logs;
+ return Collections.unmodifiableList(logs);
}
/**
* get logs, filtered by log type.
*/
public List getLogs(Class filterClass) {
- return getLogs(logs, filterClass);
+ return getLogs(getLogs(), filterClass);
}
public static List getLogs(Collection logs, Class filterClass) {
@@ -93,7 +94,7 @@
}
List getCompositeLogStack() {
- return compositeLogStack;
+ return Collections.unmodifiableList(compositeLogStack);
}
public void logLogs() {
Added: jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm3416/JBPM3416Test.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm3416/JBPM3416Test.java (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm3416/JBPM3416Test.java 2012-02-22 02:14:43 UTC (rev 7060)
@@ -0,0 +1,148 @@
+package org.jbpm.jbpm3416;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jbpm.AbstractJbpmTestCase;
+import org.jbpm.context.exe.ContextInstance;
+import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.graph.exe.ProcessInstance;
+import org.jbpm.graph.exe.Token;
+
+/**
+ * 2 threads concurrently call Token#signal() and ContextThread#setVariable() on the same process instance.
+ * THREAD_NUM is the number of threads which concurrently execute the test. Each thread spawns 2 threads as described above.
+ * LOOP_NUM is the number of test iterations. You may increase it to reproduce the Exception for sure.
+ *
+ * @see <a href="https://jira.jboss.org/jira/browse/JBPM-3416">JBPM-3416</a>
+ */
+public class JBPM3416Test extends AbstractJbpmTestCase {
+
+ private static final int LOOP_NUM = 100;
+ private static final int THREAD_NUM = 1000;
+
+ private static List exceptionList = new ArrayList();
+
+ public boolean doNotRunUnlessManually = true;
+
+ public void testConcurrentAccessToLoggingInstance() {
+ if( doNotRunUnlessManually ) {
+ return;
+ }
+
+ ProcessDefinition processDefinition = ProcessDefinition
+ .parseXmlString(
+ "<process-definition>"
+ + " <start-state name='start'>"
+ + " <transition to='s' />"
+ + " </start-state>"
+ + " <state name='s'>"
+ + " <transition to='end' />"
+ + " </state>"
+ + " <end-state name='end' />"
+ + "</process-definition>");
+
+ for (int i = 0; i < LOOP_NUM; i++) {
+ ArrayList threads = new ArrayList();
+ for (int idx = 0; idx < THREAD_NUM; idx++) {
+ threads.add(new JobThread(processDefinition, idx));
+ }
+
+ for (int idx = 0; idx < THREAD_NUM; idx++) {
+ ((Thread) threads.get(idx)).start();
+ }
+
+ for (int idx = 0; idx < THREAD_NUM; idx++) {
+ try {
+ ((Thread) threads.get(idx)).join();
+ } catch (InterruptedException e) {
+ // ignore
+ }
+ }
+ if (exceptionList.size() > 0) {
+ ((RuntimeException) exceptionList.get(exceptionList.size()-1)).printStackTrace();
+ fail("[" + i + "] Found RuntimeException : exceptionList.size() = "
+ + exceptionList.size() + ", exceptionList.get(0) = "
+ + exceptionList.get(0));
+ }
+ }
+
+
+ }
+
+ private class JobThread extends Thread {
+ ProcessDefinition processDefinition = null;
+ int id = -1;
+
+ public JobThread(ProcessDefinition processDefinition, int id) {
+ this.processDefinition = processDefinition;
+ this.id = id;
+ }
+
+ public void run() {
+ ProcessInstance processInstance = new ProcessInstance(processDefinition);
+
+ TokenThread tokenThread = new TokenThread(processInstance);
+ ContextThread contextThread = new ContextThread(processInstance);
+ tokenThread.start();
+ contextThread.start();
+ try {
+ tokenThread.join();
+ } catch (InterruptedException e) {
+ // ignore;
+ }
+ try {
+ contextThread.join();
+ } catch (InterruptedException e) {
+ // ignore
+ }
+
+ this.processDefinition = null;
+ }
+ }
+
+ /*
+ * Thread for Token#signal
+ */
+ private class TokenThread extends Thread {
+ ProcessInstance processInstance = null;
+
+ public TokenThread(ProcessInstance processInstance) {
+ this.processInstance = processInstance;
+ }
+
+ public void run() {
+ Token token = processInstance.getRootToken();
+ try {
+ token.signal();
+ token.signal();
+ } catch (RuntimeException e) {
+ exceptionList.add(e);
+ }
+ this.processInstance = null;
+ }
+ }
+
+ /*
+ * Thread for ContextThread#setVariable
+ */
+ private class ContextThread extends Thread {
+ ProcessInstance processInstance = null;
+
+ public ContextThread(ProcessInstance processInstance ) {
+ this.processInstance = processInstance;
+ }
+
+ public void run() {
+
+ ContextInstance contextInstance = processInstance.getContextInstance();
+ try {
+ contextInstance.setVariable("RESULT", "OK");
+ } catch (RuntimeException e) {
+ exceptionList.add(e);
+ }
+ this.processInstance = null;
+
+ }
+ }
+}
Property changes on: jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm3416/JBPM3416Test.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
12 years, 2 months
JBoss JBPM SVN: r7059 - in jbpm3/branches/jbpm-3.2-soa/core/src: main/java/org/jbpm/job/executor and 7 other directories.
by do-not-reply@jboss.org
Author: marco.rietveld
Date: 2012-02-21 21:13:14 -0500 (Tue, 21 Feb 2012)
New Revision: 7059
Added:
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/Jbpm3430/
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/Jbpm3430/JBPM3430Test.java
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/job/executor/DispatcherAndJobExecutorMethodTest.java
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3430/
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3430/hibernate.postgresql.properties
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3430/jbpm-3430.cfg.xml
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/spy.properties
Modified:
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/db/JobSession.java
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/DispatcherThread.java
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/JobExecutor.java
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/JobExecutorThread.java
jbpm3/branches/jbpm-3.2-soa/core/src/main/resources/org/jbpm/db/hibernate.queries.hbm.xml
Log:
JBPM-3430: rewrite queries for calculating due date, clean up Job executor/dispatcher code.
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/db/JobSession.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/db/JobSession.java 2012-02-22 02:06:32 UTC (rev 7058)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/db/JobSession.java 2012-02-22 02:13:14 UTC (rev 7059)
@@ -21,7 +21,7 @@
*/
package org.jbpm.db;
-import java.util.Collection;
+import java.sql.Timestamp;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
@@ -30,15 +30,27 @@
import org.hibernate.LockMode;
import org.hibernate.Query;
import org.hibernate.Session;
-import org.hibernate.criterion.Restrictions;
-
+import org.jbpm.command.ExecuteJobsCommand;
import org.jbpm.graph.def.Action;
import org.jbpm.graph.exe.ProcessInstance;
import org.jbpm.graph.exe.Token;
import org.jbpm.job.Job;
import org.jbpm.job.Timer;
+import org.jbpm.job.executor.JobExecutor;
import org.jbpm.persistence.JbpmPersistenceException;
+/**
+ * This is the utility class that deals with Job persistence.
+ * It has a bunch of methods that have been grouped according to who uses the methods:
+ * <ul>
+ * <li>General use</li>
+ * <li>DispatcherThread, {@link JobExecutor}, etc.</li>
+ * <li>Service</li>
+ * <li>{@link Token}</li>
+ * <li>{@link ProcessInstance}</li>
+ * <li>Various commands, including the {@link ExecuteJobsCommand}</li>
+ * </ul>
+ */
public class JobSession {
private final Session session;
@@ -47,71 +59,7 @@
this.session = session;
}
- public Job getFirstAcquirableJob(String lockOwner) {
- try {
- Query query;
- if (lockOwner == null) {
- query = session.getNamedQuery("JobSession.getFirstUnownedAcquirableJob");
- }
- else {
- query = session.getNamedQuery("JobSession.getFirstAcquirableJob")
- .setString("lockOwner", lockOwner);
- }
- return (Job) query.setTimestamp("now", new Date()).setMaxResults(1).uniqueResult();
- }
- catch (HibernateException e) {
- throw new JbpmPersistenceException("could not get first acquirable job", e);
- }
- }
-
- public List findExclusiveJobs(String lockOwner, ProcessInstance processInstance) {
- try {
- return session.getNamedQuery("JobSession.findExclusiveJobs")
- .setString("lockOwner", lockOwner)
- .setTimestamp("now", new Date())
- .setParameter("processInstance", processInstance)
- .list();
- }
- catch (HibernateException e) {
- throw new JbpmPersistenceException("could not find exclusive jobs owned by '" + lockOwner
- + "' for " + processInstance, e);
- }
- }
-
- public List findJobsByToken(Token token) {
- try {
- return session.getNamedQuery("JobSession.findJobsByToken")
- .setParameter("token", token)
- .list();
- }
- catch (HibernateException e) {
- throw new JbpmPersistenceException("could not find jobs for " + token, e);
- }
- }
-
- public Job getFirstDueJob(String lockOwner, Collection monitoredJobs) {
- try {
- Query query;
- if (lockOwner == null) {
- query = session.getNamedQuery("JobSession.getFirstUnownedDueJob");
- }
- else if (monitoredJobs == null || monitoredJobs.isEmpty()) {
- query = session.getNamedQuery("JobSession.getFirstDueJob")
- .setString("lockOwner", lockOwner);
- }
- else {
- query = session.getNamedQuery("JobSession.getFirstDueJobExcludingMonitoredJobs")
- .setString("lockOwner", lockOwner)
- .setParameterList("monitoredJobIds", monitoredJobs);
- }
- return (Job) query.setMaxResults(1).uniqueResult();
- }
- catch (HibernateException e) {
- throw new JbpmPersistenceException("could not get first due job owned by '" + lockOwner
- + "' ignoring jobs " + monitoredJobs, e);
- }
- }
-
+ // Services
public void saveJob(Job job) {
try {
session.save(job);
@@ -119,7 +67,8 @@
Timer timer = (Timer) job;
Action action = timer.getAction();
// if action is transient, save it
- if (action != null && action.getId() == 0L) session.save(action);
+ if (action != null && action.getId() == 0L)
+ session.save(action);
}
}
catch (HibernateException e) {
@@ -127,6 +76,7 @@
}
}
+ // EVERYTHING
public void deleteJob(Job job) {
try {
session.delete(job);
@@ -136,21 +86,13 @@
}
}
- public Job loadJob(long jobId) {
- try {
- return (Job) session.load(Job.class, new Long(jobId));
- }
- catch (HibernateException e) {
- throw new JbpmPersistenceException("could not load job " + jobId, e);
- }
- }
-
/**
* Reattach job originally loaded in a previous session.
*
* @param job a detached job
* @see <a href="http://tinyurl.com/kjss69">Detached objects and automatic versioning</a>
*/
+ // JobExecutor, ExecuteJobsCommand
public void reattachJob(Job job) {
try {
session.lock(job, LockMode.NONE);
@@ -160,24 +102,72 @@
}
}
- public Timer loadTimer(long timerId) {
+ // Services
+ public void deleteTimersByName(String name, Token token) {
try {
- return (Timer) session.load(Timer.class, new Long(timerId));
+ // delete unowned timers
+ session.getNamedQuery("JobSession.deleteTimersByName")
+ .setString("name", name)
+ .setParameter("token", token)
+ .executeUpdate();
+
+ // prevent further repetitions
+ List timers = session.getNamedQuery("JobSession.findRepeatingTimersByName")
+ .setString("name", name)
+ .setParameter("token", token)
+ .list();
+ preventFurtherRepetitions(timers);
}
catch (HibernateException e) {
- throw new JbpmPersistenceException("could not load timer " + timerId, e);
+ throw new JbpmPersistenceException("could not delete timers by name '" + name + "' for "
+ + token, e);
}
}
- public Job getJob(long jobId) {
+ // Job Executor
+ public Job getFirstAcquirableJob(String lockOwner) {
try {
- return (Job) session.get(Job.class, new Long(jobId));
+ Query query;
+ if (lockOwner == null) {
+ query = session.getNamedQuery("JobSession.getFirstUnownedAcquirableJob");
+ }
+ else {
+ query = session.getNamedQuery("JobSession.getFirstAcquirableJob")
+ .setString("lockOwner", lockOwner);
+ }
+ return (Job) query.setTimestamp("now", new Date()).setMaxResults(1).uniqueResult();
}
catch (HibernateException e) {
- throw new JbpmPersistenceException("could not get job " + jobId, e);
+ throw new JbpmPersistenceException("could not get first acquirable job", e);
}
}
+
+ // Job Executor
+ public Date getNextUnownedDueJobDueDate(Date wakeUpDate) {
+ try {
+ Query query = session.getNamedQuery("JobSession.getNextUnownedDueJobDueDate")
+ .setTimestamp("wakeUpDate", wakeUpDate);
+ return (Timestamp) query.uniqueResult();
+ }
+ catch (HibernateException e) {
+ throw new JbpmPersistenceException("could not get next job due.");
+ }
+ }
+ // used by the LockMonitorThread
+ public List findJobsWithOverdueLockTime(Date threshold) {
+ try {
+ return session.getNamedQuery("JobSession.findJobsWithOverdueLockTime")
+ .setTimestamp("threshold", threshold)
+ .list();
+ }
+ catch (HibernateException e) {
+ throw new JbpmPersistenceException("could not find jobs with lock time over " + threshold,
+ e);
+ }
+ }
+
+ // Token
public void suspendJobs(Token token) {
try {
session.getNamedQuery("JobSession.suspendJobs")
@@ -189,6 +179,7 @@
}
}
+ // Token
public void resumeJobs(Token token) {
try {
session.getNamedQuery("JobSession.resumeJobs")
@@ -200,27 +191,7 @@
}
}
- public void deleteTimersByName(String name, Token token) {
- try {
- // delete unowned timers
- session.getNamedQuery("JobSession.deleteTimersByName")
- .setString("name", name)
- .setParameter("token", token)
- .executeUpdate();
-
- // prevent further repetitions
- List timers = session.getNamedQuery("JobSession.findRepeatingTimersByName")
- .setString("name", name)
- .setParameter("token", token)
- .list();
- preventFurtherRepetitions(timers);
- }
- catch (HibernateException e) {
- throw new JbpmPersistenceException("could not delete timers by name '" + name + "' for "
- + token, e);
- }
- }
-
+ // ProcessInstance
public int countDeletableJobsForProcessInstance(ProcessInstance processInstance) {
Number jobCount = (Number) session.getNamedQuery("JobSession.countDeletableJobsForProcessInstance")
.setParameter("processInstance", processInstance)
@@ -228,6 +199,7 @@
return jobCount.intValue();
}
+ // ProcessInstance
public void deleteJobsForProcessInstance(ProcessInstance processInstance) {
try {
// delete unowned node-execute-jobs and timers
@@ -255,24 +227,51 @@
}
}
- public List findJobsWithOverdueLockTime(Date threshold) {
+ // Change Process Instance Command
+ public List findJobsByToken(Token token) {
try {
- return session.getNamedQuery("JobSession.findJobsWithOverdueLockTime")
- .setTimestamp("threshold", threshold)
+ return session.getNamedQuery("JobSession.findJobsByToken")
+ .setParameter("token", token)
.list();
}
catch (HibernateException e) {
- throw new JbpmPersistenceException("could not find jobs with lock time over " + threshold,
- e);
+ throw new JbpmPersistenceException("could not find jobs for " + token, e);
}
}
- public List loadJobs(long[] jobIds) {
- int jobCount = jobIds.length;
- Long[] jobs = new Long[jobCount];
- for (int i = 0; i < jobCount; i++) {
- jobs[i] = new Long(jobIds[i]);
+ // ExecuteJobCommand
+ public Job getJob(long jobId) {
+ try {
+ return (Job) session.get(Job.class, new Long(jobId));
}
- return session.createCriteria(Job.class).add(Restrictions.in("id", jobs)).list();
+ catch (HibernateException e) {
+ throw new JbpmPersistenceException("could not get job " + jobId, e);
+ }
}
+
+ // ExecuteJobCommand & tests
+ public Timer loadTimer(long timerId) {
+ try {
+ return (Timer) session.load(Timer.class, new Long(timerId));
+ }
+ catch (HibernateException e) {
+ throw new JbpmPersistenceException("could not load timer " + timerId, e);
+ }
+ }
+
+ // Execute Jobs Command
+ public List findExclusiveJobs(String lockOwner, ProcessInstance processInstance) {
+ try {
+ return session.getNamedQuery("JobSession.findExclusiveJobs")
+ .setString("lockOwner", lockOwner)
+ .setTimestamp("now", new Date())
+ .setParameter("processInstance", processInstance)
+ .list();
+ }
+ catch (HibernateException e) {
+ throw new JbpmPersistenceException("could not find exclusive jobs owned by '" + lockOwner
+ + "' for " + processInstance, e);
+ }
+ }
+
}
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/DispatcherThread.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/DispatcherThread.java 2012-02-22 02:06:32 UTC (rev 7058)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/DispatcherThread.java 2012-02-22 02:13:14 UTC (rev 7059)
@@ -21,18 +21,17 @@
*/
package org.jbpm.job.executor;
+import java.util.Calendar;
import java.util.Date;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-
import org.jbpm.JbpmContext;
import org.jbpm.job.Job;
/**
* Acquires jobs and then dispatches them to the job executor thread pool.
*
- * @author Alejandro Guizar
*/
class DispatcherThread extends Thread implements Deactivable {
@@ -66,12 +65,15 @@
// if still active, wait or sleep
if (active) {
try {
+ int currentIdleInterval = jobExecutor.getIdleInterval();
// wait for next due job
- long waitPeriod = getWaitPeriod(jobExecutor.getIdleInterval());
+ Date nextDueDate = getNextDueDateWithinIdleInterval(currentIdleInterval);
+ long waitPeriod = getWaitPeriod(currentIdleInterval, nextDueDate);
if (waitPeriod > 0) {
synchronized (jobExecutor) {
- if (active)
+ if (active) {
jobExecutor.wait(waitPeriod);
+ }
}
}
}
@@ -79,7 +81,9 @@
if (log.isDebugEnabled()) log.debug(getName() + " got interrupted");
}
}
- }
+
+ } // while(active)
+
log.info(getName() + " leaves cyberspace");
}
@@ -165,28 +169,35 @@
}
}
- private long getWaitPeriod(int currentIdleInterval) {
- Date nextDueDate = getNextDueDate();
+ static long getWaitPeriod(int currentIdleInterval, Date nextDueDate) {
+ // Have we found a job that should be called before now + current idle interval?
if (nextDueDate != null) {
long waitPeriod = nextDueDate.getTime() - System.currentTimeMillis();
- if (waitPeriod < currentIdleInterval) return waitPeriod;
+
+ // next due date > now
+ if (waitPeriod < currentIdleInterval) {
+ return waitPeriod;
+ }
}
return currentIdleInterval;
}
- private Date getNextDueDate() {
+ private Date getNextDueDateWithinIdleInterval(int currentIdleInterval) {
Date nextDueDate = null;
JbpmContext jbpmContext = jobExecutor.getJbpmConfiguration().createJbpmContext();
try {
- Job job = jbpmContext.getJobSession().getFirstDueJob(null, null);
- if (job != null) {
- nextDueDate = job.getDueDate();
+ Calendar cal = Calendar.getInstance();
+ cal.add(Calendar.MILLISECOND, currentIdleInterval);
+ Date wakeUpDate = cal.getTime();
+
+ nextDueDate = jbpmContext.getJobSession().getNextUnownedDueJobDueDate(wakeUpDate);
+ if (log.isDebugEnabled() && nextDueDate == null) {
+ log.debug("no next waiting due job found before wake up date: possible future jobs after sleep");
}
- else if (log.isDebugEnabled()) log.debug("no due job found");
}
catch (RuntimeException e) {
jbpmContext.setRollbackOnly();
- if (log.isDebugEnabled()) log.debug("failed to determine next due date", e);
+ if (log.isDebugEnabled()) log.debug("failed to retrieve next waiting due job", e);
}
catch (Error e) {
jbpmContext.setRollbackOnly();
@@ -198,7 +209,7 @@
}
catch (RuntimeException e) {
nextDueDate = null;
- if (log.isDebugEnabled()) log.debug("failed to determine next due date", e);
+ if (log.isDebugEnabled()) log.debug("failed to retrieve next waiting due job", e);
}
}
return nextDueDate;
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/JobExecutor.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/JobExecutor.java 2012-02-22 02:06:32 UTC (rev 7058)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/JobExecutor.java 2012-02-22 02:13:14 UTC (rev 7059)
@@ -4,7 +4,6 @@
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
@@ -17,7 +16,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-
import org.jbpm.JbpmConfiguration;
import org.jbpm.job.Job;
@@ -35,13 +33,9 @@
protected int idleInterval;
protected int maxIdleInterval;
private int retryInterval;
- /** @deprecated property has no effect */
- protected int historyMaxSize;
protected int maxLockTime;
protected int lockMonitorInterval;
- /** @deprecated property has no effect */
- protected int lockBufferTime;
private ThreadGroup threadGroup;
private int waitingExecutorCount ;
@@ -52,17 +46,15 @@
private Condition waitingDispatcherCondition = waitingExecutorLock.newCondition() ;
private LinkedList dispatchedJobs = new LinkedList();
- /** @deprecated call {@link #getThreads()} instead */
- protected Map threads;
- /** @deprecated call {@link #getThreads()} instead */
- protected LockMonitorThread lockMonitorThread;
-
protected Map monitoredJobIds = new Hashtable();
protected boolean isStarted;
- /** @deprecated this field was just an aid for generating thread names */
- protected static String hostName;
-
+ /**
+ * Starts all the threads needed.
+ *
+ * This method has been split into smaller methods
+ * in order to make the logic testable.
+ */
public synchronized void start() {
if (!isStarted) {
log.info("starting " + name);
@@ -99,7 +91,7 @@
log.debug("ignoring start: " + name + " already started");
}
}
-
+
/**
* tells all threads in this job executor to stop. Threads may be in the middle of processing
* a job and they will finish that first. Use {@link #stopAndJoin()} in case you want a method
@@ -177,11 +169,6 @@
return name + '@' + getHostAddress() + ":Executor-" + index;
}
- /** @deprecated no longer invoked */
- protected void startThread() {
- startThread(getNextThreadName());
- }
-
protected void startThread(String threadName) {
Thread thread = createThread(threadName);
@@ -193,35 +180,6 @@
return new JobExecutorThread(threadName, this);
}
- /** @deprecated no longer invoked */
- protected String getNextThreadName() {
- return getThreadName(threadGroup.activeCount() + 1);
- }
-
- /** @deprecated no longer invoked */
- protected String getLastThreadName() {
- Map threads = getThreads();
- for (int i = nbrOfThreads; i > 0; i--) {
- String threadName = getThreadName(i);
- if (threads.containsKey(threadName)) return threadName;
- }
- return null;
- }
-
- /** @deprecated no longer invoked */
- protected synchronized Thread stopThread() {
- Map threads = getThreads();
- for (int i = nbrOfThreads; i > 0; i--) {
- String threadName = getThreadName(i);
- JobExecutorThread executorThread = (JobExecutorThread) threads.get(threadName);
- if (executorThread != null) {
- executorThread.deactivate();
- return executorThread;
- }
- }
- return null;
- }
-
private String getDispatcherThreadName() {
return name + '@' + getHostAddress() + ':' + DispatcherThread.DEFAULT_NAME;
}
@@ -267,25 +225,6 @@
monitoredJobIds.remove(threadName);
}
- /**
- * Method has no effect.
- *
- * @deprecated call {@link #addMonitoredJobId(String, long)} or
- * {@link #removeMonitoredJobId(String)} to manipulate the set of monitored jobs
- */
- public void setMonitoredJobIds(Map monitoredJobIds) {
- }
-
- /** @deprecated property has no effect */
- public int getHistoryMaxSize() {
- return historyMaxSize;
- }
-
- /** @deprecated property has no effect */
- public void setHistoryMaxSize(int historyMaxSize) {
- this.historyMaxSize = historyMaxSize;
- }
-
public int getIdleInterval() {
return idleInterval;
}
@@ -304,14 +243,6 @@
return isStarted;
}
- /**
- * This method has no effect.
- *
- * @deprecated call {@link #start()} or {@link #stop()} to control this job executor.
- */
- public void setStarted(boolean isStarted) {
- }
-
public JbpmConfiguration getJbpmConfiguration() {
return jbpmConfiguration;
}
@@ -350,20 +281,6 @@
this.name = name;
}
- /**
- * @deprecated replaced by {@link #getNbrOfThreads()}
- */
- public int getSize() {
- return nbrOfThreads;
- }
-
- /**
- * @deprecated replaced by {@link #setNbrOfThreads(int)}
- */
- public void setSize(int nbrOfThreads) {
- this.nbrOfThreads = nbrOfThreads;
- }
-
public Map getThreads() {
// fetch active threads
Thread[] activeThreads = new Thread[nbrOfThreads + 2];
@@ -378,14 +295,6 @@
return threadMap;
}
- /**
- * This method has no effect.
- *
- * @deprecated this job executor manages its own thread pool
- */
- public void setThreads(Map threads) {
- }
-
public int getMaxLockTime() {
return maxLockTime;
}
@@ -397,16 +306,6 @@
this.maxLockTime = maxLockTime;
}
- /** @deprecated property has no effect */
- public int getLockBufferTime() {
- return lockBufferTime;
- }
-
- /** @deprecated property has no effect */
- public void setLockBufferTime(int lockBufferTime) {
- this.lockBufferTime = lockBufferTime;
- }
-
public int getLockMonitorInterval() {
return lockMonitorInterval;
}
@@ -431,12 +330,13 @@
private boolean hasFreeExecutor() {
waitingExecutorLock.lock() ;
- try {
+ try {
return (waitingExecutorCount > dispatchedJobs.size()) ;
} finally {
waitingExecutorLock.unlock() ;
}
}
+
// return false when interrupted
boolean waitForFreeExecutorThread() {
waitingExecutorLock.lock() ;
@@ -483,9 +383,9 @@
}
boolean submitJob(final Job job) {
- waitingExecutorLock.lock() ;
- try {
- if (hasFreeExecutor()) {
+ waitingExecutorLock.lock() ;
+ try {
+ if (hasFreeExecutor()) {
dispatchedJobs.add(job) ;
waitingExecutorCondition.signal() ;
return true ;
@@ -514,4 +414,5 @@
}
private static Log log = LogFactory.getLog(JobExecutor.class);
+
}
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/JobExecutorThread.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/JobExecutorThread.java 2012-02-22 02:06:32 UTC (rev 7058)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/JobExecutorThread.java 2012-02-22 02:13:14 UTC (rev 7059)
@@ -2,17 +2,11 @@
import java.io.PrintWriter;
import java.io.StringWriter;
-import java.util.Collection;
-import java.util.Collections;
import java.util.Date;
-import java.util.Iterator;
-import java.util.List;
import java.util.Random;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-
-import org.jbpm.JbpmConfiguration;
import org.jbpm.JbpmContext;
import org.jbpm.db.JobSession;
import org.jbpm.graph.exe.ProcessInstance;
@@ -31,16 +25,6 @@
this.jobExecutor = jobExecutor;
}
- /**
- * @deprecated use {@link #JobExecutorThread(String, JobExecutor)} instead
- */
- public JobExecutorThread(String name, JobExecutor jobExecutor,
- JbpmConfiguration jbpmConfiguration, int idleInterval, int maxIdleInterval,
- long maxLockTime, int maxHistory) {
- super(jobExecutor.getThreadGroup(), name);
- this.jobExecutor = jobExecutor;
- }
-
public void run() {
while (active) {
// take on next job
@@ -66,68 +50,6 @@
log.info(getName() + " leaves cyberspace");
}
- /** @deprecated responsibility moved to DispatcherThread **/
- protected Collection acquireJobs() {
- Collection jobs = Collections.EMPTY_LIST;
- boolean debug = log.isDebugEnabled();
- JbpmContext jbpmContext = jobExecutor.getJbpmConfiguration().createJbpmContext();
- try {
- // search for available job
- String lockOwner = getName();
- JobSession jobSession = jbpmContext.getJobSession();
- Job firstJob = jobSession.getFirstAcquirableJob(lockOwner);
- // is there a job?
- if (firstJob != null) {
- // is job exclusive?
- if (firstJob.isExclusive()) {
- // find other exclusive jobs
- ProcessInstance processInstance = firstJob.getProcessInstance();
- List exclusiveJobs = jobSession.findExclusiveJobs(lockOwner, processInstance);
-
- if (debug) log.debug("acquiring " + exclusiveJobs + " for " + processInstance);
- Date lockTime = new Date();
- for (Iterator i = exclusiveJobs.iterator(); i.hasNext();) {
- Job exclusiveJob = (Job) i.next();
- exclusiveJob.setLockOwner(lockOwner);
- exclusiveJob.setLockTime(lockTime);
- }
-
- // deliver result
- if (debug) log.debug("acquired " + exclusiveJobs);
- jobs = exclusiveJobs;
- }
- else {
- if (debug) log.debug("acquiring " + firstJob);
- firstJob.setLockOwner(lockOwner);
- firstJob.setLockTime(new Date());
-
- // deliver result
- if (debug) log.debug("acquired " + firstJob);
- jobs = Collections.singletonList(firstJob);
- }
- }
- else if (debug) log.debug("no acquirable job found");
- }
- catch (RuntimeException e) {
- jbpmContext.setRollbackOnly();
- if (debug) log.debug("failed to acquire jobs", e);
- }
- catch (Error e) {
- jbpmContext.setRollbackOnly();
- throw e;
- }
- finally {
- try {
- jbpmContext.close();
- }
- catch (RuntimeException e) {
- jobs = Collections.EMPTY_LIST;
- if (debug) log.debug("failed to acquire jobs", e);
- }
- }
- return jobs;
- }
-
protected void executeJob(Job job) throws Exception {
JbpmContext jbpmContext = jobExecutor.getJbpmConfiguration().createJbpmContext();
try {
@@ -164,8 +86,7 @@
private void saveJobException(Job job, Exception exception) {
// if this is a locking exception, keep it quiet
if (DbPersistenceService.isLockingException(exception)) {
- StaleObjectLogConfigurer.getStaleObjectExceptionsLog()
- .error("failed to execute " + job, exception);
+ StaleObjectLogConfigurer.getStaleObjectExceptionsLog().error("failed to execute " + job, exception);
}
else {
log.error("failed to execute " + job, exception);
@@ -247,57 +168,6 @@
}
}
- /** @deprecated responsibility moved to DispatcherThread */
- protected long getWaitPeriod(int currentIdleInterval) {
- Date nextDueDate = getNextDueDate();
- if (nextDueDate != null) {
- long waitPeriod = nextDueDate.getTime() - System.currentTimeMillis();
- if (waitPeriod < currentIdleInterval) return waitPeriod;
- }
- return currentIdleInterval;
- }
-
- /** @deprecated responsibility moved to DispatcherThread */
- protected Date getNextDueDate() {
- Date nextDueDate = null;
- JbpmContext jbpmContext = jobExecutor.getJbpmConfiguration().createJbpmContext();
- try {
- String lockOwner = getName();
- Job job = jbpmContext.getJobSession()
- .getFirstDueJob(lockOwner, jobExecutor.getMonitoredJobIds());
- if (job != null) {
- jobExecutor.addMonitoredJobId(lockOwner, job.getId());
- nextDueDate = job.getDueDate();
- }
- else if (log.isDebugEnabled()) log.debug("no due job found");
- }
- catch (RuntimeException e) {
- jbpmContext.setRollbackOnly();
- if (log.isDebugEnabled()) log.debug("failed to determine next due date", e);
- }
- catch (Error e) {
- jbpmContext.setRollbackOnly();
- throw e;
- }
- finally {
- try {
- jbpmContext.close();
- }
- catch (RuntimeException e) {
- nextDueDate = null;
- if (log.isDebugEnabled()) log.debug("failed to determine next due date", e);
- }
- }
- return nextDueDate;
- }
-
- /**
- * @deprecated As of jBPM 3.2.3, replaced by {@link #deactivate()}
- */
- public void setActive(boolean isActive) {
- if (isActive == false) deactivate();
- }
-
public void deactivate() {
if (active) {
active = false;
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/resources/org/jbpm/db/hibernate.queries.hbm.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/resources/org/jbpm/db/hibernate.queries.hbm.xml 2012-02-22 02:06:32 UTC (rev 7058)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/resources/org/jbpm/db/hibernate.queries.hbm.xml 2012-02-22 02:13:14 UTC (rev 7059)
@@ -250,6 +250,7 @@
<!-- JobSession -->
<!-- ########################### -->
+ <!-- : DISPATCHER THREAD -->
<query name="JobSession.getFirstAcquirableJob">
<![CDATA[
select job
@@ -274,54 +275,34 @@
]]>
</query>
- <query name="JobSession.findExclusiveJobs">
+ <!-- Used to calculate the next time that a job should run
+ there are possibly multiple jobs with the same due date -->
+ <query name="JobSession.getNextUnownedDueJobDueDate">
<![CDATA[
- select job
+ select min(job.dueDate)
from org.jbpm.job.Job job
- where (job.lockOwner is null or job.lockOwner = :lockOwner)
+ where job.dueDate <= :wakeUpDate
+ and job.lockOwner is null
and job.retries > 0
- and job.dueDate <= :now
- and job.processInstance = :processInstance
- and job.isExclusive = true
and job.isSuspended = false
- order by job.dueDate asc
]]>
</query>
- <query name="JobSession.getFirstDueJob">
+ <!-- : EXECUTE JOBS COMMAND -->
+ <query name="JobSession.findExclusiveJobs">
<![CDATA[
select job
from org.jbpm.job.Job job
where (job.lockOwner is null or job.lockOwner = :lockOwner)
and job.retries > 0
+ and job.dueDate <= :now
+ and job.processInstance = :processInstance
+ and job.isExclusive = true
and job.isSuspended = false
order by job.dueDate asc
]]>
</query>
- <query name="JobSession.getFirstDueJobExcludingMonitoredJobs">
- <![CDATA[
- select job
- from org.jbpm.job.Job job
- where (job.lockOwner is null or job.lockOwner = :lockOwner)
- and job.id not in (:monitoredJobIds)
- and job.retries > 0
- and job.isSuspended = false
- order by job.dueDate asc
- ]]>
- </query>
-
- <query name="JobSession.getFirstUnownedDueJob">
- <![CDATA[
- select job
- from org.jbpm.job.Job job
- where job.lockOwner is null
- and job.retries > 0
- and job.isSuspended = false
- order by job.dueDate asc
- ]]>
- </query>
-
<query name="JobSession.suspendJobs">
<![CDATA[
update org.jbpm.job.Job job
Added: jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/Jbpm3430/JBPM3430Test.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/Jbpm3430/JBPM3430Test.java (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/Jbpm3430/JBPM3430Test.java 2012-02-22 02:13:14 UTC (rev 7059)
@@ -0,0 +1,305 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2011, 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.Jbpm3430;
+
+import java.lang.reflect.Field;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.hibernate.cfg.Configuration;
+import org.jbpm.JbpmConfiguration;
+import org.jbpm.db.AbstractDbTestCase;
+import org.jbpm.db.JbpmSchema;
+import org.jbpm.db.hibernate.HibernateHelper;
+import org.jbpm.graph.def.ActionHandler;
+import org.jbpm.graph.def.Event;
+import org.jbpm.graph.def.EventCallback;
+import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.graph.exe.ExecutionContext;
+import org.jbpm.graph.exe.ProcessInstance;
+import org.jbpm.job.Timer;
+import org.jbpm.jpdl.JpdlException;
+import org.jbpm.jpdl.xml.Problem;
+import org.jbpm.persistence.db.DbPersistenceServiceFactory;
+import org.jbpm.scheduler.db.DbSchedulerService;
+import org.jbpm.svc.Services;
+
+/**
+ * JobSession.getFirstDueJob was not performing due to the queries having to sort the duedate
+ * field without an index.
+ *
+ * Which led me to look at the queries, and to discover that the queries were not at all matched
+ * with what they were being used for.
+ *
+ * The queries where written to retrieve the first due job (and possibly the first due job w/
+ * lock owner, or etc.). They were being used to retrieve the next due date.
+ *
+ * So I rewrote the queries.
+ *
+ * (Needs the postgresql jdbc driver jar to be attached to the build path
+ * to work, as well as a local postgresql db, of course.)
+ */
+public class JBPM3430Test extends AbstractDbTestCase {
+
+ private static final String PROCESS_NAME = "jbpm3430";
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ setUpAndEnsureCleanDatabase();
+ setupTimerDueDates();
+
+ ProcessDefinition processDefinition = null;
+ try {
+ processDefinition = ProcessDefinition.parseXmlString(getProcessDefinitionString());
+ } catch( JpdlException je ) {
+ Iterator iter = je.getProblems().iterator();
+ while( iter.hasNext() ) {
+ Problem prob = (Problem) iter.next();
+ log.error( prob.getDescription() );
+ }
+ fail( je.getMessage() );
+ }
+
+ deployProcessDefinition(processDefinition);
+ }
+
+ /**
+ * What do we want?
+ *
+ * 1. The job executor and dispatcher threads start.
+ * - no jobs available,
+ */
+ private void setupTimerDueDates() {
+ jobExecutor = getJbpmConfiguration().getJobExecutor();
+ dispatcherIdleInterval = jobExecutor.getIdleInterval();
+ assertTrue( "Idle interval is too small: " + dispatcherIdleInterval, dispatcherIdleInterval > 2500 );
+
+ withinIdleSeconds = (int) (3 * ((double) dispatcherIdleInterval)/(4 * 1000) + ((double) dispatcherIdleInterval/1000));
+ afterIdleSeconds = (int) (3 * ((double) dispatcherIdleInterval)/1000 + 1);
+ assertTrue( "Within idle timer duration not larger than 0", withinIdleSeconds > 0 );
+ assertTrue( "Within idle timer duration equal to idle interval. [" + withinIdleSeconds + " >= " + dispatcherIdleInterval/1000 + "]", (withinIdleSeconds % (dispatcherIdleInterval/1000)-1) > 0 );
+ }
+
+ private String postgresDatabaseProperties = "org/jbpm/jbpm3235/hibernate.postgresql.properties";
+
+ private void setUpAndEnsureCleanDatabase() {
+ String propertiesResource = postgresDatabaseProperties;
+
+ /**
+ * Postgresql/other database setup
+ */
+ // Ensure that the hibernate session uses the properties we configured (see propertiesResource above)
+ Configuration configuration = HibernateHelper.createConfiguration(null, propertiesResource);
+
+ DbPersistenceServiceFactory persistenceServiceFactory = (DbPersistenceServiceFactory) getJbpmConfiguration().getServiceFactory(Services.SERVICENAME_PERSISTENCE);
+ if (persistenceServiceFactory == null) fail("Expected to be able to configure persistence, but no peristence service factory can be found.");
+ persistenceServiceFactory.setConfiguration(configuration);
+
+ /**
+ * Clean up jbpm schema in database
+ */
+ boolean hasLeftOvers = false;
+ JbpmSchema jbpmSchema = new JbpmSchema(configuration);
+
+ for (Iterator i = jbpmSchema.getRowsPerTable().entrySet().iterator(); i.hasNext();) {
+ Map.Entry entry = (Map.Entry) i.next();
+ Long count = (Long) entry.getValue();
+ if (count.intValue() != 0) {
+ hasLeftOvers = true;
+ log.debug(getName() + " left " + count + " records in " + entry.getKey());
+ }
+ }
+
+ if (hasLeftOvers) {
+ jbpmSchema.cleanSchema();
+ }
+ }
+
+// protected void startJobExecutor() {
+// jobExecutor.start();
+// }
+
+ protected void tearDown() throws Exception {
+ stopJobExecutor();
+ EventCallback.clear();
+
+ log.info("### END " + getName() + " ####################");
+ }
+
+ protected JbpmConfiguration getJbpmConfiguration() {
+ if (jbpmConfiguration == null) {
+ // use postgresql properties
+ jbpmConfiguration = JbpmConfiguration.getInstance("org/jbpm/jbpm3430/jbpm-3430.cfg.xml");
+ }
+ return jbpmConfiguration;
+ }
+
+ // ACTUAL TEST
+
+
+ private static HashMap timerActionDates = new HashMap();
+
+ private static long dispatcherIdleInterval;
+ private static int withinIdleSeconds;
+ private static int afterIdleSeconds;
+ private static final String overdueTimerDate = "overDueDate";
+
+ private static final String overdueTimer = "overdue-timer";
+ private static final String withinIdleTimer = "pre-idle-timer";
+ private static final String afterIdleTimer = "after-idle-timer";
+
+ // DBG
+ private static final SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss,SSS");
+
+ boolean doNotRunUnlessManually = true;
+
+ public void testTimerScheduling() throws Exception {
+ if( doNotRunUnlessManually ) {
+ return;
+ }
+
+ // multiple job executors not supported on hsql
+ if (getHibernateDialect().indexOf("HSQL") != -1) {
+ return;
+ }
+
+ ProcessInstance processInstance = jbpmContext.newProcessInstanceForUpdate(PROCESS_NAME);
+ processInstance.getContextInstance().setVariable("eventCallback", new EventCallback());
+
+ Calendar overDueDateCal = Calendar.getInstance();
+ overDueDateCal.clear(Calendar.MILLISECOND);
+ overDueDateCal.add(Calendar.HOUR, -1);
+ processInstance.getContextInstance().setVariable(overdueTimerDate, overDueDateCal.getTime());
+
+ // start dispatcher, job executor and lock monitor threads
+ startJobExecutor();
+
+ // kick off process instance
+ processInstance.signal();
+
+ // Make sure that the jobExecutor is not notified
+ DbSchedulerService schedulerService = (DbSchedulerService) jbpmContext.getServices().getSchedulerService();
+ Field hasProducedTimersField = DbSchedulerService.class.getDeclaredField("hasProducedTimers");
+ hasProducedTimersField.setAccessible(true);
+ hasProducedTimersField.setBoolean(schedulerService, false);
+
+ closeJbpmContext();
+ try {
+ EventCallback.waitForEvent(Event.EVENTTYPE_PROCESS_END);
+ }
+ finally {
+ createJbpmContext();
+ }
+
+ assertTrue(timerActionDates.size() == 4);
+
+ long startTime = ((Long) timerActionDates.get("start")).longValue();
+ { long overdueTime = ((Long) timerActionDates.get(overdueTimer)).longValue();
+ assertTrue( "Overdue job ran " + ((double) overdueTime-startTime)/1000 + " secs after process started [ < " + ((double) dispatcherIdleInterval)/1000 + "]", startTime+dispatcherIdleInterval + 500 > overdueTime );
+ }
+
+ { long withinIdleTime = ((Long) timerActionDates.get(withinIdleTimer)).longValue();
+ assertTrue( "Pre idle job did not run " + withinIdleSeconds + " seconds after start [" + ((double) startTime-withinIdleTime)/1000 + "]", isWithin1SecondOf(startTime + withinIdleSeconds*1000, withinIdleTime) );
+ }
+
+ { long afterIdleTime = ((Long) timerActionDates.get(afterIdleTimer)).longValue();
+ assertTrue( "After idle job did not run " + afterIdleSeconds + " seconds after start [" + ((double) startTime-afterIdleTime)/1000 + "]", isWithin1SecondOf(startTime + afterIdleSeconds*1000, afterIdleTime) );
+ }
+ }
+
+ // ACTUAL TESTS
+ //
+
+ boolean isWithin1SecondOf(long compare, long expected) {
+ boolean withinOneSecond = false;
+
+ double thisSeconds = ((double) compare)/1000;
+ double thatSeconds = ((double) expected)/1000;
+
+ if( thatSeconds - 0.5d <= thisSeconds && thisSeconds <= thatSeconds + 0.5 ) {
+ withinOneSecond = true;
+ }
+
+ return withinOneSecond;
+ }
+
+
+ public static class TimerAction implements ActionHandler {
+
+ private static final long serialVersionUID = -1723705242334355414L;
+
+ public void execute(ExecutionContext executionContext) throws Exception {
+ Timer timer = executionContext.getTimer();
+ String timerName = timer.getName();
+
+ System.out.println("--> " + timerName + " [" + sdf.format(new Date()) + " <> " + sdf.format(timer.getDueDate()) + "]" );
+
+ timerActionDates.put(timerName, new Long(new Date().getTime()));
+ }
+ }
+
+
+ public static class StartAction implements ActionHandler {
+
+ private static final long serialVersionUID = -8083148121782750200L;
+
+ public void execute(ExecutionContext executionContext) throws Exception {
+ System.out.println("START: " + sdf.format(new Date()));
+ timerActionDates.put("start", new Long(new Date().getTime()));
+ }
+
+ }
+
+ private String getProcessDefinitionString() {
+ return
+ "<?xml version='1.0' encoding='UTF-8'?>" +
+ "<process-definition name='jbpm3430' xmlns='urn:jbpm.org:jpdl-3.2'>" +
+ " <event type='process-end'>" +
+ " <action expression='#{eventCallback.processEnd}' />" +
+ " </event>" +
+ "" +
+ " <start-state>" +
+ " <transition to='timers'>" +
+ " <action class='" + StartAction.class.getName() + "'/>" +
+ " </transition>" +
+ " </start-state>" +
+ "" +
+ " <state name='timers'>" +
+ " <event type='timer'>" +
+ " <action class='" + TimerAction.class.getName() + "'/>" +
+ " </event>" +
+ " <timer duedate='#{" + overdueTimerDate + "}' name='" + overdueTimer + "' />" +
+ " <timer duedate='" + withinIdleSeconds + " seconds' name='" + withinIdleTimer + "' />" +
+ " <timer duedate='" + afterIdleSeconds + " seconds' name='" + afterIdleTimer + "' transition='done' />" +
+ " <transition to='end' name='done' />" +
+ " </state>" +
+ "" +
+ " <end-state name='end' />" +
+ "</process-definition>";
+ }
+
+}
Property changes on: jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/Jbpm3430/JBPM3430Test.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
Added: jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/job/executor/DispatcherAndJobExecutorMethodTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/job/executor/DispatcherAndJobExecutorMethodTest.java (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/job/executor/DispatcherAndJobExecutorMethodTest.java 2012-02-22 02:13:14 UTC (rev 7059)
@@ -0,0 +1,55 @@
+package org.jbpm.job.executor;
+
+
+import java.util.Calendar;
+import java.util.Date;
+
+import junit.framework.TestCase;
+
+public class DispatcherAndJobExecutorMethodTest extends TestCase {
+
+ private DispatcherThread dispatcherThread = null;
+ private JobExecutor jobExecutor = null;
+ private JobExecutorThread jobExecutorThread = null;
+
+ public void setUp() {
+ jobExecutor = new JobExecutor();
+ dispatcherThread = new DispatcherThread("Test-Dispatcher", jobExecutor);
+ jobExecutorThread = new JobExecutorThread("Test-JobExecutorThread", jobExecutor);
+ }
+
+ public void tearDown() {
+ jobExecutor = null;
+ dispatcherThread = null;
+ jobExecutorThread = null;
+ }
+
+ public void testGetWaitPeriod() {
+ long currentIdleInterval = 20 * 1000;
+
+ Calendar cal = Calendar.getInstance();
+ cal.add(Calendar.SECOND, -10);
+ Date nextDueDate = cal.getTime();
+
+ long waitPeriod = DispatcherThread.getWaitPeriod((int) currentIdleInterval, nextDueDate);
+ assertTrue( "The due date has passed, we expect no wait period, not " + waitPeriod/1000, waitPeriod <= 0 );
+
+ cal = Calendar.getInstance();
+ cal.add(Calendar.SECOND, 30);
+ nextDueDate = cal.getTime();
+
+ waitPeriod = DispatcherThread.getWaitPeriod((int) currentIdleInterval, nextDueDate);
+ assertTrue( "The due date is past the idle interval, we expect a wait period of " + currentIdleInterval + " not " + waitPeriod,
+ waitPeriod == currentIdleInterval );
+
+ cal = Calendar.getInstance();
+ cal.add(Calendar.SECOND, 10);
+ nextDueDate = cal.getTime();
+
+ waitPeriod = DispatcherThread.getWaitPeriod((int) currentIdleInterval, nextDueDate);
+ assertTrue( "The due date is past the idle interval, we expect a wait period of approximately " + 10 * 1000 + " not " + waitPeriod,
+ 9 * 1000 <= waitPeriod && waitPeriod <= 11 * 1000 );
+ }
+
+}
+
Property changes on: jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/job/executor/DispatcherAndJobExecutorMethodTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
Added: jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3430/hibernate.postgresql.properties
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3430/hibernate.postgresql.properties (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3430/hibernate.postgresql.properties 2012-02-22 02:13:14 UTC (rev 7059)
@@ -0,0 +1,11 @@
+hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
+
+hibernate.connection.driver_class=org.postgresql.Driver
+# hibernate.connection.driver_class=com.p6spy.engine.spy.P6SpyDriver
+hibernate.connection.url=jdbc\:postgresql\://localhost\:5432/jbpm3
+hibernate.connection.username=jbpm3
+hibernate.connection.password=jbpm3
+
+hibernate.hbm2ddl.auto=update
+hibernate.show_sql=false
+
Property changes on: jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3430/hibernate.postgresql.properties
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
Added: jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3430/jbpm-3430.cfg.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3430/jbpm-3430.cfg.xml (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3430/jbpm-3430.cfg.xml 2012-02-22 02:13:14 UTC (rev 7059)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jbpm-configuration>
+ <string name="resource.hibernate.properties" value="org/jbpm/jbpm3430/hibernate.postgresql.properties" />
+
+ <bean name="jbpm.job.executor" class="org.jbpm.job.executor.JobExecutor">
+ <field name="jbpmConfiguration"><ref bean="jbpmConfiguration" /></field>
+ <field name="name"><string value="Jbpm3430JobExector" /></field>
+ <field name="nbrOfThreads"><int value="1" /></field>
+
+ <field name="idleInterval"><int value="3000" /></field> <!-- 3 secs -->
+ <field name="maxIdleInterval"><int value="3600000" /></field> <!-- 1 hour -->
+ <field name="retryInterval"><int value="10000" /></field>
+
+ <field name="maxLockTime"><int value="600000" /></field> <!-- 10 minutes -->
+ <field name="lockMonitorInterval"><int value="60000" /></field> <!-- 1 minute -->
+ </bean>
+
+</jbpm-configuration>
Property changes on: jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3430/jbpm-3430.cfg.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
Added: jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/spy.properties
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/spy.properties (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/spy.properties 2012-02-22 02:13:14 UTC (rev 7059)
@@ -0,0 +1,249 @@
+#################################################################
+# P6Spy 2.0-SNAPSHOT Options File #
+# See documentation for detailed instructions #
+# #
+# PLACE IN src/test/resources when using!!! #
+# #
+#################################################################
+
+#################################################################
+# MODULES #
+# #
+# Modules provide the P6Spy functionality. If a module, such #
+# as module_log is commented out, that functionality will not #
+# be available. If it is not commented out (if it is active), #
+# the functionality will be active. #
+# #
+# Values set in Modules cannot be reloaded using the #
+# reloadproperties variable. Once they are loaded, they remain #
+# in memory until the application is restarted. #
+# #
+#################################################################
+
+module.log=com.p6spy.engine.logging.P6LogFactory
+#module.outage=com.p6spy.engine.outage.P6OutageFactory
+
+#################################################################
+# REALDRIVER(s) #
+# #
+# In your application server configuration file you replace the #
+# "real driver" name with com.p6spy.engine.spy.P6SpyDriver. This#
+# is where you put the name of your real driver P6Spy can find #
+# and register your real driver to do the database work. #
+# #
+# If your application uses several drivers specify them in #
+# realdriver2, realdriver3. See the documentation for more #
+# details. #
+# #
+# Values set in REALDRIVER(s) cannot be reloaded using the #
+# reloadproperties variable. Once they are loaded, they remain #
+# in memory until the application is restarted. #
+# #
+#################################################################
+
+# oracle driver
+# realdriver=oracle.jdbc.driver.OracleDriver
+
+# mysql Connector/J driver
+# realdriver=com.mysql.jdbc.Driver
+
+# informix driver
+# realdriver=com.informix.jdbc.IfxDriver
+
+# ibm db2 driver
+# realdriver=COM.ibm.db2.jdbc.net.DB2Driver
+
+# the mysql open source driver
+realdriver=org.hsqldb.jdbcDriver
+#realdriver=org.postgresql.Driver
+
+#specifies another driver to use
+realdriver2=
+#specifies a third driver to use
+realdriver3=
+
+#the DriverManager class sequentially tries every driver that is
+#registered to find the right driver. In some instances, it's possible to
+#load up the realdriver before the p6spy driver, in which case your connections
+#will not get wrapped as the realdriver will "steal" the connection before
+#p6spy sees it. Set the following property to "true" to cause p6spy to
+#explicitily deregister the realdrivers
+deregisterdrivers=true
+
+################################################################
+# P6LOG SPECIFIC PROPERTIES #
+################################################################
+# no properties currently available
+
+################################################################
+# EXECUTION THRESHOLD PROPERTIES #
+################################################################
+# This feature applies to the standard logging of P6Spy. #
+# While the standard logging logs out every statement #
+# regardless of its execution time, this feature puts a time #
+# condition on that logging. Only statements that have taken #
+# longer than the time specified (in milliseconds) will be #
+# logged. This way it is possible to see only statements that #
+# have exceeded some high water mark. #
+# This time is reloadable. #
+#
+# executionthreshold=integer time (milliseconds)
+#
+executionthreshold=
+
+################################################################
+# P6OUTAGE SPECIFIC PROPERTIES #
+################################################################
+# Outage Detection
+#
+# This feature detects long-running statements that may be indicative of
+# a database outage problem. If this feature is turned on, it will log any
+# statement that surpasses the configurable time boundary during its execution.
+# When this feature is enabled, no other statements are logged except the long
+# running statements. The interval property is the boundary time set in seconds.
+# For example, if this is set to 2, then any statement requiring at least 2
+# seconds will be logged. Note that the same statement will continue to be logged
+# for as long as it executes. So if the interval is set to 2, and the query takes
+# 11 seconds, it will be logged 5 times (at the 2, 4, 6, 8, 10 second intervals).
+#
+# outagedetection=true|false
+# outagedetectioninterval=integer time (seconds)
+#
+outagedetection=false
+outagedetectioninterval=
+
+################################################################
+# COMMON PROPERTIES #
+################################################################
+
+# filter what is logged
+filter=true
+
+# comma separated list of tables to include when filtering
+include=JBPM_JOB
+# comma separated list of tables to exclude when filtering
+exclude=
+
+# sql expression to evaluate if using regex filtering
+sqlexpression =
+
+
+# turn on tracing
+autoflush = true
+
+# sets the date format using Java's SimpleDateFormat routine
+dateformat=HH:mm:ss,SSS
+
+#list of categories to explicitly include
+includecategories=
+
+#list of categories to exclude: error, info, batch, debug, statement, resultset
+#commit, rollback and result are valid values
+#excludecategories=info,debug,result,batch
+excludecategories=debug,resultset,result
+
+
+#allows you to use a regex engine or your own matching engine to determine
+#which statements to log
+#
+#stringmatcher=com.p6spy.engine.common.GnuRegexMatcher
+#stringmatcher=com.p6spy.engine.common.JakartaRegexMatcher
+stringmatcher=
+
+# prints a stack trace for every statement logged
+stacktrace=false
+# if stacktrace=true, specifies the stack trace to print
+stacktraceclass=
+
+# determines if property file should be reloaded
+reloadproperties=false
+# determines how often should be reloaded in seconds
+reloadpropertiesinterval=60
+
+#if=true then url must be prefixed with p6spy:
+useprefix=false
+
+#specifies the appender to use for logging
+#appender=com.p6spy.engine.logging.appender.Log4jLogger
+appender=com.p6spy.engine.logging.appender.StdoutLogger
+
+# name of logfile to use, note Windows users should make sure to use forward slashes in their pathname (e:/test/spy.log) (used for file logger only)
+logfile = spy.log
+
+# append to the p6spy log file. if this is set to false the
+# log file is truncated every time. (file logger only)
+append=true
+
+#The following are for log4j logging only
+log4j.appender.STDOUT=org.apache.log4j.ConsoleAppender
+log4j.appender.STDOUT.layout=org.apache.log4j.PatternLayout
+log4j.appender.STDOUT.layout.ConversionPattern=p6spy - %m%n
+
+#log4j.appender.CHAINSAW_CLIENT=org.apache.log4j.net.SocketAppender
+#log4j.appender.CHAINSAW_CLIENT.RemoteHost=localhost
+#log4j.appender.CHAINSAW_CLIENT.Port=4445
+#log4j.appender.CHAINSAW_CLIENT.LocationInfo=true
+
+log4j.logger.p6spy=INFO,STDOUT
+
+
+#################################################################
+# DataSource replacement #
+# #
+# Replace the real DataSource class in your application server #
+# configuration with the name com.p6spy.engine.spy.P6DataSource,#
+# then add the JNDI name and class name of the real #
+# DataSource here #
+# #
+# Values set in this item cannot be reloaded using the #
+# reloadproperties variable. Once it is loaded, it remains #
+# in memory until the application is restarted. #
+# #
+#################################################################
+#realdatasource=/RealMySqlDS
+#realdatasourceclass=com.mysql.jdbc.jdbc2.optional.MysqlDataSource
+
+#################################################################
+# DataSource properties #
+# #
+# If you are using the DataSource support to intercept calls #
+# to a DataSource that requires properties for proper setup, #
+# define those properties here. Use name value pairs, separate #
+# the name and value with a semicolon, and separate the #
+# pairs with commas. #
+# #
+# The example shown here is for mysql #
+# #
+#################################################################
+#realdatasourceproperties=port;3306,serverName;ibmhost,databaseName;mydb
+
+
+#################################################################
+# JNDI DataSource lookup #
+# #
+# If you are using the DataSource support outside of an app #
+# server, you will probably need to define the JNDI Context #
+# environment. #
+# #
+# If the P6Spy code will be executing inside an app server then #
+# do not use these properties, and the DataSource lookup will #
+# use the naming context defined by the app server. #
+# #
+# The two standard elements of the naming environment are #
+# jndicontextfactory and jndicontextproviderurl. If you need #
+# additional elements, use the jndicontextcustom property. #
+# You can define multiple properties in jndicontextcustom, #
+# in name value pairs. Separate the name and value with a #
+# semicolon, and separate the pairs with commas. #
+# #
+# The example shown here is for a standalone program running on #
+# a machine that is also running JBoss, so the JDNI context #
+# is configured for JBoss (3.0.4). #
+# #
+#################################################################
+#jndicontextfactory=org.jnp.interfaces.NamingContextFactory
+#jndicontextproviderurl=localhost:1099
+#jndicontextcustom=java.naming.factory.url.pkgs;org.jboss.nameing:org.jnp.interfaces
+
+#jndicontextfactory=com.ibm.websphere.naming.WsnInitialContextFactory
+#jndicontextproviderurl=iiop://localhost:900
Property changes on: jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/spy.properties
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
12 years, 2 months