You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cz...@apache.org on 2016/06/29 11:15:47 UTC

svn commit: r1750619 - in /felix/sandbox/cziegeler/configurator/src: main/java/org/apache/felix/configurator/impl/ main/java/org/apache/felix/configurator/impl/yaml/ test/java/org/apache/felix/configurator/impl/ test/java/org/apache/felix/configurator/...

Author: cziegeler
Date: Wed Jun 29 11:15:47 2016
New Revision: 1750619

URL: http://svn.apache.org/viewvc?rev=1750619&view=rev
Log:
Move type conversion into separate module

Added:
    felix/sandbox/cziegeler/configurator/src/main/java/org/apache/felix/configurator/impl/TypeConverter.java   (with props)
    felix/sandbox/cziegeler/configurator/src/test/java/org/apache/felix/configurator/impl/TypeConverterTest.java   (with props)
Modified:
    felix/sandbox/cziegeler/configurator/src/main/java/org/apache/felix/configurator/impl/yaml/YAMLUtil.java
    felix/sandbox/cziegeler/configurator/src/test/java/org/apache/felix/configurator/impl/yaml/YAMLUtilTest.java

Added: felix/sandbox/cziegeler/configurator/src/main/java/org/apache/felix/configurator/impl/TypeConverter.java
URL: http://svn.apache.org/viewvc/felix/sandbox/cziegeler/configurator/src/main/java/org/apache/felix/configurator/impl/TypeConverter.java?rev=1750619&view=auto
==============================================================================
--- felix/sandbox/cziegeler/configurator/src/main/java/org/apache/felix/configurator/impl/TypeConverter.java (added)
+++ felix/sandbox/cziegeler/configurator/src/main/java/org/apache/felix/configurator/impl/TypeConverter.java Wed Jun 29 11:15:47 2016
@@ -0,0 +1,242 @@
+/*
+ * 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.configurator.impl;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
+import org.apache.felix.converter.impl.ConverterService;
+import org.osgi.framework.Bundle;
+import org.osgi.service.converter.Converter;
+import org.osgi.service.converter.TypeReference;
+
+public class TypeConverter {
+
+    public static Converter getConverter() {
+        return new ConverterService(); // TODO use OSGi service
+    }
+
+    private final Bundle bundle;
+
+    /**
+     * Create a new instance
+     * @param bundle The bundle, might be {@code null}.
+     */
+    public TypeConverter(final Bundle bundle) {
+        this.bundle = bundle;
+    }
+
+    /**
+     * Convert a value to the given type
+     * @param value The value
+     * @param typeInfo Optional type info, might be {@code null}
+     * @return The converted value (never returns null)
+     * @throws IOException If an error happens
+     */
+    public Object convert(final Object value,
+            final Object defaultValue,
+            final String typeInfo) throws IOException {
+        if ( typeInfo == null ) {
+            if ( value instanceof String || value instanceof Boolean ) {
+                return value;
+            } else if ( value instanceof Long || value instanceof Double ) {
+                return value;
+            } else if ( value instanceof Integer ) {
+                return ((Integer)value).longValue();
+            } else if ( value instanceof Float ) {
+                return ((Float)value).doubleValue();
+            }
+            if ( value instanceof List ) {
+                @SuppressWarnings("unchecked")
+                final List<Object> list = (List<Object>)value;
+                if ( list.isEmpty() ) {
+                    return new String[0];
+                }
+                final Object firstObject = list.get(0);
+                if ( firstObject instanceof String ) {
+                    return getConverter().convert(list).defaultValue(defaultValue).to(String[].class);
+                } else if ( firstObject instanceof Boolean ) {
+                    return getConverter().convert(list).defaultValue(defaultValue).to(Boolean[].class);
+                } else if ( firstObject instanceof Long || firstObject instanceof Integer ) {
+                    return getConverter().convert(list).defaultValue(defaultValue).to(Long[].class);
+                } else if ( firstObject instanceof Double || firstObject instanceof Float ) {
+                    return getConverter().convert(list).defaultValue(defaultValue).to(Double[].class);
+                }
+            }
+            return defaultValue;
+        }
+
+        // binary
+        // TODO - keep track of files and delete them when configuration is UNINSTALLED/removed
+        if ( "binary".equals(typeInfo) ) {
+            if ( bundle == null ) {
+                throw new IOException("Binary files only allowed within a bundle");
+            }
+            final String path = getConverter().convert(value).defaultValue(null).to(String.class);
+            if ( path == null ) {
+                throw new IOException("Invalid path for binary property: " + value);
+            }
+            final File filePath = Util.extractFile(bundle, path);
+            if ( filePath == null ) {
+                throw new IOException("Invalid path for binary property: " + value);
+            }
+            return filePath.getAbsolutePath();
+
+        } else if ( "binary[]".equals(typeInfo) ) {
+            if ( bundle == null ) {
+                throw new IOException("Binary files only allowed within a bundle");
+            }
+            final String[] paths = getConverter().convert(value).defaultValue(null).to(String[].class);
+            if ( paths == null ) {
+                throw new IOException("Invalid paths for binary[] property: " + value);
+            }
+            final String[] filePaths = new String[paths.length];
+            int i = 0;
+            while ( i < paths.length ) {
+                final File filePath = Util.extractFile(bundle, paths[i]);
+                if ( filePath == null ) {
+                    throw new IOException("Invalid path for binary property: " + value);
+                }
+                filePaths[i] = filePath.getAbsolutePath();
+                i++;
+            }
+            return filePaths;
+        }
+
+        // scalar types and primitive types
+        if ( "String".equals(typeInfo) ) {
+            return getConverter().convert(value).defaultValue(defaultValue).to(String.class);
+
+        } else if ( "Integer".equals(typeInfo) || "int".equals(typeInfo) ) {
+            return getConverter().convert(value).defaultValue(defaultValue).to(Integer.class);
+
+        } else if ( "Long".equals(typeInfo) || "long".equals(typeInfo) ) {
+            return getConverter().convert(value).defaultValue(defaultValue).to(Long.class);
+
+        } else if ( "Float".equals(typeInfo) || "float".equals(typeInfo) ) {
+            return getConverter().convert(value).defaultValue(defaultValue).to(Float.class);
+
+        } else if ( "Double".equals(typeInfo) || "double".equals(typeInfo) ) {
+            return getConverter().convert(value).defaultValue(defaultValue).to(Double.class);
+
+        } else if ( "Byte".equals(typeInfo) || "byte".equals(typeInfo) ) {
+            return getConverter().convert(value).defaultValue(defaultValue).to(Byte.class);
+
+        } else if ( "Short".equals(typeInfo) || "short".equals(typeInfo) ) {
+            return getConverter().convert(value).defaultValue(defaultValue).to(Short.class);
+
+        } else if ( "Character".equals(typeInfo) || "char".equals(typeInfo) ) {
+            return getConverter().convert(value).defaultValue(defaultValue).to(Character.class);
+
+        } else if ( "Boolean".equals(typeInfo) || "boolean".equals(typeInfo) ) {
+            return getConverter().convert(value).defaultValue(defaultValue).to(Boolean.class);
+
+        }
+
+        // array of scalar types and primitive types
+        if ( "String[]".equals(typeInfo) ) {
+            return getConverter().convert(value).defaultValue(defaultValue).to(String[].class);
+
+        } else if ( "Integer[]".equals(typeInfo) ) {
+            return getConverter().convert(value).defaultValue(defaultValue).to(Integer[].class);
+
+        } else if ( "int[]".equals(typeInfo) ) {
+            return getConverter().convert(value).defaultValue(defaultValue).to(int[].class);
+
+        } else if ( "Long[]".equals(typeInfo) ) {
+            return getConverter().convert(value).defaultValue(defaultValue).to(Long[].class);
+
+        } else if ( "long[]".equals(typeInfo) ) {
+            return getConverter().convert(value).defaultValue(defaultValue).to(long[].class);
+
+        } else if ( "Float[]".equals(typeInfo)  ) {
+            return getConverter().convert(value).defaultValue(defaultValue).to(Float[].class);
+
+        } else if ( "float[]".equals(typeInfo)  ) {
+            return getConverter().convert(value).defaultValue(defaultValue).to(float[].class);
+
+        } else if ( "Double[]".equals(typeInfo)  ) {
+            return getConverter().convert(value).defaultValue(defaultValue).to(Double[].class);
+
+        } else if ( "double[]".equals(typeInfo)  ) {
+            return getConverter().convert(value).defaultValue(defaultValue).to(double[].class);
+
+        } else if ( "Byte[]".equals(typeInfo) ) {
+            return getConverter().convert(value).defaultValue(defaultValue).to(Byte[].class);
+
+        } else if ( "byte[]".equals(typeInfo) ) {
+            return getConverter().convert(value).defaultValue(defaultValue).to(byte[].class);
+
+        } else if ( "Short[]".equals(typeInfo)  ) {
+            return getConverter().convert(value).defaultValue(defaultValue).to(Short[].class);
+
+        } else if ( "short[]".equals(typeInfo)  ) {
+            return getConverter().convert(value).defaultValue(defaultValue).to(short[].class);
+
+        } else if ( "Character[]".equals(typeInfo) ) {
+            return getConverter().convert(value).defaultValue(defaultValue).to(Character[].class);
+
+        } else if ( "char[]".equals(typeInfo) ) {
+            return getConverter().convert(value).defaultValue(defaultValue).to(char[].class);
+
+        } else if ( "Boolean[]".equals(typeInfo) ) {
+            return getConverter().convert(value).defaultValue(defaultValue).to(Boolean[].class);
+
+        } else if ( "boolean[]".equals(typeInfo) ) {
+            return getConverter().convert(value).defaultValue(defaultValue).to(boolean[].class);
+        }
+
+        // Collections of scalar types
+        if ( "Collection<String>".equals(typeInfo) ) {
+            return getConverter().convert(value).defaultValue(defaultValue).to(new TypeReference<List<String>>() {});
+
+        } else if ( "Collection<Integer>".equals(typeInfo) ) {
+            return getConverter().convert(value).defaultValue(defaultValue).to(new TypeReference<List<Integer>>() {});
+
+        } else if ( "Collection<Long>".equals(typeInfo) ) {
+            return getConverter().convert(value).defaultValue(defaultValue).to(new TypeReference<List<Long>>() {});
+
+        } else if ( "Collection<Float>".equals(typeInfo)  ) {
+            return getConverter().convert(value).defaultValue(defaultValue).to(new TypeReference<List<Float>>() {});
+
+        } else if ( "Collection<Double>".equals(typeInfo)  ) {
+            return getConverter().convert(value).defaultValue(defaultValue).to(new TypeReference<List<Double>>() {});
+
+        } else if ( "Collection<Byte>".equals(typeInfo) ) {
+            return getConverter().convert(value).defaultValue(defaultValue).to(new TypeReference<List<Byte>>() {});
+
+        } else if ( "Collection<Short>".equals(typeInfo)  ) {
+            return getConverter().convert(value).defaultValue(defaultValue).to(new TypeReference<List<Short>>() {});
+
+        } else if ( "Collection<Character>".equals(typeInfo) ) {
+            return getConverter().convert(value).defaultValue(defaultValue).to(new TypeReference<List<Character>>() {});
+
+        } else if ( "Collection<Boolean>".equals(typeInfo) ) {
+            return getConverter().convert(value).defaultValue(defaultValue).to(new TypeReference<List<Boolean>>() {});
+        }
+
+        // unknown type - ignore configuration
+        throw new IOException("Invalid type information: " + typeInfo);
+    }
+
+    public void cleanupFiles() {
+        // TODO
+    }
+}

