FELIX-3680: invoke latches from B/C/D/E/F/G/H/I/J/K start/stop methods.

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1393476 13f79535-47bb-0310-9956-ffa450edef68
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 71dea9d..c34634a 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
@@ -146,7 +146,7 @@
              ),
              junitBundles(),
              systemProperty( "ds.factory.enabled" ).value( Boolean.toString( NONSTANDARD_COMPONENT_FACTORY_BEHAVIOR ) ),
-             systemProperty( "ds.loglevel" ).value( "warn" )
+             systemProperty( "ds.loglevel" ).value( "debug" )
 
         );
         final Option vmOption = ( paxRunnerVmOption != null ) ? CoreOptions.vmOption( paxRunnerVmOption ) : null;
diff --git a/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/B.java b/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/B.java
index d2e709f..c801c86 100644
--- a/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/B.java
+++ b/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/B.java
@@ -18,6 +18,16 @@
  */
 package org.apache.felix.scr.integration.components.felix3680;
 
+
 public class B
 {
+    void start()
+    {
+        Main._enabledLatch.countDown();
+    }
+
+    void stop()
+    {
+        Main._disabledLatch.countDown();
+    }
 }
diff --git a/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/C.java b/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/C.java
index 2e8088e..29c7015 100644
--- a/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/C.java
+++ b/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/C.java
@@ -20,4 +20,13 @@
 
 public class C
 {
+    void start()
+    {
+        Main._enabledLatch.countDown();
+    }
+
+    void stop()
+    {
+        Main._disabledLatch.countDown();
+    }
 }
diff --git a/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/D.java b/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/D.java
index 4db5704..fc2288a 100644
--- a/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/D.java
+++ b/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/D.java
@@ -20,5 +20,13 @@
 
 public class D
 {
+    void start()
+    {
+        Main._enabledLatch.countDown();
+    }
 
+    void stop()
+    {
+        Main._disabledLatch.countDown();
+    }
 }
diff --git a/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/E.java b/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/E.java
index da238b3..d51c39b 100644
--- a/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/E.java
+++ b/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/E.java
@@ -20,5 +20,13 @@
 
 public class E
 {
+    void start()
+    {
+        Main._enabledLatch.countDown();
+    }
 
+    void stop()
+    {
+        Main._disabledLatch.countDown();
+    }
 }
diff --git a/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/F.java b/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/F.java
index f6cd544..ca037f0 100644
--- a/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/F.java
+++ b/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/F.java
@@ -23,4 +23,14 @@
     void bindG(G g)
     {
     }
+
+    void start()
+    {
+        Main._enabledLatch.countDown();
+    }
+
+    void stop()
+    {
+        Main._disabledLatch.countDown();
+    }
 }
diff --git a/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/G.java b/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/G.java
index 0bb3435..850ccc5 100644
--- a/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/G.java
+++ b/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/G.java
@@ -5,4 +5,13 @@
     void bindH(H h)
     {
     }
+    void start()
+    {
+        Main._enabledLatch.countDown();
+    }
+
+    void stop()
+    {
+        Main._disabledLatch.countDown();
+    }
 }
diff --git a/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/H.java b/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/H.java
index db27d59..ea3b079 100644
--- a/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/H.java
+++ b/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/H.java
@@ -23,4 +23,13 @@
     void bindI(I i)
     {
     }
+    void start()
+    {
+        Main._enabledLatch.countDown();
+    }
+
+    void stop()
+    {
+        Main._disabledLatch.countDown();
+    }
 }
diff --git a/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/I.java b/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/I.java
index 1e0ef8b..6630b43 100644
--- a/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/I.java
+++ b/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/I.java
@@ -23,4 +23,13 @@
     void bindJ(J j)
     {
     }
+    void start()
+    {
+        Main._enabledLatch.countDown();
+    }
+
+    void stop()
+    {
+        Main._disabledLatch.countDown();
+    }
 }
diff --git a/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/J.java b/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/J.java
index 50423eb..afae8f1 100644
--- a/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/J.java
+++ b/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/J.java
@@ -23,4 +23,13 @@
     void bindK(K k)
     {
     }
