felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1779162 - in /felix/trunk/osgi-r7/scr: ./ src/test/java/org/apache/felix/scr/integration/ src/test/resources/
Date Tue, 17 Jan 2017 10:35:40 GMT
Author: cziegeler
Date: Tue Jan 17 10:35:40 2017
New Revision: 1779162

URL: http://svn.apache.org/viewvc?rev=1779162&view=rev
Log:
Update field activation test

Modified:
    felix/trunk/osgi-r7/scr/pom.xml
    felix/trunk/osgi-r7/scr/src/test/java/org/apache/felix/scr/integration/ComponentFieldActivationTest.java
    felix/trunk/osgi-r7/scr/src/test/java/org/apache/felix/scr/integration/ExtenderTest.java
    felix/trunk/osgi-r7/scr/src/test/resources/integration_test_field_activation_components.xml

Modified: felix/trunk/osgi-r7/scr/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/scr/pom.xml?rev=1779162&r1=1779161&r2=1779162&view=diff
==============================================================================
--- felix/trunk/osgi-r7/scr/pom.xml (original)
+++ felix/trunk/osgi-r7/scr/pom.xml Tue Jan 17 10:35:40 2017
@@ -119,7 +119,7 @@
         <dependency>
             <groupId>org.apache.felix</groupId>
             <artifactId>org.apache.felix.utils</artifactId>
-            <version>1.8.5-SNAPSHOT</version>
+            <version>1.8.6</version>
             <scope>provided</scope>
         </dependency>
         <dependency>

Modified: felix/trunk/osgi-r7/scr/src/test/java/org/apache/felix/scr/integration/ComponentFieldActivationTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/scr/src/test/java/org/apache/felix/scr/integration/ComponentFieldActivationTest.java?rev=1779162&r1=1779161&r2=1779162&view=diff
==============================================================================
--- felix/trunk/osgi-r7/scr/src/test/java/org/apache/felix/scr/integration/ComponentFieldActivationTest.java
(original)
+++ felix/trunk/osgi-r7/scr/src/test/java/org/apache/felix/scr/integration/ComponentFieldActivationTest.java
Tue Jan 17 10:35:40 2017
@@ -19,8 +19,11 @@
 package org.apache.felix.scr.integration;
 
 
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
 
+import java.util.Arrays;
 import java.util.Collection;
 
 import org.apache.felix.scr.integration.components.FieldActivatorComponent;
@@ -55,6 +58,11 @@ public class ComponentFieldActivationTes
         final String componentname = "FieldActivatorComponent.satisfied";
 
         ComponentConfigurationDTO cc = getDisabledConfigurationAndEnable(componentname, ComponentConfigurationDTO.SATISFIED);
+        assertEquals(4, cc.description.activationFields.length);
+        assertTrue(Arrays.asList(cc.description.activationFields).contains("bundle"));
+        assertTrue(Arrays.asList(cc.description.activationFields).contains("context"));
+        assertTrue(Arrays.asList(cc.description.activationFields).contains("config"));
+        assertTrue(Arrays.asList(cc.description.activationFields).contains("annotation"));
 
         FieldActivatorComponent cmp = this.getServiceFromConfiguration(cc, FieldActivatorComponent.class);
 
@@ -87,6 +95,8 @@ public class ComponentFieldActivationTes
         final String componentname = "FieldActivatorComponent.unsatisfied";
 
         ComponentConfigurationDTO cc = getDisabledConfigurationAndEnable(componentname, ComponentConfigurationDTO.SATISFIED);
+        assertEquals(1, cc.description.activationFields.length);
+        assertTrue(Arrays.asList(cc.description.activationFields).contains("foo"));
 
         this.failGetServiceFromConfiguration(cc, FieldActivatorComponent.class);
 
@@ -99,9 +109,24 @@ public class ComponentFieldActivationTes
         final String componentname = "FieldActivatorComponent.partiallysatisfied";
 
         ComponentConfigurationDTO cc = getDisabledConfigurationAndEnable(componentname, ComponentConfigurationDTO.SATISFIED);
