You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tamaya.apache.org by pl...@apache.org on 2016/09/06 17:18:23 UTC

[27/50] [abbrv] incubator-tamaya-sandbox git commit: Moved collections module into active modules folder.

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/c9e965a2/collections/src/test/java/org/apache/tamaya/collections/CollectionsTypedTests.java
----------------------------------------------------------------------
diff --git a/collections/src/test/java/org/apache/tamaya/collections/CollectionsTypedTests.java b/collections/src/test/java/org/apache/tamaya/collections/CollectionsTypedTests.java
deleted file mode 100644
index b4e4d52..0000000
--- a/collections/src/test/java/org/apache/tamaya/collections/CollectionsTypedTests.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * 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.tamaya.collections;
-
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.ConfigurationProvider;
-import org.apache.tamaya.TypeLiteral;
-import org.junit.Test;
-
-import java.util.*;
-
-import static junit.framework.TestCase.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-/**
- * Basic tests for Tamaya collection support. Relevant configs for this tests:
- * <pre>base.items=1,2,3,4,5,6,7,8,9,0
- * base.map=1::a, 2::b, 3::c, [4:: ]
- * </pre>
- */
-public class CollectionsTypedTests {
-
-    @Test
-    public void testArrayListList_String(){
-        Configuration config = ConfigurationProvider.getConfiguration();
-        List<String> items = config.get("typed2.arraylist", new TypeLiteral<List<String>>(){});
-        assertNotNull(items);
-        assertFalse(items.isEmpty());
-        assertEquals(10, items.size());
-        assertTrue(items instanceof ArrayList);
-        items = (List<String>) config.get("typed2.arraylist", List.class);
-        assertNotNull(items);
-        assertFalse(items.isEmpty());
-        assertEquals(10, items.size());
-        assertTrue(items instanceof ArrayList);
-    }
-
-    @Test
-    public void testLinkedListList_String(){
-        Configuration config = ConfigurationProvider.getConfiguration();
-        List<String> items = config.get("typed2.linkedlist", new TypeLiteral<List<String>>(){});
-        assertNotNull(items);
-        assertFalse(items.isEmpty());
-        assertEquals(10, items.size());
-        assertTrue(items instanceof LinkedList);
-        items = (List<String>) config.get("typed2.linkedlist", List.class);
-        assertNotNull(items);
-        assertFalse(items.isEmpty());
-        assertEquals(10, items.size());
-        assertTrue(items instanceof LinkedList);
-    }
-
-
-    @Test
-    public void testHashSet_String(){
-        Configuration config = ConfigurationProvider.getConfiguration();
-        Set<String> items = config.get("typed2.hashset", new TypeLiteral<Set<String>>(){});
-        assertNotNull(items);
-        assertFalse(items.isEmpty());
-        assertEquals(10, items.size());
-        assertTrue(items instanceof HashSet);
-        items = (Set<String>) config.get("typed2.hashset", Set.class);
-        assertNotNull(items);
-        assertFalse(items.isEmpty());
-        assertEquals(10, items.size());
-        assertTrue(items instanceof HashSet);
-    }
-
-    @Test
-    public void testTreeSet_String(){
-        Configuration config = ConfigurationProvider.getConfiguration();
-        Set<String> items = config.get("typed2.treeset", new TypeLiteral<Set<String>>(){});
-        assertNotNull(items);
-        assertFalse(items.isEmpty());
-        assertEquals(10, items.size());
-        assertTrue(items instanceof TreeSet);
-        items = (Set<String>) config.get("typed2.treeset", Set.class);
-        assertNotNull(items);
-        assertFalse(items.isEmpty());
-        assertEquals(10, items.size());
-        assertTrue(items instanceof TreeSet);
-    }
-
-    @Test
-    public void testHashMap_String(){
-        Configuration config = ConfigurationProvider.getConfiguration();
-        Map<String,String> items = config.get("typed2.hashmap", new TypeLiteral<Map<String,String>>(){});
-        assertNotNull(items);
-        assertFalse(items.isEmpty());
-        assertEquals(4, items.size());
-        assertEquals("a", items.get("1"));
-        assertEquals("b", items.get("2"));
-        assertEquals("c", items.get("3"));
-        assertEquals(" ", items.get("4"));
-        assertTrue(items instanceof HashMap);
-        items = (Map<String,String>) config.get("typed2.hashmap", Map.class);
-        assertNotNull(items);
-        assertFalse(items.isEmpty());
-        assertEquals(4, items.size());
-        assertEquals("a", items.get("1"));
-        assertEquals("b", items.get("2"));
-        assertEquals("c", items.get("3"));
-        assertEquals(" ", items.get("4"));
-        assertTrue(items instanceof HashMap);
-    }
-
-    @Test
-    public void testTreeMap_String(){
-        Configuration config = ConfigurationProvider.getConfiguration();
-        Map<String,String> items = config.get("typed2.treemap", new TypeLiteral<Map<String,String>>(){});
-        assertNotNull(items);
-        assertFalse(items.isEmpty());
-        assertEquals(4, items.size());
-        assertEquals("a", items.get("1"));
-        assertEquals("b", items.get("2"));
-        assertEquals("c", items.get("3"));
-        assertEquals(" ", items.get("4"));
-        assertTrue(items instanceof TreeMap);
-        items = (Map<String,String>) config.get("typed2.treemap", Map.class);
-        assertNotNull(items);
-        assertFalse(items.isEmpty());
-        assertEquals(4, items.size());
-        assertEquals("a", items.get("1"));
-        assertEquals("b", items.get("2"));
-        assertEquals("c", items.get("3"));
-        assertEquals(" ", items.get("4"));
-        assertTrue(items instanceof TreeMap);
-    }
-
-    @Test
-    public void testCollection_HashSet(){
-        Configuration config = ConfigurationProvider.getConfiguration();
-        Collection<String> items = config.get("typed2.hashset", new TypeLiteral<Collection<String>>(){});
-        assertNotNull(items);
-        assertFalse(items.isEmpty());
-        assertEquals(10, items.size());
-        assertTrue(items instanceof HashSet);
-        items = (Collection<String>) config.get("typed2.hashset", Collection.class);
-        assertNotNull(items);
-        assertFalse(items.isEmpty());
-        assertEquals(10, items.size());
-        assertTrue(items instanceof HashSet);
-    }
-
-    @Test
-    public void testCollection_TreeSet(){
-        Configuration config = ConfigurationProvider.getConfiguration();
-        Collection<String> items = config.get("typed2.treeset", new TypeLiteral<Collection<String>>(){});
-        assertNotNull(items);
-        assertFalse(items.isEmpty());
-        assertEquals(10, items.size());
-        assertTrue(items instanceof TreeSet);
-        items = (Collection<String>) config.get("typed2.treeset", Collection.class);
-        assertNotNull(items);
-        assertFalse(items.isEmpty());
-        assertEquals(10, items.size());
-        assertTrue(items instanceof TreeSet);
-    }
-
-    @Test
-    public void testCollection_ArrayList(){
-        Configuration config = ConfigurationProvider.getConfiguration();
-        Collection<String> items = config.get("typed2.arraylist", new TypeLiteral<Collection<String>>(){});
-        assertNotNull(items);
-        assertFalse(items.isEmpty());
-        assertEquals(10, items.size());
-        assertTrue(items instanceof ArrayList);
-        items = (Collection<String>) config.get("typed2.arraylist", Collection.class);
-        assertNotNull(items);
-        assertFalse(items.isEmpty());
-        assertEquals(10, items.size());
-        assertTrue(items instanceof ArrayList);
-    }
-
-    @Test
-    public void testCollection_LinkedList(){
-        Configuration config = ConfigurationProvider.getConfiguration();
-        Collection<String> items = config.get("typed2.linkedlist", new TypeLiteral<Collection<String>>(){});
-        assertNotNull(items);
-        assertFalse(items.isEmpty());
-        assertEquals(10, items.size());
-        assertTrue(items instanceof LinkedList);
-        items = (Collection<String>) config.get("typed2.linkedlist", Collection.class);
-        assertNotNull(items);
-        assertFalse(items.isEmpty());
-        assertEquals(10, items.size());
-        assertTrue(items instanceof LinkedList);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/c9e965a2/collections/src/test/java/org/apache/tamaya/collections/MyUpperCaseConverter.java
----------------------------------------------------------------------
diff --git a/collections/src/test/java/org/apache/tamaya/collections/MyUpperCaseConverter.java b/collections/src/test/java/org/apache/tamaya/collections/MyUpperCaseConverter.java
deleted file mode 100644
index 1c95261..0000000
--- a/collections/src/test/java/org/apache/tamaya/collections/MyUpperCaseConverter.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.tamaya.collections;
-
-import org.apache.tamaya.spi.ConversionContext;
-import org.apache.tamaya.spi.PropertyConverter;
-
-/**
- * Example converter that is used for testing the custom parsing functionality. It sorrounds values with () and
- * converts them to uppercase.
- */
-public class MyUpperCaseConverter implements PropertyConverter<String>{
-    @Override
-    public String convert(String value, ConversionContext context) {
-        return "("+value.toUpperCase()+")";
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/c9e965a2/collections/src/test/resources/META-INF/javaconfiguration.properties
----------------------------------------------------------------------
diff --git a/collections/src/test/resources/META-INF/javaconfiguration.properties b/collections/src/test/resources/META-INF/javaconfiguration.properties
deleted file mode 100644
index e9a234c..0000000
--- a/collections/src/test/resources/META-INF/javaconfiguration.properties
+++ /dev/null
@@ -1,73 +0,0 @@
-#
-# 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 current 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.
-#
-# Similar to etcd all keys starting with a _ are hidden by default (only directly accessible).
-
-# Config for base tests (no combination policy)
-base.items=1,2,3,4,5,6,7,8,9,0
-base.map=1::a, 2::b, 3::c, [4:: ]
-
-# Config for tests with explcit implementation types
-typed2.arraylist=1,2,3,4,5,6,7,8,9,0
-_typed2.arraylist.collection-type=ArrayList
-_typed2.arraylist.read-only=false
-typed2.linkedlist=1,2,3,4,5,6,7,8,9,0
-_typed2.linkedlist.collection-type=java.util.LinkedList
-_typed2.linkedlist.read-only=false
-typed2.hashset=1,2,3,4,5,6,7,8,9,0
-_typed2.hashset.collection-type=HashSet
-_typed2.hashset.read-only=false
-typed2.treeset=1,2,3,4,5,6,7,8,9,0
-_typed2.treeset.collection-type=TreeSet
-_typed2.treeset.read-only=false
-typed2.hashmap=1::a, 2::b, 3::c, [4:: ]
-_typed2.hashmap.collection-type=java.util.HashMap
-_typed2.hashmap.read-only=false
-typed2.treemap=1::a, 2::b, 3::c, [4:: ]
-_typed2.treemap.collection-type=TreeMap
-_typed2.treemap.read-only=false
-
-# Config for tests with combination policy, writable
-typed.arraylist=1,2,3,4,5,6,7,8,9,0
-_typed.arraylist.collection-type=ArrayList
-typed.linkedlist=1,2,3,4,5,6,7,8,9,0
-_typed.linkedlist.collection-type=java.util.LinkedList
-typed.hashset=1,2,3,4,5,6,7,8,9,0
-_typed.hashset.collection-type=HashSet
-typed.treeset=1,2,3,4,5,6,7,8,9,0
-_typed.treeset.collection-type=TreeSet
-typed.hashmap=1::a, 2::b, 3::c, [4:: ]
-_typed.hashmap.collection-type=java.util.HashMap
-typed.treemap=1::a, 2::b, 3::c, [4:: ]
-_typed.treemap.collection-type=TreeMap
-
-# Config for advanced tests
-sep-list=a,b,c|d,e,f|g,h,i
-_sep-list.collection-type=List
-_sep-list.item-separator=|
-currency-list=CHF,USD,USS
-_currency-list.collection-type=List
-
-parser-list=a,b,c
-_parser-list.collection-type=List
-_parser-list.item-converter=org.apache.tamaya.collections.MyUpperCaseConverter
-
-redefined-map=0==none | 1==single | 2==any
-_redefined-map.map-entry-separator===
-_redefined-map.item-separator=|
-