aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lin...@apache.org
Subject svn commit: r924504 - in /incubator/aries/trunk: application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/ blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/ transaction/transaction-itests/src/te...
Date Wed, 17 Mar 2010 21:35:06 GMT
Author: linsun
Date: Wed Mar 17 21:35:06 2010
New Revision: 924504

URL: http://svn.apache.org/viewvc?rev=924504&view=rev
Log:
attempt to fix the blueprint and transaction intermittent itest failure by closing the service
tracker - able to get 3 good full build

Modified:
    incubator/aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/AbstractIntegrationTest.java
    incubator/aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/AbstractIntegrationTest.java
    incubator/aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainerTest.java
    incubator/aries/trunk/transaction/transaction-itests/src/test/java/org/apache/aries/transaction/itests/AbstractIntegrationTest.java

Modified: incubator/aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/AbstractIntegrationTest.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/AbstractIntegrationTest.java?rev=924504&r1=924503&r2=924504&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/AbstractIntegrationTest.java
(original)
+++ incubator/aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/AbstractIntegrationTest.java
Wed Mar 17 21:35:06 2010
@@ -20,6 +20,9 @@ import static org.ops4j.pax.exam.CoreOpt
 import static org.ops4j.pax.exam.CoreOptions.wrappedBundle;
 import static org.ops4j.pax.exam.OptionUtils.combine;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.runner.RunWith;
@@ -44,15 +47,21 @@ public class AbstractIntegrationTest {
 
   @Inject
   protected BundleContext bundleContext;
+  
+  private List<ServiceTracker> srs;
 
   @Before
-  public void setUp() throws Exception {
-    // Register any core services
+  public void setUp() {
+      srs = new ArrayList<ServiceTracker>();
   }
-
+  
   @After
-  public void tearDown() throws Exception {
-    // ungetService (reference)
+  public void tearDown() throws Exception{
+      for (ServiceTracker st : srs) {
+          if (st != null) {
+              st.close();
+          }  
+      }
   }
 
   protected Bundle getBundle(String symbolicName) {
@@ -124,8 +133,10 @@ public class AbstractIntegrationTest {
       tracker = new ServiceTracker(bc == null ? bundleContext : bc, osgiFilter,
           null);
       tracker.open();
-      // Note that the tracker is not closed to keep the reference
-      // This is buggy, has the service reference may change i think
+      
+      // add tracker to the list of trackers we close at tear down
+      srs.add(tracker);
+
       Object x = tracker.waitForService(timeout);
       Object svc = type.cast(x);
       if (svc == null) {

Modified: incubator/aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/AbstractIntegrationTest.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/AbstractIntegrationTest.java?rev=924504&r1=924503&r2=924504&view=diff
==============================================================================
--- incubator/aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/AbstractIntegrationTest.java
(original)
+++ incubator/aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/AbstractIntegrationTest.java
Wed Mar 17 21:35:06 2010
@@ -29,11 +29,15 @@ import java.io.*;
 import java.net.URISyntaxException;
 import java.net.URL;
 import java.text.SimpleDateFormat;
+import java.util.ArrayList;
 import java.util.Currency;
+import java.util.List;
 import java.util.Properties;
 
 import org.apache.aries.blueprint.sample.Bar;
 import org.apache.aries.blueprint.sample.Foo;
+import org.junit.After;
+import org.junit.Before;
 import org.ops4j.pax.exam.CoreOptions;
 import static org.ops4j.pax.exam.CoreOptions.options;
 import static org.ops4j.pax.exam.CoreOptions.wrappedBundle;
@@ -54,6 +58,22 @@ public abstract class AbstractIntegratio
 
     public static final long DEFAULT_TIMEOUT = 30000;
 
+    private List<ServiceTracker> srs;
+
+    @Before
+    public void setUp() {
+        srs = new ArrayList<ServiceTracker>();
+    }
+    
+    @After
+    public void tearDown() throws Exception{
+        for (ServiceTracker st : srs) {
+            if (st != null) {
+                st.close();
+            }  
+        }
+    }
+    
     @Inject
     protected BundleContext bundleContext;
 
@@ -93,8 +113,9 @@ public abstract class AbstractIntegratio
             Filter osgiFilter = FrameworkUtil.createFilter(flt);
             tracker = new ServiceTracker(bc == null ? bundleContext : bc, osgiFilter, null);
             tracker.open();
-            // Note that the tracker is not closed to keep the reference
-            // This is buggy, has the service reference may change i think
+            
+            // add tracker to the list of trackers we close at tear down
+            srs.add(tracker);
             Object svc = type.cast(tracker.waitForService(timeout));
             if (svc == null) {
                 throw new RuntimeException("Gave up waiting for service " + flt);

Modified: incubator/aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainerTest.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainerTest.java?rev=924504&r1=924503&r2=924504&view=diff
==============================================================================
--- incubator/aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainerTest.java
(original)
+++ incubator/aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainerTest.java
Wed Mar 17 21:35:06 2010
@@ -84,7 +84,7 @@ public class BlueprintContainerTest exte
             mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint"),
             mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.sample").noStart(),
             mavenBundle("org.osgi", "org.osgi.compendium"),
-            // org.ops4j.pax.exam.container.def.PaxRunnerOptions.vmOption("-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"),
+            //org.ops4j.pax.exam.container.def.PaxRunnerOptions.vmOption("-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"),
 
             equinox().version("3.5.0")
         );

Modified: incubator/aries/trunk/transaction/transaction-itests/src/test/java/org/apache/aries/transaction/itests/AbstractIntegrationTest.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/transaction/transaction-itests/src/test/java/org/apache/aries/transaction/itests/AbstractIntegrationTest.java?rev=924504&r1=924503&r2=924504&view=diff
==============================================================================
--- incubator/aries/trunk/transaction/transaction-itests/src/test/java/org/apache/aries/transaction/itests/AbstractIntegrationTest.java
(original)
+++ incubator/aries/trunk/transaction/transaction-itests/src/test/java/org/apache/aries/transaction/itests/AbstractIntegrationTest.java
Wed Mar 17 21:35:06 2010
@@ -25,7 +25,11 @@ import static org.ops4j.pax.swissbox.tin
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
 
+import org.junit.After;
+import org.junit.Before;
 import org.junit.runner.RunWith;
 import org.ops4j.pax.exam.CoreOptions;
 import org.ops4j.pax.exam.Customizer;
@@ -51,6 +55,22 @@ public abstract class AbstractIntegratio
 
     public static final long DEFAULT_TIMEOUT = 30000;
     
+    private List<ServiceTracker> srs;
+
+    @Before
+    public void setUp() {
+        srs = new ArrayList<ServiceTracker>();
+    }
+    
+    @After
+    public void tearDown() throws Exception{
+        for (ServiceTracker st : srs) {
+            if (st != null) {
+                st.close();
+            }  
+        }
+    }
+    
     @Inject
     protected BundleContext bundleContext;
 
@@ -156,8 +176,10 @@ public abstract class AbstractIntegratio
                   tracker = new ServiceTracker(bc == null ? bundleContext : bc, osgiFilter,
                       null);
                   tracker.open();
-                  // Note that the tracker is not closed to keep the reference
-                  // This is buggy, has the service reference may change i think
+                  
+                  // add tracker to the list of trackers we close at tear down
+                  srs.add(tracker);
+                  
                   Object svc = type.cast(tracker.waitForService(timeout));
                   if (svc == null) {
                     throw new RuntimeException("Gave up waiting for service " + flt);



Mime
View raw message