[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: UnwrapValueUnitTestCase.testCollectionUnwrap failure on
adrian@jboss.org
do-not-reply at jboss.com
Thu Nov 20 10:18:06 EST 2008
I don't know how to make the test fail, but the following
change to the test shows the problem happening.
| Index: src/test/java/org/jboss/test/metatype/values/factory/test/UnwrapValueUnitTestCase.java
| ===================================================================
| --- src/test/java/org/jboss/test/metatype/values/factory/test/UnwrapValueUnitTestCase.java (revision 81358)
| +++ src/test/java/org/jboss/test/metatype/values/factory/test/UnwrapValueUnitTestCase.java (working copy)
| @@ -35,7 +35,10 @@
|
| import junit.framework.Test;
|
| +import org.jboss.beans.info.spi.BeanInfo;
| +import org.jboss.config.plugins.property.PropertyConfiguration;
| import org.jboss.metatype.api.values.MetaValue;
| +import org.jboss.reflect.spi.ClassInfo;
| import org.jboss.test.metatype.values.factory.support.SimpleCompositeInterface;
| import org.jboss.test.metatype.values.factory.support.TestEnum;
| import org.jboss.test.metatype.values.factory.support.TestGeneric;
| @@ -103,9 +106,21 @@
|
| checkSingle(new TestSimpleCompositeInterface("something"), SimpleCompositeInterface.class);
| }
| + PropertyConfiguration config = new PropertyConfiguration();
|
| + private void printCollection(Type type)
| + {
| + ClassInfo typeInfo = (ClassInfo) config.getTypeInfo(type);
| + System.out.println(typeInfo.getName() + " " + typeInfo.getComponentType());
| + BeanInfo beanInfo = config.getBeanInfo(typeInfo);
| + typeInfo = beanInfo.getClassInfo();
| + System.out.println(typeInfo.getName() + " " + typeInfo.getComponentType());
| + }
| +
| public void testCollectionUnwrap() throws Exception
| {
| + printCollection(getType("Integer", Set.class));
| + printCollection(getType("Enum", Set.class));
| Integer i1 = 123;
| Integer i2 = 123;
| checkCollection(new ArrayList<Integer>(), i1, i2);
|
which produces output (the last line is wrong)
| java.util.Set java.lang.Integer
| java.util.Set java.lang.Integer
| java.util.Set EnumInfoImpl at 1df280b{name=org.jboss.test.metatype.values.factory.support.TestEnum}
| java.util.Set java.lang.Integer
|
So it looks like the BeanInfo caching is the problem.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4190928#4190928
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4190928
More information about the jboss-dev-forums
mailing list