FELIX-4402 don't enable a new ComponentManager until it's configuration is supplied to it

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1602642 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/config/ComponentHolder.java b/scr/src/main/java/org/apache/felix/scr/impl/config/ComponentHolder.java
index d2e3722..5b86d23 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/config/ComponentHolder.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/config/ComponentHolder.java
@@ -100,7 +100,7 @@
     List<? extends ComponentManager<?>> getComponents();
 
     /**
-     * Enables all components of this holder and if satisifed activates
+     * Enables all components of this holder and if satisfied activates
      * them.
      *
      * @param async Whether the actual activation should take place
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/config/ConfigurableComponentHolder.java b/scr/src/main/java/org/apache/felix/scr/impl/config/ConfigurableComponentHolder.java
index bc43e41..36e4313 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/config/ConfigurableComponentHolder.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/config/ConfigurableComponentHolder.java
@@ -20,6 +20,7 @@
 
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.Dictionary;
 import java.util.Enumeration;
@@ -35,6 +36,7 @@
 import org.apache.felix.scr.impl.TargetedPID;
 import org.apache.felix.scr.impl.helper.ComponentMethods;
 import org.apache.felix.scr.impl.helper.SimpleLogger;
+import org.apache.felix.scr.impl.manager.AbstractComponentManager;
 import org.apache.felix.scr.impl.manager.SingleComponentManager;
 import org.apache.felix.scr.impl.manager.ServiceFactoryComponentManager;
 import org.apache.felix.scr.impl.metadata.ComponentMetadata;
@@ -108,7 +110,7 @@
      * The values are the {@link SingleComponentManager<S> component instances}
      * created on behalf of the configurations.
      */
-    private final Map<String, SingleComponentManager<S>> m_components;
+    private final Map<String, AbstractComponentManager<S>> m_components;
 
     /**
      * The special component used if there is no configuration or a singleton
@@ -126,7 +128,7 @@
      * by this field is also contained in the map</li>
      * <ul>
      */
