karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pie...@apache.org
Subject svn commit: r1441425 - /karaf/trunk/main/src/test/java/org/apache/karaf/main/MainStartTest.java
Date Fri, 01 Feb 2013 12:38:13 GMT
Author: pieber
Date: Fri Feb  1 12:38:13 2013
New Revision: 1441425

URL: http://svn.apache.org/viewvc?rev=1441425&view=rev
Log:
[KARAF-2144] Fixed MainStartTest; Thanks to Christoph Gritschenberger for the Patch

Signed-off-by: Andreas Pieber <anpieber@gmail.com>

Modified:
    karaf/trunk/main/src/test/java/org/apache/karaf/main/MainStartTest.java

Modified: 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=1441425&r1=1441424&r2=1441425&view=diff
==============================================================================
--- karaf/trunk/main/src/test/java/org/apache/karaf/main/MainStartTest.java (original)
+++ karaf/trunk/main/src/test/java/org/apache/karaf/main/MainStartTest.java Fri Feb  1 12:38:13
2013
@@ -25,6 +25,7 @@ import java.io.File;
 import junit.framework.Assert;
 
 import org.apache.karaf.main.util.Utils;
+import org.junit.After;
 import org.junit.Test;
 import org.ops4j.pax.tinybundles.core.TinyBundles;
 import org.osgi.framework.Bundle;
@@ -33,7 +34,16 @@ import org.osgi.framework.launch.Framewo
 
 public class MainStartTest {
 
-	@Test
+    private Main main;
+
+    @After
+    public void tearDown() throws Exception {
+        if(main != null){
+            main.destroy();
+        }
+    }
+
+    @Test
     public void testAutoStart() throws Exception {
         File basedir = new File(getClass().getClassLoader().getResource("foo").getPath()).getParentFile();
         File home = new File(basedir, "test-karaf-home");
@@ -45,7 +55,7 @@ public class MainStartTest {
 		System.setProperty("karaf.home", home.toString());
 		System.setProperty("karaf.data", data.toString());
 
-		Main main = new Main(args);
+		main = new Main(args);
 		main.launch();
 		Framework framework = main.getFramework();
 		Bundle[] bundles = framework.getBundleContext().getBundles();
@@ -59,8 +69,6 @@ public class MainStartTest {
 
 		Bundle bundle2 = framework.getBundleContext().getBundle("pax-url-mvn.jar");
 		Assert.assertEquals(Bundle.ACTIVE, bundle2.getState());
-
-        main.destroy();
 	}
 
     @Test
@@ -76,7 +84,7 @@ public class MainStartTest {
 		System.setProperty("karaf.data", data.toString());
         System.setProperty("karaf.framework.factory", "org.apache.felix.framework.FrameworkFactory");
 
-        Main main = new Main(args);
+        main = new Main(args);
         main.launch();
         Framework framework = main.getFramework();
         String activatorName = TimeoutShutdownActivator.class.getName().replace('.', '/')
+ ".class";



Mime
View raw message