Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Powell2010-05-06 11:41:39 +0000
committerSteve Powell2010-05-06 11:41:39 +0000
commitf7c1aff6e096e8f269d0ed623560d76338305d9f (patch)
treefe7c113dc166eb1daaa7fc61219fa4fa83ef2a5e /org.eclipse.virgo.medic.integrationtest/src/test
parentfbaa027e9847f690279b073f13ae272e3b42713c (diff)
downloadorg.eclipse.virgo.medic-f7c1aff6e096e8f269d0ed623560d76338305d9f.tar.gz
org.eclipse.virgo.medic-f7c1aff6e096e8f269d0ed623560d76338305d9f.tar.xz
org.eclipse.virgo.medic-f7c1aff6e096e8f269d0ed623560d76338305d9f.zip
[bug: 311858] Extend DumpIntegrationTests checking.
Diffstat (limited to 'org.eclipse.virgo.medic.integrationtest/src/test')
-rw-r--r--org.eclipse.virgo.medic.integrationtest/src/test/java/org/eclipse/virgo/medic/dump/test/DumpIntegrationTests.java54
-rw-r--r--org.eclipse.virgo.medic.integrationtest/src/test/java/org/eclipse/virgo/medic/eventlog/test/EventLogIntegrationTests.java2
2 files changed, 43 insertions, 13 deletions
diff --git a/org.eclipse.virgo.medic.integrationtest/src/test/java/org/eclipse/virgo/medic/dump/test/DumpIntegrationTests.java b/org.eclipse.virgo.medic.integrationtest/src/test/java/org/eclipse/virgo/medic/dump/test/DumpIntegrationTests.java
index 3ddddc8..1917ff0 100644
--- a/org.eclipse.virgo.medic.integrationtest/src/test/java/org/eclipse/virgo/medic/dump/test/DumpIntegrationTests.java
+++ b/org.eclipse.virgo.medic.integrationtest/src/test/java/org/eclipse/virgo/medic/dump/test/DumpIntegrationTests.java
@@ -35,6 +35,8 @@ import org.eclipse.virgo.medic.dump.DumpGenerator;
import org.eclipse.virgo.test.framework.OsgiTestRunner;
import org.eclipse.virgo.test.framework.TestFrameworkUtils;
+// Medic integration tests do not run in the Eclipse IDE.
+
@RunWith(OsgiTestRunner.class)
public class DumpIntegrationTests {
@@ -87,7 +89,11 @@ public class DumpIntegrationTests {
assertTrue(file.exists());
assertNotNull(file.list());
assertEquals(1, file.list().length);
- assertDumpContributionsMade(file.listFiles()[0], "heap.out", "summary.txt", "thread.txt");
+
+ assertDumpContributionsNumberOf(file.listFiles()[0], 3);
+ assertDumpContributionsEssential(file.listFiles()[0], "summary.txt", "thread.txt");
+ assertDumpContributionsAllowable(file.listFiles()[0], "heap.out", "heap.err", "summary.txt", "thread.txt");
+
properties.put("dump.root.directory", "target/dumps/2");
configuration.update(properties);
@@ -100,7 +106,11 @@ public class DumpIntegrationTests {
assertTrue(file.exists());
assertNotNull(file.list());
assertEquals(1, file.list().length);
- assertDumpContributionsMade(file.listFiles()[0], "heap.out", "summary.txt", "thread.txt");
+
+ assertDumpContributionsNumberOf(file.listFiles()[0], 3);
+ assertDumpContributionsEssential(file.listFiles()[0], "summary.txt", "thread.txt");
+ assertDumpContributionsAllowable(file.listFiles()[0], "heap.out", "heap.err", "summary.txt", "thread.txt");
+
}
@Test
@@ -125,7 +135,10 @@ public class DumpIntegrationTests {
assertTrue(file.exists());
assertNotNull(file.list());
assertEquals(1, file.list().length);
- assertDumpContributionsMade(file.listFiles()[0], "summary.txt", "thread.txt");
+
+ assertDumpContributionsNumberOf(file.listFiles()[0], 2);
+ assertDumpContributionsEssential(file.listFiles()[0], "summary.txt", "thread.txt");
+
}
@Test
@@ -151,7 +164,10 @@ public class DumpIntegrationTests {
assertTrue(file.exists());
assertNotNull(file.list());
assertEquals(1, file.list().length);
- assertDumpContributionsMade(file.listFiles()[0], "heap.out", "summary.txt", "thread.txt", "log.log");
+
+ assertDumpContributionsNumberOf(file.listFiles()[0], 4);
+ assertDumpContributionsEssential(file.listFiles()[0], "summary.txt", "thread.txt", "log.log");
+ assertDumpContributionsAllowable(file.listFiles()[0], "heap.out", "heap.err", "summary.txt", "thread.txt", "log.log");
}
private Configuration getConfiguration(String pid) throws IOException {
@@ -168,13 +184,25 @@ public class DumpIntegrationTests {
return (ConfigurationAdmin) this.bundleContext.getService(serviceReference);
}
- private static void assertDumpContributionsMade(File dumpDirectory, String... contributions) {
- assertTrue(dumpDirectory.exists());
- File[] files = dumpDirectory.listFiles();
- assertEquals("Found '" + Arrays.toString(files) + "' but expected '" + Arrays.toString(contributions) + "'", contributions.length, files.length);
- List<String> contributionsList = Arrays.asList(contributions);
- for (File file : files) {
- assertTrue("The file " + file.getName() + " was not expected", contributionsList.contains(file.getName()));
- }
- }
+ private static void assertDumpContributionsNumberOf(File dumpDirectory, int numberAllowed) {
+ assertTrue("No dump directory found or not a directory.", dumpDirectory.exists() && dumpDirectory.isDirectory());
+ File[] files = dumpDirectory.listFiles();
+ assertEquals("Found '" + Arrays.toString(files) + " which is not the right number of files.", numberAllowed, files.length);
+ }
+
+ private static void assertDumpContributionsEssential(File dumpDirectory, String... contributions) {
+ assertTrue("No dump directory found or not a directory.", dumpDirectory.exists() && dumpDirectory.isDirectory());
+ List<String> dumpDirectoryList = Arrays.asList(dumpDirectory.list());
+ for (String fileName : contributions) {
+ assertTrue("The file " + fileName + " was not contributed", dumpDirectoryList.contains(fileName));
+ }
+ }
+
+ private static void assertDumpContributionsAllowable(File dumpDirectory, String... contributions) {
+ assertTrue("No dump directory found or not a directory.", dumpDirectory.exists() && dumpDirectory.isDirectory());
+ List<String> contributionsList = Arrays.asList(contributions);
+ for (String fileName : dumpDirectory.list()) {
+ assertTrue("The file " + fileName + " was not expected", contributionsList.contains(fileName));
+ }
+ }
}
diff --git a/org.eclipse.virgo.medic.integrationtest/src/test/java/org/eclipse/virgo/medic/eventlog/test/EventLogIntegrationTests.java b/org.eclipse.virgo.medic.integrationtest/src/test/java/org/eclipse/virgo/medic/eventlog/test/EventLogIntegrationTests.java
index 4987221..79f62f9 100644
--- a/org.eclipse.virgo.medic.integrationtest/src/test/java/org/eclipse/virgo/medic/eventlog/test/EventLogIntegrationTests.java
+++ b/org.eclipse.virgo.medic.integrationtest/src/test/java/org/eclipse/virgo/medic/eventlog/test/EventLogIntegrationTests.java
@@ -35,6 +35,8 @@ import org.eclipse.virgo.medic.log.appender.StubAppender;
import org.eclipse.virgo.test.framework.OsgiTestRunner;
import org.eclipse.virgo.test.framework.TestFrameworkUtils;
+//Medic integration tests do not run in the Eclipse IDE.
+
@RunWith(OsgiTestRunner.class)
public class EventLogIntegrationTests {

Back to the top