felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pde...@apache.org
Subject svn commit: r1393476 - in /felix/trunk/scr/src/test: java/org/apache/felix/scr/integration/ java/org/apache/felix/scr/integration/components/felix3680/ resources/
Date Wed, 03 Oct 2012 13:32:00 GMT
Author: pderop
Date: Wed Oct  3 13:31:59 2012
New Revision: 1393476

URL: http://svn.apache.org/viewvc?rev=1393476&view=rev
Log:
FELIX-3680: invoke latches from B/C/D/E/F/G/H/I/J/K start/stop methods.

Modified:
    felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/ComponentTestBase.java
    felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/B.java
    felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/C.java
    felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/D.java
    felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/E.java
    felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/F.java
    felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/G.java
    felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/H.java
    felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/I.java
    felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/J.java
    felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/K.java
    felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/Main.java
    felix/trunk/scr/src/test/resources/integration_test_FELIX_3680.xml

Modified: felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/ComponentTestBase.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/ComponentTestBase.java?rev=1393476&r1=1393475&r2=1393476&view=diff
==============================================================================
--- felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/ComponentTestBase.java
(original)
+++ felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/ComponentTestBase.java
Wed Oct  3 13:31:59 2012
@@ -146,7 +146,7 @@ public abstract class ComponentTestBase
              ),
              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;

Modified: felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/B.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/B.java?rev=1393476&r1=1393475&r2=1393476&view=diff
==============================================================================
--- felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/B.java
(original)
+++ felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/B.java
Wed Oct  3 13:31:59 2012
@@ -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();
+    }
 }

Modified: felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/C.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/C.java?rev=1393476&r1=1393475&r2=1393476&view=diff
==============================================================================
--- felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/C.java
(original)
+++ felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/C.java
Wed Oct  3 13:31:59 2012
@@ -20,4 +20,13 @@ package org.apache.felix.scr.integration
 
 public class C
 {
+    void start()
+    {
+        Main._enabledLatch.countDown();
+    }
+
+    void stop()
+    {
+        Main._disabledLatch.countDown();
+    }
 }

Modified: felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/D.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/D.java?rev=1393476&r1=1393475&r2=1393476&view=diff
==============================================================================
--- felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/D.java
(original)
+++ felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/D.java
Wed Oct  3 13:31:59 2012
@@ -20,5 +20,13 @@ package org.apache.felix.scr.integration
 
 public class D
 {
+    void start()
+    {
+        Main._enabledLatch.countDown();
+    }
 
+    void stop()
+    {
+        Main._disabledLatch.countDown();
+    }
 }

Modified: felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/E.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/E.java?rev=1393476&r1=1393475&r2=1393476&view=diff
==============================================================================
--- felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/E.java
(original)
+++ felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/E.java
Wed Oct  3 13:31:59 2012
@@ -20,5 +20,13 @@ package org.apache.felix.scr.integration
 
 public class E
 {
+    void start()
+    {
+        Main._enabledLatch.countDown();
+    }
 
+    void stop()
+    {
+        Main._disabledLatch.countDown();
+    }
 }

Modified: felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/F.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/F.java?rev=1393476&r1=1393475&r2=1393476&view=diff
==============================================================================
--- felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/F.java
(original)
+++ felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/F.java
Wed Oct  3 13:31:59 2012
@@ -23,4 +23,14 @@ public class F
     void bindG(G g)
     {
     }
+
+    void start()
+    {
+        Main._enabledLatch.countDown();
+    }
+
+    void stop()
+    {
+        Main._disabledLatch.countDown();
+    }
 }

Modified: felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/G.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/G.java?rev=1393476&r1=1393475&r2=1393476&view=diff
==============================================================================
--- felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/G.java
(original)
+++ felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/G.java
Wed Oct  3 13:31:59 2012
@@ -5,4 +5,13 @@ public class G
     void bindH(H h)
     {
     }
+    void start()
+    {
+        Main._enabledLatch.countDown();
+    }
+
+    void stop()
+    {
+        Main._disabledLatch.countDown();
+    }
 }

Modified: felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/H.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/H.java?rev=1393476&r1=1393475&r2=1393476&view=diff
==============================================================================
--- felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/H.java
(original)
+++ felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/H.java
Wed Oct  3 13:31:59 2012
@@ -23,4 +23,13 @@ public class H
     void bindI(I i)
     {
     }
+    void start()
+    {
+        Main._enabledLatch.countDown();
+    }
+
+    void stop()
+    {
+        Main._disabledLatch.countDown();
+    }
 }

Modified: felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/I.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/I.java?rev=1393476&r1=1393475&r2=1393476&view=diff
==============================================================================
--- felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/I.java
(original)
+++ felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/I.java
Wed Oct  3 13:31:59 2012
@@ -23,4 +23,13 @@ public class I
     void bindJ(J j)
     {
     }
+    void start()
+    {
+        Main._enabledLatch.countDown();
+    }
+
+    void stop()
+    {
+        Main._disabledLatch.countDown();
+    }
 }

Modified: felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/J.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/J.java?rev=1393476&r1=1393475&r2=1393476&view=diff
==============================================================================
--- felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/J.java
(original)
+++ felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/J.java
Wed Oct  3 13:31:59 2012
@@ -23,4 +23,13 @@ public class J
     void bindK(K k)
     {
     }
+    void start()
+    {
+        Main._enabledLatch.countDown();
+    }
+
+    void stop()
+    {
+        Main._disabledLatch.countDown();
+    }
 }

Modified: felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/K.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/K.java?rev=1393476&r1=1393475&r2=1393476&view=diff
==============================================================================
--- felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/K.java
(original)
+++ felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/K.java
Wed Oct  3 13:31:59 2012
@@ -20,4 +20,13 @@ package org.apache.felix.scr.integration
 
 public class K
 {
+    void start()
+    {
+        Main._enabledLatch.countDown();
+    }
+
+    void stop()
+    {
+        Main._disabledLatch.countDown();
+    }
 }

Modified: felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/Main.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/Main.java?rev=1393476&r1=1393475&r2=1393476&view=diff
==============================================================================
--- felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/Main.java
(original)
+++ felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/Main.java
Wed Oct  3 13:31:59 2012
@@ -35,10 +35,11 @@ import org.osgi.service.log.LogService;
 
 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 @@ public class Main implements Runnable
                         {
                             //_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 @@ public class Main implements Runnable
         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 @@ public class Main implements Runnable
             catch (InterruptedException e)
             {
             }
+            
+            _logService.log(LogService.LOG_WARNING, "******* Performed " + (++loop) + " tests.");
           
         }
     }
 

Modified: felix/trunk/scr/src/test/resources/integration_test_FELIX_3680.xml
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/test/resources/integration_test_FELIX_3680.xml?rev=1393476&r1=1393475&r2=1393476&view=diff
==============================================================================
--- felix/trunk/scr/src/test/resources/integration_test_FELIX_3680.xml (original)
+++ felix/trunk/scr/src/test/resources/integration_test_FELIX_3680.xml Wed Oct  3 13:31:59
2012
@@ -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>



Mime
View raw message