incubator-aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mnutt...@apache.org
Subject svn commit: r1052500 - /incubator/aries/trunk/jndi/jndi-url-itest/src/test/java/org/apache/aries/jndi/itests/JndiUrlIntegrationTest.java
Date Fri, 24 Dec 2010 13:02:17 GMT
Author: mnuttall
Date: Fri Dec 24 13:02:17 2010
New Revision: 1052500

URL: http://svn.apache.org/viewvc?rev=1052500&view=rev
Log:
ARIES-527: Diagnostics

Modified:
    incubator/aries/trunk/jndi/jndi-url-itest/src/test/java/org/apache/aries/jndi/itests/JndiUrlIntegrationTest.java

Modified: incubator/aries/trunk/jndi/jndi-url-itest/src/test/java/org/apache/aries/jndi/itests/JndiUrlIntegrationTest.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jndi/jndi-url-itest/src/test/java/org/apache/aries/jndi/itests/JndiUrlIntegrationTest.java?rev=1052500&r1=1052499&r2=1052500&view=diff
==============================================================================
--- incubator/aries/trunk/jndi/jndi-url-itest/src/test/java/org/apache/aries/jndi/itests/JndiUrlIntegrationTest.java
(original)
+++ incubator/aries/trunk/jndi/jndi-url-itest/src/test/java/org/apache/aries/jndi/itests/JndiUrlIntegrationTest.java
Fri Dec 24 13:02:17 2010
@@ -50,30 +50,53 @@ public class JndiUrlIntegrationTest exte
 
     Bundle bBiz = getInstalledBundle("org.apache.aries.jndi.url.itest.biz");
     assertNotNull(bBiz);
-    bBiz.start();
     
     Bundle bweb = getInstalledBundle("org.apache.aries.jndi.url.itest.web");
     assertNotNull(bweb);
-    bweb.start();
+    
+    // Let's see what's going on
+    printBundleStatus("Before first request");
 
     // We've had intermittent problems in which Jetty only seems to start after a bundle
     // receives an HTTP request. This next block is here to prevent Hudson failures. 
     try { 
-      Thread.sleep(2000);
       getTestServletResponse();
-    } 
-    catch (InterruptedException ix) {}
-    catch (IOException iox) {}
+    } catch (IOException iox) {}
     try { 
-      Thread.sleep(3000);
+      Thread.sleep(5000);
     } catch (InterruptedException iox) {}
     
+    printBundleStatus ("After workaround, before test proper");
     
     System.out.println("In test and trying to get connection....");
     String response = getTestServletResponse();
     assertEquals("ITest servlet response wrong", "Mark.2.0.three", response);
   }
   
+  private void printBundleStatus (String msg) { 
+    System.out.println("-----\nprintBundleStatus: " + msg + "\n-----");
+    for (Bundle b : bundleContext.getBundles()) { 
+      System.out.println (b.getSymbolicName() + " " + "state=" + formatState(b.getState()));
+    }
+    System.out.println();
+  }
+  
+  private String formatState (int state) {
+    String result = Integer.toString(state);
+    switch (state) { 
+    case Bundle.ACTIVE: 
+      result = "Active";
+      break;
+    case Bundle.INSTALLED: 
+      result = "Installed";
+      break;
+    case Bundle.RESOLVED: 
+      result = "Resolved";
+      break;
+    }
+    return result;
+  }
+  
   private String getTestServletResponse() throws IOException { 
     HttpURLConnection conn = makeConnection("http://localhost:8080/org.apache.aries.jndi.url.itest.web/ITestServlet");
     String response = getHTTPResponse(conn).trim();
@@ -107,7 +130,7 @@ public class JndiUrlIntegrationTest exte
         mavenBundle("asm", "asm-all"),
         mavenBundle("org.apache.aries", "org.apache.aries.util"),
         mavenBundle("org.apache.aries.jndi", "org.apache.aries.jndi"),
-        mavenBundle("org.apache.felix", "org.apache.felix.fileinstall"),
+        mavenBundle("org.apache.aries.jndi", "org.apache.aries.jndi.url"),
         
         mavenBundle("org.apache.aries.jndi", "org.apache.aries.jndi.url.itest.web"),
         mavenBundle("org.apache.aries.jndi", "org.apache.aries.jndi.url.itest.biz"),



Mime
View raw message