]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - org.argeo.slc/src/main/java/org/argeo/slc/core/test/tree/AsynchronousTreeTestResultListener.java
Improve reporting
[gpl/argeo-slc.git] / org.argeo.slc / src / main / java / org / argeo / slc / core / test / tree / AsynchronousTreeTestResultListener.java
index 76a8bb05a08071e93b9f7bb3a41c84d1557530e6..c3bc793ef5f357d03a16b821c1dd067f5163f83b 100644 (file)
@@ -19,13 +19,14 @@ public abstract class AsynchronousTreeTestResultListener implements
        private Vector<PartStruct> partStructs = new Vector<PartStruct>();\r
        private Thread thread;\r
 \r
+       /** Starts the underlying thread. */\r
        public void init() {\r
                thread = new Thread(this);\r
                thread.start();\r
        }\r
 \r
        /** Finish the remaining and destroy */\r
-       public void close() {\r
+       public void close(TestResult testResult) {\r
                synchronized (partStructs) {\r
                        // TODO: put a timeout\r
                        while (partStructs.size() != 0) {\r
@@ -38,6 +39,7 @@ public abstract class AsynchronousTreeTestResultListener implements
                        thread = null;\r
                        partStructs.notifyAll();\r
                }\r
+               postClose((TreeTestResult)testResult);\r
        }\r
 \r
        public final void resultPartAdded(TestResult testResult,\r
@@ -54,6 +56,14 @@ public abstract class AsynchronousTreeTestResultListener implements
        /** Called when a result part has been added. */\r
        protected abstract void resultPartAdded(PartStruct partStruct);\r
 \r
+       /**\r
+        * Called at the end of close. Default implementation is empty. To be\r
+        * overridden.\r
+        */\r
+       protected void postClose(TreeTestResult testResult) {\r
+\r
+       }\r
+\r
        public void run() {\r
                while (thread != null) {\r
                        synchronized (partStructs) {\r
@@ -85,6 +95,7 @@ public abstract class AsynchronousTreeTestResultListener implements
                /** The tree test result itself. */\r
                public final TreeTestResult result;\r
 \r
+               /** Constructor */\r
                public PartStruct(TreeSPath path, NumericTRId resultId,\r
                                TestResultPart part, TreeTestResult result) {\r
                        super();\r