X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;ds=inline;f=org.argeo.slc.example%2Fsrc%2Ftest%2Fjava%2Forg%2Fargeo%2Fslc%2Fexample%2Fjunit%2FExampleIntegrationTest.java;h=c072a21be94ce6c7c4c721d61fe1c476aa549130;hb=9d1440433733a6e3a6977ee8ee423837415b22d6;hp=592d228d8a9a6b0fa8426272514bff42fab74ef3;hpb=ad39dc06e6fcc81a50caf5c617f93f83b6cc698a;p=gpl%2Fargeo-slc.git diff --git a/org.argeo.slc.example/src/test/java/org/argeo/slc/example/junit/ExampleIntegrationTest.java b/org.argeo.slc.example/src/test/java/org/argeo/slc/example/junit/ExampleIntegrationTest.java index 592d228d8..c072a21be 100644 --- a/org.argeo.slc.example/src/test/java/org/argeo/slc/example/junit/ExampleIntegrationTest.java +++ b/org.argeo.slc.example/src/test/java/org/argeo/slc/example/junit/ExampleIntegrationTest.java @@ -4,29 +4,24 @@ import java.io.File; import junit.framework.TestCase; -import org.springframework.context.ApplicationContext; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.tools.ant.Project; - import org.argeo.slc.ant.AntRegistryUtil; import org.argeo.slc.ant.SlcProjectHelper; -import org.argeo.slc.core.structure.tree.TreeSPath; -import org.argeo.slc.core.test.NumericTRId; -import org.argeo.slc.core.test.SimpleResultPart; import org.argeo.slc.core.test.TestStatus; -import org.argeo.slc.core.test.tree.PartSubList; import org.argeo.slc.core.test.tree.TreeTestResult; import org.argeo.slc.dao.test.TestResultDao; +import org.argeo.slc.unit.test.tree.UnitTestTreeUtil; +import org.springframework.context.ApplicationContext; /** High level tests for SLC Ant. */ public class ExampleIntegrationTest extends TestCase { private static Log log = LogFactory.getLog(ExampleIntegrationTest.class); /** Tests an end-to-end Ant run. */ - public void testAllRunSimple() throws Exception{ - String slcBase = System.getProperty("it.slc.base","exampleSlcAppli"); + public void testAllRunSimple() throws Exception { + String slcBase = System.getProperty("it.slc.base", "exampleSlcAppli"); File slcBaseDir = new File(slcBase).getCanonicalFile(); log.info("SLC base: " + slcBaseDir); @@ -46,49 +41,39 @@ public class ExampleIntegrationTest extends TestCase { TestResultDao testResultDao = (TestResultDao) context .getBean("testResultDao"); - NumericTRId numericTRId = new NumericTRId(); - numericTRId.setValue(1l); TreeTestResult testResult1 = (TreeTestResult) testResultDao - .getTestResult(numericTRId); + .getTestResult("1"); // assertPart(testResult1, "", 0, TestStatus.PASSED, ""); - assertPart( - testResult1, - "/root/Category1/SubCategory2/testComplex/slc.test0/0", - 0, - TestStatus.PASSED, - "Sub task with path /root/Category1/SubCategory2/testComplex/slc.test0/0 executed"); - assertPart(testResult1, + UnitTestTreeUtil + .assertPart( + testResult1, + "/root/Category1/SubCategory2/testComplex/slc.test0/0", + 0, + TestStatus.PASSED, + "Sub task with path /root/Category1/SubCategory2/testComplex/slc.test0/0 executed"); + UnitTestTreeUtil.assertPart(testResult1, "/root/Category1/SubCategory2/testSimple/slc.test0", 1, TestStatus.FAILED, "Compare nato-expected.txt with nato-reached.txt"); - assertPart(testResult1, + UnitTestTreeUtil.assertPart(testResult1, "/root/Category1/SubCategory2/testError/slc.test0", 0, TestStatus.ERROR, "Execute example appli"); - numericTRId.setValue(2l); - TreeTestResult testResult2 = (TreeTestResult) testResultDao - .getTestResult(numericTRId); - assertPart(testResult2, - "/root/Category1/SubCategory2/testSimple/slc.test2", 1, - TestStatus.PASSED, - "Compare eu-reform-expected.txt with eu-reform-reached.txt"); - assertPart(testResult2, - "/root/Category1/SubCategory2/testSimple/slc.test3", 1, - TestStatus.FAILED, - "Compare eu-reform-expected.txt with eu-reform-reached.txt"); +// TreeTestResult testResult2 = (TreeTestResult) testResultDao +// .getTestResult("2"); +// UnitTestTreeUtil.assertPart(testResult2, +// "/root/Category1/SubCategory2/testSimple/slc.test2", 1, +// TestStatus.PASSED, +// "Compare eu-reform-expected.txt with eu-reform-reached.txt"); +// UnitTestTreeUtil.assertPart(testResult2, +// "/root/Category1/SubCategory2/testSimple/slc.test3", 1, +// TestStatus.FAILED, +// "Compare eu-reform-expected.txt with eu-reform-reached.txt"); assertTrue(new File(reportDirPath + "index.html").exists()); assertTrue(new File(reportDirPath + "slc-resultsList.html").exists()); assertTrue(new File(reportDirPath + "slc-result-1.html").exists()); - assertTrue(new File(reportDirPath + "slc-result-2.html").exists()); +// assertTrue(new File(reportDirPath + "slc-result-2.html").exists()); } - private void assertPart(TreeTestResult testResult, String pathStr, - int index, Integer status, String message) { - TreeSPath path = TreeSPath.parseToCreatePath(pathStr); - PartSubList list = testResult.getResultParts().get(path); - SimpleResultPart part = (SimpleResultPart) list.getParts().get(index); - assertEquals(status, part.getStatus()); - assertEquals(message, part.getMessage()); - } }