[jbpm-commits] JBoss JBPM SVN: r1852 - in jbpm4/jpdl/trunk/modules/core: src/main/java/org/jbpm/jpdl/xml and 2 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Fri Aug 8 09:24:27 EDT 2008
Author: tom.baeyens at jboss.com
Date: 2008-08-08 09:24:27 -0400 (Fri, 08 Aug 2008)
New Revision: 1852
Added:
jbpm4/jpdl/trunk/modules/core/pom.xml
jbpm4/jpdl/trunk/modules/core/src/test/resources/logging.properties
Modified:
jbpm4/jpdl/trunk/modules/core/src/main/java/org/jbpm/jpdl/xml/JpdlParser.java
jbpm4/jpdl/trunk/modules/core/src/test/java/org/jbpm/jpdl/controlflow/DecisionTest.java
Log:
jpdl decision completion
Added: jbpm4/jpdl/trunk/modules/core/pom.xml
===================================================================
--- jbpm4/jpdl/trunk/modules/core/pom.xml (rev 0)
+++ jbpm4/jpdl/trunk/modules/core/pom.xml 2008-08-08 13:24:27 UTC (rev 1852)
@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ====================================================================== -->
+<!-- -->
+<!-- JBoss, the OpenSource J2EE webOS -->
+<!-- -->
+<!-- Distributable under LGPL license. -->
+<!-- See terms of license at http://www.gnu.org. -->
+<!-- -->
+<!-- ====================================================================== -->
+
+<!-- $Id: pom.xml 1790 2008-07-31 12:13:06Z tom.baeyens at jboss.com $ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <!-- ### GENERAL PROJECT INFO ########################################### -->
+ <name>JBoss jBPM 4 - jPDL</name>
+ <groupId>org.jbpm</groupId>
+ <artifactId>jpdl</artifactId>
+ <packaging>jar</packaging>
+
+ <!-- ### PARENT ######################################################### -->
+ <parent>
+ <groupId>org.jbpm</groupId>
+ <artifactId>jpdl-parent</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ </parent>
+
+ <!-- ### PROPERTIES ##################################################### -->
+ <properties>
+ <surefire.gc.args>-XX:MaxPermSize=128m</surefire.gc.args>
+ <surefire.jdwp.args>-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005</surefire.jdwp.args>
+ </properties>
+
+ <!-- ### DEPENDENCIES ################################################### -->
+ <dependencies>
+ <dependency>
+ <groupId>org.jbpm</groupId>
+ <artifactId>pvm</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <!-- ### PLUGINS ###################################################### -->
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <showDeprecation>false</showDeprecation>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <argLine>${surefire.jvm.args}</argLine>
+ <includes>
+ <include>org/jbpm/jpdl/CheckInTests.java</include>
+ </includes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <!-- ### PROFILES ####################################################### -->
+ <profiles>
+ <profile>
+ <id>debug</id>
+ <activation>
+ <property>
+ <name>debug</name>
+ </property>
+ </activation>
+ <properties>
+ <surefire.jvm.args>${surefire.jdwp.args} ${surefire.gc.args}</surefire.jvm.args>
+ </properties>
+ </profile>
+ <profile>
+ <id>no-debug</id>
+ <activation>
+ <property>
+ <name>!debug</name>
+ </property>
+ </activation>
+ <properties>
+ <surefire.jvm.args>${surefire.gc.args}</surefire.jvm.args>
+ </properties>
+ </profile>
+ </profiles>
+
+</project>
\ No newline at end of file
Modified: jbpm4/jpdl/trunk/modules/core/src/main/java/org/jbpm/jpdl/xml/JpdlParser.java
===================================================================
--- jbpm4/jpdl/trunk/modules/core/src/main/java/org/jbpm/jpdl/xml/JpdlParser.java 2008-08-08 13:23:00 UTC (rev 1851)
+++ jbpm4/jpdl/trunk/modules/core/src/main/java/org/jbpm/jpdl/xml/JpdlParser.java 2008-08-08 13:24:27 UTC (rev 1852)
@@ -31,6 +31,7 @@
import org.jbpm.pvm.internal.log.Log;
import org.jbpm.pvm.internal.model.NodeImpl;
import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
+import org.jbpm.pvm.internal.model.TransitionImpl;
import org.jbpm.pvm.internal.util.ReflectUtil;
import org.jbpm.pvm.internal.util.UrlEntity;
import org.jbpm.pvm.internal.util.XmlUtil;
@@ -134,23 +135,25 @@
if (transitionElements!=null) {
UnresolvedTransitions unresolvedTransitions = parse.findObject(UnresolvedTransitions.class);
for (Element transitionElement: transitionElements) {
- unresolvedTransitions.add(node, transitionElement);
+ String transitionName = XmlUtil.attribute(transitionElement, "name", false, parse);
+ TransitionImpl transition = node.createOutgoingTransition(transitionName);
+ unresolvedTransitions.add(transition, transitionElement);
}
}
}
static class UnresolvedTransitions {
List<UnresolvedTransition> list = new ArrayList<UnresolvedTransition>();
- public void add(NodeImpl node, Element transitionElement) {
- list.add(new UnresolvedTransition(node, transitionElement));
+ public void add(TransitionImpl transition, Element transitionElement) {
+ list.add(new UnresolvedTransition(transition, transitionElement));
}
}
static class UnresolvedTransition {
- NodeImpl source;
+ TransitionImpl transition;
Element transitionElement;
- public UnresolvedTransition(NodeImpl source, Element transitionElement) {
- this.source = source;
+ public UnresolvedTransition(TransitionImpl transition, Element transitionElement) {
+ this.transition = transition;
this.transitionElement = transitionElement;
}
public void resolve(ProcessDefinitionImpl processDefinition, Parse parse) {
@@ -158,7 +161,7 @@
if (to!=null) {
NodeImpl destination = (NodeImpl) processDefinition.findNode(to);
if (destination!=null) {
- source.createOutgoingTransition(destination);
+ destination.addIncomingTransition(transition);
} else {
parse.addProblem(XmlUtil.errorMessageAttribute(transitionElement, "to", to, "doesn't reference an existing node name"));
}
Modified: jbpm4/jpdl/trunk/modules/core/src/test/java/org/jbpm/jpdl/controlflow/DecisionTest.java
===================================================================
--- jbpm4/jpdl/trunk/modules/core/src/test/java/org/jbpm/jpdl/controlflow/DecisionTest.java 2008-08-08 13:23:00 UTC (rev 1851)
+++ jbpm4/jpdl/trunk/modules/core/src/test/java/org/jbpm/jpdl/controlflow/DecisionTest.java 2008-08-08 13:24:27 UTC (rev 1852)
@@ -22,6 +22,7 @@
package org.jbpm.jpdl.controlflow;
import org.jbpm.jpdl.JpdlTestCase;
+import org.jbpm.pvm.PvmException;
import org.jbpm.pvm.client.ClientExecution;
import org.jbpm.pvm.client.ClientProcessDefinition;
@@ -38,8 +39,8 @@
" <transition to='b' />" +
" </state>" +
" <decision name='b' expr='#{theWayToGo}'>" +
- " <transition name='left' to='c' />" +
- " <transition name='right' to='d' />" +
+ " <transition name='left' to='c' />" +
+ " <transition name='right' to='d' />" +
" </decision>" +
" <state name='c' />" +
" <state name='d' />" +
@@ -58,11 +59,41 @@
execution = processDefinition.beginProcessInstance();
execution.setVariable("theWayToGo", null);
- execution.signal();
+ try {
+ execution.signal();
+ fail("expected exception");
+ } catch (PvmException e) {
+ assertTextPresent("decision expression '#{theWayToGo}' returned unexisting outgoing transition name: null", e.getMessage());
+ }
execution = processDefinition.beginProcessInstance();
execution.setVariable("theWayToGo", "up");
+ try {
+ execution.signal();
+ fail("expected exception");
+ } catch (PvmException e) {
+ assertTextPresent("decision expression '#{theWayToGo}' returned unexisting outgoing transition name: up", e.getMessage());
+ }
+ }
+
+ public void testDecisionOutgoingUnnamedTransitionExpression() {
+ ClientProcessDefinition processDefinition = parseProcess(
+ "<process initial='a' name='p'>" +
+ " <state name='a'>" +
+ " <transition to='b' />" +
+ " </state>" +
+ " <decision name='b' expr='#{theWayToGo}'>" +
+ " <transition name='left' to='c' />" +
+ " <transition to='d' />" +
+ " </decision>" +
+ " <state name='c' />" +
+ " <state name='d' />" +
+ "</process>"
+ );
+
+ ClientExecution execution = processDefinition.beginProcessInstance();
+ execution.setVariable("theWayToGo", null);
execution.signal();
+ assertEquals("d", execution.getNode().getName());
}
-
}
Added: jbpm4/jpdl/trunk/modules/core/src/test/resources/logging.properties
===================================================================
--- jbpm4/jpdl/trunk/modules/core/src/test/resources/logging.properties (rev 0)
+++ jbpm4/jpdl/trunk/modules/core/src/test/resources/logging.properties 2008-08-08 13:24:27 UTC (rev 1852)
@@ -0,0 +1,28 @@
+handlers= java.util.logging.ConsoleHandler
+# to add the error triggered file handler
+# handlers= java.util.logging.ConsoleHandler org.jbpm.util.ErrorTriggeredFileHandler
+
+redirect.commons.logging = enabled
+
+java.util.logging.ConsoleHandler.level = FINEST
+java.util.logging.ConsoleHandler.formatter = org.jbpm.pvm.internal.log.LogFormatter
+
+# org.jbpm.util.ErrorTriggeredFileHandler.size = 500
+# org.jbpm.util.ErrorTriggeredFileHandler.push = OFF
+# org.jbpm.util.ErrorTriggeredFileHandler.pattern = %h/jbpm%u.log
+
+# For example, set the com.xyz.foo logger to only log SEVERE messages:
+# com.xyz.foo.level = SEVERE
+
+org.jbpm.level=FINEST
+org.jbpm.pvm.internal.tx.level=FINE
+org.jbpm.pvm.internal.wire.level=FINE
+org.jbpm.pvm.internal.util.level=FINE
+
+org.hibernate.cfg.HbmBinder.level=SEVERE
+org.hibernate.cfg.SettingsFactory.level=SEVERE
+# org.hibernate.level=FINE
+# org.hibernate.SQL.level=FINEST
+# org.hibernate.type.level=FINEST
+# org.hibernate.tool.hbm2ddl.SchemaExport.level=FINEST
+# org.hibernate.transaction.level=FINEST
More information about the jbpm-commits
mailing list