1 package org
.argeo
.slc
.example
.junit
;
5 import junit
.framework
.TestCase
;
7 import org
.apache
.commons
.logging
.Log
;
8 import org
.apache
.commons
.logging
.LogFactory
;
9 import org
.apache
.tools
.ant
.Project
;
10 import org
.argeo
.slc
.ant
.AntRegistryUtil
;
11 import org
.argeo
.slc
.ant
.SlcProjectHelper
;
12 import org
.argeo
.slc
.core
.test
.TestStatus
;
13 import org
.argeo
.slc
.core
.test
.tree
.TreeTestResult
;
14 import org
.argeo
.slc
.dao
.test
.TestResultDao
;
15 import org
.argeo
.slc
.unit
.test
.tree
.UnitTestTreeUtil
;
16 import org
.springframework
.context
.ApplicationContext
;
18 /** High level tests for SLC Ant. */
19 public class ExampleIntegrationTest
extends TestCase
{
20 private static Log log
= LogFactory
.getLog(ExampleIntegrationTest
.class);
22 /** Tests an end-to-end Ant run. */
23 public void testAllRunSimple() throws Exception
{
24 String slcBase
= System
.getProperty("it.slc.base", "exampleSlcAppli");
25 File slcBaseDir
= new File(slcBase
).getCanonicalFile();
26 log
.info("SLC base: " + slcBaseDir
);
28 String reportDirPath
= slcBaseDir
.getPath() + "/work/results/report/";
29 File
[] reportFiles
= new File(reportDirPath
).listFiles();
30 for (File file
: reportFiles
) {
34 File antFile
= new File(slcBaseDir
.getPath()
35 + "/root/Category1/SubCategory2/build.xml");
36 Project p
= AntRegistryUtil
.runAll(antFile
);
38 ApplicationContext context
= (ApplicationContext
) p
39 .getReference(SlcProjectHelper
.REF_ROOT_CONTEXT
);
41 TestResultDao testResultDao
= (TestResultDao
) context
42 .getBean("testResultDao");
44 TreeTestResult testResult1
= (TreeTestResult
) testResultDao
46 // assertPart(testResult1, "", 0, TestStatus.PASSED, "");
50 "/root/Category1/SubCategory2/testComplex/slc.test0/0",
53 "Sub task with path /root/Category1/SubCategory2/testComplex/slc.test0/0 executed");
54 UnitTestTreeUtil
.assertPart(testResult1
,
55 "/root/Category1/SubCategory2/testSimple/slc.test0", 1,
57 "Compare nato-expected.txt with nato-reached.txt");
58 UnitTestTreeUtil
.assertPart(testResult1
,
59 "/root/Category1/SubCategory2/testError/slc.test0", 0,
60 TestStatus
.ERROR
, "Execute example appli");
62 // TreeTestResult testResult2 = (TreeTestResult) testResultDao
63 // .getTestResult("2");
64 // UnitTestTreeUtil.assertPart(testResult2,
65 // "/root/Category1/SubCategory2/testSimple/slc.test2", 1,
67 // "Compare eu-reform-expected.txt with eu-reform-reached.txt");
68 // UnitTestTreeUtil.assertPart(testResult2,
69 // "/root/Category1/SubCategory2/testSimple/slc.test3", 1,
71 // "Compare eu-reform-expected.txt with eu-reform-reached.txt");
73 assertTrue(new File(reportDirPath
+ "index.html").exists());
74 assertTrue(new File(reportDirPath
+ "slc-resultsList.html").exists());
75 assertTrue(new File(reportDirPath
+ "slc-result-1.html").exists());
76 // assertTrue(new File(reportDirPath + "slc-result-2.html").exists());