Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlyn Normington2010-04-20 10:38:13 -0400
committerGlyn Normington2010-04-20 10:38:13 -0400
commit1fe315346425dcdea73feebd431aba7ae2a75f61 (patch)
tree617c48f3ec41fb2cde58e215bc42bc2b3a5d8678 /org.eclipse.virgo.medic.integrationtest
downloadorg.eclipse.virgo.medic-1fe315346425dcdea73feebd431aba7ae2a75f61.tar.gz
org.eclipse.virgo.medic-1fe315346425dcdea73feebd431aba7ae2a75f61.tar.xz
org.eclipse.virgo.medic-1fe315346425dcdea73feebd431aba7ae2a75f61.zip
[bug 307650] initial check-in from dm Server Virgo medic 0a647883a0176f60d8572f51c7eff591b7e408b6
Diffstat (limited to 'org.eclipse.virgo.medic.integrationtest')
-rw-r--r--org.eclipse.virgo.medic.integrationtest/.classpath39
-rw-r--r--org.eclipse.virgo.medic.integrationtest/.project36
-rw-r--r--org.eclipse.virgo.medic.integrationtest/.settings/com.springsource.server.ide.bundlor.core.prefs5
-rw-r--r--org.eclipse.virgo.medic.integrationtest/.springBeans13
-rw-r--r--org.eclipse.virgo.medic.integrationtest/build.xml8
-rw-r--r--org.eclipse.virgo.medic.integrationtest/ivy.xml33
-rw-r--r--org.eclipse.virgo.medic.integrationtest/src/main/java/.gitignore0
-rw-r--r--org.eclipse.virgo.medic.integrationtest/src/main/java/test/TestClass.java37
-rw-r--r--org.eclipse.virgo.medic.integrationtest/src/main/resources/.gitignore0
-rw-r--r--org.eclipse.virgo.medic.integrationtest/src/test/java/org/eclipse/virgo/medic/dump/test/DumpIntegrationTests.java180
-rw-r--r--org.eclipse.virgo.medic.integrationtest/src/test/java/org/eclipse/virgo/medic/eventlog/test/EventLogIntegrationTests.java115
-rw-r--r--org.eclipse.virgo.medic.integrationtest/src/test/java/org/eclipse/virgo/medic/log/appender/StubAppender.java46
-rw-r--r--org.eclipse.virgo.medic.integrationtest/src/test/java/org/eclipse/virgo/medic/log/test/EntryExitTraceTests.java156
-rw-r--r--org.eclipse.virgo.medic.integrationtest/src/test/java/org/eclipse/virgo/medic/log/test/MedicLoggingIntegrationTests.java55
-rw-r--r--org.eclipse.virgo.medic.integrationtest/src/test/java/org/eclipse/virgo/medic/log/test/PrintStreamWrappingTests.java48
-rw-r--r--org.eclipse.virgo.medic.integrationtest/src/test/resources/EventLogMessages_en.properties1
-rw-r--r--org.eclipse.virgo.medic.integrationtest/src/test/resources/EventLogMessages_it.properties1
-rw-r--r--org.eclipse.virgo.medic.integrationtest/src/test/resources/META-INF/MANIFEST.MF23
-rw-r--r--org.eclipse.virgo.medic.integrationtest/src/test/resources/META-INF/test.config.properties18
-rw-r--r--org.eclipse.virgo.medic.integrationtest/src/test/resources/appender-fragment/META-INF/MANIFEST.MF6
-rw-r--r--org.eclipse.virgo.medic.integrationtest/src/test/resources/appender-fragment/org/eclipse/virgo/medic/log/appender/StubAppender.classbin0 -> 3436 bytes
-rw-r--r--org.eclipse.virgo.medic.integrationtest/src/test/resources/config-fragment/META-INF/MANIFEST.MF5
-rw-r--r--org.eclipse.virgo.medic.integrationtest/src/test/resources/config-fragment/logback.xml42
-rw-r--r--org.eclipse.virgo.medic.integrationtest/src/test/resources/java6-server.profile165
-rw-r--r--org.eclipse.virgo.medic.integrationtest/src/test/resources/logback-test.xml5
-rw-r--r--org.eclipse.virgo.medic.integrationtest/src/test/resources/message-bundle/EventLogMessages_en.properties1
-rw-r--r--org.eclipse.virgo.medic.integrationtest/src/test/resources/message-bundle/EventLogMessages_it.properties1
-rw-r--r--org.eclipse.virgo.medic.integrationtest/src/test/resources/message-bundle/META-INF/MANIFEST.MF3
-rw-r--r--org.eclipse.virgo.medic.integrationtest/src/test/resources/message-fragment/EventLogMessages.properties1
-rw-r--r--org.eclipse.virgo.medic.integrationtest/src/test/resources/message-fragment/META-INF/MANIFEST.MF5
-rw-r--r--org.eclipse.virgo.medic.integrationtest/src/test/resources/test-bundle_1/META-INF/MANIFEST.MF6
-rw-r--r--org.eclipse.virgo.medic.integrationtest/src/test/resources/test-bundle_1/logback.xml15
-rw-r--r--org.eclipse.virgo.medic.integrationtest/src/test/resources/test-bundle_1/test/TestActivator.classbin0 -> 798 bytes
-rw-r--r--org.eclipse.virgo.medic.integrationtest/src/test/resources/test-bundle_2/META-INF/MANIFEST.MF6
-rw-r--r--org.eclipse.virgo.medic.integrationtest/src/test/resources/test-bundle_2/logback.xml15
-rw-r--r--org.eclipse.virgo.medic.integrationtest/src/test/resources/test-bundle_2/test/TestActivator.classbin0 -> 798 bytes
-rw-r--r--org.eclipse.virgo.medic.integrationtest/src/test/resources/test-bundle_3/META-INF/MANIFEST.MF6
-rw-r--r--org.eclipse.virgo.medic.integrationtest/src/test/resources/test-bundle_3/test/TestActivator.classbin0 -> 798 bytes
-rw-r--r--org.eclipse.virgo.medic.integrationtest/template.mf15
39 files changed, 1111 insertions, 0 deletions
diff --git a/org.eclipse.virgo.medic.integrationtest/.classpath b/org.eclipse.virgo.medic.integrationtest/.classpath
new file mode 100644
index 0000000..b7196c2
--- /dev/null
+++ b/org.eclipse.virgo.medic.integrationtest/.classpath
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src/main/java">
+ <attributes>
+ <attribute name="com.springsource.server.ide.jdt.core.test.classpathentry" value="false"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="src" path="src/main/resources">
+ <attributes>
+ <attribute name="com.springsource.server.ide.jdt.core.test.classpathentry" value="false"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java">
+ <attributes>
+ <attribute name="com.springsource.server.ide.jdt.core.test.classpathentry" value="false"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/resources">
+ <attributes>
+ <attribute name="com.springsource.server.ide.jdt.core.test.classpathentry" value="false"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="var" path="MEDIC_IVY_CACHE/org.junit/com.springsource.org.junit/4.7.0/com.springsource.org.junit-4.7.0.jar" sourcepath="/MEDIC_IVY_CACHE/org.junit/com.springsource.org.junit/4.7.0/com.springsource.org.junit-sources-4.7.0.jar"/>
+ <classpathentry kind="var" path="MEDIC_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.5.1.R35x_v20091005/org.eclipse.osgi-3.5.1.R35x_v20091005.jar" sourcepath="/MEDIC_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.5.1.R35x_v20091005/org.eclipse.osgi-sources-3.5.1.R35x_v20091005.jar"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="var" path="MEDIC_IVY_CACHE/org.slf4j/com.springsource.slf4j.api/1.5.10/com.springsource.slf4j.api-1.5.10.jar" sourcepath="/MEDIC_IVY_CACHE/org.slf4j/com.springsource.slf4j.api/1.5.10/com.springsource.slf4j.api-sources-1.5.10.jar"/>
+ <classpathentry kind="var" path="MEDIC_IVY_CACHE/ch.qos.logback/com.springsource.ch.qos.logback.classic/0.9.18/com.springsource.ch.qos.logback.classic-0.9.18.jar" sourcepath="/MEDIC_IVY_CACHE/ch.qos.logback/com.springsource.ch.qos.logback.classic/0.9.18/com.springsource.ch.qos.logback.classic-sources-0.9.18.jar"/>
+ <classpathentry kind="var" path="MEDIC_IVY_CACHE/ch.qos.logback/com.springsource.ch.qos.logback.core/0.9.18/com.springsource.ch.qos.logback.core-0.9.18.jar" sourcepath="/MEDIC_IVY_CACHE/ch.qos.logback/com.springsource.ch.qos.logback.core/0.9.18/com.springsource.ch.qos.logback.core-sources-0.9.18.jar"/>
+ <classpathentry kind="var" path="MEDIC_IVY_CACHE/org.eclipse.virgo.test/org.eclipse.virgo.test.framework/2.1.0.D-20100420091951/org.eclipse.virgo.test.framework-2.1.0.D-20100420091951.jar" sourcepath="/MEDIC_IVY_CACHE/org.eclipse.virgo.test/org.eclipse.virgo.test.framework/2.1.0.D-20100420091951/org.eclipse.virgo.test.framework-sources-2.1.0.D-20100420091951.jar"/>
+ <classpathentry kind="con" path="org.eclipse.ajdt.core.ASPECTJRT_CONTAINER"/>
+ <classpathentry kind="var" path="MEDIC_IVY_CACHE/org.apache.felix/org.apache.felix.configadmin/1.2.4/org.apache.felix.configadmin-1.2.4.jar" sourcepath="/MEDIC_IVY_CACHE/org.apache.felix/org.apache.felix.configadmin/1.2.4/org.apache.felix.configadmin-sources-1.2.4.jar"/>
+ <classpathentry kind="src" path="/org.eclipse.virgo.medic">
+ <attributes>
+ <attribute name="org.eclipse.ajdt.aspectpath" value="org.eclipse.ajdt.aspectpath"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="var" path="MEDIC_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/2.1.0.D-20100420091708/org.eclipse.virgo.util.common-2.1.0.D-20100420091708.jar" sourcepath="/MEDIC_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/2.1.0.D-20100420091708/org.eclipse.virgo.util.common-sources-2.1.0.D-20100420091708.jar"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
diff --git a/org.eclipse.virgo.medic.integrationtest/.project b/org.eclipse.virgo.medic.integrationtest/.project
new file mode 100644
index 0000000..445d599
--- /dev/null
+++ b/org.eclipse.virgo.medic.integrationtest/.project
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.virgo.medic.integrationtest</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.wst.common.project.facet.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.ajdt.core.ajbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.springframework.ide.eclipse.core.springbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.springsource.server.ide.bundlor.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.ajdt.ui.ajnature</nature>
+ <nature>com.springsource.server.ide.facet.core.bundlenature</nature>
+ <nature>org.springframework.ide.eclipse.core.springnature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.virgo.medic.integrationtest/.settings/com.springsource.server.ide.bundlor.core.prefs b/org.eclipse.virgo.medic.integrationtest/.settings/com.springsource.server.ide.bundlor.core.prefs
new file mode 100644
index 0000000..08c417c
--- /dev/null
+++ b/org.eclipse.virgo.medic.integrationtest/.settings/com.springsource.server.ide.bundlor.core.prefs
@@ -0,0 +1,5 @@
+#Thu Nov 12 08:44:20 GMT 2009
+com.springsource.server.ide.bundlor.core.bundlor.generated.manifest.autoformatting=true
+com.springsource.server.ide.bundlor.core.byte.code.scanning=true
+com.springsource.server.ide.bundlor.core.template.properties.files=../build.versions
+eclipse.preferences.version=1
diff --git a/org.eclipse.virgo.medic.integrationtest/.springBeans b/org.eclipse.virgo.medic.integrationtest/.springBeans
new file mode 100644
index 0000000..d079ca1
--- /dev/null
+++ b/org.eclipse.virgo.medic.integrationtest/.springBeans
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beansProjectDescription>
+ <version>1</version>
+ <pluginVersion><![CDATA[2.2.4.RELEASE]]></pluginVersion>
+ <configSuffixes>
+ <configSuffix><![CDATA[xml]]></configSuffix>
+ </configSuffixes>
+ <enableImports><![CDATA[false]]></enableImports>
+ <configs>
+ </configs>
+ <configSets>
+ </configSets>
+</beansProjectDescription>
diff --git a/org.eclipse.virgo.medic.integrationtest/build.xml b/org.eclipse.virgo.medic.integrationtest/build.xml
new file mode 100644
index 0000000..f22c9dd
--- /dev/null
+++ b/org.eclipse.virgo.medic.integrationtest/build.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="org.eclipse.virgo.medic.integrationtest">
+
+ <property file="${basedir}/../build.properties"/>
+ <property file="${basedir}/../build.versions"/>
+ <import file="${basedir}/../virgo-build/weaving/default.xml"/>
+
+</project>
diff --git a/org.eclipse.virgo.medic.integrationtest/ivy.xml b/org.eclipse.virgo.medic.integrationtest/ivy.xml
new file mode 100644
index 0000000..e2d576f
--- /dev/null
+++ b/org.eclipse.virgo.medic.integrationtest/ivy.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?xml-stylesheet type="text/xsl" href="http://ivyrep.jayasoft.org/ivy-doc.xsl"?>
+<ivy-module
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="http://incubator.apache.org/ivy/schemas/ivy.xsd"
+ version="1.3">
+
+ <info organisation="org.eclipse.virgo.medic" module="${ant.project.name}"/>
+
+ <configurations>
+ <include file="${virgo.build.dir}/common/default-ivy-configurations.xml"/>
+ </configurations>
+
+ <publications>
+ <artifact name="${ant.project.name}"/>
+ <artifact name="${ant.project.name}-sources" type="src" ext="jar"/>
+ </publications>
+
+ <dependencies>
+ <dependency org="org.eclipse.osgi" name="org.eclipse.osgi" rev="${org.eclipse.osgi}" conf="compile->runtime"/>
+ <dependency org="org.slf4j" name="com.springsource.slf4j.api" rev="${org.slf4j}" conf="compile->runtime"/>
+
+ <dependency org="org.eclipse.virgo.medic" name="org.eclipse.virgo.medic" rev="latest.integration" conf="aspects->runtime"/>
+ <dependency org="org.aspectj" name="com.springsource.org.aspectj.runtime" rev="${org.aspectj}" conf="aspects->runtime"/>
+
+ <dependency org="org.eclipse.virgo.util" name="org.eclipse.virgo.util.common" rev="${org.eclipse.virgo.util}" conf="test->runtime"/>
+ <dependency org="org.junit" name="com.springsource.org.junit" rev="${org.junit}" conf="test->runtime"/>
+ <dependency org="org.eclipse.virgo.test" name="org.eclipse.virgo.test.framework" rev="${org.eclipse.virgo.test}" conf="test->runtime"/>
+ <dependency org="ch.qos.logback" name="com.springsource.ch.qos.logback.classic" rev="${ch.qos.logback}" conf="test->runtime"/>
+ <dependency org="org.apache.felix" name="org.apache.felix.configadmin" rev="${org.apache.felix.configadmin}" conf="test->runtime"/>
+ </dependencies>
+
+</ivy-module>
diff --git a/org.eclipse.virgo.medic.integrationtest/src/main/java/.gitignore b/org.eclipse.virgo.medic.integrationtest/src/main/java/.gitignore
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/org.eclipse.virgo.medic.integrationtest/src/main/java/.gitignore
diff --git a/org.eclipse.virgo.medic.integrationtest/src/main/java/test/TestClass.java b/org.eclipse.virgo.medic.integrationtest/src/main/java/test/TestClass.java
new file mode 100644
index 0000000..fb1de67
--- /dev/null
+++ b/org.eclipse.virgo.medic.integrationtest/src/main/java/test/TestClass.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * 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 test;
+
+public class TestClass {
+
+ public void publicTest(boolean throwException) {
+ if (throwException) {
+ throw new RuntimeException();
+ }
+ return;
+ }
+
+ void packagePrivateTest(boolean throwException) {
+ if (throwException) {
+ throw new RuntimeException();
+ }
+ return;
+ }
+
+ @SuppressWarnings("unused")
+ private void privateTest(boolean throwException) {
+ if (throwException) {
+ throw new RuntimeException();
+ }
+ return;
+ }
+}
diff --git a/org.eclipse.virgo.medic.integrationtest/src/main/resources/.gitignore b/org.eclipse.virgo.medic.integrationtest/src/main/resources/.gitignore
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/org.eclipse.virgo.medic.integrationtest/src/main/resources/.gitignore
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
new file mode 100644
index 0000000..3ddddc8
--- /dev/null
+++ b/org.eclipse.virgo.medic.integrationtest/src/test/java/org/eclipse/virgo/medic/dump/test/DumpIntegrationTests.java
@@ -0,0 +1,180 @@
+/*******************************************************************************
+ * 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.medic.dump.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.List;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.cm.Configuration;
+import org.osgi.service.cm.ConfigurationAdmin;
+import org.slf4j.LoggerFactory;
+
+import org.eclipse.virgo.medic.dump.DumpGenerator;
+import org.eclipse.virgo.test.framework.OsgiTestRunner;
+import org.eclipse.virgo.test.framework.TestFrameworkUtils;
+
+@RunWith(OsgiTestRunner.class)
+public class DumpIntegrationTests {
+
+ private final BundleContext bundleContext = TestFrameworkUtils.getBundleContextForTestClass(getClass());
+
+ @Before
+ public void deleteDumps() {
+ File dumpsDir = new File("target", "dumps");
+ if (dumpsDir.exists()) {
+ deleteRecursively(dumpsDir);
+ }
+ }
+
+ private static void deleteRecursively(File file) {
+ if (file.isDirectory()) {
+ File[] files = file.listFiles();
+ if (files != null) {
+ for (File fileInDir : files) {
+ deleteRecursively(fileInDir);
+ }
+ }
+ }
+ assertTrue(file.delete());
+ }
+
+ @Test
+ public void dumpGeneratorAvailableFromServiceRegistry() {
+ ServiceReference serviceReference = this.bundleContext.getServiceReference(DumpGenerator.class.getName());
+ assertNotNull(serviceReference);
+ }
+
+ @Test
+ @SuppressWarnings("unchecked")
+ public void dumpDirectoryConfiguration() throws IOException, InterruptedException {
+ Configuration configuration = getConfiguration("org.eclipse.virgo.medic");
+ assertNotNull(configuration);
+
+ Dictionary properties = new Hashtable<String, String>();
+ properties.put("dump.root.directory", "target/dumps/1");
+
+ configuration.update(properties);
+
+ Thread.sleep(2000);
+
+ ServiceReference serviceReference = this.bundleContext.getServiceReference(DumpGenerator.class.getName());
+ DumpGenerator dumpGenerator = (DumpGenerator)this.bundleContext.getService(serviceReference);
+ dumpGenerator.generateDump("bleurgh");
+
+ File file = new File("target/dumps/1");
+ assertTrue(file.exists());
+ assertNotNull(file.list());
+ assertEquals(1, file.list().length);
+ assertDumpContributionsMade(file.listFiles()[0], "heap.out", "summary.txt", "thread.txt");
+
+ properties.put("dump.root.directory", "target/dumps/2");
+ configuration.update(properties);
+
+ Thread.sleep(2000);
+
+ dumpGenerator.generateDump("bleurgh");
+
+ file = new File("target/dumps/2");
+ assertTrue(file.exists());
+ assertNotNull(file.list());
+ assertEquals(1, file.list().length);
+ assertDumpContributionsMade(file.listFiles()[0], "heap.out", "summary.txt", "thread.txt");
+ }
+
+ @Test
+ @SuppressWarnings("unchecked")
+ public void exclusionConfiguration() throws IOException, InterruptedException {
+ Configuration configuration = getConfiguration("org.eclipse.virgo.medic");
+ assertNotNull(configuration);
+
+ Dictionary properties = new Hashtable<String, String>();
+ properties.put("dump.root.directory", "target/dumps/1");
+ properties.put("dump.exclusions.bleurgh", "heap");
+
+ configuration.update(properties);
+
+ Thread.sleep(2000);
+
+ ServiceReference serviceReference = this.bundleContext.getServiceReference(DumpGenerator.class.getName());
+ DumpGenerator dumpGenerator = (DumpGenerator)this.bundleContext.getService(serviceReference);
+ dumpGenerator.generateDump("bleurgh");
+
+ File file = new File("target/dumps/1");
+ assertTrue(file.exists());
+ assertNotNull(file.list());
+ assertEquals(1, file.list().length);
+ assertDumpContributionsMade(file.listFiles()[0], "summary.txt", "thread.txt");
+ }
+
+ @Test
+ public void logDumpEnabled() throws IOException, InterruptedException {
+ Configuration configuration = getConfiguration("org.eclipse.virgo.medic");
+ assertNotNull(configuration);
+
+ Dictionary<String, String> properties = new Hashtable<String, String>();
+ properties.put("dump.root.directory", "target/dumps/1");
+ properties.put("log.dump.level", "ERROR");
+
+ configuration.update(properties);
+
+ Thread.sleep(2000);
+
+ LoggerFactory.getLogger(getClass()).info("Test");
+
+ ServiceReference serviceReference = this.bundleContext.getServiceReference(DumpGenerator.class.getName());
+ DumpGenerator dumpGenerator = (DumpGenerator)this.bundleContext.getService(serviceReference);
+ dumpGenerator.generateDump("bleurgh");
+
+ File file = new File("target/dumps/1");
+ assertTrue(file.exists());
+ assertNotNull(file.list());
+ assertEquals(1, file.list().length);
+ assertDumpContributionsMade(file.listFiles()[0], "heap.out", "summary.txt", "thread.txt", "log.log");
+ }
+
+ private Configuration getConfiguration(String pid) throws IOException {
+ ConfigurationAdmin configurationAdmin = getConfigurationAdmin();
+ assertNotNull(configurationAdmin);
+
+ return configurationAdmin.getConfiguration(pid);
+ }
+
+ private ConfigurationAdmin getConfigurationAdmin() {
+ ServiceReference serviceReference = this.bundleContext.getServiceReference(ConfigurationAdmin.class.getName());
+ assertNotNull(serviceReference);
+
+ 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()));
+ }
+ }
+}
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
new file mode 100644
index 0000000..4987221
--- /dev/null
+++ b/org.eclipse.virgo.medic.integrationtest/src/test/java/org/eclipse/virgo/medic/eventlog/test/EventLogIntegrationTests.java
@@ -0,0 +1,115 @@
+/*******************************************************************************
+ * 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.medic.eventlog.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.List;
+import java.util.Locale;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.ServiceReference;
+
+import ch.qos.logback.classic.spi.LoggingEvent;
+
+
+import org.eclipse.virgo.medic.eventlog.EventLogger;
+import org.eclipse.virgo.medic.eventlog.EventLoggerFactory;
+import org.eclipse.virgo.medic.eventlog.Level;
+import org.eclipse.virgo.medic.log.appender.StubAppender;
+import org.eclipse.virgo.test.framework.OsgiTestRunner;
+import org.eclipse.virgo.test.framework.TestFrameworkUtils;
+
+@RunWith(OsgiTestRunner.class)
+public class EventLogIntegrationTests {
+
+ private BundleContext bundleContext;
+
+ private Bundle messageBundle;
+
+ @Before
+ public void before() throws BundleException {
+ Locale.setDefault(Locale.ITALIAN);
+ this.bundleContext = TestFrameworkUtils.getBundleContextForTestClass(getClass());
+ messageBundle = this.bundleContext.installBundle("file:src/test/resources/message-bundle");
+ this.bundleContext.installBundle("file:src/test/resources/message-fragment");
+ }
+
+ @Test
+ public void availabilityOfEventLoggerFactory() {
+ ServiceReference serviceReference = this.bundleContext.getServiceReference(EventLoggerFactory.class.getName());
+ assertNotNull(serviceReference);
+ }
+
+ @Test
+ public void availabilityOfEventLogger() {
+ ServiceReference serviceReference = this.bundleContext.getServiceReference(EventLogger.class.getName());
+ assertNotNull(serviceReference);
+ }
+
+ @Test
+ public void eventLoggingWithMessageFromCurrentBundle() {
+ ServiceReference serviceReference = this.bundleContext.getServiceReference(EventLogger.class.getName());
+ assertNotNull(serviceReference);
+ EventLogger eventLogger = (EventLogger)this.bundleContext.getService(serviceReference);
+ eventLogger.log("1234", Level.WARNING, "orange", "lemon");
+
+ List<LoggingEvent> loggingEvent = StubAppender.getAndResetLoggingEvents("default-stub");
+ assertEquals(1, loggingEvent.size());
+ assertEquals("English orange and lemon", loggingEvent.get(0).getMessage());
+
+ loggingEvent = StubAppender.getAndResetLoggingEvents("localized-stub");
+ assertEquals(1, loggingEvent.size());
+ assertEquals("Italian orange and lemon", loggingEvent.get(0).getMessage());
+
+ }
+
+ @Test
+ public void eventLoggingWithMessageFromFragment() throws Exception {
+ ServiceReference serviceReference = this.bundleContext.getServiceReference(EventLoggerFactory.class.getName());
+ assertNotNull(serviceReference);
+ EventLoggerFactory eventLoggerFactory = (EventLoggerFactory)this.bundleContext.getService(serviceReference);
+ EventLogger eventLogger = eventLoggerFactory.createEventLogger(this.messageBundle);
+ eventLogger.log("3456", Level.WARNING, "oak", "sycamore");
+
+ List<LoggingEvent> loggingEvent = StubAppender.getAndResetLoggingEvents("default-stub");
+ assertEquals(1, loggingEvent.size());
+ assertEquals("Shared oak and sycamore", loggingEvent.get(0).getMessage());
+
+ loggingEvent = StubAppender.getAndResetLoggingEvents("localized-stub");
+ assertEquals(1, loggingEvent.size());
+ assertEquals("Shared oak and sycamore", loggingEvent.get(0).getMessage());
+ }
+
+ @Test
+ public void eventLoggingWithMessageFromSpecificBundle() throws Exception {
+ ServiceReference serviceReference = this.bundleContext.getServiceReference(EventLoggerFactory.class.getName());
+ assertNotNull(serviceReference);
+ EventLoggerFactory eventLoggerFactory = (EventLoggerFactory)this.bundleContext.getService(serviceReference);
+ EventLogger eventLogger = eventLoggerFactory.createEventLogger(this.messageBundle);
+ eventLogger.log("2345", Level.WARNING, "potato", "cauliflower");
+
+ List<LoggingEvent> loggingEvent = StubAppender.getAndResetLoggingEvents("default-stub");
+ assertEquals(1, loggingEvent.size());
+ assertEquals("English potato and cauliflower", loggingEvent.get(0).getMessage());
+
+ loggingEvent = StubAppender.getAndResetLoggingEvents("localized-stub");
+ assertEquals(1, loggingEvent.size());
+ assertEquals("Italian potato and cauliflower", loggingEvent.get(0).getMessage());
+ }
+}
diff --git a/org.eclipse.virgo.medic.integrationtest/src/test/java/org/eclipse/virgo/medic/log/appender/StubAppender.java b/org.eclipse.virgo.medic.integrationtest/src/test/java/org/eclipse/virgo/medic/log/appender/StubAppender.java
new file mode 100644
index 0000000..68e2974
--- /dev/null
+++ b/org.eclipse.virgo.medic.integrationtest/src/test/java/org/eclipse/virgo/medic/log/appender/StubAppender.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * 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.medic.log.appender;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import ch.qos.logback.classic.spi.LoggingEvent;
+import ch.qos.logback.core.AppenderBase;
+
+public class StubAppender extends AppenderBase<LoggingEvent> {
+
+ private static Map<String, List<LoggingEvent>> loggingEvents = new HashMap<String, List<LoggingEvent>>();
+
+ @Override
+ protected void append(LoggingEvent eventObject) {
+ getLoggingEventsByName(name).add(eventObject);
+ }
+
+ public static List<LoggingEvent> getAndResetLoggingEvents(String name) {
+ List<LoggingEvent> loggingEvents = getLoggingEventsByName(name);
+ List<LoggingEvent> response = new ArrayList<LoggingEvent>(loggingEvents);
+ loggingEvents.clear();
+ return response;
+ }
+
+ private static List<LoggingEvent> getLoggingEventsByName(String name) {
+ List<LoggingEvent> loggingEventsForName = loggingEvents.get(name);
+ if (loggingEventsForName == null) {
+ loggingEventsForName = new ArrayList<LoggingEvent>();
+ loggingEvents.put(name, loggingEventsForName);
+ }
+ return loggingEventsForName;
+ }
+}
diff --git a/org.eclipse.virgo.medic.integrationtest/src/test/java/org/eclipse/virgo/medic/log/test/EntryExitTraceTests.java b/org.eclipse.virgo.medic.integrationtest/src/test/java/org/eclipse/virgo/medic/log/test/EntryExitTraceTests.java
new file mode 100644
index 0000000..b476e80
--- /dev/null
+++ b/org.eclipse.virgo.medic.integrationtest/src/test/java/org/eclipse/virgo/medic/log/test/EntryExitTraceTests.java
@@ -0,0 +1,156 @@
+/*******************************************************************************
+ * 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.medic.log.test;
+
+import static org.junit.Assert.assertEquals;
+
+import java.lang.reflect.Method;
+import java.util.List;
+
+import org.eclipse.virgo.medic.log.appender.StubAppender;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import test.TestClass;
+import ch.qos.logback.classic.Level;
+import ch.qos.logback.classic.spi.LoggingEvent;
+
+
+public class EntryExitTraceTests {
+
+ private final TestClass testClass = new TestClass();
+
+ @BeforeClass
+ public static void ensureConfiguredContextSelectorIsDefaultContextSelector() {
+ System.setProperty("logback.ContextSelector", "ch.qos.logback.classic.selector.DefaultContextSelector");
+ }
+
+ @Test
+ public void testPublicBefore() {
+ testClass.publicTest(false);
+ List<LoggingEvent> loggingEvents = StubAppender.getAndResetLoggingEvents(null);
+ assertEquals(2, loggingEvents.size());
+ LoggingEvent event = loggingEvents.get(0);
+ assertEquals(Level.INFO, event.getLevel());
+ assertEquals("> public void test.TestClass.publicTest(boolean)", event.getFormattedMessage());
+ assertEquals("public void test.TestClass.publicTest(boolean)", event.getArgumentArray()[1]);
+ }
+
+ @Test
+ public void testPublicAfterReturn() {
+ testClass.publicTest(false);
+ List<LoggingEvent> loggingEvents = StubAppender.getAndResetLoggingEvents(null);
+ assertEquals(2, loggingEvents.size());
+ LoggingEvent event = loggingEvents.get(1);
+ assertEquals(Level.INFO, event.getLevel());
+ assertEquals("< public void test.TestClass.publicTest(boolean)", event.getFormattedMessage());
+ assertEquals("public void test.TestClass.publicTest(boolean)", event.getArgumentArray()[1]);
+ }
+
+ @Test
+ public void testPublicAfterThrowing() {
+ try {
+ testClass.publicTest(true);
+ } catch (Exception e) {
+ List<LoggingEvent> loggingEvents = StubAppender.getAndResetLoggingEvents(null);
+ assertEquals(2, loggingEvents.size());
+ LoggingEvent event = loggingEvents.get(1);
+ assertEquals(Level.INFO, event.getLevel());
+ assertEquals("< public void test.TestClass.publicTest(boolean)", event.getFormattedMessage());
+ assertEquals(RuntimeException.class.getName(), event.getThrowableProxy().getClassName());
+ }
+ }
+
+ @Test
+ public void testPackagePrivateBefore() throws Exception {
+ Method method = testClass.getClass().getDeclaredMethod("packagePrivateTest", boolean.class);
+ method.setAccessible(true);
+ method.invoke(testClass, false);
+ List<LoggingEvent> loggingEvents = StubAppender.getAndResetLoggingEvents(null);
+ assertEquals(2, loggingEvents.size());
+ LoggingEvent event = loggingEvents.get(0);
+ assertEquals(Level.DEBUG, event.getLevel());
+ assertEquals("> void test.TestClass.packagePrivateTest(boolean)", event.getFormattedMessage());
+ assertEquals("void test.TestClass.packagePrivateTest(boolean)", event.getArgumentArray()[1]);
+ }
+
+ @Test
+ public void testPackagePrivateAfterReturn() throws Exception {
+ Method method = testClass.getClass().getDeclaredMethod("packagePrivateTest", boolean.class);
+ method.setAccessible(true);
+ method.invoke(testClass, false);
+ List<LoggingEvent> loggingEvents = StubAppender.getAndResetLoggingEvents(null);
+ assertEquals(2, loggingEvents.size());
+ LoggingEvent event = loggingEvents.get(1);
+ assertEquals(Level.DEBUG, event.getLevel());
+ assertEquals("< void test.TestClass.packagePrivateTest(boolean)", event.getFormattedMessage());
+ assertEquals("void test.TestClass.packagePrivateTest(boolean)", event.getArgumentArray()[1]);
+ }
+
+ @Test
+ public void testPackagePrivateAfterThrowing() {
+ try {
+ Method method = testClass.getClass().getDeclaredMethod("packagePrivateTest", boolean.class);
+ method.setAccessible(true);
+ method.invoke(testClass, true);
+ } catch (Exception e) {
+ List<LoggingEvent> loggingEvents = StubAppender.getAndResetLoggingEvents(null);
+ assertEquals(2, loggingEvents.size());
+ LoggingEvent event = loggingEvents.get(1);
+ assertEquals(Level.DEBUG, event.getLevel());
+ assertEquals("< void test.TestClass.packagePrivateTest(boolean)", event.getFormattedMessage());
+ assertEquals(RuntimeException.class.getName(), event.getThrowableProxy().getClassName());
+ }
+ }
+
+ @Test
+ public void testPrivateBefore() throws Exception {
+ Method method = testClass.getClass().getDeclaredMethod("privateTest", boolean.class);
+ method.setAccessible(true);
+ method.invoke(testClass, false);
+ List<LoggingEvent> loggingEvents = StubAppender.getAndResetLoggingEvents(null);
+ assertEquals(2, loggingEvents.size());
+ LoggingEvent event = loggingEvents.get(0);
+ assertEquals(Level.TRACE, event.getLevel());
+ assertEquals("> private void test.TestClass.privateTest(boolean)", event.getFormattedMessage());
+ assertEquals("private void test.TestClass.privateTest(boolean)", event.getArgumentArray()[1]);
+ }
+
+ @Test
+ public void testPrivateAfterReturn() throws Exception {
+ Method method = testClass.getClass().getDeclaredMethod("privateTest", boolean.class);
+ method.setAccessible(true);
+ method.invoke(testClass, false);
+ List<LoggingEvent> loggingEvents = StubAppender.getAndResetLoggingEvents(null);
+ assertEquals(2, loggingEvents.size());
+ LoggingEvent event = loggingEvents.get(1);
+ assertEquals(Level.TRACE, event.getLevel());
+ assertEquals("< private void test.TestClass.privateTest(boolean)", event.getFormattedMessage());
+ assertEquals("private void test.TestClass.privateTest(boolean)", event.getArgumentArray()[1]);
+ }
+
+ @Test
+ public void testPrivateAfterThrowing() {
+ try {
+ Method method = testClass.getClass().getDeclaredMethod("privateTest", boolean.class);
+ method.setAccessible(true);
+ method.invoke(testClass, true);
+ } catch (Exception e) {
+ List<LoggingEvent> loggingEvents = StubAppender.getAndResetLoggingEvents(null);
+ assertEquals(2, loggingEvents.size());
+ LoggingEvent event = loggingEvents.get(1);
+ assertEquals(Level.TRACE, event.getLevel());
+ assertEquals("< private void test.TestClass.privateTest(boolean)", event.getFormattedMessage());
+ assertEquals(RuntimeException.class.getName(), event.getThrowableProxy().getClassName());
+ }
+ }
+}
diff --git a/org.eclipse.virgo.medic.integrationtest/src/test/java/org/eclipse/virgo/medic/log/test/MedicLoggingIntegrationTests.java b/org.eclipse.virgo.medic.integrationtest/src/test/java/org/eclipse/virgo/medic/log/test/MedicLoggingIntegrationTests.java
new file mode 100644
index 0000000..2b8b5e8
--- /dev/null
+++ b/org.eclipse.virgo.medic.integrationtest/src/test/java/org/eclipse/virgo/medic/log/test/MedicLoggingIntegrationTests.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * 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.medic.log.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+
+
+import org.eclipse.virgo.medic.log.LoggingConfigurationPublisher;
+import org.eclipse.virgo.medic.log.appender.StubAppender;
+import org.eclipse.virgo.test.framework.OsgiTestRunner;
+import org.eclipse.virgo.test.framework.TestFrameworkUtils;
+
+@RunWith(OsgiTestRunner.class)
+public class MedicLoggingIntegrationTests {
+
+ private BundleContext bundleContext;
+
+ @Before
+ public void before() {
+ this.bundleContext = TestFrameworkUtils.getBundleContextForTestClass(getClass());
+ }
+
+ @Test
+ public void test() throws BundleException {
+ bundleContext.installBundle("file:src/test/resources/test-bundle_1").start();
+ assertEquals(1, StubAppender.getAndResetLoggingEvents("bundle1-stub").size());
+
+ bundleContext.installBundle("file:src/test/resources/test-bundle_2").start();
+ assertEquals(1, StubAppender.getAndResetLoggingEvents("bundle2-stub").size());
+
+ bundleContext.installBundle("file:src/test/resources/test-bundle_3").start();
+ assertEquals(1, StubAppender.getAndResetLoggingEvents("root-stub").size());
+ }
+
+ @Test
+ public void availabilityOfConfigurationPublisher() {
+ assertNotNull(bundleContext.getServiceReference(LoggingConfigurationPublisher.class.getName()));
+ }
+}
diff --git a/org.eclipse.virgo.medic.integrationtest/src/test/java/org/eclipse/virgo/medic/log/test/PrintStreamWrappingTests.java b/org.eclipse.virgo.medic.integrationtest/src/test/java/org/eclipse/virgo/medic/log/test/PrintStreamWrappingTests.java
new file mode 100644
index 0000000..6b22ed8
--- /dev/null
+++ b/org.eclipse.virgo.medic.integrationtest/src/test/java/org/eclipse/virgo/medic/log/test/PrintStreamWrappingTests.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * 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.medic.log.test;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.List;
+
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import ch.qos.logback.classic.spi.LoggingEvent;
+
+import org.eclipse.virgo.medic.log.appender.StubAppender;
+import org.eclipse.virgo.test.framework.OsgiTestRunner;
+
+
+@RunWith(OsgiTestRunner.class)
+public class PrintStreamWrappingTests {
+
+ @Test
+ @Ignore("Test fails on the CI server as it wraps System.out")
+ public void sysOutWrapping() {
+ System.out.println("Hello world!");
+ List<LoggingEvent> loggingEvents = StubAppender.getAndResetLoggingEvents("root-stub");
+ assertEquals(1, loggingEvents.size());
+ assertEquals("Hello world!", loggingEvents.get(0).getMessage());
+ }
+
+ @Test
+ @Ignore("Test fails on the CI server as it wraps System.err")
+ public void sysErrWrapping() {
+ System.err.println("Hello world!");
+ List<LoggingEvent> loggingEvents = StubAppender.getAndResetLoggingEvents("root-stub");
+ assertEquals(1, loggingEvents.size());
+ assertEquals("Hello world!", loggingEvents.get(0).getMessage());
+ }
+}
diff --git a/org.eclipse.virgo.medic.integrationtest/src/test/resources/EventLogMessages_en.properties b/org.eclipse.virgo.medic.integrationtest/src/test/resources/EventLogMessages_en.properties
new file mode 100644
index 0000000..7a26421
--- /dev/null
+++ b/org.eclipse.virgo.medic.integrationtest/src/test/resources/EventLogMessages_en.properties
@@ -0,0 +1 @@
+1234=English {} and {}
diff --git a/org.eclipse.virgo.medic.integrationtest/src/test/resources/EventLogMessages_it.properties b/org.eclipse.virgo.medic.integrationtest/src/test/resources/EventLogMessages_it.properties
new file mode 100644
index 0000000..75634d3
--- /dev/null
+++ b/org.eclipse.virgo.medic.integrationtest/src/test/resources/EventLogMessages_it.properties
@@ -0,0 +1 @@
+1234=Italian {} and {}
diff --git a/org.eclipse.virgo.medic.integrationtest/src/test/resources/META-INF/MANIFEST.MF b/org.eclipse.virgo.medic.integrationtest/src/test/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..97e747d
--- /dev/null
+++ b/org.eclipse.virgo.medic.integrationtest/src/test/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,23 @@
+Manifest-Version: 1.0
+Excluded-Import: ch.qos.logback.classic
+Tool: Bundlor 1.0.0.M6
+Bundle-Name: Medic Logging Integration Tests
+Bundle-SymbolicName: org.eclipse.virgo.medic.log.test
+Import-Package: ch.qos.logback.classic.spi,
+ ch.qos.logback.core,
+ org.aspectj.lang;version="[1.6.6,2.0.0)",
+ org.aspectj.lang.reflect;version="[1.6.6,2.0.0)",
+ org.aspectj.runtime.internal;version="[1.6.6,2.0.0)",
+ org.aspectj.runtime.reflect;version="[1.6.6,2.0.0)",
+ org.eclipse.virgo.medic.dump;version="[1.0.1,1.0.2)",
+ org.eclipse.virgo.medic.eventlog;version="[1.0.1,1.0.2)",
+ org.eclipse.virgo.medic.log;version="[1.0.1,1.0.2)",
+ org.eclipse.virgo.medic.log.appender;version=0,
+ org.eclipse.virgo.test.framework,
+ org.junit,
+ org.junit.runner,
+ org.osgi.framework;version=0,
+ org.osgi.service.cm,
+ org.slf4j
+Bundle-Version: 1.0.0
+Bundle-ManifestVersion: 2
diff --git a/org.eclipse.virgo.medic.integrationtest/src/test/resources/META-INF/test.config.properties b/org.eclipse.virgo.medic.integrationtest/src/test/resources/META-INF/test.config.properties
new file mode 100644
index 0000000..8cfabaa
--- /dev/null
+++ b/org.eclipse.virgo.medic.integrationtest/src/test/resources/META-INF/test.config.properties
@@ -0,0 +1,18 @@
+launcher.bundles=\
+file:../ivy-cache/repository/org.aspectj/com.springsource.org.aspectj.runtime/1.6.6.RELEASE/com.springsource.org.aspectj.runtime-1.6.6.RELEASE.jar@start,\
+file:../ivy-cache/repository/org.slf4j/com.springsource.slf4j.api/1.5.10/com.springsource.slf4j.api-1.5.10.jar@start,\
+file:../ivy-cache/repository/org.eclipse.virgo.util/org.eclipse.virgo.util.common/2.1.0.D-20100420091708/org.eclipse.virgo.util.common-2.1.0.D-20100420091708.jar,\
+file:../ivy-cache/repository/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/2.1.0.D-20100420091708/org.eclipse.virgo.util.osgi-2.1.0.D-20100420091708.jar,\
+file:../ivy-cache/repository/org.eclipse.virgo.util/org.eclipse.virgo.util.parser.manifest/2.1.0.D-20100420091708/org.eclipse.virgo.util.parser.manifest-2.1.0.D-20100420091708.jar,\
+file:../ivy-cache/repository/org.apache.felix/org.apache.felix.configadmin/1.2.4/org.apache.felix.configadmin-1.2.4.jar@start,\
+file:../org.eclipse.virgo.medic/target/artifacts/org.eclipse.virgo.medic.jar@start,\
+file:../org.eclipse.virgo.medic.core/target/artifacts/org.eclipse.virgo.medic.core.jar@start,\
+file:src/test/resources/config-fragment,\
+file:src/test/resources/appender-fragment
+
+osgi.java.profile.bootdelegation=override
+osgi.parentClassloader=fwk
+osgi.context.bootdelegation=false
+osgi.compatibility.bootdelegation=false
+osgi.console=2401
+osgi.java.profile=file:src/test/resources/java6-server.profile
diff --git a/org.eclipse.virgo.medic.integrationtest/src/test/resources/appender-fragment/META-INF/MANIFEST.MF b/org.eclipse.virgo.medic.integrationtest/src/test/resources/appender-fragment/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..732bebd
--- /dev/null
+++ b/org.eclipse.virgo.medic.integrationtest/src/test/resources/appender-fragment/META-INF/MANIFEST.MF
@@ -0,0 +1,6 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: appender.fragment
+Fragment-Host: org.eclipse.virgo.medic.core
+Export-Package: org.eclipse.virgo.medic.log.appender
+
diff --git a/org.eclipse.virgo.medic.integrationtest/src/test/resources/appender-fragment/org/eclipse/virgo/medic/log/appender/StubAppender.class b/org.eclipse.virgo.medic.integrationtest/src/test/resources/appender-fragment/org/eclipse/virgo/medic/log/appender/StubAppender.class
new file mode 100644
index 0000000..39b1b41
--- /dev/null
+++ b/org.eclipse.virgo.medic.integrationtest/src/test/resources/appender-fragment/org/eclipse/virgo/medic/log/appender/StubAppender.class
Binary files differ
diff --git a/org.eclipse.virgo.medic.integrationtest/src/test/resources/config-fragment/META-INF/MANIFEST.MF b/org.eclipse.virgo.medic.integrationtest/src/test/resources/config-fragment/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..cb77330
--- /dev/null
+++ b/org.eclipse.virgo.medic.integrationtest/src/test/resources/config-fragment/META-INF/MANIFEST.MF
@@ -0,0 +1,5 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: config.fragment
+Bundle-Vendor: SpringSource Inc.
+Fragment-Host: org.eclipse.virgo.medic.core
diff --git a/org.eclipse.virgo.medic.integrationtest/src/test/resources/config-fragment/logback.xml b/org.eclipse.virgo.medic.integrationtest/src/test/resources/config-fragment/logback.xml
new file mode 100644
index 0000000..1332bac
--- /dev/null
+++ b/org.eclipse.virgo.medic.integrationtest/src/test/resources/config-fragment/logback.xml
@@ -0,0 +1,42 @@
+<configuration>
+
+ <appender name="localized-console" class="ch.qos.logback.core.ConsoleAppender">
+ <layout class="ch.qos.logback.classic.PatternLayout">
+ <Pattern>Localized: %-24.24thread &lt;%X{medic.eventCode}&gt; %msg %ex%n</Pattern>
+ </layout>
+ </appender>
+
+ <appender name="default-console" class="ch.qos.logback.core.ConsoleAppender">
+ <layout class="ch.qos.logback.classic.PatternLayout">
+ <Pattern>Default: %-24.24thread &lt;%X{medic.eventCode}&gt; %msg %ex%n</Pattern>
+ </layout>
+ </appender>
+
+ <appender name="root-console" class="ch.qos.logback.core.ConsoleAppender">
+ <layout class="ch.qos.logback.classic.PatternLayout">
+ <Pattern>Root: [%d{yyyy-MM-dd HH:mm:ss.SSS}] %-24.24thread %msg %ex%n</Pattern>
+ </layout>
+ </appender>
+
+ <appender name="root-stub" class="org.eclipse.virgo.medic.log.appender.StubAppender"/>
+
+ <appender name="default-stub" class="org.eclipse.virgo.medic.log.appender.StubAppender"/>
+
+ <appender name="localized-stub" class="org.eclipse.virgo.medic.log.appender.StubAppender"/>
+
+ <logger name="org.eclipse.virgo.medic.eventlog.localized">
+ <appender-ref ref="localized-console" />
+ <appender-ref ref="localized-stub" />
+ </logger>
+
+ <logger name="org.eclipse.virgo.medic.eventlog.default">
+ <appender-ref ref="default-console" />
+ <appender-ref ref="default-stub" />
+ </logger>
+
+ <root level="debug">
+ <appender-ref ref="root-stub"/>
+ <appender-ref ref="root-console"/>
+ </root>
+
+</configuration>
diff --git a/org.eclipse.virgo.medic.integrationtest/src/test/resources/java6-server.profile b/org.eclipse.virgo.medic.integrationtest/src/test/resources/java6-server.profile
new file mode 100644
index 0000000..9a72f39
--- /dev/null
+++ b/org.eclipse.virgo.medic.integrationtest/src/test/resources/java6-server.profile
@@ -0,0 +1,165 @@
+org.osgi.framework.system.packages = \
+ javax.accessibility,\
+ javax.crypto,\
+ javax.crypto.interfaces,\
+ javax.crypto.spec,\
+ javax.imageio,\
+ javax.imageio.event,\
+ javax.imageio.metadata,\
+ javax.imageio.plugins.bmp,\
+ javax.imageio.plugins.jpeg,\
+ javax.imageio.spi,\
+ javax.imageio.stream,\
+ javax.jws,\
+ javax.jws;version="2.0",\
+ javax.jws.soap,\
+ javax.jws.soap;version="2.0",\
+ javax.management,\
+ javax.management.loading,\
+ javax.management.modelmbean,\
+ javax.management.monitor,\
+ javax.management.openmbean,\
+ javax.management.relation,\
+ javax.management.remote,\
+ javax.management.remote.rmi,\
+ javax.management.timer,\
+ javax.naming,\
+ javax.naming.directory,\
+ javax.naming.event,\
+ javax.naming.ldap,\
+ javax.naming.spi,\
+ javax.net,\
+ javax.net.ssl,\
+ javax.print,\
+ javax.print.attribute,\
+ javax.print.attribute.standard,\
+ javax.print.event,\
+ javax.rmi,\
+ javax.rmi.CORBA,\
+ javax.rmi.ssl,\
+ javax.security.auth,\
+ javax.security.auth.callback,\
+ javax.security.auth.kerberos,\
+ javax.security.auth.login,\
+ javax.security.auth.spi,\
+ javax.security.auth.x500,\
+ javax.security.cert,\
+ javax.security.sasl,\
+ javax.sound.midi,\
+ javax.sound.midi.spi,\
+ javax.sound.sampled,\
+ javax.sound.sampled.spi,\
+ javax.sql,\
+ javax.sql.rowset,\
+ javax.sql.rowset.serial,\
+ javax.sql.rowset.spi,\
+ javax.swing,\
+ javax.swing.border,\
+ javax.swing.colorchooser,\
+ javax.swing.event,\
+ javax.swing.filechooser,\
+ javax.swing.plaf,\
+ javax.swing.plaf.basic,\
+ javax.swing.plaf.metal,\
+ javax.swing.plaf.multi,\
+ javax.swing.plaf.synth,\
+ javax.swing.table,\
+ javax.swing.text,\
+ javax.swing.text.html,\
+ javax.swing.text.html.parser,\
+ javax.swing.text.rtf,\
+ javax.swing.tree,\
+ javax.swing.undo,\
+ javax.transaction,\
+ javax.transaction;version="1.0.1",\
+ javax.transaction;version="1.1.0",\
+ javax.transaction.xa,\
+ javax.transaction.xa;version="1.0.1",\
+ javax.transaction.xa;version="1.1.0",\
+ javax.xml,\
+ javax.xml;version="1.0.1",\
+ javax.xml.bind,\
+ javax.xml.bind;version="2.0",\
+ javax.xml.bind.annotation,\
+ javax.xml.bind.annotation;version="2.0",\
+ javax.xml.bind.annotation.adapters,\
+ javax.xml.bind.annotation.adapters;version="2.0",\
+ javax.xml.bind.attachment,\
+ javax.xml.bind.attachment;version="2.0",\
+ javax.xml.bind.helpers,\
+ javax.xml.bind.helpers;version="2.0",\
+ javax.xml.bind.util,\
+ javax.xml.bind.util;version="2.0",\
+ javax.xml.datatype,\
+ javax.xml.namespace,\
+ javax.xml.parsers,\
+ javax.xml.soap,\
+ javax.xml.soap;version="1.3.0",\
+ javax.xml.stream,\
+ javax.xml.stream;version="1.0.1",\
+ javax.xml.stream.events,\
+ javax.xml.stream.events;version="1.0.1",\
+ javax.xml.stream.util,\
+ javax.xml.stream.util;version="1.0.1",\
+ javax.xml.transform,\
+ javax.xml.transform.dom,\
+ javax.xml.transform.sax,\
+ javax.xml.transform.stream,\
+ javax.xml.validation,\
+ javax.xml.xpath,\
+ org.ietf.jgss,\
+ org.omg.CORBA,\
+ org.omg.CORBA_2_3,\
+ org.omg.CORBA_2_3.portable,\
+ org.omg.CORBA.DynAnyPackage,\
+ org.omg.CORBA.ORBPackage,\
+ org.omg.CORBA.portable,\
+ org.omg.CORBA.TypeCodePackage,\
+ org.omg.CosNaming,\
+ org.omg.CosNaming.NamingContextExtPackage,\
+ org.omg.CosNaming.NamingContextPackage,\
+ org.omg.Dynamic,\
+ org.omg.DynamicAny,\
+ org.omg.DynamicAny.DynAnyFactoryPackage,\
+ org.omg.DynamicAny.DynAnyPackage,\
+ org.omg.IOP,\
+ org.omg.IOP.CodecFactoryPackage,\
+ org.omg.IOP.CodecPackage,\
+ org.omg.Messaging,\
+ org.omg.PortableInterceptor,\
+ org.omg.PortableInterceptor.ORBInitInfoPackage,\
+ org.omg.PortableServer,\
+ org.omg.PortableServer.CurrentPackage,\
+ org.omg.PortableServer.POAManagerPackage,\
+ org.omg.PortableServer.POAPackage,\
+ org.omg.PortableServer.portable,\
+ org.omg.PortableServer.ServantLocatorPackage,\
+ org.omg.SendingContext,\
+ org.omg.stub.java.rmi,\
+ org.w3c.dom,\
+ org.w3c.dom.bootstrap,\
+ org.w3c.dom.css,\
+ org.w3c.dom.events,\
+ org.w3c.dom.html,\
+ org.w3c.dom.ls,\
+ org.w3c.dom.ranges,\
+ org.w3c.dom.stylesheets,\
+ org.w3c.dom.traversal,\
+ org.w3c.dom.views ,\
+ org.xml.sax,\
+ org.xml.sax.ext,\
+ org.xml.sax.helpers
+org.osgi.framework.bootdelegation = \
+ com_cenqua_clover,\
+ com.cenqua.*,\
+ com.yourkit.*,\
+ sun.reflect,\
+ sun.reflect.*
+org.osgi.framework.executionenvironment = \
+ OSGi/Minimum-1.0,\
+ OSGi/Minimum-1.1,\
+ J2SE-1.3,\
+ J2SE-1.4,\
+ J2SE-1.5,\
+ J2SE-1.6
+osgi.java.profile.name = SpringSource-dm-Server-Java6
diff --git a/org.eclipse.virgo.medic.integrationtest/src/test/resources/logback-test.xml b/org.eclipse.virgo.medic.integrationtest/src/test/resources/logback-test.xml
new file mode 100644
index 0000000..a47881b
--- /dev/null
+++ b/org.eclipse.virgo.medic.integrationtest/src/test/resources/logback-test.xml
@@ -0,0 +1,5 @@
+<configuration>
+ <root level="trace">
+ <appender class="org.eclipse.virgo.medic.log.appender.StubAppender"/>
+ </root>
+</configuration>
diff --git a/org.eclipse.virgo.medic.integrationtest/src/test/resources/message-bundle/EventLogMessages_en.properties b/org.eclipse.virgo.medic.integrationtest/src/test/resources/message-bundle/EventLogMessages_en.properties
new file mode 100644
index 0000000..54b2ddf
--- /dev/null
+++ b/org.eclipse.virgo.medic.integrationtest/src/test/resources/message-bundle/EventLogMessages_en.properties
@@ -0,0 +1 @@
+2345=English {} and {}
diff --git a/org.eclipse.virgo.medic.integrationtest/src/test/resources/message-bundle/EventLogMessages_it.properties b/org.eclipse.virgo.medic.integrationtest/src/test/resources/message-bundle/EventLogMessages_it.properties
new file mode 100644
index 0000000..09d1f6e
--- /dev/null
+++ b/org.eclipse.virgo.medic.integrationtest/src/test/resources/message-bundle/EventLogMessages_it.properties
@@ -0,0 +1 @@
+2345=Italian {} and {}
diff --git a/org.eclipse.virgo.medic.integrationtest/src/test/resources/message-bundle/META-INF/MANIFEST.MF b/org.eclipse.virgo.medic.integrationtest/src/test/resources/message-bundle/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..c4c505c
--- /dev/null
+++ b/org.eclipse.virgo.medic.integrationtest/src/test/resources/message-bundle/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Bundle-SymbolicName: message.bundle
+Bundle-ManifestVersion: 2
diff --git a/org.eclipse.virgo.medic.integrationtest/src/test/resources/message-fragment/EventLogMessages.properties b/org.eclipse.virgo.medic.integrationtest/src/test/resources/message-fragment/EventLogMessages.properties
new file mode 100644
index 0000000..3e78bfa
--- /dev/null
+++ b/org.eclipse.virgo.medic.integrationtest/src/test/resources/message-fragment/EventLogMessages.properties
@@ -0,0 +1 @@
+3456=Shared {} and {}
diff --git a/org.eclipse.virgo.medic.integrationtest/src/test/resources/message-fragment/META-INF/MANIFEST.MF b/org.eclipse.virgo.medic.integrationtest/src/test/resources/message-fragment/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..49ef7bc
--- /dev/null
+++ b/org.eclipse.virgo.medic.integrationtest/src/test/resources/message-fragment/META-INF/MANIFEST.MF
@@ -0,0 +1,5 @@
+Manifest-Version: 1.0
+Bundle-SymbolicName: message.fragment
+Bundle-ManifestVersion: 2
+Fragment-Host: message.bundle
+
diff --git a/org.eclipse.virgo.medic.integrationtest/src/test/resources/test-bundle_1/META-INF/MANIFEST.MF b/org.eclipse.virgo.medic.integrationtest/src/test/resources/test-bundle_1/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..2544d2d
--- /dev/null
+++ b/org.eclipse.virgo.medic.integrationtest/src/test/resources/test-bundle_1/META-INF/MANIFEST.MF
@@ -0,0 +1,6 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: test.bundle
+Import-Package: org.osgi.framework, org.slf4j, org.slf4j.spi
+Bundle-Activator: test.TestActivator
+Bundle-Version: 1.0
diff --git a/org.eclipse.virgo.medic.integrationtest/src/test/resources/test-bundle_1/logback.xml b/org.eclipse.virgo.medic.integrationtest/src/test/resources/test-bundle_1/logback.xml
new file mode 100644
index 0000000..2862b7b
--- /dev/null
+++ b/org.eclipse.virgo.medic.integrationtest/src/test/resources/test-bundle_1/logback.xml
@@ -0,0 +1,15 @@
+<configuration>
+ <appender name="STDOUT" class="org.eclipse.virgo.medic.log.logback.ReroutingAwareConsoleAppender">
+ <layout class="ch.qos.logback.classic.PatternLayout">
+ <Pattern>[%d{yyyy-MM-dd HH:mm:ss.SSS}] %-24.24thread %msg %ex%n</Pattern>
+ </layout>
+ </appender>
+
+ <appender name="bundle1-stub" class="org.eclipse.virgo.medic.log.appender.StubAppender"/>
+
+ <root level="debug">
+ <appender-ref ref="STDOUT" />
+ <appender-ref ref="bundle1-stub" />
+ </root>
+
+</configuration>
diff --git a/org.eclipse.virgo.medic.integrationtest/src/test/resources/test-bundle_1/test/TestActivator.class b/org.eclipse.virgo.medic.integrationtest/src/test/resources/test-bundle_1/test/TestActivator.class
new file mode 100644
index 0000000..2f77b0a
--- /dev/null
+++ b/org.eclipse.virgo.medic.integrationtest/src/test/resources/test-bundle_1/test/TestActivator.class
Binary files differ
diff --git a/org.eclipse.virgo.medic.integrationtest/src/test/resources/test-bundle_2/META-INF/MANIFEST.MF b/org.eclipse.virgo.medic.integrationtest/src/test/resources/test-bundle_2/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..a3d659b
--- /dev/null
+++ b/org.eclipse.virgo.medic.integrationtest/src/test/resources/test-bundle_2/META-INF/MANIFEST.MF
@@ -0,0 +1,6 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: test.bundle
+Import-Package: org.osgi.framework, org.slf4j, org.slf4j.spi
+Bundle-Activator: test.TestActivator
+Bundle-Version: 2.0
diff --git a/org.eclipse.virgo.medic.integrationtest/src/test/resources/test-bundle_2/logback.xml b/org.eclipse.virgo.medic.integrationtest/src/test/resources/test-bundle_2/logback.xml
new file mode 100644
index 0000000..2f914b7
--- /dev/null
+++ b/org.eclipse.virgo.medic.integrationtest/src/test/resources/test-bundle_2/logback.xml
@@ -0,0 +1,15 @@
+<configuration>
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <layout class="ch.qos.logback.classic.PatternLayout">
+ <Pattern>Bundle2 [%d{yyyy-MM-dd HH:mm:ss.SSS}] %-24.24thread %msg %ex%n</Pattern>
+ </layout>
+ </appender>
+
+ <appender name="bundle2-stub" class="org.eclipse.virgo.medic.log.appender.StubAppender"/>
+
+ <root level="debug">
+ <appender-ref ref="STDOUT" />
+ <appender-ref ref="bundle2-stub"/>
+ </root>
+
+</configuration>
diff --git a/org.eclipse.virgo.medic.integrationtest/src/test/resources/test-bundle_2/test/TestActivator.class b/org.eclipse.virgo.medic.integrationtest/src/test/resources/test-bundle_2/test/TestActivator.class
new file mode 100644
index 0000000..2f77b0a
--- /dev/null
+++ b/org.eclipse.virgo.medic.integrationtest/src/test/resources/test-bundle_2/test/TestActivator.class
Binary files differ
diff --git a/org.eclipse.virgo.medic.integrationtest/src/test/resources/test-bundle_3/META-INF/MANIFEST.MF b/org.eclipse.virgo.medic.integrationtest/src/test/resources/test-bundle_3/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..8789b85
--- /dev/null
+++ b/org.eclipse.virgo.medic.integrationtest/src/test/resources/test-bundle_3/META-INF/MANIFEST.MF
@@ -0,0 +1,6 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: test.bundle
+Import-Package: org.osgi.framework, org.slf4j, org.slf4j.spi
+Bundle-Activator: test.TestActivator
+Bundle-Version: 3.0
diff --git a/org.eclipse.virgo.medic.integrationtest/src/test/resources/test-bundle_3/test/TestActivator.class b/org.eclipse.virgo.medic.integrationtest/src/test/resources/test-bundle_3/test/TestActivator.class
new file mode 100644
index 0000000..2f77b0a
--- /dev/null
+++ b/org.eclipse.virgo.medic.integrationtest/src/test/resources/test-bundle_3/test/TestActivator.class
Binary files differ
diff --git a/org.eclipse.virgo.medic.integrationtest/template.mf b/org.eclipse.virgo.medic.integrationtest/template.mf
new file mode 100644
index 0000000..05769c2
--- /dev/null
+++ b/org.eclipse.virgo.medic.integrationtest/template.mf
@@ -0,0 +1,15 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.virgo.medic.log.test
+Bundle-Name: Medic Logging Integration Tests
+Bundle-Version: 1.0.0
+Import-Template:
+ org.eclipse.virgo.medic.*;version="[1.0.1, 1.0.2)",
+ org.aspectj.*;version="${org.aspectj:[=.=.= , +1.0.0)}"
+Import-Package:
+ org.osgi.framework;version="0",
+ org.eclipse.virgo.medic.log.appender;version="0"
+Excluded-Exports:
+ *
+Excluded-Imports:
+ ch.qos.logback.classic

Back to the top