1 package net.kwfgrid.gworkflowdl;
2
3 import junit.framework.Assert;
4 import junit.framework.Test;
5 import junit.framework.TestSuite;
6 import net.kwfgrid.gworkflowdl.structure.*;
7 import org.apache.log4j.Logger;
8 import org.jdom.Element;
9 import org.jdom.JDOMException;
10
11 import java.io.IOException;
12
13 /***
14 * Created by IntelliJ IDEA.
15 * User: hans
16 * Date: 27.09.2005
17 * Time: 14:02:07
18 * To change this template use File | Settings | File Templates.
19 */
20 public final class OutTest extends AbstractTestCase {
21
22 /***
23 * log4j logger
24 */
25 static Logger logger = Logger.getLogger(OutTest.class);
26
27 /***
28 * Create the test case.
29 *
30 * @param testName name of the test case
31 */
32 public OutTest(String testName) {
33 super(testName);
34 }
35
36 /***
37 * @return the suite of tests being tested
38 */
39 public static Test suite() {
40 return new TestSuite(OutTest.class);
41 }
42
43 public void testOutTest() {
44 boolean ok = true;
45 String s = "";
46 String fn = "src/test/net/kwfgrid/gworkflowdl/out.xml";
47 Element wfe = null;
48 try {
49 wfe = JdomString.workflowFile2element(getTestFile(fn));
50 } catch (IOException e) {
51 ok = false;
52 logger.fatal("IOException during parsing XML", e);
53 } catch (JDOMException e) {
54 ok = false;
55 logger.fatal("JDOMException during parsing XML", e);
56 }
57
58 Assert.assertTrue(ok);
59 try {
60 Workflow wf = WorkflowJdom.element2java(wfe);
61
62 Transition t = wf.getTransition("sort");
63 logger.debug("AnalysisTransition " + t.getID());
64 int al = t.getAbstractionLevel();
65 logger.debug("AbstractionLevel " + al);
66 Assert.assertEquals(al, Operation.GREEN);
67 s = JdomString.workflow2string(wf);
68 JdomString.string2verifyWorkflowElement(s);
69 } catch (Exception e) {
70 logger.debug(e);
71 e.printStackTrace();
72 }
73 Assert.assertTrue(ok);
74 logger.debug(s);
75 }
76 }
77