felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject svn commit: r1790554 - in /felix/trunk/converter/converter/src/test/java/org/apache/felix/converter/impl: ConverterTest.java PrefixEnumAnnotation.java
Date Fri, 07 Apr 2017 13:44:02 GMT
Author: davidb
Date: Fri Apr  7 13:44:02 2017
New Revision: 1790554

URL: http://svn.apache.org/viewvc?rev=1790554&view=rev
Log:
Additional annotation conversion test.

Added:
    felix/trunk/converter/converter/src/test/java/org/apache/felix/converter/impl/PrefixEnumAnnotation.java
Modified:
    felix/trunk/converter/converter/src/test/java/org/apache/felix/converter/impl/ConverterTest.java

Modified: felix/trunk/converter/converter/src/test/java/org/apache/felix/converter/impl/ConverterTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/converter/converter/src/test/java/org/apache/felix/converter/impl/ConverterTest.java?rev=1790554&r1=1790553&r2=1790554&view=diff
==============================================================================
--- felix/trunk/converter/converter/src/test/java/org/apache/felix/converter/impl/ConverterTest.java
(original)
+++ felix/trunk/converter/converter/src/test/java/org/apache/felix/converter/impl/ConverterTest.java
Fri Apr  7 13:44:02 2017
@@ -949,6 +949,19 @@ public class ConverterTest {
         assertEquals(expected, m2);
     }
 
+    @Test
+    public void testPrefixEnumAnnotation() {
+        PrefixEnumAnnotation pea = converter.convert(Collections.emptyMap()).to(PrefixEnumAnnotation.class);
+
+        assertEquals(1000, pea.timeout());
+        assertEquals(PrefixEnumAnnotation.Type.SINGLE, pea.type());
+
+        @SuppressWarnings("rawtypes")
+        Map m = converter.convert(pea).to(Map.class);
+        assertEquals(1000L, m.get("com.acme.config.timeout"));
+        assertEquals(PrefixEnumAnnotation.Type.SINGLE, m.get("com.acme.config.type"));
+    }
+
     static class MyClass2 {
         private final String value;
         public MyClass2(String v) {

Added: felix/trunk/converter/converter/src/test/java/org/apache/felix/converter/impl/PrefixEnumAnnotation.java
URL: http://svn.apache.org/viewvc/felix/trunk/converter/converter/src/test/java/org/apache/felix/converter/impl/PrefixEnumAnnotation.java?rev=1790554&view=auto
==============================================================================
--- felix/trunk/converter/converter/src/test/java/org/apache/felix/converter/impl/PrefixEnumAnnotation.java
(added)
+++ felix/trunk/converter/converter/src/test/java/org/apache/felix/converter/impl/PrefixEnumAnnotation.java
Fri Apr  7 13:44:02 2017
@@ -0,0 +1,10 @@
+package org.apache.felix.converter.impl;
+
+public @interface PrefixEnumAnnotation {
+    static final String PREFIX_ = "com.acme.config.";
+
+    enum Type { SINGLE, MULTI };
+
+    long timeout() default 1000L;
+    Type type() default Type.SINGLE;
+}



Mime
View raw message