felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clem...@apache.org
Subject svn commit: r960227 - in /felix/trunk/ipojo: annotations/src/main/java/org/apache/felix/ipojo/annotations/ core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/ te...
Date Sat, 03 Jul 2010 15:13:58 GMT
Author: clement
Date: Sat Jul  3 15:13:57 2010
New Revision: 960227

URL: http://svn.apache.org/viewvc?rev=960227&view=rev
Log:
Fix FELIX-2461
Add a specification attribute to the @ServiceController
Modify the PRovidedServiceHandler to support this attribute
Parse this attribute in the manipulator
Add the test cases 

Added:
    felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/PSServiceControllerSpec.java
Modified:
    felix/trunk/ipojo/annotations/src/main/java/org/apache/felix/ipojo/annotations/ServiceController.java
    felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedService.java
    felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceDescription.java
    felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceHandler.java
    felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/FieldCollector.java
    felix/trunk/ipojo/tests/core/annotations/pom.xml
    felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/ServiceProdiving.java
    felix/trunk/ipojo/tests/core/service-providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/ServiceControllerTest.java
    felix/trunk/ipojo/tests/core/service-providing/src/main/resources/metadata.xml

Modified: felix/trunk/ipojo/annotations/src/main/java/org/apache/felix/ipojo/annotations/ServiceController.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/annotations/src/main/java/org/apache/felix/ipojo/annotations/ServiceController.java?rev=960227&r1=960226&r2=960227&view=diff
==============================================================================
--- felix/trunk/ipojo/annotations/src/main/java/org/apache/felix/ipojo/annotations/ServiceController.java
(original)
+++ felix/trunk/ipojo/annotations/src/main/java/org/apache/felix/ipojo/annotations/ServiceController.java
Sat Jul  3 15:13:57 2010
@@ -32,5 +32,12 @@ public @interface ServiceController {
      * Sets the initial value of the controller.
      */
     boolean value() default true;
+    
+    
+    /**
+     * Sets the targeted specification.
+     * If not set, target all specifications.
+     */
+    Class specification() default Object.class;
 
 }

Modified: felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedService.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedService.java?rev=960227&r1=960226&r2=960227&view=diff
==============================================================================
--- felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedService.java
(original)
+++ felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedService.java
Sat Jul  3 15:13:57 2010
@@ -21,6 +21,7 @@ package org.apache.felix.ipojo.handlers.
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Method;
 import java.lang.reflect.Proxy;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Dictionary;
@@ -117,7 +118,7 @@ public class ProvidedService implements 
     /**
      * Service Controller.
      */
