FELIX-3680 use enable/disable counting in test, use restricted logging

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1402237 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/scr/src/test/java/org/apache/felix/scr/integration/Felix3680Test.java b/scr/src/test/java/org/apache/felix/scr/integration/Felix3680Test.java
index 73e071a..1834918 100644
--- a/scr/src/test/java/org/apache/felix/scr/integration/Felix3680Test.java
+++ b/scr/src/test/java/org/apache/felix/scr/integration/Felix3680Test.java
@@ -41,8 +41,9 @@
         // uncomment to enable debugging of this test class
         //        paxRunnerVmOption = DEBUG_VM_OPTION;
         descriptorFile = "/integration_test_FELIX_3680.xml";
+        restrictedLogging = true;
         //comment to get debug logging if the test fails.
-        DS_LOGLEVEL = "warn";
+//        DS_LOGLEVEL = "warn";
     }
 
     @Inject
diff --git a/scr/src/test/java/org/apache/felix/scr/integration/Felix3680_2Test.java b/scr/src/test/java/org/apache/felix/scr/integration/Felix3680_2Test.java
index 4ff99f9..b3ca444 100644
--- a/scr/src/test/java/org/apache/felix/scr/integration/Felix3680_2Test.java
+++ b/scr/src/test/java/org/apache/felix/scr/integration/Felix3680_2Test.java
@@ -43,7 +43,7 @@
         
         restrictedLogging = true;
         // Comment this for displaying debug messages
-        DS_LOGLEVEL = "warn";
+//        DS_LOGLEVEL = "warn";
     }
 
     @Inject
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 c801c86..890501f 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
@@ -23,11 +23,9 @@
 {
     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 29c7015..6a61cea 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
@@ -22,11 +22,9 @@
 {
     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 fc2288a..6c28045 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
@@ -22,11 +22,9 @@
 {
     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 d51c39b..93e557c 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
@@ -22,11 +22,9 @@
 {
     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 ca037f0..fb93720 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
@@ -26,11 +26,9 @@
 
     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 e9e83aa..712031d 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
@@ -26,11 +26,9 @@
 
     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 ea3b079..a9b8d52 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,13 +23,12 @@
     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 6630b43..50d43b9 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,13 +23,12 @@
     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 afae8f1..9cc1379 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,13 +23,12 @@
     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 d69008b..4d4eff1 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
@@ -22,11 +22,9 @@
 {
     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 b13657f..085c6b1 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
@@ -39,6 +39,9 @@
     public static volatile CountDownLatch _enabledLatch;
     public static volatile CountDownLatch _disabledLatch;
 
+    public static volatile CountDownLatch _activatedLatch;
+    public static volatile CountDownLatch _deactivatedLatch;
+
     private volatile ComponentContext _ctx;
     private volatile AtomicInteger _counter = new AtomicInteger();
     private volatile Random _rnd = new Random();
@@ -79,13 +82,15 @@
                     {
                         if (enable)
                         {
-                            //_logService.log(LogService.LOG_INFO, "enabling component " + _componentNames[i]);
+                            _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]);
+                            _logService.log(LogService.LOG_INFO, "disabling component " + _componentNames[i]);
                             _ctx.disableComponent(_componentNames[i]);
+                            _disabledLatch.countDown();
                         }
                     }
                 });
@@ -172,7 +177,6 @@
         {
             _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[] { 
                         "org.apache.felix.scr.integration.components.felix3680.B", 
diff --git a/scr/src/test/resources/integration_test_FELIX_3680.xml b/scr/src/test/resources/integration_test_FELIX_3680.xml
index d0642cf..5de486c 100644
--- a/scr/src/test/resources/integration_test_FELIX_3680.xml
+++ b/scr/src/test/resources/integration_test_FELIX_3680.xml
@@ -141,7 +141,7 @@
 
 	<scr:component xmlns:scr='http://www.osgi.org/xmlns/scr/v1.1.0'
 		name='org.apache.felix.scr.integration.components.felix3680.Main'
-		activate='start' deactivate='stop'>
+		activate='start' deactivate='stop' enabled="false">
 		<implementation
 			class='org.apache.felix.scr.integration.components.felix3680.Main' />
 		<reference name='a'