Propchange: felix/sandbox/cziegeler/configurator/src/main/java/org/apache/felix/configurator/impl/TypeConverter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: felix/sandbox/cziegeler/configurator/src/main/java/org/apache/felix/configurator/impl/TypeConverter.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision rev url

Modified: felix/sandbox/cziegeler/configurator/src/main/java/org/apache/felix/configurator/impl/yaml/YAMLUtil.java
URL: http://svn.apache.org/viewvc/felix/sandbox/cziegeler/configurator/src/main/java/org/apache/felix/configurator/impl/yaml/YAMLUtil.java?rev=1750619&r1=1750618&r2=1750619&view=diff
==============================================================================
--- felix/sandbox/cziegeler/configurator/src/main/java/org/apache/felix/configurator/impl/yaml/YAMLUtil.java (original)
+++ felix/sandbox/cziegeler/configurator/src/main/java/org/apache/felix/configurator/impl/yaml/YAMLUtil.java Wed Jun 29 11:15:47 2016
@@ -18,7 +18,6 @@
  */
 package org.apache.felix.configurator.impl.yaml;
 
-import java.io.File;
 import java.io.IOException;
 import java.io.StringReader;
 import java.net.URL;
@@ -31,15 +30,14 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import org.apache.felix.configurator.impl.TypeConverter;
 import org.apache.felix.configurator.impl.Util;
 import org.apache.felix.configurator.impl.logger.SystemLogger;
 import org.apache.felix.configurator.impl.model.BundleState;
 import org.apache.felix.configurator.impl.model.Config;
 import org.apache.felix.configurator.impl.model.ConfigPolicy;
 import org.apache.felix.configurator.impl.model.ConfigurationFile;
-import org.apache.felix.converter.impl.ConverterService;
 import org.osgi.framework.Bundle;
-import org.osgi.service.converter.Converter;
 import org.osgi.service.converter.TypeReference;
 import org.yaml.snakeyaml.DumperOptions;
 import org.yaml.snakeyaml.Yaml;
