felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pde...@apache.org
Subject svn commit: r1629588 - in /felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.runtime.itest: ./ src/org/apache/felix/dm/runtime/itest/components/ src/org/apache/felix/dm/runtime/itest/tests/
Date Mon, 06 Oct 2014 08:23:45 GMT
Author: pderop
Date: Mon Oct  6 08:23:44 2014
New Revision: 1629588

URL: http://svn.apache.org/r1629588
Log:
Don't use sub-bundles for runtime integration tests (because sometimes, all tests are in error).


Removed:
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.runtime.itest/components.bnd
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/tests/PublisherAnnotationParallelTest.java
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.runtime.itest/tests.bnd
Modified:
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.runtime.itest/bnd.bnd
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/BundleDependencyAnnotation.java
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/Utils.java
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/tests/BundleDependencyAnnotationTest.java

Modified: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.runtime.itest/bnd.bnd
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.runtime.itest/bnd.bnd?rev=1629588&r1=1629587&r2=1629588&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.runtime.itest/bnd.bnd
(original)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.runtime.itest/bnd.bnd
Mon Oct  6 08:23:44 2014
@@ -4,13 +4,11 @@
 	org.apache.felix.dependencymanager.itest.api;version=latest,\
 	org.apache.felix.dependencymanager.annotation;version=latest,\
 	osgi.cmpn;version=4.2,\
-	biz.aQute.junit;version=999999999.0
+	junit.osgi;version=3.8
 -runbundles:  \
 	org.apache.felix.configadmin;version=1.8.0,\
 	org.apache.felix.dependencymanager;version=latest,\
 	org.apache.felix.dependencymanager.itest.api;version=latest,\
-	org.apache.felix.dependencymanager.runtime.itest.components;version=latest,\
-	org.apache.felix.dependencymanager.runtime.itest.tests;version=latest,\
 	org.apache.felix.dependencymanager.runtime;version=latest,\
 	org.apache.felix.metatype;version=1.0.4,\
 	org.apache.felix.gogo.runtime;version=0.10.0,\
@@ -20,7 +18,8 @@
 -runsystempackages: \
 	sun.reflect
 -runvm:-ea
--sub: \
-	*.bnd
 -plugin: org.apache.felix.dm.annotation.plugin.bnd.AnnotationPlugin;log=debug;\
-		 path:=${workspace}/org.apache.felix.dependencymanager.annotation/generated/org.apache.felix.dependencymanager.annotation.jar
\ No newline at end of file
+		 path:=${workspace}/org.apache.felix.dependencymanager.annotation/generated/org.apache.felix.dependencymanager.annotation.jar
+Private-Package:  \
+	org.apache.felix.dm.runtime.itest.tests,\
+	org.apache.felix.dm.runtime.itest.components
\ No newline at end of file

