1
2
3
4
5
6
7
8
9
10 package net.kwfgrid.gworkflowdl;
11
12 import junit.framework.Assert;
13 import junit.framework.Test;
14 import junit.framework.TestSuite;
15 import net.kwfgrid.gworkflowdl.structure.*;
16 import org.jdom.Element;
17
18 import java.io.IOException;
19
20
21 public final class OperationJdomTest extends AbstractTestCase {
22
23 /***
24 * Create the test case.
25 *
26 * @param testName name of the test case
27 */
28 public OperationJdomTest(String testName) {
29 super(testName);
30 }
31
32 /***
33 * @return the suite of tests being tested
34 */
35 public static Test suite() {
36 return new TestSuite(OperationJdomTest.class);
37 }
38
39 public void testOperationJdomTest() throws WorkflowFormatException, IOException {
40
41 Operation op1 = OperationTest.example("anton", 5);
42 ((OperationClass)op1.get()).getOperationCandidates()[1].setSelected();
43 Element ope1 = OperationJdom.java2element(op1);
44
45 String opxml;
46 Element ope2 = null;
47 opxml = JdomString.element2string(ope1);
48 System.out.println(opxml);
49 ope2 = JdomString.string2element(opxml);
50 Operation op2 = OperationJdom.element2java(ope2);
51
52 OperationClass o1 = (OperationClass) op1.get();
53 OperationClass o2 = (OperationClass) op2.get();
54 Assert.assertEquals("Operation class name",o1.getName(), o2.getName());
55 Assert.assertEquals("Number Operation Candidates", o1.getOperationCount(), o2.getOperationCount());
56 }
57 }