-    private SingleComponentManager<S> m_singleComponent;
+    private AbstractComponentManager<S> m_singleComponent;
     
     /**
      * Whether components have already been enabled by calling the
@@ -147,7 +149,7 @@
 		this.m_targetedPids = new TargetedPID[pidCount];
         this.m_configurations = new Dictionary[pidCount];
         this.m_changeCount = new Long[pidCount];
-        this.m_components = new HashMap<String, SingleComponentManager<S>>();
+        this.m_components = new HashMap<String, AbstractComponentManager<S>>();
         this.m_componentMethods = new ComponentMethods();
         this.m_enabled = false;
     }
@@ -177,10 +179,6 @@
             manager = new SingleComponentManager<S>( m_activator, this, m_componentMetadata, m_componentMethods );
         }
 
-        if ( m_enabled )
-        {
-        	manager.enable( false );
-        }
         return manager;
     }
 
@@ -223,7 +221,7 @@
                 new Object[] {pid}, null);
 
         // component to deconfigure or dispose of
-        final Map<SingleComponentManager<S>, Map<String, Object>> scms = new HashMap<SingleComponentManager<S>, Map<String, Object>>();
+        final Map<AbstractComponentManager<S>, Map<String, Object>> scms = new HashMap<AbstractComponentManager<S>, Map<String, Object>>();
         boolean reconfigure = false;
 
         synchronized ( m_components )
@@ -239,7 +237,7 @@
 				m_factoryTargetedPids.remove(servicePid);
 				m_factoryChangeCount.remove(servicePid);
 				m_factoryConfigurations.remove(servicePid);
-				SingleComponentManager<S> scm = m_components.remove(servicePid);
+				AbstractComponentManager<S> scm = m_components.remove(servicePid);
 				if ( m_factoryConfigurations.isEmpty() )
 				{
 					m_factoryPidIndex = null;
@@ -286,13 +284,13 @@
 				else
 				{
 					if (reconfigure) {
-						for (Map.Entry<String, SingleComponentManager<S>> entry : m_components.entrySet()) {
+						for (Map.Entry<String, AbstractComponentManager<S>> entry : m_components.entrySet()) {
 							scms.put(entry.getValue(), mergeProperties(entry.getKey()));
 						}
 					}
 					else
 					{
-						for (Map.Entry<String, SingleComponentManager<S>> entry : m_components.entrySet()) {
+						for (Map.Entry<String, AbstractComponentManager<S>> entry : m_components.entrySet()) {
 							scms.put(entry.getValue(), null );
 						}	
 						m_components.clear();
@@ -302,7 +300,7 @@
 			}
         }
 
-        for ( Map.Entry<SingleComponentManager<S>,Map<String, Object>> entry: scms.entrySet())
+        for ( Map.Entry<AbstractComponentManager<S>,Map<String, Object>> entry: scms.entrySet())
         {
 			if ( reconfigure ) {
 				entry.getKey().reconfigure( entry.getValue(), true);
@@ -333,9 +331,7 @@
                 new Object[] {pid, props}, null);
 
         // component to update or create
-        final Map<SingleComponentManager<S>, Map<String, Object>> scms = new HashMap< SingleComponentManager<S>, Map<String, Object>>();
-        final String message;
-        Object[] notEnabledArguments = null;
+        final Map<AbstractComponentManager<S>, Map<String, Object>> scms = new HashMap< AbstractComponentManager<S>, Map<String, Object>>();
         boolean created = false;
         
         //TODO better change count tracking
@@ -348,14 +344,14 @@
 				m_factoryChangeCount.put(pid.getServicePid(), changeCount);
 				if (m_enabled && isSatisfied()) {
 					if (m_singleComponent != null) {
-						SingleComponentManager<S> scm = m_singleComponent;
+						AbstractComponentManager<S> scm = m_singleComponent;
 						scms.put( scm, mergeProperties( pid.getServicePid() ) );
 						m_singleComponent = null;
 						m_components.put(pid.getServicePid(), scm);
 					} else if (m_components.containsKey(pid.getServicePid())) {
 						scms.put( m_components.get(pid.getServicePid()), mergeProperties( pid.getServicePid())  );
 					} else {
-						SingleComponentManager<S> scm = createComponentManager();
+						AbstractComponentManager<S> scm = createComponentManager();
 						m_components.put(pid.getServicePid(), scm);
 						scms.put( scm, mergeProperties( pid.getServicePid())  );
 						created = true;
@@ -376,7 +372,7 @@
 					} 
 					else if ( m_factoryPidIndex != null) 
 					{
-						for (Map.Entry<String, SingleComponentManager<S>> entry: m_components.entrySet()) 
+						for (Map.Entry<String, AbstractComponentManager<S>> entry: m_components.entrySet()) 
 						{
 							scms.put(entry.getValue(), mergeProperties( entry.getKey()));
 						}
@@ -400,7 +396,7 @@
         //properties is all the configs merged together (without any possible component factory info.
 
         final boolean enable = created && m_enabled;// TODO WTF?? && getComponentMetadata().isEnabled();
-        for ( Map.Entry<SingleComponentManager<S>,Map<String, Object>> entry: scms.entrySet())
+        for ( Map.Entry<AbstractComponentManager<S>,Map<String, Object>> entry: scms.entrySet())
         {
 			// configure the component
 			entry.getKey().reconfigure(entry.getValue(), false);
@@ -443,7 +439,7 @@
 		int index = m_componentMetadata.getPidIndex(pid);
 		if (index == -1) {
 			log(LogService.LOG_ERROR,
-					"Unrecognized pid {0], expected one of {1}",
+					"Unrecognized pid {0}, expected one of {1}",
 					new Object[] { pid,
 							m_componentMetadata.getConfigurationPid() },
 					null);
@@ -452,7 +448,7 @@
 		}
 		if (m_factoryPidIndex != null && index == m_factoryPidIndex) {
 			log(LogService.LOG_ERROR,
-					"singleton pid {0] supplied, but matches an existing factory pid at index: {1}",
+					"singleton pid {0} supplied, but matches an existing factory pid at index: {1}",
 					new Object[] { pid, m_factoryPidIndex }, null);
 			throw new IllegalStateException(
 					"Singleton pid supplied matching a previous factory pid "
@@ -466,7 +462,7 @@
 		int index = m_componentMetadata.getPidIndex(factoryPid);
 		if (index == -1) {
 			log(LogService.LOG_ERROR,
-					"Unrecognized factory pid {0], expected one of {1}",
+					"Unrecognized factory pid {0}, expected one of {1}",
 					new Object[] { factoryPid,
 							m_componentMetadata.getConfigurationPid() },
 					null);
@@ -475,8 +471,8 @@
 		}
 		if (m_configurations[index] != null) {
 			log(LogService.LOG_ERROR,
-					"factory pid {0], but this pids already supplied as a singleton: {1}",
-					new Object[] { factoryPid, m_targetedPids }, null);
+					"factory pid {0}, but this pid is already supplied as a singleton: {1} at index {2}",
+					new Object[] { factoryPid, Arrays.asList(m_targetedPids), index }, null);
 			throw new IllegalStateException(
 					"Factory pid supplied after all non-factory configurations supplied "
 							+ factoryPid);
@@ -485,7 +481,7 @@
 			m_factoryPidIndex = index;
 		} else if (index != m_factoryPidIndex) {
 			log(LogService.LOG_ERROR,
-					"factory pid {0] supplied for index {1}, but a factory pid previously supplied at index {2}",
+					"factory pid {0} supplied for index {1}, but a factory pid previously supplied at index {2}",
 					new Object[] { factoryPid, index, m_factoryPidIndex },
 					null);
 			throw new IllegalStateException(
@@ -568,7 +564,7 @@
 
     public void enableComponents( final boolean async )
     {
-    	List<SingleComponentManager<S>> cms = new ArrayList<SingleComponentManager<S>>();
+    	List<AbstractComponentManager<S>> cms = new ArrayList<AbstractComponentManager<S>>();
     	synchronized ( m_components )
     	{
     		if ( isSatisfied() )
@@ -583,6 +579,7 @@
     			{
     				for (String pid: m_factoryConfigurations.keySet()) {
     					SingleComponentManager<S> scm = createComponentManager();
+						m_components.put(pid, scm);
     					scm.reconfigure( mergeProperties( pid ), false);
     					cms.add( scm );
     				}
@@ -590,7 +587,7 @@
     		}
     		m_enabled = true;
     	}
-    	for ( SingleComponentManager<S> cm : cms )
+    	for ( AbstractComponentManager<S> cm : cms )
     	{
     		cm.enable( async );
     	}
@@ -599,7 +596,7 @@
 
     public void disableComponents( final boolean async )
     {
-        List<SingleComponentManager<S>> cms;
+        List<AbstractComponentManager<S>> cms;
         synchronized ( m_components )
         {
             m_enabled = false;
@@ -611,7 +608,7 @@
 //    			m_singleComponent = null;
 //    		}
         }
-        for ( SingleComponentManager<S> cm : cms )
+        for ( AbstractComponentManager<S> cm : cms )
         {
             cm.disable( async );
         }
@@ -620,12 +617,12 @@
 
     public void disposeComponents( final int reason )
     {
-        List<SingleComponentManager<S>> cms;
+        List<AbstractComponentManager<S>> cms;
         synchronized ( m_components )
         {
             cms = getComponentManagers( true );
         }
-        for ( SingleComponentManager<S> cm : cms )
+        for ( AbstractComponentManager<S> cm : cms )
         {
             cm.dispose( reason );
         }
@@ -639,7 +636,7 @@
         {
             if ( !m_components.isEmpty() )
             {
-                for ( Iterator<SingleComponentManager<S>> vi = m_components.values().iterator(); vi.hasNext(); )
+                for ( Iterator<AbstractComponentManager<S>> vi = m_components.values().iterator(); vi.hasNext(); )
                 {
                     if ( component == vi.next() )
                     {
@@ -712,9 +709,9 @@
      * 
      * @param clear If true, clear the map and the single component manager.
      */
