You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juneau.apache.org by ja...@apache.org on 2017/12/23 16:51:00 UTC
[19/21] juneau git commit: JUNEAU-76 Improvements to Context/Builder
APIs
http://git-wip-us.apache.org/repos/asf/juneau/blob/227719b2/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/PropertyStoreTest.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/PropertyStoreTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/PropertyStoreTest.java
deleted file mode 100644
index 93144eb..0000000
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/PropertyStoreTest.java
+++ /dev/null
@@ -1,819 +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.juneau;
-
-import static org.apache.juneau.TestUtils.*;
-import static org.junit.Assert.*;
-
-import java.util.*;
-
-import org.apache.juneau.utils.*;
-import org.apache.juneau.xml.*;
-import org.junit.*;
-
-
-@SuppressWarnings({"rawtypes","javadoc"})
-public class PropertyStoreTest {
-
- //====================================================================================================
- // testSimpleProperties()
- //====================================================================================================
- @Test
- public void testSimpleProperties() {
- PropertyStore f = PropertyStore.create();
-
- f.setProperty("A.f1", "1");
- f.setProperty("A.f2", "2");
-
- assertObjectEquals("{'A.f1':'1','A.f2':'2'}", f.getPropertyMap("A").asMap());
-
- f.setProperty("B.f3", "3");
- f.setProperty("A.f1", String.class);
- f.setProperty("A.f2", 4);
-
- assertObjectEquals("{'A.f1':'java.lang.String','A.f2':4}", f.getPropertyMap("A").asMap());
-
- f.setProperty("A.f2", null);
- f.setProperty("A.f2", null);
- assertObjectEquals("{'A.f1':'java.lang.String'}", f.getPropertyMap("A").asMap());
-
- try {
- f.setProperty(null, null);
- fail("Exception expected");
- } catch (Exception e) {
- assertEquals("Invalid property name specified: 'null'", e.getMessage());
- }
-
- try {
- f.addToProperty("A.f1", "foo");
- fail("Exception expected");
- } catch (Exception e) {
- assertEquals("Cannot add value 'foo' (java.lang.String) to property 'A.f1' (SIMPLE).", e.getMessage());
- }
-
- try {
- f.removeFromProperty("A.f1", "foo");
- fail("Exception expected");
- } catch (Exception e) {
- assertEquals("Cannot remove value 'foo' (java.lang.String) from property 'A.f1' (SIMPLE).", e.getMessage());
- }
-
- try {
- f.putToProperty("A.f1", "foo", "bar");
- fail("Exception expected");
- } catch (Exception e) {
- assertEquals("Cannot put value 'foo'(java.lang.String)->'bar'(java.lang.String) to property 'A.f1' (SIMPLE).", e.getMessage());
- }
-
- try {
- f.putToProperty("A.f1", "foo");
- fail("Exception expected");
- } catch (Exception e) {
- assertEquals("Cannot put value 'foo' (java.lang.String) to property 'A.f1' (SIMPLE).", e.getMessage());
- }
- }
-
- //====================================================================================================
- // testSetProperties()
- //====================================================================================================
- @Test
- public void testSetProperties() {
- PropertyStore f = PropertyStore.create();
- String key = "A.f1.set";
-
- f.setProperty(key, Arrays.asList(2,3,1));
- assertObjectEquals("[1,2,3]", f.getProperty(key, int[].class, null));
-
- f.addToProperty(key, 0);
- f.addToProperty(key, new int[]{4,5});
- assertObjectEquals("[0,1,2,3,4,5]", f.getProperty(key, int[].class, null));
- f.addToProperty(key, new HashSet<String>(Arrays.asList("6","7")));
- assertObjectEquals("[0,1,2,3,4,5,6,7]", f.getProperty(key, int[].class, null));
- f.addToProperty(key, new int[]{4,5});
- assertObjectEquals("[0,1,2,3,4,5,6,7]", f.getProperty(key, int[].class, null));
-
- f.removeFromProperty(key, 4);
- f.removeFromProperty(key, new HashSet<String>(Arrays.asList("1")));
- f.removeFromProperty(key, new String[]{"2","9"});
- assertObjectEquals("[0,3,5,6,7]", f.getProperty(key, int[].class, null));
- assertObjectEquals("['0','3','5','6','7']", f.getProperty(key, String[].class, null));
-
- f.setProperty(key, Arrays.asList("foo","bar","baz"));
- assertObjectEquals("['bar','baz','foo']", f.getProperty(key, String[].class, null));
-
- f.setProperty(key, "[1,2,3]");
- assertObjectEquals("[1,2,3]", f.getProperty(key, int[].class, null));
-
- f.setProperty(key, "['1','2','3']");
- assertObjectEquals("[1,2,3]", f.getProperty(key, int[].class, null));
-
- try {
- f.putToProperty("A.f1.set", "foo");
- fail("Exception expected");
- } catch (Exception e) {
- assertEquals("Cannot put value 'foo' (java.lang.String) to property 'A.f1.set' (SET).", e.getMessage());
- }
-
- try {
- f.putToProperty("A.f1.set", "foo", "bar");
- fail("Exception expected");
- } catch (Exception e) {
- assertEquals("Cannot put value 'foo'(java.lang.String)->'bar'(java.lang.String) to property 'A.f1.set' (SET).", e.getMessage());
- }
- }
-
- //====================================================================================================
- // testListProperties()
- //====================================================================================================
- @Test
- public void testListProperties() {
- PropertyStore f = PropertyStore.create();
- String key = "A.f1.list";
-
- f.setProperty(key, Arrays.asList(2,3,1));
- assertObjectEquals("[2,3,1]", f.getProperty(key, int[].class, null));
-
- f.addToProperty(key, 0);
- f.addToProperty(key, new int[]{4,5});
- assertObjectEquals("[4,5,0,2,3,1]", f.getProperty(key, int[].class, null));
- f.addToProperty(key, new TreeSet<String>(Arrays.asList("6","7")));
- assertObjectEquals("[6,7,4,5,0,2,3,1]", f.getProperty(key, int[].class, null));
- f.addToProperty(key, new int[]{4,5});
- assertObjectEquals("[4,5,6,7,0,2,3,1]", f.getProperty(key, int[].class, null));
-
- f.removeFromProperty(key, 4);
- f.removeFromProperty(key, new HashSet<String>(Arrays.asList("1")));
- f.removeFromProperty(key, new String[]{"2","9"});
- assertObjectEquals("[5,6,7,0,3]", f.getProperty(key, int[].class, null));
- assertObjectEquals("['5','6','7','0','3']", f.getProperty(key, String[].class, null));
-
- f.setProperty(key, Arrays.asList("foo","bar","baz"));
- assertObjectEquals("['foo','bar','baz']", f.getProperty(key, String[].class, null));
- }
-
- //====================================================================================================
- // testMapProperties()
- //====================================================================================================
- @Test
- public void testMapProperties() {
- PropertyStore f = PropertyStore.create();
- String key = "A.f1.map";
-
- f.setProperty(key, new AMap<String,String>().append("1","1").append("3","3").append("2","2"));
- assertObjectEquals("{'1':1,'2':2,'3':3}", f.getMap(key, Integer.class, Integer.class, null));
-
- f.setProperty(key, "{'1':1,'2':2,'3':3}");
- assertObjectEquals("{'1':1,'2':2,'3':3}", f.getMap(key, Integer.class, Integer.class, null));
-
- f.putToProperty(key, "{'3':4,'4':5,'5':6}");
- assertObjectEquals("{'1':1,'2':2,'3':4,'4':5,'5':6}", f.getMap(key, Integer.class, Integer.class, null));
- }
-
- //====================================================================================================
- // Hash code and comparison
- //====================================================================================================
- @Test
- public void testHashCodes() throws Exception {
- PropertyStore f1 = PropertyStore.create();
- f1.setProperty("A.a", 1);
- f1.setProperty("A.b", true);
- f1.setProperty("A.c", String.class);
- f1.setProperty("A.d.set", new Object[]{1, true, String.class});
- f1.setProperty("A.e.map", new AMap<Object,Object>().append(true,true).append(1,1).append(String.class,String.class));
-
- PropertyStore f2 = PropertyStore.create();
- f2.setProperty("A.e.map", new AMap<Object,Object>().append("1","1").append("true","true").append("java.lang.String","java.lang.String"));
- f2.setProperty("A.d.set", new Object[]{"true","1","java.lang.String"});
- f2.setProperty("A.c", "java.lang.String");
- f2.setProperty("A.b", "true");
- f2.setProperty("A.a", "1");
-
- PropertyStore.PropertyMap p1 = f1.getPropertyMap("A");
- PropertyStore.PropertyMap p2 = f2.getPropertyMap("A");
- assertEquals(p1.hashCode(), p2.hashCode());
- }
-
- @SuppressWarnings("unchecked")
- private static class ConversionTest {
- PropertyStore config = PropertyStore.create();
- String pName;
- Object in;
-
- private ConversionTest(String pName, Object in) {
- this.pName = pName;
- this.in = in;
- }
-
- private ConversionTest test(Class c, String expected) {
- try {
- config.setProperty(pName, in);
- assertObjectEquals(expected, config.getProperty(pName, c, null));
- } catch (Exception x) {
- assertEquals(expected.toString(), x.getLocalizedMessage());
- }
- return this;
- }
-
- private ConversionTest testMap(Class k, Class v, String expected) {
- try {
- config.setProperty(pName, in);
- assertObjectEquals(expected, config.getMap(pName, k, v, null));
- } catch (Exception x) {
- assertEquals(expected, x.getLocalizedMessage());
- }
- return this;
- }
- }
-
- //====================================================================================================
- // Conversions on simple properties
- //====================================================================================================
- @Test
- public void testConversionsOnSimpleProperties() throws Exception {
- String pName = "A.a";
-
- //--------------------------------------------------------------------------------
- // boolean
- //--------------------------------------------------------------------------------
- new ConversionTest(pName, true)
- .test(boolean.class, "true")
- .test(int.class, "1")
- .test(String.class, "'true'")
- .test(Class.class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'java.lang.Boolean' to type 'java.lang.Class'. Value=true.")
- .test(TestEnum.class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'java.lang.Boolean' to type 'org.apache.juneau.PropertyStoreTest$TestEnum'. Value=true.")
- .test(String[].class, "['true']")
- .test(Class[].class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'java.lang.Boolean' to type 'java.lang.Class[]'. Value=true.")
- .test(TestEnum[].class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'java.lang.Boolean' to type 'org.apache.juneau.PropertyStoreTest$TestEnum[]'. Value=true.")
- .testMap(String.class, String.class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'java.lang.Boolean' to type 'java.util.LinkedHashMap<java.lang.String,java.lang.String>'. Value=true.")
- .testMap(Class.class, Class.class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'java.lang.Boolean' to type 'java.util.LinkedHashMap<java.lang.Class,java.lang.Class>'. Value=true.")
- ;
-
- //--------------------------------------------------------------------------------
- // int
- //--------------------------------------------------------------------------------
- new ConversionTest(pName, 123)
- .test(boolean.class, "true")
- .test(int.class, "123")
- .test(String.class, "'123'")
- .test(Class.class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'java.lang.Integer' to type 'java.lang.Class'. Value=123.")
- .test(TestEnum.class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'java.lang.Integer' to type 'org.apache.juneau.PropertyStoreTest$TestEnum'. Value=123.")
- .test(String[].class, "['123']")
- .test(Class[].class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'java.lang.Integer' to type 'java.lang.Class[]'. Value=123.")
- .test(TestEnum[].class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'java.lang.Integer' to type 'org.apache.juneau.PropertyStoreTest$TestEnum[]'. Value=123.")
- .testMap(String.class, String.class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'java.lang.Integer' to type 'java.util.LinkedHashMap<java.lang.String,java.lang.String>'. Value=123.")
- .testMap(Class.class, Class.class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'java.lang.Integer' to type 'java.util.LinkedHashMap<java.lang.Class,java.lang.Class>'. Value=123.")
- ;
-
- //--------------------------------------------------------------------------------
- // Class
- //--------------------------------------------------------------------------------
- new ConversionTest(pName, String.class)
- .test(boolean.class, "false")
- .test(int.class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'java.lang.Class' to type 'int'. Value='java.lang.String'.")
- .test(String.class, "'java.lang.String'")
- .test(Class.class, "'java.lang.String'")
- .test(TestEnum.class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'java.lang.Class' to type 'org.apache.juneau.PropertyStoreTest$TestEnum'. Value='java.lang.String'.")
- .test(String[].class, "['class java.lang.String']")
- .test(Class[].class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'java.lang.Class' to type 'java.lang.Class[]'. Value='java.lang.String'.")
- .test(TestEnum[].class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'java.lang.Class' to type 'org.apache.juneau.PropertyStoreTest$TestEnum[]'. Value='java.lang.String'.")
- .testMap(String.class, String.class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'java.lang.Class' to type 'java.util.LinkedHashMap<java.lang.String,java.lang.String>'. Value='java.lang.String'.")
- .testMap(Class.class, Class.class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'java.lang.Class' to type 'java.util.LinkedHashMap<java.lang.Class,java.lang.Class>'. Value='java.lang.String'.")
- ;
-
- //--------------------------------------------------------------------------------
- // String
- //--------------------------------------------------------------------------------
- new ConversionTest(pName, "foo")
- .test(boolean.class, "false")
- .test(int.class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'java.lang.String' to type 'int'. Value='foo'.")
- .test(String.class, "'foo'")
- .test(Class.class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'java.lang.String' to type 'java.lang.Class'. Value='foo'.")
- .test(TestEnum.class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'java.lang.String' to type 'org.apache.juneau.PropertyStoreTest$TestEnum'. Value='foo'.")
- .test(String[].class, "['foo']")
- .test(Class[].class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'java.lang.String' to type 'java.lang.Class[]'. Value='foo'.")
- .test(TestEnum[].class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'java.lang.String' to type 'org.apache.juneau.PropertyStoreTest$TestEnum[]'. Value='foo'.")
- .testMap(String.class, String.class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'java.lang.String' to type 'java.util.LinkedHashMap<java.lang.String,java.lang.String>'. Value='foo'.")
- .testMap(Class.class, Class.class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'java.lang.String' to type 'java.util.LinkedHashMap<java.lang.Class,java.lang.Class>'. Value='foo'.")
- ;
- new ConversionTest(pName, "java.lang.String")
- .test(Class.class, "'java.lang.String'")
- ;
- new ConversionTest(pName, "true")
- .test(boolean.class, "true")
- ;
- new ConversionTest(pName, "ONE")
- .test(TestEnum.class, "'ONE'")
- ;
- new ConversionTest(pName, "123")
- .test(int.class, "123")
- ;
-
- //--------------------------------------------------------------------------------
- // enum
- //--------------------------------------------------------------------------------
- new ConversionTest(pName, TestEnum.ONE)
- .test(boolean.class, "false")
- .test(int.class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'org.apache.juneau.PropertyStoreTest$TestEnum' to type 'int'. Value='ONE'.")
- .test(String.class, "'ONE'")
- .test(Class.class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'org.apache.juneau.PropertyStoreTest$TestEnum' to type 'java.lang.Class'. Value='ONE'.")
- .test(TestEnum.class, "'ONE'")
- .test(String[].class, "['ONE']")
- .test(Class[].class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'org.apache.juneau.PropertyStoreTest$TestEnum' to type 'java.lang.Class[]'. Value='ONE'.")
- .test(TestEnum[].class, "['ONE']")
- .testMap(String.class, String.class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'org.apache.juneau.PropertyStoreTest$TestEnum' to type 'java.util.LinkedHashMap<java.lang.String,java.lang.String>'. Value='ONE'.")
- .testMap(Class.class, Class.class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'org.apache.juneau.PropertyStoreTest$TestEnum' to type 'java.util.LinkedHashMap<java.lang.Class,java.lang.Class>'. Value='ONE'.")
- ;
-
- //--------------------------------------------------------------------------------
- // String[]
- //--------------------------------------------------------------------------------
- new ConversionTest(pName, new String[]{"foo","bar"})
- .test(boolean.class, "false")
- .test(int.class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'java.lang.String[]' to type 'int'. Value=['foo','bar'].")
- .test(String.class, "'[\\'foo\\',\\'bar\\']'")
- .test(Class.class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'java.lang.String[]' to type 'java.lang.Class'. Value=['foo','bar'].")
- .test(TestEnum.class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'java.lang.String[]' to type 'org.apache.juneau.PropertyStoreTest$TestEnum'. Value=['foo','bar'].")
- .test(String[].class, "['foo','bar']")
- .test(Class[].class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'java.lang.String[]' to type 'java.lang.Class[]'. Value=['foo','bar'].")
- .test(TestEnum[].class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'java.lang.String[]' to type 'org.apache.juneau.PropertyStoreTest$TestEnum[]'. Value=['foo','bar'].")
- .testMap(String.class, String.class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'java.lang.String[]' to type 'java.util.LinkedHashMap<java.lang.String,java.lang.String>'. Value=['foo','bar'].")
- .testMap(Class.class, Class.class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'java.lang.String[]' to type 'java.util.LinkedHashMap<java.lang.Class,java.lang.Class>'. Value=['foo','bar'].")
- ;
- new ConversionTest(pName, new String[]{"ONE","TWO"})
- .test(TestEnum[].class, "['ONE','TWO']")
- ;
- new ConversionTest(pName, new String[]{"true","false"})
- .test(boolean[].class, "[true,false]")
- ;
- new ConversionTest(pName, new String[]{"java.lang.String","java.lang.Integer"})
- .test(Class[].class, "['java.lang.String','java.lang.Integer']")
- ;
-
- //--------------------------------------------------------------------------------
- // Class[]
- //--------------------------------------------------------------------------------
- new ConversionTest(pName, new Class[]{String.class,Integer.class})
- .test(boolean.class, "false")
- .test(int.class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'java.lang.Class[]' to type 'int'. Value=['java.lang.String','java.lang.Integer'].")
- .test(String.class, "'[\\'java.lang.String\\',\\'java.lang.Integer\\']'")
- .test(Class.class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'java.lang.Class[]' to type 'java.lang.Class'. Value=['java.lang.String','java.lang.Integer'].")
- .test(TestEnum.class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'java.lang.Class[]' to type 'org.apache.juneau.PropertyStoreTest$TestEnum'. Value=['java.lang.String','java.lang.Integer'].")
- .test(String[].class, "['java.lang.String','java.lang.Integer']")
- .test(Class[].class, "['java.lang.String','java.lang.Integer']")
- .test(TestEnum[].class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'java.lang.Class[]' to type 'org.apache.juneau.PropertyStoreTest$TestEnum[]'. Value=['java.lang.String','java.lang.Integer'].")
- .testMap(String.class, String.class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'java.lang.Class[]' to type 'java.util.LinkedHashMap<java.lang.String,java.lang.String>'. Value=['java.lang.String','java.lang.Integer'].")
- .testMap(Class.class, Class.class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'java.lang.Class[]' to type 'java.util.LinkedHashMap<java.lang.Class,java.lang.Class>'. Value=['java.lang.String','java.lang.Integer'].")
- ;
-
- //--------------------------------------------------------------------------------
- // enum[]
- //--------------------------------------------------------------------------------
- new ConversionTest(pName, new TestEnum[]{TestEnum.ONE,TestEnum.TWO})
- .test(boolean.class, "false")
- .test(int.class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'org.apache.juneau.PropertyStoreTest$TestEnum[]' to type 'int'. Value=['ONE','TWO'].")
- .test(String.class, "'[\\'ONE\\',\\'TWO\\']'")
- .test(Class.class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'org.apache.juneau.PropertyStoreTest$TestEnum[]' to type 'java.lang.Class'. Value=['ONE','TWO'].")
- .test(TestEnum.class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'org.apache.juneau.PropertyStoreTest$TestEnum[]' to type 'org.apache.juneau.PropertyStoreTest$TestEnum'. Value=['ONE','TWO'].")
- .test(String[].class, "['ONE','TWO']")
- .test(Class[].class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'org.apache.juneau.PropertyStoreTest$TestEnum[]' to type 'java.lang.Class[]'. Value=['ONE','TWO'].")
- .test(TestEnum[].class, "['ONE','TWO']")
- .testMap(String.class, String.class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'org.apache.juneau.PropertyStoreTest$TestEnum[]' to type 'java.util.LinkedHashMap<java.lang.String,java.lang.String>'. Value=['ONE','TWO'].")
- .testMap(Class.class, Class.class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'org.apache.juneau.PropertyStoreTest$TestEnum[]' to type 'java.util.LinkedHashMap<java.lang.Class,java.lang.Class>'. Value=['ONE','TWO'].")
- ;
-
- //--------------------------------------------------------------------------------
- // Map<String,String>
- //--------------------------------------------------------------------------------
- LinkedHashMap<String,String> m1 = new LinkedHashMap<String,String>();
- m1.put("foo","bar");
- new ConversionTest(pName, m1)
- .test(boolean.class, "false")
- .test(int.class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'java.util.LinkedHashMap' to type 'int'. Value={foo:'bar'}.")
- .test(String.class, "'{foo:\\'bar\\'}'")
- .test(Class.class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'java.util.LinkedHashMap' to type 'java.lang.Class'. Value={foo:'bar'}.")
- .test(TestEnum.class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'java.util.LinkedHashMap' to type 'org.apache.juneau.PropertyStoreTest$TestEnum'. Value={foo:'bar'}.")
- .test(String[].class, "['{foo=bar}']")
- .test(Class[].class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'java.util.LinkedHashMap' to type 'java.lang.Class[]'. Value={foo:'bar'}.")
- .test(TestEnum[].class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'java.util.LinkedHashMap' to type 'org.apache.juneau.PropertyStoreTest$TestEnum[]'. Value={foo:'bar'}.")
- .testMap(String.class, String.class, "{foo:'bar'}")
- .testMap(Class.class, Class.class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'java.util.LinkedHashMap' to type 'java.util.LinkedHashMap<java.lang.Class,java.lang.Class>'. Value={foo:'bar'}.")
- ;
-
- //--------------------------------------------------------------------------------
- // Map<Class,Class>
- //--------------------------------------------------------------------------------
- LinkedHashMap<Class,Class> m2 = new LinkedHashMap<Class,Class>();
- m2.put(String.class, Integer.class);
- new ConversionTest(pName, m2)
- .test(boolean.class, "false")
- .test(int.class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'java.util.LinkedHashMap' to type 'int'. Value={'java.lang.String':'java.lang.Integer'}.")
- .test(String.class, "'{\\'java.lang.String\\':\\'java.lang.Integer\\'}'")
- .test(Class.class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'java.util.LinkedHashMap' to type 'java.lang.Class'. Value={'java.lang.String':'java.lang.Integer'}.")
- .test(TestEnum.class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'java.util.LinkedHashMap' to type 'org.apache.juneau.PropertyStoreTest$TestEnum'. Value={'java.lang.String':'java.lang.Integer'}.")
- .test(String[].class, "['{class java.lang.String=class java.lang.Integer}']")
- .test(Class[].class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'java.util.LinkedHashMap' to type 'java.lang.Class[]'. Value={'java.lang.String':'java.lang.Integer'}.")
- .test(TestEnum[].class, "Could not retrieve property store property 'A.a'. Invalid data conversion from type 'java.util.LinkedHashMap' to type 'org.apache.juneau.PropertyStoreTest$TestEnum[]'. Value={'java.lang.String':'java.lang.Integer'}.")
- .testMap(String.class, String.class, "{'java.lang.String':'java.lang.Integer'}")
- .testMap(Class.class, Class.class, "{'java.lang.String':'java.lang.Integer'}")
- ;
-
- //--------------------------------------------------------------------------------
- // Namespace
- //--------------------------------------------------------------------------------
- final Namespace n = new Namespace("foo","bar");
- new ConversionTest(pName, n)
- .test(String.class, "'{name:\\'foo\\',uri:\\'bar\\'}'")
- .test(Namespace.class, "{name:'foo',uri:'bar'}");
-
- //--------------------------------------------------------------------------------
- // Namespace[]
- //--------------------------------------------------------------------------------
- new ConversionTest(pName, new Namespace[]{n})
- .test(String.class, "'[{name:\\'foo\\',uri:\\'bar\\'}]'")
- .test(Namespace[].class, "[{name:'foo',uri:'bar'}]");
-
- //--------------------------------------------------------------------------------
- // Map<Namespace,Namespace>
- //--------------------------------------------------------------------------------
- new ConversionTest(pName, new AMap<Namespace,Namespace>().append(n,n))
- .testMap(Namespace.class, Namespace.class, "{'{name:\\'foo\\',uri:\\'bar\\'}':{name:'foo',uri:'bar'}}")
- .testMap(String.class, String.class, "{'{name:\\'foo\\',uri:\\'bar\\'}':'{name:\\'foo\\',uri:\\'bar\\'}'}");
- }
-
- //====================================================================================================
- // Conversions on set properties
- //====================================================================================================
- @Test
- public void testConversionsOnSetProperties() throws Exception {
- String pName = "A.a.set";
-
- //--------------------------------------------------------------------------------
- // boolean
- //--------------------------------------------------------------------------------
- new ConversionTest(pName, true)
- .test(boolean.class, "false")
- .test(int.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'int'. Value=[true].")
- .test(String.class, "'[true]'")
- .test(Class.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'java.lang.Class'. Value=[true].")
- .test(TestEnum.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'org.apache.juneau.PropertyStoreTest$TestEnum'. Value=[true].")
- .test(String[].class, "['true']")
- .test(Class[].class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'java.lang.Class[]'. Value=[true].")
- .test(TestEnum[].class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'org.apache.juneau.PropertyStoreTest$TestEnum[]'. Value=[true].")
- .testMap(String.class, String.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'java.util.LinkedHashMap<java.lang.String,java.lang.String>'. Value=[true].")
- .testMap(Class.class, Class.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'java.util.LinkedHashMap<java.lang.Class,java.lang.Class>'. Value=[true].")
- ;
-
- //--------------------------------------------------------------------------------
- // int
- //--------------------------------------------------------------------------------
- new ConversionTest(pName, 123)
- .test(boolean.class, "false")
- .test(int.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'int'. Value=[123].")
- .test(String.class, "'[123]'")
- .test(Class.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'java.lang.Class'. Value=[123].")
- .test(TestEnum.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'org.apache.juneau.PropertyStoreTest$TestEnum'. Value=[123].")
- .test(String[].class, "['123']")
- .test(Class[].class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'java.lang.Class[]'. Value=[123].")
- .test(TestEnum[].class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'org.apache.juneau.PropertyStoreTest$TestEnum[]'. Value=[123].")
- .testMap(String.class, String.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'java.util.LinkedHashMap<java.lang.String,java.lang.String>'. Value=[123].")
- .testMap(Class.class, Class.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'java.util.LinkedHashMap<java.lang.Class,java.lang.Class>'. Value=[123].")
- ;
-
- //--------------------------------------------------------------------------------
- // Class
- //--------------------------------------------------------------------------------
- new ConversionTest(pName, String.class)
- .test(boolean.class, "false")
- .test(int.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'int'. Value=['java.lang.String'].")
- .test(String.class, "'[\\'java.lang.String\\']'")
- .test(Class.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'java.lang.Class'. Value=['java.lang.String'].")
- .test(TestEnum.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'org.apache.juneau.PropertyStoreTest$TestEnum'. Value=['java.lang.String'].")
- .test(String[].class, "['java.lang.String']")
- .test(Class[].class, "['java.lang.String']")
- .test(TestEnum[].class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'org.apache.juneau.PropertyStoreTest$TestEnum[]'. Value=['java.lang.String'].")
- .testMap(String.class, String.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'java.util.LinkedHashMap<java.lang.String,java.lang.String>'. Value=['java.lang.String'].")
- .testMap(Class.class, Class.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'java.util.LinkedHashMap<java.lang.Class,java.lang.Class>'. Value=['java.lang.String'].")
- ;
-
- //--------------------------------------------------------------------------------
- // String
- //--------------------------------------------------------------------------------
- new ConversionTest(pName, "foo")
- .test(boolean.class, "false")
- .test(int.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'int'. Value=['foo'].")
- .test(String.class, "'[\\'foo\\']'")
- .test(Class.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'java.lang.Class'. Value=['foo'].")
- .test(TestEnum.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'org.apache.juneau.PropertyStoreTest$TestEnum'. Value=['foo'].")
- .test(String[].class, "['foo']")
- .test(Class[].class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'java.lang.Class[]'. Value=['foo'].")
- .test(TestEnum[].class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'org.apache.juneau.PropertyStoreTest$TestEnum[]'. Value=['foo'].")
- .testMap(String.class, String.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'java.util.LinkedHashMap<java.lang.String,java.lang.String>'. Value=['foo'].")
- .testMap(Class.class, Class.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'java.util.LinkedHashMap<java.lang.Class,java.lang.Class>'. Value=['foo'].")
- ;
- new ConversionTest(pName, Arrays.asList("java.lang.String"))
- .test(Class[].class, "['java.lang.String']")
- ;
- new ConversionTest(pName, Arrays.asList("true"))
- .test(boolean[].class, "[true]")
- ;
- new ConversionTest(pName, Arrays.asList("ONE"))
- .test(TestEnum[].class, "['ONE']")
- ;
- new ConversionTest(pName, Arrays.asList("123"))
- .test(int[].class, "[123]")
- ;
-
- //--------------------------------------------------------------------------------
- // enum
- //--------------------------------------------------------------------------------
- new ConversionTest(pName, TestEnum.ONE)
- .test(boolean.class, "false")
- .test(int.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'int'. Value=['ONE'].")
- .test(String.class, "'[\\'ONE\\']'")
- .test(Class.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'java.lang.Class'. Value=['ONE'].")
- .test(TestEnum.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'org.apache.juneau.PropertyStoreTest$TestEnum'. Value=['ONE'].")
- .test(String[].class, "['ONE']")
- .test(Class[].class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'java.lang.Class[]'. Value=['ONE'].")
- .test(TestEnum[].class, "['ONE']")
- .testMap(String.class, String.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'java.util.LinkedHashMap<java.lang.String,java.lang.String>'. Value=['ONE'].")
- .testMap(Class.class, Class.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'java.util.LinkedHashMap<java.lang.Class,java.lang.Class>'. Value=['ONE'].")
- ;
-
- //--------------------------------------------------------------------------------
- // String[]
- //--------------------------------------------------------------------------------
- new ConversionTest(pName, new String[]{"foo","bar"})
- .test(boolean.class, "false")
- .test(int.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'int'. Value=['bar','foo'].")
- .test(String.class, "'[\\'bar\\',\\'foo\\']'")
- .test(Class.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'java.lang.Class'. Value=['bar','foo'].")
- .test(TestEnum.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'org.apache.juneau.PropertyStoreTest$TestEnum'. Value=['bar','foo'].")
- .test(String[].class, "['bar','foo']")
- .test(Class[].class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'java.lang.Class[]'. Value=['bar','foo'].")
- .test(TestEnum[].class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'org.apache.juneau.PropertyStoreTest$TestEnum[]'. Value=['bar','foo'].")
- .testMap(String.class, String.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'java.util.LinkedHashMap<java.lang.String,java.lang.String>'. Value=['bar','foo'].")
- .testMap(Class.class, Class.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'java.util.LinkedHashMap<java.lang.Class,java.lang.Class>'. Value=['bar','foo'].")
- ;
- new ConversionTest(pName, new String[]{"ONE","TWO"})
- .test(TestEnum[].class, "['ONE','TWO']")
- ;
- new ConversionTest(pName, new String[]{"true","false"})
- .test(boolean[].class, "[false,true]")
- ;
- new ConversionTest(pName, new String[]{"java.lang.String","java.lang.Integer"})
- .test(Class[].class, "['java.lang.Integer','java.lang.String']")
- ;
-
- //--------------------------------------------------------------------------------
- // Class[]
- //--------------------------------------------------------------------------------
- new ConversionTest(pName, new Class[]{String.class,Integer.class})
- .test(boolean.class, "false")
- .test(int.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'int'. Value=['java.lang.Integer','java.lang.String'].")
- .test(String.class, "'[\\'java.lang.Integer\\',\\'java.lang.String\\']'")
- .test(Class.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'java.lang.Class'. Value=['java.lang.Integer','java.lang.String'].")
- .test(TestEnum.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'org.apache.juneau.PropertyStoreTest$TestEnum'. Value=['java.lang.Integer','java.lang.String'].")
- .test(String[].class, "['java.lang.Integer','java.lang.String']")
- .test(Class[].class, "['java.lang.Integer','java.lang.String']")
- .test(TestEnum[].class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'org.apache.juneau.PropertyStoreTest$TestEnum[]'. Value=['java.lang.Integer','java.lang.String'].")
- .testMap(String.class, String.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'java.util.LinkedHashMap<java.lang.String,java.lang.String>'. Value=['java.lang.Integer','java.lang.String'].")
- .testMap(Class.class, Class.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'java.util.LinkedHashMap<java.lang.Class,java.lang.Class>'. Value=['java.lang.Integer','java.lang.String'].")
- ;
-
- //--------------------------------------------------------------------------------
- // enum[]
- //--------------------------------------------------------------------------------
- new ConversionTest(pName, new TestEnum[]{TestEnum.ONE,TestEnum.TWO})
- .test(boolean.class, "false")
- .test(int.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'int'. Value=['ONE','TWO'].")
- .test(String.class, "'[\\'ONE\\',\\'TWO\\']'")
- .test(Class.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'java.lang.Class'. Value=['ONE','TWO'].")
- .test(TestEnum.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'org.apache.juneau.PropertyStoreTest$TestEnum'. Value=['ONE','TWO'].")
- .test(String[].class, "['ONE','TWO']")
- .test(Class[].class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'java.lang.Class[]'. Value=['ONE','TWO'].")
- .test(TestEnum[].class, "['ONE','TWO']")
- .testMap(String.class, String.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'java.util.LinkedHashMap<java.lang.String,java.lang.String>'. Value=['ONE','TWO'].")
- .testMap(Class.class, Class.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'java.util.LinkedHashMap<java.lang.Class,java.lang.Class>'. Value=['ONE','TWO'].")
- ;
-
- //--------------------------------------------------------------------------------
- // Map<String,String>
- //--------------------------------------------------------------------------------
- LinkedHashMap<String,String> m1 = new LinkedHashMap<String,String>();
- m1.put("foo","bar");
- new ConversionTest(pName, m1)
- .test(boolean.class, "false")
- .test(int.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'int'. Value=[{foo:'bar'}].")
- .test(String.class, "'[{foo:\\'bar\\'}]'")
- .test(Class.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'java.lang.Class'. Value=[{foo:'bar'}].")
- .test(TestEnum.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'org.apache.juneau.PropertyStoreTest$TestEnum'. Value=[{foo:'bar'}].")
- .test(String[].class, "['{foo:\\'bar\\'}']")
- .test(Class[].class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'java.lang.Class[]'. Value=[{foo:'bar'}].")
- .test(TestEnum[].class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'org.apache.juneau.PropertyStoreTest$TestEnum[]'. Value=[{foo:'bar'}].")
- .testMap(String.class, String.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'java.util.LinkedHashMap<java.lang.String,java.lang.String>'. Value=[{foo:'bar'}].")
- .testMap(Class.class, Class.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'java.util.LinkedHashMap<java.lang.Class,java.lang.Class>'. Value=[{foo:'bar'}].")
- ;
-
- //--------------------------------------------------------------------------------
- // Map<Class,Class>
- //--------------------------------------------------------------------------------
- LinkedHashMap<Class,Class> m2 = new LinkedHashMap<Class,Class>();
- m2.put(String.class, Integer.class);
- new ConversionTest(pName, m2)
- .test(boolean.class, "false")
- .test(int.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'int'. Value=[{'java.lang.String':'java.lang.Integer'}].")
- .test(String.class, "'[{\\'java.lang.String\\':\\'java.lang.Integer\\'}]'")
- .test(Class.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'java.lang.Class'. Value=[{'java.lang.String':'java.lang.Integer'}].")
- .test(TestEnum.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'org.apache.juneau.PropertyStoreTest$TestEnum'. Value=[{'java.lang.String':'java.lang.Integer'}].")
- .test(String[].class, "['{\\'java.lang.String\\':\\'java.lang.Integer\\'}']")
- .test(Class[].class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'java.lang.Class[]'. Value=[{'java.lang.String':'java.lang.Integer'}].")
- .test(TestEnum[].class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'org.apache.juneau.PropertyStoreTest$TestEnum[]'. Value=[{'java.lang.String':'java.lang.Integer'}].")
- .testMap(String.class, String.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'java.util.LinkedHashMap<java.lang.String,java.lang.String>'. Value=[{'java.lang.String':'java.lang.Integer'}].")
- .testMap(Class.class, Class.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'java.util.LinkedHashMap<java.lang.Class,java.lang.Class>'. Value=[{'java.lang.String':'java.lang.Integer'}].")
- ;
-
- //--------------------------------------------------------------------------------
- // Namespace
- //--------------------------------------------------------------------------------
- final Namespace n = new Namespace("foo","bar");
- new ConversionTest(pName, Arrays.asList(n))
- .test(String.class, "'[{name:\\'foo\\',uri:\\'bar\\'}]'")
- .test(Namespace.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'org.apache.juneau.xml.Namespace'. Value=[{name:'foo',uri:'bar'}].");
-
- //--------------------------------------------------------------------------------
- // Namespace[]
- //--------------------------------------------------------------------------------
- new ConversionTest(pName, new Namespace[]{n})
- .test(String.class, "'[{name:\\'foo\\',uri:\\'bar\\'}]'")
- .test(Namespace[].class, "[{name:'foo',uri:'bar'}]");
-
- //--------------------------------------------------------------------------------
- // Map<Namespace,Namespace>
- //--------------------------------------------------------------------------------
- new ConversionTest(pName, new AMap<Namespace,Namespace>().append(n,n))
- .testMap(Namespace.class, Namespace.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'java.util.LinkedHashMap<org.apache.juneau.xml.Namespace,org.apache.juneau.xml.Namespace>'. Value=[{'{name:\\'foo\\',uri:\\'bar\\'}':{name:'foo',uri:'bar'}}].")
- .testMap(String.class, String.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'java.util.LinkedHashMap<java.lang.String,java.lang.String>'. Value=[{'{name:\\'foo\\',uri:\\'bar\\'}':{name:'foo',uri:'bar'}}].");
- }
-
-
- //====================================================================================================
- // Conversions on map properties
- //====================================================================================================
- @Test
- public void testConversionsOnMapProperties() throws Exception {
- String pName = "A.a.map";
-
- //--------------------------------------------------------------------------------
- // boolean
- //--------------------------------------------------------------------------------
- new ConversionTest(pName, true)
- .test(boolean.class, "Cannot put value true (java.lang.Boolean) to property 'A.a.map' (MAP).")
- ;
-
- //--------------------------------------------------------------------------------
- // int
- //--------------------------------------------------------------------------------
- new ConversionTest(pName, 123)
- .test(int.class, "Cannot put value 123 (java.lang.Integer) to property 'A.a.map' (MAP).")
- ;
-
- //--------------------------------------------------------------------------------
- // Class
- //--------------------------------------------------------------------------------
- new ConversionTest(pName, String.class)
- .test(Class.class, "Cannot put value 'java.lang.String' (java.lang.Class) to property 'A.a.map' (MAP).")
- ;
-
- //--------------------------------------------------------------------------------
- // String
- //--------------------------------------------------------------------------------
- new ConversionTest(pName, "foo")
- .test(String.class, "Cannot put value 'foo' (java.lang.String) to property 'A.a.map' (MAP).")
- ;
-
- //--------------------------------------------------------------------------------
- // enum
- //--------------------------------------------------------------------------------
- new ConversionTest(pName, TestEnum.ONE)
- .test(TestEnum.class, "Cannot put value 'ONE' (org.apache.juneau.PropertyStoreTest$TestEnum) to property 'A.a.map' (MAP).")
- ;
-
- //--------------------------------------------------------------------------------
- // String[]
- //--------------------------------------------------------------------------------
- new ConversionTest(pName, new String[]{"foo","bar"})
- .test(String[].class, "Cannot put value ['foo','bar'] (java.lang.String[]) to property 'A.a.map' (MAP).")
- ;
-
- //--------------------------------------------------------------------------------
- // Class[]
- //--------------------------------------------------------------------------------
- new ConversionTest(pName, new Class[]{String.class,Integer.class})
- .test(Class[].class, "Cannot put value ['java.lang.String','java.lang.Integer'] (java.lang.Class[]) to property 'A.a.map' (MAP).")
- ;
-
- //--------------------------------------------------------------------------------
- // enum[]
- //--------------------------------------------------------------------------------
- new ConversionTest(pName, new TestEnum[]{TestEnum.ONE,TestEnum.TWO})
- .test(TestEnum[].class, "Cannot put value ['ONE','TWO'] (org.apache.juneau.PropertyStoreTest$TestEnum[]) to property 'A.a.map' (MAP).")
- ;
-
- //--------------------------------------------------------------------------------
- // Map<String,String>
- //--------------------------------------------------------------------------------
- LinkedHashMap<String,String> m1 = new LinkedHashMap<String,String>();
- m1.put("foo","bar");
- new ConversionTest(pName, m1)
- .test(boolean.class, "false")
- .test(int.class, "Could not retrieve property store property 'A.a.map'. Invalid data conversion from type 'java.util.Collections$SynchronizedMap' to type 'int'. Value={foo:'bar'}.")
- .test(String.class, "'{foo:\\'bar\\'}'")
- .test(Class.class, "Could not retrieve property store property 'A.a.map'. Invalid data conversion from type 'java.util.Collections$SynchronizedMap' to type 'java.lang.Class'. Value={foo:'bar'}.")
- .test(TestEnum.class, "Could not retrieve property store property 'A.a.map'. Invalid data conversion from type 'java.util.Collections$SynchronizedMap' to type 'org.apache.juneau.PropertyStoreTest$TestEnum'. Value={foo:'bar'}.")
- .test(String[].class, "['{foo=bar}']")
- .test(Class[].class, "Could not retrieve property store property 'A.a.map'. Invalid data conversion from type 'java.util.Collections$SynchronizedMap' to type 'java.lang.Class[]'. Value={foo:'bar'}.")
- .test(TestEnum[].class, "Could not retrieve property store property 'A.a.map'. Invalid data conversion from type 'java.util.Collections$SynchronizedMap' to type 'org.apache.juneau.PropertyStoreTest$TestEnum[]'. Value={foo:'bar'}.")
- .testMap(String.class, String.class, "{foo:'bar'}")
- .testMap(Class.class, Class.class, "Could not retrieve property store property 'A.a.map'. Invalid data conversion from type 'java.util.Collections$SynchronizedMap' to type 'java.util.LinkedHashMap<java.lang.Class,java.lang.Class>'. Value={foo:'bar'}.")
- ;
-
- //--------------------------------------------------------------------------------
- // Map<Class,Class>
- //--------------------------------------------------------------------------------
- LinkedHashMap<Class,Class> m2 = new LinkedHashMap<Class,Class>();
- m2.put(String.class, Integer.class);
- new ConversionTest(pName, m2)
- .test(boolean.class, "false")
- .test(int.class, "Could not retrieve property store property 'A.a.map'. Invalid data conversion from type 'java.util.Collections$SynchronizedMap' to type 'int'. Value={'java.lang.String':'java.lang.Integer'}.")
- .test(String.class, "'{\\'java.lang.String\\':\\'java.lang.Integer\\'}'")
- .test(Class.class, "Could not retrieve property store property 'A.a.map'. Invalid data conversion from type 'java.util.Collections$SynchronizedMap' to type 'java.lang.Class'. Value={'java.lang.String':'java.lang.Integer'}.")
- .test(TestEnum.class, "Could not retrieve property store property 'A.a.map'. Invalid data conversion from type 'java.util.Collections$SynchronizedMap' to type 'org.apache.juneau.PropertyStoreTest$TestEnum'. Value={'java.lang.String':'java.lang.Integer'}.")
- .test(String[].class, "['{class java.lang.String=class java.lang.Integer}']")
- .test(Class[].class, "Could not retrieve property store property 'A.a.map'. Invalid data conversion from type 'java.util.Collections$SynchronizedMap' to type 'java.lang.Class[]'. Value={'java.lang.String':'java.lang.Integer'}.")
- .test(TestEnum[].class, "Could not retrieve property store property 'A.a.map'. Invalid data conversion from type 'java.util.Collections$SynchronizedMap' to type 'org.apache.juneau.PropertyStoreTest$TestEnum[]'. Value={'java.lang.String':'java.lang.Integer'}.")
- .testMap(String.class, String.class, "{'java.lang.String':'java.lang.Integer'}")
- .testMap(Class.class, Class.class, "{'java.lang.String':'java.lang.Integer'}")
- ;
-
- //--------------------------------------------------------------------------------
- // Namespace
- //--------------------------------------------------------------------------------
- final Namespace n = new Namespace("foo","bar");
- new ConversionTest(pName, Arrays.asList(n))
- .test(String.class, "Cannot put value [{name:'foo',uri:'bar'}] (java.util.Arrays$ArrayList) to property 'A.a.map' (MAP).")
- ;
-
- //--------------------------------------------------------------------------------
- // Namespace[]
- //--------------------------------------------------------------------------------
- new ConversionTest(pName, new Namespace[]{n})
- .test(String.class, "Cannot put value [{name:'foo',uri:'bar'}] (org.apache.juneau.xml.Namespace[]) to property 'A.a.map' (MAP).")
- ;
-
- //--------------------------------------------------------------------------------
- // Map<Namespace,Namespace>
- //--------------------------------------------------------------------------------
- new ConversionTest(pName, new AMap<Namespace,Namespace>().append(n,n))
- .testMap(Namespace.class, Namespace.class, "{'{name:\\'foo\\',uri:\\'bar\\'}':{name:'foo',uri:'bar'}}")
- .testMap(String.class, String.class, "{'{name:\\'foo\\',uri:\\'bar\\'}':'{name:\\'foo\\',uri:\\'bar\\'}'}");
- }
-
- public enum TestEnum {
- ONE,TWO,TREE;
- }
-
- //====================================================================================================
- // testSystemPropertyDefaults()
- //====================================================================================================
- @Test
- public void testSystemPropertyDefaults() {
- System.setProperty("Foo.f1", "true");
- System.setProperty("Foo.f2", "123");
- System.setProperty("Foo.f3", "TWO");
-
- PropertyStore f = PropertyStore.create();
-
- assertObjectEquals("true", f.getProperty("Foo.f1", boolean.class, false));
- assertObjectEquals("123", f.getProperty("Foo.f2", int.class, 0));
- assertObjectEquals("'TWO'", f.getProperty("Foo.f3", TestEnum.class, TestEnum.ONE));
-
- f.setProperty("Foo.f1", false);
- f.setProperty("Foo.f2", 456);
- f.setProperty("Foo.f3", TestEnum.TREE);
-
- assertObjectEquals("false", f.getProperty("Foo.f1", boolean.class, false));
- assertObjectEquals("456", f.getProperty("Foo.f2", int.class, 0));
- assertObjectEquals("'TREE'", f.getProperty("Foo.f3", TestEnum.class, TestEnum.ONE));
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/juneau/blob/227719b2/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/XmlValidatorParser.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/XmlValidatorParser.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/XmlValidatorParser.java
index 1ff1add..7703ddb 100755
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/XmlValidatorParser.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/XmlValidatorParser.java
@@ -30,7 +30,7 @@ import org.apache.juneau.xml.*;
public class XmlValidatorParser extends XmlParser {
public XmlValidatorParser() {
- super(PropertyStore.create());
+ super(PropertyStore2.DEFAULT);
}
@Override /* Parser */
http://git-wip-us.apache.org/repos/asf/juneau/blob/227719b2/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/XmlValidatorParserBuilder.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/XmlValidatorParserBuilder.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/XmlValidatorParserBuilder.java
index 6d7f00b..8c68e7c 100644
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/XmlValidatorParserBuilder.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/XmlValidatorParserBuilder.java
@@ -17,7 +17,7 @@ import org.apache.juneau.xml.*;
public class XmlValidatorParserBuilder extends XmlParserBuilder {
public XmlValidatorParserBuilder() {
- super(PropertyStore.create());
+ super(PropertyStore2.DEFAULT);
}
@Override
http://git-wip-us.apache.org/repos/asf/juneau/blob/227719b2/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripTest.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripTest.java
index 3e80d35..ea661d0 100755
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripTest.java
@@ -203,8 +203,8 @@ public abstract class RoundTripTest {
p.implClass(e.getKey(), e.getValue());
}
}
- this.s = s.beanFilters(getBeanFilters()).pojoSwaps(getPojoSwaps()).beanDictionary(getDictionary()).properties(getProperties()).build();
- this.p = p == null ? null : p.beanFilters(getBeanFilters()).pojoSwaps(getPojoSwaps()).beanDictionary(getDictionary()).properties(getProperties()).build();
+ this.s = s.beanFilters(getBeanFilters()).pojoSwaps(getPojoSwaps()).beanDictionary(getDictionary()).add(getProperties()).build();
+ this.p = p == null ? null : p.beanFilters(getBeanFilters()).pojoSwaps(getPojoSwaps()).beanDictionary(getDictionary()).add(getProperties()).build();
this.validateXmlWhitespace = (flags & CHECK_XML_WHITESPACE) > 0;
this.validateXml = (flags & VALIDATE_XML) > 0;
this.returnOriginalObject = (flags & RETURN_ORIGINAL_OBJECT) > 0;
http://git-wip-us.apache.org/repos/asf/juneau/blob/227719b2/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jena/CommonParserTest.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jena/CommonParserTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jena/CommonParserTest.java
index 1af8a8c..32420e0 100755
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jena/CommonParserTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jena/CommonParserTest.java
@@ -45,9 +45,9 @@ public class CommonParserTest {
.sq()
.addLiteralTypes(true)
.useWhitespace(false)
- .property(RDF_rdfxml_allowBadUris, true)
- .property(RDF_rdfxml_showDoctypeDeclaration, false)
- .property(RDF_rdfxml_showXmlDeclaration, false);
+ .set(RDF_rdfxml_allowBadUris, true)
+ .set(RDF_rdfxml_showDoctypeDeclaration, false)
+ .set(RDF_rdfxml_showXmlDeclaration, false);
}
//====================================================================================================
http://git-wip-us.apache.org/repos/asf/juneau/blob/227719b2/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jena/CommonTest.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jena/CommonTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jena/CommonTest.java
index a79cebe..6cae6ab 100755
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jena/CommonTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jena/CommonTest.java
@@ -33,9 +33,9 @@ public class CommonTest {
return RdfSerializer.create()
.sq()
.useWhitespace(false)
- .property(RDF_rdfxml_allowBadUris, true)
- .property(RDF_rdfxml_showDoctypeDeclaration, false)
- .property(RDF_rdfxml_showXmlDeclaration, false);
+ .set(RDF_rdfxml_allowBadUris, true)
+ .set(RDF_rdfxml_showDoctypeDeclaration, false)
+ .set(RDF_rdfxml_showXmlDeclaration, false);
}
private String strip(String s) {
http://git-wip-us.apache.org/repos/asf/juneau/blob/227719b2/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jena/CommonXmlTest.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jena/CommonXmlTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jena/CommonXmlTest.java
index b3fd3bc..ea06f57 100755
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jena/CommonXmlTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jena/CommonXmlTest.java
@@ -29,9 +29,9 @@ public class CommonXmlTest {
return RdfSerializer.create()
.sq()
.useWhitespace(false)
- .property(RDF_rdfxml_allowBadUris, true)
- .property(RDF_rdfxml_showDoctypeDeclaration, false)
- .property(RDF_rdfxml_showXmlDeclaration, false);
+ .set(RDF_rdfxml_allowBadUris, true)
+ .set(RDF_rdfxml_showDoctypeDeclaration, false)
+ .set(RDF_rdfxml_showXmlDeclaration, false);
}
private String strip(String s) {
http://git-wip-us.apache.org/repos/asf/juneau/blob/227719b2/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jena/RdfParserTest.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jena/RdfParserTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jena/RdfParserTest.java
index acf414f..d77f4a4 100755
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jena/RdfParserTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jena/RdfParserTest.java
@@ -46,7 +46,7 @@ public class RdfParserTest {
// Create a new serializer with readable output.
RdfSerializer s = RdfSerializer.create().xmlabbrev()
- .property(RDF_rdfxml_tab, 3)
+ .set(RDF_rdfxml_tab, 3)
.sq()
.addRootProperty(true)
.build();
http://git-wip-us.apache.org/repos/asf/juneau/blob/227719b2/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jena/RdfTest.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jena/RdfTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jena/RdfTest.java
index 9d17b22..9172965 100755
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jena/RdfTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jena/RdfTest.java
@@ -33,7 +33,7 @@ public class RdfTest {
String expected;
RdfSerializerBuilder s = RdfSerializer.create().xmlabbrev()
- .property(RDF_rdfxml_tab, 3)
+ .set(RDF_rdfxml_tab, 3)
.sq()
.addRootProperty(true);
RdfParser p = RdfParser.create().xml().build();
@@ -193,7 +193,7 @@ public class RdfTest {
B b = new B().init(), b2;
String rdfXml, expected;
RdfSerializerBuilder s = RdfSerializer.create().xmlabbrev()
- .property(RDF_rdfxml_tab, 3)
+ .set(RDF_rdfxml_tab, 3)
.sq()
.addRootProperty(true);
RdfParser p = RdfParser.DEFAULT_XML;
@@ -426,7 +426,7 @@ public class RdfTest {
C c = new C().init(), c2;
String rdfXml, expected;
RdfSerializerBuilder s = RdfSerializer.create().xmlabbrev()
- .property(RDF_rdfxml_tab, 3)
+ .set(RDF_rdfxml_tab, 3)
.sq()
.addRootProperty(true);
RdfParser p = RdfParser.DEFAULT_XML;
http://git-wip-us.apache.org/repos/asf/juneau/blob/227719b2/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/parser/ParserGroupTest.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/parser/ParserGroupTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/parser/ParserGroupTest.java
index d6b039a..a984635 100755
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/parser/ParserGroupTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/parser/ParserGroupTest.java
@@ -46,20 +46,20 @@ public class ParserGroupTest {
public static class Parser1 extends JsonParser {
- public Parser1(PropertyStore propertyStore) {
- super(propertyStore, "text/foo", "text/foo_a");
+ public Parser1(PropertyStore2 ps) {
+ super(ps, "text/foo", "text/foo_a");
}
}
public static class Parser2 extends JsonParser {
- public Parser2(PropertyStore propertyStore) {
- super(propertyStore, "text/foo+bar", "text/foo+bar_a");
+ public Parser2(PropertyStore2 ps) {
+ super(ps, "text/foo+bar", "text/foo+bar_a");
}
}
public static class Parser3 extends JsonParser {
- public Parser3(PropertyStore propertyStore) {
- super(propertyStore, "text/baz", "text/baz_a");
+ public Parser3(PropertyStore2 ps) {
+ super(ps, "text/baz", "text/baz_a");
}
}
@@ -85,32 +85,32 @@ public class ParserGroupTest {
}
public static class P1 extends JsonParser {
- public P1(PropertyStore propertyStore) {
- super(propertyStore, "text/1");
+ public P1(PropertyStore2 ps) {
+ super(ps, "text/1");
}
}
public static class P2 extends JsonParser {
- public P2(PropertyStore propertyStore) {
- super(propertyStore, "text/2", "text/2a");
+ public P2(PropertyStore2 ps) {
+ super(ps, "text/2", "text/2a");
}
}
public static class P3 extends JsonParser {
- public P3(PropertyStore propertyStore) {
- super(propertyStore, "text/3");
+ public P3(PropertyStore2 ps) {
+ super(ps, "text/3");
}
}
public static class P4 extends JsonParser {
- public P4(PropertyStore propertyStore) {
- super(propertyStore, "text/4", "text/4a");
+ public P4(PropertyStore2 ps) {
+ super(ps, "text/4", "text/4a");
}
}
public static class P5 extends JsonParser {
- public P5(PropertyStore propertyStore) {
- super(propertyStore, "text/5");
+ public P5(PropertyStore2 ps) {
+ super(ps, "text/5");
}
}
}
http://git-wip-us.apache.org/repos/asf/juneau/blob/227719b2/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/serializer/SerializerGroupTest.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/serializer/SerializerGroupTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/serializer/SerializerGroupTest.java
index 385ba4e..45f3383 100755
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/serializer/SerializerGroupTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/serializer/SerializerGroupTest.java
@@ -51,20 +51,20 @@ public class SerializerGroupTest {
public static class SA1 extends JsonSerializer {
- public SA1(PropertyStore propertyStore) {
- super(propertyStore, "application/json", "text/foo+*", "text/foo_a+*");
+ public SA1(PropertyStore2 ps) {
+ super(ps, "application/json", "text/foo+*", "text/foo_a+*");
}
}
public static class SA2 extends JsonSerializer {
- public SA2(PropertyStore propertyStore) {
- super(propertyStore, "application/json", "text/foo+bar+*", "text/foo+bar_a+*");
+ public SA2(PropertyStore2 ps) {
+ super(ps, "application/json", "text/foo+bar+*", "text/foo+bar_a+*");
}
}
public static class SA3 extends JsonSerializer {
- public SA3(PropertyStore propertyStore) {
- super(propertyStore, "application/json", "text/baz+*", "text/baz_a+*");
+ public SA3(PropertyStore2 ps) {
+ super(ps, "application/json", "text/baz+*", "text/baz_a+*");
}
}
@@ -90,32 +90,32 @@ public class SerializerGroupTest {
}
public static class SB1 extends JsonSerializer {
- public SB1(PropertyStore propertyStore) {
- super(propertyStore, "application/json", "text/1");
+ public SB1(PropertyStore2 ps) {
+ super(ps, "application/json", "text/1");
}
}
public static class SB2 extends JsonSerializer {
- public SB2(PropertyStore propertyStore) {
- super(propertyStore, "application/json", "text/2", "text/2a");
+ public SB2(PropertyStore2 ps) {
+ super(ps, "application/json", "text/2", "text/2a");
}
}
public static class SB3 extends JsonSerializer {
- public SB3(PropertyStore propertyStore) {
- super(propertyStore, "application/json", "text/3");
+ public SB3(PropertyStore2 ps) {
+ super(ps, "application/json", "text/3");
}
}
public static class SB4 extends JsonSerializer {
- public SB4(PropertyStore propertyStore) {
- super(propertyStore, "application/json", "text/4", "text/4a");
+ public SB4(PropertyStore2 ps) {
+ super(ps, "application/json", "text/4", "text/4a");
}
}
public static class SB5 extends JsonSerializer {
- public SB5(PropertyStore propertyStore) {
- super(propertyStore, "application/json", "text/5");
+ public SB5(PropertyStore2 ps) {
+ super(ps, "application/json", "text/5");
}
}
@@ -135,20 +135,20 @@ public class SerializerGroupTest {
}
public static class SC1 extends JsonSerializer {
- public SC1(PropertyStore propertyStore) {
- super(propertyStore, "application/json", "text/*");
+ public SC1(PropertyStore2 ps) {
+ super(ps, "application/json", "text/*");
}
}
public static class SC2 extends JsonSerializer {
- public SC2(PropertyStore propertyStore) {
- super(propertyStore, "application/json", "*/json");
+ public SC2(PropertyStore2 ps) {
+ super(ps, "application/json", "*/json");
}
}
public static class SC3 extends JsonSerializer {
- public SC3(PropertyStore propertyStore) {
- super(propertyStore, "application/json", "*/*");
+ public SC3(PropertyStore2 ps) {
+ super(ps, "application/json", "*/*");
}
}
}
http://git-wip-us.apache.org/repos/asf/juneau/blob/227719b2/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/transforms/BeanFilterTest.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/transforms/BeanFilterTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/transforms/BeanFilterTest.java
index e5fcc26..e6b53ba 100755
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/transforms/BeanFilterTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/transforms/BeanFilterTest.java
@@ -30,13 +30,13 @@ public class BeanFilterTest {
BeanSession session;
BeanMap<A3> bm;
- session = PropertyStore.create().setBeanFilters(A1.class).getBeanContext().createSession();
+ session = BeanContext.create().setBeanFilters(A1.class).build().createSession();
bm = session.newBeanMap(A3.class);
assertEquals("f1", bm.get("f1"));
assertNull(bm.get("f2"));
assertNull(bm.get("f3"));
- session = PropertyStore.create().setBeanFilters(A2.class).getBeanContext().createSession();
+ session = BeanContext.create().setBeanFilters(A2.class).build().createSession();
bm = session.newBeanMap(A3.class);
assertEquals("f1", bm.get("f1"));
assertEquals("f2", bm.get("f2"));
@@ -73,13 +73,13 @@ public class BeanFilterTest {
BeanSession session;
BeanMap<Test2> bm;
- session = PropertyStore.create().setBeanFilters(B1.class).getBeanContext().createSession();
+ session = BeanContext.create().setBeanFilters(B1.class).build().createSession();
bm = session.newBeanMap(Test2.class);
assertEquals("f1", bm.get("f1"));
assertNull(bm.get("f2"));
assertNull(bm.get("f3"));
- session = PropertyStore.create().setBeanFilters(B2.class).getBeanContext().createSession();
+ session = BeanContext.create().setBeanFilters(B2.class).build().createSession();
bm = session.newBeanMap(Test2.class);
assertEquals("f1", bm.get("f1"));
assertEquals("f2", bm.get("f2"));
http://git-wip-us.apache.org/repos/asf/juneau/blob/227719b2/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/transforms/BeanMapTest.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/transforms/BeanMapTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/transforms/BeanMapTest.java
index 1e5d375..480936d 100755
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/transforms/BeanMapTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/transforms/BeanMapTest.java
@@ -26,7 +26,7 @@ public class BeanMapTest {
//====================================================================================================
@Test
public void testFilteredEntry() throws Exception {
- BeanSession session = PropertyStore.create().setPojoSwaps(ByteArrayBase64Swap.class).getBeanContext().createSession();
+ BeanSession session = BeanContext.create().setPojoSwaps(ByteArrayBase64Swap.class).build().createSession();
BeanMap<A> m = session.toBeanMap(new A());
assertEquals("AQID", m.get("f1"));
@@ -48,12 +48,12 @@ public class BeanMapTest {
//====================================================================================================
@Test
public void testFilteredEntryWithMultipleMatchingFilters() throws Exception {
- BeanSession session = PropertyStore.create().setPojoSwaps(B2Swap.class,B1Swap.class).getBeanContext().createSession();
+ BeanSession session = BeanContext.create().setPojoSwaps(B2Swap.class,B1Swap.class).build().createSession();
BeanMap<B> bm = session.toBeanMap(B.create());
ObjectMap om = (ObjectMap)bm.get("b1");
assertEquals("b2", om.getString("type"));
- session = PropertyStore.create().setPojoSwaps(B1Swap.class,B2Swap.class).getBeanContext().createSession();
+ session = BeanContext.create().setPojoSwaps(B1Swap.class,B2Swap.class).build().createSession();
bm = session.toBeanMap(B.create());
om = (ObjectMap)bm.get("b1");
assertEquals("b1", om.getString("type"));
http://git-wip-us.apache.org/repos/asf/juneau/blob/227719b2/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/transforms/CalendarSwapTest.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/transforms/CalendarSwapTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/transforms/CalendarSwapTest.java
index 6be4e10..68e7a32 100755
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/transforms/CalendarSwapTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/transforms/CalendarSwapTest.java
@@ -55,9 +55,9 @@ public class CalendarSwapTest {
return RdfSerializer.create()
.sq()
.useWhitespace(false)
- .property(RdfCommon.RDF_rdfxml_allowBadUris, true)
- .property(RdfCommon.RDF_rdfxml_showDoctypeDeclaration, false)
- .property(RdfCommon.RDF_rdfxml_showXmlDeclaration, false)
+ .set(RdfCommon.RDF_rdfxml_allowBadUris, true)
+ .set(RdfCommon.RDF_rdfxml_showDoctypeDeclaration, false)
+ .set(RdfCommon.RDF_rdfxml_showXmlDeclaration, false)
.build();
}
http://git-wip-us.apache.org/repos/asf/juneau/blob/227719b2/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/transforms/LocalizedDatesTest.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/transforms/LocalizedDatesTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/transforms/LocalizedDatesTest.java
index 582dcad..8809dea 100644
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/transforms/LocalizedDatesTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/transforms/LocalizedDatesTest.java
@@ -621,7 +621,7 @@ public class LocalizedDatesTest {
@SuppressWarnings("unused")
private String label, expected;
private Object calendar;
- private PropertyStore ps;
+ private BeanContext bc;
private Locale sessionLocale;
private TimeZone sessionTimeZone;
@@ -631,16 +631,18 @@ public class LocalizedDatesTest {
this.calendar = calendar;
this.sessionLocale = sessionLocale;
this.sessionTimeZone = sessionTimeZone;
- ps = PropertyStore.create().setPojoSwaps(swap);
+ BeanContextBuilder bcb = BeanContext.create();
+ bcb.setPojoSwaps(swap);
if (contextLocale != null)
- ps.setProperty(BEAN_locale, contextLocale);
+ bcb.set(BEAN_locale, contextLocale);
if (contextTimeZone != null)
- ps.setProperty(BEAN_timeZone, contextTimeZone);
+ bcb.set(BEAN_timeZone, contextTimeZone);
+ bc = bcb.build();
}
@Test
public void test() {
- BeanSession session = ps.getBeanContext().createSession(new BeanSessionArgs(null, sessionLocale, sessionTimeZone, null));
+ BeanSession session = bc.createSession(new BeanSessionArgs(null, sessionLocale, sessionTimeZone, null));
String actual = session.convertToType(calendar, String.class);
String actual2 = actual;
if (expected.indexOf('(') == -1)