+    void start()
+    {
+        Main._enabledLatch.countDown();
+    }
+
+    void stop()
+    {
+        Main._disabledLatch.countDown();
+    }
 }
diff --git a/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/K.java b/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/K.java
index 0f50354..d69008b 100644
--- a/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/K.java
+++ b/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/K.java
@@ -20,4 +20,13 @@
 
 public class K
 {
+    void start()
+    {
+        Main._enabledLatch.countDown();
+    }
+
+    void stop()
+    {
+        Main._disabledLatch.countDown();
+    }
 }
diff --git a/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/Main.java b/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/Main.java
index 1f8f1b2..303e543 100644
--- a/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/Main.java
+++ b/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/Main.java
@@ -35,10 +35,11 @@
 
 public class Main implements Runnable
 {
+    public static volatile CountDownLatch _enabledLatch;
+    public static volatile CountDownLatch _disabledLatch;
+
     private volatile ComponentContext _ctx;
     private volatile AtomicInteger _counter = new AtomicInteger();
-    private volatile CountDownLatch _enabledLatch;
-    private volatile CountDownLatch _disabledLatch;
     private volatile Random _rnd = new Random();
     private volatile LogService _logService;
     private ScrService _scr;
@@ -79,13 +80,11 @@
                         {
                             //_logService.log(LogService.LOG_INFO, "enabling component " + _componentNames[i]);
                             _ctx.enableComponent(_componentNames[i]);
-                            _enabledLatch.countDown();
                         }
                         else
                         {
                             //_logService.log(LogService.LOG_INFO, "disabling component " + _componentNames[i]);
                             _ctx.disableComponent(_componentNames[i]);
-                            _disabledLatch.countDown();
                         }
                     }
                 });
@@ -170,9 +169,8 @@
         int loop = 0;
         while (_running)
         {
-            _logService.log(LogService.LOG_WARNING, "Performed " + loop + " tests.");            
-            _enabledLatch = new CountDownLatch(11); // 10 to make sure all enable tasks are executed + 1 to make sure Main.bindA has been called
-            _disabledLatch = new CountDownLatch(11); // 10 to make sure all disable tasks are executed + 1 to make sure Main.unbindA has been called
+            _enabledLatch = new CountDownLatch(11); // for B,C,D,E,F,G,H,I,J,K and Main.bindA()
+            _disabledLatch = new CountDownLatch(11); // for B,C,D,E,F,G,H,I,J,K and Main.unbindA()
 
             EnableManager manager =
                     new EnableManager(new String[] { "B", "C", "D", "E", "F", "G", "H", "I", "J", "K" });
@@ -206,6 +204,8 @@
             catch (InterruptedException e)
             {
             }
+            
+            _logService.log(LogService.LOG_WARNING, "******* Performed " + (++loop) + " tests.");            
         }
     }
 
diff --git a/scr/src/test/resources/integration_test_FELIX_3680.xml b/scr/src/test/resources/integration_test_FELIX_3680.xml
index aeb743d..da8cb0f 100644
--- a/scr/src/test/resources/integration_test_FELIX_3680.xml
+++ b/scr/src/test/resources/integration_test_FELIX_3680.xml
@@ -11,7 +11,7 @@
 	language governing permissions and limitations under the License. -->
 <components xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0">
 	<scr:component xmlns:scr='http://www.osgi.org/xmlns/scr/v1.1.0'
-		name='A' activate='start' enabled='false'>
+		name='A' activate='start'>
 		<implementation
 			class='org.apache.felix.scr.integration.components.felix3680.A' />
 		<service>
@@ -34,8 +34,8 @@
 			bind='bindF' />
 	</scr:component>
 
-	<scr:component xmlns:scr='http://www.osgi.org/xmlns/scr/v1.0.0'
-		name='B' enabled='false'>
+	<scr:component xmlns:scr='http://www.osgi.org/xmlns/scr/v1.1.0'
+		name='B' enabled='false' activate='start' deactivate='stop'>
 		<implementation
 			class='org.apache.felix.scr.integration.components.felix3680.B' />
 		<service>