-   List<SingleComponentManager<S>> getComponentManagers( final boolean clear )
+   List<AbstractComponentManager<S>> getComponentManagers( final boolean clear )
    {
-	   List<SingleComponentManager<S>> cm;
+	   List<AbstractComponentManager<S>> cm;
        if ( m_components.isEmpty() )
        {
            if ( m_singleComponent != null)
@@ -729,7 +726,7 @@
 
        else
        {
-           cm = new ArrayList<SingleComponentManager<S>>(m_components.values());
+           cm = new ArrayList<AbstractComponentManager<S>>(m_components.values());
        }
        if ( clear )
        {
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/config/ConfigurationSupport.java b/scr/src/main/java/org/apache/felix/scr/impl/config/ConfigurationSupport.java
index 8d59979..7503a1c 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/config/ConfigurationSupport.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/config/ConfigurationSupport.java
@@ -137,8 +137,9 @@
                                         if ( checkBundleLocation( config, bundleContext.getBundle() ) )
                                         {
                                             long changeCount = changeCounter.getChangeCount( config, false, -1 );
-                                            created |= holder.configurationUpdated( new TargetedPID( config.getFactoryPid() ),
-                                                    null, config.getProperties(),
+                                            created |= holder.configurationUpdated( new TargetedPID( config.getPid() ), 
+                                            		new TargetedPID( config.getFactoryPid() ),
+                                                    config.getProperties(),
                                                     changeCount );
                                         }
                                     }
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/manager/AbstractComponentManager.java b/scr/src/main/java/org/apache/felix/scr/impl/manager/AbstractComponentManager.java
index e5ae3a1..164cfb1 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/manager/AbstractComponentManager.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/manager/AbstractComponentManager.java
@@ -1530,5 +1530,8 @@
     {
         return m_internalEnabled;
     }
+
+    //TODO NEW!!
+	public abstract void reconfigure(Map<String, Object> value, boolean b);
     
 }
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/manager/ComponentFactoryImpl.java b/scr/src/main/java/org/apache/felix/scr/impl/manager/ComponentFactoryImpl.java
index 9be2e30..324f313 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/manager/ComponentFactoryImpl.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/manager/ComponentFactoryImpl.java
@@ -561,4 +561,11 @@
 	}
 
 
+	@Override
+	public void reconfigure(Map<String, Object> value, boolean b) {
+		// TODO Auto-generated method stub
+		
+	}
+
+
 }
