FELIX-3371 Apply patch FELIX-3371-3.diff to update to newer pax-exam (patch provided by David Jencks, thanks alot)

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1298268 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/scr/pom.xml b/scr/pom.xml
index 84ce849..8bae96a 100644
--- a/scr/pom.xml
+++ b/scr/pom.xml
@@ -21,7 +21,7 @@
         <groupId>org.apache.felix</groupId>
         <artifactId>felix-parent</artifactId>
         <version>2.1</version>
-        <relativePath>../pom/pom.xml</relativePath>
+        <relativePath/>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <packaging>bundle</packaging>
@@ -113,33 +113,92 @@
         
         <!-- Integration Testing with Pax Exam -->
         <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <version>4.6</version>
+            <groupId>org.ops4j.pax.exam</groupId>
+            <artifactId>pax-exam-container-forked</artifactId>
+            <version>2.4.0.RC1</version>
             <scope>test</scope>
         </dependency>
+
         <dependency>
             <groupId>org.ops4j.pax.exam</groupId>
-            <artifactId>pax-exam</artifactId>
-            <version>0.6.0</version>
+            <artifactId>pax-exam-junit4</artifactId>
+            <version>2.4.0.RC1</version>
             <scope>test</scope>
         </dependency>
+    
         <dependency>
             <groupId>org.ops4j.pax.exam</groupId>
-            <artifactId>pax-exam-junit</artifactId>
-            <version>0.6.0</version>
+            <artifactId>pax-exam-link-mvn</artifactId>
+            <version>2.4.0.RC1</version>
+            <scope>test</scope>
+        </dependency>
+    
+        <dependency>
+            <groupId>org.ops4j.pax.url</groupId>
+            <artifactId>pax-url-aether</artifactId>
+            <version>1.4.0.RC1</version>
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>org.ops4j.pax.exam</groupId>
-            <artifactId>pax-exam-container-default</artifactId>
-            <version>0.6.0</version>
+            <groupId>org.ops4j.pax.url</groupId>
+            <artifactId>pax-url-wrap</artifactId>
+            <version>1.4.0.RC1</version>
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>org.ops4j.pax.swissbox</groupId>
-            <artifactId>pax-swissbox-tinybundles</artifactId>
-            <version>1.1.0</version>
+            <groupId>org.ops4j.pax.logging</groupId>
+            <artifactId>pax-logging-api</artifactId>
+            <version>1.6.3</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.ops4j.pax.logging</groupId>
+            <artifactId>pax-logging-service</artifactId>
+            <version>1.6.3</version>
+            <scope>test</scope>
+        </dependency>
+    
+        <dependency>
+            <groupId>ch.qos.logback</groupId>
+            <artifactId>logback-core</artifactId>
+            <version>0.9.29</version>
+            <scope>test</scope>
+        </dependency>
+    
+        <dependency>
+            <groupId>ch.qos.logback</groupId>
+            <artifactId>logback-classic</artifactId>
+            <version>0.9.29</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-atinject_1.0_spec</artifactId>
+            <version>1.0</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.junit</groupId>
+            <artifactId>com.springsource.org.junit</artifactId>
+            <version>4.9.0</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.ops4j.base</groupId>
+            <artifactId>ops4j-base-lang</artifactId>
+            <version>1.2.3</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.ops4j.base</groupId>
+            <artifactId>ops4j-base-net</artifactId>
+            <version>1.2.3</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.ops4j.pax.tinybundles</groupId>
+            <artifactId>tinybundles</artifactId>
+            <version>1.0.0</version>
             <scope>test</scope>
         </dependency>
     </dependencies>
@@ -149,7 +208,7 @@
             <plugin>
                 <groupId>org.apache.felix</groupId>
                 <artifactId>maven-bundle-plugin</artifactId>
-                <version>2.3.4</version>
+                <version>2.3.7</version>
                 <extensions>true</extensions>
                 <configuration>
                     <instructions>
@@ -295,36 +354,9 @@
                 </configuration>
             </plugin>
 
-            <!--
-                Exclude Integration tests in (default) unit tests and
-                conversely enable integration tests for integration testing
-                only. Helper classes are completely excluded from testing. 
-            -->
+            <!-- plain unit tests -->
             <plugin>
                 <artifactId>maven-surefire-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>surefire-it</id>
