Author: cschneider
Date: Fri Jun 13 16:28:42 2014
New Revision: 1602470

URL: http://svn.apache.org/r1602470
Log:
Providing some diagnostic tooling for testsupport

Modified:
    aries/trunk/jpa/jpa-container-itest/pom.xml
    
aries/trunk/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/itest/AbstractJPAItest.java
    
aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/itest/AbstractIntegrationTest.java

Modified: aries/trunk/jpa/jpa-container-itest/pom.xml
URL: 
http://svn.apache.org/viewvc/aries/trunk/jpa/jpa-container-itest/pom.xml?rev=1602470&r1=1602469&r2=1602470&view=diff
==============================================================================
--- aries/trunk/jpa/jpa-container-itest/pom.xml (original)
+++ aries/trunk/jpa/jpa-container-itest/pom.xml Fri Jun 13 16:28:42 2014
@@ -45,7 +45,7 @@
     </properties>
 
     <dependencies>
-       <dependency>
+               <dependency>
             <groupId>org.eclipse</groupId>
             <artifactId>org.eclipse.osgi</artifactId>
             <version>3.8.0.v20120529-1548</version>

Modified: 
aries/trunk/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/itest/AbstractJPAItest.java
URL: 
http://svn.apache.org/viewvc/aries/trunk/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/itest/AbstractJPAItest.java?rev=1602470&r1=1602469&r2=1602470&view=diff
==============================================================================
--- 
aries/trunk/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/itest/AbstractJPAItest.java
 (original)
+++ 
aries/trunk/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/itest/AbstractJPAItest.java
 Fri Jun 13 16:28:42 2014
@@ -65,22 +65,7 @@ public abstract class AbstractJPAItest e
                return 
bundleContext.getAllServiceReferences(EntityManagerFactory.class.getName(), 
"(&(osgi.unit.name=" + name + ")" 
                        + FILTER_CONTAINER_MANAGED + FILTER_PROXY + ")");
        }
-       
-       /**
-        * Help to diagnose bundles that did not start
-        * 
-        * @throws BundleException
-        */
-       protected void showBundles() throws BundleException {
-               Bundle[] bundles = bundleContext.getBundles();
-               for (Bundle bundle : bundles) {
-                       System.out.println(bundle.getBundleId() + ":" + 
bundle.getSymbolicName() + ":" + bundle.getVersion() + ":" + bundle.getState());
-                       if (bundle.getState() != 32) {
-                               System.out.println(bundle.getBundleId() + ":" + 
bundle.getSymbolicName() + ":" + bundle.getState());
-                               bundle.start();
-                       }
-               }
-       }
+
 
        protected Option baseOptions() {
         String localRepo = System.getProperty("maven.repo.local");

Modified: 
aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/itest/AbstractIntegrationTest.java
URL: 
http://svn.apache.org/viewvc/aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/itest/AbstractIntegrationTest.java?rev=1602470&r1=1602469&r2=1602470&view=diff
==============================================================================
--- 
aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/itest/AbstractIntegrationTest.java
 (original)
+++ 
aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/itest/AbstractIntegrationTest.java
 Fri Jun 13 16:28:42 2014
@@ -20,7 +20,9 @@ package org.apache.aries.itest;
 
 import javax.inject.Inject;
 
+import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
 
 /**
  * Base class for Pax Exam 1.2.x based unit tests
@@ -47,4 +49,32 @@ public abstract class AbstractIntegratio
        }
        return localRepo;
     }
+    
+       
+       /**
+        * Help to diagnose bundles that did not start
+        * 
+        * @throws BundleException
+        */
+       protected void showBundles() throws BundleException {
+               Bundle[] bundles = bundleContext.getBundles();
+               for (Bundle bundle : bundles) {
+                       System.out.println(bundle.getBundleId() + ":" + 
bundle.getSymbolicName() + ":" + bundle.getVersion() + ":" + bundle.getState());
+               }
+       }
+       
+       /**
+        * Helps to diagnose bundles that are not resolved as it will throw a 
detailed exception
+        * 
+        * @throws BundleException
+        */
+       protected void resolveBundles() throws BundleException {
+               Bundle[] bundles = bundleContext.getBundles();
+               for (Bundle bundle : bundles) {
+                       if (bundle.getState() == Bundle.INSTALLED) {
+                               System.out.println("Found non resolved bundle " 
+ bundle.getBundleId() + ":" + bundle.getSymbolicName() + ":" + 
bundle.getVersion());
+                               bundle.start();
+                       }
+               }
+       }
 }


Reply via email to