diff --git a/scr/src/test/java/org/apache/felix/scr/integration/ComponentConfigurationTest.java b/scr/src/test/java/org/apache/felix/scr/integration/ComponentConfigurationTest.java
index 7393cbe..c1b6b35 100644
--- a/scr/src/test/java/org/apache/felix/scr/integration/ComponentConfigurationTest.java
+++ b/scr/src/test/java/org/apache/felix/scr/integration/ComponentConfigurationTest.java
@@ -144,6 +144,35 @@
         TestCase.assertNull( SimpleComponent.INSTANCE );
     }
 
+    /**
+     * same as test_SimpleComponent_configuration_require except configuration is present when component is enabled.
+     */
+    @Test
+    public void test_SimpleComponent_configuration_require_initialize()
+    {
+        final String pid = "SimpleComponent.configuration.require";
+
+        deleteConfig( pid );
+        configure( pid );
+        delay();
+        
+        TestCase.assertNull( SimpleComponent.INSTANCE );
+
+        ComponentConfigurationDTO cc = getConfigurationsDisabledThenEnable(pid, 1, ComponentConfigurationDTO.ACTIVE).iterator().next();
+
+        TestCase.assertNotNull( SimpleComponent.INSTANCE );
+        TestCase.assertEquals( PROP_NAME, SimpleComponent.INSTANCE.getProperty( PROP_NAME ) );
+
+        deleteConfig( pid );
+        delay();
+
+        checkConfigurationCount(pid, 0, -1);
+        TestCase.assertNull( SimpleComponent.INSTANCE );
+
+        disableAndCheck( cc );
+        TestCase.assertNull( SimpleComponent.INSTANCE );
+    }
+
 
     @Test
     public void test_SimpleComponent_dynamic_configuration()
@@ -466,57 +495,37 @@
 
         // expect two active components, //TODO WTF?? only first is active, second is disabled
         checkConfigurationCount(factoryPid, 2, ComponentConfigurationDTO.ACTIVE);
