1
2
3
4
5
6
7
8
9 package net.kwfgrid.gwes;
10
11 import net.kwfgrid.gwes.exception.*;
12 import net.kwfgrid.gworkflowdl.structure.WorkflowFormatException;
13 import org.apache.log4j.Logger;
14 import junit.framework.Test;
15 import junit.framework.TestSuite;
16 import junit.framework.Assert;
17
18 import java.io.IOException;
19
20
21
22
23
24
25
26
27
28
29
30
31
32 public final class GWES_ResourceMatcherProraterTest extends LocalGWESAbstractTestCase {
33
34
35
36
37 static Logger logger = Logger.getLogger(GWES_ResourceMatcherProraterTest.class);
38
39 private boolean finished;
40
41 static private final long TIMEOUT = 1000L;
42
43 public final String userID;
44
45 GWES gwes;
46
47 String workflowID;
48
49
50
51
52
53
54
55 public GWES_ResourceMatcherProraterTest(String testName) throws LoggingException {
56 super(testName);
57 userID = System.getProperty("user.name");
58 }
59
60
61
62
63 public static Test suite() {
64 return new TestSuite(GWES_ResourceMatcherProraterTest.class);
65 }
66
67
68
69
70 public void testProrater() throws StateTransitionException, IOException, WorkflowFormatException, WorkflowSecurityException, InterruptedException, NoSuchWorkflowException, DatabaseException, LoggingException, GWESException {
71
72 String gworkflowdl = testGWES("examples/programexecution/concatenateIt_20.xml");
73
74 String[] data = gwes.getData(workflowID, "d25-27", userID);
75 Assert.assertEquals("number of Tokens on d25-27", 1, data.length);
76 logger.info("d25-27:\n" + data[0].trim());
77 Assert.assertEquals("d27-27 token", "...", data[0]);
78
79 }
80
81
82
83
84 public void testResourceMatcher() throws StateTransitionException, IOException, WorkflowFormatException, WorkflowSecurityException, InterruptedException, NoSuchWorkflowException, DatabaseException, LoggingException, GWESException {
85
86 String gworkflowdl = testGWES("examples/programexecution/concatenateIt_10.xml");
87
88 logger.info(gworkflowdl);
89
90 }
91
92
93
94
95
96
97
98 private String testGWES(String gworkflowdlPath) throws StateTransitionException, WorkflowFormatException, WorkflowSecurityException, NoSuchWorkflowException, InterruptedException, IOException, DatabaseException, LoggingException, GWESException {
99 String retGWorkflowDL = null;
100
101 gwes = new GWESEngine();
102
103 workflowID = gwes.initiate(readfile(gworkflowdlPath), userID);
104 logger.debug("workflowID: " + workflowID);
105 gwes.start(workflowID, userID);
106
107 waitWorkflowStatus(gwes, workflowID);
108
109 retGWorkflowDL = gwes.getWorkflowDescription(workflowID, userID);
110 logger.debug("\n" + retGWorkflowDL);
111
112 return retGWorkflowDL;
113 }
114
115 }