View Javadoc

1   /***
2    * 
3    */
4   package atg.test;
5   
6   import java.io.File;
7   import java.io.IOException;
8   
9   import junit.framework.TestCase;
10  
11  /***
12   * @author robert
13   * 
14   */
15  public class AtgDustCaseTest extends TestCase {
16    private AtgDustCase atgCase = new AtgDustCase();
17  
18    /*
19     * (non-Javadoc)
20     * 
21     * @see junit.framework.TestCase#setUp()
22     */
23    protected void setUp() throws Exception {
24      super.setUp();
25    }
26  
27    /*
28     * (non-Javadoc)
29     * 
30     * @see junit.framework.TestCase#tearDown()
31     */
32    protected void tearDown() throws Exception {
33      super.tearDown();
34    }
35  
36    /***
37     * Test method for
38     * {@link atg.test.AtgDustCase#createPropertyFile(java.lang.String, java.lang.String, java.lang.Class)}.
39     */
40    public void testCreatePropertyFile() {
41      try {
42  
43        atgCase.createPropertyFile("target/test-classes/config",
44            "/some/component/impl", Object.class);
45  
46      }
47      catch (IOException e) {
48        e.printStackTrace();
49        fail(e.getMessage());
50      }
51    }
52  
53    public void testGetMoreCoverage() {
54      try {
55        atgCase.tearDown();
56      }
57      catch (Exception e) {
58        fail("Previous call should not have triggerd an Exception");
59      }
60  
61      try {
62        atgCase.copyConfigurationFiles(new String[] { "src/test/resources/config"
63            .replace("/", File.separator) }, "target/test-classes/config"
64            .replace("/", File.separator), ".svn");
65  
66        // starts nucleus and resolves component (which can't be resolved because
67        // it's non existing)
68        assertNull(atgCase.resolveNucleusComponent("bla"));
69  
70        // just resolves the component (which can't be resolved because
71        // it's non existing)
72        assertNull(atgCase.resolveNucleusComponent("bla"));
73  
74        // TODO: there must be a way to really test this
75        atgCase.setDebug(true);
76      }
77      catch (Exception e) {
78        e.printStackTrace();
79        fail("Previous call should not have triggerd an Exception");
80      }
81  
82    }
83  
84    public void _testCopyConfigurationFiles() throws Exception {
85      atgCase.copyConfigurationFiles(
86          new String[] { "/Users/robert/tmp/back_ex/atgdust-lots-of-props" },
87          "/tmp/atgdust", ".svn");
88      atgCase.copyConfigurationFiles(
89          new String[] { "/Users/robert/tmp/back_ex/atgdust-lots-of-props/tmp2",  "/Users/robert/tmp/back_ex/atgdust-lots-of-props/tmp2" },
90          "/tmp/atgdust", "excludes");
91    }
92  }