Author: zhoukevin
Date: Fri Oct 15 15:17:01 2010
New Revision: 1022963
URL: http://svn.apache.org/viewvc?rev=1022963&view=rev
Log:
For objects of types generated by methods of java.util.Collections class, like java.util.Collections$UnmodifiableCollection generated by java.util.Collections.unmodifiableCollection(Collection) method etc, HARMONY has problem to encode and decode them while Oracle JDK doesn't. This patch also adds several test cases to reproduce those problems.
Added:
harmony/enhanced/java/trunk/classlib/modules/beans/main/
harmony/enhanced/java/trunk/classlib/modules/beans/main/java/
harmony/enhanced/java/trunk/classlib/modules/beans/main/java/java/
harmony/enhanced/java/trunk/classlib/modules/beans/main/java/java/beans/
harmony/enhanced/java/trunk/classlib/modules/beans/main/java/java/beans/UtilCollectionsPersistenceDelegate.java (with props)
harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/UtilCollectionsPersistenceDelegate.java (with props)
harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockCheckedCollection.xml (with props)
harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockCheckedList.xml (with props)
harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockCheckedMap.xml (with props)
harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockCheckedRandomAccessList.xml (with props)
harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockCheckedSet.xml (with props)
harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockCheckedSortedMap.xml (with props)
harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockCheckedSortedSet.xml (with props)
harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockGetPropertyClass.xml (with props)
harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockListImplements.xml (with props)
harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockSetImplements.xml (with props)
harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockSynchronizedCollection.xml (with props)
harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockSynchronizedList.xml (with props)
harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockSynchronizedMap.xml (with props)
harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockSynchronizedRandomAccessList.xml (with props)
harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockSynchronizedSet.xml (with props)
harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockSynchronizedSortedMap.xml (with props)
harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockSynchronizedSortedSet.xml (with props)
harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockUnmodifiableCollection.xml (with props)
harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockUnmodifiableList.xml (with props)
harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockUnmodifiableMap.xml (with props)
harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockUnmodifiableRandomAccessList.xml (with props)
harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockUnmodifiableSet.xml (with props)
harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockUnmodifiableSortedMap.xml (with props)
harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockUnmodifiableSortedSet.xml (with props)
Modified:
harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/DefaultPersistenceDelegate.java
harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/Encoder.java
harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/XMLEncoder.java
harmony/enhanced/java/trunk/classlib/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/XMLEncoderTest.java
Added: harmony/enhanced/java/trunk/classlib/modules/beans/main/java/java/beans/UtilCollectionsPersistenceDelegate.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/beans/main/java/java/beans/UtilCollectionsPersistenceDelegate.java?rev=1022963&view=auto
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/beans/main/java/java/beans/UtilCollectionsPersistenceDelegate.java (added)
+++ harmony/enhanced/java/trunk/classlib/modules/beans/main/java/java/beans/UtilCollectionsPersistenceDelegate.java Fri Oct 15 15:17:01 2010
@@ -0,0 +1,208 @@
+/*
+ * 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 java.beans;
+
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.SortedMap;
+import java.util.SortedSet;
+import java.util.TreeMap;
+import java.util.TreeSet;
+
+import org.apache.harmony.beans.BeansUtils;
+
+public class UtilCollectionsPersistenceDelegate extends PersistenceDelegate {
+
+ static String CLASS_PREFIX = "java.util.Collections$"; //$NON-NLS-1$
+
+ private static final String COLLECTIONS_TYPE = "type"; //$NON-NLS-1$
+
+ private static final String MAP_KEY_TYPE = "keyType"; //$NON-NLS-1$
+
+ private static final String MAP_VALUE_TYPE = "valueType"; //$NON-NLS-1$
+
+ protected boolean mutatesTo(Object o1, Object o2) {
+ if (BeansUtils.declaredEquals(o1.getClass())) {
+ return o1.equals(o2);
+ }
+ if (o1 instanceof Collection<?>) {
+ Collection<?> c1 = (Collection<?>) o1;
+ Collection<?> c2 = (Collection<?>) o2;
+ return c1.size() == c2.size() && c1.containsAll(c2);
+ }
+ if (o1 instanceof Map<?, ?>) {
+ Map<?, ?> m1 = (Map<?, ?>) o1;
+ Map<?, ?> m2 = (Map<?, ?>) o2;
+ return m1.size() == m2.size()
+ && m1.entrySet().containsAll(m2.entrySet());
+ }
+ return super.mutatesTo(o1, o2);
+ }
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @Override
+ protected Expression instantiate(Object oldInstance, Encoder enc) {
+ String className = oldInstance.getClass().getName();
+ if (className.endsWith("UnmodifiableCollection")) { //$NON-NLS-1$
+ // Collections.unmodifiableCollection(Collection);
+ return new Expression(oldInstance, Collections.class,
+ "unmodifiableCollection", new Object[] { new ArrayList( //$NON-NLS-1$
+ (Collection) oldInstance) });
+ } else if (className.endsWith("UnmodifiableList")) { //$NON-NLS-1$
+ // Collections.unmodifiableList(List);
+ return new Expression(oldInstance, Collections.class,
+ "unmodifiableList", new Object[] { new LinkedList(
+ (Collection) oldInstance) });
+ } else if (className.endsWith("UnmodifiableRandomAccessList")) { //$NON-NLS-1$
+ // Collections.unmodifiableList(List);
+ return new Expression(oldInstance, Collections.class,
+ "unmodifiableList", new Object[] { new ArrayList( //$NON-NLS-1$
+ (Collection) oldInstance) });
+ } else if (className.endsWith("UnmodifiableSet")) { //$NON-NLS-1$
+ // Collections.unmodifiableSet(Set);
+ return new Expression(oldInstance, Collections.class,
+ "unmodifiableSet", new Object[] { new HashSet( //$NON-NLS-1$
+ (Set) oldInstance) });
+ } else if (className.endsWith("UnmodifiableSortedSet")) { //$NON-NLS-1$
+ // Collections.unmodifiableSortedSet(set)
+ return new Expression(oldInstance, Collections.class,
+ "unmodifiableSortedSet", new Object[] { new TreeSet( //$NON-NLS-1$
+ (SortedSet) oldInstance) });
+ } else if (className.endsWith("UnmodifiableMap")) { //$NON-NLS-1$
+ return new Expression(oldInstance, Collections.class,
+ "unmodifiableMap", new Object[] { new HashMap( //$NON-NLS-1$
+ (Map) oldInstance) });
+ } else if (className.endsWith("UnmodifiableSortedMap")) { //$NON-NLS-1$
+ // Collections.unmodifiableSortedMap(SortedMap);
+ return new Expression(oldInstance, Collections.class,
+ "unmodifiableSortedMap", new Object[] { new TreeMap( //$NON-NLS-1$
+ (Map) oldInstance) });
+ } else if (className.endsWith("SynchronizedCollection")) { //$NON-NLS-1$
+ // Collections.synchronizedCollection(Collection);
+ return new Expression(oldInstance, Collections.class,
+ "synchronizedCollection", new Object[] { new ArrayList( //$NON-NLS-1$
+ (Collection) oldInstance) });
+ } else if (className.endsWith("SynchronizedList")) { //$NON-NLS-1$
+ // Collections.synchronizedList(List);
+ return new Expression(oldInstance, Collections.class,
+ "synchronizedList", new Object[] { new LinkedList( //$NON-NLS-1$
+ (List) oldInstance) });
+ } else if (className.endsWith("SynchronizedRandomAccessList")) { //$NON-NLS-1$
+ // Collections.synchronizedList(List);
+ return new Expression(oldInstance, Collections.class,
+ "synchronizedList", new Object[] { new ArrayList( //$NON-NLS-1$
+ (List) oldInstance) });
+ } else if (className.endsWith("SynchronizedSet")) { //$NON-NLS-1$
+ // Collections.synchronizedSet(Set);
+ return new Expression(oldInstance, Collections.class,
+ "synchronizedSet", new Object[] { new HashSet( //$NON-NLS-1$
+ (Set) oldInstance) });
+ } else if (className.endsWith("SynchronizedSortedSet")) { //$NON-NLS-1$
+ // Collections.synchronizedSortedSet(SortedSet);
+ return new Expression(oldInstance, Collections.class,
+ "synchronizedSortedSet", new Object[] { new TreeSet( //$NON-NLS-1$
+ (SortedSet) oldInstance) });
+ } else if (className.endsWith("SynchronizedMap")) { //$NON-NLS-1$
+ // Collections.synchronizedMap(Map);
+ return new Expression(oldInstance, Collections.class,
+ "synchronizedMap", new Object[] { new HashMap( //$NON-NLS-1$
+ (Map) oldInstance) });
+ } else if (className.endsWith("SynchronizedSortedMap")) { //$NON-NLS-1$
+ // Collections.synchronizedSortedMap(SortedMap)
+ return new Expression(oldInstance, Collections.class,
+ "synchronizedSortedMap", new Object[] { new TreeMap( //$NON-NLS-1$
+ (SortedMap) oldInstance) });
+ } else if (className.endsWith("CheckedCollection")) { //$NON-NLS-1$
+ // Collections.checkedCollection(Collection, Class);
+ return new Expression(oldInstance, Collections.class,
+ "checkedCollection", new Object[] { //$NON-NLS-1$
+ new ArrayList((Collection) oldInstance),
+ valueOfField(oldInstance, COLLECTIONS_TYPE) });
+ } else if (className.endsWith("CheckedList")) { //$NON-NLS-1$
+ // Collections.checkedList(List, Class);
+ return new Expression(oldInstance, Collections.class,
+ "checkedList", new Object[] {
+ new LinkedList((Collection) oldInstance),
+ valueOfField(oldInstance, COLLECTIONS_TYPE) });
+ } else if (className.endsWith("CheckedRandomAccessList")) { //$NON-NLS-1$
+ // Collections.checkedList(List, Class);
+ return new Expression(oldInstance, Collections.class,
+ "checkedList", new Object[] { //$NON-NLS-1$
+ new ArrayList((Collection) oldInstance),
+ valueOfField(oldInstance, COLLECTIONS_TYPE) });
+ } else if (className.endsWith("CheckedSet")) { //$NON-NLS-1$
+ // Collections.checkedSet(Set, Class);
+ return new Expression(oldInstance, Collections.class, "checkedSet", //$NON-NLS-1$
+ new Object[] { new HashSet((Set) oldInstance),
+ valueOfField(oldInstance, COLLECTIONS_TYPE) });
+ } else if (className.endsWith("CheckedSortedSet")) { //$NON-NLS-1$
+ // Collections.checkedSortedSet(SortedSet, Class);
+ return new Expression(oldInstance, Collections.class,
+ "checkedSortedSet", new Object[] { //$NON-NLS-1$
+ new TreeSet((Set) oldInstance),
+ valueOfField(oldInstance, COLLECTIONS_TYPE) });
+ } else if (className.endsWith("CheckedMap")) { //$NON-NLS-1$
+ // Collections.checkedMap(Map, keyType, valueType);
+ return new Expression(oldInstance, Collections.class, "checkedMap", //$NON-NLS-1$
+ new Object[] { new HashMap((Map) oldInstance),
+ valueOfField(oldInstance, MAP_KEY_TYPE),
+ valueOfField(oldInstance, MAP_VALUE_TYPE) });
+ } else if (className.endsWith("CheckedSortedMap")) { //$NON-NLS-1$
+ // Collections.checkedSortedMap(SortedMap, keyType, valueType);
+ return new Expression(oldInstance, Collections.class,
+ "checkedSortedMap", new Object[] { //$NON-NLS-1$
+ new TreeMap((Map) oldInstance),
+ valueOfField(oldInstance, MAP_KEY_TYPE),
+ valueOfField(oldInstance, MAP_VALUE_TYPE) });
+ }
+ return null;
+ }
+
+ private static Object valueOfField(Object obj, String fieldName) {
+ Class<?> clazz = obj.getClass();
+ Field field = null;
+ while (clazz != null) {
+ for (Field declaredField : clazz.getDeclaredFields()) {
+ if (fieldName.equals(declaredField.getName())) {
+ field = declaredField;
+ break;
+ }
+ }
+ clazz = clazz.getSuperclass();
+ }
+ if (field != null) {
+ if (!field.isAccessible()) {
+ field.setAccessible(true);
+ }
+ try {
+ return field.get(obj);
+ } catch (Exception e) {
+ // Ignored
+ }
+ }
+ return null;
+ }
+}
Propchange: harmony/enhanced/java/trunk/classlib/modules/beans/main/java/java/beans/UtilCollectionsPersistenceDelegate.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/DefaultPersistenceDelegate.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/DefaultPersistenceDelegate.java?rev=1022963&r1=1022962&r2=1022963&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/DefaultPersistenceDelegate.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/DefaultPersistenceDelegate.java Fri Oct 15 15:17:01 2010
@@ -141,10 +141,8 @@ public class DefaultPersistenceDelegate
Object targetVal = enc.get(oldVal);
Object newVal = new Expression(newInstance, getter.getName(),
null).getValue();
- boolean invokeSetter = targetVal == null ? (newVal != null && oldVal == null)
- : !enc.getPersistenceDelegate(targetVal.getClass())
- .mutatesTo(targetVal, newVal);
- if (invokeSetter) {
+ if (targetVal == null ? (newVal != null && oldVal == null)
+ : targetVal != newVal && !targetVal.equals(newVal)) {
enc.writeStatement(new Statement(oldInstance, setter
.getName(), new Object[] { oldVal }));
}
Modified: harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/Encoder.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/Encoder.java?rev=1022963&r1=1022962&r2=1022963&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/Encoder.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/Encoder.java Fri Oct 15 15:17:01 2010
@@ -71,6 +71,8 @@ public class Encoder {
private static final DefaultPersistenceDelegate defaultPD = new DefaultPersistenceDelegate();
+ private static final UtilCollectionsPersistenceDelegate utilCollectionsPD = new UtilCollectionsPersistenceDelegate();
+
private static final ArrayPersistenceDelegate arrayPD = new ArrayPersistenceDelegate();
private static final ProxyPersistenceDelegate proxyPD = new ProxyPersistenceDelegate();
@@ -136,6 +138,19 @@ public class Encoder {
delegates.put(ScrollPane.class, new AwtScrollPanePersistenceDelegate());
delegates.put(Date.class, new UtilDatePersistenceDelegate());
+
+ PersistenceDelegate pd = new UtilListPersistenceDelegate();
+ delegates.put(java.util.List.class, pd);
+ delegates.put(java.util.AbstractList.class, pd);
+
+ pd = new UtilCollectionPersistenceDelegate();
+ delegates.put(java.util.Collection.class, pd);
+ delegates.put(java.util.AbstractCollection.class, pd);
+
+ pd = new UtilMapPersistenceDelegate();
+ delegates.put(java.util.Map.class, pd);
+ delegates.put(java.util.AbstractMap.class, pd);
+ delegates.put(java.util.Hashtable.class, pd);
}
private ExceptionListener listener = defaultExListener;
@@ -221,16 +236,9 @@ public class Encoder {
return registeredPD;
}
- if (java.util.List.class.isAssignableFrom(type)) {
- return new UtilListPersistenceDelegate();
- }
-
- if (Collection.class.isAssignableFrom(type)) {
- return new UtilCollectionPersistenceDelegate();
- }
-
- if (Map.class.isAssignableFrom(type)) {
- return new UtilMapPersistenceDelegate();
+ if (type.getName().startsWith(
+ UtilCollectionsPersistenceDelegate.CLASS_PREFIX)) {
+ return utilCollectionsPD;
}
if (type.isArray()) {
Added: harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/UtilCollectionsPersistenceDelegate.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/UtilCollectionsPersistenceDelegate.java?rev=1022963&view=auto
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/UtilCollectionsPersistenceDelegate.java (added)
+++ harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/UtilCollectionsPersistenceDelegate.java Fri Oct 15 15:17:01 2010
@@ -0,0 +1,208 @@
+/*
+ * 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 java.beans;
+
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.SortedMap;
+import java.util.SortedSet;
+import java.util.TreeMap;
+import java.util.TreeSet;
+
+import org.apache.harmony.beans.BeansUtils;
+
+class UtilCollectionsPersistenceDelegate extends PersistenceDelegate {
+
+ static String CLASS_PREFIX = "java.util.Collections$"; //$NON-NLS-1$
+
+ private static final String COLLECTIONS_TYPE = "type"; //$NON-NLS-1$
+
+ private static final String MAP_KEY_TYPE = "keyType"; //$NON-NLS-1$
+
+ private static final String MAP_VALUE_TYPE = "valueType"; //$NON-NLS-1$
+
+ protected boolean mutatesTo(Object o1, Object o2) {
+ if (BeansUtils.declaredEquals(o1.getClass())) {
+ return o1.equals(o2);
+ }
+ if (o1 instanceof Collection<?>) {
+ Collection<?> c1 = (Collection<?>) o1;
+ Collection<?> c2 = (Collection<?>) o2;
+ return c1.size() == c2.size() && c1.containsAll(c2);
+ }
+ if (o1 instanceof Map<?, ?>) {
+ Map<?, ?> m1 = (Map<?, ?>) o1;
+ Map<?, ?> m2 = (Map<?, ?>) o2;
+ return m1.size() == m2.size()
+ && m1.entrySet().containsAll(m2.entrySet());
+ }
+ return super.mutatesTo(o1, o2);
+ }
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @Override
+ protected Expression instantiate(Object oldInstance, Encoder enc) {
+ String className = oldInstance.getClass().getName();
+ if (className.endsWith("UnmodifiableCollection")) { //$NON-NLS-1$
+ // Collections.unmodifiableCollection(Collection);
+ return new Expression(oldInstance, Collections.class,
+ "unmodifiableCollection", new Object[] { new ArrayList( //$NON-NLS-1$
+ (Collection) oldInstance) });
+ } else if (className.endsWith("UnmodifiableList")) { //$NON-NLS-1$
+ // Collections.unmodifiableList(List);
+ return new Expression(oldInstance, Collections.class,
+ "unmodifiableList", new Object[] { new LinkedList(
+ (Collection) oldInstance) });
+ } else if (className.endsWith("UnmodifiableRandomAccessList")) { //$NON-NLS-1$
+ // Collections.unmodifiableList(List);
+ return new Expression(oldInstance, Collections.class,
+ "unmodifiableList", new Object[] { new ArrayList( //$NON-NLS-1$
+ (Collection) oldInstance) });
+ } else if (className.endsWith("UnmodifiableSet")) { //$NON-NLS-1$
+ // Collections.unmodifiableSet(Set);
+ return new Expression(oldInstance, Collections.class,
+ "unmodifiableSet", new Object[] { new HashSet( //$NON-NLS-1$
+ (Set) oldInstance) });
+ } else if (className.endsWith("UnmodifiableSortedSet")) { //$NON-NLS-1$
+ // Collections.unmodifiableSortedSet(set)
+ return new Expression(oldInstance, Collections.class,
+ "unmodifiableSortedSet", new Object[] { new TreeSet( //$NON-NLS-1$
+ (SortedSet) oldInstance) });
+ } else if (className.endsWith("UnmodifiableMap")) { //$NON-NLS-1$
+ return new Expression(oldInstance, Collections.class,
+ "unmodifiableMap", new Object[] { new HashMap( //$NON-NLS-1$
+ (Map) oldInstance) });
+ } else if (className.endsWith("UnmodifiableSortedMap")) { //$NON-NLS-1$
+ // Collections.unmodifiableSortedMap(SortedMap);
+ return new Expression(oldInstance, Collections.class,
+ "unmodifiableSortedMap", new Object[] { new TreeMap( //$NON-NLS-1$
+ (Map) oldInstance) });
+ } else if (className.endsWith("SynchronizedCollection")) { //$NON-NLS-1$
+ // Collections.synchronizedCollection(Collection);
+ return new Expression(oldInstance, Collections.class,
+ "synchronizedCollection", new Object[] { new ArrayList( //$NON-NLS-1$
+ (Collection) oldInstance) });
+ } else if (className.endsWith("SynchronizedList")) { //$NON-NLS-1$
+ // Collections.synchronizedList(List);
+ return new Expression(oldInstance, Collections.class,
+ "synchronizedList", new Object[] { new LinkedList( //$NON-NLS-1$
+ (List) oldInstance) });
+ } else if (className.endsWith("SynchronizedRandomAccessList")) { //$NON-NLS-1$
+ // Collections.synchronizedList(List);
+ return new Expression(oldInstance, Collections.class,
+ "synchronizedList", new Object[] { new ArrayList( //$NON-NLS-1$
+ (List) oldInstance) });
+ } else if (className.endsWith("SynchronizedSet")) { //$NON-NLS-1$
+ // Collections.synchronizedSet(Set);
+ return new Expression(oldInstance, Collections.class,
+ "synchronizedSet", new Object[] { new HashSet( //$NON-NLS-1$
+ (Set) oldInstance) });
+ } else if (className.endsWith("SynchronizedSortedSet")) { //$NON-NLS-1$
+ // Collections.synchronizedSortedSet(SortedSet);
+ return new Expression(oldInstance, Collections.class,
+ "synchronizedSortedSet", new Object[] { new TreeSet( //$NON-NLS-1$
+ (SortedSet) oldInstance) });
+ } else if (className.endsWith("SynchronizedMap")) { //$NON-NLS-1$
+ // Collections.synchronizedMap(Map);
+ return new Expression(oldInstance, Collections.class,
+ "synchronizedMap", new Object[] { new HashMap( //$NON-NLS-1$
+ (Map) oldInstance) });
+ } else if (className.endsWith("SynchronizedSortedMap")) { //$NON-NLS-1$
+ // Collections.synchronizedSortedMap(SortedMap)
+ return new Expression(oldInstance, Collections.class,
+ "synchronizedSortedMap", new Object[] { new TreeMap( //$NON-NLS-1$
+ (SortedMap) oldInstance) });
+ } else if (className.endsWith("CheckedCollection")) { //$NON-NLS-1$
+ // Collections.checkedCollection(Collection, Class);
+ return new Expression(oldInstance, Collections.class,
+ "checkedCollection", new Object[] { //$NON-NLS-1$
+ new ArrayList((Collection) oldInstance),
+ valueOfField(oldInstance, COLLECTIONS_TYPE) });
+ } else if (className.endsWith("CheckedList")) { //$NON-NLS-1$
+ // Collections.checkedList(List, Class);
+ return new Expression(oldInstance, Collections.class,
+ "checkedList", new Object[] {
+ new LinkedList((Collection) oldInstance),
+ valueOfField(oldInstance, COLLECTIONS_TYPE) });
+ } else if (className.endsWith("CheckedRandomAccessList")) { //$NON-NLS-1$
+ // Collections.checkedList(List, Class);
+ return new Expression(oldInstance, Collections.class,
+ "checkedList", new Object[] { //$NON-NLS-1$
+ new ArrayList((Collection) oldInstance),
+ valueOfField(oldInstance, COLLECTIONS_TYPE) });
+ } else if (className.endsWith("CheckedSet")) { //$NON-NLS-1$
+ // Collections.checkedSet(Set, Class);
+ return new Expression(oldInstance, Collections.class, "checkedSet", //$NON-NLS-1$
+ new Object[] { new HashSet((Set) oldInstance),
+ valueOfField(oldInstance, COLLECTIONS_TYPE) });
+ } else if (className.endsWith("CheckedSortedSet")) { //$NON-NLS-1$
+ // Collections.checkedSortedSet(SortedSet, Class);
+ return new Expression(oldInstance, Collections.class,
+ "checkedSortedSet", new Object[] { //$NON-NLS-1$
+ new TreeSet((Set) oldInstance),
+ valueOfField(oldInstance, COLLECTIONS_TYPE) });
+ } else if (className.endsWith("CheckedMap")) { //$NON-NLS-1$
+ // Collections.checkedMap(Map, keyType, valueType);
+ return new Expression(oldInstance, Collections.class, "checkedMap", //$NON-NLS-1$
+ new Object[] { new HashMap((Map) oldInstance),
+ valueOfField(oldInstance, MAP_KEY_TYPE),
+ valueOfField(oldInstance, MAP_VALUE_TYPE) });
+ } else if (className.endsWith("CheckedSortedMap")) { //$NON-NLS-1$
+ // Collections.checkedSortedMap(SortedMap, keyType, valueType);
+ return new Expression(oldInstance, Collections.class,
+ "checkedSortedMap", new Object[] { //$NON-NLS-1$
+ new TreeMap((Map) oldInstance),
+ valueOfField(oldInstance, MAP_KEY_TYPE),
+ valueOfField(oldInstance, MAP_VALUE_TYPE) });
+ }
+ return null;
+ }
+
+ private static Object valueOfField(Object obj, String fieldName) {
+ Class<?> clazz = obj.getClass();
+ Field field = null;
+ while (clazz != null) {
+ for (Field declaredField : clazz.getDeclaredFields()) {
+ if (fieldName.equals(declaredField.getName())) {
+ field = declaredField;
+ break;
+ }
+ }
+ clazz = clazz.getSuperclass();
+ }
+ if (field != null) {
+ if (!field.isAccessible()) {
+ field.setAccessible(true);
+ }
+ try {
+ return field.get(obj);
+ } catch (Exception e) {
+ // Ignored
+ }
+ }
+ return null;
+ }
+}
Propchange: harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/UtilCollectionsPersistenceDelegate.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/XMLEncoder.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/XMLEncoder.java?rev=1022963&r1=1022962&r2=1022963&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/XMLEncoder.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/XMLEncoder.java Fri Oct 15 15:17:01 2010
@@ -136,15 +136,6 @@ public class XMLEncoder extends Encoder
return buf;
}
- private String idSerialNoOfObject(Object obj) {
- Class<?> clazz = obj.getClass();
- Integer serialNo = (Integer) clazzCounterMap.get(clazz);
- serialNo = serialNo == null ? 0 : serialNo;
- String id = BeansUtils.idOfClass(obj.getClass()) + serialNo;
- clazzCounterMap.put(clazz, ++serialNo);
- return id;
- }
-
/**
* Writes out all objects since last flush to the output stream.
* <p>
@@ -512,7 +503,7 @@ public class XMLEncoder extends Encoder
List<?> subStats, int indent) {
// open tag, begin
flushIndent(indent);
- String tagName = stat instanceof Expression ? "object" : "void";
+ String tagName = "void";
out.print("<");
out.print(tagName);
@@ -689,6 +680,15 @@ public class XMLEncoder extends Encoder
return (method.startsWith(BeansUtils.SET) && method.length() > 3 && args.length == 1);
}
+ private String idSerialNoOfObject(Object obj) {
+ Class<?> clazz = obj.getClass();
+ Integer serialNo = (Integer) clazzCounterMap.get(clazz);
+ serialNo = serialNo == null ? 0 : serialNo;
+ String id = BeansUtils.idOfClass(obj.getClass()) + serialNo;
+ clazzCounterMap.put(clazz, ++serialNo);
+ return id;
+ }
+
/*
* The preprocess removes unused statements and counts references of every
* object
@@ -799,17 +799,48 @@ public class XMLEncoder extends Encoder
return;
}
// deal with 'owner' property
- if (stat.getTarget() == owner && owner != null) {
+ Object target = stat.getTarget();
+ if (target == owner && owner != null) {
needOwner = true;
}
// record how a statement affects the target object
- Record rec = objRecordMap.get(stat.getTarget());
+ Record rec = objRecordMap.get(target);
if (rec == null) {
rec = new Record();
- objRecordMap.put(stat.getTarget(), rec);
+ objRecordMap.put(target, rec);
+ }
+
+ boolean hasRecord = false;
+ String methodName = stat.getMethodName();
+ Object[] args = stat.getArguments();
+ if (isSetPropertyStat(methodName, args)
+ || isSetArrayStat(target, methodName, args)) {
+ for (Statement subStat : rec.stats) {
+ if (target == subStat.getTarget()
+ && methodName.equals(subStat.getMethodName())) {
+ Object[] subArgs = subStat.getArguments();
+ if (args.length == subArgs.length) {
+ boolean equals = true;
+ for (int index = 0; index < args.length; index++) {
+ if (getPersistenceDelegate(args[index].getClass())
+ .mutatesTo(args[index], subArgs[index])) {
+ continue;
+ }
+ equals = false;
+ break;
+ }
+ if (equals) {
+ hasRecord = true;
+ break;
+ }
+ }
+ }
+ }
+ }
+ if (!hasRecord) {
+ rec.stats.add(stat);
}
- rec.stats.add(stat);
}
/**
Modified: harmony/enhanced/java/trunk/classlib/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/XMLEncoderTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/XMLEncoderTest.java?rev=1022963&r1=1022962&r2=1022963&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/XMLEncoderTest.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/XMLEncoderTest.java Fri Oct 15 15:17:01 2010
@@ -36,10 +36,23 @@ import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
+import java.util.Collections;
import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.ListIterator;
import java.util.Map;
+import java.util.Set;
+import java.util.SortedMap;
+import java.util.SortedSet;
import java.util.TreeMap;
+import java.util.TreeSet;
import junit.framework.TestCase;
@@ -1125,4 +1138,781 @@ public class XMLEncoderTest extends Test
return ((0x0000 <= c && c < 0x0009) || (0x000a < c && c < 0x000d)
|| (0x000d < c && c < 0x0020) || (0xd7ff < c && c < 0xe000) || c == 0xfffe);
}
+
+ public static class MockUnmodifiableCollection {
+
+ private Collection<String> property = new ArrayList<String>();
+
+ public Collection<String> getProperty() {
+ return Collections.unmodifiableCollection(property);
+ }
+
+ public void setProperty(Collection<String> set) {
+ property.clear();
+ property.addAll(set);
+ }
+ }
+
+ public void testWriteObject_MockUnmodifiableCollection() throws Exception {
+ MockUnmodifiableCollection mockCollections = new MockUnmodifiableCollection();
+ Class<?> propertyClass = mockCollections.getProperty().getClass();
+ assertEquals("java.util.Collections$UnmodifiableCollection",
+ propertyClass.getName());
+ assertSamePD(propertyClass);
+ mockCollections.setProperty(Arrays
+ .asList(new String[] { "A", "B", "C" }));
+ assertCodedXML(mockCollections, "/xml/MockUnmodifiableCollection.xml");
+ }
+
+ public static class MockUnmodifiableList {
+
+ private List<String> property = new LinkedList<String>();
+
+ public Collection<String> getProperty() {
+ return Collections.unmodifiableList(property);
+ }
+
+ public void setProperty(Collection<String> set) {
+ property.clear();
+ property.addAll(set);
+ }
+ }
+
+ public void testWriteObject_MockUnmodifiableList() throws Exception {
+ MockUnmodifiableList mockCollections = new MockUnmodifiableList();
+ Class<?> propertyClass = mockCollections.getProperty().getClass();
+ assertEquals("java.util.Collections$UnmodifiableList",
+ propertyClass.getName());
+ assertSamePD(propertyClass);
+ mockCollections.setProperty(Arrays
+ .asList(new String[] { "A", "B", "C" }));
+ assertCodedXML(mockCollections, "/xml/MockUnmodifiableList.xml");
+ }
+
+ public static class MockUnmodifiableRandomAccessList {
+
+ private List<String> property = new ArrayList<String>();
+
+ public Collection<String> getProperty() {
+ return Collections.unmodifiableList(property);
+ }
+
+ public void setProperty(Collection<String> set) {
+ property.clear();
+ property.addAll(set);
+ }
+ }
+
+ public void testWriteObject_MockUnmodifiableRandomAccessList()
+ throws Exception {
+ MockUnmodifiableRandomAccessList mockCollections = new MockUnmodifiableRandomAccessList();
+ Class<?> propertyClass = mockCollections.getProperty().getClass();
+ assertEquals("java.util.Collections$UnmodifiableRandomAccessList",
+ propertyClass.getName());
+ assertSamePD(propertyClass);
+ mockCollections.setProperty(Arrays
+ .asList(new String[] { "A", "B", "C" }));
+ assertCodedXML(mockCollections,
+ "/xml/MockUnmodifiableRandomAccessList.xml");
+ }
+
+ public static class MockUnmodifiableSet {
+
+ private Set<String> property = new HashSet<String>();
+
+ public Collection<String> getProperty() {
+ return Collections.unmodifiableSet(property);
+ }
+
+ public void setProperty(Collection<String> set) {
+ property.clear();
+ property.addAll(set);
+ }
+ }
+
+ public void testWriteObject_MockUnmodifiableSet() throws Exception {
+ MockUnmodifiableSet mockCollections = new MockUnmodifiableSet();
+ Class<?> propertyClass = mockCollections.getProperty().getClass();
+ assertEquals("java.util.Collections$UnmodifiableSet",
+ propertyClass.getName());
+ assertSamePD(propertyClass);
+ Set<String> prop = new HashSet<String>();
+ prop.add("A");
+ prop.add("B");
+ prop.add("C");
+ mockCollections.setProperty(prop);
+ assertCodedXML(mockCollections, "/xml/MockUnmodifiableSet.xml");
+ }
+
+ public static class MockUnmodifiableSortedSet {
+
+ private SortedSet<String> property = new TreeSet<String>();
+
+ public Collection<String> getProperty() {
+ return Collections.unmodifiableSortedSet(property);
+ }
+
+ public void setProperty(Collection<String> set) {
+ property.clear();
+ property.addAll(set);
+ }
+ }
+
+ public void testWriteObject_MockUnmodifiableSortedSet() throws Exception {
+ MockUnmodifiableSortedSet mockCollections = new MockUnmodifiableSortedSet();
+ Class<?> propertyClass = mockCollections.getProperty().getClass();
+ assertEquals("java.util.Collections$UnmodifiableSortedSet",
+ propertyClass.getName());
+ assertSamePD(propertyClass);
+ Set<String> prop = new HashSet<String>();
+ prop.add("A");
+ prop.add("B");
+ prop.add("C");
+ mockCollections.setProperty(prop);
+ assertCodedXML(mockCollections, "/xml/MockUnmodifiableSortedSet.xml");
+ }
+
+ public static class MockUnmodifiableMap {
+
+ private Map<String, String> property = new HashMap<String, String>();
+
+ public Map<String, String> getProperty() {
+ return Collections.unmodifiableMap(property);
+ }
+
+ public void setProperty(Map<String, String> prop) {
+ property.clear();
+ property.putAll(prop);
+ }
+ }
+
+ public void testWriteObject_MockUnmodifiableMap() throws Exception {
+ MockUnmodifiableMap mockCollections = new MockUnmodifiableMap();
+ Class<?> propertyClass = mockCollections.getProperty().getClass();
+ assertEquals("java.util.Collections$UnmodifiableMap",
+ propertyClass.getName());
+ assertSamePD(propertyClass);
+ Map<String, String> prop = new HashMap<String, String>();
+ prop.put("A", "a");
+ prop.put("B", "b");
+ prop.put("C", "c");
+ mockCollections.setProperty(prop);
+ assertCodedXML(mockCollections, "/xml/MockUnmodifiableMap.xml");
+ }
+
+ public static class MockUnmodifiableSortedMap {
+
+ private SortedMap<String, String> property = new TreeMap<String, String>();
+
+ public Map<String, String> getProperty() {
+ return Collections.unmodifiableSortedMap(property);
+ }
+
+ public void setProperty(Map<String, String> prop) {
+ property.clear();
+ property.putAll(prop);
+ }
+ }
+
+ public void testWriteObject_MockUnmodifiableSortedMap() throws Exception {
+ MockUnmodifiableSortedMap mockCollections = new MockUnmodifiableSortedMap();
+ Class<?> propertyClass = mockCollections.getProperty().getClass();
+ assertEquals("java.util.Collections$UnmodifiableSortedMap",
+ propertyClass.getName());
+ assertSamePD(propertyClass);
+ Map<String, String> prop = new HashMap<String, String>();
+ prop.put("A", "a");
+ prop.put("B", "b");
+ prop.put("C", "c");
+ mockCollections.setProperty(prop);
+ assertCodedXML(mockCollections, "/xml/MockUnmodifiableSortedMap.xml");
+ }
+
+ public static class MockSynchronizedCollection {
+
+ private Collection<String> property = new ArrayList<String>();
+
+ public Collection<String> getProperty() {
+ return Collections.synchronizedCollection(property);
+ }
+
+ public void setProperty(Collection<String> prop) {
+ property.clear();
+ property.addAll(prop);
+ }
+ }
+
+ public void testWriteObject_MockSynchronizedCollection() throws Exception {
+ MockSynchronizedCollection mockCollections = new MockSynchronizedCollection();
+ Class<?> propertyClass = mockCollections.getProperty().getClass();
+ assertEquals("java.util.Collections$SynchronizedCollection",
+ propertyClass.getName());
+ assertSamePD(propertyClass);
+ mockCollections.setProperty(Arrays
+ .asList(new String[] { "A", "B", "C" }));
+ assertCodedXML(mockCollections, "/xml/MockSynchronizedCollection.xml");
+ }
+
+ public static class MockSynchronizedList {
+
+ private List<String> property = new LinkedList<String>();
+
+ public Collection<String> getProperty() {
+ return Collections.synchronizedList(property);
+ }
+
+ public void setProperty(Collection<String> prop) {
+ property.clear();
+ property.addAll(prop);
+ }
+ }
+
+ public void testWriteObject_MockSynchronizedList() throws Exception {
+ MockSynchronizedList mockCollections = new MockSynchronizedList();
+ Class<?> propertyClass = mockCollections.getProperty().getClass();
+ assertEquals("java.util.Collections$SynchronizedList",
+ propertyClass.getName());
+ assertSamePD(propertyClass);
+ mockCollections.setProperty(Arrays
+ .asList(new String[] { "A", "B", "C" }));
+ assertCodedXML(mockCollections, "/xml/MockSynchronizedList.xml");
+ }
+
+ public static class MockSynchronizedRandomAccessList {
+
+ private List<String> property = new ArrayList<String>();
+
+ public Collection<String> getProperty() {
+ return Collections.synchronizedList(property);
+ }
+
+ public void setProperty(Collection<String> prop) {
+ property.clear();
+ property.addAll(prop);
+ }
+ }
+
+ public void testWriteObject_MockSynchronizedRandomAccessList()
+ throws Exception {
+ MockSynchronizedRandomAccessList mockCollections = new MockSynchronizedRandomAccessList();
+ Class<?> propertyClass = mockCollections.getProperty().getClass();
+ assertEquals("java.util.Collections$SynchronizedRandomAccessList",
+ propertyClass.getName());
+ assertSamePD(propertyClass);
+ mockCollections.setProperty(Arrays
+ .asList(new String[] { "A", "B", "C" }));
+ assertCodedXML(mockCollections,
+ "/xml/MockSynchronizedRandomAccessList.xml");
+ }
+
+ public static class MockSynchronizedSet {
+
+ private Set<String> property = new HashSet<String>();
+
+ public Collection<String> getProperty() {
+ return Collections.synchronizedSet(property);
+ }
+
+ public void setProperty(Collection<String> prop) {
+ property.clear();
+ property.addAll(prop);
+ }
+ }
+
+ public void testWriteObject_MockSynchronizedSet() throws Exception {
+ MockSynchronizedSet mockCollections = new MockSynchronizedSet();
+ Class<?> propertyClass = mockCollections.getProperty().getClass();
+ assertEquals("java.util.Collections$SynchronizedSet",
+ propertyClass.getName());
+ assertSamePD(propertyClass);
+ mockCollections.setProperty(Arrays
+ .asList(new String[] { "A", "B", "C" }));
+ assertCodedXML(mockCollections, "/xml/MockSynchronizedSet.xml");
+ }
+
+ public static class MockSynchronizedSortedSet {
+
+ private SortedSet<String> property = new TreeSet<String>();
+
+ public Collection<String> getProperty() {
+ return Collections.synchronizedSortedSet(property);
+ }
+
+ public void setProperty(Collection<String> prop) {
+ property.clear();
+ property.addAll(prop);
+ }
+ }
+
+ public void testWriteObject_MockSynchronizedSortedSet() throws Exception {
+ MockSynchronizedSortedSet mockCollections = new MockSynchronizedSortedSet();
+ Class<?> propertyClass = mockCollections.getProperty().getClass();
+ assertEquals("java.util.Collections$SynchronizedSortedSet",
+ propertyClass.getName());
+ assertSamePD(propertyClass);
+ mockCollections.setProperty(Arrays
+ .asList(new String[] { "A", "B", "C" }));
+ assertCodedXML(mockCollections, "/xml/MockSynchronizedSortedSet.xml");
+ }
+
+ public static class MockSynchronizedMap {
+
+ private Map<String, String> property = new HashMap<String, String>();
+
+ public Map<String, String> getProperty() {
+ return Collections.synchronizedMap(property);
+ }
+
+ public void setProperty(Map<String, String> prop) {
+ property.clear();
+ property.putAll(prop);
+ }
+ }
+
+ public void testWriteObject_MockSynchronizedMap() throws Exception {
+ MockSynchronizedMap mockCollections = new MockSynchronizedMap();
+ Class<?> propertyClass = mockCollections.getProperty().getClass();
+ assertEquals("java.util.Collections$SynchronizedMap",
+ propertyClass.getName());
+ assertSamePD(propertyClass);
+ Map<String, String> prop = new HashMap<String, String>();
+ prop.put("A", "a");
+ prop.put("B", "b");
+ prop.put("C", "c");
+ mockCollections.setProperty(prop);
+ assertCodedXML(mockCollections, "/xml/MockSynchronizedMap.xml");
+ }
+
+ public static class MockSynchronizedSortedMap {
+
+ private SortedMap<String, String> property = new TreeMap<String, String>();
+
+ public Map<String, String> getProperty() {
+ return Collections.synchronizedSortedMap(property);
+ }
+
+ public void setProperty(Map<String, String> prop) {
+ property.clear();
+ property.putAll(prop);
+ }
+ }
+
+ public void testWriteObject_MockSynchronizedSortedMap() throws Exception {
+ MockSynchronizedSortedMap mockCollections = new MockSynchronizedSortedMap();
+ Class<?> propertyClass = mockCollections.getProperty().getClass();
+ assertEquals("java.util.Collections$SynchronizedSortedMap",
+ propertyClass.getName());
+ assertSamePD(propertyClass);
+ Map<String, String> prop = new HashMap<String, String>();
+ prop.put("A", "a");
+ prop.put("B", "b");
+ prop.put("C", "c");
+ mockCollections.setProperty(prop);
+ assertCodedXML(mockCollections, "/xml/MockSynchronizedSortedMap.xml");
+ }
+
+ public static class MockCheckedCollection {
+
+ private Collection<String> property = new ArrayList<String>();
+
+ public Collection<String> getProperty() {
+ return Collections.checkedCollection(property, String.class);
+ }
+
+ public void setProperty(Collection<String> prop) {
+ property.clear();
+ property.addAll(prop);
+ }
+ }
+
+ public void testWriteObject_MockCheckedCollection() throws Exception {
+ MockCheckedCollection mockCollections = new MockCheckedCollection();
+ Class<?> propertyClass = mockCollections.getProperty().getClass();
+ assertEquals("java.util.Collections$CheckedCollection",
+ propertyClass.getName());
+ assertSamePD(propertyClass);
+ mockCollections.setProperty(Arrays
+ .asList(new String[] { "A", "B", "C" }));
+ assertCodedXML(mockCollections, "/xml/MockCheckedCollection.xml");
+ }
+
+ public static class MockCheckedList {
+
+ private List<String> property = new LinkedList<String>();
+
+ public Collection<String> getProperty() {
+ return Collections.checkedList(property, String.class);
+ }
+
+ public void setProperty(Collection<String> prop) {
+ property.clear();
+ property.addAll(prop);
+ }
+ }
+
+ public void testWriteObject_MockCheckedList() throws Exception {
+ MockCheckedList mockCollections = new MockCheckedList();
+ Class<?> propertyClass = mockCollections.getProperty().getClass();
+ assertEquals("java.util.Collections$CheckedList",
+ propertyClass.getName());
+ assertSamePD(propertyClass);
+ mockCollections.setProperty(Arrays
+ .asList(new String[] { "A", "B", "C" }));
+ assertCodedXML(mockCollections, "/xml/MockCheckedList.xml");
+ }
+
+ public static class MockCheckedRandomAccessList {
+
+ private List<String> property = new ArrayList<String>();
+
+ public Collection<String> getProperty() {
+ return Collections.checkedList(property, String.class);
+ }
+
+ public void setProperty(Collection<String> prop) {
+ property.clear();
+ property.addAll(prop);
+ }
+ }
+
+ public void testWriteObject_MockCheckedRandomAccessList() throws Exception {
+ MockCheckedRandomAccessList mockCollections = new MockCheckedRandomAccessList();
+ Class<?> propertyClass = mockCollections.getProperty().getClass();
+ assertEquals("java.util.Collections$CheckedRandomAccessList",
+ propertyClass.getName());
+ assertSamePD(propertyClass);
+ mockCollections.setProperty(Arrays
+ .asList(new String[] { "A", "B", "C" }));
+ assertCodedXML(mockCollections, "/xml/MockCheckedRandomAccessList.xml");
+ }
+
+ public static class MockCheckedSet {
+
+ private Set<String> property = new HashSet<String>();
+
+ public Collection<String> getProperty() {
+ return Collections.checkedSet(property, String.class);
+ }
+
+ public void setProperty(Collection<String> prop) {
+ property.clear();
+ property.addAll(prop);
+ }
+ }
+
+ public void testWriteObject_MockCheckedSet() throws Exception {
+ MockCheckedSet mockCollections = new MockCheckedSet();
+ Class<?> propertyClass = mockCollections.getProperty().getClass();
+ assertEquals("java.util.Collections$CheckedSet",
+ propertyClass.getName());
+ assertSamePD(propertyClass);
+ mockCollections.setProperty(Arrays
+ .asList(new String[] { "A", "B", "C" }));
+ assertCodedXML(mockCollections, "/xml/MockCheckedSet.xml");
+ }
+
+ public static class MockCheckedSortedSet {
+
+ private SortedSet<String> property = new TreeSet<String>();
+
+ public Collection<String> getProperty() {
+ return Collections.checkedSortedSet(property, String.class);
+ }
+
+ public void setProperty(Collection<String> prop) {
+ property.clear();
+ property.addAll(prop);
+ }
+ }
+
+ public void testWriteObject_MockCheckedSortedSet() throws Exception {
+ MockCheckedSortedSet mockCollections = new MockCheckedSortedSet();
+ Class<?> propertyClass = mockCollections.getProperty().getClass();
+ assertEquals("java.util.Collections$CheckedSortedSet",
+ propertyClass.getName());
+ assertSamePD(propertyClass);
+ mockCollections.setProperty(Arrays
+ .asList(new String[] { "A", "B", "C" }));
+ assertCodedXML(mockCollections, "/xml/MockCheckedSortedSet.xml");
+ }
+
+ public static class MockCheckedMap {
+
+ private Map<String, String> property = new HashMap<String, String>();
+
+ public Map<String, String> getProperty() {
+ return Collections.checkedMap(property, String.class, String.class);
+ }
+
+ public void setProperty(Map<String, String> prop) {
+ property.clear();
+ property.putAll(prop);
+ }
+ }
+
+ public void testWriteObject_MockCheckedMap() throws Exception {
+ MockCheckedMap mockCollections = new MockCheckedMap();
+ Class<?> propertyClass = mockCollections.getProperty().getClass();
+ assertEquals("java.util.Collections$CheckedMap",
+ propertyClass.getName());
+ assertSamePD(propertyClass);
+ Map<String, String> prop = new HashMap<String, String>();
+ prop.put("A", "a");
+ prop.put("B", "b");
+ prop.put("C", "c");
+ mockCollections.setProperty(prop);
+ assertCodedXML(mockCollections, "/xml/MockCheckedMap.xml");
+ }
+
+ public static class MockCheckedSortedMap {
+
+ private SortedMap<String, String> property = new TreeMap<String, String>();
+
+ public Map<String, String> getProperty() {
+ return Collections.checkedSortedMap(property, String.class,
+ String.class);
+ }
+
+ public void setProperty(Map<String, String> prop) {
+ property.clear();
+ property.putAll(prop);
+ }
+ }
+
+ public void testWriteObject_MockCheckedSortedMap() throws Exception {
+ MockCheckedSortedMap mockCollections = new MockCheckedSortedMap();
+ Class<?> propertyClass = mockCollections.getProperty().getClass();
+ assertEquals("java.util.Collections$CheckedSortedMap",
+ propertyClass.getName());
+ assertSamePD(propertyClass);
+ Map<String, String> prop = new HashMap<String, String>();
+ prop.put("A", "a");
+ prop.put("B", "b");
+ prop.put("C", "c");
+ mockCollections.setProperty(prop);
+ assertCodedXML(mockCollections, "/xml/MockCheckedSortedMap.xml");
+ }
+
+ public static class MockGetPropertyClass {
+
+ private Set<String> property = new HashSet<String>();
+
+ public Set<String> getProperty() {
+ return new HashSet<String>(property);
+ }
+
+ public void setProperty(Set<String> set) {
+ property.clear();
+ property.addAll(set);
+ }
+ }
+
+ public void testWriteObject_MockGetPropertyClass() throws Exception {
+ MockGetPropertyClass mockCollections = new MockGetPropertyClass();
+ assertSamePD(mockCollections.getProperty().getClass());
+ Set<String> prop = new HashSet<String>();
+ prop.add("A");
+ prop.add("B");
+ prop.add("C");
+ mockCollections.setProperty(prop);
+ assertCodedXML(mockCollections, "/xml/MockGetPropertyClass.xml");
+ }
+
+ public static class MockListImplements implements List<String> {
+
+ private List<String> property = new ArrayList<String>();
+
+ public List<String> getProperty() {
+ return property;
+ }
+
+ public void setProperty(List<String> prop) {
+ property = prop;
+ }
+
+ public boolean add(String o) {
+ return property.add(o);
+ }
+
+ public void add(int index, String o) {
+ property.add(index, o);
+ }
+
+ public boolean addAll(Collection<? extends String> c) {
+ return property.addAll(c);
+ }
+
+ public boolean addAll(int index, Collection<? extends String> c) {
+ return property.addAll(index, c);
+ }
+
+ public void clear() {
+ property.clear();
+ }
+
+ public boolean contains(Object o) {
+ return property.contains(o);
+ }
+
+ public boolean containsAll(Collection<?> c) {
+ return property.containsAll(c);
+ }
+
+ public String get(int index) {
+ return property.get(index);
+ }
+
+ public int indexOf(Object o) {
+ return property.indexOf(o);
+ }
+
+ public boolean isEmpty() {
+ return property.isEmpty();
+ }
+
+ public Iterator<String> iterator() {
+ return property.iterator();
+ }
+
+ public int lastIndexOf(Object o) {
+ return property.lastIndexOf(o);
+ }
+
+ public ListIterator<String> listIterator() {
+ return property.listIterator();
+ }
+
+ public ListIterator<String> listIterator(int index) {
+ return property.listIterator(index);
+ }
+
+ public boolean remove(Object o) {
+ return property.remove(o);
+ }
+
+ public String remove(int index) {
+ return property.remove(index);
+ }
+
+ public boolean removeAll(Collection<?> c) {
+ return property.removeAll(c);
+ }
+
+ public boolean retainAll(Collection<?> c) {
+ return property.retainAll(c);
+ }
+
+ public String set(int index, String o) {
+ return property.set(index, o);
+ }
+
+ public int size() {
+ return property.size();
+ }
+
+ public List<String> subList(int fromIndex, int toIndex) {
+ return property.subList(fromIndex, toIndex);
+ }
+
+ public Object[] toArray() {
+ return property.toArray();
+ }
+
+ public <T> T[] toArray(T[] a) {
+ return property.toArray(a);
+ }
+ }
+
+ public void testWriteObject_MockListImplements() throws Exception {
+ List<String> mockListImplements = new MockListImplements();
+ mockListImplements.add("A");
+ assertCodedXML(mockListImplements, "/xml/MockListImplements.xml");
+ }
+
+ public static class MockSetImplements implements Set<String> {
+
+ private Set<String> property;
+
+ public MockSetImplements() {
+ property = new HashSet<String>();
+ }
+
+ public Set<String> getProperty() {
+ return property;
+ }
+
+ public void setProperty(Set<String> prop) {
+ property = prop;
+ }
+
+ public boolean add(String o) {
+ return property.add(o);
+ }
+
+ public void clear() {
+ property.clear();
+ }
+
+ public boolean contains(final Object o) {
+ return property.contains(o);
+ }
+
+ public boolean containsAll(final Collection<?> c) {
+ return property.containsAll(c);
+ }
+
+ public boolean isEmpty() {
+ return property.isEmpty();
+ }
+
+ public Iterator<String> iterator() {
+ return property.iterator();
+ }
+
+ public boolean remove(final Object o) {
+ return property.remove(o);
+ }
+
+ public boolean removeAll(final Collection<?> c) {
+ return property.removeAll(c);
+ }
+
+ public boolean retainAll(final Collection<?> c) {
+ return property.retainAll(c);
+ }
+
+ public int size() {
+ return property.size();
+ }
+
+ public Object[] toArray() {
+ return property.toArray();
+ }
+
+ public <T> T[] toArray(final T[] a) {
+ return property.toArray(a);
+ }
+
+ public int hashCode() {
+ return property.hashCode();
+ }
+
+ public boolean addAll(Collection<? extends String> c) {
+ return property.addAll(c);
+ }
+ }
+
+ public void testWriteObject_MockSetImplements() throws Exception {
+ Set<String> mockSetImplements = new MockSetImplements();
+ mockSetImplements.add("A");
+ assertCodedXML(mockSetImplements, "/xml/MockSetImplements.xml");
+ }
+
+ private Encoder encoder = new Encoder();
+
+ private void assertSamePD(Class<?> clazz) {
+ assertSame(encoder.getPersistenceDelegate(clazz),
+ encoder.getPersistenceDelegate(clazz));
+ }
+
}
\ No newline at end of file
Added: harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockCheckedCollection.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockCheckedCollection.xml?rev=1022963&view=auto
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockCheckedCollection.xml (added)
+++ harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockCheckedCollection.xml Fri Oct 15 15:17:01 2010
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<java version="${version}" class="java.beans.XMLDecoder">
+ <object class="${classname}">
+ <void property="property">
+ <object class="java.util.Collections" method="checkedCollection">
+ <object class="java.util.ArrayList">
+ <void method="add">
+ <string>A</string>
+ </void>
+ <void method="add">
+ <string>B</string>
+ </void>
+ <void method="add">
+ <string>C</string>
+ </void>
+ </object>
+ <class>java.lang.String</class>
+ </object>
+ </void>
+ </object>
+</java>
+
Propchange: harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockCheckedCollection.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockCheckedList.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockCheckedList.xml?rev=1022963&view=auto
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockCheckedList.xml (added)
+++ harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockCheckedList.xml Fri Oct 15 15:17:01 2010
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<java version="${version}" class="java.beans.XMLDecoder">
+ <object class="${classname}">
+ <void property="property">
+ <object class="java.util.Collections" method="checkedList">
+ <object class="java.util.LinkedList">
+ <void method="add">
+ <string>A</string>
+ </void>
+ <void method="add">
+ <string>B</string>
+ </void>
+ <void method="add">
+ <string>C</string>
+ </void>
+ </object>
+ <class>java.lang.String</class>
+ </object>
+ </void>
+ </object>
+</java>
+
Propchange: harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockCheckedList.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockCheckedMap.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockCheckedMap.xml?rev=1022963&view=auto
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockCheckedMap.xml (added)
+++ harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockCheckedMap.xml Fri Oct 15 15:17:01 2010
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<java version="${version}" class="java.beans.XMLDecoder">
+ <object class="${classname}">
+ <void property="property">
+ <object class="java.util.Collections" method="checkedMap">
+ <object class="java.util.HashMap">
+ <void method="put">
+ <string>A</string>
+ <string>a</string>
+ </void>
+ <void method="put">
+ <string>B</string>
+ <string>b</string>
+ </void>
+ <void method="put">
+ <string>C</string>
+ <string>c</string>
+ </void>
+ </object>
+ <class>java.lang.String</class>
+ <class>java.lang.String</class>
+ </object>
+ </void>
+ </object>
+</java>
\ No newline at end of file
Propchange: harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockCheckedMap.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockCheckedRandomAccessList.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockCheckedRandomAccessList.xml?rev=1022963&view=auto
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockCheckedRandomAccessList.xml (added)
+++ harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockCheckedRandomAccessList.xml Fri Oct 15 15:17:01 2010
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<java version="${version}" class="java.beans.XMLDecoder">
+ <object class="${classname}">
+ <void property="property">
+ <object class="java.util.Collections" method="checkedList">
+ <object class="java.util.ArrayList">
+ <void method="add">
+ <string>A</string>
+ </void>
+ <void method="add">
+ <string>B</string>
+ </void>
+ <void method="add">
+ <string>C</string>
+ </void>
+ </object>
+ <class>java.lang.String</class>
+ </object>
+ </void>
+ </object>
+</java>
+
Propchange: harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockCheckedRandomAccessList.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockCheckedSet.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockCheckedSet.xml?rev=1022963&view=auto
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockCheckedSet.xml (added)
+++ harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockCheckedSet.xml Fri Oct 15 15:17:01 2010
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<java version="${version}" class="java.beans.XMLDecoder">
+ <object class="${classname}">
+ <void property="property">
+ <object class="java.util.Collections" method="checkedSet">
+ <object class="java.util.HashSet">
+ <void method="add">
+ <string>A</string>
+ </void>
+ <void method="add">
+ <string>B</string>
+ </void>
+ <void method="add">
+ <string>C</string>
+ </void>
+ </object>
+ <class>java.lang.String</class>
+ </object>
+ </void>
+ </object>
+</java>
+
Propchange: harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockCheckedSet.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockCheckedSortedMap.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockCheckedSortedMap.xml?rev=1022963&view=auto
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockCheckedSortedMap.xml (added)
+++ harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockCheckedSortedMap.xml Fri Oct 15 15:17:01 2010
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<java version="${version}" class="java.beans.XMLDecoder">
+ <object class="${classname}">
+ <void property="property">
+ <object class="java.util.Collections" method="checkedSortedMap">
+ <object class="java.util.TreeMap">
+ <void method="put">
+ <string>A</string>
+ <string>a</string>
+ </void>
+ <void method="put">
+ <string>B</string>
+ <string>b</string>
+ </void>
+ <void method="put">
+ <string>C</string>
+ <string>c</string>
+ </void>
+ </object>
+ <class>java.lang.String</class>
+ <class>java.lang.String</class>
+ </object>
+ </void>
+ </object>
+</java>
\ No newline at end of file
Propchange: harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockCheckedSortedMap.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockCheckedSortedSet.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockCheckedSortedSet.xml?rev=1022963&view=auto
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockCheckedSortedSet.xml (added)
+++ harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockCheckedSortedSet.xml Fri Oct 15 15:17:01 2010
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<java version="${version}" class="java.beans.XMLDecoder">
+ <object class="${classname}">
+ <void property="property">
+ <object class="java.util.Collections" method="checkedSortedSet">
+ <object class="java.util.TreeSet">
+ <void method="add">
+ <string>A</string>
+ </void>
+ <void method="add">
+ <string>B</string>
+ </void>
+ <void method="add">
+ <string>C</string>
+ </void>
+ </object>
+ <class>java.lang.String</class>
+ </object>
+ </void>
+ </object>
+</java>
+
Propchange: harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockCheckedSortedSet.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockGetPropertyClass.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockGetPropertyClass.xml?rev=1022963&view=auto
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockGetPropertyClass.xml (added)
+++ harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockGetPropertyClass.xml Fri Oct 15 15:17:01 2010
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<java version="${version}" class="java.beans.XMLDecoder">
+ <object class="${classname}">
+ <void id="HashSet0" property="property">
+ <void method="add">
+ <string>A</string>
+ </void>
+ <void method="add">
+ <string>B</string>
+ </void>
+ <void method="add">
+ <string>C</string>
+ </void>
+ </void>
+ <void property="property">
+ <object idref="HashSet0"/>
+ </void>
+ </object>
+</java>
\ No newline at end of file
Propchange: harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockGetPropertyClass.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockListImplements.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockListImplements.xml?rev=1022963&view=auto
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockListImplements.xml (added)
+++ harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockListImplements.xml Fri Oct 15 15:17:01 2010
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<java version="${version}" class="java.beans.XMLDecoder">
+ <object class="${classname}">
+ <void property="property">
+ <void method="add">
+ <string>A</string>
+ </void>
+ </void>
+ </object>
+</java>
+
Propchange: harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockListImplements.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockSetImplements.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockSetImplements.xml?rev=1022963&view=auto
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockSetImplements.xml (added)
+++ harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockSetImplements.xml Fri Oct 15 15:17:01 2010
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<java version="${version}" class="java.beans.XMLDecoder">
+ <object class="${classname}">
+ <void property="property">
+ <void method="add">
+ <string>A</string>
+ </void>
+ </void>
+ </object>
+</java>
+
Propchange: harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockSetImplements.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockSynchronizedCollection.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockSynchronizedCollection.xml?rev=1022963&view=auto
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockSynchronizedCollection.xml (added)
+++ harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockSynchronizedCollection.xml Fri Oct 15 15:17:01 2010
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<java version="${version}" class="java.beans.XMLDecoder">
+ <object class="${classname}">
+ <void property="property">
+ <object class="java.util.Collections" method="synchronizedCollection">
+ <object class="java.util.ArrayList">
+ <void method="add">
+ <string>A</string>
+ </void>
+ <void method="add">
+ <string>B</string>
+ </void>
+ <void method="add">
+ <string>C</string>
+ </void>
+ </object>
+ </object>
+ </void>
+ </object>
+</java>
+
Propchange: harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockSynchronizedCollection.xml
------------------------------------------------------------------------------
svn:eol-style = native
|