Author: julien(a)jboss.com
Date: 2007-06-03 05:56:50 -0400 (Sun, 03 Jun 2007)
New Revision: 7373
Added:
trunk/common/src/main/org/jboss/portal/common/reflect/Reflection.java
trunk/common/src/main/org/jboss/portal/test/common/reflect/
trunk/common/src/main/org/jboss/portal/test/common/reflect/Class1.java
trunk/common/src/main/org/jboss/portal/test/common/reflect/Class2.java
trunk/common/src/main/org/jboss/portal/test/common/reflect/Class3.java
trunk/common/src/main/org/jboss/portal/test/common/reflect/ModifierTestCase.java
trunk/common/src/main/org/jboss/portal/test/common/reflect/ReflectionTestCase.java
trunk/common/src/main/org/jboss/portal/test/common/test/junit/
trunk/common/src/main/org/jboss/portal/test/common/test/junit/BaseTest.java
trunk/common/src/main/org/jboss/portal/test/common/test/junit/POJOJunitTestTestCase.java
trunk/common/src/main/org/jboss/portal/test/common/test/junit/PrivateLifecycleInheritedTest.java
trunk/common/src/main/org/jboss/portal/test/common/test/junit/PrivateLifecycleSuperTest.java
trunk/common/src/main/org/jboss/portal/test/common/test/junit/PrivateLifecycleTest.java
trunk/common/src/main/org/jboss/portal/test/common/test/junit/ProtectedLifecycleInheritedTest.java
trunk/common/src/main/org/jboss/portal/test/common/test/junit/ProtectedLifecycleSuperTest.java
trunk/common/src/main/org/jboss/portal/test/common/test/junit/ProtectedLifecycleTest.java
trunk/common/src/main/org/jboss/portal/test/common/test/junit/PublicLifecycleInheritedTest.java
trunk/common/src/main/org/jboss/portal/test/common/test/junit/PublicLifecycleSuperTest.java
trunk/common/src/main/org/jboss/portal/test/common/test/junit/PublicLifecycleTest.java
Removed:
trunk/common/src/main/org/jboss/portal/test/common/ModifierTestCase.java
Modified:
trunk/common/build.xml
trunk/common/src/main/org/jboss/portal/common/test/driver/command/StartTestCommand.java
trunk/common/src/main/org/jboss/portal/common/test/junit/POJOJUnitTest.java
Log:
- added util to find methods on classes that are either public or declared by the class or
its super classes
- added test case for POJOJunitTest life cycle call backs
Modified: trunk/common/build.xml
===================================================================
--- trunk/common/build.xml 2007-06-02 23:51:26 UTC (rev 7372)
+++ trunk/common/build.xml 2007-06-03 09:56:50 UTC (rev 7373)
@@ -210,6 +210,12 @@
</x-sysproperty>
<x-test>
+ <test todir="${test.reports}"
name="org.jboss.portal.test.common.reflect.ReflectionTestCase"/>
+ <test todir="${test.reports}"
name="org.jboss.portal.test.common.reflect.ModifierTestCase"/>
+ <test todir="${test.reports}"
name="org.jboss.portal.test.common.test.junit.POJOJunitTestTestCase"/>
+ <test todir="${test.reports}"
name="org.jboss.portal.test.common.test.InfoTestCase"/>
+ <test todir="${test.reports}"
name="org.jboss.portal.test.common.test.TestParameterValueTestCase"/>
+ <test todir="${test.reports}"
name="org.jboss.portal.test.common.test.TestParametrizationTestCase"/>
<test todir="${test.reports}"
name="org.jboss.portal.test.common.adapter.AdapterTestCase"/>
<test todir="${test.reports}"
name="org.jboss.portal.test.common.BundleNameIteratorTestCase"/>
<test todir="${test.reports}"
name="org.jboss.portal.test.common.BundleNameParserTestCase"/>
@@ -217,9 +223,6 @@
<test todir="${test.reports}"
name="org.jboss.portal.test.common.ObjectLoaderTestCase"/>
<test todir="${test.reports}"
name="org.jboss.portal.test.common.MarkupTestCase"/>
<test todir="${test.reports}"
name="org.jboss.portal.test.common.TypedMapTestCase"/>
- <test todir="${test.reports}"
name="org.jboss.portal.test.common.test.InfoTestCase"/>
- <test todir="${test.reports}"
name="org.jboss.portal.test.common.test.TestParameterValueTestCase"/>
- <test todir="${test.reports}"
name="org.jboss.portal.test.common.test.TestParametrizationTestCase"/>
<test todir="${test.reports}"
name="org.jboss.portal.test.common.FastURLEncoderTestCase"/>
<test todir="${test.reports}"
name="org.jboss.portal.test.common.AbstractInvocationContextTestCase"/>
<test todir="${test.reports}"
name="org.jboss.portal.test.common.LocaleFormatTestCase"/>
@@ -242,7 +245,6 @@
<test todir="${test.reports}"
name="org.jboss.portal.test.common.CopyOnWriteRegistryTestCase"/>
<test todir="${test.reports}"
name="org.jboss.portal.test.common.URLToolsTestCase"/>
<test todir="${test.reports}"
name="org.jboss.portal.test.common.ToolsTestCase"/>
- <test todir="${test.reports}"
name="org.jboss.portal.test.common.ModifierTestCase"/>
<test todir="${test.reports}"
name="org.jboss.portal.test.common.IteratorStatusTestCase"/>
<test todir="${test.reports}"
name="org.jboss.portal.test.common.PathMapperTestCase"/>
</x-test>
Added: trunk/common/src/main/org/jboss/portal/common/reflect/Reflection.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/reflect/Reflection.java
(rev 0)
+++ trunk/common/src/main/org/jboss/portal/common/reflect/Reflection.java 2007-06-03
09:56:50 UTC (rev 7373)
@@ -0,0 +1,142 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt 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.portal.common.reflect;
+
+import java.lang.reflect.Method;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class Reflection
+{
+
+ /**
+ * Search a method on the specified class. The search will try find methods with any
scope and will
+ * start with the provided class. First it will inspect the public method on the
class, if one is found
+ * then this method is returned. If no public method is found then it will inspect the
declared methods
+ * of the provided class and its super classes.
+ *
+ * @param clazz the class to inspect
+ * @param methodName the method name
+ * @param parameterTypes the parameter types
+ * @return the matched method or null
+ * @throws IllegalArgumentException if one argument is null
+ */
+ public static Method findMethod(
+ Class clazz,
+ String methodName,
+ Class[] parameterTypes) throws IllegalArgumentException
+ {
+ if (clazz == null)
+ {
+ throw new IllegalArgumentException("No class provided");
+ }
+ if (methodName == null)
+ {
+ throw new IllegalArgumentException("No method name provided");
+ }
+ if (parameterTypes == null)
+ {
+ throw new IllegalArgumentException("No parameter types provided");
+ }
+ for (int i = 0; i < parameterTypes.length; i++)
+ {
+ if (parameterTypes[i] == null)
+ {
+ throw new IllegalArgumentException("Null parameter type at
element=" + i);
+ }
+ }
+
+ // First try a public method, which could be an implemented from an interface
+ try
+ {
+ return clazz.getMethod(methodName, parameterTypes);
+ }
+ catch (NoSuchMethodException ignore)
+ {
+ }
+
+ //
+ return findDeclaredMethod(clazz, methodName, parameterTypes);
+ }
+
+ /**
+ * Search a declared method on the specified class and its super classes.
+ *
+ * @param clazz the class to inspect
+ * @param methodName the method name
+ * @param parameterTypes the parameter types
+ * @return the matched method or null
+ * @throws IllegalArgumentException if one argument is null
+ */
+ private static Method findDeclaredMethod(
+ Class clazz,
+ String methodName,
+ Class[] parameterTypes) throws IllegalArgumentException
+ {
+ if (clazz == null)
+ {
+ throw new IllegalArgumentException("No class provided");
+ }
+ if (methodName == null)
+ {
+ throw new IllegalArgumentException("No method name provided");
+ }
+ if (parameterTypes == null)
+ {
+ throw new IllegalArgumentException("No parameter types provided");
+ }
+ for (int i = 0; i < parameterTypes.length; i++)
+ {
+ if (parameterTypes[i] == null)
+ {
+ throw new IllegalArgumentException("Null parameter type at
element=" + i);
+ }
+ }
+
+ //
+ try
+ {
+ return clazz.getDeclaredMethod(methodName, parameterTypes);
+ }
+ catch (NoSuchMethodException ignore)
+ {
+ }
+
+ //
+ Class parentClass = clazz.getSuperclass();
+ if (parentClass != null)
+ {
+ Method method = findDeclaredMethod(parentClass, methodName, parameterTypes);
+ if (method != null)
+ {
+ return method;
+ }
+ }
+
+ // Nothing found
+ return null;
+ }
+
+}
Modified:
trunk/common/src/main/org/jboss/portal/common/test/driver/command/StartTestCommand.java
===================================================================
---
trunk/common/src/main/org/jboss/portal/common/test/driver/command/StartTestCommand.java 2007-06-02
23:51:26 UTC (rev 7372)
+++
trunk/common/src/main/org/jboss/portal/common/test/driver/command/StartTestCommand.java 2007-06-03
09:56:50 UTC (rev 7373)
@@ -50,6 +50,11 @@
this.parametrization = parametrization;
}
+ public StartTestCommand() throws IllegalArgumentException
+ {
+ this(new TestParametrization());
+ }
+
/**
* Return the test parametrization.
*
Modified: trunk/common/src/main/org/jboss/portal/common/test/junit/POJOJUnitTest.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/test/junit/POJOJUnitTest.java 2007-06-02
23:51:26 UTC (rev 7372)
+++ trunk/common/src/main/org/jboss/portal/common/test/junit/POJOJUnitTest.java 2007-06-03
09:56:50 UTC (rev 7373)
@@ -39,6 +39,7 @@
import org.jboss.portal.common.test.info.TestInfo;
import org.jboss.portal.common.test.info.TestItemInfo;
import org.jboss.portal.common.test.info.TestParameterInfo;
+import org.jboss.portal.common.reflect.Reflection;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@@ -146,14 +147,11 @@
}
// Invoke setUp() if it exists
- try
+ Method setUp = Reflection.findMethod(testClass, "setUp", new
Class[0]);
+ if (setUp != null && (setUp.getModifiers() & (Modifier.PRIVATE |
Modifier.STATIC | Modifier.ABSTRACT)) == 0)
{
- Method setUp = testClass.getMethod("setUp", new Class[0]);
invokeNoArg(test, setUp, true);
}
- catch (NoSuchMethodException ignore)
- {
- }
// Invoke test joinpoint
Method method = (Method)testMap.get(testId);
@@ -187,12 +185,12 @@
// Invoke tearDown() if it exists
try
{
- Method tearDown = testClass.getMethod("tearDown", new Class[0]);
- invokeNoArg(test, tearDown, true);
+ Method tearDown = Reflection.findMethod(testClass, "tearDown", new
Class[0]);
+ if (tearDown != null && (tearDown.getModifiers() &
(Modifier.PRIVATE | Modifier.STATIC | Modifier.ABSTRACT)) == 0)
+ {
+ invokeNoArg(test, tearDown, true);
+ }
}
- catch (NoSuchMethodException ignore)
- {
- }
catch (Exception e)
{
e.printStackTrace();
Deleted: trunk/common/src/main/org/jboss/portal/test/common/ModifierTestCase.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/test/common/ModifierTestCase.java 2007-06-02
23:51:26 UTC (rev 7372)
+++ trunk/common/src/main/org/jboss/portal/test/common/ModifierTestCase.java 2007-06-03
09:56:50 UTC (rev 7373)
@@ -1,121 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt 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.portal.test.common;
-
-import junit.framework.TestCase;
-import org.jboss.portal.common.reflect.Modifier;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class ModifierTestCase extends TestCase
-{
-
- public void testIsReadableProperty() throws Exception
- {
- try
- {
- Modifier.isReadableProperty(null);
- fail("Was expecting an IAE");
- }
- catch (IllegalArgumentException expected)
- {
- }
-
-
assertTrue(Modifier.isReadableProperty(Bean.class.getDeclaredField("publicField")));
-
assertFalse(Modifier.isReadableProperty(Bean.class.getDeclaredField("privateField")));
-
assertFalse(Modifier.isReadableProperty(Bean.class.getDeclaredField("protectedField")));
-
assertFalse(Modifier.isReadableProperty(Bean.class.getDeclaredField("packageProtectedField")));
-
-
assertTrue(Modifier.isReadableProperty(Bean.class.getDeclaredField("finalPublicField")));
-
assertFalse(Modifier.isReadableProperty(Bean.class.getDeclaredField("finalPrivateField")));
-
assertFalse(Modifier.isReadableProperty(Bean.class.getDeclaredField("finalProtectedField")));
-
assertFalse(Modifier.isReadableProperty(Bean.class.getDeclaredField("finalPackageProtectedField")));
-
-
assertFalse(Modifier.isReadableProperty(Bean.class.getDeclaredField("staticPublicField")));
-
assertFalse(Modifier.isReadableProperty(Bean.class.getDeclaredField("staticPrivateField")));
-
assertFalse(Modifier.isReadableProperty(Bean.class.getDeclaredField("staticProtectedField")));
-
assertFalse(Modifier.isReadableProperty(Bean.class.getDeclaredField("staticPackageProtectedField")));
-
-
assertFalse(Modifier.isReadableProperty(Bean.class.getDeclaredField("finalStaticPublicField")));
-
assertFalse(Modifier.isReadableProperty(Bean.class.getDeclaredField("finalStaticPrivateField")));
-
assertFalse(Modifier.isReadableProperty(Bean.class.getDeclaredField("finalStaticProtectedField")));
-
assertFalse(Modifier.isReadableProperty(Bean.class.getDeclaredField("finalStaticPackageProtectedField")));
- }
-
- public void testIsWritableProperty() throws Exception
- {
- try
- {
- Modifier.isWritableProperty(null);
- fail("Was expecting an IAE");
- }
- catch (IllegalArgumentException expected)
- {
- }
-
-
assertTrue(Modifier.isWritableProperty(Bean.class.getDeclaredField("publicField")));
-
assertFalse(Modifier.isWritableProperty(Bean.class.getDeclaredField("privateField")));
-
assertFalse(Modifier.isWritableProperty(Bean.class.getDeclaredField("protectedField")));
-
assertFalse(Modifier.isWritableProperty(Bean.class.getDeclaredField("packageProtectedField")));
-
-
assertFalse(Modifier.isWritableProperty(Bean.class.getDeclaredField("finalPublicField")));
-
assertFalse(Modifier.isWritableProperty(Bean.class.getDeclaredField("finalPrivateField")));
-
assertFalse(Modifier.isWritableProperty(Bean.class.getDeclaredField("finalProtectedField")));
-
assertFalse(Modifier.isWritableProperty(Bean.class.getDeclaredField("finalPackageProtectedField")));
-
-
assertFalse(Modifier.isWritableProperty(Bean.class.getDeclaredField("staticPublicField")));
-
assertFalse(Modifier.isWritableProperty(Bean.class.getDeclaredField("staticPrivateField")));
-
assertFalse(Modifier.isWritableProperty(Bean.class.getDeclaredField("staticProtectedField")));
-
assertFalse(Modifier.isWritableProperty(Bean.class.getDeclaredField("staticPackageProtectedField")));
-
-
assertFalse(Modifier.isWritableProperty(Bean.class.getDeclaredField("finalStaticPublicField")));
-
assertFalse(Modifier.isWritableProperty(Bean.class.getDeclaredField("finalStaticPrivateField")));
-
assertFalse(Modifier.isWritableProperty(Bean.class.getDeclaredField("finalStaticProtectedField")));
-
assertFalse(Modifier.isWritableProperty(Bean.class.getDeclaredField("finalStaticPackageProtectedField")));
- }
-
- private static class Bean
- {
- public Object publicField;
- private Object privateField;
- protected Object protectedField;
- Object packageProtectedField;
-
- final public Object finalPublicField = new Object();
- final private Object finalPrivateField = new Object();
- final protected Object finalProtectedField = new Object();
- final Object finalPackageProtectedField = new Object();
-
- static public Object staticPublicField;
- static private Object staticPrivateField;
- static protected Object staticProtectedField;
- static Object staticPackageProtectedField;
-
- final static public Object finalStaticPublicField = new Object();
- final static private Object finalStaticPrivateField = new Object();
- final static protected Object finalStaticProtectedField = new Object();
- final static Object finalStaticPackageProtectedField = new Object();
- }
-}
Added: trunk/common/src/main/org/jboss/portal/test/common/reflect/Class1.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/test/common/reflect/Class1.java
(rev 0)
+++ trunk/common/src/main/org/jboss/portal/test/common/reflect/Class1.java 2007-06-03
09:56:50 UTC (rev 7373)
@@ -0,0 +1,43 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt 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.portal.test.common.reflect;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class Class1
+{
+
+ private void privateMethod()
+ {
+ }
+
+ public abstract void publicAbstractMethodOfClass1();
+
+ protected abstract void protectedAbstractMethodOfClass1();
+
+ private void privateMethodOfClass1()
+ {
+ }
+}
Added: trunk/common/src/main/org/jboss/portal/test/common/reflect/Class2.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/test/common/reflect/Class2.java
(rev 0)
+++ trunk/common/src/main/org/jboss/portal/test/common/reflect/Class2.java 2007-06-03
09:56:50 UTC (rev 7373)
@@ -0,0 +1,55 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt 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.portal.test.common.reflect;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class Class2 extends Class1
+{
+
+ private void privateMethod()
+ {
+ }
+
+ public void publicAbstractMethodOfClass1()
+ {
+ }
+
+ protected void protectedAbstractMethodOfClass1()
+ {
+ }
+
+ public void publicMethodOfClass2()
+ {
+ }
+
+ protected void protectedMethodOfClass2()
+ {
+ }
+
+ private void privateMethodOfClass2()
+ {
+ }
+}
Added: trunk/common/src/main/org/jboss/portal/test/common/reflect/Class3.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/test/common/reflect/Class3.java
(rev 0)
+++ trunk/common/src/main/org/jboss/portal/test/common/reflect/Class3.java 2007-06-03
09:56:50 UTC (rev 7373)
@@ -0,0 +1,38 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt 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.portal.test.common.reflect;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class Class3 extends Class2
+{
+ private void privateMethod()
+ {
+ }
+
+ private void privateMethodOfClass3()
+ {
+ }
+}
Added: trunk/common/src/main/org/jboss/portal/test/common/reflect/ModifierTestCase.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/test/common/reflect/ModifierTestCase.java
(rev 0)
+++
trunk/common/src/main/org/jboss/portal/test/common/reflect/ModifierTestCase.java 2007-06-03
09:56:50 UTC (rev 7373)
@@ -0,0 +1,121 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt 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.portal.test.common.reflect;
+
+import junit.framework.TestCase;
+import org.jboss.portal.common.reflect.Modifier;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ModifierTestCase extends TestCase
+{
+
+ public void testIsReadableProperty() throws Exception
+ {
+ try
+ {
+ Modifier.isReadableProperty(null);
+ fail("Was expecting an IAE");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+
+
assertTrue(Modifier.isReadableProperty(Bean.class.getDeclaredField("publicField")));
+
assertFalse(Modifier.isReadableProperty(Bean.class.getDeclaredField("privateField")));
+
assertFalse(Modifier.isReadableProperty(Bean.class.getDeclaredField("protectedField")));
+
assertFalse(Modifier.isReadableProperty(Bean.class.getDeclaredField("packageProtectedField")));
+
+
assertTrue(Modifier.isReadableProperty(Bean.class.getDeclaredField("finalPublicField")));
+
assertFalse(Modifier.isReadableProperty(Bean.class.getDeclaredField("finalPrivateField")));
+
assertFalse(Modifier.isReadableProperty(Bean.class.getDeclaredField("finalProtectedField")));
+
assertFalse(Modifier.isReadableProperty(Bean.class.getDeclaredField("finalPackageProtectedField")));
+
+
assertFalse(Modifier.isReadableProperty(Bean.class.getDeclaredField("staticPublicField")));
+
assertFalse(Modifier.isReadableProperty(Bean.class.getDeclaredField("staticPrivateField")));
+
assertFalse(Modifier.isReadableProperty(Bean.class.getDeclaredField("staticProtectedField")));
+
assertFalse(Modifier.isReadableProperty(Bean.class.getDeclaredField("staticPackageProtectedField")));
+
+
assertFalse(Modifier.isReadableProperty(Bean.class.getDeclaredField("finalStaticPublicField")));
+
assertFalse(Modifier.isReadableProperty(Bean.class.getDeclaredField("finalStaticPrivateField")));
+
assertFalse(Modifier.isReadableProperty(Bean.class.getDeclaredField("finalStaticProtectedField")));
+
assertFalse(Modifier.isReadableProperty(Bean.class.getDeclaredField("finalStaticPackageProtectedField")));
+ }
+
+ public void testIsWritableProperty() throws Exception
+ {
+ try
+ {
+ Modifier.isWritableProperty(null);
+ fail("Was expecting an IAE");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+
+
assertTrue(Modifier.isWritableProperty(Bean.class.getDeclaredField("publicField")));
+
assertFalse(Modifier.isWritableProperty(Bean.class.getDeclaredField("privateField")));
+
assertFalse(Modifier.isWritableProperty(Bean.class.getDeclaredField("protectedField")));
+
assertFalse(Modifier.isWritableProperty(Bean.class.getDeclaredField("packageProtectedField")));
+
+
assertFalse(Modifier.isWritableProperty(Bean.class.getDeclaredField("finalPublicField")));
+
assertFalse(Modifier.isWritableProperty(Bean.class.getDeclaredField("finalPrivateField")));
+
assertFalse(Modifier.isWritableProperty(Bean.class.getDeclaredField("finalProtectedField")));
+
assertFalse(Modifier.isWritableProperty(Bean.class.getDeclaredField("finalPackageProtectedField")));
+
+
assertFalse(Modifier.isWritableProperty(Bean.class.getDeclaredField("staticPublicField")));
+
assertFalse(Modifier.isWritableProperty(Bean.class.getDeclaredField("staticPrivateField")));
+
assertFalse(Modifier.isWritableProperty(Bean.class.getDeclaredField("staticProtectedField")));
+
assertFalse(Modifier.isWritableProperty(Bean.class.getDeclaredField("staticPackageProtectedField")));
+
+
assertFalse(Modifier.isWritableProperty(Bean.class.getDeclaredField("finalStaticPublicField")));
+
assertFalse(Modifier.isWritableProperty(Bean.class.getDeclaredField("finalStaticPrivateField")));
+
assertFalse(Modifier.isWritableProperty(Bean.class.getDeclaredField("finalStaticProtectedField")));
+
assertFalse(Modifier.isWritableProperty(Bean.class.getDeclaredField("finalStaticPackageProtectedField")));
+ }
+
+ private static class Bean
+ {
+ public Object publicField;
+ private Object privateField;
+ protected Object protectedField;
+ Object packageProtectedField;
+
+ final public Object finalPublicField = new Object();
+ final private Object finalPrivateField = new Object();
+ final protected Object finalProtectedField = new Object();
+ final Object finalPackageProtectedField = new Object();
+
+ static public Object staticPublicField;
+ static private Object staticPrivateField;
+ static protected Object staticProtectedField;
+ static Object staticPackageProtectedField;
+
+ final static public Object finalStaticPublicField = new Object();
+ final static private Object finalStaticPrivateField = new Object();
+ final static protected Object finalStaticProtectedField = new Object();
+ final static Object finalStaticPackageProtectedField = new Object();
+ }
+}
Added: trunk/common/src/main/org/jboss/portal/test/common/reflect/ReflectionTestCase.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/test/common/reflect/ReflectionTestCase.java
(rev 0)
+++
trunk/common/src/main/org/jboss/portal/test/common/reflect/ReflectionTestCase.java 2007-06-03
09:56:50 UTC (rev 7373)
@@ -0,0 +1,90 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt 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.portal.test.common.reflect;
+
+import junit.framework.TestCase;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+
+import org.jboss.portal.common.reflect.Reflection;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ReflectionTestCase extends TestCase
+{
+
+ public void testClass1()
+ {
+ assertEquals(Class1.class, "privateMethod", Modifier.PRIVATE,
Reflection.findMethod(Class1.class, "privateMethod", new Class[0]));
+
+ //
+ assertEquals(Class1.class, "privateMethodOfClass1", Modifier.PRIVATE,
Reflection.findMethod(Class1.class, "privateMethodOfClass1", new Class[0]));
+ assertEquals(Class1.class, "publicAbstractMethodOfClass1",
Modifier.PUBLIC | Modifier.ABSTRACT, Reflection.findMethod(Class1.class,
"publicAbstractMethodOfClass1", new Class[0]));
+ assertEquals(Class1.class, "protectedAbstractMethodOfClass1",
Modifier.PROTECTED | Modifier.ABSTRACT, Reflection.findMethod(Class1.class,
"protectedAbstractMethodOfClass1", new Class[0]));
+ }
+
+ public void testClass2()
+ {
+ assertEquals(Class2.class, "privateMethod", Modifier.PRIVATE,
Reflection.findMethod(Class2.class, "privateMethod", new Class[0]));
+
+ //
+ assertEquals(Class1.class, "privateMethodOfClass1", Modifier.PRIVATE,
Reflection.findMethod(Class2.class, "privateMethodOfClass1", new Class[0]));
+ assertEquals(Class2.class, "publicAbstractMethodOfClass1",
Modifier.PUBLIC, Reflection.findMethod(Class2.class,
"publicAbstractMethodOfClass1", new Class[0]));
+ assertEquals(Class2.class, "protectedAbstractMethodOfClass1",
Modifier.PROTECTED, Reflection.findMethod(Class2.class,
"protectedAbstractMethodOfClass1", new Class[0]));
+
+ //
+ assertEquals(Class2.class, "privateMethodOfClass2", Modifier.PRIVATE,
Reflection.findMethod(Class2.class, "privateMethodOfClass2", new Class[0]));
+ assertEquals(Class2.class, "publicMethodOfClass2", Modifier.PUBLIC,
Reflection.findMethod(Class2.class, "publicMethodOfClass2", new Class[0]));
+ assertEquals(Class2.class, "protectedMethodOfClass2", Modifier.PROTECTED,
Reflection.findMethod(Class2.class, "protectedMethodOfClass2", new Class[0]));
+ }
+
+ public void testClass3()
+ {
+ assertEquals(Class3.class, "privateMethod", Modifier.PRIVATE,
Reflection.findMethod(Class3.class, "privateMethod", new Class[0]));
+
+ //
+ assertEquals(Class1.class, "privateMethodOfClass1", Modifier.PRIVATE,
Reflection.findMethod(Class3.class, "privateMethodOfClass1", new Class[0]));
+ assertEquals(Class2.class, "publicAbstractMethodOfClass1",
Modifier.PUBLIC, Reflection.findMethod(Class3.class,
"publicAbstractMethodOfClass1", new Class[0]));
+ assertEquals(Class2.class, "protectedAbstractMethodOfClass1",
Modifier.PROTECTED, Reflection.findMethod(Class3.class,
"protectedAbstractMethodOfClass1", new Class[0]));
+
+ //
+ assertEquals(Class2.class, "privateMethodOfClass2", Modifier.PRIVATE,
Reflection.findMethod(Class3.class, "privateMethodOfClass2", new Class[0]));
+ assertEquals(Class2.class, "publicMethodOfClass2", Modifier.PUBLIC,
Reflection.findMethod(Class3.class, "publicMethodOfClass2", new Class[0]));
+ assertEquals(Class2.class, "protectedMethodOfClass2", Modifier.PROTECTED,
Reflection.findMethod(Class3.class, "protectedMethodOfClass2", new Class[0]));
+
+ //
+ assertEquals(Class3.class, "privateMethodOfClass3", Modifier.PRIVATE,
Reflection.findMethod(Class3.class, "privateMethodOfClass3", new Class[0]));
+ }
+
+ private void assertEquals(Class declaringClass, String methodName, int modifiers,
Method effectiveMethod)
+ {
+ assertNotNull(effectiveMethod);
+ assertEquals(declaringClass, effectiveMethod.getDeclaringClass());
+ assertEquals(modifiers, effectiveMethod.getModifiers());
+ assertEquals(methodName, effectiveMethod.getName());
+ }
+
+}
Added: trunk/common/src/main/org/jboss/portal/test/common/test/junit/BaseTest.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/test/common/test/junit/BaseTest.java
(rev 0)
+++ trunk/common/src/main/org/jboss/portal/test/common/test/junit/BaseTest.java 2007-06-03
09:56:50 UTC (rev 7373)
@@ -0,0 +1,44 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt 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.portal.test.common.test.junit;
+
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class BaseTest
+{
+ protected final Map state = new HashMap();
+ protected final void add(String methodName)
+ {
+ Integer count = (Integer)state.get(methodName);
+ if (count == null)
+ {
+ count = new Integer(0);
+ }
+ state.put(methodName, new Integer(count.intValue() + 1));
+ }
+}
Added:
trunk/common/src/main/org/jboss/portal/test/common/test/junit/POJOJunitTestTestCase.java
===================================================================
---
trunk/common/src/main/org/jboss/portal/test/common/test/junit/POJOJunitTestTestCase.java
(rev 0)
+++
trunk/common/src/main/org/jboss/portal/test/common/test/junit/POJOJunitTestTestCase.java 2007-06-03
09:56:50 UTC (rev 7373)
@@ -0,0 +1,92 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt 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.portal.test.common.test.junit;
+
+import junit.framework.TestCase;
+import org.jboss.portal.common.test.junit.POJOJUnitTest;
+import org.jboss.portal.common.test.driver.command.StartTestCommand;
+import org.jboss.portal.common.util.MapBuilder;
+
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class POJOJunitTestTestCase extends TestCase
+{
+
+ /** . */
+ private static final Map lifeCycleCalledState = new
MapBuilder().put("testFoo", new Integer(1)).put("setUp", new
Integer(1)).put("tearDown", new Integer(1)).toHashMap();
+
+ /** . */
+ private static final Map lifeCycleNotCalledState = new
MapBuilder().put("testFoo", new Integer(1)).toHashMap();
+
+ public void testDeclaredPublicLifeCycle() throws Exception
+ {
+ PublicLifecycleTest publicLifecycle = new PublicLifecycleTest();
+ POJOJUnitTest test = new POJOJUnitTest(publicLifecycle);
+ test.invoke("testFoo", new StartTestCommand());
+ assertEquals(lifeCycleCalledState, publicLifecycle.state);
+ }
+
+ public void testDeclaredProtectedLifeCycle() throws Exception
+ {
+ ProtectedLifecycleTest protectedLifecycle = new ProtectedLifecycleTest();
+ POJOJUnitTest test = new POJOJUnitTest(protectedLifecycle);
+ test.invoke("testFoo", new StartTestCommand());
+ assertEquals(lifeCycleCalledState, protectedLifecycle.state);
+ }
+
+ public void testDeclaredPrivateLifeCycle() throws Exception
+ {
+ PrivateLifecycleTest privateLifecycle = new PrivateLifecycleTest();
+ POJOJUnitTest test = new POJOJUnitTest(privateLifecycle);
+ test.invoke("testFoo", new StartTestCommand());
+ assertEquals(lifeCycleNotCalledState, privateLifecycle.state);
+ }
+
+ public void testInheritedPublicLifeCycle() throws Exception
+ {
+ PublicLifecycleInheritedTest publicLifecycleInherited = new
PublicLifecycleInheritedTest();
+ POJOJUnitTest test = new POJOJUnitTest(publicLifecycleInherited);
+ test.invoke("testFoo", new StartTestCommand());
+ assertEquals(lifeCycleCalledState, publicLifecycleInherited.state);
+ }
+
+ public void testInheritedProtectedLifeCycle() throws Exception
+ {
+ ProtectedLifecycleInheritedTest protectedLifecycleInherited = new
ProtectedLifecycleInheritedTest();
+ POJOJUnitTest test = new POJOJUnitTest(protectedLifecycleInherited);
+ test.invoke("testFoo", new StartTestCommand());
+ assertEquals(lifeCycleCalledState, protectedLifecycleInherited.state);
+ }
+
+ public void testInheritedPrivateLifeCycle() throws Exception
+ {
+ PrivateLifecycleInheritedTest privateLifecycleInherited = new
PrivateLifecycleInheritedTest();
+ POJOJUnitTest test = new POJOJUnitTest(privateLifecycleInherited);
+ test.invoke("testFoo", new StartTestCommand());
+ assertEquals(lifeCycleNotCalledState, privateLifecycleInherited.state);
+ }
+}
\ No newline at end of file
Added:
trunk/common/src/main/org/jboss/portal/test/common/test/junit/PrivateLifecycleInheritedTest.java
===================================================================
---
trunk/common/src/main/org/jboss/portal/test/common/test/junit/PrivateLifecycleInheritedTest.java
(rev 0)
+++
trunk/common/src/main/org/jboss/portal/test/common/test/junit/PrivateLifecycleInheritedTest.java 2007-06-03
09:56:50 UTC (rev 7373)
@@ -0,0 +1,35 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt 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.portal.test.common.test.junit;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PrivateLifecycleInheritedTest extends PrivateLifecycleSuperTest
+{
+ public void testFoo()
+ {
+ add("testFoo");
+ }
+}
Added:
trunk/common/src/main/org/jboss/portal/test/common/test/junit/PrivateLifecycleSuperTest.java
===================================================================
---
trunk/common/src/main/org/jboss/portal/test/common/test/junit/PrivateLifecycleSuperTest.java
(rev 0)
+++
trunk/common/src/main/org/jboss/portal/test/common/test/junit/PrivateLifecycleSuperTest.java 2007-06-03
09:56:50 UTC (rev 7373)
@@ -0,0 +1,39 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt 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.portal.test.common.test.junit;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class PrivateLifecycleSuperTest extends BaseTest
+{
+ private void setUp()
+ {
+ add("setUp");
+ }
+ private void tearDown()
+ {
+ add("tearDown");
+ }
+}
Added:
trunk/common/src/main/org/jboss/portal/test/common/test/junit/PrivateLifecycleTest.java
===================================================================
---
trunk/common/src/main/org/jboss/portal/test/common/test/junit/PrivateLifecycleTest.java
(rev 0)
+++
trunk/common/src/main/org/jboss/portal/test/common/test/junit/PrivateLifecycleTest.java 2007-06-03
09:56:50 UTC (rev 7373)
@@ -0,0 +1,43 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt 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.portal.test.common.test.junit;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PrivateLifecycleTest extends BaseTest
+{
+ private void setUp()
+ {
+ add("setUp");
+ }
+ private void tearDown()
+ {
+ add("tearDown");
+ }
+ public void testFoo()
+ {
+ add("testFoo");
+ }
+}
Added:
trunk/common/src/main/org/jboss/portal/test/common/test/junit/ProtectedLifecycleInheritedTest.java
===================================================================
---
trunk/common/src/main/org/jboss/portal/test/common/test/junit/ProtectedLifecycleInheritedTest.java
(rev 0)
+++
trunk/common/src/main/org/jboss/portal/test/common/test/junit/ProtectedLifecycleInheritedTest.java 2007-06-03
09:56:50 UTC (rev 7373)
@@ -0,0 +1,35 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt 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.portal.test.common.test.junit;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ProtectedLifecycleInheritedTest extends ProtectedLifecycleSuperTest
+{
+ public void testFoo()
+ {
+ add("testFoo");
+ }
+}
Added:
trunk/common/src/main/org/jboss/portal/test/common/test/junit/ProtectedLifecycleSuperTest.java
===================================================================
---
trunk/common/src/main/org/jboss/portal/test/common/test/junit/ProtectedLifecycleSuperTest.java
(rev 0)
+++
trunk/common/src/main/org/jboss/portal/test/common/test/junit/ProtectedLifecycleSuperTest.java 2007-06-03
09:56:50 UTC (rev 7373)
@@ -0,0 +1,39 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt 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.portal.test.common.test.junit;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class ProtectedLifecycleSuperTest extends BaseTest
+{
+ protected void setUp()
+ {
+ add("setUp");
+ }
+ protected void tearDown()
+ {
+ add("tearDown");
+ }
+}
Added:
trunk/common/src/main/org/jboss/portal/test/common/test/junit/ProtectedLifecycleTest.java
===================================================================
---
trunk/common/src/main/org/jboss/portal/test/common/test/junit/ProtectedLifecycleTest.java
(rev 0)
+++
trunk/common/src/main/org/jboss/portal/test/common/test/junit/ProtectedLifecycleTest.java 2007-06-03
09:56:50 UTC (rev 7373)
@@ -0,0 +1,43 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt 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.portal.test.common.test.junit;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ProtectedLifecycleTest extends BaseTest
+{
+ protected void setUp()
+ {
+ add("setUp");
+ }
+ protected void tearDown()
+ {
+ add("tearDown");
+ }
+ public void testFoo()
+ {
+ add("testFoo");
+ }
+}
Added:
trunk/common/src/main/org/jboss/portal/test/common/test/junit/PublicLifecycleInheritedTest.java
===================================================================
---
trunk/common/src/main/org/jboss/portal/test/common/test/junit/PublicLifecycleInheritedTest.java
(rev 0)
+++
trunk/common/src/main/org/jboss/portal/test/common/test/junit/PublicLifecycleInheritedTest.java 2007-06-03
09:56:50 UTC (rev 7373)
@@ -0,0 +1,35 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt 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.portal.test.common.test.junit;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PublicLifecycleInheritedTest extends PublicLifecycleSuperTest
+{
+ public void testFoo()
+ {
+ add("testFoo");
+ }
+}
Added:
trunk/common/src/main/org/jboss/portal/test/common/test/junit/PublicLifecycleSuperTest.java
===================================================================
---
trunk/common/src/main/org/jboss/portal/test/common/test/junit/PublicLifecycleSuperTest.java
(rev 0)
+++
trunk/common/src/main/org/jboss/portal/test/common/test/junit/PublicLifecycleSuperTest.java 2007-06-03
09:56:50 UTC (rev 7373)
@@ -0,0 +1,39 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt 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.portal.test.common.test.junit;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class PublicLifecycleSuperTest extends BaseTest
+{
+ public void setUp()
+ {
+ add("setUp");
+ }
+ public void tearDown()
+ {
+ add("tearDown");
+ }
+}
Added:
trunk/common/src/main/org/jboss/portal/test/common/test/junit/PublicLifecycleTest.java
===================================================================
---
trunk/common/src/main/org/jboss/portal/test/common/test/junit/PublicLifecycleTest.java
(rev 0)
+++
trunk/common/src/main/org/jboss/portal/test/common/test/junit/PublicLifecycleTest.java 2007-06-03
09:56:50 UTC (rev 7373)
@@ -0,0 +1,43 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt 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.portal.test.common.test.junit;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PublicLifecycleTest extends BaseTest
+{
+ public void setUp()
+ {
+ add("setUp");
+ }
+ public void tearDown()
+ {
+ add("tearDown");
+ }
+ public void testFoo()
+ {
+ add("testFoo");
+ }
+}