1   /*
2    * Copyright (c) 2003-2008, by Henrik Arro and Contributors
3    *
4    * This file is part of JSeq, a tool to automatically create
5    * sequence diagrams by tracing program execution.
6    *
7    * See <http://jseq.sourceforge.net> for more information.
8    *
9    * JSeq is free software: you can redistribute it and/or modify
10   * it under the terms of the GNU Lesser General Public License as
11   * published by the Free Software Foundation, either version 3 of
12   * the License, or (at your option) any later version.
13   *
14   * JSeq is distributed in the hope that it will be useful,
15   * but WITHOUT ANY WARRANTY; without even the implied warranty of
16   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17   * GNU Lesser General Public License for more details.
18   *
19   * You should have received a copy of the GNU Lesser General Public License
20   * along with JSeq. If not, see <http://www.gnu.org/licenses/>.
21   */
22  
23  package th.co.edge.jseq.argouml;
24  
25  import java.io.File;
26  
27  import junit.framework.Test;
28  import junit.framework.TestCase;
29  import junit.framework.TestSuite;
30  import th.co.edge.jseq.Activation;
31  import th.co.edge.jseq.ActivationList;
32  import th.co.edge.jseq.Diagram;
33  import th.co.edge.jseq.TestMethodImpl;
34  
35  public class ArgoUMLGeneratorTest extends TestCase {
36      public ArgoUMLGeneratorTest(String name) {
37          super(name);
38      }
39  
40      public static Test suite() {
41          TestSuite suite = new TestSuite(ArgoUMLGeneratorTest.class);
42          return suite;
43      }
44  
45      public static void main(String[] args) throws Exception {
46          ArgoUMLGeneratorTest testcase = new ArgoUMLGeneratorTest("");
47          testcase.test();
48      }
49  
50      //
51      // Test methods
52      //
53  
54      public void test() throws Exception {
55          ArgoUMLGenerator generator = new ArgoUMLGenerator();
56          // ActivationList activationList = buildActivationList();
57          ActivationList activationList = th.co.edge.jseq.ActivationListTest
58                  .buildActivationList();
59          Diagram diagram = generator.generate(activationList);
60          File file = new File("test.zargo");
61          diagram.save(file);
62      }
63  
64      //
65      // Utility methods
66      //
67  
68      public static ActivationList buildActivationList() {
69          Activation root = new Activation(null, "Foo", new TestMethodImpl(
70                  "start"), -1);
71          Activation barInit = new Activation(root, "Bar", new TestMethodImpl(
72                  "<init>", true), -1);
73          new Activation(barInit, "Baz", new TestMethodImpl("hubba"), -1);
74          new Activation(root, "Bar", new TestMethodImpl("frotz"), -1);
75  
76          ActivationList activationList = new ActivationList();
77          activationList.add(root);
78          return activationList;
79      }
80  }