You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by cc...@apache.org on 2009/08/06 02:53:44 UTC
svn commit: r801482 [1/2] - in /servicemix/sandbox/karaf/nmr: ./ assembly/
branding/ jbi/ jbi/commands/
jbi/commands/src/main/java/org/apache/servicemix/jbi/commands/ jbi/deployer/
jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/handler/ ...
Author: ccustine
Date: Thu Aug 6 00:53:43 2009
New Revision: 801482
URL: http://svn.apache.org/viewvc?rev=801482&view=rev
Log:
Patch from SMX4-332 for review
Added:
servicemix/sandbox/karaf/nmr/testing/
servicemix/sandbox/karaf/nmr/testing/pom.xml
servicemix/sandbox/karaf/nmr/testing/support/
servicemix/sandbox/karaf/nmr/testing/support/pom.xml
servicemix/sandbox/karaf/nmr/testing/support/src/
servicemix/sandbox/karaf/nmr/testing/support/src/main/
servicemix/sandbox/karaf/nmr/testing/support/src/main/java/
servicemix/sandbox/karaf/nmr/testing/support/src/main/java/org/
servicemix/sandbox/karaf/nmr/testing/support/src/main/java/org/apache/
servicemix/sandbox/karaf/nmr/testing/support/src/main/java/org/apache/servicemix/
servicemix/sandbox/karaf/nmr/testing/support/src/main/java/org/apache/servicemix/platform/
servicemix/sandbox/karaf/nmr/testing/support/src/main/java/org/apache/servicemix/platform/main/
servicemix/sandbox/karaf/nmr/testing/support/src/main/java/org/apache/servicemix/platform/main/spi/
servicemix/sandbox/karaf/nmr/testing/support/src/main/java/org/apache/servicemix/platform/main/spi/MainService.java
servicemix/sandbox/karaf/nmr/testing/support/src/main/java/org/apache/servicemix/platform/testing/
servicemix/sandbox/karaf/nmr/testing/support/src/main/java/org/apache/servicemix/platform/testing/support/
servicemix/sandbox/karaf/nmr/testing/support/src/main/java/org/apache/servicemix/platform/testing/support/AbstractIntegrationTest.java
servicemix/sandbox/karaf/nmr/testing/support/src/main/java/org/apache/servicemix/platform/testing/support/Counter.java
servicemix/sandbox/karaf/nmr/testing/support/src/main/java/org/apache/servicemix/platform/testing/support/FrameworkUtil.java
servicemix/sandbox/karaf/nmr/testing/support/src/main/java/org/apache/servicemix/platform/testing/support/SmxPlatform.java
servicemix/sandbox/karaf/nmr/testing/support/src/main/resources/
servicemix/sandbox/karaf/nmr/testing/support/src/main/resources/META-INF/
servicemix/sandbox/karaf/nmr/testing/support/src/main/resources/META-INF/spring/
servicemix/sandbox/karaf/nmr/testing/support/src/main/resources/META-INF/spring/testing-support.xml
servicemix/sandbox/karaf/nmr/testing/support/src/main/resources/org/
servicemix/sandbox/karaf/nmr/testing/support/src/main/resources/org/apache/
servicemix/sandbox/karaf/nmr/testing/support/src/main/resources/org/apache/servicemix/
servicemix/sandbox/karaf/nmr/testing/support/src/main/resources/org/apache/servicemix/platform/
servicemix/sandbox/karaf/nmr/testing/support/src/main/resources/org/apache/servicemix/platform/testing/
servicemix/sandbox/karaf/nmr/testing/support/src/main/resources/org/apache/servicemix/platform/testing/support/
servicemix/sandbox/karaf/nmr/testing/support/src/main/resources/org/apache/servicemix/platform/testing/support/config.properties
servicemix/sandbox/karaf/nmr/testing/support/src/test/
servicemix/sandbox/karaf/nmr/testing/support/src/test/java/
servicemix/sandbox/karaf/nmr/testing/support/src/test/java/org/
servicemix/sandbox/karaf/nmr/testing/support/src/test/java/org/apache/
servicemix/sandbox/karaf/nmr/testing/support/src/test/java/org/apache/servicemix/
servicemix/sandbox/karaf/nmr/testing/support/src/test/java/org/apache/servicemix/platform/
servicemix/sandbox/karaf/nmr/testing/support/src/test/java/org/apache/servicemix/platform/testing/
servicemix/sandbox/karaf/nmr/testing/support/src/test/java/org/apache/servicemix/platform/testing/support/
servicemix/sandbox/karaf/nmr/testing/support/src/test/java/org/apache/servicemix/platform/testing/support/AbstractIntegrationTestTest.java
Modified:
servicemix/sandbox/karaf/nmr/assembly/pom.xml
servicemix/sandbox/karaf/nmr/branding/pom.xml
servicemix/sandbox/karaf/nmr/jbi/commands/pom.xml
servicemix/sandbox/karaf/nmr/jbi/commands/src/main/java/org/apache/servicemix/jbi/commands/JbiCommandSupport.java
servicemix/sandbox/karaf/nmr/jbi/deployer/pom.xml
servicemix/sandbox/karaf/nmr/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/handler/JBIDeploymentListener.java
servicemix/sandbox/karaf/nmr/jbi/deployer/src/main/resources/META-INF/spring/servicemix-jbi-deployer.xml
servicemix/sandbox/karaf/nmr/jbi/itests/pom.xml
servicemix/sandbox/karaf/nmr/jbi/itests/src/test/java/org/apache/servicemix/jbi/itests/IntegrationTest.java
servicemix/sandbox/karaf/nmr/jbi/itests/src/test/java/org/apache/servicemix/jbi/itests/ManagementTest.java
servicemix/sandbox/karaf/nmr/jbi/itests/src/test/resources/org/apache/servicemix/MANIFEST.MF
servicemix/sandbox/karaf/nmr/jbi/pom.xml
servicemix/sandbox/karaf/nmr/naming/pom.xml
servicemix/sandbox/karaf/nmr/nmr/audit/pom.xml
servicemix/sandbox/karaf/nmr/nmr/audit/src/main/java/org/apache/servicemix/nmr/audit/commands/AuditCommandSupport.java
servicemix/sandbox/karaf/nmr/nmr/commands/pom.xml
servicemix/sandbox/karaf/nmr/nmr/commands/src/main/java/org/apache/servicemix/nmr/commands/NmrCommandSupport.java
servicemix/sandbox/karaf/nmr/nmr/core/pom.xml
servicemix/sandbox/karaf/nmr/pom.xml
Modified: servicemix/sandbox/karaf/nmr/assembly/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/sandbox/karaf/nmr/assembly/pom.xml?rev=801482&r1=801481&r2=801482&view=diff
==============================================================================
--- servicemix/sandbox/karaf/nmr/assembly/pom.xml (original)
+++ servicemix/sandbox/karaf/nmr/assembly/pom.xml Thu Aug 6 00:53:43 2009
@@ -34,13 +34,13 @@
<dependencies>
<dependency>
- <groupId>org.apache.servicemix.kernel</groupId>
- <artifactId>apache-servicemix-kernel</artifactId>
+ <groupId>org.apache.felix.karaf</groupId>
+ <artifactId>apache-felix-karaf</artifactId>
<type>zip</type>
</dependency>
<dependency>
- <groupId>org.apache.servicemix.kernel</groupId>
- <artifactId>apache-servicemix-kernel</artifactId>
+ <groupId>org.apache.felix.karaf</groupId>
+ <artifactId>apache-felix-karaf</artifactId>
<type>tar.gz</type>
</dependency>
<dependency>
@@ -193,8 +193,8 @@
<configuration>
<artifactItems>
<artifactItem>
- <groupId>org.apache.servicemix.kernel</groupId>
- <artifactId>apache-servicemix-kernel</artifactId>
+ <groupId>org.apache.felix.karaf</groupId>
+ <artifactId>apache-felix-karaf</artifactId>
<type>tar.gz</type>
<outputDirectory>target/dependencies/unix</outputDirectory>
</artifactItem>
@@ -210,8 +210,8 @@
<configuration>
<artifactItems>
<artifactItem>
- <groupId>org.apache.servicemix.kernel</groupId>
- <artifactId>apache-servicemix-kernel</artifactId>
+ <groupId>org.apache.felix.karaf</groupId>
+ <artifactId>apache-felix-karaf</artifactId>
<type>zip</type>
<outputDirectory>target/dependencies/win</outputDirectory>
</artifactItem>
Modified: servicemix/sandbox/karaf/nmr/branding/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/sandbox/karaf/nmr/branding/pom.xml?rev=801482&r1=801481&r2=801482&view=diff
==============================================================================
--- servicemix/sandbox/karaf/nmr/branding/pom.xml (original)
+++ servicemix/sandbox/karaf/nmr/branding/pom.xml Thu Aug 6 00:53:43 2009
@@ -52,7 +52,7 @@
<Import-Package>*</Import-Package>
<Private-Package>!*</Private-Package>
<Export-Package>
- org.apache.servicemix.kernel.version
+ org.apache.felix.karaf.version
</Export-Package>
<Spring-Context>*;publish-context:=false</Spring-Context>
</instructions>
Modified: servicemix/sandbox/karaf/nmr/jbi/commands/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/sandbox/karaf/nmr/jbi/commands/pom.xml?rev=801482&r1=801481&r2=801482&view=diff
==============================================================================
--- servicemix/sandbox/karaf/nmr/jbi/commands/pom.xml (original)
+++ servicemix/sandbox/karaf/nmr/jbi/commands/pom.xml Thu Aug 6 00:53:43 2009
@@ -37,8 +37,9 @@
<artifactId>org.apache.servicemix.jbi.deployer</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.servicemix.kernel.gshell</groupId>
- <artifactId>org.apache.servicemix.kernel.gshell.core</artifactId>
+ <groupId>org.apache.felix.karaf.gshell</groupId>
+ <artifactId>org.apache.felix.karaf.gshell.console</artifactId>
+ <version>${felix.karaf.version}</version>
</dependency>
</dependencies>
@@ -53,7 +54,7 @@
<Import-Package>
org.apache.geronimo.gshell.wisdom.command,
org.apache.geronimo.gshell.wisdom.registry,
- org.apache.servicemix.kernel.gshell.core,
+ org.apache.felix.karaf.gshell.console,
*
</Import-Package>
<Export-Package>${pom.artifactId}*</Export-Package>
@@ -64,4 +65,4 @@
</plugins>
</build>
-</project>
\ No newline at end of file
+</project>
Modified: servicemix/sandbox/karaf/nmr/jbi/commands/src/main/java/org/apache/servicemix/jbi/commands/JbiCommandSupport.java
URL: http://svn.apache.org/viewvc/servicemix/sandbox/karaf/nmr/jbi/commands/src/main/java/org/apache/servicemix/jbi/commands/JbiCommandSupport.java?rev=801482&r1=801481&r2=801482&view=diff
==============================================================================
--- servicemix/sandbox/karaf/nmr/jbi/commands/src/main/java/org/apache/servicemix/jbi/commands/JbiCommandSupport.java (original)
+++ servicemix/sandbox/karaf/nmr/jbi/commands/src/main/java/org/apache/servicemix/jbi/commands/JbiCommandSupport.java Thu Aug 6 00:53:43 2009
@@ -19,7 +19,7 @@
import java.util.ArrayList;
import java.util.List;
-import org.apache.servicemix.kernel.gshell.core.OsgiCommandSupport;
+import org.apache.felix.karaf.gshell.console.OsgiCommandSupport;
import org.apache.servicemix.jbi.deployer.Component;
import org.apache.servicemix.jbi.deployer.ServiceAssembly;
import org.apache.servicemix.jbi.deployer.SharedLibrary;
Modified: servicemix/sandbox/karaf/nmr/jbi/deployer/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/sandbox/karaf/nmr/jbi/deployer/pom.xml?rev=801482&r1=801481&r2=801482&view=diff
==============================================================================
--- servicemix/sandbox/karaf/nmr/jbi/deployer/pom.xml (original)
+++ servicemix/sandbox/karaf/nmr/jbi/deployer/pom.xml Thu Aug 6 00:53:43 2009
@@ -41,8 +41,9 @@
<artifactId>org.apache.servicemix.jbi.runtime</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.servicemix.kernel</groupId>
- <artifactId>org.apache.servicemix.kernel.filemonitor</artifactId>
+ <groupId>org.apache.felix.karaf.deployer</groupId>
+ <artifactId>org.apache.felix.karaf.deployer.filemonitor</artifactId>
+ <version>${felix.karaf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.xbean</groupId>
Modified: servicemix/sandbox/karaf/nmr/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/handler/JBIDeploymentListener.java
URL: http://svn.apache.org/viewvc/servicemix/sandbox/karaf/nmr/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/handler/JBIDeploymentListener.java?rev=801482&r1=801481&r2=801482&view=diff
==============================================================================
--- servicemix/sandbox/karaf/nmr/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/handler/JBIDeploymentListener.java (original)
+++ servicemix/sandbox/karaf/nmr/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/handler/JBIDeploymentListener.java Thu Aug 6 00:53:43 2009
@@ -25,7 +25,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.servicemix.jbi.deployer.descriptor.DescriptorFactory;
-import org.apache.servicemix.kernel.filemonitor.DeploymentListener;
+import org.apache.felix.karaf.deployer.filemonitor.DeploymentListener;
/**
* A JBI DeploymentListener which transforms plain JBI artifacts to OSGi bundles.
Modified: servicemix/sandbox/karaf/nmr/jbi/deployer/src/main/resources/META-INF/spring/servicemix-jbi-deployer.xml
URL: http://svn.apache.org/viewvc/servicemix/sandbox/karaf/nmr/jbi/deployer/src/main/resources/META-INF/spring/servicemix-jbi-deployer.xml?rev=801482&r1=801481&r2=801482&view=diff
==============================================================================
--- servicemix/sandbox/karaf/nmr/jbi/deployer/src/main/resources/META-INF/spring/servicemix-jbi-deployer.xml (original)
+++ servicemix/sandbox/karaf/nmr/jbi/deployer/src/main/resources/META-INF/spring/servicemix-jbi-deployer.xml Thu Aug 6 00:53:43 2009
@@ -61,7 +61,7 @@
</osgi:service-properties>
</osgi:service>
- <osgi:service ref="listener" interface="org.apache.servicemix.kernel.filemonitor.DeploymentListener" />
+ <osgi:service ref="listener" interface="org.apache.felix.karaf.deployer.filemonitor.DeploymentListener" />
<osgi:service ref="endpointListener">
<osgi:interfaces>
Modified: servicemix/sandbox/karaf/nmr/jbi/itests/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/sandbox/karaf/nmr/jbi/itests/pom.xml?rev=801482&r1=801481&r2=801482&view=diff
==============================================================================
--- servicemix/sandbox/karaf/nmr/jbi/itests/pom.xml (original)
+++ servicemix/sandbox/karaf/nmr/jbi/itests/pom.xml Thu Aug 6 00:53:43 2009
@@ -31,20 +31,27 @@
<packaging>jar</packaging>
<name>Apache ServiceMix JBI Integration Tests</name>
+ <properties>
+ <ant.version>1.7.0_1</ant.version>
+ <geronimo.blueprint.version>1.0.0-SNAPSHOT</geronimo.blueprint.version>
+ </properties>
+
<dependencies>
<dependency>
- <groupId>org.apache.servicemix.kernel</groupId>
- <artifactId>org.apache.servicemix.kernel.main</artifactId>
- <scope>test</scope>
+ <groupId>org.apache.servicemix.bundles</groupId>
+ <artifactId>org.apache.servicemix.bundles.ant</artifactId>
+ <version>${ant.version}</version>
</dependency>
<dependency>
- <groupId>org.apache.servicemix.kernel.testing</groupId>
- <artifactId>org.apache.servicemix.kernel.testing.support</artifactId>
+ <groupId>org.apache.servicemix.platform.testing</groupId>
+ <artifactId>org.apache.servicemix.platform.testing.support</artifactId>
+ <version>${pom.version}</version>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.apache.servicemix.kernel</groupId>
- <artifactId>org.apache.servicemix.kernel.filemonitor</artifactId>
+ <groupId>org.apache.felix.karaf.deployer</groupId>
+ <artifactId>org.apache.felix.karaf.deployer.filemonitor</artifactId>
+ <version>${felix.karaf.version}</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -101,11 +108,6 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.apache.servicemix.kernel</groupId>
- <artifactId>org.apache.servicemix.kernel.management</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.prefs</artifactId>
<scope>test</scope>
Modified: servicemix/sandbox/karaf/nmr/jbi/itests/src/test/java/org/apache/servicemix/jbi/itests/IntegrationTest.java
URL: http://svn.apache.org/viewvc/servicemix/sandbox/karaf/nmr/jbi/itests/src/test/java/org/apache/servicemix/jbi/itests/IntegrationTest.java?rev=801482&r1=801481&r2=801482&view=diff
==============================================================================
--- servicemix/sandbox/karaf/nmr/jbi/itests/src/test/java/org/apache/servicemix/jbi/itests/IntegrationTest.java (original)
+++ servicemix/sandbox/karaf/nmr/jbi/itests/src/test/java/org/apache/servicemix/jbi/itests/IntegrationTest.java Thu Aug 6 00:53:43 2009
@@ -29,7 +29,7 @@
import org.apache.servicemix.jbi.deployer.ServiceAssembly;
import org.apache.servicemix.jbi.deployer.handler.JBIDeploymentListener;
-import org.apache.servicemix.kernel.testing.support.AbstractIntegrationTest;
+import org.apache.servicemix.platform.testing.support.AbstractIntegrationTest;
import org.apache.servicemix.nmr.api.NMR;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleException;
@@ -71,8 +71,7 @@
getBundle("org.apache.geronimo.specs", "geronimo-jta_1.1_spec"),
getBundle("org.apache.felix", "org.apache.felix.prefs"),
getBundle("org.apache.xbean", "xbean-classloader"),
- getBundle("org.apache.servicemix.kernel", "org.apache.servicemix.kernel.filemonitor"),
- getBundle("org.apache.servicemix.kernel", "org.apache.servicemix.kernel.management"),
+ getBundle("org.apache.felix.karaf.deployer", "org.apache.felix.karaf.deployer.filemonitor"),
getBundle("org.apache.servicemix", "servicemix-utils"),
getBundle("org.apache.servicemix.nmr", "org.apache.servicemix.nmr.api"),
getBundle("org.apache.servicemix.nmr", "org.apache.servicemix.nmr.core"),
Modified: servicemix/sandbox/karaf/nmr/jbi/itests/src/test/java/org/apache/servicemix/jbi/itests/ManagementTest.java
URL: http://svn.apache.org/viewvc/servicemix/sandbox/karaf/nmr/jbi/itests/src/test/java/org/apache/servicemix/jbi/itests/ManagementTest.java?rev=801482&r1=801481&r2=801482&view=diff
==============================================================================
--- servicemix/sandbox/karaf/nmr/jbi/itests/src/test/java/org/apache/servicemix/jbi/itests/ManagementTest.java (original)
+++ servicemix/sandbox/karaf/nmr/jbi/itests/src/test/java/org/apache/servicemix/jbi/itests/ManagementTest.java Thu Aug 6 00:53:43 2009
@@ -16,7 +16,7 @@
*/
package org.apache.servicemix.jbi.itests;
-import org.apache.servicemix.kernel.testing.support.AbstractIntegrationTest;
+import org.apache.servicemix.platform.testing.support.AbstractIntegrationTest;
import org.apache.servicemix.jbi.deployer.AdminCommandsService;
public class ManagementTest extends AbstractIntegrationTest {
@@ -56,8 +56,7 @@
getBundle("org.apache.geronimo.specs", "geronimo-jta_1.1_spec"),
getBundle("org.apache.felix", "org.apache.felix.prefs"),
getBundle("org.apache.xbean", "xbean-classloader"),
- getBundle("org.apache.servicemix.kernel", "org.apache.servicemix.kernel.filemonitor"),
- getBundle("org.apache.servicemix.kernel", "org.apache.servicemix.kernel.management"),
+ getBundle("org.apache.felix.karaf.deployer", "org.apache.felix.karaf.deployer.filemonitor"),
getBundle("org.apache.servicemix", "servicemix-utils"),
getBundle("org.apache.servicemix.nmr", "org.apache.servicemix.nmr.api"),
getBundle("org.apache.servicemix.nmr", "org.apache.servicemix.nmr.core"),
Modified: servicemix/sandbox/karaf/nmr/jbi/itests/src/test/resources/org/apache/servicemix/MANIFEST.MF
URL: http://svn.apache.org/viewvc/servicemix/sandbox/karaf/nmr/jbi/itests/src/test/resources/org/apache/servicemix/MANIFEST.MF?rev=801482&r1=801481&r2=801482&view=diff
==============================================================================
--- servicemix/sandbox/karaf/nmr/jbi/itests/src/test/resources/org/apache/servicemix/MANIFEST.MF (original)
+++ servicemix/sandbox/karaf/nmr/jbi/itests/src/test/resources/org/apache/servicemix/MANIFEST.MF Thu Aug 6 00:53:43 2009
@@ -29,7 +29,7 @@
org.apache.servicemix.nmr.core,
org.apache.servicemix.jbi.deployer,
org.apache.servicemix.jbi.deployer.handler,
- org.apache.servicemix.kernel.testing.support,
+ org.apache.servicemix.platform.testing.support,
org.springframework.osgi.util,
javax.jbi.component,
javax.jbi.management
Modified: servicemix/sandbox/karaf/nmr/jbi/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/sandbox/karaf/nmr/jbi/pom.xml?rev=801482&r1=801481&r2=801482&view=diff
==============================================================================
--- servicemix/sandbox/karaf/nmr/jbi/pom.xml (original)
+++ servicemix/sandbox/karaf/nmr/jbi/pom.xml Thu Aug 6 00:53:43 2009
@@ -40,4 +40,4 @@
<module>itests</module>
</modules>
-</project>
\ No newline at end of file
+</project>
Modified: servicemix/sandbox/karaf/nmr/naming/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/sandbox/karaf/nmr/naming/pom.xml?rev=801482&r1=801481&r2=801482&view=diff
==============================================================================
--- servicemix/sandbox/karaf/nmr/naming/pom.xml (original)
+++ servicemix/sandbox/karaf/nmr/naming/pom.xml Thu Aug 6 00:53:43 2009
@@ -58,11 +58,6 @@
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>org.apache.servicemix.kernel.testing</groupId>
- <artifactId>org.apache.servicemix.kernel.testing.support</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<scope>test</scope>
@@ -99,4 +94,4 @@
</plugins>
</build>
-</project>
\ No newline at end of file
+</project>
Modified: servicemix/sandbox/karaf/nmr/nmr/audit/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/sandbox/karaf/nmr/nmr/audit/pom.xml?rev=801482&r1=801481&r2=801482&view=diff
==============================================================================
--- servicemix/sandbox/karaf/nmr/nmr/audit/pom.xml (original)
+++ servicemix/sandbox/karaf/nmr/nmr/audit/pom.xml Thu Aug 6 00:53:43 2009
@@ -45,12 +45,13 @@
<artifactId>spring-beans</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.servicemix.kernel</groupId>
- <artifactId>org.apache.servicemix.kernel.main</artifactId>
+ <groupId>org.apache.felix.karaf</groupId>
+ <artifactId>org.apache.felix.karaf.main</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.servicemix.kernel.gshell</groupId>
- <artifactId>org.apache.servicemix.kernel.gshell.core</artifactId>
+ <groupId>org.apache.felix.karaf.gshell</groupId>
+ <artifactId>org.apache.felix.karaf.gshell.console</artifactId>
+ <version>${felix.karaf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
@@ -81,7 +82,7 @@
org.apache.geronimo.gshell.wisdom.command,
org.apache.geronimo.gshell.wisdom.registry,
org.apache.lucene*;resolution:=optional,
- org.apache.servicemix.kernel.gshell.core,
+ org.apache.felix.karaf.gshell.console,
org.apache.servicemix.nmr.core,
*
</Import-Package>
Modified: servicemix/sandbox/karaf/nmr/nmr/audit/src/main/java/org/apache/servicemix/nmr/audit/commands/AuditCommandSupport.java
URL: http://svn.apache.org/viewvc/servicemix/sandbox/karaf/nmr/nmr/audit/src/main/java/org/apache/servicemix/nmr/audit/commands/AuditCommandSupport.java?rev=801482&r1=801481&r2=801482&view=diff
==============================================================================
--- servicemix/sandbox/karaf/nmr/nmr/audit/src/main/java/org/apache/servicemix/nmr/audit/commands/AuditCommandSupport.java (original)
+++ servicemix/sandbox/karaf/nmr/nmr/audit/src/main/java/org/apache/servicemix/nmr/audit/commands/AuditCommandSupport.java Thu Aug 6 00:53:43 2009
@@ -16,7 +16,7 @@
*/
package org.apache.servicemix.nmr.audit.commands;
-import org.apache.servicemix.kernel.gshell.core.OsgiCommandSupport;
+import org.apache.felix.karaf.gshell.console.OsgiCommandSupport;
import org.apache.servicemix.nmr.audit.AuditorMBean;
import org.osgi.framework.ServiceReference;
@@ -36,8 +36,8 @@
protected Object doExecute() throws Exception {
AuditorMBean auditor = getAuditor();
if (auditor == null) {
- io.err.println("No NMR auditor has been registered. Aborting");
- return Result.FAILURE;
+ System.err.println("No NMR auditor has been registered. Aborting");
+ return 1;
}
return doExecute(auditor);
}
Modified: servicemix/sandbox/karaf/nmr/nmr/commands/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/sandbox/karaf/nmr/nmr/commands/pom.xml?rev=801482&r1=801481&r2=801482&view=diff
==============================================================================
--- servicemix/sandbox/karaf/nmr/nmr/commands/pom.xml (original)
+++ servicemix/sandbox/karaf/nmr/nmr/commands/pom.xml Thu Aug 6 00:53:43 2009
@@ -37,8 +37,9 @@
<artifactId>org.apache.servicemix.nmr.core</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.servicemix.kernel.gshell</groupId>
- <artifactId>org.apache.servicemix.kernel.gshell.core</artifactId>
+ <groupId>org.apache.felix.karaf.gshell</groupId>
+ <artifactId>org.apache.felix.karaf.gshell.console</artifactId>
+ <version>${felix.karaf.version}</version>
</dependency>
</dependencies>
@@ -53,7 +54,7 @@
<Import-Package>
org.apache.geronimo.gshell.wisdom.command,
org.apache.geronimo.gshell.wisdom.registry,
- org.apache.servicemix.kernel.gshell.core,
+ org.apache.felix.karaf.gshell.console,
*
</Import-Package>
<Export-Package>${pom.artifactId}</Export-Package>
@@ -64,4 +65,4 @@
</plugins>
</build>
-</project>
\ No newline at end of file
+</project>
Modified: servicemix/sandbox/karaf/nmr/nmr/commands/src/main/java/org/apache/servicemix/nmr/commands/NmrCommandSupport.java
URL: http://svn.apache.org/viewvc/servicemix/sandbox/karaf/nmr/nmr/commands/src/main/java/org/apache/servicemix/nmr/commands/NmrCommandSupport.java?rev=801482&r1=801481&r2=801482&view=diff
==============================================================================
--- servicemix/sandbox/karaf/nmr/nmr/commands/src/main/java/org/apache/servicemix/nmr/commands/NmrCommandSupport.java (original)
+++ servicemix/sandbox/karaf/nmr/nmr/commands/src/main/java/org/apache/servicemix/nmr/commands/NmrCommandSupport.java Thu Aug 6 00:53:43 2009
@@ -18,7 +18,7 @@
import java.util.List;
import org.apache.servicemix.nmr.api.Endpoint;
-import org.apache.servicemix.kernel.gshell.core.OsgiCommandSupport;
+import org.apache.felix.karaf.gshell.console.OsgiCommandSupport;
/**
* Base class for NMR related commands
Modified: servicemix/sandbox/karaf/nmr/nmr/core/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/sandbox/karaf/nmr/nmr/core/pom.xml?rev=801482&r1=801481&r2=801482&view=diff
==============================================================================
--- servicemix/sandbox/karaf/nmr/nmr/core/pom.xml (original)
+++ servicemix/sandbox/karaf/nmr/nmr/core/pom.xml Thu Aug 6 00:53:43 2009
@@ -33,6 +33,17 @@
<dependencies>
<dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.framework</artifactId>
+ <version>${felix.framework.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
<groupId>org.apache.servicemix.nmr</groupId>
<artifactId>org.apache.servicemix.nmr.api</artifactId>
</dependency>
@@ -52,8 +63,8 @@
<!-- Put this dependency before the following one to avoid a classloader problem
when running junit tests -->
<dependency>
- <groupId>org.apache.servicemix.kernel</groupId>
- <artifactId>org.apache.servicemix.kernel.main</artifactId>
+ <groupId>org.apache.felix.karaf</groupId>
+ <artifactId>org.apache.felix.karaf.main</artifactId>
<scope>test</scope>
</dependency>
<dependency>
@@ -72,6 +83,11 @@
<artifactId>easymock</artifactId>
<scope>test</scope>
</dependency>
+
+ <dependency>
+ <groupId>org.springframework.osgi</groupId>
+ <artifactId>spring-osgi-test</artifactId>
+ </dependency>
</dependencies>
<build>
@@ -93,4 +109,4 @@
</plugins>
</build>
-</project>
\ No newline at end of file
+</project>
Modified: servicemix/sandbox/karaf/nmr/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/sandbox/karaf/nmr/pom.xml?rev=801482&r1=801481&r2=801482&view=diff
==============================================================================
--- servicemix/sandbox/karaf/nmr/pom.xml (original)
+++ servicemix/sandbox/karaf/nmr/pom.xml Thu Aug 6 00:53:43 2009
@@ -38,6 +38,7 @@
<module>naming</module>
<module>transaction</module>
<module>nmr</module>
+ <module>testing</module>
<module>jbi</module>
<module>bundle</module>
<module>assembly</module>
@@ -97,7 +98,7 @@
<servicemix.http.version>2008.01</servicemix.http.version>
<servicemix.jsr181.version>2008.01</servicemix.jsr181.version>
<servicemix.shared.version>2008.01</servicemix.shared.version>
- <servicemix.kernel.version>1.1.0</servicemix.kernel.version>
+ <felix.karaf.version>1.2.0-SNAPSHOT</felix.karaf.version>
<servicemix.legal.version>1.0</servicemix.legal.version>
<servicemix.specs.version>1.3.0</servicemix.specs.version>
<servicemix.utils.version>1.1.0</servicemix.utils.version>
@@ -480,14 +481,14 @@
<version>${junit.version}</version>
</dependency>
<dependency>
- <groupId>org.apache.servicemix.kernel.gshell</groupId>
- <artifactId>org.apache.servicemix.kernel.gshell.core</artifactId>
- <version>${servicemix.kernel.version}</version>
+ <groupId>org.apache.felix.karaf.gshell</groupId>
+ <artifactId>org.apache.felix.karaf.gshell.core</artifactId>
+ <version>${felix.karaf.version}</version>
</dependency>
<dependency>
- <groupId>org.apache.servicemix.kernel</groupId>
- <artifactId>org.apache.servicemix.kernel.filemonitor</artifactId>
- <version>${servicemix.kernel.version}</version>
+ <groupId>org.apache.felix.karaf</groupId>
+ <artifactId>org.apache.felix.karaf.filemonitor</artifactId>
+ <version>${felix.karaf.version}</version>
<exclusions>
<exclusion>
<groupId>org.apache.felix</groupId>
@@ -496,14 +497,14 @@
</exclusions>
</dependency>
<dependency>
- <groupId>org.apache.servicemix.kernel</groupId>
- <artifactId>org.apache.servicemix.kernel.management</artifactId>
- <version>${servicemix.kernel.version}</version>
+ <groupId>org.apache.felix.karaf</groupId>
+ <artifactId>org.apache.felix.karaf.management</artifactId>
+ <version>${felix.karaf.version}</version>
</dependency>
<dependency>
- <groupId>org.apache.servicemix.kernel.testing</groupId>
- <artifactId>org.apache.servicemix.kernel.testing.support</artifactId>
- <version>${servicemix.kernel.version}</version>
+ <groupId>org.apache.felix.karaf.testing</groupId>
+ <artifactId>org.apache.felix.karaf.testing.support</artifactId>
+ <version>${felix.karaf.version}</version>
<exclusions>
<exclusion>
<groupId>org.apache.felix</groupId>
@@ -614,9 +615,9 @@
</exclusions>
</dependency>
<dependency>
- <groupId>org.apache.servicemix.kernel</groupId>
- <artifactId>org.apache.servicemix.kernel.main</artifactId>
- <version>${servicemix.kernel.version}</version>
+ <groupId>org.apache.felix.karaf</groupId>
+ <artifactId>org.apache.felix.karaf.main</artifactId>
+ <version>${felix.karaf.version}</version>
<exclusions>
<exclusion>
<groupId>org.apache.felix</groupId>
@@ -631,15 +632,15 @@
<type>xml</type>
</dependency>
<dependency>
- <groupId>org.apache.servicemix.kernel</groupId>
- <artifactId>apache-servicemix-kernel</artifactId>
- <version>${servicemix.kernel.version}</version>
+ <groupId>org.apache.felix.karaf</groupId>
+ <artifactId>apache-felix-karaf</artifactId>
+ <version>${felix.karaf.version}</version>
<type>zip</type>
</dependency>
<dependency>
- <groupId>org.apache.servicemix.kernel</groupId>
- <artifactId>apache-servicemix-kernel</artifactId>
- <version>${servicemix.kernel.version}</version>
+ <groupId>org.apache.felix.karaf</groupId>
+ <artifactId>apache-felix-karaf</artifactId>
+ <version>${felix.karaf.version}</version>
<type>tar.gz</type>
</dependency>
<dependency>
Added: servicemix/sandbox/karaf/nmr/testing/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/sandbox/karaf/nmr/testing/pom.xml?rev=801482&view=auto
==============================================================================
--- servicemix/sandbox/karaf/nmr/testing/pom.xml (added)
+++ servicemix/sandbox/karaf/nmr/testing/pom.xml Thu Aug 6 00:53:43 2009
@@ -0,0 +1,38 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.servicemix.nmr</groupId>
+ <artifactId>nmr-parent</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.apache.servicemix.testing</groupId>
+ <artifactId>testing</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache ServiceMix Testing</name>
+
+ <modules>
+ <module>support</module>
+ </modules>
+
+</project>
Added: servicemix/sandbox/karaf/nmr/testing/support/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/sandbox/karaf/nmr/testing/support/pom.xml?rev=801482&view=auto
==============================================================================
--- servicemix/sandbox/karaf/nmr/testing/support/pom.xml (added)
+++ servicemix/sandbox/karaf/nmr/testing/support/pom.xml Thu Aug 6 00:53:43 2009
@@ -0,0 +1,159 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.servicemix.testing</groupId>
+ <artifactId>testing</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.apache.servicemix.platform.testing</groupId>
+ <artifactId>org.apache.servicemix.platform.testing.support</artifactId>
+ <packaging>bundle</packaging>
+ <version>1.1.0-SNAPSHOT</version>
+ <name>Apache ServiceMix :: Testing - Support</name>
+
+ <properties>
+ <aopalliance.version>1.0_1</aopalliance.version>
+ <asm.version>2.2.3_1</asm.version>
+ <jaxp.ri.version>1.4.2_1</jaxp.ri.version>
+ <pax.url.version>0.3.3</pax.url.version>
+ <felix.configadmin.version>1.0.4</felix.configadmin.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.framework</artifactId>
+ <version>${felix.framework.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.configadmin</artifactId>
+ <version>${felix.configadmin.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.logging</groupId>
+ <artifactId>pax-logging-api</artifactId>
+ <version>${pax.logging.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.logging</groupId>
+ <artifactId>pax-logging-service</artifactId>
+ <version>${pax.logging.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.osgi</groupId>
+ <artifactId>spring-osgi-test</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.osgi</groupId>
+ <artifactId>spring-osgi-extender</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.osgi</groupId>
+ <artifactId>spring-osgi-annotation</artifactId>
+ <version>${spring.osgi.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-servlet_2.5_spec</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.servicemix.specs</groupId>
+ <artifactId>org.apache.servicemix.specs.jaxp-api-1.4</artifactId>
+ <version>${servicemix.specs.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.servicemix.bundles</groupId>
+ <artifactId>org.apache.servicemix.bundles.aopalliance</artifactId>
+ <version>${aopalliance.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.servicemix.bundles</groupId>
+ <artifactId>org.apache.servicemix.bundles.asm</artifactId>
+ <version>${asm.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.servicemix.bundles</groupId>
+ <artifactId>org.apache.servicemix.bundles.junit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.servicemix.bundles</groupId>
+ <artifactId>org.apache.servicemix.bundles.woodstox</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.servicemix.bundles</groupId>
+ <artifactId>org.apache.servicemix.bundles.jaxp-ri</artifactId>
+ <version>${jaxp.ri.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.url</groupId>
+ <artifactId>pax-url-mvn</artifactId>
+ <version>${pax.url.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <configuration>
+ <instructions>
+ <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+ <Import-Package>
+ javax.management,
+ org.springframework.jmx.support,
+ org.apache.felix*;resolution:=optional,
+ org.apache.servicemix.platform.main;resolution:=optional,
+ org.apache.servicemix.platform.main.spi;resolution:=optional;version="1.0.0",
+ *
+ </Import-Package>
+ <Export-Package>
+ org.apache.servicemix.platform.testing.support,
+ org.apache.servicemix.platform.main.spi
+ </Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Added: servicemix/sandbox/karaf/nmr/testing/support/src/main/java/org/apache/servicemix/platform/main/spi/MainService.java
URL: http://svn.apache.org/viewvc/servicemix/sandbox/karaf/nmr/testing/support/src/main/java/org/apache/servicemix/platform/main/spi/MainService.java?rev=801482&view=auto
==============================================================================
--- servicemix/sandbox/karaf/nmr/testing/support/src/main/java/org/apache/servicemix/platform/main/spi/MainService.java (added)
+++ servicemix/sandbox/karaf/nmr/testing/support/src/main/java/org/apache/servicemix/platform/main/spi/MainService.java Thu Aug 6 00:53:43 2009
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.servicemix.platform.main.spi;
+
+public interface MainService {
+ public abstract String[] getArgs();
+ public int getExitCode();
+ public void setExitCode(int exitCode);
+}
Added: servicemix/sandbox/karaf/nmr/testing/support/src/main/java/org/apache/servicemix/platform/testing/support/AbstractIntegrationTest.java
URL: http://svn.apache.org/viewvc/servicemix/sandbox/karaf/nmr/testing/support/src/main/java/org/apache/servicemix/platform/testing/support/AbstractIntegrationTest.java?rev=801482&view=auto
==============================================================================
--- servicemix/sandbox/karaf/nmr/testing/support/src/main/java/org/apache/servicemix/platform/testing/support/AbstractIntegrationTest.java (added)
+++ servicemix/sandbox/karaf/nmr/testing/support/src/main/java/org/apache/servicemix/platform/testing/support/AbstractIntegrationTest.java Thu Aug 6 00:53:43 2009
@@ -0,0 +1,246 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.platform.testing.support;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import org.apache.log4j.PropertyConfigurator;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceListener;
+import org.springframework.core.io.FileSystemResource;
+import org.springframework.core.io.Resource;
+import org.springframework.osgi.test.AbstractConfigurableBundleCreatorTests;
+import org.springframework.osgi.test.provisioning.ArtifactLocator;
+import org.springframework.osgi.util.OsgiFilterUtils;
+import org.springframework.osgi.util.OsgiListenerUtils;
+import org.springframework.util.Assert;
+import org.springframework.util.StringUtils;
+
+
+public class AbstractIntegrationTest extends AbstractConfigurableBundleCreatorTests {
+
+ static {
+ try {
+ File f = new File("target/smx4");
+ f.mkdirs();
+ System.setProperty("servicemix.name", "root");
+ System.setProperty("servicemix.home", f.getAbsolutePath());
+ System.setProperty("servicemix.base", f.getAbsolutePath());
+ System.setProperty("org.apache.servicemix.filemonitor.configDir", new File(f, "etc").getAbsolutePath());
+ System.setProperty("org.apache.servicemix.filemonitor.monitorDir", new File(f, "deploy").getAbsolutePath());
+ System.setProperty("org.apache.servicemix.filemonitor.generatedJarDir", new File(f, "data/generate-bundles").getAbsolutePath());
+ System.setProperty("bundles.configuration.location", new File("src/test/conf").getAbsolutePath());
+ System.setProperty("org.osgi.vendor.framework", "org.apache.servicemix.platform.testing.support");
+ PropertyConfigurator.configure("target/test-classes/log4j.properties");
+ } catch (Throwable t) {}
+ }
+
+ private Properties dependencies;
+
+ @Override
+ protected String getPlatformName() {
+ String systemProperty = System.getProperty(OSGI_FRAMEWORK_SELECTOR);
+ if (logger.isTraceEnabled())
+ logger.trace("system property [" + OSGI_FRAMEWORK_SELECTOR + "] has value=" + systemProperty);
+
+ return (systemProperty == null ? SmxPlatform.class.getName() : systemProperty);
+ }
+
+ protected String getBundle(String groupId, String artifactId) {
+ return groupId + "," + artifactId + "," + getBundleVersion(groupId, artifactId);
+ }
+
+ protected String getBundleVersion(String groupId, String artifactId) {
+ if (dependencies == null) {
+ try {
+ File f = new File(System.getProperty("basedir"), "target/classes/META-INF/maven/dependencies.properties");
+ Properties prop = new Properties();
+ prop.load(new FileInputStream(f));
+ dependencies = prop;
+ } catch (IOException e) {
+ throw new IllegalStateException("Unable to load dependencies informations", e);
+ }
+ }
+ String version = dependencies.getProperty(groupId + "/" + artifactId + "/version");
+ if (version == null) {
+ throw new IllegalStateException("Unable to find dependency information for: " + groupId + "/" + artifactId + "/version");
+ }
+ return version;
+ }
+
+ protected String[] getTestFrameworkBundlesNames() {
+ return new String[] {
+ getBundle("org.apache.geronimo.specs", "geronimo-servlet_2.5_spec"),
+ getBundle("org.apache.servicemix.specs", "org.apache.servicemix.specs.jaxp-api-1.4"),
+ getBundle("org.apache.servicemix.bundles", "org.apache.servicemix.bundles.jaxp-ri"),
+ getBundle("org.apache.felix", "org.osgi.compendium"),
+ getBundle("org.apache.felix", "org.apache.felix.configadmin"),
+ getBundle("org.ops4j.pax.logging", "pax-logging-api"),
+ getBundle("org.ops4j.pax.logging", "pax-logging-service"),
+ getBundle("org.apache.servicemix.bundles", "org.apache.servicemix.bundles.aopalliance"),
+ getBundle("org.apache.servicemix.bundles", "org.apache.servicemix.bundles.asm"),
+ getBundle("org.apache.servicemix.bundles", "org.apache.servicemix.bundles.junit"),
+ getBundle("org.springframework", "spring-beans"),
+ getBundle("org.springframework", "spring-core"),
+ getBundle("org.springframework", "spring-context"),
+ getBundle("org.springframework", "spring-aop"),
+ getBundle("org.springframework", "spring-test"),
+ getBundle("org.springframework.osgi", "spring-osgi-core"),
+ getBundle("org.springframework.osgi", "spring-osgi-io"),
+ getBundle("org.springframework.osgi", "spring-osgi-extender"),
+ getBundle("org.springframework.osgi", "spring-osgi-test"),
+ getBundle("org.springframework.osgi", "spring-osgi-annotation"),
+ getBundle("org.ops4j.pax.url", "pax-url-mvn"),
+ getBundle("org.apache.servicemix.platform.testing", "org.apache.servicemix.platform.testing.support"),
+ };
+ }
+
+ protected Bundle installBundle(String groupId, String artifactId, String classifier, String type) throws Exception {
+ String version = getBundleVersion(groupId, artifactId);
+ File loc = localMavenBundle(groupId, artifactId, version, classifier, type);
+ Bundle bundle = bundleContext.installBundle(loc.toURI().toString());
+ bundle.start();
+ return bundle;
+ }
+
+ protected Resource locateBundle(String bundleId) {
+ Assert.hasText(bundleId, "bundleId should not be empty");
+
+ // parse the String
+ String[] artifactId = StringUtils.commaDelimitedListToStringArray(bundleId);
+
+ Assert.isTrue(artifactId.length >= 3, "the CSV string " + bundleId + " contains too few values");
+ // TODO: add a smarter mechanism which can handle 1 or 2 values CSVs
+ for (int i = 0; i < artifactId.length; i++) {
+ artifactId[i] = StringUtils.trimWhitespace(artifactId[i]);
+ }
+
+ File f;
+ if (artifactId.length == 3) {
+ f = localMavenBundle(artifactId[0], artifactId[1], artifactId[2], null, ArtifactLocator.DEFAULT_ARTIFACT_TYPE);
+ } else {
+ f = localMavenBundle(artifactId[0], artifactId[1], artifactId[2], null, artifactId[3]);
+ }
+ return new FileSystemResource(f);
+ }
+
+
+ protected File localMavenBundle(String groupId, String artifact, String version, String classifier, String type) {
+ String defaultHome = new File(new File(System.getProperty("user.home")), ".m2/repository").getAbsolutePath();
+ File repositoryHome = new File(System.getProperty("localRepository", defaultHome));
+
+ StringBuffer location = new StringBuffer(groupId.replace('.', '/'));
+ location.append('/');
+ location.append(artifact);
+ location.append('/');
+ location.append(getSnapshot(version));
+ location.append('/');
+ location.append(artifact);
+ location.append('-');
+ location.append(version);
+ if (classifier != null) {
+ location.append('-');
+ location.append(classifier);
+ }
+ location.append(".");
+ location.append(type);
+
+ return new File(repositoryHome, location.toString());
+ }
+
+ protected static String getSnapshot(String version) {
+ if (isTimestamped(version)) {
+ return version.substring(0, version.lastIndexOf('-', version.lastIndexOf('-') - 1)) + "-SNAPSHOT";
+ }
+ return version;
+ }
+
+ protected static boolean isTimestamped(String version) {
+ return version.matches(".+-\\d\\d\\d\\d\\d\\d\\d\\d\\.\\d\\d\\d\\d\\d\\d-\\d+");
+ }
+
+ protected static boolean isSnapshot(String version) {
+ return version.matches(".+-SNAPSHOT");
+ }
+
+ public <T> T getOsgiService(Class<T> type) {
+ return getOsgiService(type, DEFAULT_WAIT_TIME);
+ }
+
+ public <T> T getOsgiService(Class<T> type, long timeout) {
+ // translate from seconds to miliseconds
+ long time = timeout * 1000;
+
+ // use the counter to make sure the threads block
+ final Counter counter = new Counter("waitForOsgiService on bnd=" + type.getName());
+
+ counter.increment();
+
+ final List<T> services = new ArrayList<T>();
+
+ ServiceListener listener = new ServiceListener() {
+ public void serviceChanged(ServiceEvent event) {
+ if (event.getType() == ServiceEvent.REGISTERED) {
+ services.add((T) bundleContext.getService(event.getServiceReference()));
+ counter.decrement();
+ }
+ }
+ };
+
+ String filter = OsgiFilterUtils.unifyFilter(type.getName(), null);
+ OsgiListenerUtils.addServiceListener(bundleContext, listener, filter);
+
+ if (logger.isDebugEnabled())
+ logger.debug("start waiting for OSGi service=" + type.getName());
+
+ try {
+ if (counter.waitForZero(time)) {
+ logger.warn("waiting for OSGi service=" + type.getName() + " timed out");
+ throw new RuntimeException("Gave up waiting for OSGi service '" + type.getName() + "' to be created");
+ }
+ else if (logger.isDebugEnabled()) {
+ logger.debug("found OSGi service=" + type.getName());
+ }
+ return services.get(0);
+ }
+ finally {
+ // inform waiting thread
+ bundleContext.removeServiceListener(listener);
+ }
+ }
+
+ protected void checkBundleStarted(String name) {
+ assertNotNull(bundleContext);
+ for (int i = 0; i < bundleContext.getBundles().length; i++) {
+ Bundle b = bundleContext.getBundles()[i];
+ if (b.getSymbolicName().equals(name)) {
+ assertEquals("Bundle '" + name + "' is not active", Bundle.ACTIVE, b.getState());
+ return;
+ }
+ }
+ fail("Bundle '" + name + "' not found");
+ }
+
+
+}
Added: servicemix/sandbox/karaf/nmr/testing/support/src/main/java/org/apache/servicemix/platform/testing/support/Counter.java
URL: http://svn.apache.org/viewvc/servicemix/sandbox/karaf/nmr/testing/support/src/main/java/org/apache/servicemix/platform/testing/support/Counter.java?rev=801482&view=auto
==============================================================================
--- servicemix/sandbox/karaf/nmr/testing/support/src/main/java/org/apache/servicemix/platform/testing/support/Counter.java (added)
+++ servicemix/sandbox/karaf/nmr/testing/support/src/main/java/org/apache/servicemix/platform/testing/support/Counter.java Thu Aug 6 00:53:43 2009
@@ -0,0 +1,172 @@
+/*
+ * Copyright 2002-2007 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.platform.testing.support;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Simple counting class which can be incremented or decremented in a
+ * synchronized manner. This class can be used as a synchronization mechanism
+ * between threads mainly though {@link #waitForZero(long)} method.
+ *
+ * The main usage of the class is to allow a master thread, to know when other
+ * threads (slaves) have passed a certain point in execution.
+ *
+ * <p/> As opposed to a Barrier or a Semaphore, this class should be used only
+ * with 1 waiting thread (a master) and any number of slave threads.
+ *
+ * <pre style="code">
+ * Thread 1:
+ * synchronized(counter) {
+ * counter.increment();
+ * thread2.start();
+ * counter.increment();
+ * thread3.start();
+ *
+ * // wait 1 second for other threads to complete
+ * counter.waitForZero(1000);
+ * }
+ *
+ * Thread 2:
+ * // do some work
+ * counter.decrement();
+ *
+ * Thread 3:
+ * // do some work
+ * counter.decrement();
+ *
+ * </pre>
+ *
+ * <p/> Mainly for usage inside the framework. All methods are thread-safe
+ * however for the master/slave pattern, synchronized blocks are recommended as
+ * multiple operations have to be executed at once.
+ *
+ * @author Costin Leau
+ *
+ */
+public class Counter {
+
+ private int counter = 0;
+
+ private static final Log log = LogFactory.getLog(Counter.class);
+
+ private final String name;
+
+ /**
+ * Create counter with a given name.
+ * @param name counter name
+ */
+ public Counter(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Increment the counter value.
+ */
+ public synchronized void increment() {
+ counter++;
+ if (log.isTraceEnabled())
+ log.trace("counter [" + name + "] incremented to " + counter);
+ }
+
+ /**
+ * Decrement the counter value.
+ */
+ public synchronized void decrement() {
+ counter--;
+ if (log.isTraceEnabled())
+ log.trace("counter [" + name + "] decremented to " + counter);
+ notifyAll();
+ }
+
+ public synchronized boolean decrementAndWait(long timeToWait) {
+ decrement();
+ if (counter > 0)
+ return waitForZero(timeToWait);
+ return true;
+ }
+
+ /**
+ * Check if the counter value is zero.
+ * @return true if value is equal or below zero, false otherwise.
+ */
+ public synchronized boolean isZero() {
+ return is(0);
+ }
+
+ public synchronized boolean is(int value) {
+ return counter == value;
+ }
+
+ /**
+ * Return the counter value.
+ *
+ * @return the counter value.
+ */
+ public synchronized int getValue() {
+ return counter;
+ }
+
+ public synchronized String toString() {
+ return "" + counter;
+ }
+
+ /**
+ * Specialized method which waits for 0. Identical to waitFor(0, waitTime).
+ *
+ * @see #waitFor(int, long)
+ * @param waitTime
+ * @return true if the waiting timed out, false otherwise
+ */
+ public synchronized boolean waitForZero(long waitTime) {
+ return waitFor(0, waitTime);
+ }
+
+ /**
+ * Wait maximum the givem amount of time, for the counter to reach the given
+ * value.. This mechanism relies on {@link Object#wait(long)} and
+ * {@link Object#notify()} mechanism to work appropriately. Please see the
+ * class javadoc for more info.
+ *
+ * <p/> This method will stop waiting and return true if the thread
+ * is interrupted.
+ *
+ * @param value the value to wait for
+ * @param waitTime the time (in miliseconds) to wait for zero value
+ * @return true if the waiting timed out, false otherwise
+ */
+ public synchronized boolean waitFor(int value, long waitTime) {
+ boolean timedout = false;
+ long remainingTime = waitTime;
+ long startTime = System.currentTimeMillis();
+
+ while (counter > value && !timedout) {
+ // start waiting
+ try {
+ this.wait(remainingTime);
+ // compute the remaining time
+ remainingTime = waitTime - (System.currentTimeMillis() - startTime);
+ timedout = remainingTime <= 0;
+ }
+ catch (InterruptedException ex) {
+ timedout = true;
+ }
+ }
+
+ return timedout;
+ }
+}
Added: servicemix/sandbox/karaf/nmr/testing/support/src/main/java/org/apache/servicemix/platform/testing/support/FrameworkUtil.java
URL: http://svn.apache.org/viewvc/servicemix/sandbox/karaf/nmr/testing/support/src/main/java/org/apache/servicemix/platform/testing/support/FrameworkUtil.java?rev=801482&view=auto
==============================================================================
--- servicemix/sandbox/karaf/nmr/testing/support/src/main/java/org/apache/servicemix/platform/testing/support/FrameworkUtil.java (added)
+++ servicemix/sandbox/karaf/nmr/testing/support/src/main/java/org/apache/servicemix/platform/testing/support/FrameworkUtil.java Thu Aug 6 00:53:43 2009
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.platform.testing.support;
+
+import org.apache.felix.framework.FilterImpl;
+import org.osgi.framework.Filter;
+import org.osgi.framework.InvalidSyntaxException;
+
+/**
+ */
+public class FrameworkUtil {
+
+ public static Filter createFilter(String f) throws InvalidSyntaxException {
+ return new FilterImpl(f);
+ }
+
+}
Added: servicemix/sandbox/karaf/nmr/testing/support/src/main/java/org/apache/servicemix/platform/testing/support/SmxPlatform.java
URL: http://svn.apache.org/viewvc/servicemix/sandbox/karaf/nmr/testing/support/src/main/java/org/apache/servicemix/platform/testing/support/SmxPlatform.java?rev=801482&view=auto
==============================================================================
--- servicemix/sandbox/karaf/nmr/testing/support/src/main/java/org/apache/servicemix/platform/testing/support/SmxPlatform.java (added)
+++ servicemix/sandbox/karaf/nmr/testing/support/src/main/java/org/apache/servicemix/platform/testing/support/SmxPlatform.java Thu Aug 6 00:53:43 2009
@@ -0,0 +1,543 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.platform.testing.support;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.felix.framework.Felix;
+import org.apache.felix.framework.util.CompoundEnumeration;
+import org.apache.felix.framework.util.FelixConstants;
+import org.apache.servicemix.platform.main.spi.MainService;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+import org.springframework.osgi.test.platform.FelixPlatform;
+import org.springframework.osgi.test.platform.OsgiPlatform;
+import org.springframework.util.ClassUtils;
+
+public class SmxPlatform implements OsgiPlatform {
+
+ private static final Log log = LogFactory.getLog(FelixPlatform.class);
+
+ private static final String FELIX_CONF_FILE = "config.properties";
+
+ private static final String FELIX_CONFIG_PROPERTY = "config.properties";
+
+ public final static String FRAMEWORK_STORAGE = "org.osgi.framework.storage";
+
+ private static final String DELIM_START = "${";
+ private static final String DELIM_STOP = "}";
+
+ private BundleContext context;
+
+ private Object platform;
+
+ private File felixStorageDir;
+
+ private Properties configurationProperties = new Properties();
+
+ protected Properties getPlatformProperties() {
+ // load Felix configuration
+ Properties props = new Properties();
+ props.putAll(getFelixConfiguration());
+ props.putAll(getLocalConfiguration());
+ return props;
+ }
+
+ public Properties getConfigurationProperties() {
+ // local properties
+ configurationProperties.putAll(getPlatformProperties());
+ // system properties
+ configurationProperties.putAll(System.getProperties());
+ return configurationProperties;
+ }
+
+ public BundleContext getBundleContext() {
+ return context;
+ }
+
+ private Set<String> getJars(Class... classes) {
+ Set<String> jars = new HashSet<String>();
+ for (Class cl : classes) {
+ String name = cl.getName().replace('.', '/') + ".class";
+ URL url = (cl.getClassLoader() != null ? cl.getClassLoader() : getClass().getClassLoader()).getResource(name);
+ String path = url.toString();
+ if (path.startsWith("jar:")) {
+ path = path.substring(0, path.indexOf('!'));
+ } else {
+ path = path.substring(0, path.indexOf(name));
+ }
+ jars.add(path);
+ }
+ return jars;
+ }
+
+ public void start() throws Exception {
+ Set<String> jars = getJars(Felix.class);
+ ClassLoader classLoader = new GuardClassLoader(toURLs(jars.toArray(new String[jars.size()])), null);
+
+ BundleActivator activator = new BundleActivator() {
+ private ServiceRegistration registration;
+
+ public void start(BundleContext context) {
+ registration = context.registerService(MainService.class.getName(), new MainService() {
+ public String[] getArgs() {
+ return new String[0];
+ }
+ public int getExitCode() {
+ return 0;
+ }
+ public void setExitCode(int exitCode) {
+ }
+ }, null);
+ }
+
+ public void stop(BundleContext context) {
+ registration.unregister();
+ }
+ };
+ List<BundleActivator> activations = new ArrayList<BundleActivator>();
+ activations.add(activator);
+
+ Properties props = getConfigurationProperties();
+ props.put(FelixConstants.SYSTEMBUNDLE_ACTIVATORS_PROP, activations);
+
+ Thread.currentThread().setContextClassLoader(classLoader);
+ Class cl = classLoader.loadClass(Felix.class.getName());
+ Constructor cns = cl.getConstructor(Map.class);
+ platform = cns.newInstance(props);
+ platform.getClass().getMethod("start").invoke(platform);
+
+ Bundle systemBundle = (Bundle) platform;
+
+ // call getBundleContext
+ final Method getContext = systemBundle.getClass().getMethod("getBundleContext", null);
+
+ AccessController.doPrivileged(new PrivilegedAction() {
+
+ public Object run() {
+ getContext.setAccessible(true);
+ return null;
+ }
+ });
+ context = (BundleContext) getContext.invoke(systemBundle, null);
+ }
+
+ public void stop() throws Exception {
+ try {
+ platform.getClass().getMethod("stop").invoke(platform);
+ }
+ finally {
+ // remove cache folder
+ delete(felixStorageDir);
+ }
+ }
+
+ public String toString() {
+ return getClass().getName();
+ }
+
+ File createTempDir(String suffix) {
+ if (suffix == null)
+ suffix = "osgi";
+ File tempFileName;
+
+ try {
+ tempFileName = File.createTempFile("org.sfw.osgi", suffix);
+ }
+ catch (IOException ex) {
+ if (log.isWarnEnabled()) {
+ log.warn("Could not create temporary directory, returning a temp folder inside the current folder", ex);
+ }
+ return new File("./tmp-test");
+ }
+
+ tempFileName.delete(); // we want it to be a directory...
+ File tempFolder = new File(tempFileName.getAbsolutePath());
+ tempFolder.mkdir();
+ return tempFolder;
+ }
+
+ /**
+ * Configuration settings for the OSGi test run.
+ *
+ * @return
+ */
+ private Properties getLocalConfiguration() {
+ Properties props = new Properties();
+ felixStorageDir = createTempDir("felix");
+ props.setProperty(FRAMEWORK_STORAGE, this.felixStorageDir.getAbsolutePath());
+ if (log.isTraceEnabled())
+ log.trace("felix storage dir is " + felixStorageDir.getAbsolutePath());
+
+ return props;
+ }
+
+ /**
+ * Loads Felix config.properties.
+ *
+ * <strong>Note</strong> the current implementation uses Felix's Main class
+ * to resolve placeholders as opposed to loading the properties manually
+ * (through JDK's Properties class or Spring's PropertiesFactoryBean).
+ *
+ * @return
+ */
+ // TODO: this method should be removed once Felix 1.0.2 is released
+ private Properties getFelixConfiguration() {
+ String location = "/".concat(ClassUtils.classPackageAsResourcePath(getClass())).concat("/").concat(FELIX_CONF_FILE);
+ URL url = getClass().getResource(location);
+ if (url == null)
+ throw new RuntimeException("cannot find felix configuration properties file:" + location);
+
+ // used with Main
+ System.getProperties().setProperty(FELIX_CONFIG_PROPERTY, url.toExternalForm());
+
+ // load config.properties (use Felix's Main for resolving placeholders)
+ Properties props = new Properties();
+ InputStream is = null;
+ try {
+ is = url.openConnection().getInputStream();
+ props.load(is);
+ is.close();
+ }
+ catch (FileNotFoundException ex) {
+ // Ignore file not found.
+ }
+ catch (Exception ex) {
+ System.err.println("Main: Error loading system properties from " + url);
+ System.err.println("Main: " + ex);
+ try {
+ if (is != null) is.close();
+ }
+ catch (IOException ex2) {
+ // Nothing we can do.
+ }
+ return null;
+ }
+ // Perform variable substitution for system properties.
+ for (Enumeration e = props.propertyNames(); e.hasMoreElements();) {
+ String name = (String) e.nextElement();
+ props.setProperty(name, substVars(props.getProperty(name), name, null, props));
+ }
+ return props;
+ }
+
+ /**
+ * Delete the given file (can be a simple file or a folder).
+ *
+ * @param file the file to be deleted
+ * @return if the deletion succeded or not
+ */
+ public static boolean delete(File file) {
+
+ // bail out quickly
+ if (file == null)
+ return false;
+
+ // recursively delete children file
+ boolean success = true;
+
+ if (file.isDirectory()) {
+ String[] children = file.list();
+ for (int i = 0; i < children.length; i++) {
+ success &= delete(new File(file, children[i]));
+ }
+ }
+
+ // The directory is now empty so delete it
+ return (success &= file.delete());
+ }
+
+ private static URL[] toURLs(String[] jars) throws MalformedURLException {
+ URL[] urls = new URL[jars.length];
+ for (int i = 0; i < urls.length; i++) {
+ String s = jars[i];
+ if (s.startsWith("jar:")) {
+ s = s.substring("jar:".length());
+ }
+ urls[i] = new URL(s);
+ }
+ return urls;
+ }
+
+ public class GuardClassLoader extends URLClassLoader {
+ private Set<String> bootDelegationPackages = new HashSet<String>();
+ private Set<String> packages = new HashSet<String>();
+ private List<ClassLoader> parents = new ArrayList<ClassLoader>();
+
+ public GuardClassLoader(URL[] urls, List<String> additionalPackages) throws MalformedURLException {
+ super(urls, SmxPlatform.class.getClassLoader());
+ Properties props = getConfigurationProperties();
+ String prop = props.getProperty("org.osgi.framework.system.packages");
+ String[] ps = prop.split(",");
+ for (String p : ps) {
+ String[] spack = p.split(";");
+ for (String sp : spack) {
+ sp = sp.trim();
+ if (!sp.startsWith("version")) {
+ packages.add(sp);
+ }
+ }
+ }
+ if (additionalPackages != null) {
+ packages.addAll(additionalPackages);
+ }
+ prop = props.getProperty("org.osgi.framework.bootdelegation");
+ ps = prop.split(",");
+ for (String p : ps) {
+ p = p.trim();
+ if (p.endsWith("*")) {
+ p = p.substring(0, p.length() - 1);
+ }
+ bootDelegationPackages.add(p);
+ }
+ ClassLoader cl = getParent();
+ while (cl != null) {
+ parents.add(0, cl);
+ cl = cl.getParent();
+ }
+ //System.err.println("Boot packages: " + packages);
+ }
+
+ protected synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
+ //System.err.println("Loading class: " + name);
+ Class c = findLoadedClass(name);
+ if (c == null) {
+ String pkg = name.substring(0, name.lastIndexOf('.'));
+ boolean match = name.startsWith("java.") || packages.contains(pkg);
+ if (!match) {
+ for (String p : bootDelegationPackages) {
+ if (pkg.startsWith(p)) {
+ match = true;
+ break;
+ }
+ }
+ }
+ if (match) {
+ for (ClassLoader cl : parents) {
+ try {
+ c = cl.loadClass(name);
+ //System.err.println("Class loaded from: " + cl.getResource(name.replace('.', '/') + ".class"));
+ break;
+ } catch (ClassNotFoundException e) {
+ }
+ }
+ if (c == null) {
+ throw new ClassNotFoundException(name);
+ }
+ //c = getParent().loadClass(name);
+ } else {
+ c = findClass(name);
+ }
+ }
+ if (resolve) {
+ resolveClass(c);
+ }
+ return c;
+ }
+
+ public URL getResource(String name) {
+ //System.err.println("GetResource: " + name);
+ URL url = getParent().getResource(name);
+ if (url != null && url.toString().startsWith("file:")) {
+ return url;
+ }
+ url = findResource(name);
+ System.err.println("Resource " + name + " found at " + url);
+ return url;
+ /*
+ URL u = getParent().getResource(name);
+ if (u != null) {
+ String path = u.toString();
+ int idx = path.indexOf('!');
+ if (idx > 0) {
+ path = path.substring(0, idx);
+ if (!jars.contains(path)) {
+ return null;
+ }
+ } else {
+ idx = 0;
+ }
+ }
+ return u;
+ */
+ }
+
+ public Enumeration<URL> getResources(final String name) throws IOException {
+ //System.err.println("GetResources: " + name);
+ Enumeration[] tmp = new Enumeration[2];
+ final Enumeration<URL> e = getParent().getResources(name);
+ tmp[0] = new Enumeration<URL>() {
+ URL next = null;
+ public boolean hasMoreElements() {
+ while (next == null && e.hasMoreElements()) {
+ next = e.nextElement();
+ String path = next.toString();
+ if (!path.startsWith("file:")) {
+ next = null;
+ }
+ }
+ return next != null;
+ }
+ public URL nextElement() {
+ return next;
+ }
+ };
+ tmp[1] = findResources(name);
+ return new CompoundEnumeration(tmp) {
+ public Object nextElement() {
+ Object next = super.nextElement();
+ System.err.println("Resources " + name + " found at " + next);
+ return next;
+ }
+ };
+ }
+ }
+
+ /**
+ * <p>
+ * This method performs property variable substitution on the
+ * specified value. If the specified value contains the syntax
+ * <tt>${<prop-name>}</tt>, where <tt><prop-name></tt>
+ * refers to either a configuration property or a system property,
+ * then the corresponding property value is substituted for the variable
+ * placeholder. Multiple variable placeholders may exist in the
+ * specified value as well as nested variable placeholders, which
+ * are substituted from inner most to outer most. Configuration
+ * properties override system properties.
+ * </p>
+ *
+ * @param val The string on which to perform property substitution.
+ * @param currentKey The key of the property being evaluated used to
+ * detect cycles.
+ * @param cycleMap Map of variable references used to detect nested cycles.
+ * @param configProps Set of configuration properties.
+ * @return The value of the specified string after system property substitution.
+ * @throws IllegalArgumentException If there was a syntax error in the
+ * property placeholder syntax or a recursive variable reference.
+ */
+ public static String substVars(String val, String currentKey,
+ Map<String, String> cycleMap, Properties configProps)
+ throws IllegalArgumentException {
+ // If there is currently no cycle map, then create
+ // one for detecting cycles for this invocation.
+ if (cycleMap == null) {
+ cycleMap = new HashMap<String, String>();
+ }
+
+ // Put the current key in the cycle map.
+ cycleMap.put(currentKey, currentKey);
+
+ // Assume we have a value that is something like:
+ // "leading ${foo.${bar}} middle ${baz} trailing"
+
+ // Find the first ending '}' variable delimiter, which
+ // will correspond to the first deepest nested variable
+ // placeholder.
+ int stopDelim = val.indexOf(DELIM_STOP);
+
+ // Find the matching starting "${" variable delimiter
+ // by looping until we find a start delimiter that is
+ // greater than the stop delimiter we have found.
+ int startDelim = val.indexOf(DELIM_START);
+ while (stopDelim >= 0) {
+ int idx = val.indexOf(DELIM_START, startDelim + DELIM_START.length());
+ if ((idx < 0) || (idx > stopDelim)) {
+ break;
+ } else if (idx < stopDelim) {
+ startDelim = idx;
+ }
+ }
+
+ // If we do not have a start or stop delimiter, then just
+ // return the existing value.
+ if ((startDelim < 0) && (stopDelim < 0)) {
+ return val;
+ }
+ // At this point, we found a stop delimiter without a start,
+ // so throw an exception.
+ else if (((startDelim < 0) || (startDelim > stopDelim))
+ && (stopDelim >= 0)) {
+ throw new IllegalArgumentException(
+ "stop delimiter with no start delimiter: "
+ + val);
+ }
+
+ // At this point, we have found a variable placeholder so
+ // we must perform a variable substitution on it.
+ // Using the start and stop delimiter indices, extract
+ // the first, deepest nested variable placeholder.
+ String variable =
+ val.substring(startDelim + DELIM_START.length(), stopDelim);
+
+ // Verify that this is not a recursive variable reference.
+ if (cycleMap.get(variable) != null) {
+ throw new IllegalArgumentException(
+ "recursive variable reference: " + variable);
+ }
+
+ // Get the value of the deepest nested variable placeholder.
+ // Try to configuration properties first.
+ String substValue = (configProps != null)
+ ? configProps.getProperty(variable, null)
+ : null;
+ if (substValue == null) {
+ // Ignore unknown property values.
+ substValue = System.getProperty(variable, "");
+ }
+
+ // Remove the found variable from the cycle map, since
+ // it may appear more than once in the value and we don't
+ // want such situations to appear as a recursive reference.
+ cycleMap.remove(variable);
+
+ // Append the leading characters, the substituted value of
+ // the variable, and the trailing characters to get the new
+ // value.
+ val = val.substring(0, startDelim)
+ + substValue
+ + val.substring(stopDelim + DELIM_STOP.length(), val.length());
+
+ // Now perform substitution again, since there could still
+ // be substitutions to make.
+ val = substVars(val, currentKey, cycleMap, configProps);
+
+ // Return the value.
+ return val;
+ }
+}
Added: servicemix/sandbox/karaf/nmr/testing/support/src/main/resources/META-INF/spring/testing-support.xml
URL: http://svn.apache.org/viewvc/servicemix/sandbox/karaf/nmr/testing/support/src/main/resources/META-INF/spring/testing-support.xml?rev=801482&view=auto
==============================================================================
--- servicemix/sandbox/karaf/nmr/testing/support/src/main/resources/META-INF/spring/testing-support.xml (added)
+++ servicemix/sandbox/karaf/nmr/testing/support/src/main/resources/META-INF/spring/testing-support.xml Thu Aug 6 00:53:43 2009
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:ctx="http://www.springframework.org/schema/context"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:osgi="http://www.springframework.org/schema/osgi"
+ xmlns:osgix="http://www.springframework.org/schema/osgi-compendium"
+ xmlns:util="http://www.springframework.org/schema/util"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/context
+ http://www.springframework.org/schema/context/spring-context.xsd
+ http://www.springframework.org/schema/util
+ http://www.springframework.org/schema/util/spring-util.xsd
+ http://www.springframework.org/schema/osgi
+ http://www.springframework.org/schema/osgi/spring-osgi.xsd
+ http://www.springframework.org/schema/osgi-compendium
+ http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd">
+
+ <!-- MBeanServer bean -->
+ <bean id="mbeanServer" class="org.springframework.jmx.support.MBeanServerFactoryBean">
+ <property name="locateExistingServerIfPossible" value="true"/>
+ </bean>
+
+ <!-- Export the MBeanServer as an OSGi service -->
+ <osgi:service ref="mbeanServer">
+ <osgi:interfaces>
+ <value>javax.management.MBeanServer</value>
+ </osgi:interfaces>
+ </osgi:service>
+
+</beans>