You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by gn...@apache.org on 2010/12/20 16:49:54 UTC
svn commit: r1051152 - in /karaf/trunk/main/src/test:
java/org/apache/karaf/main/ resources/ resources/test-karaf-home/
resources/test-karaf-home/bundles/ resources/test-karaf-home/etc/
resources/test-karaf-home/lib/ resources/test-karaf-home/system/ r...
Author: gnodet
Date: Mon Dec 20 15:49:54 2010
New Revision: 1051152
URL: http://svn.apache.org/viewvc?rev=1051152&view=rev
Log:
[KARAF-334] Include junit test
Added:
karaf/trunk/main/src/test/java/org/apache/karaf/main/MainStartTest.java
karaf/trunk/main/src/test/resources/
karaf/trunk/main/src/test/resources/foo
karaf/trunk/main/src/test/resources/test-karaf-home/
karaf/trunk/main/src/test/resources/test-karaf-home/bundles/
karaf/trunk/main/src/test/resources/test-karaf-home/bundles/pax-url-mvn.jar (with props)
karaf/trunk/main/src/test/resources/test-karaf-home/etc/
karaf/trunk/main/src/test/resources/test-karaf-home/etc/config.properties (with props)
karaf/trunk/main/src/test/resources/test-karaf-home/etc/startup.properties
karaf/trunk/main/src/test/resources/test-karaf-home/lib/
karaf/trunk/main/src/test/resources/test-karaf-home/lib/foo
karaf/trunk/main/src/test/resources/test-karaf-home/system/
karaf/trunk/main/src/test/resources/test-karaf-home/system/org/
karaf/trunk/main/src/test/resources/test-karaf-home/system/org/apache/
karaf/trunk/main/src/test/resources/test-karaf-home/system/org/apache/felix/
karaf/trunk/main/src/test/resources/test-karaf-home/system/org/apache/felix/org.apache.felix.framework/
karaf/trunk/main/src/test/resources/test-karaf-home/system/org/apache/felix/org.apache.felix.framework/3.0.6/
karaf/trunk/main/src/test/resources/test-karaf-home/system/org/apache/felix/org.apache.felix.framework/3.0.6/org.apache.felix.framework-3.0.6.jar (with props)
Added: karaf/trunk/main/src/test/java/org/apache/karaf/main/MainStartTest.java
URL: http://svn.apache.org/viewvc/karaf/trunk/main/src/test/java/org/apache/karaf/main/MainStartTest.java?rev=1051152&view=auto
==============================================================================
--- karaf/trunk/main/src/test/java/org/apache/karaf/main/MainStartTest.java (added)
+++ karaf/trunk/main/src/test/java/org/apache/karaf/main/MainStartTest.java Mon Dec 20 15:49:54 2010
@@ -0,0 +1,61 @@
+/*
+ * 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.karaf.main;
+
+import java.io.File;
+import java.net.URL;
+
+import junit.framework.Assert;
+
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.launch.Framework;
+
+public class MainStartTest {
+
+ @Test
+ public void testAutoStart() throws Exception {
+ File basedir = new File(getClass().getClassLoader().getResource("foo").getPath()).getParentFile();
+ File home = new File(basedir, "test-karaf-home");
+ File data = new File(home, "data");
+
+ Utils.deleteDirectory(data);
+
+ String[] args = new String[0];
+ String fileMVNbundle = new File(home, "bundles/pax-url-mvn.jar").toURI().toURL().toExternalForm();
+ String mvnUrl = "mvn:org.osgi/org.osgi.compendium/4.2.0";
+ System.setProperty("karaf.home", home.toString());
+ System.setProperty("karaf.data", data.toString());
+ System.setProperty("karaf.auto.start.1", "\""+fileMVNbundle+"|unused\"");
+ System.setProperty("karaf.auto.start.2", "\""+mvnUrl+"|unused\"");
+ System.setProperty("karaf.maven.convert", "false");
+
+ Main main = new Main(args);
+ main.launch();
+ Thread.sleep(1000);
+ Framework framework = main.getFramework();
+ Bundle[] bundles = framework.getBundleContext().getBundles();
+ Assert.assertEquals(3, bundles.length);
+ Assert.assertEquals(fileMVNbundle, bundles[1].getLocation());
+ Assert.assertEquals(mvnUrl, bundles[2].getLocation());
+ Assert.assertEquals(Bundle.ACTIVE, bundles[1].getState());
+ Assert.assertEquals(Bundle.ACTIVE, bundles[2].getState());
+ main.destroy(false);
+ }
+}
Added: karaf/trunk/main/src/test/resources/foo
URL: http://svn.apache.org/viewvc/karaf/trunk/main/src/test/resources/foo?rev=1051152&view=auto
==============================================================================
(empty)
Added: karaf/trunk/main/src/test/resources/test-karaf-home/bundles/pax-url-mvn.jar
URL: http://svn.apache.org/viewvc/karaf/trunk/main/src/test/resources/test-karaf-home/bundles/pax-url-mvn.jar?rev=1051152&view=auto
==============================================================================
Files karaf/trunk/main/src/test/resources/test-karaf-home/bundles/pax-url-mvn.jar (added) and karaf/trunk/main/src/test/resources/test-karaf-home/bundles/pax-url-mvn.jar Mon Dec 20 15:49:54 2010 differ
Propchange: karaf/trunk/main/src/test/resources/test-karaf-home/bundles/pax-url-mvn.jar
------------------------------------------------------------------------------
svn:executable = *
Added: karaf/trunk/main/src/test/resources/test-karaf-home/etc/config.properties
URL: http://svn.apache.org/viewvc/karaf/trunk/main/src/test/resources/test-karaf-home/etc/config.properties?rev=1051152&view=auto
==============================================================================
--- karaf/trunk/main/src/test/resources/test-karaf-home/etc/config.properties (added)
+++ karaf/trunk/main/src/test/resources/test-karaf-home/etc/config.properties Mon Dec 20 15:49:54 2010
@@ -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.
+#
+################################################################################
+
+#
+# Properties file inclusions (as a space separated list of relative paths)
+# Included files will override the values specified in this file
+#
+${includes} =
+
+#
+# Framework selection properties
+#
+karaf.framework=felix
+
+#
+# Location of the OSGi frameworks
+#
+karaf.framework.felix=${karaf.default.repository}/org/apache/felix/org.apache.felix.framework/3.0.6/org.apache.felix.framework-3.0.6.jar
+
+# To enable the use of the startup.properties file to control the start level:
+karaf.auto.start=
+
+org.osgi.framework.startlevel.beginning=100
+karaf.startlevel.bundle=60
+karaf.name=root
+karaf.default.repository=system
+
Propchange: karaf/trunk/main/src/test/resources/test-karaf-home/etc/config.properties
------------------------------------------------------------------------------
svn:executable = *
Added: karaf/trunk/main/src/test/resources/test-karaf-home/etc/startup.properties
URL: http://svn.apache.org/viewvc/karaf/trunk/main/src/test/resources/test-karaf-home/etc/startup.properties?rev=1051152&view=auto
==============================================================================
--- karaf/trunk/main/src/test/resources/test-karaf-home/etc/startup.properties (added)
+++ karaf/trunk/main/src/test/resources/test-karaf-home/etc/startup.properties Mon Dec 20 15:49:54 2010
@@ -0,0 +1,25 @@
+################################################################################
+#
+# 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.
+#
+################################################################################
+
+# This file allows you to control the start level of each bundle.
+#
+
+#
+# Startup core services like logging
+#
Added: karaf/trunk/main/src/test/resources/test-karaf-home/lib/foo
URL: http://svn.apache.org/viewvc/karaf/trunk/main/src/test/resources/test-karaf-home/lib/foo?rev=1051152&view=auto
==============================================================================
(empty)
Added: karaf/trunk/main/src/test/resources/test-karaf-home/system/org/apache/felix/org.apache.felix.framework/3.0.6/org.apache.felix.framework-3.0.6.jar
URL: http://svn.apache.org/viewvc/karaf/trunk/main/src/test/resources/test-karaf-home/system/org/apache/felix/org.apache.felix.framework/3.0.6/org.apache.felix.framework-3.0.6.jar?rev=1051152&view=auto
==============================================================================
Files karaf/trunk/main/src/test/resources/test-karaf-home/system/org/apache/felix/org.apache.felix.framework/3.0.6/org.apache.felix.framework-3.0.6.jar (added) and karaf/trunk/main/src/test/resources/test-karaf-home/system/org/apache/felix/org.apache.felix.framework/3.0.6/org.apache.felix.framework-3.0.6.jar Mon Dec 20 15:49:54 2010 differ
Propchange: karaf/trunk/main/src/test/resources/test-karaf-home/system/org/apache/felix/org.apache.felix.framework/3.0.6/org.apache.felix.framework-3.0.6.jar
------------------------------------------------------------------------------
svn:executable = *