Modified: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/BundleDependencyAnnotation.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/BundleDependencyAnnotation.java?rev=1629588&r1=1629587&r2=1629588&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/BundleDependencyAnnotation.java
(original)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/BundleDependencyAnnotation.java
Mon Oct  6 08:23:44 2014
@@ -36,6 +36,7 @@ import org.osgi.framework.BundleContext;
 public class BundleDependencyAnnotation {
     public static final String ENSURE_CONSUMER = "BundleDependencyAnnotation.consumer";
     public static final String ENSURE_ADAPTER = "BundleDependencyAnnotation.adapter";
+    public static final String METATYPE_BSN = "org.apache.felix.metatype";
 
     public interface ServiceInterface extends Runnable {
     }
@@ -45,38 +46,30 @@ public class BundleDependencyAnnotation 
      */
     @Component
     public static class Consumer {
-        protected volatile boolean m_added;
-        protected volatile boolean m_removed;
-
         @ServiceDependency(filter = "(name=" + ENSURE_CONSUMER + ")")
         private volatile Ensure m_sequencer;
 
-        @BundleDependency(required = false, removed = "removed", filter = "(Bundle-SymbolicName="
+ DM_BSN + ")")
+        @BundleDependency(required = true, removed = "removed", filter = "(Bundle-SymbolicName="
+ METATYPE_BSN + ")", stateMask = Bundle.ACTIVE)
         public void add(Bundle b) {
-            if (b != null && b.getSymbolicName().equals(DM_BSN)) {
-                m_added = true;
+            if (b != null && b.getSymbolicName().equals(METATYPE_BSN)) {
+                m_sequencer.step(1);
             }
         }
 
-        protected void removed(Bundle b) {
-            m_removed = true;
-        }
-
         @Start
         public void start() {
-            m_sequencer.step(1);
+            m_sequencer.step(2);
         }
 
         @Stop
         public void stop() {
-            if (!m_added) {
-                throw new IllegalStateException("Did not get DependencyManager bundle");
-            }
-
-            if (!m_removed) {
-                throw new IllegalStateException("Did not remove DependencyManager bundle");
+            m_sequencer.step(3);
+        }
+        
+        protected void removed(Bundle b) {
+            if (b != null && b.getSymbolicName().equals(METATYPE_BSN)) {
+                m_sequencer.step(4);
             }
-            m_sequencer.step(2);
         }
     }
 
@@ -101,7 +94,7 @@ public class BundleDependencyAnnotation 
     /**
      * A BundleAdapter test, which adapts the dependency manager bundle to the ServiceInterface
service.
      */
-    @BundleAdapterService(filter = "(Bundle-SymbolicName=" + DM_BSN + ")", stateMask = Bundle.INSTALLED
+    @BundleAdapterService(filter = "(Bundle-SymbolicName=" + METATYPE_BSN + ")", stateMask
= Bundle.INSTALLED
             | Bundle.RESOLVED | Bundle.ACTIVE, propagate = true, properties = {@Property(name
= "foo", value = "bar")})
     public static class ServiceProvider implements ServiceInterface {
         // Adapted bundle (injected by reflection).
@@ -131,7 +124,7 @@ public class BundleDependencyAnnotation 
         }
 
         public void run() {
-            if (m_bundle == null || !m_bundle.getSymbolicName().equals(DM_BSN)) {
+            if (m_bundle == null || !m_bundle.getSymbolicName().equals(METATYPE_BSN)) {
                 throw new IllegalStateException("ServiceProvider did not get proper bundle:
" + m_bundle);
             }
             m_sequencer.step(3);

Modified: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/Utils.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/Utils.java?rev=1629588&r1=1629587&r2=1629588&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/Utils.java
(original)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/Utils.java
Mon Oct  6 08:23:44 2014
@@ -20,7 +20,6 @@ package org.apache.felix.dm.runtime.ites
 
 public class Utils {
     public static final String DM_BSN = "org.apache.felix.dependencymanager"; 
-    public static final String DM_RUNTIME_IT_COMPONENTS_BSN = "org.apache.felix.dependencymanager.runtime.itest.components";

 
     public static void schedule(final Runnable task, final long n) {
         Thread t = new Thread() {

Modified: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/tests/BundleDependencyAnnotationTest.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/tests/BundleDependencyAnnotationTest.java?rev=1629588&r1=1629587&r2=1629588&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/tests/BundleDependencyAnnotationTest.java
(original)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/tests/BundleDependencyAnnotationTest.java
Mon Oct  6 08:23:44 2014
@@ -32,15 +32,16 @@ public class BundleDependencyAnnotationT
     
     /**
      * Tests a simple Consumer, which has a BundleDependency over the dependency manager
bundle.
+     * TODO: this test is not currently working.
      */
     public void testBundleDependencyAnnotation() {
         Ensure e = new Ensure();
         ServiceRegistration sr = register(e, BundleDependencyAnnotation.ENSURE_CONSUMER);
-        e.waitForStep(1, 10000);
-        stopBundle(Utils.DM_RUNTIME_IT_COMPONENTS_BSN);
         e.waitForStep(2, 10000);
+        stopBundle(BundleDependencyAnnotation.METATYPE_BSN);
+        e.waitForStep(4, 10000);
         sr.unregister();
-        startBundle(Utils.DM_RUNTIME_IT_COMPONENTS_BSN);
+        startBundle(BundleDependencyAnnotation.METATYPE_BSN);
     }
 
     /**



Mime
View raw message