Re-structure the test suites, use withiPOJO and OSGi test helpers.
Also update some test to the latest tinybundles.

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@939968 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/tests/core/handler/pom.xml b/ipojo/tests/core/handler/pom.xml
index 881826a..4b15132 100644
--- a/ipojo/tests/core/handler/pom.xml
+++ b/ipojo/tests/core/handler/pom.xml
@@ -1,4 +1,28 @@
-<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.
+-->
+<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">
+	<parent>
+		<groupId>ipojo.tests</groupId>
+		<artifactId>ipojo.tests</artifactId>
+		<version>1.5.0-SNAPSHOT</version>
+	</parent>
   <modelVersion>4.0.0</modelVersion>
   <groupId>ipojo.tests</groupId>
   <artifactId>tests.core.handler</artifactId>
@@ -19,6 +43,7 @@
       <plugin>
         <groupId>org.apache.servicemix.tooling</groupId>
         <artifactId>depends-maven-plugin</artifactId>
+        <version>1.2</version>
         <executions>
           <execution>
             <id>generate-depends-file</id>
@@ -104,18 +129,13 @@
       <scope>test</scope>
     </dependency>
 
-  <dependency>
-      <groupId>org.apache.felix</groupId>
-      <artifactId>org.apache.felix.ipojo.tinybundles.bundleAsiPOJO
-      </artifactId>
-      <version>1.5.0-SNAPSHOT</version>
-      <scope>test</scope>
+  	<dependency>
+      <groupId>org.ow2.chameleon.testing</groupId>
+      <artifactId>tinybundles-ipojo</artifactId>
     </dependency>
     <dependency>
-      <groupId>org.apache.felix</groupId>
-      <artifactId>org.apache.felix.ipojo.test.helpers</artifactId>
-      <version>1.5.0-SNAPSHOT</version>
-      <scope>test</scope>
+      <groupId>org.ow2.chameleon.testing</groupId>
+      <artifactId>osgi-helpers</artifactId>
     </dependency>
   </dependencies>
 
diff --git a/ipojo/tests/core/handler/src/test/java/org/apache/felix/ipojo/tests/core/DummyHandlerTest.java b/ipojo/tests/core/handler/src/test/java/org/apache/felix/ipojo/tests/core/DummyHandlerTest.java
index 880e689..63d0c8d 100644
--- a/ipojo/tests/core/handler/src/test/java/org/apache/felix/ipojo/tests/core/DummyHandlerTest.java
+++ b/ipojo/tests/core/handler/src/test/java/org/apache/felix/ipojo/tests/core/DummyHandlerTest.java
@@ -1,12 +1,13 @@
 package org.apache.felix.ipojo.tests.core;
 
-import static org.apache.felix.ipojo.tinybundles.BundleAsiPOJO.asiPOJOBundle;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
 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.swissbox.tinybundles.core.TinyBundles.newBundle;
+import static org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOBuilder.withiPOJO;
+
 
 import java.io.File;
 import java.util.HashMap;
@@ -19,7 +20,6 @@
 import org.apache.felix.ipojo.Factory;
 import org.apache.felix.ipojo.MissingHandlerException;
 import org.apache.felix.ipojo.UnacceptableConfiguration;
-import org.apache.felix.ipojo.test.helpers.OSGiHelper;
 import org.apache.felix.ipojo.tests.core.component.DummyImpl;
 import org.apache.felix.ipojo.tests.core.handler.DummyHandler;
 import org.apache.felix.ipojo.tests.core.service.Dummy;
@@ -38,6 +38,7 @@
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceRegistration;
 import org.osgi.service.useradmin.User;
+import org.ow2.chameleon.testing.helpers.OSGiHelper;
 
 import aQute.lib.osgi.Constants;
 
@@ -51,7 +52,7 @@
      */
     private static final int NB_MOCK = 10;
 
-  
+
     @Inject
     private BundleContext context;
 