+        assertEquals(3, cc.description.activationFields.length);
+        assertTrue(Arrays.asList(cc.description.activationFields).contains("bundle"));
+        assertTrue(Arrays.asList(cc.description.activationFields).contains("context"));
+        assertTrue(Arrays.asList(cc.description.activationFields).contains("foo"));
 
         this.failGetServiceFromConfiguration(cc, FieldActivatorComponent.class);
 
         disableAndCheck( cc );
     }
+
+    @Test
+    public void test_field_activator_dto_nofields() throws Exception
+    {
+        final String componentname = "FieldActivatorComponent.nofields";
+
+        ComponentConfigurationDTO cc = getDisabledConfigurationAndEnable(componentname, ComponentConfigurationDTO.SATISFIED);
+        assertEquals(0, cc.description.activationFields.length);
+
+        disableAndCheck( cc );
+    }
 }

Modified: felix/trunk/osgi-r7/scr/src/test/java/org/apache/felix/scr/integration/ExtenderTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/scr/src/test/java/org/apache/felix/scr/integration/ExtenderTest.java?rev=1779162&r1=1779161&r2=1779162&view=diff
==============================================================================
--- felix/trunk/osgi-r7/scr/src/test/java/org/apache/felix/scr/integration/ExtenderTest.java
(original)
+++ felix/trunk/osgi-r7/scr/src/test/java/org/apache/felix/scr/integration/ExtenderTest.java
Tue Jan 17 10:35:40 2017
@@ -42,22 +42,19 @@ public class ExtenderTest extends Compon
     @Test
     public void testWired() throws BundleException
     {
-        if (isAtLeastR5())
+        BundleWiring scrWiring = bundle.adapt(BundleWiring.class);
+        List<BundleWire> extenderWires = scrWiring.getRequiredWires(ExtenderNamespace.EXTENDER_NAMESPACE);
+        boolean wired = false;
+        for (BundleWire wire: extenderWires)
         {
-            BundleWiring scrWiring = bundle.adapt(BundleWiring.class);
-            List<BundleWire> extenderWires = scrWiring.getRequiredWires(ExtenderNamespace.EXTENDER_NAMESPACE);
-            boolean wired = false;
-            for (BundleWire wire: extenderWires)
+            if (ComponentConstants.COMPONENT_CAPABILITY_NAME.equals(wire.getCapability().getAttributes().get(ExtenderNamespace.EXTENDER_NAMESPACE)))
             {
-                if (ComponentConstants.COMPONENT_CAPABILITY_NAME.equals(wire.getCapability().getAttributes().get(ExtenderNamespace.EXTENDER_NAMESPACE)))
-                {
-                    Assert.assertEquals("Not wired to us", "org.apache.felix.scr", wire.getProviderWiring().getBundle().getSymbolicName());
-                    wired = true;
-                    break;
-                }
+                Assert.assertEquals("Not wired to us", "org.apache.felix.scr", wire.getProviderWiring().getBundle().getSymbolicName());
+                wired = true;
+                break;
             }
-            Assert.assertTrue("should be wired to us", wired);
         }
+        Assert.assertTrue("should be wired to us", wired);
     }
 
 }

Modified: felix/trunk/osgi-r7/scr/src/test/resources/integration_test_field_activation_components.xml
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/scr/src/test/resources/integration_test_field_activation_components.xml?rev=1779162&r1=1779161&r2=1779162&view=diff
==============================================================================
--- felix/trunk/osgi-r7/scr/src/test/resources/integration_test_field_activation_components.xml
(original)
+++ felix/trunk/osgi-r7/scr/src/test/resources/integration_test_field_activation_components.xml
Tue Jan 17 10:35:40 2017
@@ -48,4 +48,11 @@
         </service>
     </scr:component>
 
+    <!-- Some exist, no field -->
+    <scr:component name="FieldActivatorComponent.nofields" enabled="false">
+        <implementation class="org.apache.felix.scr.integration.components.FieldActivatorComponent"
/>
+        <service factory="false">
+            <provide interface="org.apache.felix.scr.integration.components.FieldActivatorComponent"/>
+        </service>
+    </scr:component>
 </components>



Mime
View raw message