-//        Collection<ComponentConfigurationDTO> ccs = findComponentConfigurationsByName(factoryPid);
-//        Assert.assertEquals(2, ccs.size());
-//        
-//        ComponentConfigurationDTO activ e= null;
-//        ComponentConfigurationDTO inactive = null;
-//        
-//        for (ComponentConfigurationDTO cc: ccs)
-//        {
-//        	if (ComponentConfigurationDTO.ACTIVE == cc.state)
-//        	{
-//        		if 
-//        	}
-//        }
-//
-//        // find the active and inactive configs, fail if none
-//        int activeConfig;
-//        int inactiveConfig;
-//        if ( twoConfigs[0].getState() == Component.STATE_ACTIVE )
-//        {
-//            // [0] is active, [1] expected disabled
-//            activeConfig = 0;
-//            inactiveConfig = 1;
-//        }
-//        else if ( twoConfigs[1].getState() == Component.STATE_ACTIVE )
-//        {
-//            // [1] is active, [0] expected disabled
-//            activeConfig = 1;
-//            inactiveConfig = 0;
-//        }
-//        else
-//        {
-//            TestCase.fail( "One of two components expected active" );
-//            return; // eases the compiler...
-//        }
-//
-//        TestCase.assertEquals( Component.STATE_ACTIVE, twoConfigs[activeConfig].getState() );
-//        TestCase.assertEquals( Component.STATE_DISABLED, twoConfigs[inactiveConfig].getState() );
-//        TestCase.assertEquals( 1, SimpleComponent.INSTANCES.size() );
-//        TestCase.assertTrue( SimpleComponent.INSTANCES.containsKey( twoConfigs[activeConfig].getId() ) );
-//        TestCase.assertFalse( SimpleComponent.INSTANCES.containsKey( twoConfigs[inactiveConfig].getId() ) );
-//
-//        // enable second component
-//        twoConfigs[inactiveConfig].enable();
-//        delay();
-//
-//        // ensure both components active
-//        TestCase.assertEquals( Component.STATE_ACTIVE, twoConfigs[0].getState() );
-//        TestCase.assertEquals( Component.STATE_ACTIVE, twoConfigs[1].getState() );
-//        TestCase.assertEquals( 2, SimpleComponent.INSTANCES.size() );
-//        TestCase.assertTrue( SimpleComponent.INSTANCES.containsKey( twoConfigs[0].getId() ) );
-//        TestCase.assertTrue( SimpleComponent.INSTANCES.containsKey( twoConfigs[1].getId() ) );
+        // delete a configuration
+        deleteConfig( pid0 );
+        delay();
+
+        // expect one component
+        checkConfigurationCount(factoryPid, 1, ComponentConfigurationDTO.ACTIVE);
+
+        // delete second configuration
+        deleteConfig( pid1 );
+        delay();
+
+        checkConfigurationCount(factoryPid, 0, ComponentConfigurationDTO.ACTIVE);
+    }
+
+    /**
+     * same as test_SimpleComponent_factory_configuration except configurations are present before 
+     * component is enabled to test initialization.
+     */
+    @Test
+    public void test_SimpleComponent_factory_configuration_initialize()
+    {
+        final String factoryPid = "FactoryConfigurationComponent";
+
+        deleteFactoryConfigurations( factoryPid );
+
+        // create two factory configurations expecting two components
+        final String pid0 = createFactoryConfiguration( factoryPid );
+        final String pid1 = createFactoryConfiguration( factoryPid );
+        delay();
+
+        getConfigurationsDisabledThenEnable(factoryPid, 2, ComponentConfigurationDTO.ACTIVE);
 
         // delete a configuration
         deleteConfig( pid0 );
@@ -524,25 +533,12 @@
 
         // expect one component
         checkConfigurationCount(factoryPid, 1, ComponentConfigurationDTO.ACTIVE);
-//        final Component[] oneConfig = findComponentConfigurationsByName( factoryPid );
-//        TestCase.assertNotNull( oneConfig );
-//        TestCase.assertEquals( 1, oneConfig.length );
-//        TestCase.assertEquals( Component.STATE_ACTIVE, oneConfig[0].getState() );
-//        TestCase.assertEquals( 1, SimpleComponent.INSTANCES.size() );
-//        TestCase.assertTrue( SimpleComponent.INSTANCES.containsKey( oneConfig[0].getId() ) );
 
         // delete second configuration
         deleteConfig( pid1 );
         delay();
 
         checkConfigurationCount(factoryPid, 0, ComponentConfigurationDTO.ACTIVE);
-        // expect a single unsatisfied component
-//        final Component[] configsDeleted = findComponentConfigurationsByName( factoryPid );
-//        TestCase.assertNotNull( configsDeleted );
-//        TestCase.assertEquals( 1, configsDeleted.length );
-//        TestCase.assertEquals( Component.STATE_UNSATISFIED, configsDeleted[0].getState() );
-//        TestCase.assertEquals( 0, SimpleComponent.INSTANCES.size() );
-//        disableAndCheck(cd); //TODO needed??
     }
 
     @Test
@@ -568,67 +564,13 @@
         disableAndCheck( factoryPid );
         delay();
 
-        // expect no XXtwo disabled components
-//        checkConfigurationCount(factoryPid, 0, ComponentConfigurationDTO.ACTIVE);
-//        final Component[] twoConfigsDisabled = findComponentConfigurationsByName( factoryPid );
-//        TestCase.assertNotNull( twoConfigsDisabled );
-//        TestCase.assertEquals( 2, twoConfigsDisabled.length );
-//        TestCase.assertEquals( Component.STATE_DISABLED, twoConfigsDisabled[0].getState() );
-//        TestCase.assertEquals( Component.STATE_DISABLED, twoConfigsDisabled[1].getState() );
-//        TestCase.assertEquals( 0, SimpleComponent.INSTANCES.size() );
-//        TestCase.assertFalse( SimpleComponent.INSTANCES.containsKey( twoConfigs[0].getId() ) );
-//        TestCase.assertFalse( SimpleComponent.INSTANCES.containsKey( twoConfigs[1].getId() ) );
 
         // create a configuration
         final String pid3 = createFactoryConfiguration( factoryPid );
         delay();
 
