FELIX-1284 unit tests for new "modified" attribute
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@792486 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/scr/src/test/java/org/apache/felix/scr/impl/ComponentMetadataTest.java b/scr/src/test/java/org/apache/felix/scr/impl/ComponentMetadataTest.java
index 3d2bad8..e41ef22 100644
--- a/scr/src/test/java/org/apache/felix/scr/impl/ComponentMetadataTest.java
+++ b/scr/src/test/java/org/apache/felix/scr/impl/ComponentMetadataTest.java
@@ -302,7 +302,7 @@
assertEquals( "Deactivate method name", "deactivate", cm1.getDeactivate() );
final ComponentMetadata cm2 = createComponentMetadata( Boolean.TRUE, null );
- cm2.setActivate( "someMethod" );
+ cm2.setDeactivate( "someMethod" );
cm2.validate( logger );
assertEquals( "Deactivate method name", "deactivate", cm2.getDeactivate() );
}
@@ -321,6 +321,32 @@
}
+ public void test_component_modified_ds10()
+ {
+ final ComponentMetadata cm1 = createComponentMetadata( Boolean.TRUE, null );
+ cm1.validate( logger );
+ assertNull( "Modified method name", cm1.getModified() );
+
+ final ComponentMetadata cm2 = createComponentMetadata( Boolean.TRUE, null );
+ cm2.setModified( "someName" );
+ cm2.validate( logger );
+ assertNull( "Modified method name", cm2.getModified() );
+ }
+
+
+ public void test_component_modified_ds11()
+ {
+ final ComponentMetadata cm1 = createComponentMetadata11( Boolean.TRUE, null );
+ cm1.validate( logger );
+ assertNull( "Modified method name", cm1.getModified() );
+
+ final ComponentMetadata cm2 = createComponentMetadata11( Boolean.TRUE, null );
+ cm2.setModified( "someMethod" );
+ cm2.validate( logger );
+ assertEquals( "Modified method name", "someMethod", cm2.getModified() );
+ }
+
+
public void test_component_configuration_policy_ds10()
{
final ComponentMetadata cm1 = createComponentMetadata( Boolean.TRUE, null );
diff --git a/scr/src/test/java/org/apache/felix/scr/impl/XmlHandlerTest.java b/scr/src/test/java/org/apache/felix/scr/impl/XmlHandlerTest.java
index c823a70..8cc0438 100644
--- a/scr/src/test/java/org/apache/felix/scr/impl/XmlHandlerTest.java
+++ b/scr/src/test/java/org/apache/felix/scr/impl/XmlHandlerTest.java
@@ -55,6 +55,7 @@
assertEquals( "DS Version 1.0", XmlHandler.DS_VERSION_1_0, cm10.getNamespaceCode() );
assertEquals( "Expected Activate Method not set", "activate", cm10.getActivate() );
assertEquals( "Expected Deactivate Method not set", "deactivate", cm10.getDeactivate() );
+ assertNull( "Expected Modified Method not set", cm10.getModified() );
assertEquals( "Expected Configuration Policy not set", ComponentMetadata.CONFIGURATION_POLICY_OPTIONAL, cm10
.getConfigurationPolicy() );
@@ -65,6 +66,7 @@
assertEquals( "DS Version 1.1", XmlHandler.DS_VERSION_1_1, cm11.getNamespaceCode() );
assertEquals( "Expected Activate Method set", "myactivate", cm11.getActivate() );
assertEquals( "Expected Deactivate Method set", "mydeactivate", cm11.getDeactivate() );
+ assertEquals( "Expected Modified Method set", "mymodified", cm11.getModified() );
assertEquals( "Expected Configuration Policy set", ComponentMetadata.CONFIGURATION_POLICY_IGNORE, cm11
.getConfigurationPolicy() );
}
@@ -137,6 +139,7 @@
// ds 1.1 elements
assertEquals( "activate method", "myactivate", cm10.getActivate() );
assertEquals( "deactivate method", "mydeactivate", cm10.getDeactivate() );
+ assertEquals( "modified method", "mymodified", cm10.getModified() );
assertEquals( "configuration policy", "ignore", cm10.getConfigurationPolicy() );
// from the implementation element
diff --git a/scr/src/test/resources/components_activate_10.xml b/scr/src/test/resources/components_activate_10.xml
index 2c754b5..3da1344 100644
--- a/scr/src/test/resources/components_activate_10.xml
+++ b/scr/src/test/resources/components_activate_10.xml
@@ -19,7 +19,7 @@
-->
<components>
<scr:component name="components.activate.10"
- activate="myactivate" deactivate="mydeactivate"
+ activate="myactivate" deactivate="mydeactivate" modified="mymodified"
configuration-policy="ignore" xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0">
<implementation class="components.activate.10" />
</scr:component>
diff --git a/scr/src/test/resources/components_activate_11.xml b/scr/src/test/resources/components_activate_11.xml
index b046ea6..258f2cc 100644
--- a/scr/src/test/resources/components_activate_11.xml
+++ b/scr/src/test/resources/components_activate_11.xml
@@ -19,7 +19,7 @@
-->
<components>
<scr:component name="components.activate.11"
- activate="myactivate" deactivate="mydeactivate"
+ activate="myactivate" deactivate="mydeactivate" modified="mymodified"
configuration-policy="ignore" xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0">
<implementation class="components.activate.11" />
</scr:component>
diff --git a/scr/src/test/resources/components_all_elements_10.xml b/scr/src/test/resources/components_all_elements_10.xml
index 0587053..dee4837 100644
--- a/scr/src/test/resources/components_all_elements_10.xml
+++ b/scr/src/test/resources/components_all_elements_10.xml
@@ -46,6 +46,7 @@
activate="myactivate"
deactivate="mydeactivate"
+ modified="mymodified"
configuration-policy="ignore"
>