[jboss-cvs] JBossAS SVN: r81512 - in projects/jboss-reflect/trunk/src: main/java/org/jboss/reflect/plugins/javassist and 5 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Nov 24 16:27:33 EST 2008
Author: alesj
Date: 2008-11-24 16:27:33 -0500 (Mon, 24 Nov 2008)
New Revision: 81512
Added:
projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/
projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/support/
projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/support/GenericIntegerImpl.java
projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/support/GenericInterface.java
projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/support/GenericStringImpl.java
projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/support/TestImpl.java
projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/support/TestInterface.java
projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/test/
projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/test/AbstractTypeInfoTest.java
projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/test/IntrospectionTypeInfoTestCase.java
projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/test/JavassistTypeInfoTestCase.java
projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/test/TypeInfoTestSuite.java
Modified:
projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/ClassInfoImpl.java
projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/javassist/JavassistTypeInfo.java
projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/spi/DelegateClassInfo.java
projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/spi/NumberInfo.java
projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/spi/PrimitiveInfo.java
projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/spi/TypeInfo.java
projects/jboss-reflect/trunk/src/test/java/org/jboss/test/ContainerAllTestSuite.java
Log:
[JBREFLECT-43]; add isInstance to TypeInfo.
Modified: projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/ClassInfoImpl.java
===================================================================
--- projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/ClassInfoImpl.java 2008-11-24 21:17:20 UTC (rev 81511)
+++ projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/ClassInfoImpl.java 2008-11-24 21:27:33 UTC (rev 81512)
@@ -539,12 +539,17 @@
public boolean isAssignableFrom(TypeInfo info)
{
if (info == null)
- {
throw new NullPointerException("Parameter info cannot be null!");
- }
+
return getType().isAssignableFrom(info.getType());
}
+ @SuppressWarnings("deprecation")
+ public boolean isInstance(Object object)
+ {
+ return getType().isInstance(object);
+ }
+
public TypeInfo[] getActualTypeArguments()
{
return null;
Modified: projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/javassist/JavassistTypeInfo.java
===================================================================
--- projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/javassist/JavassistTypeInfo.java 2008-11-24 21:17:20 UTC (rev 81511)
+++ projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/javassist/JavassistTypeInfo.java 2008-11-24 21:27:33 UTC (rev 81512)
@@ -380,12 +380,17 @@
public boolean isAssignableFrom(TypeInfo info)
{
if (info == null)
- {
throw new NullPointerException("Parameter info cannot be null!");
- }
+
return getType().isAssignableFrom(info.getType());
}
+ @SuppressWarnings("deprecation")
+ public boolean isInstance(Object object)
+ {
+ return getType().isInstance(object);
+ }
+
public TypeInfoFactory getTypeInfoFactory()
{
return factory;
Modified: projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/spi/DelegateClassInfo.java
===================================================================
--- projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/spi/DelegateClassInfo.java 2008-11-24 21:17:20 UTC (rev 81511)
+++ projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/spi/DelegateClassInfo.java 2008-11-24 21:27:33 UTC (rev 81512)
@@ -290,6 +290,11 @@
return delegate.isAssignableFrom(info);
}
+ public boolean isInstance(Object object)
+ {
+ return delegate.isInstance(object);
+ }
+
public TypeInfo[] getActualTypeArguments()
{
return delegate.getActualTypeArguments();
Modified: projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/spi/NumberInfo.java
===================================================================
--- projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/spi/NumberInfo.java 2008-11-24 21:17:20 UTC (rev 81511)
+++ projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/spi/NumberInfo.java 2008-11-24 21:27:33 UTC (rev 81512)
@@ -335,12 +335,13 @@
return this;
}
- public String toShortString()
+ public void toShortString(JBossStringBuilder buffer)
{
- return name;
+ buffer.append(name);
}
- public void toShortString(JBossStringBuilder buffer)
+ @Override
+ protected void toString(JBossStringBuilder buffer)
{
buffer.append(name);
}
Modified: projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/spi/PrimitiveInfo.java
===================================================================
--- projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/spi/PrimitiveInfo.java 2008-11-24 21:17:20 UTC (rev 81511)
+++ projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/spi/PrimitiveInfo.java 2008-11-24 21:27:33 UTC (rev 81512)
@@ -268,13 +268,33 @@
@SuppressWarnings({"unchecked", "deprecation"})
public boolean isAssignableFrom(TypeInfo info)
{
+ if (info == null)
+ throw new NullPointerException("Parameter info cannot be null!");
+
if (info == this)
return true;
+ return canProgress(info.getType());
+ }
+
+ @SuppressWarnings("deprecation")
+ public boolean isInstance(Object object)
+ {
+ return object != null && canProgress(object.getClass());
+ }
+
+ /**
+ * Can we progress class param to this type info.
+ *
+ * @param clazz the class to progress
+ * @return true if we can progress, false otherwise
+ */
+ protected boolean canProgress(Class<?> clazz)
+ {
try
{
ProgressionConvertor pc = ProgressionConvertorFactory.getInstance().getConvertor();
- return pc.canProgress(getType(), info.getType());
+ return pc.canProgress(getType(), clazz);
}
catch (Throwable throwable)
{
Modified: projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/spi/TypeInfo.java
===================================================================
--- projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/spi/TypeInfo.java 2008-11-24 21:17:20 UTC (rev 81511)
+++ projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/spi/TypeInfo.java 2008-11-24 21:27:33 UTC (rev 81512)
@@ -144,7 +144,7 @@
/**
* Mostly using
* @see java.lang.Class#isAssignableFrom
- * NumberInfo tests for progression
+ * PrimitiveInfo tests for progression
*
* @param info type info
* @return the boolean value indicating whether objects of the
@@ -155,6 +155,16 @@
boolean isAssignableFrom(TypeInfo info);
/**
+ * Is object instance of this type info.
+ * @see Class#isInstance(Object)
+ * PrimitiveInfo tests for progression
+ *
+ * @param object the object to check
+ * @return true if <code>object</code> is an instance of this class
+ */
+ boolean isInstance(Object object);
+
+ /**
* Get the TypeInfoFactory that created this type info
*
* @return type info factory
Modified: projects/jboss-reflect/trunk/src/test/java/org/jboss/test/ContainerAllTestSuite.java
===================================================================
--- projects/jboss-reflect/trunk/src/test/java/org/jboss/test/ContainerAllTestSuite.java 2008-11-24 21:17:20 UTC (rev 81511)
+++ projects/jboss-reflect/trunk/src/test/java/org/jboss/test/ContainerAllTestSuite.java 2008-11-24 21:27:33 UTC (rev 81512)
@@ -27,6 +27,7 @@
import org.jboss.test.beaninfo.test.BeanInfoTestSuite;
import org.jboss.test.classinfo.test.ClassInfoTestSuite;
import org.jboss.test.joinpoint.test.JoinpointTestSuite;
+import org.jboss.test.typeinfo.test.TypeInfoTestSuite;
/**
* All Test Suite.
@@ -45,6 +46,7 @@
{
TestSuite suite = new TestSuite("All Tests");
+ suite.addTest(TypeInfoTestSuite.suite());
suite.addTest(ClassInfoTestSuite.suite());
suite.addTest(JoinpointTestSuite.suite());
suite.addTest(BeanInfoTestSuite.suite());
Added: projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/support/GenericIntegerImpl.java
===================================================================
--- projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/support/GenericIntegerImpl.java (rev 0)
+++ projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/support/GenericIntegerImpl.java 2008-11-24 21:27:33 UTC (rev 81512)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.typeinfo.support;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class GenericIntegerImpl implements GenericInterface<Integer>
+{
+}
\ No newline at end of file
Added: projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/support/GenericInterface.java
===================================================================
--- projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/support/GenericInterface.java (rev 0)
+++ projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/support/GenericInterface.java 2008-11-24 21:27:33 UTC (rev 81512)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.typeinfo.support;
+
+/**
+ * @param <T> generic type
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public interface GenericInterface<T>
+{
+}
\ No newline at end of file
Added: projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/support/GenericStringImpl.java
===================================================================
--- projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/support/GenericStringImpl.java (rev 0)
+++ projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/support/GenericStringImpl.java 2008-11-24 21:27:33 UTC (rev 81512)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.typeinfo.support;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class GenericStringImpl implements GenericInterface<String>
+{
+}
\ No newline at end of file
Added: projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/support/TestImpl.java
===================================================================
--- projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/support/TestImpl.java (rev 0)
+++ projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/support/TestImpl.java 2008-11-24 21:27:33 UTC (rev 81512)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.typeinfo.support;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class TestImpl implements TestInterface
+{
+}
\ No newline at end of file
Added: projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/support/TestInterface.java
===================================================================
--- projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/support/TestInterface.java (rev 0)
+++ projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/support/TestInterface.java 2008-11-24 21:27:33 UTC (rev 81512)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.typeinfo.support;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public interface TestInterface
+{
+}
Added: projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/test/AbstractTypeInfoTest.java
===================================================================
--- projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/test/AbstractTypeInfoTest.java (rev 0)
+++ projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/test/AbstractTypeInfoTest.java 2008-11-24 21:27:33 UTC (rev 81512)
@@ -0,0 +1,137 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.typeinfo.test;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.util.Date;
+
+import org.jboss.reflect.spi.TypeInfo;
+import org.jboss.reflect.spi.TypeInfoFactory;
+import org.jboss.test.ContainerTest;
+import org.jboss.test.typeinfo.support.GenericInterface;
+import org.jboss.test.typeinfo.support.TestImpl;
+import org.jboss.test.typeinfo.support.TestInterface;
+import org.jboss.test.typeinfo.support.GenericStringImpl;
+import org.jboss.test.typeinfo.support.GenericIntegerImpl;
+
+/**
+ * Type info test.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public abstract class AbstractTypeInfoTest extends ContainerTest
+{
+ protected AbstractTypeInfoTest(String name)
+ {
+ super(name);
+ }
+
+ protected abstract TypeInfoFactory getTypeInfoFactory();
+
+ // TODO - remove this after JBMICROCONT-129 is done
+ protected abstract boolean isTypeSupported();
+
+ protected TypeInfo getTypeInfo(Type type) throws Exception
+ {
+ return getTypeInfoFactory().getTypeInfo(type);
+ }
+
+ public void testIsAssignableFrom() throws Throwable
+ {
+ TypeInfo first = getTypeInfo(int.class);
+ TypeInfo second = getTypeInfo(double.class);
+
+ assertIsAssignableFrom(first, second, true);
+ second = getTypeInfo(Date.class);
+ assertIsAssignableFrom(first, second, false);
+
+ first = getTypeInfo(TestInterface.class);
+ assertIsAssignableFrom(first, second, false);
+
+ second = getTypeInfo(TestInterface.class);
+ assertIsAssignableFrom(first, second, true);
+ second = getTypeInfo(TestImpl.class);
+ assertIsAssignableFrom(first, second, true);
+
+ if (isTypeSupported())
+ {
+ first = getTypeInfo(getType("getGenericStringInterface"));
+ second = getTypeInfo(GenericStringImpl.class);
+ assertIsAssignableFrom(first, second, true);
+
+ second = getTypeInfo(GenericIntegerImpl.class);
+ // TODO - better impl could return false?
+ assertIsAssignableFrom(first, second, true);
+ }
+ }
+
+ public void testIsInstance() throws Throwable
+ {
+ TypeInfo first = getTypeInfo(int.class);
+ Object second = 123d;
+
+ assertIsInstance(first, second, true);
+ second = (byte)123;
+ assertIsInstance(first, second, true);
+ second = new Date();
+ assertIsInstance(first, second, false);
+
+ first = getTypeInfo(TestInterface.class);
+ assertIsInstance(first, second, false);
+
+ second = new TestImpl();
+ assertIsInstance(first, second, true);
+
+ if (isTypeSupported())
+ {
+ first = getTypeInfo(getType("getGenericStringInterface"));
+ second = new GenericStringImpl();
+ assertIsInstance(first, second, true);
+
+ second = new GenericIntegerImpl();
+ // TODO - better impl could return false?
+ assertIsInstance(first, second, true);
+ }
+ }
+
+ protected void assertIsAssignableFrom(TypeInfo first, TypeInfo second, boolean expected) throws Throwable
+ {
+ assertEquals(expected, first.isAssignableFrom(second));
+ }
+
+ protected void assertIsInstance(TypeInfo typeInfo, Object object, boolean expected) throws Throwable
+ {
+ assertEquals(expected, typeInfo.isInstance(object));
+ }
+
+ protected Type getType(String methodName, Class<?>... parameters) throws Exception
+ {
+ Method method = getClass().getMethod(methodName, parameters);
+ return method.getGenericReturnType();
+ }
+
+ public GenericInterface<String> getGenericStringInterface()
+ {
+ return null;
+ }
+}
\ No newline at end of file
Added: projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/test/IntrospectionTypeInfoTestCase.java
===================================================================
--- projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/test/IntrospectionTypeInfoTestCase.java (rev 0)
+++ projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/test/IntrospectionTypeInfoTestCase.java 2008-11-24 21:27:33 UTC (rev 81512)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.typeinfo.test;
+
+import junit.framework.Test;
+import org.jboss.reflect.plugins.introspection.IntrospectionTypeInfoFactory;
+import org.jboss.reflect.spi.TypeInfoFactory;
+
+/**
+ * Introspection test info tests.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class IntrospectionTypeInfoTestCase extends AbstractTypeInfoTest
+{
+ private TypeInfoFactory factory = new IntrospectionTypeInfoFactory();
+
+ public IntrospectionTypeInfoTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return suite(IntrospectionTypeInfoTestCase.class);
+ }
+
+ protected TypeInfoFactory getTypeInfoFactory()
+ {
+ return factory;
+ }
+
+ protected boolean isTypeSupported()
+ {
+ return true;
+ }
+}
\ No newline at end of file
Added: projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/test/JavassistTypeInfoTestCase.java
===================================================================
--- projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/test/JavassistTypeInfoTestCase.java (rev 0)
+++ projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/test/JavassistTypeInfoTestCase.java 2008-11-24 21:27:33 UTC (rev 81512)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.typeinfo.test;
+
+import junit.framework.Test;
+import org.jboss.reflect.plugins.javassist.JavassistTypeInfoFactory;
+import org.jboss.reflect.spi.TypeInfoFactory;
+
+/**
+ * Javassist type info tests.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class JavassistTypeInfoTestCase extends AbstractTypeInfoTest
+{
+ private TypeInfoFactory factory = new JavassistTypeInfoFactory();
+
+ public JavassistTypeInfoTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return suite(JavassistTypeInfoTestCase.class);
+ }
+
+ protected TypeInfoFactory getTypeInfoFactory()
+ {
+ return factory;
+ }
+
+ protected boolean isTypeSupported()
+ {
+ return false;
+ }
+}
\ No newline at end of file
Added: projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/test/TypeInfoTestSuite.java
===================================================================
--- projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/test/TypeInfoTestSuite.java (rev 0)
+++ projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/test/TypeInfoTestSuite.java 2008-11-24 21:27:33 UTC (rev 81512)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.typeinfo.test;
+
+import junit.framework.TestSuite;
+import junit.framework.Test;
+import junit.textui.TestRunner;
+
+/**
+ * TypeInfo test suite.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class TypeInfoTestSuite extends TestSuite
+{
+ public static void main(String[] args)
+ {
+ TestRunner.run(suite());
+ }
+
+ public static Test suite()
+ {
+ TestSuite suite = new TestSuite("TypeInfo Tests");
+
+ suite.addTest(IntrospectionTypeInfoTestCase.suite());
+ suite.addTest(JavassistTypeInfoTestCase.suite());
+
+ return suite;
+ }
+}
More information about the jboss-cvs-commits
mailing list