-    private ServiceController m_controller;
+    private Map /*<Specification, ServiceController>*/ m_controllers = new HashMap/*<Specification,
ServiceController>*/();
 
     /**
      * Post-Registration callback.
@@ -327,16 +328,21 @@ public class ProvidedService implements 
      * This method also notifies the creation strategy of the publication.
      */
     protected synchronized void registerService() {
+        // Unregister if registered
+        if (m_serviceRegistration != null) {
+            unregisterService();
+        }
+        
         if (m_handler.getInstanceManager().getState() == ComponentInstance.VALID
-                && m_serviceRegistration == null  && (m_controller == null
|| m_controller.getValue())) {
+                && m_serviceRegistration == null  && isAtLeastAServiceControllerValid())
{
             // Build the service properties list
 
             BundleContext bc = m_handler.getInstanceManager().getContext();
             // Security check
             if (SecurityHelper.hasPermissionToRegisterServices(m_serviceSpecifications, bc))
{
                 Properties serviceProperties = getServiceProperties();
-                m_strategy.onPublication(getInstanceManager(), m_serviceSpecifications, serviceProperties);
-                m_serviceRegistration = bc.registerService(m_serviceSpecifications, this,
serviceProperties);
+                m_strategy.onPublication(getInstanceManager(), getServiceSpecificationsToRegister(),
serviceProperties);
+                m_serviceRegistration = bc.registerService(getServiceSpecificationsToRegister(),
this, serviceProperties);
                 // An update may happen during the registration, re-check and apply.
                 if (m_wasUpdated) {
                     m_serviceRegistration.setProperties(getServiceProperties());
@@ -366,7 +372,7 @@ public class ProvidedService implements 
     protected synchronized void unregisterService() {
     	// Create a copy of the service reference in the case we need
     	// to inject it to the post-unregistration callback.
-
+        
     	ServiceReference ref = null;
         if (m_serviceRegistration != null) {
     		ref = m_serviceRegistration.getReference();
@@ -497,13 +503,87 @@ public class ProvidedService implements 
      * Sets the service controller on this provided service.
      * @param field the field attached to this controller
      * @param value the value the initial value
+     * @param specification the target specification, if <code>null</code>
+     * affect all specifications.
      */
-    public void setController(String field, boolean value) {
-        m_controller = new ServiceController(field, value);
+    public void setController(String field, boolean value, String specification) {
+        if (specification == null) {
+            m_controllers.put("ALL", new ServiceController(field, value));
+        } else {
+            m_controllers.put(specification, new ServiceController(field, value));
+
+        }
     }
 
-    public ServiceController getController() {
-        return m_controller;
+    public ServiceController getController(String field) {
+        Collection controllers = m_controllers.values();
+        Iterator iterator = controllers.iterator();
+        while (iterator.hasNext()) {
+            ServiceController controller = (ServiceController) iterator.next();
+            if (field.equals(controller.m_field)) {
+                return controller;
+            }
+        }
+        return null;
+    }
+    
+    public ServiceController getControllerBySpecification(String spec) {
+        return (ServiceController) m_controllers.get(spec);
+    }
+    
+    /**
+     * Checks if at least one service controller is valid.
+     * @return <code>true</code> if one service controller at least
+     * is valid.
+     */
+    private boolean isAtLeastAServiceControllerValid() {
+        Collection controllers = m_controllers.values();
+        
+        // No controller
+        if (controllers.isEmpty()) {
+            return true;
+        }
+        
+        Iterator iterator = controllers.iterator();
+        while (iterator.hasNext()) {
+            ServiceController controller = (ServiceController) iterator.next();
+            if (controller.getValue()) {
+                return true;
+            }
+        }
+        return false;
+    }
+    
+    private String[] getServiceSpecificationsToRegister() {
+        if (m_controllers.isEmpty()) {
+            return m_serviceSpecifications;
+        }
+        
+        ArrayList l = new ArrayList();
+        if (m_controllers.containsKey("ALL")) {
+            ServiceController ctrl = (ServiceController) m_controllers.get("ALL");
+            if (ctrl.m_value) {
+                l.addAll(Arrays.asList(m_serviceSpecifications));
+            }
+        }
+        
+        Iterator iterator = m_controllers.keySet().iterator();
+        while (iterator.hasNext()) {
+            String spec = (String) iterator.next();
+            ServiceController ctrl = (ServiceController) m_controllers.get(spec);
+            if (ctrl.m_value) {
+                if (! "ALL".equals(spec)) { // Already added.
+                    if (! l.contains(spec)) {
+                        l.add(spec);
+                    }
+                }
+            } else {
+                l.remove(spec);
+            }
+        }
+                
+        return (String[]) l.toArray(new String[l.size()]);
+        
     }
 
     public void setPostRegistrationCallback(Callback cb) {
@@ -562,7 +642,14 @@ public class ProvidedService implements 
                     if (m_value) {
                         registerService();
                     } else {
-                        unregisterService();
+                        // If we are still some specification valid, register those one
+                        // The registerService will call unregister.
+                        if (getServiceSpecificationsToRegister().length != 0) {
+                            registerService();
+                        } else {
+                            // If not, then unregister all
+                            unregisterService();
+                        }
                     }
                 }
             }

Modified: felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceDescription.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceDescription.java?rev=960227&r1=960226&r2=960227&view=diff
==============================================================================
--- felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceDescription.java
(original)
+++ felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceDescription.java
Sat Jul  3 15:13:57 2010
@@ -109,10 +109,23 @@ public class ProvidedServiceDescription 
      * @return the value
      */
     public String getController() {
-        if (m_ps.getController() == null) {
+        if (m_ps.getControllerBySpecification("ALL") == null) {
             return null; 
         } else {
-            return String.valueOf(m_ps.getController().getValue());
+            return String.valueOf(m_ps.getControllerBySpecification("ALL").getValue());
+        }
+    }
+    
+    /**
+     * Gets the controller value as a String.
+     * @param specification
+     * @return the value
+     */
+    public String getController(String specification) {
+        if (m_ps.getControllerBySpecification(specification) == null) {
+            return null; 
+        } else {
+            return String.valueOf(m_ps.getControllerBySpecification(specification).getValue());
         }
     }
 

Modified: felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceHandler.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceHandler.java?rev=960227&r1=960226&r2=960227&view=diff
==============================================================================
--- felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceHandler.java
(original)
+++ felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceHandler.java
Sat Jul  3 15:13:57 2010
@@ -35,6 +35,7 @@ import org.apache.felix.ipojo.architectu
 import org.apache.felix.ipojo.architecture.PropertyDescription;
 import org.apache.felix.ipojo.handlers.dependency.Dependency;
 import org.apache.felix.ipojo.handlers.dependency.DependencyHandler;
+import org.apache.felix.ipojo.handlers.providedservice.ProvidedService.ServiceController;
 import org.apache.felix.ipojo.metadata.Attribute;
 import org.apache.felix.ipojo.metadata.Element;
 import org.apache.felix.ipojo.parser.FieldMetadata;
@@ -189,20 +190,22 @@ public class ProvidedServiceHandler exte
 
             Element[] controllers = providedServices[i].getElements("Controller");
             if (controllers != null) {
-                if (controllers.length > 1) {
-                    throw new ConfigurationException("Cannot have several controller per
'provides' element");
-                }
-
-                String field = controllers[0].getAttribute("field");
-                if (field == null) {
-                    throw new ConfigurationException("The field attribute of a controller
is mandatory");
-                }
+                for (int k = 0; k < controllers.length; k++) {
+                    String field = controllers[k].getAttribute("field");
+                    if (field == null) {
+                        throw new ConfigurationException("The field attribute of a controller
is mandatory");
+                    }
 
-                String v = controllers[0].getAttribute("value");
-                boolean value = ! (v != null  && v.equalsIgnoreCase("false"));
-                svc.setController(field, value);
+                    String v = controllers[k].getAttribute("value");
+                    boolean value = ! (v != null  && v.equalsIgnoreCase("false"));
+                    String s = controllers[k].getAttribute("specification");
+                    if (s == null) {
+                        s ="ALL";
+                    }
+                    svc.setController(field, value, s);
 
-                getInstanceManager().register(new FieldMetadata(field, "boolean"), this);
+                    getInstanceManager().register(new FieldMetadata(field, "boolean"), this);
+                }
             }
 
             if (checkProvidedService(svc)) {
@@ -428,9 +431,10 @@ public class ProvidedServiceHandler exte
             if (update) {
                 svc.update();
             }
-            if (svc.getController() != null  && svc.getController().getField().equals(fieldName))
{
+            ServiceController ctrl = svc.getController(fieldName);
+            if (ctrl != null) {
                 if (value instanceof Boolean) {
-                    svc.getController().setValue((Boolean) value);
+                    ctrl.setValue((Boolean) value);
                 } else {
                     warn("Boolean value expected for the service controler " + fieldName);
                 }
@@ -459,8 +463,9 @@ public class ProvidedServiceHandler exte
                     return prop.onGet(pojo, fieldName, value);
                 }
             }
-            if (svc.getController() != null  && svc.getController().getField().equals(fieldName))
{
-                return new Boolean(svc.getController().getValue());
+            ServiceController ctrl = svc.getController(fieldName);
+            if (ctrl != null) {
+                return new Boolean(ctrl.getValue());
             }
         }
         // Else it is not a property

Modified: felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/FieldCollector.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/FieldCollector.java?rev=960227&r1=960226&r2=960227&view=diff
==============================================================================
--- felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/FieldCollector.java
(original)
+++ felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/FieldCollector.java
Sat Jul  3 15:13:57 2010
@@ -408,7 +408,12 @@ public class FieldCollector extends Empt
         /**
          * Property value.  
          */
-        private String m_value;        
+        private String m_value;
+        
+        /**
+         * Specification value.  
+         */
+        private String m_spec;   
         
         /**
          * Constructor.
@@ -431,6 +436,10 @@ public class FieldCollector extends Empt
                 m_value = arg1.toString();
                 return;
             }
+            if (arg0.equals("specification")) {
+                m_spec = ((Type) arg1).getClassName();
+                return;
+            } 
         }
 
         /**
@@ -446,6 +455,9 @@ public class FieldCollector extends Empt
             if (m_value != null) {
                 controller.addAttribute(new Attribute("value", m_value));
             }
+            if (m_spec != null) {
+                controller.addAttribute(new Attribute("specification", m_spec));
+            }
         }
     }
 }

Modified: felix/trunk/ipojo/tests/core/annotations/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/core/annotations/pom.xml?rev=960227&r1=960226&r2=960227&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/core/annotations/pom.xml (original)
+++ felix/trunk/ipojo/tests/core/annotations/pom.xml Sat Jul  3 15:13:57 2010
@@ -113,6 +113,7 @@
       <plugin>
         <groupId>org.apache.felix</groupId>
         <artifactId>maven-ipojo-plugin</artifactId>
+        <version>1.7.0-SNAPSHOT</version>
         <executions>
           <execution>
             <goals>

Modified: felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/ServiceProdiving.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/ServiceProdiving.java?rev=960227&r1=960226&r2=960227&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/ServiceProdiving.java
(original)
+++ felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/ServiceProdiving.java
Sat Jul  3 15:13:57 2010
@@ -91,6 +91,17 @@ public class ServiceProdiving extends OS
         assertEquals(1, provs[0].getElements("controller").length);
         assertEquals("false", provs[0].getElements("controller")[0].getAttribute("value"));
     }
+    
+    public void testServiceControllerWithSpecification() {
+        Element meta = helper.getMetadata("org.apache.felix.ipojo.test.scenarios.component.PSServiceControllerSpec");
+        Element[] provs = meta.getElements("provides");
+        assertNotNull("Provides exists ", provs);
+        System.out.println(provs[0].toString());
+        assertNotNull(provs[0].getElements("controller"));
+        assertEquals(2, provs[0].getElements("controller").length);
+        assertEquals("false", provs[0].getElements("controller")[0].getAttribute("value"));
+        assertEquals(FooService.class.getName(), provs[0].getElements("controller")[0].getAttribute("specification"));
+    }
 
     private Element getPropertyByName(Element[] props, String name) {
         for (int i = 0; i < props.length; i++) {

Added: felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/PSServiceControllerSpec.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/PSServiceControllerSpec.java?rev=960227&view=auto
==============================================================================
--- felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/PSServiceControllerSpec.java
(added)
+++ felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/PSServiceControllerSpec.java
Sat Jul  3 15:13:57 2010
@@ -0,0 +1,57 @@
+package org.apache.felix.ipojo.test.scenarios.component;
+
+import java.util.Properties;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.annotations.Provides;
+import org.apache.felix.ipojo.annotations.ServiceController;
+import org.apache.felix.ipojo.test.scenarios.annotations.service.BarService;
+import org.apache.felix.ipojo.test.scenarios.annotations.service.FooService;
+
+@Component
+@Provides(specifications= {FooService.class, BarService.class})
+public class PSServiceControllerSpec implements FooService, BarService {
+
+    @ServiceController(value=false, specification=FooService.class)
+    public boolean controller1;
+    
+    @ServiceController(value=true)
+    public boolean controller2;
+    
+    public boolean foo() {
+        return false;
+    }
+
+    public Properties fooProps() {
+        return null;
+    }
+
+    public boolean getBoolean() {
+        return false;
+    }
+
+    public double getDouble() {
+        return 0;
+    }
+
+    public int getInt() {
+        return 0;
+    }
+
+    public long getLong() {
+        return 0;
+    }
+
+    public Boolean getObject() {
+        return null;
+    }
+
+    public boolean bar() {
+        return false;
+    }
+
+    public Properties getProps() {
+        return null;
+    }
+
+}

Modified: felix/trunk/ipojo/tests/core/service-providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/ServiceControllerTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/core/service-providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/ServiceControllerTest.java?rev=960227&r1=960226&r2=960227&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/core/service-providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/ServiceControllerTest.java
(original)
+++ felix/trunk/ipojo/tests/core/service-providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/ServiceControllerTest.java
Sat Jul  3 15:13:57 2010
@@ -127,6 +127,100 @@ public class ServiceControllerTest exten
         ci.dispose();
     }
     
+    public void testComponentWithTwoControllersUsingBothSpecificationsTrueFalse() {
+        ComponentInstance ci = helper.createComponentInstance("PS-Controller-2-spec1");
+
+        waitForService(CheckService.class.getName(), null, 5000);
+        
+        assertFalse(isServiceAvailable(FooService.class.getName()));
+
+        CheckService check = (CheckService) getServiceObject(CheckService.class.getName(),
null);
+        assertNotNull(check);
+        
+        check.getProps();
+        
+        assertFalse(isServiceAvailable(CheckService.class.getName()));
+        assertTrue(isServiceAvailable(FooService.class.getName()));
+       
+        FooService fs = (FooService) getServiceObject(FooService.class.getName(), null);
+        fs.fooProps();
+        
+        assertTrue(isServiceAvailable(CheckService.class.getName()));
+        assertTrue(isServiceAvailable(FooService.class.getName()));
+        
+        ci.dispose();
+    }
+    
+    public void testComponentWithTwoControllersUsingBothSpecificationsTrueTrue() {
+        ComponentInstance ci = helper.createComponentInstance("PS-Controller-2-spec2");
+
+        waitForService(CheckService.class.getName(), null, 5000);
+        waitForService(FooService.class.getName(), null, 5000);
+
+        CheckService check = (CheckService) getServiceObject(CheckService.class.getName(),
null);
+        assertNotNull(check);
+        
+        check.check();
+        // CheckService not available
+        assertNull(getServiceReference(CheckService.class.getName()));
+        assertNotNull(getServiceReference(FooService.class.getName()));
+
+        FooService fs = (FooService) getServiceObject(FooService.class.getName(), null);
+        fs.foo();
+        
+        assertNull(getServiceReference(CheckService.class.getName()));
+        assertNull(getServiceReference(FooService.class.getName()));
+        
+        ci.dispose();
+    }
+    
+    public void testComponentWithTwoControllersUsingSpecificationAndAllTrueTrue() {
+        ComponentInstance ci = helper.createComponentInstance("PS-Controller-2-spec3");
+
+        waitForService(CheckService.class.getName(), null, 5000);
+        waitForService(FooService.class.getName(), null, 5000);
+
+        CheckService check = (CheckService) getServiceObject(CheckService.class.getName(),
null);
+        assertNotNull(check);
+        
+        check.check();
+        // CheckService not available
+        assertNull(getServiceReference(CheckService.class.getName()));
+        assertNotNull(getServiceReference(FooService.class.getName()));
+
+        FooService fs = (FooService) getServiceObject(FooService.class.getName(), null);
+        fs.foo();
+        
+        assertNull(getServiceReference(CheckService.class.getName()));
+        assertNull(getServiceReference(FooService.class.getName()));
+        
+        ci.dispose();
+    }
+    
+    public void testComponentWithTwoControllersUsingSpecificationAndAllTrueFalse() {
+        ComponentInstance ci = helper.createComponentInstance("PS-Controller-2-spec4");
+
+        waitForService(CheckService.class.getName(), null, 5000);
+        
+        assertFalse(isServiceAvailable(FooService.class.getName()));
+
+        CheckService check = (CheckService) getServiceObject(CheckService.class.getName(),
null);
+        assertNotNull(check);
+        
+        check.getProps();
+        
+        assertFalse(isServiceAvailable(CheckService.class.getName()));
+        assertTrue(isServiceAvailable(FooService.class.getName()));
+       
+        FooService fs = (FooService) getServiceObject(FooService.class.getName(), null);
+        fs.fooProps();
+        
+        assertTrue(isServiceAvailable(CheckService.class.getName()));
+        assertTrue(isServiceAvailable(FooService.class.getName()));
+        
+        ci.dispose();
+    }
+    
     public void testArchitecture() {
         ComponentInstance ci = helper.createComponentInstance("PS-Controller-1-default");
         // Controller set to true.

Modified: felix/trunk/ipojo/tests/core/service-providing/src/main/resources/metadata.xml
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/core/service-providing/src/main/resources/metadata.xml?rev=960227&r1=960226&r2=960227&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/core/service-providing/src/main/resources/metadata.xml (original)
+++ felix/trunk/ipojo/tests/core/service-providing/src/main/resources/metadata.xml Sat Jul
 3 15:13:57 2010
@@ -1,6 +1,5 @@
 <ipojo
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="org.apache.felix.ipojo http://felix.apache.org/ipojo/schemas/SNAPSHOT/core.xsd"
  xmlns="org.apache.felix.ipojo"
 >
     <!-- Simple provider  -->
@@ -209,6 +208,48 @@
             <controller field="controllerCS" value="true"/>
         </provides>
     </component>
+    
+    <component classname="org.apache.felix.ipojo.test.scenarios.component.controller.DoubleControllerCheckService"
+     name="PS-Controller-2-spec1">
+        <provides>
+            <property name="test2" type="string" value="test2"/>
+            <controller field="controllerFoo" value="false" specification="org.apache.felix.ipojo.test.scenarios.ps.service.FooService"/>
+            <controller field="controllerCS" value="true" specification="org.apache.felix.ipojo.test.scenarios.ps.service.CheckService"/>
+            <property name="test" type="string" value="test"/>
+        </provides>
+    </component>
+    
+    <component classname="org.apache.felix.ipojo.test.scenarios.component.controller.DoubleControllerCheckService"
+     name="PS-Controller-2-spec2">
+        <provides>
+            <property name="test2" type="string" value="test2"/>
+            <controller field="controllerFoo" value="true" specification="org.apache.felix.ipojo.test.scenarios.ps.service.FooService"/>
+            <controller field="controllerCS" value="true" specification="org.apache.felix.ipojo.test.scenarios.ps.service.CheckService"/>
+            <property name="test" type="string" value="test"/>
+        </provides>
+    </component>
+    
+    <component classname="org.apache.felix.ipojo.test.scenarios.component.controller.DoubleControllerCheckService"
+     name="PS-Controller-2-spec3">
+        <provides>
+            <property name="test2" type="string" value="test2"/>
+            <controller field="controllerFoo" value="true" specification="org.apache.felix.ipojo.test.scenarios.ps.service.FooService"/>
+            <controller field="controllerCS" value="true"/>
+            <property name="test" type="string" value="test"/>
+        </provides>
+    </component>
+    
+    <component classname="org.apache.felix.ipojo.test.scenarios.component.controller.DoubleControllerCheckService"
+     name="PS-Controller-2-spec4">
+        <provides>
+            <property name="test2" type="string" value="test2"/>
+            <controller field="controllerFoo" value="false" specification="org.apache.felix.ipojo.test.scenarios.ps.service.FooService"/>
+            <controller field="controllerCS" value="true"/>
+            <property name="test" type="string" value="test"/>
+        </provides>
+    </component>
+    
+    
 
     <!-- Anonymous classes -->
     <component



Mime
View raw message