-        // expect three disabled components
-//        checkConfigurationCount(factoryPid, 0, ComponentConfigurationDTO.ACTIVE);
-//        final Component[] threeConfigsDisabled = findComponentConfigurationsByName( factoryPid );
-//        TestCase.assertNotNull( threeConfigsDisabled );
-//        TestCase.assertEquals( 3, threeConfigsDisabled.length );
-//        TestCase.assertEquals( Component.STATE_DISABLED, threeConfigsDisabled[0].getState() );
-//        TestCase.assertEquals( Component.STATE_DISABLED, threeConfigsDisabled[1].getState() );
-//        TestCase.assertEquals( Component.STATE_DISABLED, threeConfigsDisabled[2].getState() );
-//        TestCase.assertEquals( 0, SimpleComponent.INSTANCES.size() );
-//        TestCase.assertFalse( SimpleComponent.INSTANCES.containsKey( threeConfigsDisabled[0].getId() ) );
-//        TestCase.assertFalse( SimpleComponent.INSTANCES.containsKey( threeConfigsDisabled[1].getId() ) );
-//        TestCase.assertFalse( SimpleComponent.INSTANCES.containsKey( threeConfigsDisabled[2].getId() ) );
-//disabled, no configurations.
-        getConfigurationsDisabledThenEnable(factoryPid, 0, ComponentConfigurationDTO.ACTIVE);
+        getConfigurationsDisabledThenEnable(factoryPid, 3, ComponentConfigurationDTO.ACTIVE);
         
-//        // enable a single component (to get ComponentContext later)
-//        threeConfigsDisabled[0].enable();
-//        delay();
-//
-//        // expect one enabled and two disabled components
-//        final Component[] threeConfigs21 = findComponentConfigurationsByName( factoryPid );
-//        TestCase.assertNotNull( threeConfigs21 );
-//        TestCase.assertEquals( 3, threeConfigs21.length );
-//        TestCase.assertEquals( 1, SimpleComponent.INSTANCES.size() );
-//        TestCase.assertEquals( Component.STATE_ACTIVE, threeConfigs21[0].getState() );
-//        TestCase.assertEquals( Component.STATE_DISABLED, threeConfigs21[1].getState() );
-//        TestCase.assertEquals( Component.STATE_DISABLED, threeConfigs21[2].getState() );
-//        TestCase.assertTrue( SimpleComponent.INSTANCES.containsKey( threeConfigs21[0].getId() ) );
-//        TestCase.assertFalse( SimpleComponent.INSTANCES.containsKey( threeConfigs21[1].getId() ) );
-//        TestCase.assertFalse( SimpleComponent.INSTANCES.containsKey( threeConfigs21[2].getId() ) );
-//
-//        // enable all components now
-//        SimpleComponent.INSTANCES.values().iterator().next().m_activateContext.enableComponent( factoryPid );
-//        delay();
-//
-//        // expect all enabled
-//        final Component[] threeConfigsEnabled = findComponentConfigurationsByName( factoryPid );
-//        TestCase.assertNotNull( threeConfigsEnabled );
-//        TestCase.assertEquals( 3, threeConfigsEnabled.length );
-//        TestCase.assertEquals( Component.STATE_ACTIVE, threeConfigsEnabled[0].getState() );
-//        TestCase.assertEquals( Component.STATE_ACTIVE, threeConfigsEnabled[1].getState() );
-//        TestCase.assertEquals( Component.STATE_ACTIVE, threeConfigsEnabled[2].getState() );
-//        TestCase.assertEquals( 3, SimpleComponent.INSTANCES.size() );
-//        TestCase.assertTrue( SimpleComponent.INSTANCES.containsKey( threeConfigsEnabled[0].getId() ) );
-//        TestCase.assertTrue( SimpleComponent.INSTANCES.containsKey( threeConfigsEnabled[1].getId() ) );
-//        TestCase.assertTrue( SimpleComponent.INSTANCES.containsKey( threeConfigsEnabled[2].getId() ) );
     }