@@ -43,8 +43,8 @@
 		</service>
 	</scr:component>
 
-	<scr:component xmlns:scr='http://www.osgi.org/xmlns/scr/v1.0.0'
-		name='C' enabled='false'>
+	<scr:component xmlns:scr='http://www.osgi.org/xmlns/scr/v1.1.0'
+		name='C' enabled='false' activate='start' deactivate='stop'>
 		<implementation
 			class='org.apache.felix.scr.integration.components.felix3680.C' />
 		<service>
@@ -52,8 +52,8 @@
 		</service>
 	</scr:component>
 
-	<scr:component xmlns:scr='http://www.osgi.org/xmlns/scr/v1.0.0'
-		name='D' enabled='false'>
+	<scr:component xmlns:scr='http://www.osgi.org/xmlns/scr/v1.1.0'
+		name='D' enabled='false' activate='start' deactivate='stop'>
 		<implementation
 			class='org.apache.felix.scr.integration.components.felix3680.D' />
 		<service>
@@ -61,8 +61,8 @@
 		</service>
 	</scr:component>
 
-	<scr:component xmlns:scr='http://www.osgi.org/xmlns/scr/v1.0.0'
-		name='E' enabled='false'>
+	<scr:component xmlns:scr='http://www.osgi.org/xmlns/scr/v1.1.0'
+		name='E' enabled='false' activate='start' deactivate='stop'>
 		<implementation
 			class='org.apache.felix.scr.integration.components.felix3680.E' />
 		<service>
@@ -71,7 +71,7 @@
 	</scr:component>
 
 	<scr:component xmlns:scr='http://www.osgi.org/xmlns/scr/v1.1.0'
-		name='F' enabled='false'>
+		name='F' enabled='false' activate='start' deactivate='stop'>
 		<implementation
 			class='org.apache.felix.scr.integration.components.felix3680.F' />
 		<service>
@@ -83,7 +83,7 @@
 	</scr:component>
 
 	<scr:component xmlns:scr='http://www.osgi.org/xmlns/scr/v1.1.0'
-		name='G' enabled='false'>
+		name='G' enabled='false' activate='start' deactivate='stop'>
 		<implementation
 			class='org.apache.felix.scr.integration.components.felix3680.G' />
 		<service>
@@ -95,7 +95,7 @@
 	</scr:component>
 
 	<scr:component xmlns:scr='http://www.osgi.org/xmlns/scr/v1.1.0'
-		name='H' enabled='false'>
+		name='H' enabled='false' activate='start' deactivate='stop'>
 		<implementation
 			class='org.apache.felix.scr.integration.components.felix3680.H' />
 		<service>
@@ -107,7 +107,7 @@
 	</scr:component>
 
 	<scr:component xmlns:scr='http://www.osgi.org/xmlns/scr/v1.1.0'
-		name='I' enabled='false'>
+		name='I' enabled='false' activate='start' deactivate='stop'>
 		<implementation
 			class='org.apache.felix.scr.integration.components.felix3680.I' />
 		<service>
@@ -119,7 +119,7 @@
 	</scr:component>
 
 	<scr:component xmlns:scr='http://www.osgi.org/xmlns/scr/v1.1.0'
-		name='J' enabled='false'>
+		name='J' enabled='false' activate='start' deactivate='stop'>
 		<implementation
 			class='org.apache.felix.scr.integration.components.felix3680.J' />
 		<service>
@@ -130,8 +130,8 @@
 			bind='bindK' />
 	</scr:component>
 
-	<scr:component xmlns:scr='http://www.osgi.org/xmlns/scr/v1.0.0'
-		name='K' enabled='false'>
+	<scr:component xmlns:scr='http://www.osgi.org/xmlns/scr/v1.1.0'
+		name='K' enabled='false' activate='start' deactivate='stop'>
 		<implementation
 			class='org.apache.felix.scr.integration.components.felix3680.K' />
 		<service>