You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cl...@apache.org on 2010/01/05 11:14:58 UTC

svn commit: r895971 - in /felix/trunk/ipojo: core/src/main/java/org/apache/felix/ipojo/handlers/lifecycle/callback/ core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/t...

Author: clement
Date: Tue Jan  5 10:14:25 2010
New Revision: 895971

URL: http://svn.apache.org/viewvc?rev=895971&view=rev
Log:
Fix issue FELIX-1965
When a validate callback throws an exception, the service is still published (a small amount of time). This 'door' allows a consumer to use a non initialized service.
The fix avoids that and test it.

Added:
    felix/trunk/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/component/CallbackWithErrorCheckService.java   (with props)
    felix/trunk/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/lifecycle/callback/ErrorCallbackTestCase.java   (with props)
Modified:
    felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/lifecycle/callback/LifecycleCallbackHandler.java
    felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedService.java
    felix/trunk/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/lifecycle/callback/CallbackTestCase.java
    felix/trunk/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/lifecycle/callback/LifeCycleCallbackTest.java
    felix/trunk/ipojo/tests/core/lifecycle-callback/src/main/resources/metadata.xml

Modified: felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/lifecycle/callback/LifecycleCallbackHandler.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/lifecycle/callback/LifecycleCallbackHandler.java?rev=895971&r1=895970&r2=895971&view=diff
==============================================================================
--- felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/lifecycle/callback/LifecycleCallbackHandler.java (original)
+++ felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/lifecycle/callback/LifecycleCallbackHandler.java Tue Jan  5 10:14:25 2010
@@ -168,7 +168,7 @@
                     throw new IllegalStateException(e.getMessage());
                 } catch (InvocationTargetException e) {
                     error("[" + getInstanceManager().getInstanceName() + "] The callback method " + m_callbacks[i].getMethod() + " has thrown an exception : " + e.getTargetException().getMessage(), e.getTargetException());
-                    getInstanceManager().setState(ComponentInstance.INVALID);
+                    throw new IllegalStateException(e.getTargetException().getMessage());
                 }
             }
         }

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=895971&r1=895970&r2=895971&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 Tue Jan  5 10:14:25 2010
@@ -276,14 +276,19 @@
     }
 
     /**
-     * Return a service object for the dependency.
+     * Returns a service object for the dependency.
      * @see org.osgi.framework.ServiceFactory#getService(org.osgi.framework.Bundle, org.osgi.framework.ServiceRegistration)
      * @param bundle : the bundle
-     * @param registration : the service registration of the registred service
-     * @return : a new service object or a already created service object (in the case of singleton)
+     * @param registration : the service registration of the registered service
+     * @return a new service object or a already created service object (in the case of singleton) or <code>null</code>
+     * if the instance is no more valid.
      */
     public Object getService(Bundle bundle, ServiceRegistration registration) {
-        return m_strategy.getService(bundle, registration);
+        if (getInstanceManager().getState() == InstanceManager.VALID) {
+            return m_strategy.getService(bundle, registration);
+        } else {
+            return null;
+        }
     }
 
     /**

Added: felix/trunk/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/component/CallbackWithErrorCheckService.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/component/CallbackWithErrorCheckService.java?rev=895971&view=auto
==============================================================================
--- felix/trunk/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/component/CallbackWithErrorCheckService.java (added)
+++ felix/trunk/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/component/CallbackWithErrorCheckService.java Tue Jan  5 10:14:25 2010
@@ -0,0 +1,44 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.test.scenarios.component;
+
+import java.util.Properties;
+
+import org.apache.felix.ipojo.test.scenarios.lifecycle.callback.service.CheckService;
+
+public class CallbackWithErrorCheckService extends ParentClass implements CheckService {
+
+
+    public void start() {
+        throw new NullPointerException();
+    }
+
+    public void stop() {
+    }
+
+    public boolean check() {
+        return true;
+    }
+
+    public Properties getProps() {
+        Properties p = new Properties();
+        return p;
+    }
+
+}

Propchange: felix/trunk/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/component/CallbackWithErrorCheckService.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: felix/trunk/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/lifecycle/callback/CallbackTestCase.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/lifecycle/callback/CallbackTestCase.java?rev=895971&r1=895970&r2=895971&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/lifecycle/callback/CallbackTestCase.java (original)
+++ felix/trunk/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/lifecycle/callback/CallbackTestCase.java Tue Jan  5 10:14:25 2010
@@ -29,87 +29,87 @@
 import org.osgi.framework.ServiceReference;
 
 public class CallbackTestCase extends OSGiTestCase {
-	
-	ComponentInstance instance; // Instance under test
-	ComponentInstance fooProvider;
+    
+    ComponentInstance instance; // Instance under test
+    ComponentInstance fooProvider;
 
-	public void setUp() {
-		Properties p2 = new Properties();
-		p2.put("instance.name","fooProvider");
-		fooProvider = Utils.getComponentInstance(getContext(), "LFCB-FooProviderType-1", p2);
-		fooProvider.stop();
-		
-		Properties p1 = new Properties();
-		p1.put("instance.name","callback");
-		instance = Utils.getComponentInstance(getContext(), "LFCB-CallbackCheckService", p1);
-		
-	}
-	
-	public void tearDown() {
-		instance.dispose();
-		fooProvider.dispose();
-		instance= null;
-		fooProvider = null;
-	}
-	
-	public void testCallback() {
-		// Check instance is invalid
-		ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance.getInstanceName());
-		assertNotNull("Check architecture availability", arch_ref);
-		PrimitiveInstanceDescription id_dep = (PrimitiveInstanceDescription) ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
-		assertTrue("Check instance invalidity - 1", id_dep.getState() == ComponentInstance.INVALID);
-		assertEquals("Check pojo count - 1", id_dep.getCreatedObjects().length, 0);
-		
-		// Start fooprovider
-		fooProvider.start();
-		
-		// Check instance validity
-		//id_dep = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
-		assertTrue("Check instance validity - 1", id_dep.getState() == ComponentInstance.VALID);
-		
-		// Check service providing
-		ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
-		assertNotNull("Check CheckService availability", cs_ref);
-		CheckService cs = (CheckService) getContext().getService(cs_ref);
-		assertTrue("check CheckService invocation", cs.check());
-		
-		// Check int property
-		Integer index = (Integer) (cs.getProps().get("int"));
-		assertEquals("Check int property - 1", index.intValue(), 1);
-		
-		assertEquals("Check pojo count - 2", id_dep.getCreatedObjects().length, 1);
-		
-		fooProvider.stop();
-		
-		//id_dep = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
-		assertTrue("Check instance invalidity - 2", id_dep.getState() == ComponentInstance.INVALID);
-		
-		assertEquals("Check pojo count - 3", id_dep.getCreatedObjects().length, 1);
-		
-		fooProvider.start();
-		
-		// Check instance validity
-		//id_dep = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
-		assertTrue("Check instance validity - 2", id_dep.getState() == ComponentInstance.VALID);
-		
-		// Check service providing
-		cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
-		assertNotNull("Check CheckService availability", cs_ref);
-		cs = (CheckService) getContext().getService(cs_ref);
-		assertTrue("check CheckService invocation", cs.check());
-		
-		// Check int property
-		index = (Integer) (cs.getProps().get("int"));
-		assertEquals("Check int property - 2 ("+index.intValue()+")", index.intValue(), 3);
-		
-		assertEquals("Check pojo count - 4 ", id_dep.getCreatedObjects().length, 1);
-		
-		// Clean up
-		getContext().ungetService(arch_ref);
-		getContext().ungetService(cs_ref);
-		cs = null;
-		id_dep = null;
-	}
-		
+    public void setUp() {
+        Properties p2 = new Properties();
+        p2.put("instance.name","fooProvider");
+        fooProvider = Utils.getComponentInstance(getContext(), "LFCB-FooProviderType-1", p2);
+        fooProvider.stop();
+        
+        Properties p1 = new Properties();
+        p1.put("instance.name","callback");
+        instance = Utils.getComponentInstance(getContext(), "LFCB-CallbackCheckService", p1);
+        
+    }
+    
+    public void tearDown() {
+        instance.dispose();
+        fooProvider.dispose();
+        instance= null;
+        fooProvider = null;
+    }
+    
+    public void testCallback() {
+        // Check instance is invalid
+        ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance.getInstanceName());
+        assertNotNull("Check architecture availability", arch_ref);
+        PrimitiveInstanceDescription id_dep = (PrimitiveInstanceDescription) ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance invalidity - 1", id_dep.getState() == ComponentInstance.INVALID);
+        assertEquals("Check pojo count - 1", id_dep.getCreatedObjects().length, 0);
+        
+        // Start fooprovider
+        fooProvider.start();
+        
+        // Check instance validity
+        //id_dep = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 1", id_dep.getState() == ComponentInstance.VALID);
+        
+        // Check service providing
+        ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_ref);
+        CheckService cs = (CheckService) getContext().getService(cs_ref);
+        assertTrue("check CheckService invocation", cs.check());
+        
+        // Check int property
+        Integer index = (Integer) (cs.getProps().get("int"));
+        assertEquals("Check int property - 1", index.intValue(), 1);
+        
+        assertEquals("Check pojo count - 2", id_dep.getCreatedObjects().length, 1);
+        
+        fooProvider.stop();
+        
+        //id_dep = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance invalidity - 2", id_dep.getState() == ComponentInstance.INVALID);
+        
+        assertEquals("Check pojo count - 3", id_dep.getCreatedObjects().length, 1);
+        
+        fooProvider.start();
+        
+        // Check instance validity
+        //id_dep = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 2", id_dep.getState() == ComponentInstance.VALID);
+        
+        // Check service providing
+        cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_ref);
+        cs = (CheckService) getContext().getService(cs_ref);
+        assertTrue("check CheckService invocation", cs.check());
+        
+        // Check int property
+        index = (Integer) (cs.getProps().get("int"));
+        assertEquals("Check int property - 2 ("+index.intValue()+")", index.intValue(), 3);
+        
+        assertEquals("Check pojo count - 4 ", id_dep.getCreatedObjects().length, 1);
+        
+        // Clean up
+        getContext().ungetService(arch_ref);
+        getContext().ungetService(cs_ref);
+        cs = null;
+        id_dep = null;
+    }
+        
 
 }

Added: felix/trunk/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/lifecycle/callback/ErrorCallbackTestCase.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/lifecycle/callback/ErrorCallbackTestCase.java?rev=895971&view=auto
==============================================================================
--- felix/trunk/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/lifecycle/callback/ErrorCallbackTestCase.java (added)
+++ felix/trunk/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/lifecycle/callback/ErrorCallbackTestCase.java Tue Jan  5 10:14:25 2010
@@ -0,0 +1,56 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.test.scenarios.lifecycle.callback;
+
+import java.util.Properties;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.test.scenarios.lifecycle.callback.service.CheckService;
+import org.apache.felix.ipojo.test.scenarios.util.Utils;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * Test the fix for FELIX-1965.
+ * When a validate callback throws an exception, the service is still provided.
+ */
+public class ErrorCallbackTestCase extends OSGiTestCase {
+    
+    ComponentInstance instance; // Instance under test
+    
+    public void tearDown() {
+        if (instance != null) {
+            instance.dispose();
+            instance= null;
+        }
+    }
+    
+    public void testErrorInValidateCallback() {
+        Properties p2 = new Properties();
+        p2.put("instance.name","error");
+        instance = Utils.getComponentInstance(getContext(), "LFCB-CallbackWithError", p2);
+        
+        // The service should not be provided as the start method has thrown an exception
+        ServiceReference ref = getServiceReference(CheckService.class.getName(), "(instance.name=" + instance.getInstanceName() +")");
+        assertNull(ref);
+        
+    }
+        
+
+}

