[jboss-svn-commits] JBoss Portal SVN: r5281 - in trunk: cms/src/main/org/jboss/portal/test/cms common common/src/main/org/jboss/portal/common common/src/main/org/jboss/portal/common/junit common/src/main/org/jboss/portal/common/junit/ant common/src/main/org/jboss/portal/common/junit/metadata common/src/main/org/jboss/portal/test/common core core/src/main/org/jboss/portal/test/core/model/instance core/src/main/org/jboss/portal/test/core/state identity/src/main/org/jboss/portal/test/identity portlet/src/main/org/jboss/portal/test/framework/portlet/actions portlet/src/main/org/jboss/portal/test/portlet portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletsession test/src/main/org/jboss/portal/test/framework test/src/main/org/jboss/portal/test/framework/container/result test/src/main/org/jboss/portal/test/framework/embedded tools/etc/buildfragments tools/lib
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Sep 28 12:49:58 EDT 2006
Author: julien at jboss.com
Date: 2006-09-28 12:49:27 -0400 (Thu, 28 Sep 2006)
New Revision: 5281
Added:
trunk/common/src/main/org/jboss/portal/common/junit/
trunk/common/src/main/org/jboss/portal/common/junit/ConfigurableTestCase.java
trunk/common/src/main/org/jboss/portal/common/junit/ExtendedAssert.java
trunk/common/src/main/org/jboss/portal/common/junit/TestCaseFactory.java
trunk/common/src/main/org/jboss/portal/common/junit/TransactionAssert.java
trunk/common/src/main/org/jboss/portal/common/junit/ant/
trunk/common/src/main/org/jboss/portal/common/junit/ant/ConfigurableJUnitTask.java
trunk/common/src/main/org/jboss/portal/common/junit/ant/ConfigurableJUnitTest.java
trunk/common/src/main/org/jboss/portal/common/junit/ant/TestFactory.java
trunk/common/src/main/org/jboss/portal/common/junit/ant/TestParameter.java
trunk/common/src/main/org/jboss/portal/common/junit/metadata/
trunk/common/src/main/org/jboss/portal/common/junit/metadata/TestCaseMetaData.java
trunk/common/src/main/org/jboss/portal/common/junit/metadata/TestCaseParameterIterableValue.java
trunk/common/src/main/org/jboss/portal/common/junit/metadata/TestCaseParameterMetaData.java
trunk/common/src/main/org/jboss/portal/common/junit/metadata/TestCaseParameterValue.java
Removed:
trunk/test/src/main/org/jboss/portal/test/framework/junit/
Modified:
trunk/cms/src/main/org/jboss/portal/test/cms/AbstractCMSTestCase.java
trunk/common/build.xml
trunk/common/src/main/org/jboss/portal/test/common/HexTestCase.java
trunk/core/build.xml
trunk/core/src/main/org/jboss/portal/test/core/model/instance/InstanceContainerTestCase.java
trunk/core/src/main/org/jboss/portal/test/core/state/ProducerTestCase.java
trunk/identity/src/main/org/jboss/portal/test/identity/DBUserTestCase.java
trunk/identity/src/main/org/jboss/portal/test/identity/LDAPUserTestCase.java
trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/actions/TestAction.java
trunk/portlet/src/main/org/jboss/portal/test/portlet/ParametersTestCase.java
trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletsession/HttpSessionInvalidatorServlet.java
trunk/test/src/main/org/jboss/portal/test/framework/container/result/AssertResult.java
trunk/test/src/main/org/jboss/portal/test/framework/embedded/DataSourceSupport.java
trunk/tools/etc/buildfragments/buildmagic.ent
trunk/tools/lib/explode.jar
Log:
- hacked the concept of parametrizing a test case in the junit test declaration and integrated it with test case metadata
Modified: trunk/cms/src/main/org/jboss/portal/test/cms/AbstractCMSTestCase.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/AbstractCMSTestCase.java 2006-09-28 15:23:26 UTC (rev 5280)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/AbstractCMSTestCase.java 2006-09-28 16:49:27 UTC (rev 5281)
@@ -25,9 +25,9 @@
import junit.framework.TestSuite;
import org.jboss.portal.test.framework.TestRuntimeContext;
import org.jboss.portal.test.framework.embedded.DataSourceSupport;
-import org.jboss.portal.test.framework.junit.TestCaseFactory;
-import org.jboss.portal.test.framework.junit.metadata.TestCaseMetaData;
-import org.jboss.portal.test.framework.junit.metadata.TestCaseParameterMetaData;
+import org.jboss.portal.common.junit.TestCaseFactory;
+import org.jboss.portal.common.junit.metadata.TestCaseMetaData;
+import org.jboss.portal.common.junit.metadata.TestCaseParameterMetaData;
import java.net.URL;
import java.util.Map;
Modified: trunk/common/build.xml
===================================================================
--- trunk/common/build.xml 2006-09-28 15:23:26 UTC (rev 5280)
+++ trunk/common/build.xml 2006-09-28 16:49:27 UTC (rev 5281)
@@ -69,12 +69,12 @@
<path refid="oswego.concurrent.classpath"/>
<path refid="jbossas/core.libs.classpath"/>
<path refid="apache.ant.classpath"/>
- <path refid="apache.ant.classpath"/>
<path refid="apache.log4j.classpath"/>
<path refid="jboss.test.classpath"/>
<path refid="junit.junit.classpath"/>
<pathelement location="../tools/lib/cargo-core-uberjar-0.8.jar"/>
<pathelement location="../tools/lib/cargo-ant-0.8.jar"/>
+ <pathelement location="../tools/lib/ant-junit.jar"/>
</path>
<!-- Configure modules -->
@@ -136,13 +136,18 @@
<jar jarfile="${build.lib}/portal-common-lib.jar" manifest="${build.etc}/portal-common-lib-jar.mf">
<fileset dir="${build.classes}"/>
<fileset dir="${build.resources}/format/code"/>
- </jar>
+ <fileset dir="${build.classes}">
+ <exclude name="org/jboss/portal/common/ant/**/*"/>
+ <exclude name="org/jboss/portal/common/junit/**/*"/>
+ </fileset>
+ </jar>
<!-- Build the ant task that explodes archives -->
<jar jarfile="${build.lib}/explode.jar">
- <fileset dir="${build.classes}">
- <include name="org/jboss/portal/common/ant/*"/>
- </fileset>
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/portal/common/ant/**/*"/>
+ <include name="org/jboss/portal/common/junit/**/*"/>
+ </fileset>
</jar>
</target>
@@ -184,8 +189,15 @@
<target name="help" depends="_default:help"/>
<target name="tests" depends="init">
+
+
<execute-tests>
<x-test>
+<!--
+ <zest todir="." name="org.jboss.portal.common.junit.ConfigurableTestCase">
+ <parameter name="blah" value="toto"/>
+ </zest>
+-->
<test todir="${test.reports}" name="org.jboss.portal.test.common.AbstractInvocationContextTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.common.LocaleInfoTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.common.ParentChildResourceBundleTestCase"/>
Added: trunk/common/src/main/org/jboss/portal/common/junit/ConfigurableTestCase.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/junit/ConfigurableTestCase.java 2006-09-28 15:23:26 UTC (rev 5280)
+++ trunk/common/src/main/org/jboss/portal/common/junit/ConfigurableTestCase.java 2006-09-28 16:49:27 UTC (rev 5281)
@@ -0,0 +1,79 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., 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.junit;
+
+import junit.framework.TestCase;
+
+import java.util.Map;
+
+import org.jboss.portal.common.junit.ant.TestParameter;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ConfigurableTestCase extends TestCase
+{
+
+ /** . */
+ private Map parameters;
+
+ public ConfigurableTestCase()
+ {
+ try
+ {
+ TestParameter.readExternalParameters();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+ }
+
+ public ConfigurableTestCase(String name)
+ {
+ super(name);
+ try
+ {
+ TestParameter.readExternalParameters();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+ }
+
+ public void testA()
+ {
+ System.out.println("parameters = " + parameters);
+ }
+
+ public void testB()
+ {
+ System.out.println("parameters = " + parameters);
+ }
+
+ public void testC()
+ {
+ System.out.println("parameters = " + parameters);
+ }
+}
Added: trunk/common/src/main/org/jboss/portal/common/junit/ExtendedAssert.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/junit/ExtendedAssert.java 2006-09-28 15:23:26 UTC (rev 5280)
+++ trunk/common/src/main/org/jboss/portal/common/junit/ExtendedAssert.java 2006-09-28 16:49:27 UTC (rev 5281)
@@ -0,0 +1,105 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., 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.junit;
+
+import junit.framework.Assert;
+
+import java.util.Arrays;
+
+/**
+ * Add more assert methods.
+ *
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1842 $
+ */
+public class ExtendedAssert extends Assert
+{
+
+ /**
+ * @see #assertEquals(Object[], Object[])
+ */
+ public static void assertEquals(Object[] expected, Object[] actual)
+ {
+ assertEquals(null, (Object[])expected, (Object[])actual);
+ }
+
+ /**
+ * Test equality as defined by java.util.Array#equals(Object[], Object[]).
+ */
+ public static void assertEquals(String message, Object[] expected, Object[] actual)
+ {
+ if (Arrays.equals(expected, actual))
+ {
+ return;
+ }
+ fail(format(message, expected, actual));
+ }
+
+ /**
+ * @see #assertEquals(byte[], byte[])
+ */
+ public static void assertEquals(byte[] expected, byte[] actual)
+ {
+ assertEquals(null, expected, actual);
+ }
+
+ /**
+ * Test equality as defined by java.util.Array#equals(Object[], Object[]).
+ */
+ public static void assertEquals(String message, byte[] expected, byte[] actual)
+ {
+ if (Arrays.equals(expected, actual))
+ {
+ return;
+ }
+ fail(format(message, expected, actual));
+ }
+
+ private static String format(String message, Object expected, Object actual) {
+ String formatted= "";
+ if (message != null)
+ {
+ formatted = message + " ";
+ }
+ return formatted + "expected:<" + format(expected) + "> but was:<" + format(actual) + ">";
+ }
+
+ private static String format(Object o)
+ {
+ if (o instanceof Object[])
+ {
+ Object[] array = (Object[])o;
+ StringBuffer buffer = new StringBuffer("[");
+ for (int i = 0; i < array.length; i++)
+ {
+ buffer.append(i == 0 ? "" : ",").append(String.valueOf(array[i]));
+ }
+ buffer.append("]");
+ return buffer.toString();
+ }
+ else
+ {
+ return String.valueOf(o);
+ }
+ }
+
+}
Property changes on: trunk/common/src/main/org/jboss/portal/common/junit/ExtendedAssert.java
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/common/src/main/org/jboss/portal/common/junit/TestCaseFactory.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/junit/TestCaseFactory.java 2006-09-28 15:23:26 UTC (rev 5280)
+++ trunk/common/src/main/org/jboss/portal/common/junit/TestCaseFactory.java 2006-09-28 16:49:27 UTC (rev 5281)
@@ -0,0 +1,101 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., 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.junit;
+
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.Method;
+import java.util.Map;
+import java.util.Iterator;
+
+import org.jboss.portal.common.junit.metadata.TestCaseMetaData;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class TestCaseFactory
+{
+
+ public static TestSuite create(TestCaseMetaData testCaseMD, Class clazz)
+ {
+ TestSuite suite = new TestSuite();
+ for (Iterator i = testCaseMD.getParametrizations().iterator();i.hasNext();)
+ {
+ Map parametrization = (Map)i.next();
+
+ //
+ introspect(suite, parametrization, clazz);
+ }
+ return suite;
+ }
+
+ private static void introspect(TestSuite suite, Map parametrization, Class clazz)
+ {
+ try
+ {
+ Constructor ctor = clazz.getConstructor(new Class[]{Map.class});
+
+ //
+ Method[] methods = clazz.getMethods();
+ for (int j = 0; j < methods.length; j++)
+ {
+ Method method = methods[j];
+ int modifiers = method.getModifiers();
+ if (Modifier.isPublic(modifiers) && !Modifier.isAbstract(modifiers) && !Modifier.isStatic(modifiers) && method.getName().startsWith("test"))
+ {
+ TestCase testCase = (TestCase)ctor.newInstance(new Object[]{parametrization});
+ testCase.setName(method.getName());
+ suite.addTest(testCase);
+ }
+ }
+ }
+ catch (InstantiationException e)
+ {
+ IllegalArgumentException iae = new IllegalArgumentException();
+ iae.initCause(e);
+ throw iae;
+ }
+ catch (NoSuchMethodException e)
+ {
+ IllegalArgumentException iae = new IllegalArgumentException();
+ iae.initCause(e);
+ throw iae;
+ }
+ catch (IllegalAccessException e)
+ {
+ IllegalArgumentException iae = new IllegalArgumentException();
+ iae.initCause(e);
+ throw iae;
+ }
+ catch (InvocationTargetException e)
+ {
+ IllegalArgumentException iae = new IllegalArgumentException();
+ iae.initCause(e);
+ throw iae;
+ }
+ }
+}
Added: trunk/common/src/main/org/jboss/portal/common/junit/TransactionAssert.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/junit/TransactionAssert.java 2006-09-28 15:23:26 UTC (rev 5280)
+++ trunk/common/src/main/org/jboss/portal/common/junit/TransactionAssert.java 2006-09-28 16:49:27 UTC (rev 5281)
@@ -0,0 +1,301 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., 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.junit;
+
+import junit.framework.Assert;
+import junit.framework.AssertionFailedError;
+
+import javax.transaction.UserTransaction;
+import javax.transaction.Status;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 5246 $
+ */
+public class TransactionAssert extends Assert
+{
+
+ private static final String[] STATUS_NAMES = {
+ "STATUS_ACTIVE",
+ "STATUS_MARKED_ROLLBACK",
+ "STATUS_PREPARED",
+ "STATUS_COMMITTED",
+ "STATUS_ROLLEDBACK",
+ "STATUS_UNKNOWN",
+ "STATUS_NO_TRANSACTION",
+ "STATUS_PREPARING",
+ "STATUS_COMMITTING",
+ "STATUS_ROLLING_BACK"};
+
+ /**
+ * Decode the status name.
+ *
+ * @param status the status value
+ * @return the translated status name or null if it is not valid
+ */
+ public static String decodeStatus(int status)
+ {
+ if (status >= 0 && status <= STATUS_NAMES.length)
+ {
+ return STATUS_NAMES[status];
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ /** . */
+ public static final Terminator NONE = new Terminator("NONE");
+
+ /** . */
+ public static final Terminator MARKED_AS_ROLLBACK = new Terminator("MARKED_AS_ROLLBACK");
+
+ /** . */
+ public static final Terminator MUST_COMMIT = new Terminator("MUST_COMMIT");
+
+ /** . */
+ public static final Terminator MUST_ROLLBACK = new Terminator("MUST ROLLBACK");
+
+ /**
+ *
+ */
+ public static final class Terminator
+ {
+
+ /** . */
+ private final String name;
+
+ public Terminator(String name)
+ {
+ this.name = name;
+ }
+ }
+
+ /**
+ * Assert the status of the current transaction.
+ *
+ * @param expectedStatus the expected status
+ */
+ public static void assertStatusEquals(int expectedStatus)
+ {
+ try
+ {
+ UserTransaction ut = getUserTransaction();
+ int status = ut.getStatus();
+ if (status != expectedStatus)
+ {
+ fail("The status of the current transaction is " + status + " was expecting " + expectedStatus);
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ fail("Unexpected exception");
+ }
+ }
+
+ /**
+ * Commit the transaction or fail.
+ */
+ public static void commitTransaction()
+ {
+ try
+ {
+ getUserTransaction().commit();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ fail("Cannot commit transaction");
+ }
+ }
+
+ /**
+ * Rollback the transaction or fail.
+ */
+ public static void rollbackTransaction()
+ {
+ rollbackTransaction(true);
+ }
+
+ public static void rollbackTransaction(boolean marked)
+ {
+ try
+ {
+ UserTransaction ut = getUserTransaction();
+ int status = ut.getStatus();
+ if (status == Status.STATUS_MARKED_ROLLBACK)
+ {
+ ut.rollback();
+ if (marked == false)
+ {
+ fail("Transaction should have been marked as rollback");
+ }
+ }
+ else if (status == Status.STATUS_ACTIVE)
+ {
+ ut.rollback();
+ if (marked)
+ {
+ fail("Transaction should have been marked as rollback");
+ }
+ }
+ else
+ {
+ if (marked)
+ {
+ fail("Unexpected transaction status " + status);
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ fail("Cannot end transaction");
+ }
+ }
+
+ /**
+ * Begin a transaction or fail.
+ */
+ public static void beginTransaction()
+ {
+ try
+ {
+ getUserTransaction().begin();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ fail("Cannot begin transaction");
+ }
+ }
+
+ /**
+ * If no transaction do nothing.
+ * End the transaction if it is active or marked for rollback otherwise fail.
+ */
+ public static int endTransaction()
+ {
+ try
+ {
+ UserTransaction ut = getUserTransaction();
+ int status = ut.getStatus();
+ if (status == Status.STATUS_MARKED_ROLLBACK)
+ {
+ ut.rollback();
+ }
+ else if (status == Status.STATUS_ACTIVE)
+ {
+ ut.commit();
+ }
+ else if (status == Status.STATUS_NO_TRANSACTION)
+ {
+ // Do nothing
+ }
+ else
+ {
+ fail("Unexpected transaction status " + status);
+ }
+ return status;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ throw new AssertionFailedError("Cannot end transaction");
+ }
+ }
+
+ /**
+ * If no transaction do nothing.
+ * End the transaction if it is active or marked for rollback otherwise fail.
+ */
+ public static int endTransaction(Terminator expectedTerminator)
+ {
+ if (expectedTerminator == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ try
+ {
+ UserTransaction ut = getUserTransaction();
+ int status = ut.getStatus();
+ if (status == Status.STATUS_MARKED_ROLLBACK)
+ {
+ ut.rollback();
+ if (expectedTerminator != MARKED_AS_ROLLBACK)
+ {
+ fail("Was expecting the transaction to be marked as rollback instead got " + decodeStatus(status));
+ }
+ }
+ else if (status == Status.STATUS_ACTIVE)
+ {
+ if (expectedTerminator == MUST_COMMIT)
+ {
+ ut.commit();
+ }
+ else if (expectedTerminator == MUST_ROLLBACK)
+ {
+ ut.rollback();
+ }
+ else
+ {
+ fail("Was expecting the transaction to be either commiting or rollbacking instead got " + decodeStatus(status));
+ }
+ }
+ else if (status == Status.STATUS_NO_TRANSACTION)
+ {
+ if (expectedTerminator != NONE)
+ {
+ fail("Was expecting no transaction instead got " + decodeStatus(status));
+ }
+ }
+ else
+ {
+ fail("Unexpected transaction status " + decodeStatus(status));
+ }
+ return status;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ throw new AssertionFailedError("Cannot end transaction");
+ }
+ }
+
+ public static UserTransaction getUserTransaction()
+ {
+ try
+ {
+ return (UserTransaction)new InitialContext().lookup("UserTransaction");
+ }
+ catch (NamingException e)
+ {
+ e.printStackTrace();
+ fail("Cannot obtain user transaction");
+ return null;
+ }
+ }
+}
Property changes on: trunk/common/src/main/org/jboss/portal/common/junit/TransactionAssert.java
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/common/src/main/org/jboss/portal/common/junit/ant/ConfigurableJUnitTask.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/junit/ant/ConfigurableJUnitTask.java 2006-09-28 15:23:26 UTC (rev 5280)
+++ trunk/common/src/main/org/jboss/portal/common/junit/ant/ConfigurableJUnitTask.java 2006-09-28 16:49:27 UTC (rev 5281)
@@ -0,0 +1,42 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., 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.junit.ant;
+
+import org.apache.tools.ant.taskdefs.optional.junit.JUnitTask;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ConfigurableJUnitTask extends JUnitTask
+{
+
+ public ConfigurableJUnitTask() throws Exception
+ {
+ }
+
+ public void addZest(ConfigurableJUnitTest test)
+ {
+ test.setTask(this);
+ addTest(test);
+ }
+}
Added: trunk/common/src/main/org/jboss/portal/common/junit/ant/ConfigurableJUnitTest.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/junit/ant/ConfigurableJUnitTest.java 2006-09-28 15:23:26 UTC (rev 5280)
+++ trunk/common/src/main/org/jboss/portal/common/junit/ant/ConfigurableJUnitTest.java 2006-09-28 16:49:27 UTC (rev 5281)
@@ -0,0 +1,98 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., 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.junit.ant;
+
+import org.apache.tools.ant.taskdefs.optional.junit.JUnitTest;
+import org.apache.tools.ant.types.Environment;
+import org.jboss.portal.common.junit.ant.ConfigurableJUnitTask;
+
+import java.util.Map;
+import java.util.HashMap;
+import java.util.ArrayList;
+import java.io.ObjectOutputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ConfigurableJUnitTest extends JUnitTest
+{
+
+ /** . */
+ public static final String PARAMETER_PROPERTY_NAME = "test.params";
+
+ /** . */
+ private ArrayList nestedParameters;
+
+ /** . */
+ private ConfigurableJUnitTask task;
+
+ public ConfigurableJUnitTest()
+ {
+ nestedParameters = new ArrayList();
+ }
+
+ public void addParameter(TestParameter parameter)
+ {
+ nestedParameters.add(parameter);
+ }
+
+ public String getName()
+ {
+ try
+ {
+ Map parameters = new HashMap();
+ for (int i = 0; i < nestedParameters.size(); i++)
+ {
+ TestParameter parameter = (TestParameter)nestedParameters.get(i);
+ parameters.put(parameter.getName(), parameter.getValue());
+ }
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(baos);
+ oos.writeObject(parameters);
+ oos.close();
+ byte[] bytes = baos.toByteArray();
+ StringBuffer hex = new StringBuffer(bytes.length * 2);
+ for (int i = 0; i < bytes.length; i++)
+ {
+ hex.append(Character.forDigit((bytes[i] & 0XF0) >> 4, 16));
+ hex.append(Character.forDigit((bytes[i] & 0X0F), 16));
+ }
+ Environment.Variable v = new Environment.Variable();
+ v.setKey(PARAMETER_PROPERTY_NAME);
+ v.setValue(hex.toString());
+ task.addSysproperty(v);
+ return super.getName();
+ }
+ catch (IOException e)
+ {
+ throw new Error(e);
+ }
+ }
+
+ public void setTask(ConfigurableJUnitTask task)
+ {
+ this.task = task;
+ }
+}
Added: trunk/common/src/main/org/jboss/portal/common/junit/ant/TestFactory.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/junit/ant/TestFactory.java 2006-09-28 15:23:26 UTC (rev 5280)
+++ trunk/common/src/main/org/jboss/portal/common/junit/ant/TestFactory.java 2006-09-28 16:49:27 UTC (rev 5281)
@@ -0,0 +1,50 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., 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.junit.ant;
+
+import junit.framework.TestSuite;
+import junit.framework.Test;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class TestFactory extends TestSuite
+{
+
+ public static Test suite()
+ {
+ System.out.println("System.getProperties() = " + System.getProperties());
+ try
+ {
+// String className = System.getProperty("test.classname");
+// String counter = System.getProperty("test.counter");
+// System.out.println("counter = " + counter);
+// Class testClass = Class.forName(className);
+ return new TestSuite();
+ }
+ catch (Exception e)
+ {
+ throw new Error(e);
+ }
+ }
+}
Added: trunk/common/src/main/org/jboss/portal/common/junit/ant/TestParameter.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/junit/ant/TestParameter.java 2006-09-28 15:23:26 UTC (rev 5280)
+++ trunk/common/src/main/org/jboss/portal/common/junit/ant/TestParameter.java 2006-09-28 16:49:27 UTC (rev 5281)
@@ -0,0 +1,94 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., 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.junit.ant;
+
+import java.util.Map;
+import java.io.ObjectInputStream;
+import java.io.ByteArrayInputStream;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class TestParameter
+{
+
+ /** . */
+ private String name;
+
+ /** . */
+ private String value;
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+
+ public void setValue(String value)
+ {
+ this.value = value;
+ }
+
+ public static Map readExternalParameters() throws Exception
+ {
+ String hex = System.getProperty(ConfigurableJUnitTest.PARAMETER_PROPERTY_NAME);
+ if (hex != null)
+ {
+ int index = 0;
+ byte[] bytes = new byte[hex.length() / 2];
+ for (int i = 0; i < bytes.length; i++)
+ {
+ char chigh = hex.charAt(index++);
+ int high = Character.digit(chigh, 16);
+ if (high == -1)
+ {
+ throw new IllegalArgumentException("Hex string contains a bad char : " + chigh);
+ }
+ char clow = hex.charAt(index++);
+ int low = Character.digit(clow, 16);
+ if (low == -1)
+ {
+ throw new IllegalArgumentException("Hex string contains a bad char : " + clow);
+ }
+ byte value = (byte)((high << 4) + low);
+ bytes[i] = value;
+ }
+ ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(bytes));
+ Map parameters = (Map)ois.readObject();
+ return parameters;
+ }
+ else
+ {
+ return null;
+ }
+ }
+}
Added: trunk/common/src/main/org/jboss/portal/common/junit/metadata/TestCaseMetaData.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/junit/metadata/TestCaseMetaData.java 2006-09-28 15:23:26 UTC (rev 5280)
+++ trunk/common/src/main/org/jboss/portal/common/junit/metadata/TestCaseMetaData.java 2006-09-28 16:49:27 UTC (rev 5281)
@@ -0,0 +1,154 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., 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.junit.metadata;
+
+import org.jboss.portal.common.junit.ant.TestParameter;
+
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Collection;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class TestCaseMetaData
+{
+
+ /** . */
+ private Map parameters;
+
+ /** . */
+ private Map parametrization;
+
+ public TestCaseMetaData()
+ {
+ this.parameters = new HashMap();
+ this.parametrization = new HashMap();
+ }
+
+ public void addParameter(TestCaseParameterMetaData parameter)
+ {
+ if (parameter == null)
+ {
+ throw new IllegalArgumentException("No null accepted");
+ }
+ if (parameters.containsKey(parameter.getName()))
+ {
+ throw new IllegalArgumentException("Duplicate parameter " + parameter.getName());
+ }
+
+ //
+ parameters.put(parameter.getName(), parameter);
+ }
+
+ public void bindParameter(TestCaseParameterMetaData parameter, TestCaseParameterValue value)
+ {
+ if (parameter == null)
+ {
+ throw new IllegalArgumentException("No null accepted");
+ }
+ if (parameters.containsKey(parameter.getName()))
+ {
+ throw new IllegalArgumentException("Duplicate parameter " + parameter.getName());
+ }
+
+ //
+ parameters.put(parameter.getName(), parameter);
+ parametrization.put(parameter.getName(), value);
+ }
+
+ public void bindExternalParameters()
+ {
+ try
+ {
+ Map externalParameters = TestParameter.readExternalParameters();
+ if (externalParameters != null)
+ {
+ for (Iterator i = externalParameters.entrySet().iterator(); i.hasNext();)
+ {
+ Map.Entry entry = (Map.Entry)i.next();
+ String parameterName = (String)entry.getKey();
+ String parameterValue = (String)entry.getValue();
+ bindParameter(new TestCaseParameterMetaData(parameterName), new TestCaseParameterValue(parameterValue));
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public Collection getParametrizations()
+ {
+ ArrayList c = new ArrayList();
+ c.add(new HashMap());
+
+ //
+ for (Iterator i = parameters.values().iterator(); i.hasNext();)
+ {
+ TestCaseParameterMetaData parameter = (TestCaseParameterMetaData)i.next();
+
+ //
+ if (parametrization.containsKey(parameter.getName()) == false)
+ {
+ throw new IllegalStateException("Parameter not bound " + parameter.getName());
+ }
+
+ //
+ TestCaseParameterValue value = (TestCaseParameterValue)parametrization.get(parameter.getName());
+
+ //
+ if (value instanceof TestCaseParameterIterableValue)
+ {
+ TestCaseParameterIterableValue iterableValue = (TestCaseParameterIterableValue)value;
+ ArrayList tmp = new ArrayList();
+ for (Iterator j = iterableValue.iterator();j.hasNext();)
+ {
+ Object o = j.next();
+ ArrayList copy = new ArrayList(c.size());
+ for (Iterator k = c.iterator();k.hasNext();)
+ {
+ Map parametrization = (Map)k.next();
+ parametrization = new HashMap(parametrization);
+ parametrization.put(parameter.getName(), o);
+ copy.add(parametrization);
+ }
+ tmp.addAll(copy);
+ }
+ c = tmp;
+ }
+ else
+ {
+ for (int j = 0; j < c.size(); j++)
+ {
+ Map parametrization = (Map)c.get(j);
+ parametrization.put(parameter.getName(), value.get());
+ }
+ }
+ }
+ return c;
+ }
+}
Added: trunk/common/src/main/org/jboss/portal/common/junit/metadata/TestCaseParameterIterableValue.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/junit/metadata/TestCaseParameterIterableValue.java 2006-09-28 15:23:26 UTC (rev 5280)
+++ trunk/common/src/main/org/jboss/portal/common/junit/metadata/TestCaseParameterIterableValue.java 2006-09-28 16:49:27 UTC (rev 5281)
@@ -0,0 +1,49 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., 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.junit.metadata;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class TestCaseParameterIterableValue extends TestCaseParameterValue
+{
+
+ public TestCaseParameterIterableValue(Collection values)
+ {
+ super(values);
+
+ //
+ if (values == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ }
+
+ public Iterator iterator()
+ {
+ return ((Collection)value).iterator();
+ }
+}
Added: trunk/common/src/main/org/jboss/portal/common/junit/metadata/TestCaseParameterMetaData.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/junit/metadata/TestCaseParameterMetaData.java 2006-09-28 15:23:26 UTC (rev 5280)
+++ trunk/common/src/main/org/jboss/portal/common/junit/metadata/TestCaseParameterMetaData.java 2006-09-28 16:49:27 UTC (rev 5281)
@@ -0,0 +1,47 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., 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.junit.metadata;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class TestCaseParameterMetaData
+{
+
+ /** . */
+ private String name;
+
+ public TestCaseParameterMetaData(String name)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ this.name = name;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+}
Added: trunk/common/src/main/org/jboss/portal/common/junit/metadata/TestCaseParameterValue.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/junit/metadata/TestCaseParameterValue.java 2006-09-28 15:23:26 UTC (rev 5280)
+++ trunk/common/src/main/org/jboss/portal/common/junit/metadata/TestCaseParameterValue.java 2006-09-28 16:49:27 UTC (rev 5281)
@@ -0,0 +1,43 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., 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.junit.metadata;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class TestCaseParameterValue
+{
+
+ /** . */
+ protected final Object value;
+
+ public TestCaseParameterValue(Object value)
+ {
+ this.value = value;
+ }
+
+ public Object get()
+ {
+ return value;
+ }
+}
Modified: trunk/common/src/main/org/jboss/portal/test/common/HexTestCase.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/test/common/HexTestCase.java 2006-09-28 15:23:26 UTC (rev 5280)
+++ trunk/common/src/main/org/jboss/portal/test/common/HexTestCase.java 2006-09-28 16:49:27 UTC (rev 5281)
@@ -35,13 +35,17 @@
public HexTestCase(String s)
{
super(s);
+ System.out.println("BUILD");
+ System.out.println("BUILD");
+ System.out.println("BUILD");
}
public void testBasic()
{
byte[] original = new byte[]{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20};
String hex = Tools.toHexString(original);
- assertEquals("000102030405060708090a0b0c0d0e0f1011121314", hex);
+// assertEquals((String)"000102030405060708090a0b0c0d0e0f1011121314", (String)hex);
+ assertEquals("a", "a");
byte[] copy = Tools.fromHexString(hex);
assertTrue(Arrays.equals(original, copy));
}
Modified: trunk/core/build.xml
===================================================================
--- trunk/core/build.xml 2006-09-28 15:23:26 UTC (rev 5280)
+++ trunk/core/build.xml 2006-09-28 16:49:27 UTC (rev 5281)
@@ -550,7 +550,14 @@
<sysproperty key="jboss.aop.class.path" value="${jbossas/core.libs.lib}/jboss-aspect-library.jar"/>
</x-sysproperty>
<x-test>
- <test todir="${test.reports}" name="org.jboss.portal.test.core.model.instance.InstanceContainerTestCase"/>
+ <zest todir="${test.reports}" name="org.jboss.portal.test.core.model.instance.InstanceContainerTestCase"
+ outfile="TEST-LocalInstanceContainerTestCase">
+ <parameter name="PersistLocally" value="true"/>
+ </zest>
+ <zest todir="${test.reports}" name="org.jboss.portal.test.core.model.instance.InstanceContainerTestCase"
+ outfile="TEST-RemoteInstanceContainerTestCase">
+ <parameter name="PersistLocally" value="false"/>
+ </zest>
<!--<test todir="${test.reports}" name="org.jboss.portal.test.core.state.ProducerTestCase"/>-->
<test todir="${test.reports}" name="org.jboss.portal.test.core.deployment.JBossApplicationMetaDataFactoryTestCase"/>
</x-test>
@@ -584,108 +591,6 @@
</execute-tests>
</target>
- <target name="test" depends="init">
-
- <property name="build.testlog" value="${module.output}/log"/>
-
- <echo><![CDATA[
- ${build.reports}
- ${build.testlog}
- ${module.output}
- ${junit.printsummary}
- ${junit.batchtest.haltonerror}
- ${junit.batchtest.haltonfailure}
- ${junit.batchtest.fork}
- ${junit.timeout}
- ${junit.jvm}
- ]]></echo>
-
- <mkdir dir="${build.reports}"/>
- <mkdir dir="${build.testlog}"/>
-
- <junit
- dir="${module.output}"
- printsummary="${junit.printsummary}"
- haltonerror="${junit.haltonerror}"
- haltonfailure="${junit.haltonfailure}"
- fork="${junit.fork}"
- timeout="${junit.timeout}"
- jvm="${junit.jvm}">
-
- <!--<jvmarg value="-Xdebug"/>-->
- <!--<jvmarg value="-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y"/>-->
-
- <formatter type="plain" usefile="false"/>
- <formatter type="xml" usefile="true"/>
- <sysproperty key="build.testlog" value="${build.testlog}"/>
- <sysproperty key="build.resources" value="${build.resources}"/>
- <!--<sysproperty key="jboss.aop.path" value="${build.resources}/portal-core-sar/portal-aop.xml;${source.etc}/jboss-aop/base-aop.xml"/>-->
- <sysproperty key="jboss.aop.path"
- value="${build.resources}/portal-core-sar/portal-aop.xml${path.separator}${source.etc}/jboss-aop/base-aop.xml"/>
- <sysproperty key="jboss.aop.class.path" value="${jbossas/core.libs.lib}/jboss-aspect-library.jar"/>
-
- <!--<test todir="${test.reports}" name="org.jboss.portal.test.core.model.portal.PortalObjectPermissionTestCase"/>-->
- <!--<test todir="${test.reports}" name="org.jboss.portal.test.core.model.portal.PortalObjectContainerTestCase"/>-->
-
-
- <test todir="${test.reports}" name="org.jboss.portal.test.core.model.instance.InstanceContainerTestCase"/>
-
-
- <!--
- <test todir="${test.reports}" name="org.jboss.portal.test.core.model.db.PreferencesModelTestCase"/>
- -->
- <test todir="${test.reports}" name="org.jboss.portal.test.core.theme.UserThemeTestCase"/>
- <!-- <test todir="${test.reports}" name="org.jboss.portal.test.core.portlet.UserPortletTestCase"/>-->
- <!-- <test todir="${test.reports}" name="org.jboss.portal.test.core.portlet.RolePortletTestCase"/>-->
-
- <!-- <test todir="${test.reports}" name="org.jboss.portal.test.core.plugins.security.ModelAuthorizationRealmTestCase"/> -->
- <!-- <test todir="${test.reports}" name="org.jboss.portal.test.core.security.ModelPluginTestCase"/>-->
- <!-- <test todir="${test.reports}" name="org.jboss.portal.test.core.PageTestCase"/>-->
- <!-- <test todir="${test.reports}" name="org.jboss.portal.test.core.CorePortletPreferencesTestCase"/>-->
- <!-- <test todir="${test.reports}" name="org.jboss.portal.test.core.ProxyValidatorTestCase"/>-->
- <!-- <test todir="${test.reports}" name="org.jboss.portal.test.core.util.ParametersTestCase"/>-->
- <!-- <test todir="${test.reports}" name="org.jboss.portal.test.core.MapperTestCase"/> -->
-
- <!-- <test todir="${test.reports}" name="org.jboss.portal.test.core.tree.LocalTestCase"/> -->
- <!-- <test todir="${test.reports}" name="org.jboss.portal.test.core.tree.ReplicatedTestCase"/> -->
- <!--
- <test todir="${test.reports}" name="org.jboss.portal.test.core.tree.CMSCacheLoaderTestCase"/>
- -->
- <!--<test todir="${test.reports}" name="org.jboss.portal.test.core.impl.portal.PortalObjectContainerLoadingTestCase"/>-->
- <!--<test todir="${test.reports}" name="org.jboss.portal.test.core.impl.portal.PortalObjectContainerLocalTestCase"/>-->
- <!--<test todir="${test.reports}" name="org.jboss.portal.test.core.impl.portal.PortalObjectContainerReplicatedTestCase"/>-->
-
- <!--<test todir="${test.reports}" name="org.jboss.portal.test.core.model.portal.ModelTestCase"/>-->
-
- <!--<test name="org.jboss.portal.test.core.impl.container.LocalContainerTestCase"/>-->
- <!--<test name="org.jboss.portal.test.core.security.SecurityTestCase"/>-->
-
- <classpath>
- <path refid="apache.xerces.classpath"/>
- <path refid="jboss.jbossxb.classpath"/>
- <pathelement location="${build.lib}/portal-core-lib.jar"/>
- <pathelement location="${build.lib}/portal-core-test-lib.jar"/>
- <pathelement location="${build.resources}/portal-core-sar"/>
- <pathelement location="${jboss.portal-test.root}/etc"/>
- <path refid="oswego.concurrent.classpath"/>
- <path refid="jboss.microcontainer.classpath"/>
- <path refid="aop.classpath"/>
-
- <pathelement location="${jboss.home}/lib/dom4j.jar"/>
- <pathelement location="${jboss.home}/server/default/lib/hsqldb.jar"/>
- <pathelement location="${jboss.home}/server/default/lib/cglib-2.1_2jboss.jar"/>
- <pathelement location="${jboss.home}/server/default/lib/asm.jar"/>
-
- <path refid="library.classpath"/>
- <path refid="dependentmodule.classpath"/>
- <pathelement location="${nekohtml.nekohtml.lib}/nekohtml.jar"/>
- <pathelement location="${dbunit.dbunit.lib}/dbunit.jar"/>
- <pathelement location="${jdbc.connectors.lib}/mysql-connector-java.jar"/>
- </classpath>
- </junit>
-
- </target>
-
<!--
Run a single unit test.
ant -Dtest=org.jboss.portal.test.core.model.portal.PortalObjectContainerTestCase one-test
@@ -732,16 +637,4 @@
</junit>
</target>
-
- <!-- Build the tests report -->
- <target name="tests-report" depends="init" description="Build the tests report">
-
- <junitreport todir="output/reports">
- <fileset dir="output/tests">
- <include name="TEST-*.xml"/>
- </fileset>
- <report format="frames" todir="output/reports/html"/>
- </junitreport>
- </target>
-
</project>
Modified: trunk/core/src/main/org/jboss/portal/test/core/model/instance/InstanceContainerTestCase.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/test/core/model/instance/InstanceContainerTestCase.java 2006-09-28 15:23:26 UTC (rev 5280)
+++ trunk/core/src/main/org/jboss/portal/test/core/model/instance/InstanceContainerTestCase.java 2006-09-28 16:49:27 UTC (rev 5281)
@@ -36,11 +36,10 @@
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.test.framework.embedded.DataSourceSupport;
import org.jboss.portal.test.framework.embedded.HibernateSupport;
-import org.jboss.portal.test.framework.junit.TransactionAssert;
-import org.jboss.portal.test.framework.junit.TestCaseFactory;
-import org.jboss.portal.test.framework.junit.metadata.TestCaseMetaData;
-import org.jboss.portal.test.framework.junit.metadata.TestCaseParameterMetaData;
-import org.jboss.portal.test.framework.junit.metadata.TestCaseParameterIterableValue;
+import org.jboss.portal.common.junit.TransactionAssert;
+import org.jboss.portal.common.junit.TestCaseFactory;
+import org.jboss.portal.common.junit.metadata.TestCaseMetaData;
+import org.jboss.portal.common.junit.metadata.TestCaseParameterMetaData;
import org.jboss.portal.test.framework.TestRuntimeContext;
import org.jboss.portal.common.value.StringValue;
import org.apache.log4j.Appender;
@@ -53,7 +52,6 @@
import java.util.List;
import java.util.Set;
import java.util.Map;
-import java.util.Arrays;
/**
* Test Case that tests the authorization for instances
@@ -87,7 +85,8 @@
URL configsURL = Thread.currentThread().getContextClassLoader().getResource("datasources.xml");
TestCaseMetaData testCaseMD = new TestCaseMetaData();
testCaseMD.bindParameter(new TestCaseParameterMetaData("DataSourceConfig"), DataSourceSupport.Config.fromXML2(configsURL));
- testCaseMD.bindParameter(new TestCaseParameterMetaData("PersistLocally"), new TestCaseParameterIterableValue(Arrays.asList(new Object[]{Boolean.TRUE,Boolean.FALSE})));
+ testCaseMD.bindExternalParameters();
+// testCaseMD.bindParameter(new TestCaseParameterMetaData("PersistLocally"), new TestCaseParameterIterableValue(Arrays.asList(new Object[]{Boolean.TRUE,Boolean.FALSE})));
TestSuite suite = TestCaseFactory.create(testCaseMD, InstanceContainerTestCase.class);
return suite;
}
@@ -131,7 +130,7 @@
public InstanceContainerTestCase(Map parametrization)
{
dataSourceConfig = (DataSourceSupport.Config)parametrization.get("DataSourceConfig");
- persistLocally = ((Boolean)parametrization.get("PersistLocally")).booleanValue();
+ persistLocally = Boolean.valueOf((String)parametrization.get("PersistLocally")).booleanValue();
}
/** . */
Modified: trunk/core/src/main/org/jboss/portal/test/core/state/ProducerTestCase.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/test/core/state/ProducerTestCase.java 2006-09-28 15:23:26 UTC (rev 5280)
+++ trunk/core/src/main/org/jboss/portal/test/core/state/ProducerTestCase.java 2006-09-28 16:49:27 UTC (rev 5281)
@@ -22,7 +22,6 @@
package org.jboss.portal.test.core.state;
import junit.framework.TestCase;
-import junit.framework.TestSuite;
import org.apache.log4j.Appender;
import org.apache.log4j.ConsoleAppender;
import org.apache.log4j.SimpleLayout;
@@ -30,7 +29,7 @@
import org.apache.log4j.Level;
import org.jboss.portal.test.framework.embedded.DataSourceSupport;
import org.jboss.portal.test.framework.embedded.HibernateSupport;
-import org.jboss.portal.test.framework.junit.TransactionAssert;
+import org.jboss.portal.common.junit.TransactionAssert;
import org.jboss.portal.test.framework.TestRuntimeContext;
import org.jboss.portal.portlet.test.ValueMapAssert;
import org.jboss.portal.portlet.test.ActionContextImpl;
Modified: trunk/identity/src/main/org/jboss/portal/test/identity/DBUserTestCase.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/test/identity/DBUserTestCase.java 2006-09-28 15:23:26 UTC (rev 5280)
+++ trunk/identity/src/main/org/jboss/portal/test/identity/DBUserTestCase.java 2006-09-28 16:49:27 UTC (rev 5281)
@@ -22,9 +22,9 @@
package org.jboss.portal.test.identity;
import org.jboss.portal.test.framework.TestRuntimeContext;
-import org.jboss.portal.test.framework.junit.TestCaseFactory;
-import org.jboss.portal.test.framework.junit.metadata.TestCaseMetaData;
-import org.jboss.portal.test.framework.junit.metadata.TestCaseParameterMetaData;
+import org.jboss.portal.common.junit.TestCaseFactory;
+import org.jboss.portal.common.junit.metadata.TestCaseMetaData;
+import org.jboss.portal.common.junit.metadata.TestCaseParameterMetaData;
import org.jboss.portal.test.framework.embedded.HibernateSupport;
import org.jboss.portal.test.framework.embedded.DataSourceSupport;
import org.jboss.portal.identity.db.DBUserModuleImpl;
Modified: trunk/identity/src/main/org/jboss/portal/test/identity/LDAPUserTestCase.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/test/identity/LDAPUserTestCase.java 2006-09-28 15:23:26 UTC (rev 5280)
+++ trunk/identity/src/main/org/jboss/portal/test/identity/LDAPUserTestCase.java 2006-09-28 16:49:27 UTC (rev 5281)
@@ -30,9 +30,6 @@
import java.text.SimpleDateFormat;
import java.io.File;
-import org.jboss.portal.test.framework.junit.metadata.TestCaseMetaData;
-import org.jboss.portal.test.framework.junit.metadata.TestCaseParameterMetaData;
-import org.jboss.portal.test.framework.junit.TestCaseFactory;
import org.jboss.portal.test.framework.embedded.DataSourceSupport;
import org.jboss.portal.test.framework.embedded.HibernateSupport;
import org.jboss.portal.test.framework.embedded.opends.OpenDSUtil;
Modified: trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/actions/TestAction.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/actions/TestAction.java 2006-09-28 15:23:26 UTC (rev 5280)
+++ trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/actions/TestAction.java 2006-09-28 16:49:27 UTC (rev 5281)
@@ -21,7 +21,7 @@
*/
package org.jboss.portal.test.framework.portlet.actions;
-import org.jboss.portal.test.framework.junit.ExtendedAssert;
+import org.jboss.portal.common.junit.ExtendedAssert;
import org.jboss.portal.test.framework.container.result.AssertResult;
import org.jboss.portal.test.framework.container.result.Result;
Modified: trunk/portlet/src/main/org/jboss/portal/test/portlet/ParametersTestCase.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/ParametersTestCase.java 2006-09-28 15:23:26 UTC (rev 5280)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/ParametersTestCase.java 2006-09-28 16:49:27 UTC (rev 5281)
@@ -26,7 +26,7 @@
import java.util.Map;
import org.jboss.portal.test.AbstractTestCase;
-import org.jboss.portal.test.framework.junit.ExtendedAssert;
+import org.jboss.portal.common.junit.ExtendedAssert;
import org.jboss.portal.portlet.Parameters;
/**
Modified: trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletsession/HttpSessionInvalidatorServlet.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletsession/HttpSessionInvalidatorServlet.java 2006-09-28 15:23:26 UTC (rev 5280)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletsession/HttpSessionInvalidatorServlet.java 2006-09-28 16:49:27 UTC (rev 5281)
@@ -21,7 +21,7 @@
*/
package org.jboss.portal.test.portlet.jsr168.tck.portletsession;
-import org.jboss.portal.test.framework.junit.ExtendedAssert;
+import org.jboss.portal.common.junit.ExtendedAssert;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
Modified: trunk/test/src/main/org/jboss/portal/test/framework/container/result/AssertResult.java
===================================================================
--- trunk/test/src/main/org/jboss/portal/test/framework/container/result/AssertResult.java 2006-09-28 15:23:26 UTC (rev 5280)
+++ trunk/test/src/main/org/jboss/portal/test/framework/container/result/AssertResult.java 2006-09-28 16:49:27 UTC (rev 5281)
@@ -22,7 +22,7 @@
package org.jboss.portal.test.framework.container.result;
import org.apache.log4j.Logger;
-import org.jboss.portal.test.framework.junit.ExtendedAssert;
+import org.jboss.portal.common.junit.ExtendedAssert;
import org.jboss.portal.test.framework.container.client.command.EndCommand;
import org.jboss.portal.test.framework.container.client.command.RethrowCommand;
import org.jboss.portal.test.framework.container.client.command.ClientCommand;
Modified: trunk/test/src/main/org/jboss/portal/test/framework/embedded/DataSourceSupport.java
===================================================================
--- trunk/test/src/main/org/jboss/portal/test/framework/embedded/DataSourceSupport.java 2006-09-28 15:23:26 UTC (rev 5280)
+++ trunk/test/src/main/org/jboss/portal/test/framework/embedded/DataSourceSupport.java 2006-09-28 16:49:27 UTC (rev 5281)
@@ -25,7 +25,7 @@
import org.jboss.resource.adapter.jdbc.local.LocalTxDataSource;
import org.jboss.portal.common.util.XML;
import org.jboss.portal.common.util.Tools;
-import org.jboss.portal.test.framework.junit.metadata.TestCaseParameterIterableValue;
+import org.jboss.portal.common.junit.metadata.TestCaseParameterIterableValue;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
Modified: trunk/tools/etc/buildfragments/buildmagic.ent
===================================================================
--- trunk/tools/etc/buildfragments/buildmagic.ent 2006-09-28 15:23:26 UTC (rev 5280)
+++ trunk/tools/etc/buildfragments/buildmagic.ent 2006-09-28 16:49:27 UTC (rev 5281)
@@ -94,6 +94,7 @@
<!-- Load common properties -->
<property file="${project.tools}/etc/buildfragments/common.properties"/>
+ <!-- Load db properties -->
<loadproperties srcFile="${project.root}/build/etc/hsqldb.properties">
<filterchain>
<prefixlines prefix="hsqldb."/>
@@ -134,6 +135,15 @@
<property file="${project.root}/build/etc/${portal.database}.properties"/>
<property name="hibernate.properties" value="${project.root}/build/etc/${portal.database}.properties"/>
+ <!-- Load the junit extension -->
+ <path id="junit_.task.classpath">
+ <pathelement location="${project.tools}/lib/explode.jar"/>
+ </path>
+ <taskdef
+ name="junit_"
+ classname="org.jboss.portal.common.junit.ant.ConfigurableJUnitTask"
+ classpathref="junit_.task.classpath"/>
+
<!-- Setup the build timestamp & build identifer properties -->
<tstamp>
<format property="build.number" pattern="yyyyMMddHHmm"/>
@@ -636,7 +646,7 @@
]]></echo>
<mkdir dir="${build.reports}"/>
<mkdir dir="${test.reports}"/>
- <junit
+ <junit_
dir="${module.output}"
printsummary="${junit.printsummary}"
haltonerror="${junit.haltonerror}"
@@ -660,7 +670,7 @@
<path refid="jboss.test.classpath"/>
<x-classpath/>
</classpath>
- </junit>
+ </junit_>
</sequential>
</macrodef>
Modified: trunk/tools/lib/explode.jar
===================================================================
(Binary files differ)
More information about the jboss-svn-commits
mailing list