lttng: Update history construction unit tests
authorAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Sat, 28 Apr 2012 07:45:46 +0000 (03:45 -0400)
committerAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Sat, 28 Apr 2012 07:45:46 +0000 (03:45 -0400)
Now that builder.run() returns immediately, we have to call
.close() to actually wait until the complete history is built
before we start the tests.

Signed-off-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/stateprovider/StateSystemFullHistoryTest.java
org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/stateprovider/StateSystemFullThreadedHistoryTest.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statesystem/backend/historytree/HistoryTree.java

index 77cd8a01f4b3f4bda7b39850312017291b8e94e7..7ea49253867474367f0a1701693c8e0e7d97de5a 100644 (file)
@@ -70,6 +70,7 @@ public class StateSystemFullHistoryTest {
         }
         builder.run();
         shs = (StateHistorySystem) builder.getSS();
+        builder.close(); /* Waits for the construction to finish */
     }
 
     @AfterClass
index a9a1510676a37dfc8dba609c2ed75d85495ad881..b812438f32d9513c3885044e204bb572bbfa9686 100644 (file)
@@ -53,6 +53,7 @@ public class StateSystemFullThreadedHistoryTest extends
         }
         builder.run();
         shs = (StateHistorySystem) builder.getSS();
+        builder.close(); /* Waits for the construction to finish */
     }
 
     @Override
index 608b3bb358e20fe32f3f4be07c80caa12532da78..3c7908b6ecec9a541247fa657d5aae627e142be3 100644 (file)
@@ -118,8 +118,11 @@ class HistoryTree {
         long ts;
 
         /* Java I/O mumbo jumbo... */
-        if ((!existingStateFile.exists()) || existingStateFile.length() <= 0) {
-            throw new IOException("Invalid state file selected"); //$NON-NLS-1$
+        if (!existingStateFile.exists()) {
+            throw new IOException("Selected state file does not exist"); //$NON-NLS-1$
+        }
+        if  (existingStateFile.length() <= 0) {
+            throw new IOException("Invalid state file selected, target file is empty"); //$NON-NLS-1$
         }
 
         FileInputStream fis = new FileInputStream(existingStateFile);
This page took 0.026699 seconds and 5 git commands to generate.