Propchange: felix/trunk/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/lifecycle/callback/ErrorCallbackTestCase.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: felix/trunk/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/lifecycle/callback/LifeCycleCallbackTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/lifecycle/callback/LifeCycleCallbackTest.java?rev=895971&r1=895970&r2=895971&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/lifecycle/callback/LifeCycleCallbackTest.java (original)
+++ felix/trunk/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/lifecycle/callback/LifeCycleCallbackTest.java Tue Jan  5 10:14:25 2010
@@ -25,17 +25,18 @@
 import org.osgi.framework.BundleContext;
 
 public class LifeCycleCallbackTest extends TestSuite {
-	
+    
 
-	public static Test suite(BundleContext bc) {
-		OSGiTestSuite ots = new OSGiTestSuite("Lifecycle callbacks Test Suite", bc);
-		ots.addTestSuite(CallbackTestCase.class);
-		ots.addTestSuite(ParentCallbackTestCase.class);
+    public static Test suite(BundleContext bc) {
+        OSGiTestSuite ots = new OSGiTestSuite("Lifecycle callbacks Test Suite", bc);
+        ots.addTestSuite(CallbackTestCase.class);
+        ots.addTestSuite(ParentCallbackTestCase.class);
         ots.addTestSuite(ImmediateCallbackTest.class);
         ots.addTestSuite(ImmediateCallbackSingletonFactoryTest.class);
         ots.addTestSuite(ImmediateCallbackSeveralFactoryTest.class);
-		return ots;
-	}
+        ots.addTestSuite(ErrorCallbackTestCase.class);
+        return ots;
+    }
 
 }
 

