Commits

hani  committed 3931f24

Extra test for multiple text elements in an arg

  • Participants
  • Parent commits e8b09de

Comments (0)

Files changed (3)

File src/test/com/opensymphony/workflow/DescriptorQuirksTestCase.java

     }
 
     /**
+     * Test if comments in args are correctly ignored.
+     * @see <a href="http://jira.opensymphony.com/secure/ViewIssue.jspa?key=WF-178">Jira issue WF-178</a>
+     * @throws Exception If error while executing testing
+     */
+    public void testArgMultiText() throws Exception {
+        counter = 0;
+
+        Map inputs = new HashMap();
+        inputs.put("test", this);
+
+        URL resource = getClass().getResource("/samples/multitext-arg.xml");
+        long id = workflow.initialize(resource.toString(), 1, inputs);
+        assertEquals("beanshell script not parsed correctly", 2, counter);
+    }
+
+    /**
      * Test if functions are executed once in an unconditional-result
      * @see <a href="http://jira.opensymphony.com/secure/ViewIssue.jspa?key=WF-118">Jira issue WF-118</a>
      * @throws Exception If error while executing testing

File src/test/com/opensymphony/workflow/util/beanshell/BeanShellFunctionProviderTestCase.java

      * exception location of the script instead.
      *
      * What I want somewhere:
+     * <pre>
      * java.lang.NullPointerException
-    at com.opensymphony.module.propertyset.database.JDBCPropertySet.setImpl(JDBCPropertySet.java:267)
-    at com.opensymphony.module.propertyset.AbstractPropertySet.set(AbstractPropertySet.java:565)
-    at com.opensymphony.module.propertyset.AbstractPropertySet.setString(AbstractPropertySet.java:363)
-    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
-    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
-    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
-    at java.lang.reflect.Method.invoke(Method.java:324)
-    at bsh.Reflect.invokeMethod(Unknown Source)
-    at bsh.Reflect.invokeObjectMethod(Unknown Source)
-    at bsh.Name.invokeMethod(Unknown Source)
-    at bsh.BSHMethodInvocation.eval(Unknown Source)
+     * at com.opensymphony.module.propertyset.database.JDBCPropertySet.setImpl(JDBCPropertySet.java:267)
+     * at com.opensymphony.module.propertyset.AbstractPropertySet.set(AbstractPropertySet.java:565)
+     * at com.opensymphony.module.propertyset.AbstractPropertySet.setString(AbstractPropertySet.java:363)
+     * at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
+     * at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
+     * at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
+     * at java.lang.reflect.Method.invoke(Method.java:324)
+     * at bsh.Reflect.invokeMethod(Unknown Source)
+     * at bsh.Reflect.invokeObjectMethod(Unknown Source)
+     * at bsh.Name.invokeMethod(Unknown Source)
+     * at bsh.BSHMethodInvocation.eval(Unknown Source)
+     </pre>
      *
      */
     public void testThrowingException() throws Exception {
-        Configuration config = new DefaultConfiguration();
-        config.load(getClass().getResource("/osworkflow-jdbc.xml"));
-
-        Workflow workflow = new BasicWorkflow("test");
-        workflow.setConfiguration(config);
-
-        // long workflowId = workflow.initialize(getClass().getResource("/example.xml").toString(), 1, new HashMap());
         BeanShellFunctionProvider function = new BeanShellFunctionProvider();
         PropertySet ps = new JDBCPropertySet();
         Map transientVars = new HashMap();

File src/test/samples/multitext-arg.xml

+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE workflow PUBLIC "-//OpenSymphony Group//DTD OSWorkflow 2.6//EN" "http://www.opensymphony.com/osworkflow/workflow_2_6.dtd">
+<workflow>
+  <initial-actions>
+    <action id="1" name="Start Workflow">
+      <pre-functions>
+        <function type="class">
+          <arg name="class.name">com.opensymphony.workflow.util.Caller</arg>
+        </function>
+        <function type="beanshell">
+          <arg name="script">
+            <![CDATA[
+                    com.opensymphony.workflow.DescriptorQuirksTestCase test = transientVars.get("test");
+                    test.counter++;
+                    test.counter++;
+                    ]]>
+          </arg>
+        </function>
+      </pre-functions>
+      <results>
+        <unconditional-result old-status="Finished" status="Underway" step="1" owner="${caller}"/>
+      </results>
+    </action>
+  </initial-actions>
+  <steps>
+    <step id="1" name="First Step">
+      <actions>
+        <action id="2" name="The first action">
+          <results>
+            <unconditional-result old-status="Finished" status="Finished" step="1"/>
+          </results>
+        </action>
+      </actions>
+    </step>
+  </steps>
+</workflow>
+