[jboss-svn-commits] JBoss Portal SVN: r5514 - in trunk: cms/src/main/org/jboss/portal/test/cms cms/src/main/org/jboss/portal/test/cms/commands 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/common/test common/src/main/org/jboss/portal/common/test/junit core/src/main/org/jboss/portal/test/core/model/instance identity identity/src/main/org/jboss/portal/test/identity server/src/main/org/jboss/portal/test/server test/src/main/org/jboss/portal/test/framework/embedded tools/lib
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Oct 30 10:34:13 EST 2006
Author: julien at jboss.com
Date: 2006-10-30 10:33:10 -0500 (Mon, 30 Oct 2006)
New Revision: 5514
Added:
trunk/common/src/main/org/jboss/portal/common/test/MonoValuedTestParameterValue.java
trunk/common/src/main/org/jboss/portal/common/test/MultiValuedTestParameterValue.java
Removed:
trunk/common/src/main/org/jboss/portal/common/junit/TestBuilder.java
trunk/common/src/main/org/jboss/portal/common/junit/ant/TestFactory.java
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
trunk/common/src/main/org/jboss/portal/common/test/MonoValuedTestParameter.java
trunk/common/src/main/org/jboss/portal/common/test/MultiValuedTestParameter.java
Modified:
trunk/cms/src/main/org/jboss/portal/test/cms/AbstractCMSTestCase.java
trunk/cms/src/main/org/jboss/portal/test/cms/JackrabbitTestCase.java
trunk/cms/src/main/org/jboss/portal/test/cms/TestRepositoryBootStrap.java
trunk/cms/src/main/org/jboss/portal/test/cms/TestRepositoryUtil.java
trunk/cms/src/main/org/jboss/portal/test/cms/commands/AbstractCommandTestCase.java
trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileArchiveUpload.java
trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileCopy.java
trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileCreate.java
trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileCreateFailed.java
trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileDelete.java
trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileGet.java
trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileGetList.java
trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileGetVersion.java
trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileUpdate.java
trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFolderCopy.java
trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFolderCreate.java
trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFolderDelete.java
trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFolderGet.java
trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFolderUpdate.java
trunk/common/src/main/org/jboss/portal/common/test/TestParametrization.java
trunk/common/src/main/org/jboss/portal/common/test/junit/JUnitAdapter.java
trunk/common/src/main/org/jboss/portal/common/test/junit/POJOJUnitTest.java
trunk/core/src/main/org/jboss/portal/test/core/model/instance/InstanceContainerTestCase.java
trunk/identity/build.xml
trunk/identity/src/main/org/jboss/portal/test/identity/DBUserTestCase.java
trunk/identity/src/main/org/jboss/portal/test/identity/LDAPMembershipStrategyTestCase.java
trunk/identity/src/main/org/jboss/portal/test/identity/LDAPSimpleRoleModuleTestCase.java
trunk/identity/src/main/org/jboss/portal/test/identity/LDAPSimpleUserModuleTestCase.java
trunk/identity/src/main/org/jboss/portal/test/identity/LDAPStaticGroupStrategyTestCase.java
trunk/identity/src/main/org/jboss/portal/test/identity/LDAPStaticRoleStrategyTestCase.java
trunk/identity/src/main/org/jboss/portal/test/identity/LDAPTestCase.java
trunk/identity/src/main/org/jboss/portal/test/identity/LDAPUserTestCase.java
trunk/server/src/main/org/jboss/portal/test/server/ServerTestRunner.java
trunk/test/src/main/org/jboss/portal/test/framework/embedded/DSConfig.java
trunk/test/src/main/org/jboss/portal/test/framework/embedded/DataSourceSupport.java
trunk/tools/lib/explode.jar
Log:
- converted the parametrized test cases to use the test framework refactor
- remove obsolete test classes
Modified: trunk/cms/src/main/org/jboss/portal/test/cms/AbstractCMSTestCase.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/AbstractCMSTestCase.java 2006-10-30 13:49:00 UTC (rev 5513)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/AbstractCMSTestCase.java 2006-10-30 15:33:10 UTC (rev 5514)
@@ -24,14 +24,14 @@
import junit.framework.TestCase;
import junit.framework.TestSuite;
-import org.jboss.portal.common.junit.TestBuilder;
-import org.jboss.portal.common.junit.metadata.TestCaseMetaData;
-import org.jboss.portal.common.junit.metadata.TestCaseParameterMetaData;
+import org.jboss.portal.common.test.junit.POJOJUnitTest;
+import org.jboss.portal.common.test.junit.JUnitAdapter;
import org.jboss.portal.test.framework.TestRuntimeContext;
import org.jboss.portal.test.framework.embedded.DataSourceSupport;
import java.net.URL;
import java.util.Map;
+import java.util.HashMap;
/**
* @author <a href="mailto:julien at jboss.org">Julien Viet</a>
@@ -42,25 +42,33 @@
{
/** . */
- private DataSourceSupport.Config dsCfg;
+ private DataSourceSupport.Config dataSourceConfigParameter;
/** . */
private TestRuntimeContext runtimeContext;
- public AbstractCMSTestCase(Map parametrization)
+ public AbstractCMSTestCase()
{
- dsCfg = (DataSourceSupport.Config)parametrization.get("DataSourceConfig");
}
+ public DataSourceSupport.Config getDataSourceConfigParameter()
+ {
+ return dataSourceConfigParameter;
+ }
+
+ public void setDataSourceConfigParameter(DataSourceSupport.Config dataSourceConfigParameter)
+ {
+ this.dataSourceConfigParameter = dataSourceConfigParameter;
+ }
+
public void setUp() throws Exception
{
runtimeContext = new TestRuntimeContext("org/jboss/portal/cms/jboss-beans.xml");
runtimeContext.addBean("TestBean", this);
- runtimeContext.addBean("DataSourceConfig", dsCfg);
+ runtimeContext.addBean("DataSourceConfig", dataSourceConfigParameter);
runtimeContext.start();
}
-
protected void tearDown() throws Exception
{
runtimeContext.stop();
@@ -69,9 +77,12 @@
public static TestSuite createTestSuite(Class clazz) throws Exception
{
URL configsURL = Thread.currentThread().getContextClassLoader().getResource("datasources.xml");
- TestCaseMetaData testCaseMD = new TestCaseMetaData();
- testCaseMD.bindParameter(new TestCaseParameterMetaData("DataSourceConfig"), DataSourceSupport.Config.fromXML2(configsURL));
- TestSuite suite = TestBuilder.createTestSuite(testCaseMD, clazz);
+ Map parameterMap = new HashMap();
+ parameterMap.put("DataSourceConfig", DataSourceSupport.Config.fromXML2(configsURL));
+ POJOJUnitTest abc = new POJOJUnitTest(clazz);
+ JUnitAdapter adapter = new JUnitAdapter(abc, parameterMap);
+ TestSuite suite = new TestSuite();
+ suite.addTest(adapter);
return suite;
}
}
Modified: trunk/cms/src/main/org/jboss/portal/test/cms/JackrabbitTestCase.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/JackrabbitTestCase.java 2006-10-30 13:49:00 UTC (rev 5513)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/JackrabbitTestCase.java 2006-10-30 15:33:10 UTC (rev 5514)
@@ -45,9 +45,8 @@
public class JackrabbitTestCase extends AbstractCMSTestCase
{
- public JackrabbitTestCase(Map parametrization)
+ public JackrabbitTestCase()
{
- super(parametrization);
}
private JackrabbitJCRService jcr;
Modified: trunk/cms/src/main/org/jboss/portal/test/cms/TestRepositoryBootStrap.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/TestRepositoryBootStrap.java 2006-10-30 13:49:00 UTC (rev 5513)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/TestRepositoryBootStrap.java 2006-10-30 15:33:10 UTC (rev 5514)
@@ -41,9 +41,8 @@
public class TestRepositoryBootStrap extends AbstractCMSTestCase
{
- public TestRepositoryBootStrap(Map parametrization)
+ public TestRepositoryBootStrap()
{
- super(parametrization);
}
private JCRCMS service;
Modified: trunk/cms/src/main/org/jboss/portal/test/cms/TestRepositoryUtil.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/TestRepositoryUtil.java 2006-10-30 13:49:00 UTC (rev 5513)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/TestRepositoryUtil.java 2006-10-30 15:33:10 UTC (rev 5514)
@@ -118,9 +118,8 @@
}
}
- public TestRepositoryUtil(Map parametrization)
+ public TestRepositoryUtil()
{
- super(parametrization);
}
public void setUp() throws Exception
Modified: trunk/cms/src/main/org/jboss/portal/test/cms/commands/AbstractCommandTestCase.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/commands/AbstractCommandTestCase.java 2006-10-30 13:49:00 UTC (rev 5513)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/commands/AbstractCommandTestCase.java 2006-10-30 15:33:10 UTC (rev 5514)
@@ -44,9 +44,8 @@
*/
protected JCRCMS service;
- public AbstractCommandTestCase(Map parametrization)
+ public AbstractCommandTestCase()
{
- super(parametrization);
}
/**
Modified: trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileArchiveUpload.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileArchiveUpload.java 2006-10-30 13:49:00 UTC (rev 5513)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileArchiveUpload.java 2006-10-30 15:33:10 UTC (rev 5514)
@@ -61,9 +61,8 @@
*
*
*/
- public TestFileArchiveUpload(Map parametrization)
+ public TestFileArchiveUpload()
{
- super(parametrization);
}
/**
Modified: trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileCopy.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileCopy.java 2006-10-30 13:49:00 UTC (rev 5513)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileCopy.java 2006-10-30 15:33:10 UTC (rev 5514)
@@ -59,9 +59,8 @@
*
*
*/
- public TestFileCopy(Map parametrization)
+ public TestFileCopy()
{
- super(parametrization);
}
/**
Modified: trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileCreate.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileCreate.java 2006-10-30 13:49:00 UTC (rev 5513)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileCreate.java 2006-10-30 15:33:10 UTC (rev 5514)
@@ -62,9 +62,8 @@
*
*
*/
- public TestFileCreate(Map parametrization)
+ public TestFileCreate()
{
- super(parametrization);
}
/**
Modified: trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileCreateFailed.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileCreateFailed.java 2006-10-30 13:49:00 UTC (rev 5513)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileCreateFailed.java 2006-10-30 15:33:10 UTC (rev 5514)
@@ -65,9 +65,8 @@
*
*
*/
- public TestFileCreateFailed(Map parametrization)
+ public TestFileCreateFailed()
{
- super(parametrization);
}
/**
Modified: trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileDelete.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileDelete.java 2006-10-30 13:49:00 UTC (rev 5513)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileDelete.java 2006-10-30 15:33:10 UTC (rev 5514)
@@ -61,9 +61,8 @@
*
*
*/
- public TestFileDelete(Map parametrization)
+ public TestFileDelete()
{
- super(parametrization);
}
/**
Modified: trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileGet.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileGet.java 2006-10-30 13:49:00 UTC (rev 5513)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileGet.java 2006-10-30 15:33:10 UTC (rev 5514)
@@ -59,9 +59,8 @@
*
*
*/
- public TestFileGet(Map parametrization)
+ public TestFileGet()
{
- super(parametrization);
}
/**
Modified: trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileGetList.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileGetList.java 2006-10-30 13:49:00 UTC (rev 5513)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileGetList.java 2006-10-30 15:33:10 UTC (rev 5514)
@@ -60,9 +60,8 @@
*
*
*/
- public TestFileGetList(Map parametrization)
+ public TestFileGetList()
{
- super(parametrization);
}
/**
Modified: trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileGetVersion.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileGetVersion.java 2006-10-30 13:49:00 UTC (rev 5513)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileGetVersion.java 2006-10-30 15:33:10 UTC (rev 5514)
@@ -59,9 +59,8 @@
*
*
*/
- public TestFileGetVersion(Map parametrization)
+ public TestFileGetVersion()
{
- super(parametrization);
}
/**
Modified: trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileUpdate.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileUpdate.java 2006-10-30 13:49:00 UTC (rev 5513)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileUpdate.java 2006-10-30 15:33:10 UTC (rev 5514)
@@ -64,9 +64,8 @@
*
*
*/
- public TestFileUpdate(Map parametrization)
+ public TestFileUpdate()
{
- super(parametrization);
}
/**
Modified: trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFolderCopy.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFolderCopy.java 2006-10-30 13:49:00 UTC (rev 5513)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFolderCopy.java 2006-10-30 15:33:10 UTC (rev 5514)
@@ -53,9 +53,8 @@
*
*
*/
- public TestFolderCopy(Map parametrization)
+ public TestFolderCopy()
{
- super(parametrization);
}
/**
Modified: trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFolderCreate.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFolderCreate.java 2006-10-30 13:49:00 UTC (rev 5513)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFolderCreate.java 2006-10-30 15:33:10 UTC (rev 5514)
@@ -52,9 +52,8 @@
*
*
*/
- public TestFolderCreate(Map parametrization)
+ public TestFolderCreate()
{
- super(parametrization);
}
/**
Modified: trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFolderDelete.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFolderDelete.java 2006-10-30 13:49:00 UTC (rev 5513)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFolderDelete.java 2006-10-30 15:33:10 UTC (rev 5514)
@@ -47,9 +47,8 @@
*
*
*/
- public TestFolderDelete(Map parametrization)
+ public TestFolderDelete()
{
- super(parametrization);
}
/**
Modified: trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFolderGet.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFolderGet.java 2006-10-30 13:49:00 UTC (rev 5513)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFolderGet.java 2006-10-30 15:33:10 UTC (rev 5514)
@@ -48,9 +48,8 @@
*
*
*/
- public TestFolderGet(Map parametrization)
+ public TestFolderGet()
{
- super(parametrization);
}
/**
Modified: trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFolderUpdate.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFolderUpdate.java 2006-10-30 13:49:00 UTC (rev 5513)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFolderUpdate.java 2006-10-30 15:33:10 UTC (rev 5514)
@@ -51,9 +51,8 @@
*
*
*/
- public TestFolderUpdate(Map parametrization)
+ public TestFolderUpdate()
{
- super(parametrization);
}
/**
Deleted: trunk/common/src/main/org/jboss/portal/common/junit/TestBuilder.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/junit/TestBuilder.java 2006-10-30 13:49:00 UTC (rev 5513)
+++ trunk/common/src/main/org/jboss/portal/common/junit/TestBuilder.java 2006-10-30 15:33:10 UTC (rev 5514)
@@ -1,120 +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.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 java.util.Collections;
-
-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 TestBuilder
-{
-
- public static TestSuite createTestSuite(TestCaseMetaData testCaseMD, Class clazz, TestCaseFactory factory) throws NoSuchMethodException
- {
- TestSuite suite = new TestSuite();
- for (Iterator i = testCaseMD.getParametrizations().iterator();i.hasNext();)
- {
- Map parametrization = (Map)i.next();
-
- //
- introspect(suite, parametrization, clazz, factory);
- }
- return suite;
- }
-
- public static TestSuite createTestSuite(TestCaseMetaData testCaseMD, Class clazz) throws NoSuchMethodException
- {
- return createTestSuite(testCaseMD, clazz, new ReflectedTestCaseFactory(clazz));
- }
-
- public static void introspect(TestSuite suite, Class clazz) throws NoSuchMethodException
- {
- introspect(suite, clazz, new ReflectedTestCaseFactory(clazz));
- }
-
- public static void introspect(TestSuite suite, Class clazz, TestCaseFactory factory) throws NoSuchMethodException
- {
- introspect(suite, Collections.EMPTY_MAP, clazz, factory);
- }
-
- private static void introspect(TestSuite suite, Map parametrization, Class clazz, TestCaseFactory factory)
- {
- try
- {
- 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 = factory.createTestCase(parametrization, method.getName());
- suite.addTest(testCase);
- }
- }
- }
- catch (Exception e)
- {
- IllegalArgumentException iae = new IllegalArgumentException();
- iae.initCause(e);
- throw iae;
- }
- }
-
- public static class ReflectedTestCaseFactory implements TestCaseFactory
- {
-
- /** . */
- private final Constructor ctor;
-
- public ReflectedTestCaseFactory(Class clazz) throws NoSuchMethodException
- {
- this.ctor = clazz.getConstructor(new Class[]{Map.class});
- }
-
- public TestCase createTestCase(Map parametrization, String name) throws IllegalAccessException, InvocationTargetException, InstantiationException
- {
- TestCase testCase = (TestCase)ctor.newInstance(new Object[]{parametrization});
- testCase.setName(name);
- return testCase;
- }
- }
-
- public interface TestCaseFactory
- {
- TestCase createTestCase(Map parametrization, String name) throws Exception;
- }
-}
Deleted: 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-10-30 13:49:00 UTC (rev 5513)
+++ trunk/common/src/main/org/jboss/portal/common/junit/ant/TestFactory.java 2006-10-30 15:33:10 UTC (rev 5514)
@@ -1,51 +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.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);
- }
- }
-}
Deleted: 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-10-30 13:49:00 UTC (rev 5513)
+++ trunk/common/src/main/org/jboss/portal/common/junit/metadata/TestCaseMetaData.java 2006-10-30 15:33:10 UTC (rev 5514)
@@ -1,155 +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.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;
- }
-}
Deleted: 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-10-30 13:49:00 UTC (rev 5513)
+++ trunk/common/src/main/org/jboss/portal/common/junit/metadata/TestCaseParameterIterableValue.java 2006-10-30 15:33:10 UTC (rev 5514)
@@ -1,50 +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.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();
- }
-}
Deleted: 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-10-30 13:49:00 UTC (rev 5513)
+++ trunk/common/src/main/org/jboss/portal/common/junit/metadata/TestCaseParameterMetaData.java 2006-10-30 15:33:10 UTC (rev 5514)
@@ -1,48 +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.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;
- }
-}
Deleted: 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-10-30 13:49:00 UTC (rev 5513)
+++ trunk/common/src/main/org/jboss/portal/common/junit/metadata/TestCaseParameterValue.java 2006-10-30 15:33:10 UTC (rev 5514)
@@ -1,44 +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.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;
- }
-}
Deleted: trunk/common/src/main/org/jboss/portal/common/test/MonoValuedTestParameter.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/test/MonoValuedTestParameter.java 2006-10-30 13:49:00 UTC (rev 5513)
+++ trunk/common/src/main/org/jboss/portal/common/test/MonoValuedTestParameter.java 2006-10-30 15:33:10 UTC (rev 5514)
@@ -1,46 +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.common.test;
-
-/**
- * A simple value.
- *
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class MonoValuedTestParameter extends TestParameterValue
-{
-
- /** . */
- protected final Object value;
-
- public MonoValuedTestParameter(Object value)
- {
- this.value = value;
- }
-
- public Object get()
- {
- return value;
- }
-}
Copied: trunk/common/src/main/org/jboss/portal/common/test/MonoValuedTestParameterValue.java (from rev 5510, trunk/common/src/main/org/jboss/portal/common/test/MonoValuedTestParameter.java)
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/test/MonoValuedTestParameter.java 2006-10-30 13:35:25 UTC (rev 5510)
+++ trunk/common/src/main/org/jboss/portal/common/test/MonoValuedTestParameterValue.java 2006-10-30 15:33:10 UTC (rev 5514)
@@ -0,0 +1,46 @@
+/******************************************************************************
+ * 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.test;
+
+/**
+ * A simple value.
+ *
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class MonoValuedTestParameterValue extends TestParameterValue
+{
+
+ /** . */
+ protected final Object value;
+
+ public MonoValuedTestParameterValue(Object value)
+ {
+ this.value = value;
+ }
+
+ public Object get()
+ {
+ return value;
+ }
+}
Deleted: trunk/common/src/main/org/jboss/portal/common/test/MultiValuedTestParameter.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/test/MultiValuedTestParameter.java 2006-10-30 13:49:00 UTC (rev 5513)
+++ trunk/common/src/main/org/jboss/portal/common/test/MultiValuedTestParameter.java 2006-10-30 15:33:10 UTC (rev 5514)
@@ -1,75 +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.common.test;
-
-import java.util.Collection;
-import java.util.Iterator;
-
-/**
- * A multi valueed.
- *
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class MultiValuedTestParameter extends TestParameterValue
-{
-
- /** . */
- protected final Collection value;
-
- public MultiValuedTestParameter(Collection value)
- {
- if (value == null)
- {
- throw new IllegalArgumentException();
- }
-
- //
- this.value = value;
- }
-
- public Object get()
- {
- return value;
- }
-
- public Iterator iterator()
- {
- return new Iterator()
- {
- Iterator i = value.iterator();
- public boolean hasNext()
- {
- return i.hasNext();
- }
- public Object next()
- {
- return new MonoValuedTestParameter(i.next());
- }
- public void remove()
- {
- throw new UnsupportedOperationException();
- }
- };
- }
-}
Copied: trunk/common/src/main/org/jboss/portal/common/test/MultiValuedTestParameterValue.java (from rev 5510, trunk/common/src/main/org/jboss/portal/common/test/MultiValuedTestParameter.java)
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/test/MultiValuedTestParameter.java 2006-10-30 13:35:25 UTC (rev 5510)
+++ trunk/common/src/main/org/jboss/portal/common/test/MultiValuedTestParameterValue.java 2006-10-30 15:33:10 UTC (rev 5514)
@@ -0,0 +1,87 @@
+/******************************************************************************
+ * 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.test;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Arrays;
+
+/**
+ * A multi valueed.
+ *
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class MultiValuedTestParameterValue extends TestParameterValue
+{
+
+ /** . */
+ protected final Collection value;
+
+ public MultiValuedTestParameterValue(Object[] value)
+ {
+ if (value == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ this.value = Arrays.asList(value);
+ }
+
+ public MultiValuedTestParameterValue(Collection value)
+ {
+ if (value == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ this.value = value;
+ }
+
+ public Object get()
+ {
+ return value;
+ }
+
+ public Iterator iterator()
+ {
+ return new Iterator()
+ {
+ Iterator i = value.iterator();
+ public boolean hasNext()
+ {
+ return i.hasNext();
+ }
+ public Object next()
+ {
+ return new MonoValuedTestParameterValue(i.next());
+ }
+ public void remove()
+ {
+ throw new UnsupportedOperationException();
+ }
+ };
+ }
+}
Modified: trunk/common/src/main/org/jboss/portal/common/test/TestParametrization.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/test/TestParametrization.java 2006-10-30 13:49:00 UTC (rev 5513)
+++ trunk/common/src/main/org/jboss/portal/common/test/TestParametrization.java 2006-10-30 15:33:10 UTC (rev 5514)
@@ -104,9 +104,9 @@
expectedParameters.remove(parameterName);
//
- if (value instanceof MultiValuedTestParameter)
+ if (value instanceof MultiValuedTestParameterValue)
{
- MultiValuedTestParameter multiValue = (MultiValuedTestParameter)value;
+ MultiValuedTestParameterValue multiValue = (MultiValuedTestParameterValue)value;
ArrayList tmp = new ArrayList();
for (Iterator j = multiValue.iterator();j.hasNext();)
{
Modified: trunk/common/src/main/org/jboss/portal/common/test/junit/JUnitAdapter.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/test/junit/JUnitAdapter.java 2006-10-30 13:49:00 UTC (rev 5513)
+++ trunk/common/src/main/org/jboss/portal/common/test/junit/JUnitAdapter.java 2006-10-30 15:33:10 UTC (rev 5514)
@@ -26,7 +26,8 @@
import junit.framework.TestCase;
import junit.framework.AssertionFailedError;
import org.jboss.portal.common.test.TestParametrization;
-import org.jboss.portal.common.test.MonoValuedTestParameter;
+import org.jboss.portal.common.test.MonoValuedTestParameterValue;
+import org.jboss.portal.common.test.MultiValuedTestParameterValue;
import org.jboss.portal.common.test.info.TestInfo;
import org.jboss.portal.common.test.info.TestItemInfo;
import org.jboss.portal.common.test.driver.TestDriver;
@@ -131,7 +132,7 @@
info.visit(visitor);
}
- public static Map getParameterMap() throws Exception
+ public static Map getParameterMap()
{
Map parameterMap = TestParameter.readExternalParameters();
if (parameterMap == null)
@@ -145,8 +146,19 @@
{
Map.Entry entry = (Map.Entry)i.next();
String parameterName = (String)entry.getKey();
- String parameterValue = (String)entry.getValue();
- tmp.put(parameterName, new MonoValuedTestParameter(parameterValue));
+ String[] parameterValue = (String[])entry.getValue();
+ if (parameterValue.length == 0)
+ {
+ // Should not be possible
+ }
+ else if (parameterValue.length == 1)
+ {
+ tmp.put(parameterName, new MonoValuedTestParameterValue(parameterValue[0]));
+ }
+ else
+ {
+ tmp.put(parameterName, new MultiValuedTestParameterValue(parameterValue));
+ }
}
parameterMap = tmp;
}
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 2006-10-30 13:49:00 UTC (rev 5513)
+++ trunk/common/src/main/org/jboss/portal/common/test/junit/POJOJUnitTest.java 2006-10-30 15:33:10 UTC (rev 5514)
@@ -111,10 +111,14 @@
{
StartTestCommand start = (StartTestCommand)command;
+ //
+ Object test = null;
+
+ //
try
{
// Reuse instance already provided if it exists otherwise instantiate it from class
- Object test = this.test;
+ test = this.test;
if (test == null)
{
test = testClass.newInstance();
@@ -228,8 +232,7 @@
}
else if (methodName.startsWith("set") &&
methodName.endsWith("Parameter") &&
- method.getParameterTypes().length == 1 &&
- String.class.equals(method.getParameterTypes()[0]))
+ method.getParameterTypes().length == 1)
{
String parameterName = methodName.substring(3, methodName.length() - 9);
setterMap.put(parameterName, method);
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-10-30 13:49:00 UTC (rev 5513)
+++ trunk/core/src/main/org/jboss/portal/test/core/model/instance/InstanceContainerTestCase.java 2006-10-30 15:33:10 UTC (rev 5514)
@@ -38,12 +38,11 @@
import org.apache.log4j.SimpleLayout;
import org.hibernate.Session;
import org.jboss.portal.Mode;
-import org.jboss.portal.common.junit.TestBuilder;
import org.jboss.portal.common.junit.TransactionAssert;
-import org.jboss.portal.common.junit.metadata.TestCaseMetaData;
-import org.jboss.portal.common.junit.metadata.TestCaseParameterMetaData;
import org.jboss.portal.common.util.CollectionBuilder;
import org.jboss.portal.common.value.StringValue;
+import org.jboss.portal.common.test.junit.POJOJUnitTest;
+import org.jboss.portal.common.test.junit.JUnitAdapter;
import org.jboss.portal.core.impl.model.instance.InstanceCustomizationImpl;
import org.jboss.portal.core.impl.model.instance.InstanceDefinitionImpl;
import org.jboss.portal.core.impl.model.instance.PersistentInstanceContainer;
@@ -78,6 +77,7 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.HashMap;
/**
* Test Case that tests the authorization for instances via the instance container
@@ -103,11 +103,18 @@
public static TestSuite suite() throws Exception
{
+
+ Map parameterMap = JUnitAdapter.getParameterMap();
+
+// dataSourceConfigParameter = (DataSourceSupport.Config)parametrization.get("DataSourceConfig");
+// persistLocallyParameter = Boolean.valueOf((String)parametrization.get("PersistLocally")).booleanValue();
+// cloneOnCreateParameter = Boolean.valueOf((String)parametrization.get("CloneOnCreate")).booleanValue();
URL configsURL = Thread.currentThread().getContextClassLoader().getResource("datasources.xml");
- TestCaseMetaData testCaseMD = new TestCaseMetaData();
- testCaseMD.bindParameter(new TestCaseParameterMetaData("DataSourceConfig"), DataSourceSupport.Config.fromXML2(configsURL));
- testCaseMD.bindExternalParameters();
- TestSuite suite = TestBuilder.createTestSuite(testCaseMD, InstanceContainerTestCase.class);
+ parameterMap.put("DataSourceConfig", DataSourceSupport.Config.fromXML2(configsURL));
+ POJOJUnitTest abc = new POJOJUnitTest(InstanceContainerTestCase.class);
+ JUnitAdapter adapter = new JUnitAdapter(abc, parameterMap);
+ TestSuite suite = new TestSuite();
+ suite.addTest(adapter);
return suite;
}
@@ -148,13 +155,6 @@
}
}
- public InstanceContainerTestCase(Map parametrization)
- {
- dataSourceConfig = (DataSourceSupport.Config)parametrization.get("DataSourceConfig");
- persistLocally = Boolean.valueOf((String)parametrization.get("PersistLocally")).booleanValue();
- cloneOnCreate = Boolean.valueOf((String)parametrization.get("CloneOnCreate")).booleanValue();
- }
-
/** . */
private boolean persistLocally;
@@ -162,10 +162,10 @@
private boolean cloneOnCreate;
/** . */
- private TestRuntimeContext runtimeContext;
+ private DataSourceSupport.Config dataSourceConfigParameter;
/** . */
- private DataSourceSupport.Config dataSourceConfig;
+ private TestRuntimeContext runtimeContext;
/** . */
private HibernateSupport instanceHibernateSupport;
@@ -187,24 +187,59 @@
public String getName()
{
- return super.getName() + ",persistLocally=" + persistLocally + ",cloneOnCreate=" + cloneOnCreate + ",ds=" + dataSourceConfig.getDisplayName();
+ return super.getName() + ",persistLocally=" + persistLocally + ",cloneOnCreate=" + cloneOnCreate + ",ds=" + dataSourceConfigParameter.getDisplayName();
}
- public boolean getCloneOnCreate()
+ public String getPersistLocallyParameter()
{
- return cloneOnCreate;
+ return Boolean.toString(persistLocally);
}
- public boolean getPersistLocally()
+ public void setPersistLocallyParameter(String persistLocallyParameter)
{
+ this.persistLocally = Boolean.valueOf(persistLocallyParameter).booleanValue();
+ }
+
+ public String getCloneOnCreateParameter()
+ {
+ return Boolean.toString(cloneOnCreate);
+ }
+
+ public void setCloneOnCreateParameter(String cloneOnCreateParameter)
+ {
+ this.cloneOnCreate = Boolean.valueOf(cloneOnCreateParameter).booleanValue();
+ }
+
+ public DataSourceSupport.Config getDataSourceConfigParameter()
+ {
+ return dataSourceConfigParameter;
+ }
+
+ public void setDataSourceConfigParameter(DataSourceSupport.Config dataSourceConfigParameter)
+ {
+ this.dataSourceConfigParameter = dataSourceConfigParameter;
+ }
+
+ public boolean isPersistLocally()
+ {
return persistLocally;
}
- public DataSourceSupport.Config getDataSourceConfig()
+ public boolean isCloneOnCreate()
{
- return dataSourceConfig;
+ return cloneOnCreate;
}
+ public TestRuntimeContext getRuntimeContext()
+ {
+ return runtimeContext;
+ }
+
+ public void setRuntimeContext(TestRuntimeContext runtimeContext)
+ {
+ this.runtimeContext = runtimeContext;
+ }
+
public HibernateSupport getInstanceHibernateSupport()
{
return instanceHibernateSupport;
@@ -265,17 +300,17 @@
this.portletContainer = portletContainer;
}
- protected void setUp() throws Exception
+ public void setUp() throws Exception
{
//
runtimeContext = new TestRuntimeContext("org/jboss/portal/test/core/model/instance/jboss-beans.xml");
runtimeContext.addBean("TestCaseConfig", this);
runtimeContext.addBean("TestBean", this);
- runtimeContext.addBean("DataSourceConfig", dataSourceConfig);
+ runtimeContext.addBean("DataSourceConfig", dataSourceConfigParameter);
runtimeContext.start();
}
- protected void tearDown() throws Exception
+ public void tearDown() throws Exception
{
// Cleanup any pending transaction
TransactionAssert.endTransaction();
Modified: trunk/identity/build.xml
===================================================================
--- trunk/identity/build.xml 2006-10-30 13:49:00 UTC (rev 5513)
+++ trunk/identity/build.xml 2006-10-30 15:33:10 UTC (rev 5514)
@@ -222,6 +222,12 @@
<execute-tests>
+<!--
+ <x-sysproperty>
+ <jvmarg value="-Xdebug"/>
+ <jvmarg value="-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y"/>
+ </x-sysproperty>
+-->
<x-test>
<test todir="${test.reports}" name="org.jboss.portal.test.identity.DBUserTestCase"/>
</x-test>
Modified: trunk/identity/src/main/org/jboss/portal/test/identity/DBUserTestCase.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/test/identity/DBUserTestCase.java 2006-10-30 13:49:00 UTC (rev 5513)
+++ trunk/identity/src/main/org/jboss/portal/test/identity/DBUserTestCase.java 2006-10-30 15:33:10 UTC (rev 5514)
@@ -28,9 +28,8 @@
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.apache.log4j.SimpleLayout;
-import org.jboss.portal.common.junit.TestBuilder;
-import org.jboss.portal.common.junit.metadata.TestCaseMetaData;
-import org.jboss.portal.common.junit.metadata.TestCaseParameterMetaData;
+import org.jboss.portal.common.test.junit.POJOJUnitTest;
+import org.jboss.portal.common.test.junit.JUnitAdapter;
import org.jboss.portal.common.p3p.P3PConstants;
import org.jboss.portal.identity.ProfileMap;
import org.jboss.portal.identity.User;
@@ -44,6 +43,7 @@
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;
+import java.util.HashMap;
/**
* @author <a href="mailto:julien at jboss.org">Julien Viet</a>
@@ -52,15 +52,6 @@
public class DBUserTestCase extends junit.framework.TestCase implements UserTest.Context
{
- public static TestSuite suite() throws Exception
- {
- URL configsURL = Thread.currentThread().getContextClassLoader().getResource("datasources.xml");
- TestCaseMetaData testCaseMD = new TestCaseMetaData();
- testCaseMD.bindParameter(new TestCaseParameterMetaData("DataSourceConfig"), DataSourceSupport.Config.fromXML2(configsURL));
- TestSuite suite = TestBuilder.createTestSuite(testCaseMD, DBUserTestCase.class);
- return suite;
- }
-
static
{
Appender appender = new ConsoleAppender(new SimpleLayout());
@@ -69,12 +60,22 @@
Logger.getLogger("org.hibernate").setLevel(Level.ERROR);
}
- public DBUserTestCase(Map parametrization)
+ public static TestSuite suite() throws Exception
{
- dsCfg = (DataSourceSupport.Config)parametrization.get("DataSourceConfig");
+ URL configsURL = Thread.currentThread().getContextClassLoader().getResource("datasources.xml");
+ Map parameterMap = new HashMap();
+ parameterMap.put("DataSourceConfig", DataSourceSupport.Config.fromXML2(configsURL));
+ POJOJUnitTest abc = new POJOJUnitTest(DBUserTestCase.class);
+ JUnitAdapter adapter = new JUnitAdapter(abc, parameterMap);
+ TestSuite suite = new TestSuite();
+ suite.addTest(adapter);
+ return suite;
}
/** . */
+ private DataSourceSupport.Config dataSourceConfigParameter;
+
+ /** . */
private TestRuntimeContext runtimeContext;
/** . */
@@ -89,12 +90,14 @@
/** . */
private DBRoleModuleImpl roleModule;
- /** . */
- private DataSourceSupport.Config dsCfg;
+ public DataSourceSupport.Config getDataSourceConfigParameter()
+ {
+ return dataSourceConfigParameter;
+ }
- public DBUserTestCase(DataSourceSupport.Config dsCfg)
+ public void setDataSourceConfigParameter(DataSourceSupport.Config dataSourceConfig)
{
- this.dsCfg = dsCfg;
+ this.dataSourceConfigParameter = dataSourceConfig;
}
public HibernateSupport getHibernate()
@@ -109,14 +112,14 @@
public String getName()
{
- return super.getName() + "," + dsCfg.getDisplayName();
+ return super.getName() + "," + dataSourceConfigParameter.getDisplayName();
}
- protected void setUp() throws Exception
+ public void setUp() throws Exception
{
runtimeContext = new TestRuntimeContext("org/jboss/portal/test/identity/db-beans.xml");
runtimeContext.addBean("DBTestBean", this);
- runtimeContext.addBean("DataSourceConfig", dsCfg);
+ runtimeContext.addBean("DataSourceConfig", dataSourceConfigParameter);
runtimeContext.start();
//
@@ -137,7 +140,7 @@
utc.populate();
}
- protected void tearDown() throws Exception
+ public void tearDown() throws Exception
{
utc.setUserModule(null);
utc.setRoleModule(null);
Modified: trunk/identity/src/main/org/jboss/portal/test/identity/LDAPMembershipStrategyTestCase.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/test/identity/LDAPMembershipStrategyTestCase.java 2006-10-30 13:49:00 UTC (rev 5513)
+++ trunk/identity/src/main/org/jboss/portal/test/identity/LDAPMembershipStrategyTestCase.java 2006-10-30 15:33:10 UTC (rev 5514)
@@ -22,18 +22,12 @@
******************************************************************************/
package org.jboss.portal.test.identity;
-import java.util.Map;
-
/**
* @author <a href="mailto:boleslaw.dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
* @version $Revision: 1.1 $
*/
public abstract class LDAPMembershipStrategyTestCase extends LDAPTestCase
{
- public LDAPMembershipStrategyTestCase(Map parametrization)
- {
- super(parametrization);
- }
/** . */
protected MembershipStrategyTest mstc;
Modified: trunk/identity/src/main/org/jboss/portal/test/identity/LDAPSimpleRoleModuleTestCase.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/test/identity/LDAPSimpleRoleModuleTestCase.java 2006-10-30 13:49:00 UTC (rev 5513)
+++ trunk/identity/src/main/org/jboss/portal/test/identity/LDAPSimpleRoleModuleTestCase.java 2006-10-30 15:33:10 UTC (rev 5514)
@@ -23,18 +23,11 @@
package org.jboss.portal.test.identity;
import junit.framework.TestSuite;
-import org.jboss.portal.common.junit.TestBuilder;
-import org.jboss.portal.common.junit.metadata.TestCaseMetaData;
-import org.jboss.portal.common.junit.metadata.TestCaseParameterMetaData;
import org.jboss.portal.identity2.RoleModule;
import org.jboss.portal.identity2.ldap.LDAPRoleImpl;
import org.jboss.portal.identity2.ldap.LDAPRoleModuleImpl;
import org.jboss.portal.test.framework.TestRuntimeContext;
-import org.jboss.portal.test.framework.embedded.DSConfig;
-import java.net.URL;
-import java.util.Map;
-
/**
* @author <a href="mailto:boleslaw.dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
* @version $Revision: 1.1 $
@@ -45,18 +38,9 @@
public static TestSuite suite() throws Exception
{
- URL configsURL = Thread.currentThread().getContextClassLoader().getResource("directories.xml");
- TestCaseMetaData testCaseMD = new TestCaseMetaData();
- testCaseMD.bindParameter(new TestCaseParameterMetaData("DirectoryServerConfig"), DSConfig.fromXML2(configsURL));
- TestSuite suite = TestBuilder.createTestSuite(testCaseMD, LDAPSimpleRoleModuleTestCase.class);
- return suite;
+ return createTestSuite(LDAPSimpleRoleModuleTestCase.class);
}
- public LDAPSimpleRoleModuleTestCase(Map parametrization)
- {
- super(parametrization);
- }
-
RoleModule roleModule;
protected void setUp() throws Exception
Modified: trunk/identity/src/main/org/jboss/portal/test/identity/LDAPSimpleUserModuleTestCase.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/test/identity/LDAPSimpleUserModuleTestCase.java 2006-10-30 13:49:00 UTC (rev 5513)
+++ trunk/identity/src/main/org/jboss/portal/test/identity/LDAPSimpleUserModuleTestCase.java 2006-10-30 15:33:10 UTC (rev 5514)
@@ -23,18 +23,11 @@
package org.jboss.portal.test.identity;
import junit.framework.TestSuite;
-import org.jboss.portal.common.junit.TestBuilder;
-import org.jboss.portal.common.junit.metadata.TestCaseMetaData;
-import org.jboss.portal.common.junit.metadata.TestCaseParameterMetaData;
import org.jboss.portal.identity2.UserModule;
import org.jboss.portal.identity2.ldap.LDAPUserImpl;
import org.jboss.portal.identity2.ldap.LDAPUserModuleImpl;
import org.jboss.portal.test.framework.TestRuntimeContext;
-import org.jboss.portal.test.framework.embedded.DSConfig;
-import java.net.URL;
-import java.util.Map;
-
/**
* @author <a href="mailto:boleslaw.dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
* @version $Revision: 1.1 $
@@ -45,18 +38,9 @@
public static TestSuite suite() throws Exception
{
- URL configsURL = Thread.currentThread().getContextClassLoader().getResource("directories.xml");
- TestCaseMetaData testCaseMD = new TestCaseMetaData();
- testCaseMD.bindParameter(new TestCaseParameterMetaData("DirectoryServerConfig"), DSConfig.fromXML2(configsURL));
- TestSuite suite = TestBuilder.createTestSuite(testCaseMD, LDAPSimpleUserModuleTestCase.class);
- return suite;
+ return createTestSuite(LDAPSimpleUserModuleTestCase.class);
}
- public LDAPSimpleUserModuleTestCase(Map parametrization)
- {
- super(parametrization);
- }
-
UserModule userModule;
protected void setUp() throws Exception
Modified: trunk/identity/src/main/org/jboss/portal/test/identity/LDAPStaticGroupStrategyTestCase.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/test/identity/LDAPStaticGroupStrategyTestCase.java 2006-10-30 13:49:00 UTC (rev 5513)
+++ trunk/identity/src/main/org/jboss/portal/test/identity/LDAPStaticGroupStrategyTestCase.java 2006-10-30 15:33:10 UTC (rev 5514)
@@ -23,16 +23,9 @@
package org.jboss.portal.test.identity;
import junit.framework.TestSuite;
-import org.jboss.portal.common.junit.TestBuilder;
-import org.jboss.portal.common.junit.metadata.TestCaseMetaData;
-import org.jboss.portal.common.junit.metadata.TestCaseParameterMetaData;
import org.jboss.portal.identity2.ldap.StaticGroupLDAPMembershipStrategyImpl;
import org.jboss.portal.test.framework.TestRuntimeContext;
-import org.jboss.portal.test.framework.embedded.DSConfig;
-import java.net.URL;
-import java.util.Map;
-
/**
* @author <a href="mailto:boleslaw.dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
* @version $Revision: 1.1 $
@@ -44,18 +37,9 @@
public static TestSuite suite() throws Exception
{
- URL configsURL = Thread.currentThread().getContextClassLoader().getResource("directories.xml");
- TestCaseMetaData testCaseMD = new TestCaseMetaData();
- testCaseMD.bindParameter(new TestCaseParameterMetaData("DirectoryServerConfig"), DSConfig.fromXML2(configsURL));
- TestSuite suite = TestBuilder.createTestSuite(testCaseMD, LDAPStaticGroupStrategyTestCase.class);
- return suite;
+ return createTestSuite(LDAPStaticGroupStrategyTestCase.class);
}
- public LDAPStaticGroupStrategyTestCase(Map parametrization)
- {
- super(parametrization);
- }
-
protected void setUp() throws Exception
{
runtimeContext = new TestRuntimeContext("org/jboss/portal/test/identity/ldap-beans.xml");
Modified: trunk/identity/src/main/org/jboss/portal/test/identity/LDAPStaticRoleStrategyTestCase.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/test/identity/LDAPStaticRoleStrategyTestCase.java 2006-10-30 13:49:00 UTC (rev 5513)
+++ trunk/identity/src/main/org/jboss/portal/test/identity/LDAPStaticRoleStrategyTestCase.java 2006-10-30 15:33:10 UTC (rev 5514)
@@ -23,16 +23,9 @@
package org.jboss.portal.test.identity;
import junit.framework.TestSuite;
-import org.jboss.portal.common.junit.TestBuilder;
-import org.jboss.portal.common.junit.metadata.TestCaseMetaData;
-import org.jboss.portal.common.junit.metadata.TestCaseParameterMetaData;
import org.jboss.portal.identity2.ldap.StaticRoleLDAPMembershipStrategyImpl;
import org.jboss.portal.test.framework.TestRuntimeContext;
-import org.jboss.portal.test.framework.embedded.DSConfig;
-import java.net.URL;
-import java.util.Map;
-
/**
* @author <a href="mailto:boleslaw.dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
* @version $Revision: 1.1 $
@@ -44,18 +37,9 @@
public static TestSuite suite() throws Exception
{
- URL configsURL = Thread.currentThread().getContextClassLoader().getResource("directories.xml");
- TestCaseMetaData testCaseMD = new TestCaseMetaData();
- testCaseMD.bindParameter(new TestCaseParameterMetaData("DirectoryServerConfig"), DSConfig.fromXML2(configsURL));
- TestSuite suite = TestBuilder.createTestSuite(testCaseMD, LDAPStaticRoleStrategyTestCase.class);
- return suite;
+ return createTestSuite(LDAPStaticRoleStrategyTestCase.class);
}
- public LDAPStaticRoleStrategyTestCase(Map parametrization)
- {
- super(parametrization);
- }
-
protected void setUp() throws Exception
{
runtimeContext = new TestRuntimeContext("org/jboss/portal/test/identity/ldap-beans.xml");
Modified: trunk/identity/src/main/org/jboss/portal/test/identity/LDAPTestCase.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/test/identity/LDAPTestCase.java 2006-10-30 13:49:00 UTC (rev 5513)
+++ trunk/identity/src/main/org/jboss/portal/test/identity/LDAPTestCase.java 2006-10-30 15:33:10 UTC (rev 5514)
@@ -31,6 +31,8 @@
import org.jboss.portal.identity2.ldap.LDAPConnectionContext;
import org.jboss.portal.test.framework.TestRuntimeContext;
import org.jboss.portal.test.framework.embedded.DSConfig;
+import org.jboss.portal.common.test.junit.JUnitAdapter;
+import org.jboss.portal.common.test.junit.POJOJUnitTest;
import javax.naming.Binding;
import javax.naming.Context;
@@ -40,7 +42,10 @@
import java.net.URL;
import java.util.Hashtable;
import java.util.Map;
+import java.util.HashMap;
+import junit.framework.TestSuite;
+
/**
* @author <a href="mailto:julien at jboss.org">Julien Viet</a>
* @author <a href="mailto:boleslaw dot dawidowicz at jboss dot com">Boleslaw Dawidowicz</a>
@@ -59,31 +64,48 @@
Logger.getLogger("org.jboss.portal.identity2.ldap").setLevel(Level.DEBUG);
}
- public LDAPTestCase()
+ public static TestSuite createTestSuite(Class clazz) throws Exception
{
-
+ URL configsURL = Thread.currentThread().getContextClassLoader().getResource("directories.xml");
+ Map parameterMap = new HashMap();
+ parameterMap.put("DirectoryServerConfig", DSConfig.fromXML2(configsURL));
+ POJOJUnitTest abc = new POJOJUnitTest(clazz);
+ JUnitAdapter adapter = new JUnitAdapter(abc, parameterMap);
+ TestSuite suite = new TestSuite();
+ suite.addTest(adapter);
+ return suite;
}
- public LDAPTestCase(Map parametrization)
+ public LDAPTestCase()
{
- dsConfig = (DSConfig)parametrization.get("DirectoryServerConfig");
+
}
public LDAPTestCase(DSConfig dsConfig)
{
- this.dsConfig = dsConfig;
+ this.directoryServerConfigParameter = dsConfig;
}
protected TestRuntimeContext runtimeContext;
- private DSConfig dsConfig;
+ private DSConfig directoryServerConfigParameter;
public String getName()
{
- return super.getName() + "," + dsConfig.getName() + "," + dsConfig.getDescription();
+ return super.getName() + "," + directoryServerConfigParameter.getName() + "," + directoryServerConfigParameter.getDescription();
}
+ public DSConfig getDirectoryServerConfigParameter()
+ {
+ return directoryServerConfigParameter;
+ }
+
+ public void setDirectoryServerConfigParameter(DSConfig directoryServerConfigParameter)
+ {
+ this.directoryServerConfigParameter = directoryServerConfigParameter;
+ }
+
protected void setUp() throws Exception
{
runtimeContext.start();
@@ -153,11 +175,11 @@
protected DirContext getDirContext() throws Exception
{
Hashtable env = new Hashtable();
- env.put(Context.INITIAL_CONTEXT_FACTORY, dsConfig.getContextFactory());
- env.put(Context.PROVIDER_URL, dsConfig.getProviderUrl());
+ env.put(Context.INITIAL_CONTEXT_FACTORY, directoryServerConfigParameter.getContextFactory());
+ env.put(Context.PROVIDER_URL, directoryServerConfigParameter.getProviderUrl());
env.put(Context.SECURITY_AUTHENTICATION, "simple");
- env.put(Context.SECURITY_PRINCIPAL, dsConfig.getAdminDN());
- env.put(Context.SECURITY_CREDENTIALS, dsConfig.getAdminPassword());
+ env.put(Context.SECURITY_PRINCIPAL, directoryServerConfigParameter.getAdminDN());
+ env.put(Context.SECURITY_CREDENTIALS, directoryServerConfigParameter.getAdminPassword());
return new InitialDirContext(env);
}
@@ -180,11 +202,11 @@
public LDAPConnectionContext createConnectionContext()
{
- return new LDAPConnectionContext(dsConfig.getName(),
- dsConfig.getProviderUrl(),
- dsConfig.getContextFactory(),
- dsConfig.getAdminDN(),
- dsConfig.getAdminPassword(),
+ return new LDAPConnectionContext(directoryServerConfigParameter.getName(),
+ directoryServerConfigParameter.getProviderUrl(),
+ directoryServerConfigParameter.getContextFactory(),
+ directoryServerConfigParameter.getAdminDN(),
+ directoryServerConfigParameter.getAdminPassword(),
null,
"simple");
}
Modified: trunk/identity/src/main/org/jboss/portal/test/identity/LDAPUserTestCase.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/test/identity/LDAPUserTestCase.java 2006-10-30 13:49:00 UTC (rev 5513)
+++ trunk/identity/src/main/org/jboss/portal/test/identity/LDAPUserTestCase.java 2006-10-30 15:33:10 UTC (rev 5514)
@@ -29,9 +29,8 @@
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.apache.log4j.SimpleLayout;
-import org.jboss.portal.common.junit.TestBuilder;
-import org.jboss.portal.common.junit.metadata.TestCaseMetaData;
-import org.jboss.portal.common.junit.metadata.TestCaseParameterMetaData;
+import org.jboss.portal.common.test.junit.POJOJUnitTest;
+import org.jboss.portal.common.test.junit.JUnitAdapter;
import org.jboss.portal.test.framework.TestRuntimeContext;
import org.jboss.portal.test.framework.embedded.DSConfig;
@@ -43,6 +42,7 @@
import java.net.URL;
import java.util.Hashtable;
import java.util.Map;
+import java.util.HashMap;
/**
* @author <a href="mailto:julien at jboss.org">Julien Viet</a>
@@ -57,9 +57,12 @@
public static TestSuite suite() throws Exception
{
URL configsURL = Thread.currentThread().getContextClassLoader().getResource("directories.xml");
- TestCaseMetaData testCaseMD = new TestCaseMetaData();
- testCaseMD.bindParameter(new TestCaseParameterMetaData("DirectoryServerConfig"), DSConfig.fromXML2(configsURL));
- TestSuite suite = TestBuilder.createTestSuite(testCaseMD, LDAPUserTestCase.class);
+ Map parameterMap = new HashMap();
+ parameterMap.put("DirectoryServerConfig", DSConfig.fromXML2(configsURL));
+ POJOJUnitTest abc = new POJOJUnitTest(LDAPUserTestCase.class);
+ JUnitAdapter adapter = new JUnitAdapter(abc, parameterMap);
+ TestSuite suite = new TestSuite();
+ suite.addTest(adapter);
return suite;
}
@@ -70,36 +73,36 @@
Logger.getRoot().setLevel(Level.INFO);
}
- public LDAPUserTestCase()
- {
+ /** . */
+ private TestRuntimeContext runtimeContext;
- }
+ /** . */
+ private DSConfig directoryServerConfigParameter;
- public LDAPUserTestCase(Map parametrization)
+ /** . */
+ private UserTest utc;
+
+ /** . */
+ //private DBUserModuleImpl userModule;
+
+ public DSConfig getDirectoryServerConfigParameter()
{
- dsConfig = (DSConfig)parametrization.get("DirectoryServerConfig");
+ return directoryServerConfigParameter;
}
- public LDAPUserTestCase(DSConfig dsConfig)
+ public void setDirectoryServerConfigParameter(DSConfig directoryServerConfigParameter)
{
- this.dsConfig = dsConfig;
+ this.directoryServerConfigParameter = directoryServerConfigParameter;
}
- private TestRuntimeContext runtimeContext;
+ /** . */
+ //private DBRoleModuleImpl roleModule;
- private DSConfig dsConfig;
- /** . */
- private UserTest utc;
- /** . */
- //private DBUserModuleImpl userModule;
-
- /** . */
- //private DBRoleModuleImpl roleModule;
public String getName()
{
- return super.getName() + "," + dsConfig.getName() + "," + dsConfig.getDescription();
+ return super.getName() + "," + directoryServerConfigParameter.getName() + "," + directoryServerConfigParameter.getDescription();
}
protected void setUp() throws Exception
@@ -381,11 +384,11 @@
private DirContext getDirContext() throws Exception
{
Hashtable env = new Hashtable();
- env.put(Context.INITIAL_CONTEXT_FACTORY, dsConfig.getContextFactory());
- env.put(Context.PROVIDER_URL, dsConfig.getProviderUrl());
+ env.put(Context.INITIAL_CONTEXT_FACTORY, directoryServerConfigParameter.getContextFactory());
+ env.put(Context.PROVIDER_URL, directoryServerConfigParameter.getProviderUrl());
env.put(Context.SECURITY_AUTHENTICATION, "simple");
- env.put(Context.SECURITY_PRINCIPAL, dsConfig.getAdminDN());
- env.put(Context.SECURITY_CREDENTIALS, dsConfig.getAdminPassword());
+ env.put(Context.SECURITY_PRINCIPAL, directoryServerConfigParameter.getAdminDN());
+ env.put(Context.SECURITY_CREDENTIALS, directoryServerConfigParameter.getAdminPassword());
return new InitialDirContext(env);
}
Modified: trunk/server/src/main/org/jboss/portal/test/server/ServerTestRunner.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/test/server/ServerTestRunner.java 2006-10-30 13:49:00 UTC (rev 5513)
+++ trunk/server/src/main/org/jboss/portal/test/server/ServerTestRunner.java 2006-10-30 15:33:10 UTC (rev 5514)
@@ -25,6 +25,8 @@
import org.jboss.portal.test.framework.runner.BaseRunner;
import org.jboss.portal.test.framework.server.NodeId;
import org.jboss.portal.common.junit.ant.TestParameter;
+import org.jboss.portal.common.test.TestParameterValue;
+import org.jboss.portal.common.test.junit.JUnitAdapter;
import junit.framework.TestSuite;
import junit.framework.AssertionFailedError;
@@ -41,8 +43,8 @@
public ServerTestRunner()
{
- Map abc = TestParameter.readExternalParameters();
- archiveName = ((String[])abc.get("archive"))[0];
+ Map abc = JUnitAdapter.getParameterMap();
+ archiveName = (String)((TestParameterValue)abc.get("archive")).get();
}
public ServerTestRunner(String archiveName)
Modified: trunk/test/src/main/org/jboss/portal/test/framework/embedded/DSConfig.java
===================================================================
--- trunk/test/src/main/org/jboss/portal/test/framework/embedded/DSConfig.java 2006-10-30 13:49:00 UTC (rev 5513)
+++ trunk/test/src/main/org/jboss/portal/test/framework/embedded/DSConfig.java 2006-10-30 15:33:10 UTC (rev 5514)
@@ -23,9 +23,9 @@
package org.jboss.portal.test.framework.embedded;
-import org.jboss.portal.common.junit.metadata.TestCaseParameterIterableValue;
import org.jboss.portal.common.util.Tools;
import org.jboss.portal.common.util.XML;
+import org.jboss.portal.common.test.MultiValuedTestParameterValue;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -67,11 +67,11 @@
this.adminPassword = adminPass;
}
- public static TestCaseParameterIterableValue fromXML2(URL url) throws Exception
+ public static MultiValuedTestParameterValue fromXML2(URL url) throws Exception
{
DSConfig[] configs = fromXML(url);
List list = Arrays.asList(configs);
- return new TestCaseParameterIterableValue(list);
+ return new MultiValuedTestParameterValue(list);
}
public static DSConfig[] fromXML(URL url) throws Exception
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-10-30 13:49:00 UTC (rev 5513)
+++ trunk/test/src/main/org/jboss/portal/test/framework/embedded/DataSourceSupport.java 2006-10-30 15:33:10 UTC (rev 5514)
@@ -23,9 +23,9 @@
package org.jboss.portal.test.framework.embedded;
-import org.jboss.portal.common.junit.metadata.TestCaseParameterIterableValue;
import org.jboss.portal.common.util.Tools;
import org.jboss.portal.common.util.XML;
+import org.jboss.portal.common.test.MultiValuedTestParameterValue;
import org.jboss.resource.adapter.jdbc.local.LocalTxDataSource;
import org.jboss.resource.connectionmanager.CachedConnectionManagerReference;
import org.w3c.dom.Document;
@@ -249,11 +249,11 @@
return password;
}
- public static TestCaseParameterIterableValue fromXML2(URL url) throws Exception
+ public static MultiValuedTestParameterValue fromXML2(URL url) throws Exception
{
Config[] configs = fromXML(url);
List list = Arrays.asList(configs);
- return new TestCaseParameterIterableValue(list);
+ return new MultiValuedTestParameterValue(list);
}
public static Config[] fromXML(URL url) throws Exception
Modified: trunk/tools/lib/explode.jar
===================================================================
(Binary files differ)
More information about the jboss-svn-commits
mailing list