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 net.kwfgrid.gworkflowdl.structure.WorkflowFormatException;
16 import org.apache.log4j.Logger;
17 import org.jaxen.JaxenException;
18 import org.jdom.JDOMException;
19
20 import java.io.IOException;
21 import java.util.List;
22
23
24
25
26
27
28
29
30
31
32 public final class GWESPatternsTest extends LocalGWESAbstractTestCase {
33
34 static Logger logger = Logger.getLogger(GWESPatternsTest.class);
35
36
37
38
39
40
41 public GWESPatternsTest(String testName) throws LoggingException {
42 super(testName);
43 }
44
45
46
47
48 public static Test suite() {
49 return new TestSuite(GWESPatternsTest.class);
50 }
51
52
53
54
55 public void testSequence() throws JaxenException, IOException, JDOMException, NoSuchWorkflowException, WorkflowSecurityException, StateTransitionException, WorkflowFormatException, InterruptedException, DatabaseException, LoggingException, GWESException {
56 String gworkflowdl = testGWES("examples/patterns/sequence.gwdl", WorkflowStatus.STATUS_COMPLETED);
57
58
59
60 String sequence = extractOccurrenceSequence(gworkflowdl);
61 Assert.assertEquals("Occurrence sequence", "A B",sequence);
62
63
64 List tokens = extractTokenChildElements(gworkflowdl);
65 Assert.assertEquals("Number of Tokens", 1, tokens.size());
66
67 String[] endB = gwes.getData(workflowID, "end_B", userID);
68 logger.info("end_B[0]:\n" + endB[0]);
69 Assert.assertEquals("Number of Tokens on end_B", 1, endB.length);
70 Assert.assertEquals("end_B[0]", "<data xmlns=\"http://www.gridworkflow.org/gworkflowdl\">\r\n" +
71 " <string xmlns=\"\">a_out and b_out</string>\r\n" +
72 "</data>", endB[0]);
73 }
74
75
76
77
78 public void testParallelSplit() throws JaxenException, IOException, JDOMException, NoSuchWorkflowException, WorkflowSecurityException, StateTransitionException, WorkflowFormatException, InterruptedException, DatabaseException, LoggingException, GWESException {
79 String gworkflowdl = testGWES("examples/patterns/parallel-split.gwdl", WorkflowStatus.STATUS_COMPLETED);
80
81
82
83 String sequence = extractOccurrenceSequence(gworkflowdl);
84 Assert.assertEquals("Occurrence sequence", "AND_Split A B",sequence);
85
86
87 List tokens = extractTokenChildElements(gworkflowdl);
88 Assert.assertEquals("Number of token child elements", 2, tokens.size());
89
90 String[] endA = gwes.getData(workflowID, "end_A", userID);
91 logger.info("end_A[0]:\n" + endA[0]);
92 Assert.assertEquals("Number of Tokens on end_A", 1, endA.length);
93 Assert.assertEquals("end_A[0]", "<data xmlns=\"http://www.gridworkflow.org/gworkflowdl\">\r\n" +
94 " <string xmlns=\"\">a_out</string>\r\n" +
95 "</data>", endA[0]);
96
97 String[] endB = gwes.getData(workflowID, "end_B", userID);
98 logger.info("end_B[0]:\n" + endB[0]);
99 Assert.assertEquals("Number of Tokens on end_B", 1, endB.length);
100 Assert.assertEquals("end_B[0]", "<data xmlns=\"http://www.gridworkflow.org/gworkflowdl\">\r\n" +
101 " <string xmlns=\"\">b_out</string>\r\n" +
102 "</data>", endB[0]);
103 }
104
105
106
107
108 public void testSynchronization() throws JaxenException, IOException, JDOMException, NoSuchWorkflowException, WorkflowSecurityException, StateTransitionException, WorkflowFormatException, InterruptedException, DatabaseException, LoggingException, GWESException {
109 String gworkflowdl = testGWES("examples/patterns/synchronization.gwdl", WorkflowStatus.STATUS_COMPLETED);
110
111
112
113 String sequence = extractOccurrenceSequence(gworkflowdl);
114 Assert.assertEquals("Occurrence sequence", "A B AND_Join",sequence);
115
116
117 List tokens = extractTokenChildElements(gworkflowdl);
118 Assert.assertEquals("Number of Tokens", 1, tokens.size());
119
120 String[] end = gwes.getData(workflowID, "end", userID);
121 logger.info("end[0]:\n" + end[0]);
122 Assert.assertEquals("Number of Tokens on end", 1, end.length);
123 Assert.assertEquals("end[0]", "<data xmlns=\"http://www.gridworkflow.org/gworkflowdl\">\r\n" +
124 " <a xmlns=\"\">a_out</a>\r\n" +
125 " <b xmlns=\"\">b_out</b>\r\n" +
126 "</data>", end[0]);
127 }
128
129
130
131
132 public void testExclusiveChoice() throws JaxenException, IOException, JDOMException, NoSuchWorkflowException, WorkflowSecurityException, StateTransitionException, WorkflowFormatException, InterruptedException, DatabaseException, LoggingException, GWESException {
133 String gworkflowdl = testGWES("examples/patterns/exclusive-choice.gwdl", WorkflowStatus.STATUS_COMPLETED);
134
135
136
137 String sequence = extractOccurrenceSequence(gworkflowdl);
138 Assert.assertEquals("Occurrence sequence", "A",sequence);
139
140
141 List tokens = extractTokenChildElements(gworkflowdl);
142 Assert.assertEquals("Number of Tokens", 1, tokens.size());
143
144 String[] endA = gwes.getData(workflowID, "end_A", userID);
145 logger.info("end_A[0]:\n" + endA[0]);
146 Assert.assertEquals("Number of Tokens on end_A", 1, endA.length);
147 Assert.assertEquals("end_A[0]", "<data xmlns=\"http://www.gridworkflow.org/gworkflowdl\">\r\n" +
148 " <string xmlns=\"\">a_out</string>\r\n" +
149 "</data>", endA[0]);
150
151 String[] endB = gwes.getData(workflowID, "end_B", userID);
152 Assert.assertEquals("Number of Tokens on end_B", 0, endB.length);
153 }
154
155
156
157
158 public void testSimpleMerge() throws JaxenException, IOException, JDOMException, NoSuchWorkflowException, WorkflowSecurityException, StateTransitionException, WorkflowFormatException, InterruptedException, DatabaseException, LoggingException, GWESException {
159 String gworkflowdl = testGWES("examples/patterns/simple-merge.gwdl", WorkflowStatus.STATUS_COMPLETED);
160
161
162
163 String sequence = extractOccurrenceSequence(gworkflowdl);
164 Assert.assertEquals("Occurrence sequence", "A C",sequence);
165
166
167 List tokens = extractTokenChildElements(gworkflowdl);
168 Assert.assertEquals("Number of Tokens", 1, tokens.size());
169
170 String[] endC = gwes.getData(workflowID, "end_C", userID);
171 logger.info("end_C[0]:\n" + endC[0]);
172 Assert.assertEquals("Number of Tokens on end_C", 1, endC.length);
173 Assert.assertEquals("end_C[0]", "<data xmlns=\"http://www.gridworkflow.org/gworkflowdl\">\r\n" +
174 " <string xmlns=\"\">c_out</string>\r\n" +
175 "</data>", endC[0]);
176 }
177
178
179
180
181 public void testMultiChoice() throws JaxenException, IOException, JDOMException, NoSuchWorkflowException, WorkflowSecurityException, StateTransitionException, WorkflowFormatException, InterruptedException, DatabaseException, LoggingException, GWESException {
182 String gworkflowdl = testGWES("examples/patterns/multi-choice.gwdl", WorkflowStatus.STATUS_COMPLETED);
183
184
185
186 String sequence = extractOccurrenceSequence(gworkflowdl);
187 Assert.assertEquals("Occurrence sequence", "A_and_B only_B A B B",sequence);
188
189
190 List tokens = extractTokenChildElements(gworkflowdl);
191 Assert.assertEquals("Number of Tokens", 3, tokens.size());
192
193 String[] endA = gwes.getData(workflowID, "end_A", userID);
194 Assert.assertEquals("Number of Tokens on end_A", 1, endA.length);
195 logger.info("end_A[0]:\n" + endA[0]);
196 Assert.assertEquals("end_A[0]", "<data xmlns=\"http://www.gridworkflow.org/gworkflowdl\">\r\n" +
197 " <string xmlns=\"\">a_out</string>\r\n" +
198 "</data>", endA[0]);
199
200 String[] endB = gwes.getData(workflowID, "end_B", userID);
201 Assert.assertEquals("Number of Tokens on end_B", 2, endB.length);
202 logger.info("end_B[0]:\n" + endB[0]);
203 logger.info("end_B[1]:\n" + endB[1]);
204 Assert.assertEquals("end_B[0]", "<data xmlns=\"http://www.gridworkflow.org/gworkflowdl\">\r\n" +
205 " <string xmlns=\"\">b_out</string>\r\n" +
206 "</data>", endB[0]);
207 Assert.assertEquals("end_B[1]", "<data xmlns=\"http://www.gridworkflow.org/gworkflowdl\">\r\n" +
208 " <string xmlns=\"\">b_out</string>\r\n" +
209 "</data>", endB[1]);
210 }
211
212
213
214
215 public void testStructuredSynchronizingMergeSingle() throws JaxenException, IOException, JDOMException, NoSuchWorkflowException, WorkflowSecurityException, StateTransitionException, WorkflowFormatException, InterruptedException, DatabaseException, LoggingException, GWESException {
216 String gworkflowdl = testGWES("examples/patterns/structured-synchronizing-merge_single.gwdl", WorkflowStatus.STATUS_COMPLETED);
217
218
219
220 String sequence = extractOccurrenceSequence(gworkflowdl);
221 Assert.assertEquals("Occurrence sequence", "A_and_B A B post_AB",sequence);
222
223
224 List tokens = extractTokenChildElements(gworkflowdl);
225 Assert.assertEquals("Number of token child elements", 2, tokens.size());
226
227 String[] end = gwes.getData(workflowID, "end", userID);
228 Assert.assertEquals("Number of Tokens on end", 1, end.length);
229 logger.info("end[0]:\n" + end[0]);
230 Assert.assertEquals("end[0]", "<data xmlns=\"http://www.gridworkflow.org/gworkflowdl\">\r\n" +
231 " <a xmlns=\"\">a_out</a>\r\n" +
232 " <b xmlns=\"\">b_out</b>\r\n" +
233 "</data>", end[0]);
234 }
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268 public void testMultiMerge() throws JaxenException, IOException, JDOMException, NoSuchWorkflowException, StateTransitionException, WorkflowSecurityException, WorkflowFormatException, InterruptedException, DatabaseException, LoggingException, GWESException {
269 String gworkflowdl = testGWES("examples/patterns/multi-merge.gwdl", WorkflowStatus.STATUS_COMPLETED);
270
271
272
273 String sequence = extractOccurrenceSequence(gworkflowdl);
274 Assert.assertEquals("Occurrence sequence", "A B C C",sequence);
275
276
277 List tokens = extractTokenChildElements(gworkflowdl);
278 Assert.assertEquals("Number of Tokens", 2, tokens.size());
279
280 String[] endC = gwes.getData(workflowID, "end_C", userID);
281 Assert.assertEquals("Number of Tokens on end_C", 2, endC.length);
282 logger.info("end_C[0]:\n" + endC[0]);
283 logger.info("end_C[1]:\n" + endC[1]);
284 Assert.assertEquals("end_C[0]", "<data xmlns=\"http://www.gridworkflow.org/gworkflowdl\">\r\n" +
285 " <c_in xmlns=\"\">a_out</c_in>\r\n" +
286 "</data>", endC[0]);
287 Assert.assertEquals("end_C[1]", "<data xmlns=\"http://www.gridworkflow.org/gworkflowdl\">\r\n" +
288 " <c_in xmlns=\"\">b_out</c_in>\r\n" +
289 "</data>", endC[1]);
290 }
291
292
293
294
295 public void testStructuredDiscriminator() throws JaxenException, IOException, JDOMException, NoSuchWorkflowException, WorkflowSecurityException, StateTransitionException, WorkflowFormatException, InterruptedException, DatabaseException, LoggingException, GWESException {
296 String gworkflowdl = testGWES("examples/patterns/structured-discriminator.gwdl", WorkflowStatus.STATUS_COMPLETED);
297
298
299
300 String sequence = extractOccurrenceSequence(gworkflowdl);
301 Assert.assertEquals("Occurrence sequence", "A B C next release",sequence);
302
303
304 List tokens = extractTokenChildElements(gworkflowdl);
305 Assert.assertEquals("Number of token child elements", 2, tokens.size());
306
307 String[] endC = gwes.getData(workflowID, "end_C", userID);
308 Assert.assertEquals("Number of Tokens on end_C", 1, endC.length);
309 logger.info("end_C[0]:\n" + endC[0]);
310 Assert.assertEquals("end_C[0]", "<data xmlns=\"http://www.gridworkflow.org/gworkflowdl\">\r\n" +
311 " <c_in xmlns=\"\">a_out</c_in>\r\n" +
312 "</data>", endC[0]);
313
314 String[] end = gwes.getData(workflowID, "end", userID);
315 Assert.assertEquals("Number of Tokens on end", 1, end.length);
316 logger.info("end[0]:\n" + end[0]);
317 Assert.assertEquals("end[0]", "<data xmlns=\"http://www.gridworkflow.org/gworkflowdl\">\r\n" +
318 " <i xmlns=\"\">2.0</i>\r\n" +
319 "</data>", end[0]);
320 }
321
322
323
324
325 public void testStructuredDiscriminatorB() throws JaxenException, IOException, JDOMException, NoSuchWorkflowException, WorkflowSecurityException, StateTransitionException, WorkflowFormatException, InterruptedException, DatabaseException, LoggingException, GWESException {
326 String gworkflowdl = testGWES("examples/patterns/structured-discriminator_b.gwdl", WorkflowStatus.STATUS_COMPLETED);
327
328
329
330 String sequence = extractOccurrenceSequence(gworkflowdl);
331 Assert.assertEquals("Occurrence sequence", "A B C ignore release",sequence);
332
333
334 List tokens = extractTokenChildElements(gworkflowdl);
335 Assert.assertEquals("Number of Tokens", 3, tokens.size());
336
337 String[] endC = gwes.getData(workflowID, "end_C", userID);
338 Assert.assertEquals("Number of Tokens on end_C", 1, endC.length);
339 logger.info("end_C[0]:\n" + endC[0]);
340 Assert.assertEquals("end_C[0]", "<data xmlns=\"http://www.gridworkflow.org/gworkflowdl\">\r\n" +
341 " <c_in xmlns=\"\">a_out</c_in>\r\n" +
342 "</data>", endC[0]);
343
344 String[] end = gwes.getData(workflowID, "end", userID);
345 Assert.assertEquals("Number of Tokens on end", 1, end.length);
346 logger.info("end[0]:\n" + end[0]);
347 Assert.assertEquals("end[0]", "<control>true</control>", end[0]);
348 }
349
350
351
352
353 public void testStructuredDiscriminatorC() throws JaxenException, IOException, JDOMException, NoSuchWorkflowException, WorkflowSecurityException, StateTransitionException, WorkflowFormatException, InterruptedException, DatabaseException, LoggingException, GWESException {
354 String gworkflowdl = testGWES("examples/patterns/structured-discriminator_c.gwdl", WorkflowStatus.STATUS_COMPLETED);
355
356
357
358 String sequence = extractOccurrenceSequence(gworkflowdl);
359 Assert.assertEquals("Occurrence sequence", "AND AND B B C C A ignore A ignore",sequence);
360
361
362 List tokens = extractTokenChildElements(gworkflowdl);
363 Assert.assertEquals("Number of token child elements", 4, tokens.size());
364
365 String[] endC = gwes.getData(workflowID, "end_C", userID);
366 Assert.assertEquals("Number of Tokens on end_C", 2, endC.length);
367 logger.info("end_C[0]:\n" + endC[0]);
368 Assert.assertEquals("end_C[0]", "<data xmlns=\"http://www.gridworkflow.org/gworkflowdl\">\r\n" +
369 " <c_in xmlns=\"\">b_out</c_in>\r\n" +
370 "</data>", endC[0]);
371 logger.info("end_C[1]:\n" + endC[1]);
372 Assert.assertEquals("end_C[1]", "<data xmlns=\"http://www.gridworkflow.org/gworkflowdl\">\r\n" +
373 " <c_in xmlns=\"\">b_out</c_in>\r\n" +
374 "</data>", endC[1]);
375 }
376
377
378
379
380 public void testBlockingDiscriminator() throws JaxenException, IOException, JDOMException, NoSuchWorkflowException, WorkflowSecurityException, StateTransitionException, WorkflowFormatException, InterruptedException, DatabaseException, LoggingException, GWESException {
381 String gworkflowdl = testGWES("examples/patterns/blocking-discriminator.gwdl", WorkflowStatus.STATUS_COMPLETED);
382
383
384
385 String sequence = extractOccurrenceSequence(gworkflowdl);
386 Assert.assertEquals("Occurrence sequence", "AND B A C ignore release AND B A C ignore release",sequence);
387
388
389 List tokens = extractTokenChildElements(gworkflowdl);
390 Assert.assertEquals("Number of Tokens", 6, tokens.size());
391
392 String[] endC = gwes.getData(workflowID, "end_C", userID);
393 Assert.assertEquals("Number of Tokens on end_C", 2, endC.length);
394 logger.info("end_C[0]:\n" + endC[0]);
395 Assert.assertEquals("end_C[0]", "<data xmlns=\"http://www.gridworkflow.org/gworkflowdl\">\r\n" +
396 " <c_in xmlns=\"\">b_out</c_in>\r\n" +
397 "</data>", endC[0]);
398 logger.info("end_C[1]:\n" + endC[1]);
399 Assert.assertEquals("end_C[1]", "<data xmlns=\"http://www.gridworkflow.org/gworkflowdl\">\r\n" +
400 " <c_in xmlns=\"\">b_out</c_in>\r\n" +
401 "</data>", endC[1]);
402
403 String[] end = gwes.getData(workflowID, "end", userID);
404 Assert.assertEquals("Number of Tokens on end", 2, end.length);
405 logger.info("end[0]:\n" + end[0]);
406 Assert.assertEquals("end[0]", "<control>true</control>", end[0]);
407 logger.info("end[1]:\n" + end[1]);
408 Assert.assertEquals("end[1]", "<control>true</control>", end[1]);
409 }
410
411
412
413
414 public void testCancellingDiscriminator() throws JaxenException, IOException, JDOMException, NoSuchWorkflowException, WorkflowSecurityException, StateTransitionException, WorkflowFormatException, InterruptedException, DatabaseException, LoggingException, GWESException {
415 String gworkflowdl = testGWES("examples/patterns/cancelling-discriminator.gwdl", WorkflowStatus.STATUS_COMPLETED);
416
417
418
419 String sequence = extractOccurrenceSequence(gworkflowdl);
420 Assert.assertEquals("Occurrence sequence", "A B AND C",sequence);
421
422
423 List tokens = extractTokenChildElements(gworkflowdl);
424 Assert.assertEquals("Number of token child elements", 1, tokens.size());
425
426 String[] end = gwes.getData(workflowID, "end", userID);
427 Assert.assertEquals("Number of Tokens on end", 1, end.length);
428 logger.info("end[0]:\n" + end[0]);
429 Assert.assertEquals("end[0]", "<data xmlns=\"http://www.gridworkflow.org/gworkflowdl\">\r\n" +
430 " <string xmlns=\"\">c_out</string>\r\n" +
431 "</data>", end[0]);
432 }
433
434
435
436
437 public void testCancellingDiscriminator2() throws JaxenException, IOException, JDOMException, NoSuchWorkflowException, WorkflowSecurityException, StateTransitionException, WorkflowFormatException, InterruptedException, DatabaseException, LoggingException, GWESException {
438 String gworkflowdl = testGWES("examples/patterns/cancelling-discriminator_2.gwdl", WorkflowStatus.STATUS_COMPLETED);
439
440
441
442 String sequence = extractOccurrenceSequence(gworkflowdl);
443 Assert.assertEquals("Occurrence sequence", "B cancel_A A remove_A C",sequence);
444
445
446 List tokens = extractTokenChildElements(gworkflowdl);
447 Assert.assertEquals("Number of Tokens", 1, tokens.size());
448
449 String[] end = gwes.getData(workflowID, "end", userID);
450 Assert.assertEquals("Number of Tokens on end", 1, end.length);
451 logger.info("end[0]:\n" + end[0]);
452 Assert.assertEquals("end[0]", "<data xmlns=\"http://www.gridworkflow.org/gworkflowdl\">\r\n" +
453 " <string xmlns=\"\">c_out</string>\r\n" +
454 "</data>", end[0]);
455 }
456
457
458
459
460 public void testCancellingDiscriminator3() throws JaxenException, IOException, JDOMException, NoSuchWorkflowException, WorkflowSecurityException, StateTransitionException, WorkflowFormatException, InterruptedException, DatabaseException, LoggingException, GWESException {
461 String gworkflowdl = testGWES("examples/patterns/cancelling-discriminator_3.gwdl", WorkflowStatus.STATUS_COMPLETED);
462
463
464
465 String sequence = extractOccurrenceSequence(gworkflowdl);
466 Assert.assertEquals("Occurrence sequence", "A cancel_B B remove_B C",sequence);
467
468
469 List tokens = extractTokenChildElements(gworkflowdl);
470 Assert.assertEquals("Number of Tokens", 1, tokens.size());
471
472 String[] end = gwes.getData(workflowID, "end", userID);
473 Assert.assertEquals("Number of Tokens on end", 1, end.length);
474 logger.info("end[0]:\n" + end[0]);
475 Assert.assertEquals("end[0]", "<data xmlns=\"http://www.gridworkflow.org/gworkflowdl\">\r\n" +
476 " <string xmlns=\"\">c_out</string>\r\n" +
477 "</data>", end[0]);
478 }
479
480
481
482
483 public void testStructuredPartialJoin() throws JaxenException, IOException, JDOMException, NoSuchWorkflowException, WorkflowSecurityException, StateTransitionException, WorkflowFormatException, InterruptedException, DatabaseException, LoggingException, GWESException {
484 String gworkflowdl = testGWES("examples/patterns/structured-partial-join.gwdl", WorkflowStatus.STATUS_COMPLETED);
485
486
487
488 String sequence = extractOccurrenceSequence(gworkflowdl);
489 Assert.assertEquals("Occurrence sequence", "A B Use_1 Use_2 D C Ignore_3 Release",sequence);
490
491
492 List tokens = extractTokenChildElements(gworkflowdl);
493 Assert.assertEquals("Number of token child elements", 3, tokens.size());
494
495 String[] end = gwes.getData(workflowID, "end", userID);
496 Assert.assertEquals("Number of Tokens on end", 1, end.length);
497 logger.info("end[0]:\n" + end[0]);
498 Assert.assertEquals("end[0]", "<data xmlns=\"http://www.gridworkflow.org/gworkflowdl\">\r\n" +
499 " <string xmlns=\"\">released</string>\r\n" +
500 "</data>", end[0]);
501 }
502
503
504
505
506 public void testCombineTokens() throws JaxenException, IOException, JDOMException, NoSuchWorkflowException, WorkflowSecurityException, StateTransitionException, WorkflowFormatException, InterruptedException, DatabaseException, LoggingException, GWESException {
507 String gworkflowdl = testGWES("examples/patterns/combine-tokens.gwdl", WorkflowStatus.STATUS_COMPLETED);
508
509
510
511 String sequence = extractOccurrenceSequence(gworkflowdl);
512 Assert.assertEquals("Occurrence sequence", "combine_AxB next_A combine_AxB next_A combine_AxB next_A next_B pushback_A pushback_A pushback_A remove_B combine_AxB next_A combine_AxB next_A combine_AxB next_A next_B pushback_A pushback_A pushback_A remove_B remove_A remove_A remove_A f_AxB f_AxB f_AxB f_AxB f_AxB f_AxB",sequence);
513
514
515 List tokens = extractTokenChildElements(gworkflowdl);
516 Assert.assertEquals("Number of Tokens", 14, tokens.size());
517
518 String[] end = gwes.getData(workflowID, "AxB_combined", userID);
519 logger.info("AxB_combined[0]:\n" + end[0]);
520 Assert.assertEquals("AxB_combined[0]", createColouredAnimal("red", "rabbit"), end[0]);
521 Assert.assertEquals("AxB_combined[1]", createColouredAnimal("green", "rabbit"), end[1]);
522 Assert.assertEquals("AxB_combined[2]", createColouredAnimal("yellow", "rabbit"), end[2]);
523 Assert.assertEquals("AxB_combined[3]", createColouredAnimal("red", "frog"), end[3]);
524 Assert.assertEquals("AxB_combined[4]", createColouredAnimal("green", "frog"), end[4]);
525 Assert.assertEquals("AxB_combined[5]", createColouredAnimal("yellow", "frog"), end[5]);
526
527 String[] counter = gwes.getData(workflowID, "counter", userID);
528 Assert.assertEquals("Number of tokens on counter",1,counter.length);
529 logger.info("counter:\n" + counter[0]);
530 Assert.assertEquals("counter[0]","<data xmlns=\"http://www.gridworkflow.org/gworkflowdl\">\r\n" +
531 " <double xmlns=\"\">6.0</double>\r\n" +
532 "</data>",counter[0]);
533 }
534
535 private String createColouredAnimal(String colour, String animal) {
536 return "<data xmlns=\"http://www.gridworkflow.org/gworkflowdl\">\r\n" +
537 " <a xmlns=\"\">"+colour+"</a>\r\n" +
538 " <b xmlns=\"\">"+animal+"</b>\r\n" +
539 "</data>";
540 }
541
542
543
544
545
546
547
548 }