-                        <phase>integration-test</phase>
-                        <goals>
-                            <goal>test</goal>
-                        </goals>
-                        <configuration>
-                            <systemProperties>
-                                <property>
-                                    <name>project.bundle.file</name>
-                                    <value>${bundle.file.name}</value>
-                                </property>
-                            </systemProperties>
-                            <excludes>
-                                <exclude>**/components/**</exclude>
-                            </excludes>
-                            <includes>
-                                <include>**/integration/*</include>
-                            </includes>
-                        </configuration>
-                    </execution>
-                </executions>
                 <configuration>
                     <excludes>
                         <exclude>**/integration/**</exclude>
@@ -334,6 +366,33 @@
                     </excludes>
                 </configuration>
             </plugin>
+            <!-- integration tests run with pax-exam -->
+            <plugin>
+                <artifactId>maven-failsafe-plugin</artifactId>
+                <version>2.12</version>
+                <executions>
+                  <execution>
+                    <goals>
+                      <goal>integration-test</goal>
+                      <goal>verify</goal>
+                    </goals>
+                  </execution>
+                </executions>
+                <configuration>
+                    <systemProperties>
+                        <property>
+                            <name>project.bundle.file</name>
+                            <value>${bundle.file.name}</value>
+                        </property>
+                    </systemProperties>
+                    <excludes>
+                        <exclude>**/components/**</exclude>
+                    </excludes>
+                    <includes>
+                        <include>**/integration/*</include>
+                    </includes>
+                </configuration>
+            </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-javadoc-plugin</artifactId>
@@ -374,17 +433,40 @@
                 </plugins>
             </build>
         </profile>
+
+        <profile>
+            <id>felix</id>
+            <activation>
+                <activeByDefault>true</activeByDefault>
+            </activation>
+            <dependencies>
+                <dependency>
+                    <groupId>org.apache.felix</groupId>
+                    <artifactId>org.apache.felix.framework</artifactId>
+                    <version>4.0.2</version>
+                    <scope>test</scope>
+                </dependency>
+            </dependencies>
+        </profile>
+        <profile>
+            <id>equinox</id>
+            <dependencies>
+                <dependency>
+                    <groupId>org.eclipse</groupId>
+                    <artifactId>osgi</artifactId>
+                    <version>3.7.1.R37x_v20110808-1106</version>
+                    <scope>test</scope>
+                </dependency>
+            </dependencies>
+        </profile>
     </profiles>
         
-    <!-- repositories for Pax Exam and BND tool -->
     <repositories>
-    	<repository>
-    		<id>ops4j</id>
-    		<name>ops4j</name>
-    		<url>http://repository.ops4j.org/maven2</url>
-    		<snapshots>
-    			<enabled>false</enabled>
-    		</snapshots>
-    	</repository>
+        <!-- springsource junit wrapping -->
+        <repository>
+            <id>com.springsource.repository.bundles.external</id>
+            <name>SpringSource Enterprise Bundle Repository - External Bundle Releases</name>
+            <url>http://repository.springsource.com/maven/bundles/external</url>
+        </repository>
     </repositories>
 </project>
diff --git a/scr/src/test/java/org/apache/felix/scr/integration/ComponentTestBase.java b/scr/src/test/java/org/apache/felix/scr/integration/ComponentTestBase.java
index edcd72e..b0be98f 100644
--- a/scr/src/test/java/org/apache/felix/scr/integration/ComponentTestBase.java
+++ b/scr/src/test/java/org/apache/felix/scr/integration/ComponentTestBase.java
@@ -19,11 +19,13 @@
 package org.apache.felix.scr.integration;
 
 
+import static org.ops4j.pax.exam.CoreOptions.junitBundles;
 import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
 import static org.ops4j.pax.exam.CoreOptions.options;
 import static org.ops4j.pax.exam.CoreOptions.provision;
 import static org.ops4j.pax.exam.CoreOptions.systemProperty;
-import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.withBnd;
+import static org.ops4j.pax.tinybundles.core.TinyBundles.bundle;
+import static org.ops4j.pax.tinybundles.core.TinyBundles.withBnd;
 
 import java.io.File;
 import java.io.IOException;
@@ -31,19 +33,20 @@
 import java.lang.reflect.Field;
 import java.util.Dictionary;
 import java.util.Hashtable;
+
+import javax.inject.Inject;
 import junit.framework.TestCase;
 
 import org.apache.felix.scr.Component;
 import org.apache.felix.scr.ScrService;
-import org.apache.felix.scr.integration.components.MyTinyBundle;
 import org.junit.After;
 import org.junit.Before;
 import org.ops4j.pax.exam.CoreOptions;
-import org.ops4j.pax.exam.Inject;
 import org.ops4j.pax.exam.Option;
 import org.ops4j.pax.exam.OptionUtils;
-import org.ops4j.pax.exam.container.def.PaxRunnerOptions;
+import org.ops4j.pax.exam.TestProbeBuilder;
 import org.ops4j.pax.exam.junit.Configuration;
+import org.ops4j.pax.exam.junit.ProbeBuilder;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.BundleException;
@@ -91,6 +94,11 @@
         theConfig.put( PROP_NAME, PROP_NAME );
     }
 
+    @ProbeBuilder
+    public TestProbeBuilder extendProbe(TestProbeBuilder builder) {
+        builder.setHeader("Export-Package", "org.apache.felix.scr.integration.components,org.apache.felix.scr.integration.components.activatesignature");
+        return builder;
+    }
 
     @Configuration
     public static Option[] configuration()
@@ -106,12 +114,14 @@
         final Option[] base = options(
             provision(
                 CoreOptions.bundle( bundleFile.toURI().toString() ),
-                mavenBundle( "org.ops4j.pax.swissbox", "pax-swissbox-tinybundles", "1.1.0" ),
+                mavenBundle( "org.ops4j.pax.tinybundles", "tinybundles", "1.0.0" ),
                 mavenBundle( "org.apache.felix", "org.apache.felix.configadmin", "1.0.10" )
              ),
+             junitBundles(),
              systemProperty( "ds.factory.enabled" ).value( "true" )
+
         );
-        final Option vmOption = ( paxRunnerVmOption != null ) ? PaxRunnerOptions.vmOption( paxRunnerVmOption ) : null;
+        final Option vmOption = ( paxRunnerVmOption != null ) ? CoreOptions.vmOption( paxRunnerVmOption ) : null;
         return OptionUtils.combine( base, vmOption );
     }
 
@@ -319,17 +329,15 @@
 
     protected Bundle installBundle( final String descriptorFile ) throws BundleException
     {
-        final InputStream bundleStream = new MyTinyBundle()
-            .add( "OSGI-INF/components.xml", getClass().getResource( descriptorFile ) )
-            .prepare(
-                withBnd()
-                .set( Constants.BUNDLE_SYMBOLICNAME, "simplecomponent" )
-                .set( Constants.BUNDLE_VERSION, "0.0.11" )
-                .set( Constants.IMPORT_PACKAGE,
-                    "org.apache.felix.scr.integration.components,org.apache.felix.scr.integration.components.activatesignature" )
-                .set( "Service-Component", "OSGI-INF/components.xml" )
-            )
-            .build();
+        final InputStream bundleStream = bundle()
+            .add("OSGI-INF/components.xml", getClass().getResource(descriptorFile))
+
+                .set(Constants.BUNDLE_SYMBOLICNAME, "simplecomponent")
+                .set(Constants.BUNDLE_VERSION, "0.0.11")
+                .set(Constants.IMPORT_PACKAGE,
+                        "org.apache.felix.scr.integration.components,org.apache.felix.scr.integration.components.activatesignature")
+                .set("Service-Component", "OSGI-INF/components.xml")
+            .build(withBnd());
 
         try
         {
diff --git a/scr/src/test/java/org/apache/felix/scr/integration/components/MyTinyBundle.java b/scr/src/test/java/org/apache/felix/scr/integration/components/MyTinyBundle.java
deleted file mode 100644
index 8ee6e57..0000000
--- a/scr/src/test/java/org/apache/felix/scr/integration/components/MyTinyBundle.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * 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.felix.scr.integration.components;
-
-import java.io.InputStream;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.ops4j.pax.swissbox.tinybundles.core.BuildableBundle;
-import org.ops4j.pax.swissbox.tinybundles.core.TinyBundle;
-import org.ops4j.pax.swissbox.tinybundles.core.metadata.RawBuilder;
-
-public class MyTinyBundle implements TinyBundle {
-
-    private Map<String, URL> m_resources = new HashMap<String, URL>();
-
-    @SuppressWarnings("unchecked")
-    public TinyBundle add( Class clazz )
-    {
-        String name = clazz.getName().replaceAll( "\\.", "/" ) + ".class";
-        add( name, clazz.getResource( "/" + name ) );
-        return this;
-    }
-
-    public TinyBundle add( String name, URL url )
-    {
-        m_resources.put( name, url );
-        return this;
-    }
-
-
-    public TinyBundle add( String name, InputStream input )
-    {
-        // we don't currently support adding InputStream resources...
-        throw new UnsupportedOperationException();
-    }
-
-
-    public BuildableBundle prepare( BuildableBundle builder )
-    {
-        return builder.setResources( m_resources );
-    }
-
-    public BuildableBundle prepare()
-    {
-        return new RawBuilder().setResources( m_resources );
-    }
-
-
-}
\ No newline at end of file