[jbpm-commits] JBoss JBPM SVN: r3606 - in jbpm4/trunk/modules: api/src/main/java/org/jbpm/builder and 15 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Thu Jan 8 03:52:58 EST 2009
Author: tom.baeyens at jboss.com
Date: 2009-01-08 03:52:58 -0500 (Thu, 08 Jan 2009)
New Revision: 3606
Added:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/builder/
jbpm4/trunk/modules/api/src/main/java/org/jbpm/builder/CompositeBuilder.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/builder/Descriptor.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/builder/DescriptorBuilder.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/builder/FlowBuilder.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/builder/NodeBuilder.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/builder/ObjectDescriptorBuilder.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/builder/ProcessBuilder.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/builder/ProcessDefinitionBuilder.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/ExclusiveBuilder.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/CompositeBuilder.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/DescriptorBuilder.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/EventBuilder.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/FlowBuilder.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/NodeBuilder.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/ProcessDefinitionBuilder.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/UnresolvedFlow.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/activities/
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/activities/AutomaticActivity.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/activities/DisplaySource.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/activities/PrintLn.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/activities/PrintLnBuilder.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/activities/TestConsole.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/activities/TestConsoleTestCase.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/activities/WaitState.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/builder/
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/builder/BuilderTest.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/builder/TestActivity.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/builder/TestActivityBuilder.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/println/
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/println/PrintlnTest.java
Removed:
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/builder/BuilderTest.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/builder/Decision.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/builder/DecisionBuilder.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/builder/Sequence.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/builder/SequenceBuilder.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/display/Display.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/display/DisplayActivityTest.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/display/TestConsole.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/eventlistener/DisplaySource.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/eventlistener/PrintLn.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/execution/BasicProcessExecutionTest.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/executionmode/object/AutomaticActivity.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/executionmode/object/WaitState.java
Modified:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/Configuration.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/ExclusiveHandlerActivity.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/NodeImpl.java
jbpm4/trunk/modules/pvm/src/main/resources/jbpm.pvm.job.hbm.xml
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/eventlistener/EventListenerTest.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/eventlistener/EventPropagationTest.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/executionmode/object/ObjectExecutionModeTest.java
jbpm4/trunk/modules/pvm/src/test/resources/logging.properties
Log:
introducing builders
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/Configuration.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/Configuration.java 2009-01-08 07:55:33 UTC (rev 3605)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/Configuration.java 2009-01-08 08:52:58 UTC (rev 3606)
@@ -72,7 +72,7 @@
return implementationClassName;
}
- private Configuration instantiate(String className) {
+ protected Configuration instantiate(String className) {
ClassLoader classLoader = getClassLoader();
Configuration implementation;
try {
Added: jbpm4/trunk/modules/api/src/main/java/org/jbpm/builder/CompositeBuilder.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/builder/CompositeBuilder.java (rev 0)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/builder/CompositeBuilder.java 2009-01-08 08:52:58 UTC (rev 3606)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.builder;
+
+import org.jbpm.client.ClientProcessDefinition;
+
+/**
+ * @author Tom Baeyens
+ */
+public interface CompositeBuilder {
+
+ ClientProcessDefinition endProcess();
+
+ CompositeBuilder endNode();
+
+ <T extends NodeBuilder> T startNode(Class<T> nodeBuilderType);
+
+ <T extends NodeBuilder> T startNode(String nodeName, Class<T> nodeBuilderType);
+
+}
\ No newline at end of file
Added: jbpm4/trunk/modules/api/src/main/java/org/jbpm/builder/Descriptor.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/builder/Descriptor.java (rev 0)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/builder/Descriptor.java 2009-01-08 08:52:58 UTC (rev 3606)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.builder;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public interface Descriptor {
+}
Added: jbpm4/trunk/modules/api/src/main/java/org/jbpm/builder/DescriptorBuilder.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/builder/DescriptorBuilder.java (rev 0)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/builder/DescriptorBuilder.java 2009-01-08 08:52:58 UTC (rev 3606)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.builder;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public interface DescriptorBuilder {
+
+ ObjectDescriptorBuilder inject(String fieldName, Descriptor valueDescriptor);
+
+ ObjectDescriptorBuilder inject(String fieldName, String value);
+
+ ObjectDescriptorBuilder inject(String fieldName, Long value);
+
+ Descriptor endObjectDescriptor();
+
+}
\ No newline at end of file
Added: jbpm4/trunk/modules/api/src/main/java/org/jbpm/builder/FlowBuilder.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/builder/FlowBuilder.java (rev 0)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/builder/FlowBuilder.java 2009-01-08 08:52:58 UTC (rev 3606)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.builder;
+
+/**
+ * @author Tom Baeyens
+ */
+public interface FlowBuilder {
+
+ FlowBuilder name(String name);
+
+ FlowBuilder expr(String expression);
+
+ NodeBuilder<NodeBuilder< ? >> endFlow();
+
+}
\ No newline at end of file
Added: jbpm4/trunk/modules/api/src/main/java/org/jbpm/builder/NodeBuilder.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/builder/NodeBuilder.java (rev 0)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/builder/NodeBuilder.java 2009-01-08 08:52:58 UTC (rev 3606)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.builder;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public interface NodeBuilder<T> extends CompositeBuilder {
+
+ FlowBuilder startFlow(String to);
+
+ T flow(String to);
+
+ T flow(String to, String name);
+
+}
\ No newline at end of file
Added: jbpm4/trunk/modules/api/src/main/java/org/jbpm/builder/ObjectDescriptorBuilder.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/builder/ObjectDescriptorBuilder.java (rev 0)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/builder/ObjectDescriptorBuilder.java 2009-01-08 08:52:58 UTC (rev 3606)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.builder;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public interface ObjectDescriptorBuilder {
+
+ ObjectDescriptorBuilder inject(String fieldName, Descriptor valueDescriptor);
+
+ ObjectDescriptorBuilder inject(String fieldName, String value);
+
+ ObjectDescriptorBuilder inject(String fieldName, Long value);
+
+ Descriptor endObjectDescriptor();
+
+}
\ No newline at end of file
Added: jbpm4/trunk/modules/api/src/main/java/org/jbpm/builder/ProcessBuilder.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/builder/ProcessBuilder.java (rev 0)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/builder/ProcessBuilder.java 2009-01-08 08:52:58 UTC (rev 3606)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.builder;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public interface ProcessBuilder extends CompositeBuilder {
+
+ ProcessDefinitionBuilder initial(String initialNodeName);
+
+ ProcessDefinitionBuilder key(String key);
+
+ ProcessDefinitionBuilder version(int version);
+
+ ProcessDefinitionBuilder description(String description);
+
+}
\ No newline at end of file
Added: jbpm4/trunk/modules/api/src/main/java/org/jbpm/builder/ProcessDefinitionBuilder.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/builder/ProcessDefinitionBuilder.java (rev 0)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/builder/ProcessDefinitionBuilder.java 2009-01-08 08:52:58 UTC (rev 3606)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.builder;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public interface ProcessDefinitionBuilder extends CompositeBuilder {
+
+ ProcessDefinitionBuilder initial(String initialNodeName);
+
+ ProcessDefinitionBuilder key(String key);
+
+ ProcessDefinitionBuilder version(int version);
+
+ ProcessDefinitionBuilder description(String description);
+
+}
\ No newline at end of file
Added: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/ExclusiveBuilder.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/ExclusiveBuilder.java (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/ExclusiveBuilder.java 2009-01-08 08:52:58 UTC (rev 3606)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.activity;
+
+import org.jbpm.pvm.builder.CompositeBuilder;
+import org.jbpm.pvm.builder.NodeBuilder;
+import org.jbpm.pvm.internal.wire.Descriptor;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ExclusiveBuilder extends NodeBuilder<ExclusiveBuilder> {
+
+ public ExclusiveBuilder(CompositeBuilder compositeBuilder, String nodeName) {
+ super(compositeBuilder, nodeName);
+ }
+
+ public ExclusiveBuilder handler(Descriptor descriptor) {
+ // TODO finish this
+ return null;
+ }
+}
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/ExclusiveHandlerActivity.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/ExclusiveHandlerActivity.java 2009-01-08 07:55:33 UTC (rev 3605)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/ExclusiveHandlerActivity.java 2009-01-08 08:52:58 UTC (rev 3606)
@@ -54,7 +54,7 @@
}
if (object==null) {
- throw new JpdlException("decision handler for "+node+" is null");
+ throw new JpdlException("exclusive handler for "+node+" is null");
}
if (! (object instanceof ExclusiveHandler)) {
throw new JpdlException("handler for exclusive is not a "+ExclusiveHandler.class.getName()+": "+object.getClass().getName());
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/CompositeBuilder.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/CompositeBuilder.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/CompositeBuilder.java 2009-01-08 08:52:58 UTC (rev 3606)
@@ -0,0 +1,110 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.builder;
+
+import java.lang.reflect.Constructor;
+
+import org.jbpm.JbpmException;
+import org.jbpm.activity.Activity;
+import org.jbpm.pvm.internal.model.CompositeElementImpl;
+import org.jbpm.pvm.internal.model.EventImpl;
+import org.jbpm.pvm.internal.model.NodeImpl;
+import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
+import org.jbpm.pvm.internal.wire.Descriptor;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public abstract class CompositeBuilder {
+
+ private static final Class<?>[] NODEBUILDER_PARAMTYPES = new Class<?>[]{CompositeBuilder.class, String.class};
+
+ protected CompositeElementImpl compositeElement;
+
+ protected abstract void addUnresolvedFlow(UnresolvedFlow unresolvedFlow);
+ public abstract ProcessDefinitionImpl endProcess();
+
+ protected NodeImpl createNode() {
+ return compositeElement.createNode();
+ }
+
+ public EventImpl createEvent(String eventName) {
+ return compositeElement.createEvent(eventName);
+ }
+
+
+ public <T extends NodeBuilder> T startNode(Descriptor activityDescriptor) {
+ return (T) startNode(null, activityDescriptor);
+ }
+
+ public NodeBuilder<NodeBuilder<?>> startNode(String nodeName, Descriptor activityDescriptor) {
+ if (activityDescriptor==null) {
+ throw new RuntimeException("activityDescriptor is null");
+ }
+ NodeBuilder<NodeBuilder<?>> nodeBuilder = new NodeBuilder<NodeBuilder<?>>(this, nodeName);
+ nodeBuilder.node.setBehaviour(activityDescriptor);
+ return nodeBuilder;
+ }
+
+ public NodeBuilder<NodeBuilder<?>> startNode(Activity activity) {
+ return startNode(null, activity);
+ }
+
+ public NodeBuilder<NodeBuilder<?>> startNode(String nodeName, Activity activity) {
+ if (activity==null) {
+ throw new RuntimeException("activity is null");
+ }
+ NodeBuilder<NodeBuilder<?>> nodeBuilder = new NodeBuilder<NodeBuilder<?>>(this, nodeName);
+ nodeBuilder.node.setBehaviour(activity);
+ return nodeBuilder;
+ }
+
+ public <T extends NodeBuilder> T startNode(Class<T> nodeBuilderType) {
+ return startNode(null, nodeBuilderType);
+ }
+
+ public <T extends NodeBuilder> T startNode(String nodeName, Class<T> nodeBuilderType) {
+ if (nodeBuilderType==null) {
+ throw new RuntimeException("nodeBuilderType is null");
+ }
+ try {
+ Constructor<T> constructor = nodeBuilderType.getConstructor(NODEBUILDER_PARAMTYPES);
+ T nodeBuilder = constructor.newInstance(new Object[]{this, nodeName});
+ return nodeBuilder;
+ } catch (Exception e) {
+ throw new RuntimeException("couldn't instantiate node builder type "+nodeBuilderType.getName(), e);
+ }
+ }
+
+ public EventBuilder startEvent(String eventName) {
+ return new EventBuilder(this, compositeElement, eventName);
+ }
+
+ public CompositeBuilder endNode() {
+ throw new JbpmException("calling endNode on a processBuilder is invalid");
+ }
+
+ public FlowBuilder startFlow(String to) {
+ throw new JbpmException("calling startFlow on a processBuilder is invalid");
+ }
+}
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/DescriptorBuilder.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/DescriptorBuilder.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/DescriptorBuilder.java 2009-01-08 08:52:58 UTC (rev 3606)
@@ -0,0 +1,83 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.builder;
+
+import org.jbpm.pvm.internal.wire.Descriptor;
+import org.jbpm.pvm.internal.wire.descriptor.LongDescriptor;
+import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
+import org.jbpm.pvm.internal.wire.descriptor.ReferenceDescriptor;
+import org.jbpm.pvm.internal.wire.descriptor.StringDescriptor;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class DescriptorBuilder {
+
+ ObjectDescriptor objectDescriptor;
+
+ protected DescriptorBuilder(String className) {
+ objectDescriptor = new ObjectDescriptor();
+ objectDescriptor.setClassName(className);
+ }
+
+ public static DescriptorBuilder startObjectDescriptor(String className) {
+ return new DescriptorBuilder(className);
+ }
+
+ public static Descriptor createObjectDescriptor(String className) {
+ return new ObjectDescriptor(className);
+ }
+
+ public static Descriptor createReferenceDescriptor(String objectName) {
+ return new ReferenceDescriptor(objectName);
+ }
+
+ public static Descriptor createStringDescriptor(String text) {
+ return new StringDescriptor(text);
+ }
+
+ public static Descriptor createLongDescriptor(Long l) {
+ return new LongDescriptor(l);
+ }
+
+ public DescriptorBuilder inject(String fieldName, Descriptor valueDescriptor) {
+ objectDescriptor.addInjection(fieldName, valueDescriptor);
+ return this;
+ }
+
+ public DescriptorBuilder inject(String fieldName, String value) {
+ StringDescriptor stringDescriptor = new StringDescriptor(value);
+ objectDescriptor.addInjection(fieldName, stringDescriptor);
+ return this;
+ }
+
+ public DescriptorBuilder inject(String fieldName, Long value) {
+ LongDescriptor longDescriptor = new LongDescriptor(value);
+ objectDescriptor.addInjection(fieldName, longDescriptor);
+ return this;
+ }
+
+ public Descriptor endObjectDescriptor() {
+ return objectDescriptor;
+ }
+}
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/EventBuilder.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/EventBuilder.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/EventBuilder.java 2009-01-08 08:52:58 UTC (rev 3606)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.builder;
+
+import org.jbpm.JbpmException;
+import org.jbpm.listener.EventListener;
+import org.jbpm.pvm.internal.model.EventImpl;
+import org.jbpm.pvm.internal.model.EventListenerReference;
+import org.jbpm.pvm.internal.model.ObservableElementImpl;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class EventBuilder {
+
+ protected CompositeBuilder compositeBuilder;
+ protected ObservableElementImpl observableElement;
+ protected String eventName;
+ protected EventImpl event = null;
+
+ public EventBuilder(CompositeBuilder compositeBuilder, ObservableElementImpl observableElement, String eventName) {
+ this.compositeBuilder = compositeBuilder;
+ this.observableElement = observableElement;
+ this.eventName = eventName;
+ }
+
+ public EventBuilder listener(EventListener eventListener) {
+ getEvent().createEventListenerReference(eventListener);
+ return this;
+ }
+
+ private EventImpl getEvent() {
+ if (event==null) {
+ this.event = observableElement.createEvent(eventName);
+ }
+ return event;
+ }
+
+ public CompositeBuilder endEvent() {
+ return compositeBuilder;
+ }
+
+ public NodeBuilder<NodeBuilder<?>> endFlow() {
+ throw new JbpmException("endFlow is only allowed on flows");
+ }
+
+}
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/FlowBuilder.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/FlowBuilder.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/FlowBuilder.java 2009-01-08 08:52:58 UTC (rev 3606)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.builder;
+
+import org.jbpm.model.Event;
+import org.jbpm.pvm.internal.model.TransitionImpl;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class FlowBuilder extends EventBuilder {
+
+ protected NodeBuilder<?> nodeBuilder;
+ protected TransitionImpl transition;
+
+ public FlowBuilder(NodeBuilder<?> nodeBuilder, TransitionImpl transition) {
+ super(nodeBuilder, transition, Event.TRANSITION_TAKE);
+ this.nodeBuilder = nodeBuilder;
+ this.transition = transition;
+ }
+
+ public FlowBuilder name(String name) {
+ transition.setName(name);
+ return this;
+ }
+
+ public FlowBuilder expr(String expression) {
+ // transition.setExpression(expression);
+ return this;
+ }
+
+ public NodeBuilder<NodeBuilder<?>> endFlow() {
+ return (NodeBuilder) nodeBuilder;
+ }
+}
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/NodeBuilder.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/NodeBuilder.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/NodeBuilder.java 2009-01-08 08:52:58 UTC (rev 3606)
@@ -0,0 +1,72 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.builder;
+
+import org.jbpm.pvm.internal.model.NodeImpl;
+import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
+
+/**
+ * @author Tom Baeyens
+ */
+public class NodeBuilder<T> extends CompositeBuilder {
+
+ /** the enclosing composite */
+ protected CompositeBuilder compositeBuilder;
+ protected NodeImpl node;
+
+ public NodeBuilder(CompositeBuilder compositeBuilder, String nodeName) {
+ this.compositeBuilder = compositeBuilder;
+ this.node = compositeBuilder.createNode();
+ this.compositeElement = node;
+ this.node.setName(nodeName);
+ }
+
+ public CompositeBuilder endNode() {
+ return compositeBuilder;
+ }
+
+ public FlowBuilder startFlow(String to) {
+ UnresolvedFlow unresolvedFlow = new UnresolvedFlow();
+ unresolvedFlow.transition = node.createOutgoingTransition();
+ unresolvedFlow.destinationName = to;
+ addUnresolvedFlow(unresolvedFlow);
+ return new FlowBuilder(this, unresolvedFlow.transition);
+ }
+
+ public ProcessDefinitionImpl endProcess() {
+ return compositeBuilder.endProcess();
+ }
+
+ public T flow(String to) {
+ startFlow(to);
+ return (T) this;
+ }
+
+ public T flow(String to, String name) {
+ startFlow(to).name(name);
+ return (T) this;
+ }
+
+ protected void addUnresolvedFlow(UnresolvedFlow unresolvedFlow) {
+ compositeBuilder.addUnresolvedFlow(unresolvedFlow);
+ }
+}
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/ProcessDefinitionBuilder.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/ProcessDefinitionBuilder.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/ProcessDefinitionBuilder.java 2009-01-08 08:52:58 UTC (rev 3606)
@@ -0,0 +1,113 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.builder;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jbpm.log.Log;
+import org.jbpm.pvm.internal.model.NodeImpl;
+import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
+
+/**
+ * @author Tom Baeyens
+ */
+public class ProcessDefinitionBuilder extends CompositeBuilder {
+
+ private static final Log log = Log.getLog(ProcessDefinitionBuilder.class.getName());
+
+ protected ProcessDefinitionImpl processDefinition;
+ protected String initialNodeName = null;
+ protected List<UnresolvedFlow> unresolvedFlows = new ArrayList<UnresolvedFlow>();
+
+ protected ProcessDefinitionBuilder(ProcessDefinitionImpl processDefinition) {
+ this.processDefinition = processDefinition;
+ this.compositeElement = processDefinition;
+ }
+
+ public static ProcessDefinitionBuilder startProcess() {
+ return startProcess(null);
+ }
+
+ public static ProcessDefinitionBuilder startProcess(String processDefinitionName) {
+ ProcessDefinitionImpl processDefinition = new ProcessDefinitionImpl();
+ processDefinition.setName(processDefinitionName);
+ return new ProcessDefinitionBuilder(processDefinition);
+ }
+
+ public ProcessDefinitionImpl endProcess() {
+ resolveInitialNode();
+ resolveFlows();
+ return processDefinition;
+ }
+
+ protected void resolveInitialNode() {
+ NodeImpl initial = (NodeImpl) processDefinition.findNode(initialNodeName);
+ if (initial==null) {
+ errorUnexistingInitial();
+ }
+ processDefinition.setInitial(initial);
+ }
+
+ protected void resolveFlows() {
+ for (UnresolvedFlow unresolvedFlow: unresolvedFlows) {
+ NodeImpl destination = (NodeImpl) processDefinition.findNode(unresolvedFlow.destinationName);
+ if (destination==null) {
+ errorUnexistingFlowDestination(unresolvedFlow);
+ }
+ unresolvedFlow.transition.setDestination(destination);
+ }
+ }
+
+ protected void errorUnexistingInitial() {
+ log.error("unexisting initial "+initialNodeName);
+ }
+
+ protected void errorUnexistingFlowDestination(UnresolvedFlow unresolvedFlow) {
+ String sourceNodeName = unresolvedFlow.transition.getSource().getName();
+ log.error("unexisting flow destination: "+sourceNodeName+"-->"+unresolvedFlow.destinationName);
+ }
+
+ public ProcessDefinitionBuilder key(String key) {
+ processDefinition.setKey(key);
+ return this;
+ }
+
+ public ProcessDefinitionBuilder version(int version) {
+ processDefinition.setVersion(version);
+ return this;
+ }
+
+ public ProcessDefinitionBuilder description(String description) {
+ processDefinition.setDescription(description);
+ return this;
+ }
+
+ public ProcessDefinitionBuilder initial(String initialNodeName) {
+ this.initialNodeName = initialNodeName;
+ return this;
+ }
+
+ protected void addUnresolvedFlow(UnresolvedFlow unresolvedFlow) {
+ unresolvedFlows.add(unresolvedFlow);
+ }
+}
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/UnresolvedFlow.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/UnresolvedFlow.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/UnresolvedFlow.java 2009-01-08 08:52:58 UTC (rev 3606)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.builder;
+
+import org.jbpm.pvm.internal.model.TransitionImpl;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class UnresolvedFlow {
+
+ TransitionImpl transition;
+ String destinationName;
+}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/NodeImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/NodeImpl.java 2009-01-08 07:55:33 UTC (rev 3605)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/NodeImpl.java 2009-01-08 08:52:58 UTC (rev 3606)
@@ -81,23 +81,30 @@
// leaving transitions //////////////////////////////////////////////////////
- /**
- * creates a transition from this node to the given
- * destination node. Also the transition pointers to source and destination
- * node will be set appropriatly.
- * @throws NullPointerException if destination is null.
- */
+ /** creates an outgoing transition from this node. */
+ public TransitionImpl createOutgoingTransition() {
+ // create a new transition
+ TransitionImpl transition = new TransitionImpl();
+
+ // wire it between the source and destination
+ addOutgoingTransition(transition);
+
+ // if there is no default transition yet
+ if (defaultTransition==null) {
+ // make this the default outgoing transition
+ defaultTransition = transition;
+ }
+
+ return transition;
+ }
+
+
+ // TODO remove
public Transition createOutgoingTransition(NodeImpl destination) {
return createOutgoingTransition(destination, null);
}
- /**
- * creates a transition with the given name from this node to the given
- * destination node. Also the transition pointers to source and destination
- * node will be set appropriatly.
- * @param transitionName may be null.
- * @throws NullPointerException if destination is null.
- */
+ // TODO remove
public TransitionImpl createOutgoingTransition(NodeImpl destination, String transitionName) {
TransitionImpl transition = createOutgoingTransition(transitionName);
if (destination!=null) {
@@ -106,6 +113,7 @@
return transition;
}
+ // TODO remove
public TransitionImpl createOutgoingTransition(String transitionName) {
// create a new transition
TransitionImpl transition = new TransitionImpl();
Modified: jbpm4/trunk/modules/pvm/src/main/resources/jbpm.pvm.job.hbm.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/resources/jbpm.pvm.job.hbm.xml 2009-01-08 07:55:33 UTC (rev 3605)
+++ jbpm4/trunk/modules/pvm/src/main/resources/jbpm.pvm.job.hbm.xml 2009-01-08 08:52:58 UTC (rev 3606)
@@ -13,14 +13,14 @@
<discriminator column="CLASS_" />
<version name="dbversion" column="DBVERSION_" />
- <property name="dueDate" column="DUEDATE_" type="timestamp" />
+ <property name="dueDate" column="DUEDATE_" type="timestamp" index="IDX_JOBDUEDATE" />
<property name="isSuspended" column="ISSUSPENDED_" />
<property name="isExclusive" column="ISEXCLUSIVE_" />
<property name="lockOwner" column="LOCKOWNER_" />
- <property name="lockExpirationTime" column="LOCKEXPTIME_" />
+ <property name="lockExpirationTime" column="LOCKEXPTIME_" index="IDX_JOBLOCKEXP" />
<property name="info" column="INFO_" />
<property name="exception" column="EXCEPTION_" type="text" />
- <property name="retries" column="RETRIES_" />
+ <property name="retries" column="RETRIES_" index="IDX_JOBRETRIES" />
<many-to-one name="processInstance"
class="org.jbpm.pvm.internal.model.ExecutionImpl"
Deleted: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/builder/BuilderTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/builder/BuilderTest.java 2009-01-08 07:55:33 UTC (rev 3605)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/builder/BuilderTest.java 2009-01-08 08:52:58 UTC (rev 3606)
@@ -1,61 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.builder;
-
-import org.jbpm.ProcessDefinition;
-import org.jbpm.test.JbpmTestCase;
-
-
-/**
- * @author Tom Baeyens
- */
-public class BuilderTest extends JbpmTestCase {
-
- public void testBuilder() {
- ProcessDefinition processDefinition = PvmProcessBuilder.startProcess()
- .name("insurance claim")
-/*
- .startNode(DecisionBuilder.class)
- .name("decision")
- .expr("expression")
- .flow("one")
- .flow("three", "langs hier")
- .startFlowTo("")
- .expr("#{mount > 20}")
- .endFlow()
- .endNode()
- .startNode(SequenceBuilder.class)
- .name("sequence")
- .startNode(DecisionBuilder.class)
- .name("one")
- .endNode()
- .startNode(DecisionBuilder.class)
- .name("two")
- .endNode()
- .startNode(DecisionBuilder.class)
- .name("three")
- .endNode()
- .endNode()
-*/
- .endProcess();
- }
-}
Deleted: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/builder/Decision.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/builder/Decision.java 2009-01-08 07:55:33 UTC (rev 3605)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/builder/Decision.java 2009-01-08 08:52:58 UTC (rev 3606)
@@ -1,40 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.builder;
-
-import org.jbpm.activity.Activity;
-import org.jbpm.activity.ActivityExecution;
-
-
-/**
- * @author Tom Baeyens
- */
-public class Decision implements Activity {
-
- private static final long serialVersionUID = 1L;
-
- String expression;
-
- public void execute(ActivityExecution execution) throws Exception {
- }
-
-}
Deleted: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/builder/DecisionBuilder.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/builder/DecisionBuilder.java 2009-01-08 07:55:33 UTC (rev 3605)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/builder/DecisionBuilder.java 2009-01-08 08:52:58 UTC (rev 3606)
@@ -1,41 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.builder;
-
-
-
-/**
- * @author Tom Baeyens
- */
-public class DecisionBuilder extends NodeBuilder<DecisionBuilder> {
-
- Decision decision = new Decision();
-
- public DecisionBuilder(CompositeBuilder compositeBuilder) {
- super(compositeBuilder);
- }
-
- public DecisionBuilder expr(String expression) {
- decision.expression = expression;
- return this;
- }
-}
Deleted: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/builder/Sequence.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/builder/Sequence.java 2009-01-08 07:55:33 UTC (rev 3605)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/builder/Sequence.java 2009-01-08 08:52:58 UTC (rev 3606)
@@ -1,38 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.builder;
-
-import org.jbpm.activity.Activity;
-import org.jbpm.activity.ActivityExecution;
-
-
-/**
- * @author Tom Baeyens
- */
-public class Sequence implements Activity {
-
- private static final long serialVersionUID = 1L;
-
- public void execute(ActivityExecution execution) throws Exception {
- }
-
-}
Deleted: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/builder/SequenceBuilder.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/builder/SequenceBuilder.java 2009-01-08 07:55:33 UTC (rev 3605)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/builder/SequenceBuilder.java 2009-01-08 08:52:58 UTC (rev 3606)
@@ -1,40 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.builder;
-
-
-/**
- * @author Tom Baeyens
- */
-public class SequenceBuilder extends NodeBuilder<SequenceBuilder> {
-
- Sequence sequence = new Sequence();
-
- protected SequenceBuilder(CompositeBuilder compositeBuilder) {
- super(compositeBuilder);
- node.setBehaviour(sequence);
- }
-
- public <T extends NodeBuilder> T startNode(Class<T> nodeBuilderType) {
- return super.startNode(nodeBuilderType);
- }
-}
Added: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/activities/AutomaticActivity.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/activities/AutomaticActivity.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/activities/AutomaticActivity.java 2009-01-08 08:52:58 UTC (rev 3606)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.activities;
+
+import org.jbpm.activity.Activity;
+import org.jbpm.activity.ActivityExecution;
+
+/**
+ * @author Tom Baeyens
+ */
+public class AutomaticActivity implements Activity {
+
+ private static final long serialVersionUID = 1L;
+
+ public void execute(ActivityExecution execution) throws Exception {
+ }
+
+}
Added: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/activities/DisplaySource.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/activities/DisplaySource.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/activities/DisplaySource.java 2009-01-08 08:52:58 UTC (rev 3606)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.activities;
+
+import org.jbpm.listener.EventListener;
+import org.jbpm.listener.EventListenerExecution;
+
+public class DisplaySource implements EventListener {
+
+ private static final long serialVersionUID = 1L;
+
+ public void notify(EventListenerExecution execution) {
+ System.out.println("leaving "+execution.getEventSource());
+ }
+}
Added: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/activities/PrintLn.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/activities/PrintLn.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/activities/PrintLn.java 2009-01-08 08:52:58 UTC (rev 3606)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.activities;
+
+import org.jbpm.activity.Activity;
+import org.jbpm.activity.ActivityExecution;
+import org.jbpm.listener.EventListener;
+import org.jbpm.listener.EventListenerExecution;
+import org.jbpm.model.OpenExecution;
+
+public class PrintLn implements Activity, EventListener {
+
+ private static final long serialVersionUID = 1L;
+
+ String message;
+
+ public PrintLn() {
+ }
+
+ public PrintLn(String message) {
+ this.message = message;
+ }
+
+ public void execute(ActivityExecution execution) {
+ perform(execution);
+ }
+
+ public void notify(EventListenerExecution execution) throws Exception {
+ perform(execution);
+ }
+
+ public void perform(OpenExecution execution) {
+ System.out.println(message);
+ }
+}
\ No newline at end of file
Added: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/activities/PrintLnBuilder.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/activities/PrintLnBuilder.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/activities/PrintLnBuilder.java 2009-01-08 08:52:58 UTC (rev 3606)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.activities;
+
+import org.jbpm.pvm.builder.CompositeBuilder;
+import org.jbpm.pvm.builder.NodeBuilder;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class PrintLnBuilder extends NodeBuilder<PrintLnBuilder> {
+
+ PrintLn printLn = new PrintLn();
+
+ public PrintLnBuilder(CompositeBuilder compositeBuilder, String nodeName) {
+ super(compositeBuilder, nodeName);
+ node.setBehaviour(printLn);
+ }
+
+ public PrintLnBuilder message(String message) {
+ printLn.message = message;
+ return this;
+ }
+
+}
Added: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/activities/TestConsole.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/activities/TestConsole.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/activities/TestConsole.java 2009-01-08 08:52:58 UTC (rev 3606)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.activities;
+
+import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.List;
+
+/** wraps the System.out and buffers the println(String) invocations
+ * so that those can be asserted */
+public class TestConsole extends PrintStream {
+
+ public List<String> lines = new ArrayList<String>();
+
+ public TestConsole() {
+ super(System.out);
+ }
+
+ public static TestConsole install() {
+ TestConsole testConsole = new TestConsole();
+ System.setOut(testConsole);
+ return testConsole;
+ }
+
+ public static void uninstall() {
+ if (System.out instanceof TestConsole) {
+ TestConsole testConsole = (TestConsole) System.out;
+ System.setOut((PrintStream) testConsole.out);
+ }
+ }
+
+ public void println(String x) {
+ lines.add(x);
+ super.println(x);
+ }
+
+ public String getLine(int i) {
+ return lines.get(i);
+ }
+}
Added: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/activities/TestConsoleTestCase.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/activities/TestConsoleTestCase.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/activities/TestConsoleTestCase.java 2009-01-08 08:52:58 UTC (rev 3606)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.activities;
+
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class TestConsoleTestCase extends JbpmTestCase {
+
+ protected TestConsole testConsole;
+
+ public void setUp() throws Exception {
+ super.setUp();
+ testConsole = TestConsole.install();
+ }
+
+ public void tearDown() throws Exception {
+ TestConsole.uninstall();
+ testConsole = null;
+ super.tearDown();
+ }
+
+
+}
Added: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/activities/WaitState.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/activities/WaitState.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/activities/WaitState.java 2009-01-08 08:52:58 UTC (rev 3606)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.activities;
+
+import java.util.Map;
+
+import org.jbpm.activity.ActivityExecution;
+import org.jbpm.activity.ExternalActivity;
+
+/**
+ * @author Tom Baeyens
+ */
+public class WaitState implements ExternalActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ public void execute(ActivityExecution execution) {
+ execution.waitForSignal();
+ }
+
+ public void signal(ActivityExecution execution,
+ String signalName,
+ Map<String, Object> parameters) {
+ execution.setVariables(parameters);
+ execution.take(signalName);
+ }
+}
Added: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/builder/BuilderTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/builder/BuilderTest.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/builder/BuilderTest.java 2009-01-08 08:52:58 UTC (rev 3606)
@@ -0,0 +1,190 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.builder;
+
+import java.util.List;
+import java.util.Map;
+
+import org.jbpm.client.ClientProcessDefinition;
+import org.jbpm.model.Transition;
+import org.jbpm.pvm.internal.model.NodeImpl;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class BuilderTest extends JbpmTestCase {
+
+ public void testBuilderProcessDefinitionProperties() {
+ ClientProcessDefinition processDefinition = ProcessDefinitionBuilder
+ .startProcess("p")
+ .key("k")
+ .version(5)
+ .description("the description")
+ .endProcess();
+
+ assertEquals("p", processDefinition.getName());
+ assertEquals("k", processDefinition.getKey());
+ assertEquals(5, processDefinition.getVersion());
+ assertEquals("the description", processDefinition.getDescription());
+ }
+
+ public void testBuilderInitialNode() {
+ ClientProcessDefinition processDefinition = ProcessDefinitionBuilder
+ .startProcess("p")
+ .initial("start")
+ .startNode("start", TestActivityBuilder.class)
+ .endNode()
+ .endProcess();
+
+ NodeImpl start = (NodeImpl) processDefinition.getInitial();
+ assertNotNull(start);
+ assertEquals("start", start.getName());
+ }
+
+ public void testBuilderActivityProperties() {
+ ClientProcessDefinition processDefinition = ProcessDefinitionBuilder
+ .startProcess("p")
+ .startNode("start", TestActivityBuilder.class)
+ .testActivityProperty("some cfg value")
+ .endNode()
+ .endProcess();
+
+ NodeImpl decisionNode = (NodeImpl) processDefinition.getNode("start");
+ assertNotNull(decisionNode);
+ assertEquals("start", decisionNode.getName());
+
+ TestActivity testActivity = (TestActivity) decisionNode.getBehaviour();
+ assertEquals("some cfg value", testActivity.getTestActivityProperty());
+ }
+
+ public void testBuilderMultipleOutgoingFlows() {
+ ClientProcessDefinition processDefinition = ProcessDefinitionBuilder
+ .startProcess("p")
+ .startNode("x", TestActivityBuilder.class)
+ .flow("a")
+ .flow("b", "to b")
+ .startFlow("c")
+ .name("to c")
+ .endFlow()
+ .endNode()
+ .startNode("a", TestActivityBuilder.class)
+ .endNode()
+ .startNode("b", TestActivityBuilder.class)
+ .endNode()
+ .startNode("c", TestActivityBuilder.class)
+ .endNode()
+ .endProcess();
+
+ NodeImpl decisionNode = (NodeImpl) processDefinition.getNode("x");
+ assertNotNull(decisionNode);
+
+ List<Transition> outgoingTransitions = decisionNode.getOutgoingTransitions();
+ assertNotNull(outgoingTransitions);
+ assertEquals("expected 3 transitions: "+outgoingTransitions, 3, outgoingTransitions.size());
+ Transition toA = outgoingTransitions.get(0);
+ assertNull(toA.getName());
+ assertEquals("a", toA.getDestination().getName());
+
+ Transition toB = outgoingTransitions.get(1);
+ assertEquals("to b", toB.getName());
+ assertEquals("b", toB.getDestination().getName());
+
+ Transition toC = outgoingTransitions.get(2);
+ assertEquals("to c", toC.getName());
+ assertEquals("c", toC.getDestination().getName());
+
+ Map<String, Transition> outgoingTransitionsMap = decisionNode.getOutgoingTransitionsMap();
+ assertSame(toA, outgoingTransitionsMap.get(null));
+ assertSame(toB, outgoingTransitionsMap.get("to b"));
+ assertSame(toC, outgoingTransitionsMap.get("to c"));
+ }
+
+ public void testBuilderCompositeNodes() {
+ ClientProcessDefinition processDefinition = ProcessDefinitionBuilder
+ .startProcess()
+ .initial("1.2.2")
+ .startNode("1", TestActivityBuilder.class)
+ .startNode("1.1", TestActivityBuilder.class)
+ .flow("1.2.1", "to onedottwodotone")
+ .endNode()
+ .startNode("1.2", TestActivityBuilder.class)
+ .startNode("1.2.1", TestActivityBuilder.class)
+ .endNode()
+ .startNode("1.2.2", TestActivityBuilder.class)
+ .flow("1", "to one")
+ .endNode()
+ .startNode("1.2.3", TestActivityBuilder.class)
+ .endNode()
+ .endNode()
+ .startNode("1.3", TestActivityBuilder.class)
+ .endNode()
+ .endNode()
+ .endProcess();
+
+ NodeImpl node1 = (NodeImpl) processDefinition.findNode("1");
+ NodeImpl node11 = (NodeImpl) processDefinition.findNode("1.1");
+ NodeImpl node12 = (NodeImpl) processDefinition.findNode("1.2");
+ NodeImpl node121 = (NodeImpl) processDefinition.findNode("1.2.1");
+ NodeImpl node122 = (NodeImpl) processDefinition.findNode("1.2.2");
+ NodeImpl node123 = (NodeImpl) processDefinition.findNode("1.2.3");
+ NodeImpl node13 = (NodeImpl) processDefinition.findNode("1.3");
+
+ assertNotNull(node1);
+ assertNotNull(node11);
+ assertNotNull(node12);
+ assertNotNull(node121);
+ assertNotNull(node122);
+ assertNotNull(node123);
+ assertNotNull(node13);
+
+ assertSame(node1, processDefinition.getNodes().get(0));
+ assertSame(node11, processDefinition.getNodes().get(1));
+ assertSame(node12, processDefinition.getNodes().get(2));
+ assertSame(node121, processDefinition.getNodes().get(3));
+ assertSame(node122, processDefinition.getNodes().get(4));
+ assertSame(node123, processDefinition.getNodes().get(5));
+ assertSame(node13, processDefinition.getNodes().get(6));
+ assertEquals(7, processDefinition.getNodes().size());
+
+ assertSame(node11, node1.getNodes().get(0));
+ assertSame(node12, node1.getNodes().get(1));
+ assertSame(node13, node1.getNodes().get(2));
+
+ assertSame(node121, node12.getNodes().get(0));
+ assertSame(node122, node12.getNodes().get(1));
+ assertSame(node123, node12.getNodes().get(2));
+
+ assertSame(processDefinition, node1.getParent());
+ assertSame(node1, node11.getParent());
+ assertSame(node1, node12.getParent());
+ assertSame(node12, node121.getParent());
+ assertSame(node12, node122.getParent());
+ assertSame(node12, node123.getParent());
+ assertSame(node1, node13.getParent());
+
+ assertSame(node1, node122.getOutgoingTransition("to one").getDestination());
+ assertSame(node121, node11.getOutgoingTransition("to onedottwodotone").getDestination());
+ }
+
+}
Added: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/builder/TestActivity.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/builder/TestActivity.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/builder/TestActivity.java 2009-01-08 08:52:58 UTC (rev 3606)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.builder;
+
+import org.jbpm.activity.Activity;
+import org.jbpm.activity.ActivityExecution;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class TestActivity implements Activity {
+
+ private static final long serialVersionUID = 1L;
+
+ String testActivityProperty;
+
+ public void execute(ActivityExecution execution) throws Exception {
+ }
+
+ public String getTestActivityProperty() {
+ return testActivityProperty;
+ }
+
+}
Added: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/builder/TestActivityBuilder.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/builder/TestActivityBuilder.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/builder/TestActivityBuilder.java 2009-01-08 08:52:58 UTC (rev 3606)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.builder;
+
+import org.jbpm.pvm.builder.CompositeBuilder;
+import org.jbpm.pvm.builder.NodeBuilder;
+
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class TestActivityBuilder extends NodeBuilder<TestActivityBuilder> {
+
+ TestActivity testActivity = new TestActivity();
+
+ public TestActivityBuilder(CompositeBuilder compositeBuilder, String nodeName) {
+ super(compositeBuilder, nodeName);
+ node.setBehaviour(testActivity);
+ }
+
+ public TestActivityBuilder testActivityProperty(String testActivityProperty) {
+ testActivity.testActivityProperty = testActivityProperty;
+ return this;
+ }
+}
Deleted: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/display/Display.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/display/Display.java 2009-01-08 07:55:33 UTC (rev 3605)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/display/Display.java 2009-01-08 08:52:58 UTC (rev 3606)
@@ -1,40 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.display;
-
-import org.jbpm.activity.Activity;
-import org.jbpm.activity.ActivityExecution;
-
-public class Display implements Activity {
-
- private static final long serialVersionUID = 1L;
-
- String message;
-
- public Display(String message) {
- this.message = message;
- }
-
- public void execute(ActivityExecution execution) {
- System.out.println(message);
- }
-}
\ No newline at end of file
Deleted: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/display/DisplayActivityTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/display/DisplayActivityTest.java 2009-01-08 07:55:33 UTC (rev 3605)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/display/DisplayActivityTest.java 2009-01-08 08:52:58 UTC (rev 3606)
@@ -1,55 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.display;
-
-import org.jbpm.Execution;
-import org.jbpm.client.ClientProcessDefinition;
-import org.jbpm.pvm.model.ProcessFactory;
-import org.jbpm.test.JbpmTestCase;
-
-
-public class DisplayActivityTest extends JbpmTestCase {
-
- TestConsole testConsole;
-
- public void setUp() {
- testConsole = TestConsole.install();
- }
-
- public void tearDown() {
- TestConsole.uninstall();
- testConsole = null;
- }
-
- public void testHelloWorld() {
- ClientProcessDefinition processDefinition = ProcessFactory.build()
- .node("a").initial().behaviour(new Display("hello"))
- .transition().to("b")
- .node("b").behaviour(new Display("world"))
- .done();
-
- Execution execution = processDefinition.startProcessInstance();
-
- assertEquals("hello", testConsole.getLine(0));
- assertEquals("world", testConsole.getLine(1));
- }
-}
Deleted: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/display/TestConsole.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/display/TestConsole.java 2009-01-08 07:55:33 UTC (rev 3605)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/display/TestConsole.java 2009-01-08 08:52:58 UTC (rev 3606)
@@ -1,59 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.display;
-
-import java.io.PrintStream;
-import java.util.ArrayList;
-import java.util.List;
-
-/** wraps the System.out and buffers the println(String) invocations
- * so that those can be asserted */
-public class TestConsole extends PrintStream {
-
- public List<String> lines = new ArrayList<String>();
-
- public TestConsole() {
- super(System.out);
- }
-
- public static TestConsole install() {
- TestConsole testConsole = new TestConsole();
- System.setOut(testConsole);
- return testConsole;
- }
-
- public static void uninstall() {
- if (System.out instanceof TestConsole) {
- TestConsole testConsole = (TestConsole) System.out;
- System.setOut((PrintStream) testConsole.out);
- }
- }
-
- public void println(String x) {
- lines.add(x);
- super.println(x);
- }
-
- public String getLine(int i) {
- return lines.get(i);
- }
-}
Deleted: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/eventlistener/DisplaySource.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/eventlistener/DisplaySource.java 2009-01-08 07:55:33 UTC (rev 3605)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/eventlistener/DisplaySource.java 2009-01-08 08:52:58 UTC (rev 3606)
@@ -1,34 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.eventlistener;
-
-import org.jbpm.listener.EventListener;
-import org.jbpm.listener.EventListenerExecution;
-
-public class DisplaySource implements EventListener {
-
- private static final long serialVersionUID = 1L;
-
- public void notify(EventListenerExecution execution) {
- System.out.println("leaving "+execution.getEventSource());
- }
-}
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/eventlistener/EventListenerTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/eventlistener/EventListenerTest.java 2009-01-08 07:55:33 UTC (rev 3605)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/eventlistener/EventListenerTest.java 2009-01-08 08:52:58 UTC (rev 3606)
@@ -21,44 +21,36 @@
*/
package org.jbpm.pvm.eventlistener;
-import javax.enterprise.deploy.spi.exceptions.ClientExecuteException;
-
import org.jbpm.client.ClientExecution;
import org.jbpm.client.ClientProcessDefinition;
import org.jbpm.model.Event;
-import org.jbpm.pvm.display.Display;
-import org.jbpm.pvm.display.TestConsole;
-import org.jbpm.pvm.executionmode.object.AutomaticActivity;
-import org.jbpm.pvm.executionmode.object.WaitState;
-import org.jbpm.pvm.model.ProcessFactory;
-import org.jbpm.test.JbpmTestCase;
+import org.jbpm.pvm.activities.AutomaticActivity;
+import org.jbpm.pvm.activities.PrintLn;
+import org.jbpm.pvm.activities.TestConsoleTestCase;
+import org.jbpm.pvm.activities.WaitState;
+import org.jbpm.pvm.builder.ProcessDefinitionBuilder;
+public class EventListenerTest extends TestConsoleTestCase {
-public class EventListenerTest extends JbpmTestCase {
-
- TestConsole testConsole;
-
- public void setUp() {
- testConsole = TestConsole.install();
- }
-
- public void tearDown() {
- TestConsole.uninstall();
- testConsole = null;
- }
-
public void testEventListener() {
- ClientProcessDefinition processDefinition = ProcessFactory.build()
- .node("a").initial().behaviour(new AutomaticActivity())
- .event(Event.NODE_END)
+ ClientProcessDefinition processDefinition = ProcessDefinitionBuilder
+ .startProcess()
+ .initial("a")
+ .startNode("a", new AutomaticActivity())
+ .startEvent(Event.NODE_END)
.listener(new PrintLn("leaving a"))
.listener(new PrintLn("second message while leaving a"))
- .transition().to("b")
+ .endEvent()
+ .startFlow("b")
.listener(new PrintLn("taking transition"))
- .node("b").behaviour(new WaitState())
- .event(Event.NODE_BEGIN)
+ .endFlow()
+ .endNode()
+ .startNode("b", new WaitState())
+ .startEvent(Event.NODE_BEGIN)
.listener(new PrintLn("entering b"))
- .done();
+ .endEvent()
+ .endNode()
+ .endProcess();
ClientExecution execution = processDefinition.startProcessInstance();
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/eventlistener/EventPropagationTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/eventlistener/EventPropagationTest.java 2009-01-08 07:55:33 UTC (rev 3605)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/eventlistener/EventPropagationTest.java 2009-01-08 08:52:58 UTC (rev 3606)
@@ -27,8 +27,9 @@
import org.jbpm.client.ClientExecution;
import org.jbpm.client.ClientProcessDefinition;
import org.jbpm.model.Event;
-import org.jbpm.pvm.display.TestConsole;
-import org.jbpm.pvm.executionmode.object.WaitState;
+import org.jbpm.pvm.activities.DisplaySource;
+import org.jbpm.pvm.activities.TestConsole;
+import org.jbpm.pvm.activities.WaitState;
import org.jbpm.pvm.model.ProcessFactory;
import org.jbpm.test.JbpmTestCase;
Deleted: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/eventlistener/PrintLn.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/eventlistener/PrintLn.java 2009-01-08 07:55:33 UTC (rev 3605)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/eventlistener/PrintLn.java 2009-01-08 08:52:58 UTC (rev 3606)
@@ -1,41 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.eventlistener;
-
-import org.jbpm.listener.EventListener;
-import org.jbpm.listener.EventListenerExecution;
-
-
-public class PrintLn implements EventListener {
-
- private static final long serialVersionUID = 1L;
-
- String message;
-
- public PrintLn(String message) {
- this.message = message;
- }
-
- public void notify(EventListenerExecution execution) throws Exception {
- System.out.println(message);
- }
-}
Deleted: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/execution/BasicProcessExecutionTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/execution/BasicProcessExecutionTest.java 2009-01-08 07:55:33 UTC (rev 3605)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/execution/BasicProcessExecutionTest.java 2009-01-08 08:52:58 UTC (rev 3606)
@@ -1,53 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.execution;
-
-import org.jbpm.client.ClientExecution;
-import org.jbpm.client.ClientProcessDefinition;
-import org.jbpm.pvm.display.Display;
-import org.jbpm.pvm.externalactivity.WaitState;
-import org.jbpm.pvm.model.ProcessFactory;
-import org.jbpm.test.JbpmTestCase;
-
-
-public class BasicProcessExecutionTest extends JbpmTestCase {
-
- public void testBasicProcessExecution() {
- ClientProcessDefinition processDefinition = ProcessFactory.build("loan")
- .node("submit loan request").initial().behaviour(new Display("loan request submitted"))
- .transition().to("evaluate")
- .node("evaluate").behaviour(new WaitState())
- .transition("approve").to("wire money")
- .transition("reject").to("end")
- .node("wire money").behaviour(new Display("wire the money"))
- .transition().to("archive")
- .node("archive").behaviour(new WaitState())
- .transition().to("end")
- .node("end").behaviour(new WaitState())
- .done();
-
- ClientExecution execution = processDefinition.startProcessInstance();
-
-
-
- }
-}
Deleted: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/executionmode/object/AutomaticActivity.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/executionmode/object/AutomaticActivity.java 2009-01-08 07:55:33 UTC (rev 3605)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/executionmode/object/AutomaticActivity.java 2009-01-08 08:52:58 UTC (rev 3606)
@@ -1,37 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.executionmode.object;
-
-import org.jbpm.activity.Activity;
-import org.jbpm.activity.ActivityExecution;
-
-/**
- * @author Tom Baeyens
- */
-public class AutomaticActivity implements Activity {
-
- private static final long serialVersionUID = 1L;
-
- public void execute(ActivityExecution execution) throws Exception {
- }
-
-}
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/executionmode/object/ObjectExecutionModeTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/executionmode/object/ObjectExecutionModeTest.java 2009-01-08 07:55:33 UTC (rev 3605)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/executionmode/object/ObjectExecutionModeTest.java 2009-01-08 08:52:58 UTC (rev 3606)
@@ -25,6 +25,8 @@
import org.jbpm.client.ClientExecution;
import org.jbpm.client.ClientProcessDefinition;
+import org.jbpm.pvm.activities.AutomaticActivity;
+import org.jbpm.pvm.activities.WaitState;
import org.jbpm.pvm.model.ProcessFactory;
Deleted: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/executionmode/object/WaitState.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/executionmode/object/WaitState.java 2009-01-08 07:55:33 UTC (rev 3605)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/executionmode/object/WaitState.java 2009-01-08 08:52:58 UTC (rev 3606)
@@ -1,44 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.executionmode.object;
-
-import java.util.Map;
-
-import org.jbpm.activity.ActivityExecution;
-import org.jbpm.activity.ExternalActivity;
-
-/**
- * @author Tom Baeyens
- */
-public class WaitState implements ExternalActivity {
-
- private static final long serialVersionUID = 1L;
-
- public void execute(ActivityExecution execution) {
- execution.waitForSignal();
- }
-
- public void signal(ActivityExecution execution,
- String signalName,
- Map<String, Object> parameters) {
- }
-}
Added: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/println/PrintlnTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/println/PrintlnTest.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/println/PrintlnTest.java 2009-01-08 08:52:58 UTC (rev 3606)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.println;
+
+import org.jbpm.client.ClientProcessDefinition;
+import org.jbpm.pvm.activities.PrintLnBuilder;
+import org.jbpm.pvm.activities.TestConsoleTestCase;
+import org.jbpm.pvm.builder.ProcessDefinitionBuilder;
+
+public class PrintlnTest extends TestConsoleTestCase {
+
+ public void testHelloWorld() {
+ ClientProcessDefinition processDefinition = ProcessDefinitionBuilder.startProcess()
+ .startNode(PrintLnBuilder.class)
+ .message("print me")
+ .endNode()
+ .endProcess();
+
+ processDefinition.startProcessInstance();
+
+ assertEquals("print me", testConsole.getLine(0));
+ }
+}
Modified: jbpm4/trunk/modules/pvm/src/test/resources/logging.properties
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/resources/logging.properties 2009-01-08 07:55:33 UTC (rev 3605)
+++ jbpm4/trunk/modules/pvm/src/test/resources/logging.properties 2009-01-08 08:52:58 UTC (rev 3606)
@@ -4,7 +4,7 @@
redirect.commons.logging = enabled
-java.util.logging.ConsoleHandler.level = ERROR
+java.util.logging.ConsoleHandler.level = SEVERE
java.util.logging.ConsoleHandler.formatter = org.jbpm.log.LogFormatter
# org.jbpm.util.ErrorTriggeredFileHandler.size = 500
More information about the jbpm-commits
mailing list