1
2
3
4
5
6
7
8
9 package net.kwfgrid.gwes;
10
11 import junit.framework.Assert;
12 import junit.framework.Test;
13 import junit.framework.TestSuite;
14 import net.kwfgrid.gwes.exception.*;
15 import org.apache.log4j.Logger;
16 import org.jdom.JDOMException;
17 import org.jdom.Element;
18 import org.jaxen.JaxenException;
19
20 import java.io.*;
21 import java.util.List;
22
23 import net.kwfgrid.gworkflowdl.structure.WorkflowFormatException;
24
25
26
27
28
29
30
31
32
33
34
35 public final class GWES_HierarchicalTest extends LocalGWESAbstractTestCase {
36
37
38
39
40 static Logger logger = Logger.getLogger(GWES_HierarchicalTest.class);
41
42
43
44
45
46
47 public GWES_HierarchicalTest(String testName) throws LoggingException {
48 super(testName);
49 }
50
51
52
53
54 public static Test suite() {
55 return new TestSuite(GWES_HierarchicalTest.class);
56 }
57
58
59
60
61
62
63 public void testHierarchicalWorkflow() throws InterruptedException, IOException, WorkflowFormatException, NoSuchWorkflowException, DatabaseException, StateTransitionException, JaxenException, JDOMException, WorkflowSecurityException, LoggingException, GWESException {
64 String gworkflowdl = testGWES("examples/linuxtoolbox/gworkflowdl_hierarchical.xml", WorkflowStatus.STATUS_COMPLETED);
65
66
67 String sequence = extractOccurrenceSequence(gworkflowdl);
68 Assert.assertEquals("Occurrence sequence", "workflowInititate workflowStart wait workflowGetData", sequence);
69
70
71 List tokens = extractTokenChildElements(gworkflowdl);
72 Assert.assertEquals(1, tokens.size());
73
74 List array = ((Element) tokens.get(0)).getChild("getDataReturn").getChildren();
75
76 String returnS = ((Element) array.get(0)).getText();
77 Assert.assertTrue(returnS.matches("(?s).*:long.*1.*"));
78
79 String[] data = gwes.getData(workflowID, "end", userID);
80 logger.info("end:\n"+data[0].trim());
81 }
82
83 }