junit4osgi now uses the bnd-ipojo-plugin.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1161461 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/junit4osgi/junit4osgi/pom.xml b/ipojo/junit4osgi/junit4osgi/pom.xml
index ac21e03..b8b85f4 100644
--- a/ipojo/junit4osgi/junit4osgi/pom.xml
+++ b/ipojo/junit4osgi/junit4osgi/pom.xml
@@ -93,10 +93,18 @@
META-INF/LICENSE.junit=LICENSE.junit,
META-INF/NOTICE=NOTICE
</Include-Resource>
+ <_plugin>org.apache.felix.ipojo.bnd.PojoizationPlugin;metadata=${basedir}/metadata.xml;use-local-schemas=true</_plugin>
</instructions>
</configuration>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>bnd-ipojo-plugin</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
</plugin>
- <plugin>
+ <!--<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-ipojo-plugin</artifactId>
<version>1.9.0-SNAPSHOT</version>
@@ -110,7 +118,7 @@
</configuration>
</execution>
</executions>
- </plugin>
+ </plugin>-->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rat-maven-plugin</artifactId>
diff --git a/ipojo/junit4osgi/maven-junit4osgi-plugin/src/main/java/org/apache/felix/ipojo/junit4osgi/plugin/Junit4osgiPlugin.java b/ipojo/junit4osgi/maven-junit4osgi-plugin/src/main/java/org/apache/felix/ipojo/junit4osgi/plugin/Junit4osgiPlugin.java
index 3557e8a..449fba4 100644
--- a/ipojo/junit4osgi/maven-junit4osgi-plugin/src/main/java/org/apache/felix/ipojo/junit4osgi/plugin/Junit4osgiPlugin.java
+++ b/ipojo/junit4osgi/maven-junit4osgi-plugin/src/main/java/org/apache/felix/ipojo/junit4osgi/plugin/Junit4osgiPlugin.java
@@ -51,6 +51,7 @@
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
import org.osgi.framework.Constants;
+import org.osgi.framework.InvalidSyntaxException;
import org.osgi.framework.ServiceReference;
/**
@@ -363,7 +364,7 @@
getLog().debug("Service List");
for (int i = 0; i < refs.length; i++) {
String[] itfs = (String[]) refs[i].getProperty(Constants.OBJECTCLASS);
- List list = Arrays.asList(itfs);
+ List list = Arrays.asList(itfs);
if (list.contains("org.apache.felix.ipojo.architecture.Architecture")) {
getLog().debug(list.toString() + " - " + refs[i].getProperty("architecture.instance"));
} else {
@@ -468,6 +469,9 @@
return bc.getService(ref);
}
getLog().error("Junit Runner service unavailable");
+
+ dumpServices(bc);
+
return null;
}
@@ -630,6 +634,25 @@
}
}
+ /**
+ * Prints the service list.
+ * @param bc the bundle context.
+ */
+ public void dumpServices(BundleContext bc) {
+ getLog().info("Services:");
+ ServiceReference[] refs = null;
+ try {
+ refs = bc.getAllServiceReferences(null, null);
+ } catch (InvalidSyntaxException e) {
+ e.printStackTrace();
+ }
+ for (int i = 0; i < refs.length; i++) {
+ String[] itfs = (String[]) refs[i].getProperty(Constants.OBJECTCLASS);
+ String bundle = refs[i].getBundle().getSymbolicName();
+ getLog().info(bundle + " : " + Arrays.toString(itfs));
+ }
+ }
+
public LogServiceImpl getLogService() {
return m_logService;
}