[FELIX-4022] Implement spec compliant behavior for pre and post 1.3 with a flag to get reasonable behavior pre-1.3.  Question is whether deleting a config calls modify(1.3) or deactivates(pre 1.3)

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1591423 13f79535-47bb-0310-9956-ffa450edef68
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 749495b..6483df3 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
@@ -183,7 +183,29 @@
     public void test_SimpleComponent_dynamic_configuration()
     {
         final String pid = "DynamicConfigurationComponent";
-        final Component component = findComponentByName( pid );
+        boolean pre13 = true;
+        dynamicConfigTest(pid, pre13);
+    }
+
+    @Test
+    public void test_SimpleComponent_dynamic_configuration_13()
+    {
+        final String pid = "DynamicConfigurationComponent13";
+        boolean pre13 = false;
+        dynamicConfigTest(pid, pre13);
+    }
+    
+    @Test
+    public void test_SimpleComponent_dynamic_configuration_flag()
+    {
+        final String pid = "DynamicConfigurationComponentFlag";
+        boolean pre13 = false;
+        dynamicConfigTest(pid, pre13);
+    }
+
+
+	private void dynamicConfigTest(final String pid, boolean pre13) {
+		final Component component = findComponentByName( pid );
 
         deleteConfig( pid );
         delay();
@@ -216,7 +238,14 @@
         delay();
 
         TestCase.assertEquals( Component.STATE_ACTIVE, component.getState() );
-        TestCase.assertSame( instance, SimpleComponent.INSTANCE );
+        if (pre13)
+        {
+            TestCase.assertNotSame( instance, SimpleComponent.INSTANCE );
+        }
+        else
+        {
+            TestCase.assertSame( instance, SimpleComponent.INSTANCE );
+        }
         TestCase.assertNull( SimpleComponent.INSTANCE.getProperty( PROP_NAME ) );
         TestCase.assertEquals( pid, SimpleComponent.INSTANCE.getProperty( Constants.SERVICE_PID ) );
 
@@ -225,7 +254,7 @@
 
         TestCase.assertEquals( Component.STATE_DISABLED, component.getState() );
         TestCase.assertNull( SimpleComponent.INSTANCE );
-    }
+	}
 
 
     @Test
@@ -486,7 +515,7 @@
 
             // optional ref missing --> component active
             TestCase.assertEquals( Component.STATE_ACTIVE, component.getState() );
-            TestCase.assertEquals( instance, SimpleComponent.INSTANCE );
+            TestCase.assertNotSame( instance, SimpleComponent.INSTANCE );
             TestCase.assertNull( SimpleComponent.INSTANCE.m_singleRef );
 
             component.disable();
diff --git a/scr/src/test/resources/integration_test_simple_components.xml b/scr/src/test/resources/integration_test_simple_components.xml
index 07de31a..86a784b 100644
--- a/scr/src/test/resources/integration_test_simple_components.xml
+++ b/scr/src/test/resources/integration_test_simple_components.xml
@@ -50,6 +50,19 @@
         <property name="service.pid" value="DynamicConfigurationComponent" />
     </scr:component>
 
+    <scr13:component xmlns:scr13="http://www.osgi.org/xmlns/scr/v1.3.0" name="DynamicConfigurationComponent13"
+        enabled="false" modified="configure">
+        <implementation class="org.apache.felix.scr.integration.components.SimpleComponent" />
+        <property name="service.pid" value="DynamicConfigurationComponent13" />
+    </scr13:component>
+
+    <scr:component xmlns:felix="http://felix.apache.org/xmlns/scr/extensions/v1.0.0" name="DynamicConfigurationComponentFlag"
+        enabled="false" modified="configure"
+        felix:deleteCallsModify="true">
+        <implementation class="org.apache.felix.scr.integration.components.SimpleComponent" />
+        <property name="service.pid" value="DynamicConfigurationComponentFlag" />
+    </scr:component>
+
     <!-- component dynamically updates configuration with a required reference plus target-->
     <scr:component name="DynamicConfigurationComponentWithRequiredReference"
         enabled="false" modified="configure">