[jbpm-commits] JBoss JBPM SVN: r5090 - in jbpm4/branches/jimma/modules/migration/src: main/java/org/jbpm/jpdl/internal/convert/action and 3 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Tue Jun 23 06:15:16 EDT 2009
Author: jim.ma
Date: 2009-06-23 06:15:15 -0400 (Tue, 23 Jun 2009)
New Revision: 5090
Added:
jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/action/CreateTimerAction.java
Modified:
jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/Jpdl3ConverterReader.java
jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/action/Script.java
jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/node/Fork.java
jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/node/Node.java
jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/node/StartState.java
jbpm4/branches/jimma/modules/migration/src/main/resources/action.converter.types.xml
jbpm4/branches/jimma/modules/migration/src/test/java/org/jbpm/jpdl/internal/convert/Jpdl3ConverterReaderTest.java
Log:
Added timer conversion and node Async attribute conversion
Modified: jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/Jpdl3ConverterReader.java
===================================================================
--- jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/Jpdl3ConverterReader.java 2009-06-23 10:08:08 UTC (rev 5089)
+++ jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/Jpdl3ConverterReader.java 2009-06-23 10:15:15 UTC (rev 5090)
@@ -26,7 +26,6 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
-import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
@@ -40,6 +39,7 @@
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.jbpm.jpdl.internal.convert.action.Action;
+import org.jbpm.jpdl.internal.convert.action.CreateTimerAction;
import org.jbpm.jpdl.internal.convert.node.Node;
import org.jbpm.jpdl.internal.convert.node.StartState;
import org.jbpm.jpdl.internal.convert.node.TaskNode;
@@ -159,24 +159,25 @@
// read the process name
parseProcessDefinitionAttributes(root, jpdl4Document);
+ Element jpdl4Element = jpdl4Document.getRootElement();
// get the process description
String description = root.elementTextTrim("description");
if (description != null)
{
- jpdl4Document.getRootElement().addComment(description);
+ jpdl4Element.addComment(description);
}
// first pass: read most content
- readSwimlanes(root, jpdl4Document.getRootElement());
+ readSwimlanes(root, jpdl4Element);
readActions(root, null, null);
- readNodes(root, jpdl4Document.getRootElement());
+ readNodes(root, jpdl4Element);
- readEvents(root, jpdl4Document.getRootElement());
- /*
- readExceptionHandlers(root, jpdl4Document);
- */
- readTasks(root, jpdl4Document.getRootElement());
+ readEvents(root, jpdl4Element);
+
+ readExceptionHandlers(root, jpdl4Element);
+ readTasks(root, jpdl4Element);
+
// second pass processing
resolveTransitionDestinations();
resolveActionReferences();
@@ -204,7 +205,7 @@
return jpdl4Document;
}
- //DONE!
+
protected Element parseProcessDefinitionAttributes(Element root, Document doc)
{
@@ -355,62 +356,59 @@
}
// get the condition
- //TODO: Revisit it to see when the this will be invoked and how to
- /*String condition = taskElement.elementTextTrim("condition");
- if (condition != null)
- {
- task.setCondition(condition);
+
+ String condition = taskElement.elementTextTrim("condition");
+ if (condition == null) {
+ condition = taskElement.attributeValue("condition");
+ }
+ if (condition == null) {
+ //TODO: Unsupported condition
+ addWarning("Unsupported condition attribute converstion for task : " + taskElement.asXML());
}
- else
- {
- task.setCondition(taskElement.attributeValue("condition"));
- }*/
-
+
// parse common subelements
- //TODO: convert the task timer
- //readTaskTimers(taskElement, task);
+ readTaskTimers(taskElement, jpdlElement);
readEvents(taskElement, jpdlElement);
- //readExceptionHandlers(taskElement, task);
+ readExceptionHandlers(taskElement, jpdlElement);
- // TODO:duedate and priority
- /*String duedateText = taskElement.attributeValue("duedate");
+
+ String duedateText = taskElement.attributeValue("duedate");
if (duedateText == null)
{
duedateText = taskElement.attributeValue("dueDate");
}
- task.setDueDate(duedateText);
+
+ if (duedateText != null) {
+ //TODO: Unsupported duedateText
+ addWarning("Unsupported duedateText attribute converstion for task : " + taskElement.asXML());
+ }
+
+
String priorityText = taskElement.attributeValue("priority");
if (priorityText != null)
{
- task.setPriority(Task.parsePriority(priorityText));
+ //TODO: Unsupported priorityText
+ addWarning("Unsupported priorityText attribute converstion for task : " + taskElement.asXML());
+
}
- // if this task is in the context of a taskNode, associate them
- if (taskNode != null)
- {
- taskNode.addTask(task);
- }
-*/
- // TODO: blocking
- /* String blockingText = taskElement.attributeValue("blocking");
+
+ String blockingText = taskElement.attributeValue("blocking");
if (blockingText != null)
{
- if (("true".equalsIgnoreCase(blockingText)) || ("yes".equalsIgnoreCase(blockingText)) || ("on".equalsIgnoreCase(blockingText)))
- {
- task.setBlocking(true);
- }
- }*/
+ //TODO: Unsupported blockingText
+ addWarning("Unsupported blocking attribute converstion for task : " + taskElement.asXML());
- //TODO: signalling
- /*String signallingText = taskElement.attributeValue("signalling");
+ }
+
+ String signallingText = taskElement.attributeValue("signalling");
if (signallingText != null)
{
- if (("false".equalsIgnoreCase(signallingText)) || ("no".equalsIgnoreCase(signallingText)) || ("off".equalsIgnoreCase(signallingText)))
- {
- task.setSignalling(false);
- }
- }*/
+ //TODO: Unsupported signalling
+ addWarning("Unsupported signallingText attribute converstion for task : " + taskElement.asXML());
+ }
+
// assignment
String swimlaneName = taskElement.attributeValue("swimlane");
Element assignmentElement = taskElement.element("assignment");
@@ -457,31 +455,20 @@
log.info("process xml information: no swimlane or assignment specified for task '" + taskElement.asXML() + "'");
}
- //TODO:notify
- /*String notificationsText = taskElement.attributeValue("notify");
+ String notificationsText = taskElement.attributeValue("notify");
if (notificationsText != null
&& ("true".equalsIgnoreCase(notificationsText) || "on".equalsIgnoreCase(notificationsText) || "yes".equalsIgnoreCase(notificationsText)))
{
- String notificationEvent = Event.EVENTTYPE_TASK_ASSIGN;
- Event event = task.getEvent(notificationEvent);
- if (event == null)
- {
- event = new Event(notificationEvent);
- task.addEvent(event);
- }
- Delegation delegation = createMailDelegation(notificationEvent, null, null, null, null);
- Action action = new Action(delegation);
- action.setProcessDefinition(processDefinition);
- action.setName(task.getName());
- event.addAction(action);
- }*/
+ //TODO: Unsupported controller
+ addWarning("Unsupported notify converstion for task : " + taskElement.asXML());
+ }
- //TODO: task controller
-/* Element taskControllerElement = taskElement.element("controller");
+ Element taskControllerElement = taskElement.element("controller");
if (taskControllerElement != null)
{
- task.setTaskController(readTaskController(taskControllerElement));
- }*/
+ //TODO: Unsupported controller
+ addWarning("Unsupported controller converstion for task : " + taskElement.asXML());
+ }
return task4;
}
@@ -562,23 +549,22 @@
jpdl4Element.addComment(description);
}
- //TODO:Convert Async
-/* String asyncText = nodeElement.attributeValue("async");
+ String asyncText = nodeElement.attributeValue("async");
if ("true".equalsIgnoreCase(asyncText))
{
- node.setAsync(true);
+ jpdl4Element.addAttribute("asyn", "true");
}
else if ("exclusive".equalsIgnoreCase(asyncText))
{
- node.setAsync(true);
- node.setAsyncExclusive(true);
+ jpdl4Element.addAttribute("asyn", "exclusive");
}
-*/
+
// parse common subelements
+
readNodeTimers(nodeElement, jpdl4Element);
readEvents(nodeElement, jpdl4Element);
- //readExceptionHandlers(nodeElement, jpdl4Element);
+ readExceptionHandlers(nodeElement, jpdl4Element);
// save the transitions and parse them at the end
addUnresolvedTransitionDestination(nodeElement, jpdl4Element);
@@ -596,40 +582,117 @@
protected void readNodeTimer(Element timerElement, Element jpdl4Element)
{
- //TODO: convert node timer ...
+ String name = timerElement.attributeValue("name", timerElement.getName());
+ if (name == null)
+ name = generateTimerName();
+
+ CreateTimerAction createTimerAction = new CreateTimerAction();
+ Element onElement = jpdl4Element.addElement("on");
+ onElement.addAttribute("event", "timeout");
+ createTimerAction.createConvertedElement(timerElement, onElement);
+ createTimerAction.read(timerElement, this);
+
+ //TODO: investigate if there is equivalent cancel timer action in jpdl4...
+ /*CancelTimerAction cancelTimerAction = instantiateCancelTimerAction();
+ cancelTimerAction.setTimerName(name);
+ addAction(node, Event.EVENTTYPE_NODE_LEAVE, cancelTimerAction);*/
}
-
- //* instantiate {@link CreateTimerAction} object from configured class in action.types.xml (if configured). If not the default jbpm class is used.
-
-/* private CreateTimerAction instantiateCreateTimerAction()
- {
-
- }*/
-
-
- //instantiate {@link CancelTimerAction} object from configured class in action.types.xml (if configured). If not the default jbpm class is used.*/
-
- /* private CancelTimerAction instantiateCancelTimerAction()
- {
- }*/
-
private String generateTimerName()
{
return "timer-" + (timerNumber++);
}
-/*
- protected void readTaskTimers(Element taskElement, Task task)
+
+ protected void readTaskTimers(Element taskElement, Element jdpl4Element)
{
+ Iterator<?> iter = taskElement.elementIterator();
+ while (iter.hasNext())
+ {
+ Element element = (Element)iter.next();
+ if (("timer".equals(element.getName())) || ("reminder".equals(element.getName())))
+ {
+ readTaskTimer(element, jdpl4Element);
+ }
+ }
}
- protected void readTaskTimer(Element timerElement, Task task)
+ protected void readTaskTimer(Element timerElement, Element jpdl4Element)
{
+ if ("timer".equals(timerElement.getName()))
+ {
+ String name = timerElement.attributeValue("name", timerElement.getName());
+ if (name == null)
+ name = generateTimerName();
+ Element onEle = jpdl4Element.addElement("on");
+ onEle.addAttribute("event", "timeout");
+ Element timer = jpdl4Element.addElement("timer");
+
+ String dueDate = timerElement.attributeValue("duedate");
+ if (dueDate==null) {
+ addWarning("no duedate specified in create timer action '"+ timerElement.asXML()+"'");
+ } else {
+ timer.addAttribute("duedate", dueDate);
+ }
+ String repeat = timerElement.attributeValue("repeat");
+ if ( "true".equalsIgnoreCase(repeat)
+ || "yes".equalsIgnoreCase(repeat) ) {
+ repeat = dueDate;
+ }
+
+ timer.addAttribute("repeat", repeat);
+
+ String transitionName = timerElement.attributeValue("transition");
+
+ if ( (transitionName!=null)
+ && (repeat!=null)
+ ) {
+ repeat = null;
+ addProblem(new Problem(Problem.LEVEL_WARNING, "ignoring repeat on timer with transition "+ timerElement.asXML()));
+ }
+
+ timer.addAttribute("duedata", dueDate);
+ this.readSingleAction(timerElement, timer);
+ }
+ else
+ {
+ //TODO:Create mail node for <task-reminder> element
+
+ }
+
+ //TODO: handle createTimerAction and cancelTimerAction
+ /*createTimerAction.setTimerAction(action);
+ addAction(task, Event.EVENTTYPE_TASK_CREATE, createTimerAction);
+
+ // read the cancel-event types
+ Collection<String> cancelEventTypes = new ArrayList<String>();
+
+ String cancelEventTypeText = timerElement.attributeValue("cancel-event");
+ if (cancelEventTypeText != null)
+ {
+ // cancel-event is a comma separated list of events
+ StringTokenizer tokenizer = new StringTokenizer(cancelEventTypeText, ",");
+ while (tokenizer.hasMoreTokens())
+ {
+ cancelEventTypes.add(tokenizer.nextToken().trim());
+ }
+ }
+ else
+ {
+ // set the default
+ cancelEventTypes.add(Event.EVENTTYPE_TASK_END);
+ }
+
+ for (String cancelEventType : cancelEventTypes)
+ {
+ CancelTimerAction cancelTimerAction = instantiateCancelTimerAction();
+ cancelTimerAction.setTimerName(name);
+ addAction(task, cancelEventType, cancelTimerAction);
+ }*/
}
- */
+
public void readEvents(Element parentElement, Element jpdl4Element)
{
- Iterator<?> iter = parentElement.elementIterator("event");
+ Iterator<?> iter = parentElement.elementIterator("event");
while (iter.hasNext())
{
Element eventElement = (Element)iter.next();
@@ -655,30 +718,26 @@
if (ActionConverterTypes.hasActionName(actionName))
{
Element action4 = createAction(actionElement, jpdl4Element);
- /*if ((graphElement != null) && (eventType != null))
- {
- // add the action to the event
- addAction(graphElement, eventType, action);
- }*/
+
}
}
}
- /*
- protected void addAction(GraphElement graphElement, String eventType, Action action)
+
+ public Element readSingleAction(Element nodeElement, Element jpdl4Element)
{
- Event event = graphElement.getEvent(eventType);
- if (event == null)
+ Element jpdl4Action = null;
+ Iterator<?> iter = nodeElement.elementIterator();
+ while (iter.hasNext())
{
- event = new Event(eventType);
- graphElement.addEvent(event);
+ Element candidate = (Element)iter.next();
+ if (ActionConverterTypes.hasActionName(candidate.getName()))
+ {
+ // parse the action and assign it to this node
+ jpdl4Action = createAction(candidate, jpdl4Element);
+ }
}
- event.addAction(action);
- }*/
-
-
- public Element readSingleAction(Element nodeElement)
- {
- return null;
+ return jpdl4Action;
+
}
public Element createAction(Element actionElement, Element jpdl4Element)
@@ -696,20 +755,18 @@
log.error("couldn't instantiate action '" + actionName + "', of type '" + actionType.getName() + "'", e);
}
- // read the common node parts of the action
Element action4 = action.createConvertedElement(actionElement, jpdl4Element);
- //Remove readAction cause there is no need to read the common thing for jpdl4 script or java element
- //readAction(actionElement, action4, action);
action.read(actionElement, this);
return action4;
}
-/*
- protected void readExceptionHandlers(Element graphElementElement, GraphElement graphElement)
+
+ protected void readExceptionHandlers(Element graphElement, Element jpdl4Element)
{
- //
+ this.addWarning("Unsupported exception handler conversion for element : <" + graphElement.getName()
+ + "name=" + graphElement.attributeValue("name") + "/>" );
}
-
+/*
protected void readExceptionHandler(Element exceptionHandlerElement, GraphElement graphElement)
{
// create the exception handler
@@ -782,9 +839,7 @@
addWarning("node '" + transitionElement.getPath() + "' has a transition without a 'to'-attribute to specify its destinationNode");
}
else
- {
- //TODO: Add the function to check if the transistion node exists
-
+ {
Element to = this.findNode(toName);
if (to == null)
{
@@ -797,7 +852,7 @@
// read the actions
readActions(transitionElement, transition4, "");
- //readExceptionHandlers(transitionElement, transition);
+ readExceptionHandlers(transitionElement, transition4);
}
// action references are parsed in a second pass ////////////////////////////
Added: jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/action/CreateTimerAction.java
===================================================================
--- jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/action/CreateTimerAction.java (rev 0)
+++ jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/action/CreateTimerAction.java 2009-06-23 10:15:15 UTC (rev 5090)
@@ -0,0 +1,68 @@
+/*
+ * 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.internal.convert.action;
+
+import org.dom4j.Element;
+import org.jbpm.jpdl.internal.convert.Jpdl3ConverterReader;
+import org.jbpm.jpdl.internal.convert.Problem;
+
+public class CreateTimerAction extends Action {
+ @Override
+ public Element createConvertedElement(Element actionElement,
+ Element jpdl4Doc) {
+ this.convertedElement = jpdl4Doc.addElement("timer");
+ return convertedElement;
+ }
+
+ @Override
+ public void read(Element actionElement, Jpdl3ConverterReader jpdlReader) {
+
+ Element timerAction = jpdlReader.readSingleAction(actionElement, this.convertedElement);
+
+ String dueDate = actionElement.attributeValue("duedate");
+ if (dueDate == null) {
+ jpdlReader
+ .addWarning("no duedate specified in create timer action '"
+ + actionElement + "'");
+ } else {
+ convertedElement.addAttribute("duedate", dueDate);
+ }
+ String repeat = actionElement.attributeValue("repeat");
+ if ("true".equalsIgnoreCase(repeat) || "yes".equalsIgnoreCase(repeat)) {
+ repeat = dueDate;
+ }
+
+ if (repeat != null) {
+ convertedElement.addAttribute("repeat", repeat);
+ }
+
+ String transitionName = actionElement.attributeValue("transition");
+
+ if ((transitionName != null) && (repeat != null)) {
+ repeat = null;
+ jpdlReader.addProblem(new Problem(Problem.LEVEL_WARNING,
+ "ignoring repeat on timer with transition "
+ + actionElement.asXML()));
+ }
+ //TODO: Investigate how to convert transition attribute
+ }
+}
Modified: jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/action/Script.java
===================================================================
--- jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/action/Script.java 2009-06-23 10:08:08 UTC (rev 5089)
+++ jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/action/Script.java 2009-06-23 10:15:15 UTC (rev 5090)
@@ -25,27 +25,6 @@
import org.jbpm.jpdl.internal.convert.Jpdl3ConverterReader;
public class Script extends Action {
- @Override
- public Element createConvertedElement(Element actionElement,
- Element jpdl4Doc) {
- convertedElement = jpdl4Doc.addElement("script");
- return convertedElement;
- }
+
- @Override
- public void read(Element actionElement, Jpdl3ConverterReader jpdlReader) {
- String expression = null;
- if (actionElement.isTextOnly()) {
- expression = actionElement.getText();
- } else {
- /*
- * this.variableAccesses = new HashSet<VariableAccess>(
- * jpdlReader.readVariableAccesses(scriptElement));
- */
- expression = actionElement.element("expression").getText();
- }
- Element txtElement = convertedElement.addElement("text");
- txtElement.addText(expression);
- }
-
}
Modified: jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/node/Fork.java
===================================================================
--- jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/node/Fork.java 2009-06-23 10:08:08 UTC (rev 5089)
+++ jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/node/Fork.java 2009-06-23 10:15:15 UTC (rev 5090)
@@ -32,12 +32,6 @@
}
public void read(Jpdl3ConverterReader reader) {
- /*Element startTaskElement = nodeElement.element("task");
- if (startTaskElement!=null) {
- reader.addWarning("Unsupported start task conversion");
- // delegate the parsing of the start-state task to the jpdlReader
- //reader.readStartStateTask(startTaskElement, this);
- }*/
}
}
Modified: jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/node/Node.java
===================================================================
--- jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/node/Node.java 2009-06-23 10:08:08 UTC (rev 5089)
+++ jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/node/Node.java 2009-06-23 10:15:15 UTC (rev 5090)
@@ -36,7 +36,6 @@
}
public void read(Jpdl3ConverterReader reader) {
- //TODO:implement it
Element actionElement = nodeElement.element("action");
action.read(actionElement, reader);
Modified: jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/node/StartState.java
===================================================================
--- jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/node/StartState.java 2009-06-23 10:08:08 UTC (rev 5089)
+++ jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/node/StartState.java 2009-06-23 10:15:15 UTC (rev 5090)
@@ -35,8 +35,6 @@
Element startTaskElement = nodeElement.element("task");
if (startTaskElement!=null) {
reader.addWarning("Unsupported start task conversion");
- // delegate the parsing of the start-state task to the jpdlReader
- //reader.readStartStateTask(startTaskElement, this);
}
}
Modified: jbpm4/branches/jimma/modules/migration/src/main/resources/action.converter.types.xml
===================================================================
--- jbpm4/branches/jimma/modules/migration/src/main/resources/action.converter.types.xml 2009-06-23 10:08:08 UTC (rev 5089)
+++ jbpm4/branches/jimma/modules/migration/src/main/resources/action.converter.types.xml 2009-06-23 10:15:15 UTC (rev 5090)
@@ -1,6 +1,6 @@
<action-types>
<action-type element="action" class="org.jbpm.jpdl.internal.convert.action.Action" />
- <action-type element="create-timer" class="org.jbpm.scheduler.def.CreateTimerAction" />
+ <action-type element="create-timer" class="org.jbpm.jpdl.internal.convert.action.CreateTimerAction" />
<action-type element="cancel-timer" class="org.jbpm.scheduler.def.CancelTimerAction" />
<action-type element="script" class="org.jbpm.jpdl.internal.convert.action.Script" />
<action-type element="mail" class="org.jbpm.graph.action.MailAction" />
Modified: jbpm4/branches/jimma/modules/migration/src/test/java/org/jbpm/jpdl/internal/convert/Jpdl3ConverterReaderTest.java
===================================================================
--- jbpm4/branches/jimma/modules/migration/src/test/java/org/jbpm/jpdl/internal/convert/Jpdl3ConverterReaderTest.java 2009-06-23 10:08:08 UTC (rev 5089)
+++ jbpm4/branches/jimma/modules/migration/src/test/java/org/jbpm/jpdl/internal/convert/Jpdl3ConverterReaderTest.java 2009-06-23 10:15:15 UTC (rev 5090)
@@ -30,6 +30,7 @@
import org.jbpm.jpdl.internal.xml.JpdlParser;
import org.jbpm.pvm.internal.cfg.JbpmConfiguration;
import org.junit.Assert;
+import org.junit.Ignore;
import org.junit.Test;
import org.xml.sax.InputSource;
@@ -39,7 +40,7 @@
testConvert("simple.xml");
}
- @Test
+ @Ignore
public void testBusinessTrip() throws Exception {
testConvert("businesstrip.xml");
}
@@ -54,20 +55,41 @@
setUpScriptManager();
testConvert("process-event.xml");
}
+
+ @Test
+ public void testDescision() throws Exception {
+ testConvert("testDecision.xml");
+ }
+ @Test
+ public void testTimer() throws Exception {
+ String xml = convert("timer.xml");
+ List<Problem> problems = new JpdlParser().createParse().setString(xml).execute().getProblems();
+ Assert.assertEquals(2, problems.size());
+ Assert.assertTrue(problems.get(0).getMsg().startsWith("unrecognized event listener"));
+ Assert.assertTrue(problems.get(1).getMsg().startsWith("unrecognized event listener"));
+ }
private void testConvert(String resourcefile) throws Exception {
- InputStream inputStream = getClass().getClassLoader().getResourceAsStream(resourcefile);
+ String xml = convert(resourcefile);
+ List<Problem> problems = new JpdlParser().createParse().setString(xml).execute().getProblems();
+ Assert.assertEquals(problems.toString(), 0, problems.size());
+ }
+
+
+ private String convert(String resouceFile) throws Exception {
+ InputStream inputStream = getClass().getClassLoader().getResourceAsStream(resouceFile);
//Convert to process file to jpdl4
InputSource ins = new InputSource(inputStream);
Jpdl3ConverterReader converter = new Jpdl3ConverterReader(ins);
Document doc = converter.readAndConvert();
- //System.out.println(doc.asXML());
-
- List<Problem> problems = new JpdlParser().createParse().setString(doc.asXML()).execute().getProblems();
- Assert.assertEquals(problems.toString(), 0, problems.size());
+ return doc.asXML();
}
+
+ private String format(String test) {
+
+ }
private void setUpScriptManager() throws Exception {
EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString("<jbpm-configuration>"
More information about the jbpm-commits
mailing list