Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlyn Normington2012-03-16 11:00:29 -0400
committerGlyn Normington2012-03-16 11:00:29 -0400
commitc0351391426d8b5357a1752bb51702f7e65b9d5f (patch)
tree2ad036d557ba8ec049f70748789343823efca276 /org.eclipse.virgo.kernel.deployer.test
parent6ce3514f1729c23b1a0340ed9fa1ebc04e4384a4 (diff)
downloadorg.eclipse.virgo.kernel-c0351391426d8b5357a1752bb51702f7e65b9d5f.tar.gz
org.eclipse.virgo.kernel-c0351391426d8b5357a1752bb51702f7e65b9d5f.tar.xz
org.eclipse.virgo.kernel-c0351391426d8b5357a1752bb51702f7e65b9d5f.zip
317943: add blueprint tests
Diffstat (limited to 'org.eclipse.virgo.kernel.deployer.test')
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/BlueprintDependencyMonitorIntegrationTests.java88
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/test/resources/QuickConsumerBlueprint.jarbin0 -> 1417 bytes
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/test/resources/blueprint/SlowServiceBlueprint.jarbin0 -> 1891 bytes
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/test/resources/config/org.eclipse.virgo.repository.properties5
4 files changed, 92 insertions, 1 deletions
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/BlueprintDependencyMonitorIntegrationTests.java b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/BlueprintDependencyMonitorIntegrationTests.java
new file mode 100644
index 00000000..02cf2cd9
--- /dev/null
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/BlueprintDependencyMonitorIntegrationTests.java
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.kernel.deployer.test;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.virgo.kernel.deployer.core.DeploymentIdentity;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ */
+public class BlueprintDependencyMonitorIntegrationTests extends AbstractDeployerIntegrationTest {
+
+ private static final File LOG_FILE = new File("target/serviceability/eventlog/eventlog.log");
+
+ private int existingLines;
+
+ @Before
+ public void countExistingLogLines() throws IOException {
+ BufferedReader reader = new BufferedReader(new FileReader(LOG_FILE));
+ String line = reader.readLine();
+ existingLines = 0;
+ while (line != null) {
+ existingLines++;
+ line = reader.readLine();
+ }
+ reader.close();
+ }
+
+ private List<String> findLogMessages(String logCode) throws IOException {
+ List<String> logMessages = new ArrayList<String>();
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException ie) {
+
+ }
+
+ BufferedReader reader = new BufferedReader(new FileReader(LOG_FILE));
+ String line;
+ int lines = 0;
+ while ((line = reader.readLine()) != null) {
+ lines++;
+ if (lines > existingLines) {
+ int index = line.indexOf(logCode);
+ if (index > -1) {
+ logMessages.add(line.substring(index));
+ }
+ }
+ }
+ reader.close();
+ return logMessages;
+ }
+
+
+ @Test
+ public void testBlueprintDependencyMonitoring() throws Exception {
+ this.deployer.deploy(new File("src/test/resources/QuickConsumerBlueprint.jar").toURI());
+
+ // We need to sleep for a little while to give the
+ // log output sufficient time to make it out onto disk
+ try {
+ Thread.sleep(21000);
+ } catch (InterruptedException _) {
+ // Ignore
+ }
+
+ assertEquals("One KE0100W message was expected", 1, findLogMessages("<KE0100W>").size());
+ assertEquals("One KE0101I message was expected", 1, findLogMessages("<KE0101I>").size());
+ }
+
+}
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/resources/QuickConsumerBlueprint.jar b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/QuickConsumerBlueprint.jar
new file mode 100644
index 00000000..45f14d29
--- /dev/null
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/QuickConsumerBlueprint.jar
Binary files differ
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/resources/blueprint/SlowServiceBlueprint.jar b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/blueprint/SlowServiceBlueprint.jar
new file mode 100644
index 00000000..468ad8a3
--- /dev/null
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/blueprint/SlowServiceBlueprint.jar
Binary files differ
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/resources/config/org.eclipse.virgo.repository.properties b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/config/org.eclipse.virgo.repository.properties
index 82fdec41..869bfd5e 100644
--- a/org.eclipse.virgo.kernel.deployer.test/src/test/resources/config/org.eclipse.virgo.repository.properties
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/config/org.eclipse.virgo.repository.properties
@@ -41,4 +41,7 @@ src-test-resources-8.searchPattern=src/test/resources/service-scoping/repository
src-test-resources-9.type=external
src-test-resources-9.searchPattern=src/test/resources/plan-provisioning/*
-chain=target-watched,bundles,ivy-cache-bundles,ivy-cache-libraries,src-test-resources-1,src-test-resources-2,src-test-resources-3,src-test-resources-4,src-test-resources-5,src-test-resources-6,src-test-resources-6-plans,src-test-resources-7,src-test-resources-8,src-test-resources-9
+src-test-resources-10.type=external
+src-test-resources-10.searchPattern=src/test/resources/blueprint/*
+
+chain=target-watched,bundles,ivy-cache-bundles,ivy-cache-libraries,src-test-resources-1,src-test-resources-2,src-test-resources-3,src-test-resources-4,src-test-resources-5,src-test-resources-6,src-test-resources-6-plans,src-test-resources-7,src-test-resources-8,src-test-resources-9,src-test-resources-10

Back to the top