@@ -71,19 +72,19 @@
     public static Option[] configure() {
         Option[] platform = options(CoreOptions.felix());
 
-        Option[] bundles = 
+        Option[] bundles =
             options(
                     provision(
                          newBundle()
-                             .add(DummyHandler.class) 
-                             .build(asiPOJOBundle(new File("src/test/resources/dummy-handler.xml")))
+                             .add(DummyHandler.class)
+                             .build(withiPOJO(new File("src/test/resources/dummy-handler.xml")))
                          ),
                      provision(
                          newBundle()
                              .add(Dummy.class)
                              .add(DummyImpl.class)
                              .set(Constants.EXPORT_PACKAGE, "org.apache.felix.ipojo.handler.dummy.test")
-                             .build(asiPOJOBundle(new File("src/test/resources/dummy-component.xml")))
+                             .build(withiPOJO(new File("src/test/resources/dummy-component.xml")))
                          ),
                     provision(
                         mavenBundle().groupId("org.apache.felix").artifactId("org.osgi.compendium").version("1.4.0")
@@ -100,8 +101,8 @@
     @Configuration
     public static Option[] configAdminBundle() {
         return options(
-                mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.ipojo").versionAsInProject(), 
-                mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.ipojo.test.helpers").versionAsInProject());
+                mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.ipojo").versionAsInProject(),
+                mavenBundle().groupId("org.ow2.chameleon.testing").artifactId("osgi-helpers").versionAsInProject());
     }
 
     /**
@@ -173,24 +174,24 @@
             ServiceRegistration sr = context.registerService(User.class.getName(), service, null);
             registrations.put(service, sr);
         }
-        
+
         //verify that the bind method of the handler has been called
         for (User user : registrations.keySet()) {
                 verify(user).getName();
         }
-        
+
         //verify that the unbind has been called
         for (User user : registrations.keySet()) {
             registrations.get(user).unregister();
             verify(user).getType();
         }
-        
+
         //verify no more interaction
         for (User user : registrations.keySet()) {
                 Mockito.verifyNoMoreInteractions(user);
         }
     }
-    
+
 
     /**
      * Test if the bind and unbind methods when the bind services are registered before the instance creation
@@ -198,7 +199,7 @@
     @Test
     public void testDummyTestBindBeforeStart() {
         ComponentInstance instance = null;
-        
+
         Map<User, ServiceRegistration> registrations = new HashMap<User, ServiceRegistration>();
 
         for (int i = 0; i < NB_MOCK; i++) {
@@ -217,18 +218,18 @@
         } catch (MissingHandlerException e) {
         } catch (ConfigurationException e) {
         }
-        
+
         //verify that the bind method of the handler has been called
         for (User user : registrations.keySet()) {
                 verify(user).getName();
         }
-        
+
         //verify that the unbind has been called
         for (User user : registrations.keySet()) {
             registrations.get(user).unregister();
             verify(user).getType();
         }
-        
+
         //verify no more interaction
         for (User user : registrations.keySet()) {
                 Mockito.verifyNoMoreInteractions(user);
diff --git a/ipojo/tests/core/handler/src/test/java/org/apache/felix/ipojo/tests/core/IgnoreCaseHandlerSelectionTest.java b/ipojo/tests/core/handler/src/test/java/org/apache/felix/ipojo/tests/core/IgnoreCaseHandlerSelectionTest.java
index 72e2bd5..d090cc7 100644
--- a/ipojo/tests/core/handler/src/test/java/org/apache/felix/ipojo/tests/core/IgnoreCaseHandlerSelectionTest.java
+++ b/ipojo/tests/core/handler/src/test/java/org/apache/felix/ipojo/tests/core/IgnoreCaseHandlerSelectionTest.java
@@ -1,6 +1,5 @@
 package org.apache.felix.ipojo.tests.core;
 
-import static org.apache.felix.ipojo.tinybundles.BundleAsiPOJO.asiPOJOBundle;
 import static org.ops4j.pax.exam.CoreOptions.equinox;
 import static org.ops4j.pax.exam.CoreOptions.felix;
 import static org.ops4j.pax.exam.CoreOptions.knopflerfish;
@@ -9,6 +8,8 @@
 import static org.ops4j.pax.exam.CoreOptions.provision;
 import static org.ops4j.pax.exam.MavenUtils.asInProject;
 import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.newBundle;
+import static org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOBuilder.withiPOJO;
+
 
 import java.io.File;
 
@@ -17,8 +18,6 @@
 import org.apache.felix.ipojo.HandlerFactory;
 import org.apache.felix.ipojo.architecture.Architecture;
 import org.apache.felix.ipojo.architecture.HandlerDescription;
-import org.apache.felix.ipojo.test.helpers.IPOJOHelper;
-import org.apache.felix.ipojo.test.helpers.OSGiHelper;
 import org.apache.felix.ipojo.tests.core.component.MyComponent;
 import org.apache.felix.ipojo.tests.core.handler.EmptyHandler;
 import org.apache.felix.ipojo.tests.core.service.MyService;
@@ -36,6 +35,8 @@
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Constants;
 import org.osgi.framework.ServiceReference;
+import org.ow2.chameleon.testing.helpers.IPOJOHelper;
+import org.ow2.chameleon.testing.helpers.OSGiHelper;
 
 /**
  * Check that the handler selection ignore case.
@@ -73,7 +74,7 @@
         File tmp = new File("target/tmp");
         tmp.mkdirs();
 
-        
+
         Option[] opt =  options(
                 felix(),
                 equinox(),
@@ -81,14 +82,14 @@
                 provision(
                         // Runtime.
                         mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.ipojo").version(asInProject()),
-                        mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.ipojo.test.helpers").versionAsInProject()
+                        mavenBundle().groupId("org.ow2.chameleon.testing").artifactId("osgi-helpers").versionAsInProject()
                         ),
                 provision(
                         newBundle()
                             .add( MyService.class )
                             .set( Constants.BUNDLE_SYMBOLICNAME, "ServiceInterface" )
                             .set( Constants.EXPORT_PACKAGE, "org.apache.felix.ipojo.tests.core.service" )
-                            .build( TinyBundles.withBnd() ) 
+                            .build( TinyBundles.withBnd() )
                     ),
                provision(
                        // Components and the handler
@@ -96,11 +97,11 @@
                             .add(MyComponent.class) // Component Implementation
                             .add(EmptyHandler.class) // Handler.
                             .set(Constants.BUNDLE_SYMBOLICNAME,"IgnoreCase")
-                            .set(Constants.IMPORT_PACKAGE, 
+                            .set(Constants.IMPORT_PACKAGE,
                                     "org.apache.felix.ipojo.tests.core.service, " +
                                     "org.apache.felix.ipojo, " +
                                     "org.apache.felix.ipojo.metadata")
-                            .build(asiPOJOBundle(new File(tmp, "ignorecase.jar"), new File("src/test/resources/ignorecase.xml")))));
+                            .build(withiPOJO(new File(tmp, "ignorecase.jar"), new File("src/test/resources/ignorecase.xml")))));
         return opt;
     }
 
@@ -149,7 +150,7 @@
 
           HandlerDescription desc = arch.getInstanceDescription()
               .getHandlerDescription("orG.apAche.feliX.iPOJO.tests.CORE.hAnDlEr:EmPtY");  // Check with the declared name.
-                
+
           Assert.assertNotNull(desc);
           Assert.assertTrue(desc.isValid());
     }
diff --git a/ipojo/tests/core/handler/src/test/java/org/apache/felix/ipojo/tests/core/Tools.java b/ipojo/tests/core/handler/src/test/java/org/apache/felix/ipojo/tests/core/Tools.java
index 65a3ef1..cdaa5bd 100644
--- a/ipojo/tests/core/handler/src/test/java/org/apache/felix/ipojo/tests/core/Tools.java
+++ b/ipojo/tests/core/handler/src/test/java/org/apache/felix/ipojo/tests/core/Tools.java
@@ -1,8 +1,8 @@
 package org.apache.felix.ipojo.tests.core;
 
 import org.apache.felix.ipojo.Factory;
-import org.apache.felix.ipojo.test.helpers.OSGiHelper;
 import org.osgi.framework.ServiceReference;
+import org.ow2.chameleon.testing.helpers.OSGiHelper;
 
 public class Tools {