Modified: felix/trunk/ipojo/tests/core/lifecycle-callback/src/main/resources/metadata.xml
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/core/lifecycle-callback/src/main/resources/metadata.xml?rev=895971&r1=895970&r2=895971&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/core/lifecycle-callback/src/main/resources/metadata.xml (original)
+++ felix/trunk/ipojo/tests/core/lifecycle-callback/src/main/resources/metadata.xml Tue Jan  5 10:14:25 2010
@@ -3,54 +3,63 @@
     xsi:schemaLocation="org.apache.felix.ipojo http://felix.apache.org/ipojo/schemas/SNAPSHOT/core.xsd"
     xmlns="org.apache.felix.ipojo"
 >
-	<component
-		classname="org.apache.felix.ipojo.test.scenarios.component.FooProviderType1"
-		name="LFCB-FooProviderType-1" architecture="true">
-		<provides />
-	</component>
-	
-	<!-- Lifecycle Callback -->
-	<component
-		classname="org.apache.felix.ipojo.test.scenarios.component.CallbackCheckService"
-		name="LFCB-CallbackCheckService" architecture="true">
-		<requires field="fs" />
-		<provides />
-		<callback transition="validate" method="start" />
-		<callback transition="invalidate" method="stop" />
-	</component>
-	<component
-		classname="org.apache.felix.ipojo.test.scenarios.component.CallbackCheckService"
-		name="LFCB-ParentCallbackCheckService" architecture="true">
-		<requires field="fs" />
-		<provides />
-		<callback transition="validate" method="parentStart" />
-		<callback transition="invalidate" method="parentStop" />
-	</component>
-	<component
-		classname="org.apache.felix.ipojo.test.scenarios.component.CallbackCheckService"
-		immediate="true" name="LFCB-ImmediateCallbackCheckService"
-		architecture="true">
-		<requires field="fs" />
-		<provides />
-		<callback transition="validate" method="start" />
-		<callback transition="invalidate" method="stop" />
-	</component>
-	<component
-		classname="org.apache.felix.ipojo.test.scenarios.component.CallbackCheckService"
-		immediate="true" name="LFCB-ImmediateCallbackCheckServiceSingleton"
-		factory-method="singleton" architecture="true">
-		<requires field="fs" />
-		<provides />
-		<callback transition="validate" method="start" />
-		<callback transition="invalidate" method="stop" />
-	</component>
-	<component
-		classname="org.apache.felix.ipojo.test.scenarios.component.CallbackCheckService"
-		immediate="true" name="LFCB-ImmediateCallbackCheckServiceSeveral"
-		factory-method="several" architecture="true">
-		<requires field="fs" />
-		<provides />
-		<callback transition="validate" method="start" />
-		<callback transition="invalidate" method="stop" />
-	</component>
+  <component
+    classname="org.apache.felix.ipojo.test.scenarios.component.FooProviderType1"
+    name="LFCB-FooProviderType-1" architecture="true">
+    <provides />
+  </component>
+  
+  <!-- Lifecycle Callback -->
+  <component
+    classname="org.apache.felix.ipojo.test.scenarios.component.CallbackCheckService"
+    name="LFCB-CallbackCheckService" architecture="true">
+    <requires field="fs" />
+    <provides />
+    <callback transition="validate" method="start" />
+    <callback transition="invalidate" method="stop" />
+  </component>
+  <component
+    classname="org.apache.felix.ipojo.test.scenarios.component.CallbackCheckService"
+    name="LFCB-ParentCallbackCheckService" architecture="true">
+    <requires field="fs" />
+    <provides />
+    <callback transition="validate" method="parentStart" />
+    <callback transition="invalidate" method="parentStop" />
+  </component>
+  <component
+    classname="org.apache.felix.ipojo.test.scenarios.component.CallbackCheckService"
+    immediate="true" name="LFCB-ImmediateCallbackCheckService"
+    architecture="true">
+    <requires field="fs" />
+    <provides />
+    <callback transition="validate" method="start" />
+    <callback transition="invalidate" method="stop" />
+  </component>
+  <component
+    classname="org.apache.felix.ipojo.test.scenarios.component.CallbackCheckService"
+    immediate="true" name="LFCB-ImmediateCallbackCheckServiceSingleton"
+    factory-method="singleton" architecture="true">
+    <requires field="fs" />
+    <provides />
+    <callback transition="validate" method="start" />
+    <callback transition="invalidate" method="stop" />
+  </component>
+  <component
+    classname="org.apache.felix.ipojo.test.scenarios.component.CallbackCheckService"
+    immediate="true" name="LFCB-ImmediateCallbackCheckServiceSeveral"
+    factory-method="several" architecture="true">
+    <requires field="fs" />
+    <provides />
+    <callback transition="validate" method="start" />
+    <callback transition="invalidate" method="stop" />
+  </component>
+  
+  <!--  Test initialization error -->
+  <component
+    classname="org.apache.felix.ipojo.test.scenarios.component.CallbackWithErrorCheckService"
+    name="LFCB-CallbackWithError">
+    <provides />
+    <callback transition="validate" method="start" />
+    <callback transition="invalidate" method="stop" />
+  </component>
 </ipojo>