Move ServiceMix Kernel trunk into Felix

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@768912 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/karaf/testing/itests/src/test/java/org/apache/servicemix/kernel/testing/itests/SimpleTest.java b/karaf/testing/itests/src/test/java/org/apache/servicemix/kernel/testing/itests/SimpleTest.java
new file mode 100644
index 0000000..dec38ae
--- /dev/null
+++ b/karaf/testing/itests/src/test/java/org/apache/servicemix/kernel/testing/itests/SimpleTest.java
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.kernel.testing.itests;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.validation.SchemaFactory;
+
+import org.apache.servicemix.kernel.testing.support.AbstractIntegrationTest;
+import org.osgi.framework.Bundle;
+
+public class SimpleTest extends AbstractIntegrationTest {
+
+    static {
+        System.setProperty("jaxp.debug", "true");
+        System.setProperty("org.apache.servicemix.specs.debug", "true");
+    }
+
+    /**
+	 * The manifest to use for the "virtual bundle" created
+	 * out of the test classes and resources in this project
+	 *
+	 * This is actually the boilerplate manifest with one additional
+	 * import-package added. We should provide a simpler customization
+	 * point for such use cases that doesn't require duplication
+	 * of the entire manifest...
+	 */
+	protected String getManifestLocation() {                            
+		return "classpath:org/apache/servicemix/MANIFEST.MF";
+	}
+
+	/**
+	 * The location of the packaged OSGi bundles to be installed
+	 * for this test. Values are Spring resource paths. The bundles
+	 * we want to use are part of the same multi-project maven
+	 * build as this project is. Hence we use the localMavenArtifact
+	 * helper method to find the bundles produced by the package
+	 * phase of the maven build (these tests will run after the
+	 * packaging phase, in the integration-test phase).
+	 *
+	 * JUnit, commons-logging, spring-core and the spring OSGi
+	 * test bundle are automatically included so do not need
+	 * to be specified here.
+	 */
+	protected String[] getTestBundlesNames() {
+        return new String[0];
+	}
+
+    /**
+     * Do not include the jaxp-ri bundle by default, as we want to test it
+     * @return
+     */
+    @Override
+    protected String[] getTestFrameworkBundlesNames() {
+        return new String[] {
+            getBundle("org.apache.geronimo.specs", "geronimo-servlet_2.5_spec"),
+            getBundle("org.apache.servicemix.specs", "org.apache.servicemix.specs.jaxp-api-1.4"),
+            getBundle("org.apache.felix", "org.osgi.compendium"),
+            getBundle("org.apache.felix", "org.apache.felix.configadmin"),
+            getBundle("org.ops4j.pax.logging", "pax-logging-api"),
+            getBundle("org.ops4j.pax.logging", "pax-logging-service"),
+            getBundle("org.apache.servicemix.bundles", "org.apache.servicemix.bundles.aopalliance"),
+            getBundle("org.apache.servicemix.bundles", "org.apache.servicemix.bundles.asm"),
+            getBundle("org.apache.servicemix.bundles", "org.apache.servicemix.bundles.junit"),
+            getBundle("org.springframework", "spring-beans"),
+            getBundle("org.springframework", "spring-core"),
+            getBundle("org.springframework", "spring-context"),
+            getBundle("org.springframework", "spring-aop"),
+            getBundle("org.springframework", "spring-test"),
+            getBundle("org.springframework.osgi", "spring-osgi-core"),
+            getBundle("org.springframework.osgi", "spring-osgi-io"),
+            getBundle("org.springframework.osgi", "spring-osgi-extender"),
+            getBundle("org.springframework.osgi", "spring-osgi-test"),
+            getBundle("org.springframework.osgi", "spring-osgi-annotation"),
+            getBundle("org.apache.servicemix.kernel.testing", "org.apache.servicemix.kernel.testing.support"),
+		};
+    }
+
+    public void testDocumentBuilderFactory() throws Exception {
+        try {
+            DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
+            fail("Implementation should not have been found");
+        } catch (Throwable t) {
+        }
+        Bundle b = installBundle("org.apache.servicemix.bundles", "org.apache.servicemix.bundles.jaxp-ri", null, "jar");
+        try {
+		    assertNotNull(DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument());
+        } finally {
+            b.uninstall();
+        }
+    }
+
+    public void testTransformerFactory() throws Exception {
+        try {
+            TransformerFactory.newInstance().newTransformer();
+            fail("Implementation should not have been found");
+        } catch (Throwable t) {
+        }
+        Bundle b = installBundle("org.apache.servicemix.bundles", "org.apache.servicemix.bundles.jaxp-ri", null, "jar");
+        try {
+            assertNotNull(TransformerFactory.newInstance().newTransformer());
+        } finally {
+            b.uninstall();
+        }
+    }
+
+    public void testSchemaFactory() throws Exception {
+        try {
+            SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema").newSchema();
+            fail("Implementation should not have been found");
+        } catch (Throwable t) {
+        }
+        Bundle b = installBundle("org.apache.servicemix.bundles", "org.apache.servicemix.bundles.jaxp-ri", null, "jar");
+        try {
+            assertNotNull(SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema").newSchema());
+        } finally {
+            b.uninstall();
+        }
+    }
+
+    public void testStax() throws Exception {
+        try {
+            XMLInputFactory.newInstance();
+            fail("Implementation should not have been found");
+        } catch (Throwable t) {
+        }
+        Bundle b = installBundle("org.apache.servicemix.bundles", "org.apache.servicemix.bundles.jaxp-ri", null, "jar");
+        try {
+            assertNotNull(XMLInputFactory.newInstance());
+        } finally {
+            b.uninstall();
+        }
+    }
+
+}
diff --git a/karaf/testing/itests/src/test/resources/log4j.properties b/karaf/testing/itests/src/test/resources/log4j.properties
new file mode 100644
index 0000000..7944dfb
--- /dev/null
+++ b/karaf/testing/itests/src/test/resources/log4j.properties
@@ -0,0 +1,43 @@
+# 
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed  under the  License is distributed on an "AS IS" BASIS,
+# WITHOUT  WARRANTIES OR CONDITIONS  OF ANY KIND, either  express  or
+# implied.
+#  
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+#
+# The logging properties used during tests..
+#
+log4j.rootLogger=DEBUG, stdout
+
+log4j.logger.org.springframework=INFO
+log4j.logger.org.apache.activemq=INFO
+log4j.logger.org.apache.activemq.spring=WARN
+
+
+#log4j.logger.org.apache.servicemix=DEBUG
+
+# CONSOLE appender 
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+
+# File appender
+log4j.appender.out=org.apache.log4j.FileAppender
+log4j.appender.out.layout=org.apache.log4j.PatternLayout
+log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+log4j.appender.out.file=target/servicemix-test.log
+log4j.appender.out.append=true
diff --git a/karaf/testing/itests/src/test/resources/org/apache/servicemix/MANIFEST.MF b/karaf/testing/itests/src/test/resources/org/apache/servicemix/MANIFEST.MF
new file mode 100644
index 0000000..f26d98a
--- /dev/null
+++ b/karaf/testing/itests/src/test/resources/org/apache/servicemix/MANIFEST.MF
@@ -0,0 +1,32 @@
+Manifest-Version: 1.0
+License-00: .
+License-01: Licensed to the Apache Software Foundation (ASF) under one or more
+License-02: contributor license agreements.  See the NOTICE file distributed with
+License-03: this work for additional information regarding copyright ownership.
+License-04: The ASF licenses this file to You under the Apache License, Version 2.0
+License-05: (the "License"); you may not use this file except in compliance with
+License-06: the License.  You may obtain a copy of the License at
+License-07: .
+License-08:      http://www.apache.org/licenses/LICENSE-2.0
+License-09: .
+License-10: Unless required by applicable law or agreed to in writing, software
+License-11: distributed under the License is distributed on an "AS IS" BASIS,
+License-12: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+License-13: See the License for the specific language governing permissions and
+License-14: limitations under the License.
+License-15: .
+Bundle-Name: org.apache.servicemix.testing.itests
+Bundle-SymbolicName: org.apache.servicemix.testing.itests
+Bundle-Vendor: Spring Framework
+Bundle-Activator: org.springframework.osgi.test.JUnitTestActivator
+Import-Package: junit.framework,
+ org.osgi.framework;specification-version="1.3.0",
+ org.apache.commons.logging,
+ org.springframework.core.io,
+ org.springframework.osgi.test,
+ org.apache.servicemix.kernel.testing.support,
+ org.springframework.osgi.util,
+ javax.xml.stream,
+ javax.xml.transform,
+ javax.xml.validation,
+ javax.xml.parsers