@@ -57,10 +55,6 @@ public class YAMLUtil {
 
     private static final String PROP_POLICY = "policy";
 
-    public static Converter getConverter() {
-        return new ConverterService(); // TODO use OSGi service
-    }
-
     public static BundleState readConfigurationsFromBundle(final Bundle bundle, final Set<String> paths) {
         final BundleState config = new BundleState();
 
@@ -95,9 +89,18 @@ public class YAMLUtil {
 
                 final String contents = Util.getResource(name, url);
                 if ( contents != null ) {
-                    final ConfigurationFile file = readYAML(bundle, name, url, bundle.getBundleId(), contents);
-                    if ( file != null ) {
-                        result.add(file);
+                    boolean done = false;
+                    final TypeConverter converter = new TypeConverter(bundle);
+                    try {
+                        final ConfigurationFile file = readYAML(converter, name, url, bundle.getBundleId(), contents);
+                        if ( file != null ) {
+                            result.add(file);
+                            done = true;
+                        }
+                    } finally {
+                        if ( !done ) {
+                            converter.cleanupFiles();
+                        }
                     }
                 }
             }
@@ -110,7 +113,7 @@ public class YAMLUtil {
 
     /**
      * Read a single YAML file
-     * @param bundle Optional bundle, might be {@code null}
+     * @param converter type converter
      * @param name The name of the file
      * @param url The url to that file or {@code null}
      * @param bundleId The bundle id of the bundle containing the file
@@ -118,7 +121,7 @@ public class YAMLUtil {
      * @return The configuration file or {@code null}.
      */
     public static ConfigurationFile readYAML(
-            final Bundle bundle,
+            final TypeConverter converter,
             final String name,
             final URL url,
             final long bundleId,
@@ -168,19 +171,19 @@ public class YAMLUtil {
                                 if ( internalKey ) {
                                     // no need to do type conversion based on typeInfo for internal props, type conversion is done directly below
                                     if ( key.equals(PROP_ENVIRONMENTS) ) {
-                                        environments = YAMLUtil.getConverter().convert(value).defaultValue(null).to(new TypeReference<Set<String>>() {});
+                                        environments = TypeConverter.getConverter().convert(value).defaultValue(null).to(new TypeReference<Set<String>>() {});
                                         if ( environments == null ) {
                                             SystemLogger.warning("Invalid environments for configuration in '" + identifier + "' : " + pid + " - " + value);
                                         }
                                     } else if ( key.equals(PROP_RANKING) ) {
-                                        final Integer intObj = YAMLUtil.getConverter().convert(value).defaultValue(null).to(Integer.class);
+                                        final Integer intObj = TypeConverter.getConverter().convert(value).defaultValue(null).to(Integer.class);
                                         if ( intObj == null ) {
                                             SystemLogger.warning("Invalid ranking for configuration in '" + identifier + "' : " + pid + " - " + value);
                                         } else {
                                             ranking = intObj.intValue();
                                         }
                                     } else if ( key.equals(PROP_POLICY) ) {
-                                        final String stringVal = YAMLUtil.getConverter().convert(value).defaultValue(null).to(String.class);
+                                        final String stringVal = TypeConverter.getConverter().convert(value).defaultValue(null).to(String.class);
                                         if ( stringVal == null ) {
                                             SystemLogger.error("Invalid policy for configuration in '" + identifier + "' : " + pid + " - " + value);
                                         } else {
@@ -193,7 +196,7 @@ public class YAMLUtil {
                                     }
                                 } else {
                                     try {
-                                        properties.put(key, convert(bundle, value, typeInfo));
+                                        properties.put(key, converter.convert(value, createYAML(value), typeInfo));
                                     } catch ( final IOException io ) {
                                         SystemLogger.error("Invalid value/type for configuration in '" + identifier + "' : " + pid + " - " + entry.getKey());
                                         valid = false;
@@ -218,201 +221,6 @@ public class YAMLUtil {
     }
 
     /**
-     * Convert a value to the given type
-     * @param bundle The bundle, might be {@code null}
-     * @param value The value
-     * @param typeInfo Optional type info, might be {@code null}
-     * @return The converted value (never returns null)
-     * @throws IOException If an error happens
-     */
-    public static Object convert(final Bundle bundle,
-            final Object value,
-            final String typeInfo) throws IOException {
-        final String yaml = createYAML(value);
-        if ( typeInfo == null ) {
-            if ( value instanceof String || value instanceof Boolean ) {
-                return value;
-            } else if ( value instanceof Long || value instanceof Double ) {
-                return value;
-            } else if ( value instanceof Integer ) {
-                return ((Integer)value).longValue();
-            } else if ( value instanceof Float ) {
-                return ((Float)value).doubleValue();
-            }
-            if ( value instanceof List ) {
-                @SuppressWarnings("unchecked")
-                final List<Object> list = (List<Object>)value;
-                if ( list.isEmpty() ) {
-                    return new String[0];
-                }
-                final Object firstObject = list.get(0);
-                if ( firstObject instanceof String ) {
-                    return getConverter().convert(list).defaultValue(yaml).to(String[].class);
-                } else if ( firstObject instanceof Boolean ) {
-                    return getConverter().convert(list).defaultValue(yaml).to(Boolean[].class);
-                } else if ( firstObject instanceof Long || firstObject instanceof Integer ) {
-                    return getConverter().convert(list).defaultValue(yaml).to(Long[].class);
-                } else if ( firstObject instanceof Double || firstObject instanceof Float ) {
-                    return getConverter().convert(list).defaultValue(yaml).to(Double[].class);
-                }
-            }
-            return yaml;
-        }
-
-        // binary
-        // TODO - keep track of files and delete them when configuration is UNINSTALLED/removed
-        if ( "binary".equals(typeInfo) ) {
-            if ( bundle == null ) {
-                throw new IOException("Binary files only allowed within a bundle");
-            }
-            final String path = getConverter().convert(value).defaultValue(null).to(String.class);
-            if ( path == null ) {
-                throw new IOException("Invalid path for binary property: " + value);
-            }
-            final File filePath = Util.extractFile(bundle, path);
-            if ( filePath == null ) {
-                throw new IOException("Invalid path for binary property: " + value);
-            }
-            return filePath.getAbsolutePath();
-
-        } else if ( "binary[]".equals(typeInfo) ) {
-            if ( bundle == null ) {
-                throw new IOException("Binary files only allowed within a bundle");
-            }
-            final String[] paths = getConverter().convert(value).defaultValue(null).to(String[].class);
-            if ( paths == null ) {
-                throw new IOException("Invalid paths for binary[] property: " + value);
-            }
-            final String[] filePaths = new String[paths.length];
-            int i = 0;
-            while ( i < paths.length ) {
-                final File filePath = Util.extractFile(bundle, paths[i]);
-                if ( filePath == null ) {
-                    throw new IOException("Invalid path for binary property: " + value);
-                }
-                filePaths[i] = filePath.getAbsolutePath();
-                i++;
-            }
-            return filePaths;
-        }
-
-        // scalar types and primitive types
-        if ( "String".equals(typeInfo) ) {
-            return getConverter().convert(value).defaultValue(yaml).to(String.class);
-
-        } else if ( "Integer".equals(typeInfo) || "int".equals(typeInfo) ) {
-            return getConverter().convert(value).defaultValue(yaml).to(Integer.class);
-
-        } else if ( "Long".equals(typeInfo) || "long".equals(typeInfo) ) {
-            return getConverter().convert(value).defaultValue(yaml).to(Long.class);
-
-        } else if ( "Float".equals(typeInfo) || "float".equals(typeInfo) ) {
-            return getConverter().convert(value).defaultValue(yaml).to(Float.class);
-
-        } else if ( "Double".equals(typeInfo) || "double".equals(typeInfo) ) {
-            return getConverter().convert(value).defaultValue(yaml).to(Double.class);
-
-        } else if ( "Byte".equals(typeInfo) || "byte".equals(typeInfo) ) {
-            return getConverter().convert(value).defaultValue(yaml).to(Byte.class);
-
-        } else if ( "Short".equals(typeInfo) || "short".equals(typeInfo) ) {
-            return getConverter().convert(value).defaultValue(yaml).to(Short.class);
-
-        } else if ( "Character".equals(typeInfo) || "char".equals(typeInfo) ) {
-            return getConverter().convert(value).defaultValue(yaml).to(Character.class);
-
-        } else if ( "Boolean".equals(typeInfo) || "boolean".equals(typeInfo) ) {
-            return getConverter().convert(value).defaultValue(yaml).to(Boolean.class);
-
-        }
-
-        // array of scalar types and primitive types
-        if ( "String[]".equals(typeInfo) ) {
-            return getConverter().convert(value).defaultValue(yaml).to(String[].class);
-
-        } else if ( "Integer[]".equals(typeInfo) ) {
-            return getConverter().convert(value).defaultValue(yaml).to(Integer[].class);
-
-        } else if ( "int[]".equals(typeInfo) ) {
-            return getConverter().convert(value).defaultValue(yaml).to(int[].class);
-
-        } else if ( "Long[]".equals(typeInfo) ) {
-            return getConverter().convert(value).defaultValue(yaml).to(Long[].class);
-
-        } else if ( "long[]".equals(typeInfo) ) {
-            return getConverter().convert(value).defaultValue(yaml).to(long[].class);
-
-        } else if ( "Float[]".equals(typeInfo)  ) {
-            return getConverter().convert(value).defaultValue(yaml).to(Float[].class);
-
-        } else if ( "float[]".equals(typeInfo)  ) {
-            return getConverter().convert(value).defaultValue(yaml).to(float[].class);
-
-        } else if ( "Double[]".equals(typeInfo)  ) {
-            return getConverter().convert(value).defaultValue(yaml).to(Double[].class);
-
-        } else if ( "double[]".equals(typeInfo)  ) {
-            return getConverter().convert(value).defaultValue(yaml).to(double[].class);
-
-        } else if ( "Byte[]".equals(typeInfo) ) {
-            return getConverter().convert(value).defaultValue(yaml).to(Byte[].class);
-
-        } else if ( "byte[]".equals(typeInfo) ) {
-            return getConverter().convert(value).defaultValue(yaml).to(byte[].class);
-
-        } else if ( "Short[]".equals(typeInfo)  ) {
-            return getConverter().convert(value).defaultValue(yaml).to(Short[].class);
-
-        } else if ( "short[]".equals(typeInfo)  ) {
-            return getConverter().convert(value).defaultValue(yaml).to(short[].class);
-
-        } else if ( "Character[]".equals(typeInfo) ) {
-            return getConverter().convert(value).defaultValue(yaml).to(Character[].class);
-
-        } else if ( "char[]".equals(typeInfo) ) {
-            return getConverter().convert(value).defaultValue(yaml).to(char[].class);
-
-        } else if ( "Boolean[]".equals(typeInfo) ) {
-            return getConverter().convert(value).defaultValue(yaml).to(Boolean[].class);
-
-        } else if ( "boolean[]".equals(typeInfo) ) {
-            return getConverter().convert(value).defaultValue(yaml).to(boolean[].class);
-        }
-
-        // Collections of scalar types
-        if ( "Collection<String>".equals(typeInfo) ) {
-            return getConverter().convert(value).defaultValue(yaml).to(new TypeReference<List<String>>() {});
-
-        } else if ( "Collection<Integer>".equals(typeInfo) ) {
-            return getConverter().convert(value).defaultValue(yaml).to(new TypeReference<List<Integer>>() {});
-
-        } else if ( "Collection<Long>".equals(typeInfo) ) {
-            return getConverter().convert(value).defaultValue(yaml).to(new TypeReference<List<Long>>() {});
-
-        } else if ( "Collection<Float>".equals(typeInfo)  ) {
-            return getConverter().convert(value).defaultValue(yaml).to(new TypeReference<List<Float>>() {});
-
-        } else if ( "Collection<Double>".equals(typeInfo)  ) {
-            return getConverter().convert(value).defaultValue(yaml).to(new TypeReference<List<Double>>() {});
-
-        } else if ( "Collection<Byte>".equals(typeInfo) ) {
-            return getConverter().convert(value).defaultValue(yaml).to(new TypeReference<List<Byte>>() {});
-
-        } else if ( "Collection<Short>".equals(typeInfo)  ) {
-            return getConverter().convert(value).defaultValue(yaml).to(new TypeReference<List<Short>>() {});
-
-        } else if ( "Collection<Character>".equals(typeInfo) ) {
-            return getConverter().convert(value).defaultValue(yaml).to(new TypeReference<List<Character>>() {});
-
-        } else if ( "Collection<Boolean>".equals(typeInfo) ) {
-            return getConverter().convert(value).defaultValue(yaml).to(new TypeReference<List<Boolean>>() {});
-        }
-
-        // unknown type - ignore configuration
-        throw new IOException("Invalid type information: " + typeInfo);
-    }
-
-    /**
      * Parse a YAML content
      * @param name The name of the file
      * @param contents The contents
@@ -461,7 +269,7 @@ public class YAMLUtil {
         final Object version = root.get(PROP_VERSION);
         if ( version != null ) {
 
-            final int v = getConverter().convert(version).defaultValue(-1).to(Integer.class);
+            final int v = TypeConverter.getConverter().convert(version).defaultValue(-1).to(Integer.class);
             if ( v == -1 ) {
                 SystemLogger.error("Invalid version information in " + name + " : " + version);
                 return null;

Added: felix/sandbox/cziegeler/configurator/src/test/java/org/apache/felix/configurator/impl/TypeConverterTest.java
URL: http://svn.apache.org/viewvc/felix/sandbox/cziegeler/configurator/src/test/java/org/apache/felix/configurator/impl/TypeConverterTest.java?rev=1750619&view=auto
==============================================================================
--- felix/sandbox/cziegeler/configurator/src/test/java/org/apache/felix/configurator/impl/TypeConverterTest.java (added)
+++ felix/sandbox/cziegeler/configurator/src/test/java/org/apache/felix/configurator/impl/TypeConverterTest.java Wed Jun 29 11:15:47 2016
@@ -0,0 +1,188 @@
+/*
+ * 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.configurator.impl;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.lang.reflect.Array;
+import java.util.Collection;
+import java.util.Map;
+
+import org.apache.felix.configurator.impl.yaml.YAMLUtil;
+import org.apache.felix.configurator.impl.yaml.YAMLUtilTest;
+import org.junit.Test;
+
+public class TypeConverterTest {
+
+    @Test public void testSimpleTypeConversions() throws Exception {
+        final TypeConverter converter = new TypeConverter(null);
+
+        final Object obj = YAMLUtil.parseYAML("a", YAMLUtilTest.readYAML("yaml/simple-types.yaml"));
+        @SuppressWarnings("unchecked")
+        final Map<String, Object> config = (Map<String, Object>)obj;
+        @SuppressWarnings("unchecked")
+        final Map<String, Object> properties = (Map<String, Object>)config.get("config");
+
+        assertTrue(converter.convert(properties.get("string"), null, null) instanceof String);
+        assertTrue(converter.convert(properties.get("boolean"), null, null) instanceof Boolean);
+        assertTrue(converter.convert(properties.get("number"), null, null) instanceof Long);
+        assertTrue(converter.convert(properties.get("float"), null, null) instanceof Double);
+
+        // arrays
+        assertTrue(converter.convert(properties.get("string.array"), null, null).getClass().isArray());
+        assertTrue(Array.get(converter.convert(properties.get("string.array"), null, null), 0) instanceof String);
+        assertTrue(Array.get(converter.convert(properties.get("string.array"), null, null), 1) instanceof String);
+
+        assertTrue(converter.convert(properties.get("boolean.array"), null, null).getClass().isArray());
+        assertTrue(Array.get(converter.convert(properties.get("boolean.array"), null, null), 0) instanceof Boolean);
+        assertTrue(Array.get(converter.convert(properties.get("boolean.array"), null, null), 1) instanceof Boolean);
+
+        assertTrue(converter.convert(properties.get("number.array"), null, null).getClass().isArray());
+        assertTrue(Array.get(converter.convert(properties.get("number.array"), null, null), 0) instanceof Long);
+        assertTrue(Array.get(converter.convert(properties.get("number.array"), null, null), 1) instanceof Long);
+
+        assertTrue(converter.convert(properties.get("float.array"), null, null).getClass().isArray());
+        assertTrue(Array.get(converter.convert(properties.get("float.array"), null, null), 0) instanceof Double);
+        assertTrue(Array.get(converter.convert(properties.get("float.array"), null, null), 1) instanceof Double);
+    }
+
+    @Test public void testSimpleTypeConversionsWithTypeHint() throws Exception {
+        final TypeConverter converter = new TypeConverter(null);
+
+        final Object obj = YAMLUtil.parseYAML("a", YAMLUtilTest.readYAML("yaml/simple-types.yaml"));
+        @SuppressWarnings("unchecked")
+        final Map<String, Object> config = (Map<String, Object>)obj;
+        @SuppressWarnings("unchecked")
+        final Map<String, Object> properties = (Map<String, Object>)config.get("config");
+
+        assertTrue(converter.convert(properties.get("string"), null, "String") instanceof String);
+        assertTrue(converter.convert(properties.get("boolean"), null, "Boolean") instanceof Boolean);
+        assertTrue(converter.convert(properties.get("boolean"), null, "boolean") instanceof Boolean);
+        assertTrue(converter.convert(properties.get("number"), null, "Integer") instanceof Integer);
+        assertTrue(converter.convert(properties.get("number"), null, "int") instanceof Integer);
+        assertTrue(converter.convert(properties.get("number"), null, "Long") instanceof Long);
+        assertTrue(converter.convert(properties.get("number"), null, "long") instanceof Long);
+        assertTrue(converter.convert(properties.get("float"), null, "Double") instanceof Double);
+        assertTrue(converter.convert(properties.get("float"), null, "double") instanceof Double);
+        assertTrue(converter.convert(properties.get("float"), null, "Float") instanceof Float);
+        assertTrue(converter.convert(properties.get("float"), null, "float") instanceof Float);
+        assertTrue(converter.convert(properties.get("number"), null, "Byte") instanceof Byte);
+        assertTrue(converter.convert(properties.get("number"), null, "byte") instanceof Byte);
+        assertTrue(converter.convert(properties.get("number"), null, "Short") instanceof Short);
+        assertTrue(converter.convert(properties.get("number"), null, "short") instanceof Short);
+        assertTrue(converter.convert(properties.get("string"), null, "Character") instanceof Character);
+        assertTrue(converter.convert(properties.get("string"), null, "char") instanceof Character);
+
+        // arrays
+        assertTrue(converter.convert(properties.get("string.array"), null, "String[]").getClass().isArray());
+        assertTrue(Array.get(converter.convert(properties.get("string.array"), null, "String[]"), 0) instanceof String);
+        assertTrue(Array.get(converter.convert(properties.get("string.array"), null, "String[]"), 1) instanceof String);
+
+        assertTrue(converter.convert(properties.get("boolean.array"), null, "Boolean[]").getClass().isArray());
+        assertTrue(Array.get(converter.convert(properties.get("boolean.array"), null, "Boolean[]"), 0) instanceof Boolean);
+        assertTrue(Array.get(converter.convert(properties.get("boolean.array"), null, "Boolean[]"), 1) instanceof Boolean);
+
+        // the following would throw class cast exceptions
+        boolean[] a0 = (boolean[])converter.convert(properties.get("boolean.array"), null, "boolean[]");
+        assertNotNull(a0);
+        int[] a1 = (int[])converter.convert(properties.get("number.array"), null, "int[]");
+        assertNotNull(a1);
+        long[] a2 = (long[])converter.convert(properties.get("number.array"), null, "long[]");
+        assertNotNull(a2);
+        double[] a3 = (double[])converter.convert(properties.get("float.array"), null, "double[]");
+        assertNotNull(a3);
+        float[] a4 = (float[])converter.convert(properties.get("float.array"), null, "float[]");
+        assertNotNull(a4);
+        byte[] a5 = (byte[])converter.convert(properties.get("number.array"), null, "byte[]");
+        assertNotNull(a5);
+        short[] a6 = (short[])converter.convert(properties.get("number.array"), null, "short[]");
+        assertNotNull(a6);
+        char[] a7 = (char[])converter.convert(properties.get("string.array"), null, "char[]");
+        assertNotNull(a7);
+
+        assertTrue(converter.convert(properties.get("number.array"), null, "Integer[]").getClass().isArray());
+        assertTrue(Array.get(converter.convert(properties.get("number.array"), null, "Integer[]"), 0) instanceof Integer);
+        assertTrue(Array.get(converter.convert(properties.get("number.array"), null, "Integer[]"), 1) instanceof Integer);
+
+        assertTrue(converter.convert(properties.get("number.array"), null, "Long[]").getClass().isArray());
+        assertTrue(Array.get(converter.convert(properties.get("number.array"), null, "Long[]"), 0) instanceof Long);
+        assertTrue(Array.get(converter.convert(properties.get("number.array"), null, "Long[]"), 1) instanceof Long);
+
+        assertTrue(converter.convert(properties.get("number.array"), null, "Byte[]").getClass().isArray());
+        assertTrue(Array.get(converter.convert(properties.get("number.array"), null, "Byte[]"), 0) instanceof Byte);
+        assertTrue(Array.get(converter.convert(properties.get("number.array"), null, "Byte[]"), 1) instanceof Byte);
+
+        assertTrue(converter.convert(properties.get("number.array"), null, "Short[]").getClass().isArray());
+        assertTrue(Array.get(converter.convert(properties.get("number.array"), null, "Short[]"), 0) instanceof Short);
+        assertTrue(Array.get(converter.convert(properties.get("number.array"), null, "Short[]"), 1) instanceof Short);
+
+        assertTrue(converter.convert(properties.get("float.array"), null, "Float[]").getClass().isArray());
+        assertTrue(Array.get(converter.convert(properties.get("float.array"), null, "Float[]"), 0) instanceof Float);
+        assertTrue(Array.get(converter.convert(properties.get("float.array"), null, "Float[]"), 1) instanceof Float);
+
+        assertTrue(converter.convert(properties.get("float.array"), null, "Double[]").getClass().isArray());
+        assertTrue(Array.get(converter.convert(properties.get("float.array"), null, "Double[]"), 0) instanceof Double);
+        assertTrue(Array.get(converter.convert(properties.get("float.array"), null, "Double[]"), 1) instanceof Double);
+
+        assertTrue(converter.convert(properties.get("string.array"), null, "Character[]").getClass().isArray());
+        assertTrue(Array.get(converter.convert(properties.get("string.array"), null, "Character[]"), 0) instanceof Character);
+        assertTrue(Array.get(converter.convert(properties.get("string.array"), null, "Character[]"), 1) instanceof Character);
+    }
+
+    @SuppressWarnings("unchecked")
+    @Test public void testCollectionTypeConversion() throws Exception {
+        final TypeConverter converter = new TypeConverter(null);
+        final Object obj = YAMLUtil.parseYAML("a", YAMLUtilTest.readYAML("yaml/simple-types.yaml"));
+        final Map<String, Object> config = (Map<String, Object>)obj;
+        final Map<String, Object> properties = (Map<String, Object>)config.get("config");
+
+        assertTrue(converter.convert(properties.get("string.array"), null, "Collection<String>") instanceof Collection<?>);
+        assertTrue(((Collection<String>)converter.convert(properties.get("string.array"), null, "Collection<String>")).iterator().next() instanceof String);
+
+        assertTrue(converter.convert(properties.get("number.array"), null, "Collection<Integer>") instanceof Collection<?>);
+        assertTrue(((Collection<Integer>)converter.convert(properties.get("number.array"), null, "Collection<Integer>")).iterator().next() instanceof Integer);
+
+        assertTrue(converter.convert(properties.get("number.array"), null, "Collection<Long>") instanceof Collection<?>);
+        // TODO the following check is currently failing due to a bug in the converter
+//        assertTrue(((Collection<Long>)converter.convert(properties.get("number.array"), null, "Collection<Long>")).iterator().next() instanceof Long);
+
+        assertTrue(converter.convert(properties.get("float.array"), null, "Collection<Float>") instanceof Collection<?>);
+        // TODO the following check is currently failing due to a bug in the converter
+//        assertTrue(((Collection<Float>)converter.convert(properties.get("float.array"), null, "Collection<Float>")).iterator().next() instanceof Float);
+
+        assertTrue(converter.convert(properties.get("float.array"), null, "Collection<Double>") instanceof Collection<?>);
+        assertTrue(((Collection<Double>)converter.convert(properties.get("float.array"), null, "Collection<Double>")).iterator().next() instanceof Double);
+
+        assertTrue(converter.convert(properties.get("number.array"), null, "Collection<Short>") instanceof Collection<?>);
+        // TODO the following check is currently failing due to a bug in the converter
+//        assertTrue(((Collection<Short>)converter.convert(properties.get("number.array"), null, "Collection<Short>")).iterator().next() instanceof Short);
+
+        assertTrue(converter.convert(properties.get("number.array"), null, "Collection<Byte>") instanceof Collection<?>);
+        // TODO the following check is currently failing due to a bug in the converter
+//        assertTrue(((Collection<Byte>)converter.convert(properties.get("number.array"), null, "Collection<Byte>")).iterator().next() instanceof Byte);
+
+        assertTrue(converter.convert(properties.get("string.array"), null, "Collection<Character>") instanceof Collection<?>);
+        // TODO the following check is currently failing due to a bug in the converter
+//        assertTrue(((Collection<Character>)converter.convert(properties.get("string.array"), null, "Collection<Character>")).iterator().next() instanceof Character);
+
+        assertTrue(converter.convert(properties.get("boolean.array"), null, "Collection<Boolean>") instanceof Collection<?>);
+        assertTrue(((Collection<Boolean>)converter.convert(properties.get("boolean.array"), null, "Collection<Boolean>")).iterator().next() instanceof Boolean);
+    }
+}

Propchange: felix/sandbox/cziegeler/configurator/src/test/java/org/apache/felix/configurator/impl/TypeConverterTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: felix/sandbox/cziegeler/configurator/src/test/java/org/apache/felix/configurator/impl/TypeConverterTest.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision rev url

Modified: felix/sandbox/cziegeler/configurator/src/test/java/org/apache/felix/configurator/impl/yaml/YAMLUtilTest.java
URL: http://svn.apache.org/viewvc/felix/sandbox/cziegeler/configurator/src/test/java/org/apache/felix/configurator/impl/yaml/YAMLUtilTest.java?rev=1750619&r1=1750618&r2=1750619&view=diff
==============================================================================
--- felix/sandbox/cziegeler/configurator/src/test/java/org/apache/felix/configurator/impl/yaml/YAMLUtilTest.java (original)
+++ felix/sandbox/cziegeler/configurator/src/test/java/org/apache/felix/configurator/impl/yaml/YAMLUtilTest.java Wed Jun 29 11:15:47 2016
@@ -20,17 +20,14 @@ package org.apache.felix.configurator.im
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
 
 import java.io.InputStreamReader;
 import java.io.Reader;
 import java.io.StringWriter;
 import java.io.Writer;
-import java.lang.reflect.Array;
 import java.net.URL;
-import java.util.Collection;
-import java.util.Map;
 
+import org.apache.felix.configurator.impl.TypeConverter;
 import org.apache.felix.configurator.impl.model.ConfigurationFile;
 import org.junit.Test;
 
@@ -53,158 +50,10 @@ public class YAMLUtilTest {
     }
 
     @Test public void testReadYAML() throws Exception {
-        final ConfigurationFile cg = YAMLUtil.readYAML(null, "a", new URL("http://a"), 1, readYAML("yaml/valid.yaml"));
+        final ConfigurationFile cg = YAMLUtil.readYAML(new TypeConverter(null),
+                "a", new URL("http://a"), 1, readYAML("yaml/valid.yaml"));
         assertNotNull(cg);
         assertEquals(2, cg.getConfigurations().size());
     }
 
-    @Test public void testSimpleTypeConversions() throws Exception {
-        final Object obj = YAMLUtil.parseYAML("a", readYAML("yaml/simple-types.yaml"));
-        @SuppressWarnings("unchecked")
-        final Map<String, Object> config = (Map<String, Object>)obj;
-        @SuppressWarnings("unchecked")
-        final Map<String, Object> properties = (Map<String, Object>)config.get("config");
-
-        assertTrue(YAMLUtil.convert(null, properties.get("string"), null) instanceof String);
-        assertTrue(YAMLUtil.convert(null, properties.get("boolean"), null) instanceof Boolean);
-        assertTrue(YAMLUtil.convert(null, properties.get("number"), null) instanceof Long);
-        assertTrue(YAMLUtil.convert(null, properties.get("float"), null) instanceof Double);
-
-        // arrays
-        assertTrue(YAMLUtil.convert(null, properties.get("string.array"), null).getClass().isArray());
-        assertTrue(Array.get(YAMLUtil.convert(null, properties.get("string.array"), null), 0) instanceof String);
-        assertTrue(Array.get(YAMLUtil.convert(null, properties.get("string.array"), null), 1) instanceof String);
-
-        assertTrue(YAMLUtil.convert(null, properties.get("boolean.array"), null).getClass().isArray());
-        assertTrue(Array.get(YAMLUtil.convert(null, properties.get("boolean.array"), null), 0) instanceof Boolean);
-        assertTrue(Array.get(YAMLUtil.convert(null, properties.get("boolean.array"), null), 1) instanceof Boolean);
-
-        assertTrue(YAMLUtil.convert(null, properties.get("number.array"), null).getClass().isArray());
-        assertTrue(Array.get(YAMLUtil.convert(null, properties.get("number.array"), null), 0) instanceof Long);
-        assertTrue(Array.get(YAMLUtil.convert(null, properties.get("number.array"), null), 1) instanceof Long);
-
-        assertTrue(YAMLUtil.convert(null, properties.get("float.array"), null).getClass().isArray());
-        assertTrue(Array.get(YAMLUtil.convert(null, properties.get("float.array"), null), 0) instanceof Double);
-        assertTrue(Array.get(YAMLUtil.convert(null, properties.get("float.array"), null), 1) instanceof Double);
-    }
-
-    @Test public void testSimpleTypeConversionsWithTypeHint() throws Exception {
-        final Object obj = YAMLUtil.parseYAML("a", readYAML("yaml/simple-types.yaml"));
-        @SuppressWarnings("unchecked")
-        final Map<String, Object> config = (Map<String, Object>)obj;
-        @SuppressWarnings("unchecked")
-        final Map<String, Object> properties = (Map<String, Object>)config.get("config");
-
-        assertTrue(YAMLUtil.convert(null, properties.get("string"), "String") instanceof String);
-        assertTrue(YAMLUtil.convert(null, properties.get("boolean"), "Boolean") instanceof Boolean);
-        assertTrue(YAMLUtil.convert(null, properties.get("boolean"), "boolean") instanceof Boolean);
-        assertTrue(YAMLUtil.convert(null, properties.get("number"), "Integer") instanceof Integer);
-        assertTrue(YAMLUtil.convert(null, properties.get("number"), "int") instanceof Integer);
-        assertTrue(YAMLUtil.convert(null, properties.get("number"), "Long") instanceof Long);
-        assertTrue(YAMLUtil.convert(null, properties.get("number"), "long") instanceof Long);
-        assertTrue(YAMLUtil.convert(null, properties.get("float"), "Double") instanceof Double);
-        assertTrue(YAMLUtil.convert(null, properties.get("float"), "double") instanceof Double);
-        assertTrue(YAMLUtil.convert(null, properties.get("float"), "Float") instanceof Float);
-        assertTrue(YAMLUtil.convert(null, properties.get("float"), "float") instanceof Float);
-        assertTrue(YAMLUtil.convert(null, properties.get("number"), "Byte") instanceof Byte);
-        assertTrue(YAMLUtil.convert(null, properties.get("number"), "byte") instanceof Byte);
-        assertTrue(YAMLUtil.convert(null, properties.get("number"), "Short") instanceof Short);
-        assertTrue(YAMLUtil.convert(null, properties.get("number"), "short") instanceof Short);
-        assertTrue(YAMLUtil.convert(null, properties.get("string"), "Character") instanceof Character);
-        assertTrue(YAMLUtil.convert(null, properties.get("string"), "char") instanceof Character);
-
-        // arrays
-        assertTrue(YAMLUtil.convert(null, properties.get("string.array"), "String[]").getClass().isArray());
-        assertTrue(Array.get(YAMLUtil.convert(null, properties.get("string.array"), "String[]"), 0) instanceof String);
-        assertTrue(Array.get(YAMLUtil.convert(null, properties.get("string.array"), "String[]"), 1) instanceof String);
-
-        assertTrue(YAMLUtil.convert(null, properties.get("boolean.array"), "Boolean[]").getClass().isArray());
-        assertTrue(Array.get(YAMLUtil.convert(null, properties.get("boolean.array"), "Boolean[]"), 0) instanceof Boolean);
-        assertTrue(Array.get(YAMLUtil.convert(null, properties.get("boolean.array"), "Boolean[]"), 1) instanceof Boolean);
-
-        // the following would throw class cast exceptions
-        boolean[] a0 = (boolean[])YAMLUtil.convert(null, properties.get("boolean.array"), "boolean[]");
-        assertNotNull(a0);
-        int[] a1 = (int[])YAMLUtil.convert(null, properties.get("number.array"), "int[]");
-        assertNotNull(a1);
-        long[] a2 = (long[])YAMLUtil.convert(null, properties.get("number.array"), "long[]");
-        assertNotNull(a2);
-        double[] a3 = (double[])YAMLUtil.convert(null, properties.get("float.array"), "double[]");
-        assertNotNull(a3);
-        float[] a4 = (float[])YAMLUtil.convert(null, properties.get("float.array"), "float[]");
-        assertNotNull(a4);
-        byte[] a5 = (byte[])YAMLUtil.convert(null, properties.get("number.array"), "byte[]");
-        assertNotNull(a5);
-        short[] a6 = (short[])YAMLUtil.convert(null, properties.get("number.array"), "short[]");
-        assertNotNull(a6);
-        char[] a7 = (char[])YAMLUtil.convert(null, properties.get("string.array"), "char[]");
-        assertNotNull(a7);
-
-        assertTrue(YAMLUtil.convert(null, properties.get("number.array"), "Integer[]").getClass().isArray());
-        assertTrue(Array.get(YAMLUtil.convert(null, properties.get("number.array"), "Integer[]"), 0) instanceof Integer);
-        assertTrue(Array.get(YAMLUtil.convert(null, properties.get("number.array"), "Integer[]"), 1) instanceof Integer);
-
-        assertTrue(YAMLUtil.convert(null, properties.get("number.array"), "Long[]").getClass().isArray());
-        assertTrue(Array.get(YAMLUtil.convert(null, properties.get("number.array"), "Long[]"), 0) instanceof Long);
-        assertTrue(Array.get(YAMLUtil.convert(null, properties.get("number.array"), "Long[]"), 1) instanceof Long);
-
-        assertTrue(YAMLUtil.convert(null, properties.get("number.array"), "Byte[]").getClass().isArray());
-        assertTrue(Array.get(YAMLUtil.convert(null, properties.get("number.array"), "Byte[]"), 0) instanceof Byte);
-        assertTrue(Array.get(YAMLUtil.convert(null, properties.get("number.array"), "Byte[]"), 1) instanceof Byte);
-
-        assertTrue(YAMLUtil.convert(null, properties.get("number.array"), "Short[]").getClass().isArray());
-        assertTrue(Array.get(YAMLUtil.convert(null, properties.get("number.array"), "Short[]"), 0) instanceof Short);
-        assertTrue(Array.get(YAMLUtil.convert(null, properties.get("number.array"), "Short[]"), 1) instanceof Short);
-
-        assertTrue(YAMLUtil.convert(null, properties.get("float.array"), "Float[]").getClass().isArray());
-        assertTrue(Array.get(YAMLUtil.convert(null, properties.get("float.array"), "Float[]"), 0) instanceof Float);
-        assertTrue(Array.get(YAMLUtil.convert(null, properties.get("float.array"), "Float[]"), 1) instanceof Float);
-
-        assertTrue(YAMLUtil.convert(null, properties.get("float.array"), "Double[]").getClass().isArray());
-        assertTrue(Array.get(YAMLUtil.convert(null, properties.get("float.array"), "Double[]"), 0) instanceof Double);
-        assertTrue(Array.get(YAMLUtil.convert(null, properties.get("float.array"), "Double[]"), 1) instanceof Double);
-
-        assertTrue(YAMLUtil.convert(null, properties.get("string.array"), "Character[]").getClass().isArray());
-        assertTrue(Array.get(YAMLUtil.convert(null, properties.get("string.array"), "Character[]"), 0) instanceof Character);
-        assertTrue(Array.get(YAMLUtil.convert(null, properties.get("string.array"), "Character[]"), 1) instanceof Character);
-    }
-
-    @SuppressWarnings("unchecked")
-    @Test public void testCollectionTypeConversion() throws Exception {
-        final Object obj = YAMLUtil.parseYAML("a", readYAML("yaml/simple-types.yaml"));
-        final Map<String, Object> config = (Map<String, Object>)obj;
-        final Map<String, Object> properties = (Map<String, Object>)config.get("config");
-
-        assertTrue(YAMLUtil.convert(null, properties.get("string.array"), "Collection<String>") instanceof Collection<?>);
-        assertTrue(((Collection<String>)YAMLUtil.convert(null, properties.get("string.array"), "Collection<String>")).iterator().next() instanceof String);
-
-        assertTrue(YAMLUtil.convert(null, properties.get("number.array"), "Collection<Integer>") instanceof Collection<?>);
-        assertTrue(((Collection<Integer>)YAMLUtil.convert(null, properties.get("number.array"), "Collection<Integer>")).iterator().next() instanceof Integer);
-
-        assertTrue(YAMLUtil.convert(null, properties.get("number.array"), "Collection<Long>") instanceof Collection<?>);
-        // TODO the following check is currently failing due to a bug in the converter
-//        assertTrue(((Collection<Long>)YAMLUtil.convert(null, properties.get("number.array"), "Collection<Long>")).iterator().next() instanceof Long);
-
-        assertTrue(YAMLUtil.convert(null, properties.get("float.array"), "Collection<Float>") instanceof Collection<?>);
-        // TODO the following check is currently failing due to a bug in the converter
-//        assertTrue(((Collection<Float>)YAMLUtil.convert(null, properties.get("float.array"), "Collection<Float>")).iterator().next() instanceof Float);
-
-        assertTrue(YAMLUtil.convert(null, properties.get("float.array"), "Collection<Double>") instanceof Collection<?>);
-        assertTrue(((Collection<Double>)YAMLUtil.convert(null, properties.get("float.array"), "Collection<Double>")).iterator().next() instanceof Double);
-
-        assertTrue(YAMLUtil.convert(null, properties.get("number.array"), "Collection<Short>") instanceof Collection<?>);
-        // TODO the following check is currently failing due to a bug in the converter
-//        assertTrue(((Collection<Short>)YAMLUtil.convert(null, properties.get("number.array"), "Collection<Short>")).iterator().next() instanceof Short);
-
-        assertTrue(YAMLUtil.convert(null, properties.get("number.array"), "Collection<Byte>") instanceof Collection<?>);
-        // TODO the following check is currently failing due to a bug in the converter
-//        assertTrue(((Collection<Byte>)YAMLUtil.convert(null, properties.get("number.array"), "Collection<Byte>")).iterator().next() instanceof Byte);
-
-        assertTrue(YAMLUtil.convert(null, properties.get("string.array"), "Collection<Character>") instanceof Collection<?>);
-        // TODO the following check is currently failing due to a bug in the converter
-//        assertTrue(((Collection<Character>)YAMLUtil.convert(null, properties.get("string.array"), "Collection<Character>")).iterator().next() instanceof Character);
-
-        assertTrue(YAMLUtil.convert(null, properties.get("boolean.array"), "Collection<Boolean>") instanceof Collection<?>);
-        assertTrue(((Collection<Boolean>)YAMLUtil.convert(null, properties.get("boolean.array"), "Collection<Boolean>")).iterator().next() instanceof Boolean);
-    }
-}
+}
\ No newline at end of file