FELIX-3086 Missing support for DS 1.1 "Character" type name plus unit test

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1164431 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/metadata/PropertyMetadata.java b/scr/src/main/java/org/apache/felix/scr/impl/metadata/PropertyMetadata.java
index e2c847d..a127d70 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/metadata/PropertyMetadata.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/metadata/PropertyMetadata.java
@@ -136,7 +136,8 @@
             }
             m_value = array;
         }
-        else if(m_type.equals("Char")) {
+        else if ( m_type.equals( "Char" ) || m_type.equals( "Character" ) ) {
+            // DS 1.1 changes the "Char" type to "Character", here we support both
             //TODO: verify if this is adequate for Characters
             char[] array = new char[valueList.size()];
             for (int i=0; i < array.length; i++) {
diff --git a/scr/src/test/java/org/apache/felix/scr/impl/metadata/XmlHandlerTest.java b/scr/src/test/java/org/apache/felix/scr/impl/metadata/XmlHandlerTest.java
index 7f7a5c9..bc307cd 100644
--- a/scr/src/test/java/org/apache/felix/scr/impl/metadata/XmlHandlerTest.java
+++ b/scr/src/test/java/org/apache/felix/scr/impl/metadata/XmlHandlerTest.java
@@ -427,4 +427,32 @@
         // none found
         return null;
     }
+
+    public void test_properties_11() throws Exception
+    {
+        final List metadataList11 = readMetadata( "/components_properties_11.xml" );
+        assertEquals( "Component Descriptors", 1, metadataList11.size() );
+        final ComponentMetadata cm11 = ( ComponentMetadata ) metadataList11.get( 0 );
+
+        // dont validate this, we test the raw reading
+
+        // ds namespace
+        assertEquals( "DS Version 1.1", XmlHandler.DS_VERSION_1_1, cm11.getNamespaceCode() );
+        assertTrue( "DS Version 1.1", cm11.isDS11() );
+
+        assertEquals( "component name", "DummyClass", cm11.getName() );
+        assertEquals( "component name", "DummyClass", cm11.getImplementationClassName() );
+
+        // property setting
+        final PropertyMetadata prop = getPropertyMetadata( cm11, "char_array_property" );
+        assertNotNull( "prop exists", prop );
+        assertEquals( "prop type", "Character", prop.getType() );
+        Object value = prop.getValue();
+        assertTrue( "prop arry", value instanceof char[] );
+        char[] chars = (char[]) value;
+        assertEquals( "prop number of values", 2, chars.length);
+        assertEquals( "prop value 0", 'a', chars[0] );
+        assertEquals( "prop value 1", 'b', chars[1] );
+    }
+
 }
diff --git a/scr/src/test/resources/components_properties_11.xml b/scr/src/test/resources/components_properties_11.xml
new file mode 100644
index 0000000..f4de438
--- /dev/null
+++ b/scr/src/test/resources/components_properties_11.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"> 
+  <implementation class="DummyClass" /> 
+  <property name="char_array_property" type="Character"> 
+    a 
+    b 
+  </property> 
+</scr:component>