[jboss-svn-commits] JBoss Portal SVN: r5525 - in trunk: common common/src/main/org/jboss/portal/common/test common/src/main/org/jboss/portal/common/test/junit common/src/main/org/jboss/portal/test/common common/src/main/org/jboss/portal/test/common/test core/src/main/org/jboss/portal/test/core/model/instance server/src/main/org/jboss/portal/test/server
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Oct 31 08:55:06 EST 2006
Author: julien at jboss.com
Date: 2006-10-31 08:54:54 -0500 (Tue, 31 Oct 2006)
New Revision: 5525
Added:
trunk/common/src/main/org/jboss/portal/test/common/test/
trunk/common/src/main/org/jboss/portal/test/common/test/InfoTestCase.java
trunk/common/src/main/org/jboss/portal/test/common/test/TestParameterValueTestCase.java
trunk/common/src/main/org/jboss/portal/test/common/test/TestParametrizationTestCase.java
Modified:
trunk/common/build.xml
trunk/common/src/main/org/jboss/portal/common/test/TestParameterValue.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/server/src/main/org/jboss/portal/test/server/ServerTestRunner.java
Log:
- test case for test framework
- minor improvement of TestParametrization
Modified: trunk/common/build.xml
===================================================================
--- trunk/common/build.xml 2006-10-31 11:54:06 UTC (rev 5524)
+++ trunk/common/build.xml 2006-10-31 13:54:54 UTC (rev 5525)
@@ -192,13 +192,19 @@
<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.common.test.InfoTestCase"/>
+ <test todir="${test.reports}" name="org.jboss.portal.test.common.test.TestParameterValueTestCase"/>
+ <test todir="${test.reports}" name="org.jboss.portal.test.common.test.TestParametrizationTestCase"/>
+<!--
<test todir="${test.reports}" name="org.jboss.portal.test.common.AbstractInvocationContextTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.common.LocaleInfoTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.common.ParentChildResourceBundleTestCase"/>
@@ -217,6 +223,7 @@
<test todir="${test.reports}" name="org.jboss.portal.test.common.ImplodeTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.common.Application_XWWWFormURLEncodedFormatTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.common.BufferedStreamTestCase"/>
+-->
</x-test>
<x-classpath>
<pathelement location="${build.classes}"/>
Modified: trunk/common/src/main/org/jboss/portal/common/test/TestParameterValue.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/test/TestParameterValue.java 2006-10-31 11:54:06 UTC (rev 5524)
+++ trunk/common/src/main/org/jboss/portal/common/test/TestParameterValue.java 2006-10-31 13:54:54 UTC (rev 5525)
@@ -38,4 +38,26 @@
* @return
*/
public abstract Object get();
+
+ public int hashCode()
+ {
+ Object o = get();
+ return o == null ? 0 : o.hashCode();
+ }
+
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+ if (obj instanceof TestParameterValue)
+ {
+ TestParameterValue that = (TestParameterValue)obj;
+ Object thisO = get();
+ Object thatO = that.get();
+ return thisO == null ? thatO == null : thisO.equals(thatO);
+ }
+ return false;
+ }
}
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-31 11:54:06 UTC (rev 5524)
+++ trunk/common/src/main/org/jboss/portal/common/test/TestParametrization.java 2006-10-31 13:54:54 UTC (rev 5525)
@@ -50,12 +50,34 @@
parameterValues = new HashMap();
}
- private TestParametrization(Map parameterValues)
+ public TestParametrization(Map parameterValues) throws IllegalArgumentException
{
- this.parameterValues = parameterValues;
+ this();
+
+ //
+ if (parameterValues == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ for (Iterator i = parameterValues.entrySet().iterator();i.hasNext();)
+ {
+ Map.Entry entry = (Map.Entry)i.next();
+ String parameterName = (String)entry.getKey();
+ TestParameterValue parameterValue = (TestParameterValue)entry.getValue();
+ setParameterValue(parameterName, parameterValue);
+ }
}
- public void setParameterValue(String parameterName, Object parameterValue)
+ /**
+ * Set a paraemeter value, using a null value will remove the parameter.
+ *
+ * @param parameterName the parameter name
+ * @param parameterValue the parameter value
+ * @throws IllegalArgumentException if the parameter name is null
+ */
+ public void setParameterValue(String parameterName, TestParameterValue parameterValue) throws IllegalArgumentException
{
if (parameterName == null)
{
@@ -71,20 +93,27 @@
}
}
- public boolean isEmpty()
+ /**
+ * Return a parameter value.
+ *
+ * @param parameterName the parameter name
+ * @return the parameter value or null if it does not exist
+ * @throws IllegalArgumentException if the parameter name is null
+ */
+ public TestParameterValue getParameterValue(String parameterName) throws IllegalArgumentException
{
- return parameterValues.isEmpty();
- }
-
- public Object getParameterValue(String parameterName)
- {
if (parameterName == null)
{
throw new IllegalArgumentException();
}
- return parameterValues.get(parameterName);
+ return (TestParameterValue)parameterValues.get(parameterName);
}
+ public boolean isEmpty()
+ {
+ return parameterValues.isEmpty();
+ }
+
public String toString()
{
StringBuffer tmp = new StringBuffer();
@@ -102,7 +131,7 @@
* Build a collection of parametrization that satisfies the parameters exposed by the test
* meta information and the parameter provided by the map.
*/
- public static Collection createParametrizations(TestInfo info, Map parameterMap)
+ public Collection create(TestInfo info)
{
ArrayList c = new ArrayList();
c.add(new HashMap());
@@ -110,7 +139,7 @@
Set expectedParameters = new HashSet(info.getParameterNames());
//
- for (Iterator i = parameterMap.entrySet().iterator(); i.hasNext();)
+ for (Iterator i = parameterValues.entrySet().iterator(); i.hasNext();)
{
Map.Entry entry = (Map.Entry)i.next();
String parameterName = (String)entry.getKey();
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-31 11:54:06 UTC (rev 5524)
+++ trunk/common/src/main/org/jboss/portal/common/test/junit/JUnitAdapter.java 2006-10-31 13:54:54 UTC (rev 5525)
@@ -57,17 +57,23 @@
private TestDriver driver;
/** . */
- private Map parameterMap;
+ private TestParametrization parametrization;
public JUnitAdapter(TestDriver test, Map parameterMap) throws Exception
{
this.driver = test;
- this.parameterMap = parameterMap;
+ this.parametrization = new TestParametrization(parameterMap);
}
+ public JUnitAdapter(TestDriver test, TestParametrization parametrization) throws Exception
+ {
+ this.driver = test;
+ this.parametrization = parametrization;
+ }
+
public JUnitAdapter(TestDriver test) throws Exception
{
- this(test, Collections.EMPTY_MAP);
+ this(test, new TestParametrization());
}
public int countTestCases()
@@ -101,7 +107,7 @@
{
public void visit(final TestInfo testInfo)
{
- Collection contexts = TestParametrization.createParametrizations(testInfo, parameterMap);
+ Collection contexts = parametrization.create(testInfo);
for (Iterator i = contexts.iterator();i.hasNext();)
{
final TestParametrization parametrization = (TestParametrization)i.next();
@@ -133,7 +139,7 @@
info.visit(visitor);
}
- public static Map getParameterMap()
+ public static TestParametrization getParametrization()
{
Map parameterMap = TestParameter.readExternalParameters();
if (parameterMap == null)
@@ -163,6 +169,6 @@
}
parameterMap = tmp;
}
- return parameterMap;
+ return new TestParametrization(parameterMap);
}
}
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-31 11:54:06 UTC (rev 5524)
+++ trunk/common/src/main/org/jboss/portal/common/test/junit/POJOJUnitTest.java 2006-10-31 13:54:54 UTC (rev 5525)
@@ -132,7 +132,7 @@
for (Iterator i = testInfo.getParameterNames().iterator();i.hasNext();)
{
String parameterName = (String)i.next();
- TestParameterValue value = (TestParameterValue)parametrization.getParameterValue(parameterName);
+ TestParameterValue value = parametrization.getParameterValue(parameterName);
if (value == null)
{
throw new ParameterNotBoundException(parameterName);
Added: trunk/common/src/main/org/jboss/portal/test/common/test/InfoTestCase.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/test/common/test/InfoTestCase.java 2006-10-31 11:54:06 UTC (rev 5524)
+++ trunk/common/src/main/org/jboss/portal/test/common/test/InfoTestCase.java 2006-10-31 13:54:54 UTC (rev 5525)
@@ -0,0 +1,179 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.common.test;
+
+import junit.framework.TestCase;
+import org.jboss.portal.common.test.info.TestContainerInfo;
+import org.jboss.portal.common.test.info.TestItemInfo;
+import org.jboss.portal.common.test.info.TestInfo;
+import org.jboss.portal.common.test.info.TestParameterInfo;
+import org.jboss.portal.common.util.CollectionBuilder;
+
+import java.util.Collections;
+import java.util.HashSet;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class InfoTestCase extends TestCase
+{
+
+ public void testTestContainerConstructor()
+ {
+ try
+ {
+ new TestContainerInfo((String)null);
+ fail("Was expecting an IAE");
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ try
+ {
+ new TestContainerInfo(null, "");
+ fail("Was expecting an IAE");
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+
+ //
+ TestContainerInfo c1 = new TestContainerInfo("foo", null);
+ assertEquals("foo", c1.getName());
+ assertEquals(null, c1.getDescription());
+ assertEquals(Collections.EMPTY_SET, c1.getChildNames());
+
+ //
+ TestContainerInfo c2 = new TestContainerInfo("foo", "bar");
+ assertEquals("foo", c2.getName());
+ assertEquals("bar", c2.getDescription());
+ assertEquals(Collections.EMPTY_SET, c2.getChildNames());
+ }
+
+ public void testTestConstructor()
+ {
+ try
+ {
+ new TestInfo((String)null);
+ fail("Was expecting an IAE");
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ try
+ {
+ new TestInfo(null, "");
+ fail("Was expecting an IAE");
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+
+ //
+ TestInfo t1 = new TestInfo("foo");
+ assertEquals("foo", t1.getName());
+ assertEquals(null, t1.getDescription());
+
+ //
+ TestInfo t2 = new TestInfo("foo", "bar");
+ assertEquals("foo", t2.getName());
+ assertEquals("bar", t2.getDescription());
+ }
+
+ public void testParameterConstructor()
+ {
+ try
+ {
+ new TestParameterInfo(null);
+ fail("Was expecting an IAE");
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ try
+ {
+ new TestInfo(null, "");
+ fail("Was expecting an IAE");
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+
+ //
+ TestParameterInfo p1 = new TestParameterInfo("foo");
+ assertEquals("foo", p1.getName());
+ assertEquals(null, p1.getDescription());
+
+ //
+ TestParameterInfo p2 = new TestParameterInfo("foo", "bar");
+ assertEquals("foo", p2.getName());
+ assertEquals("bar", p2.getDescription());
+ }
+
+ public void testTestParameters()
+ {
+ TestInfo test = new TestInfo("foo");
+ assertEquals(new HashSet(), new HashSet(test.getParameterNames()));
+
+ //
+ TestParameterInfo p1 = new TestParameterInfo("p1");
+ test.addParameter(p1);
+ assertEquals(p1, test.getParameter("p1"));
+ assertEquals(Collections.singleton("p1"), test.getParameterNames());
+
+ //
+ try
+ {
+ test.addParameter(new TestParameterInfo("p1"));
+ fail();
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ assertEquals(p1, test.getParameter("p1"));
+ assertEquals(Collections.singleton("p1"), test.getParameterNames());
+
+ //
+ TestParameterInfo p2 = new TestParameterInfo("p2");
+ test.addParameter(p2);
+ assertEquals(p1, test.getParameter("p1"));
+ assertEquals(p2, test.getParameter("p2"));
+ assertEquals(new CollectionBuilder().add("p1").add("p2").toHashSet(), test.getParameterNames());
+ }
+
+ public void testClone()
+ {
+
+ }
+
+ public void testVisitor()
+ {
+
+ }
+
+ public void testFind()
+ {
+
+ }
+}
Added: trunk/common/src/main/org/jboss/portal/test/common/test/TestParameterValueTestCase.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/test/common/test/TestParameterValueTestCase.java 2006-10-31 11:54:06 UTC (rev 5524)
+++ trunk/common/src/main/org/jboss/portal/test/common/test/TestParameterValueTestCase.java 2006-10-31 13:54:54 UTC (rev 5525)
@@ -0,0 +1,103 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.common.test;
+
+import org.jboss.portal.common.test.MonoValuedTestParameterValue;
+import org.jboss.portal.common.test.MultiValuedTestParameterValue;
+import junit.framework.TestCase;
+
+import java.util.Collection;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class TestParameterValueTestCase extends TestCase
+{
+
+ public void testMono()
+ {
+ Object o = new Object();
+ assertEquals(o, new MonoValuedTestParameterValue(o).get());
+ assertEquals(null, new MonoValuedTestParameterValue(null).get());
+
+ //
+ assertEquals(new MonoValuedTestParameterValue("abc"), new MonoValuedTestParameterValue("abc"));
+ assertEquals(new MonoValuedTestParameterValue(o), new MonoValuedTestParameterValue(o));
+ assertEquals(new MonoValuedTestParameterValue(null), new MonoValuedTestParameterValue(null));
+
+ //
+ assertFalse(new MonoValuedTestParameterValue(o).equals(new MonoValuedTestParameterValue(new Object())));
+ assertFalse(new MonoValuedTestParameterValue(o).equals(new MonoValuedTestParameterValue(null)));
+ assertFalse(new MonoValuedTestParameterValue(new Object()).equals(new MonoValuedTestParameterValue(o)));
+ assertFalse(new MonoValuedTestParameterValue(null).equals(new MonoValuedTestParameterValue(o)));
+ }
+
+ public void testMulti()
+ {
+ try
+ {
+ new MultiValuedTestParameterValue((Collection)null);
+ fail();
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ try
+ {
+ new MultiValuedTestParameterValue((Object[])null);
+ fail();
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ ArrayList toto = new ArrayList();
+ toto.add("abc");
+ toto.add("def");
+ MultiValuedTestParameterValue t = new MultiValuedTestParameterValue(toto);
+ assertEquals(toto, t.get());
+ Iterator i = t.iterator();
+ assertNotNull(i);
+ assertTrue(i.hasNext());
+ Object i0 = i.next();
+ assertNotNull(i0);
+ assertTrue(i0 instanceof MonoValuedTestParameterValue);
+ assertEquals("abc", ((MonoValuedTestParameterValue)i0).get());
+ assertTrue(i.hasNext());
+ Object i1 = i.next();
+ assertNotNull(i1);
+ assertTrue(i1 instanceof MonoValuedTestParameterValue);
+ assertEquals("def", ((MonoValuedTestParameterValue)i1).get());
+ assertFalse(i.hasNext());
+ try
+ {
+ i.next();
+ }
+ catch (NoSuchElementException expected)
+ {
+ }
+ }
+}
Added: trunk/common/src/main/org/jboss/portal/test/common/test/TestParametrizationTestCase.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/test/common/test/TestParametrizationTestCase.java 2006-10-31 11:54:06 UTC (rev 5524)
+++ trunk/common/src/main/org/jboss/portal/test/common/test/TestParametrizationTestCase.java 2006-10-31 13:54:54 UTC (rev 5525)
@@ -0,0 +1,116 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.common.test;
+
+import junit.framework.TestCase;
+import org.jboss.portal.common.test.TestParametrization;
+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.TestParameterInfo;
+import org.jboss.portal.common.util.CollectionBuilder;
+
+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 TestParametrizationTestCase extends TestCase
+{
+
+ public void testGet()
+ {
+ try
+ {
+ new TestParametrization().getParameterValue(null);
+ fail();
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ }
+
+ public void testSet()
+ {
+ try
+ {
+ new TestParametrization().setParameterValue(null, null);
+ fail();
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ try
+ {
+ new TestParametrization().setParameterValue(null, new MonoValuedTestParameterValue("abc"));
+ fail();
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ TestParametrization p = new TestParametrization();
+ MonoValuedTestParameterValue v = new MonoValuedTestParameterValue("def");
+ p.setParameterValue("abc", v);
+ assertEquals(v, p.getParameterValue("abc"));
+ p.setParameterValue("abc", null);
+ assertEquals(null, p.getParameterValue("abc"));
+ }
+
+ public void testCreate()
+ {
+ TestInfo info = new TestInfo("test");
+ info.addParameter(new TestParameterInfo("foo"));
+ info.addParameter(new TestParameterInfo("bar"));
+
+ //
+ TestParametrization p1 = new TestParametrization();
+ p1.setParameterValue("foo", new MonoValuedTestParameterValue("foo1"));
+ p1.setParameterValue("abc", new MonoValuedTestParameterValue("def"));
+ Collection c1 = p1.create(info);
+ assertNotNull(c1);
+ assertEquals(1, c1.size());
+ TestParametrization q1 = (TestParametrization)c1.iterator().next();
+ assertEquals(new MonoValuedTestParameterValue("foo1"), q1.getParameterValue("foo"));
+ assertEquals(null, q1.getParameterValue("abc"));
+
+ //
+ TestParametrization p2 = new TestParametrization();
+ p2.setParameterValue("foo", new MonoValuedTestParameterValue("foo1"));
+ p2.setParameterValue("abc", new MonoValuedTestParameterValue("def"));
+ p2.setParameterValue("bar", new MultiValuedTestParameterValue(new CollectionBuilder().add("bar1").add("bar2").toArrayList()));
+ Collection c2 = p2.create(info);
+ assertNotNull(c2);
+ assertEquals(2, c2.size());
+ Iterator i2 = c2.iterator();
+ TestParametrization q2_1 = (TestParametrization)i2.next();
+ assertEquals(new MonoValuedTestParameterValue("foo1"), q2_1.getParameterValue("foo"));
+ assertEquals(new MonoValuedTestParameterValue("bar1"), q2_1.getParameterValue("bar"));
+ assertEquals(null, q2_1.getParameterValue("abc"));
+ TestParametrization q2_2 = (TestParametrization)i2.next();
+ assertEquals(new MonoValuedTestParameterValue("foo1"), q2_2.getParameterValue("foo"));
+ assertEquals(new MonoValuedTestParameterValue("bar2"), q2_2.getParameterValue("bar"));
+ assertEquals(null, q2_2.getParameterValue("abc"));
+ }
+}
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-31 11:54:06 UTC (rev 5524)
+++ trunk/core/src/main/org/jboss/portal/test/core/model/instance/InstanceContainerTestCase.java 2006-10-31 13:54:54 UTC (rev 5525)
@@ -43,6 +43,7 @@
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.common.test.TestParametrization;
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;
@@ -77,7 +78,6 @@
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,11 @@
public static TestSuite suite() throws Exception
{
- Map parameterMap = JUnitAdapter.getParameterMap();
+ TestParametrization parametrization = JUnitAdapter.getParametrization();
URL configsURL = Thread.currentThread().getContextClassLoader().getResource("datasources.xml");
- parameterMap.put("DataSourceConfig", DataSourceSupport.Config.fromXML2(configsURL));
+ parametrization.setParameterValue("DataSourceConfig", DataSourceSupport.Config.fromXML2(configsURL));
POJOJUnitTest abc = new POJOJUnitTest(InstanceContainerTestCase.class);
- JUnitAdapter adapter = new JUnitAdapter(abc, parameterMap);
+ JUnitAdapter adapter = new JUnitAdapter(abc, parametrization);
TestSuite suite = new TestSuite();
suite.addTest(adapter);
return suite;
@@ -331,7 +331,7 @@
//
TransactionAssert.beginTransaction();
Session session = instanceHibernateSupport.getCurrentSession();
- List instances = session.createQuery("from InstanceImpl").list();
+ List instances = session.createQuery("from InstanceDefinitionImpl").list();
assertEquals(1, instances.size());
InstanceDefinitionImpl instanceImpl = (InstanceDefinitionImpl)instances.get(0);
assertEquals(true, instanceImpl.isModifiable());
@@ -354,7 +354,7 @@
//
TransactionAssert.beginTransaction();
session = instanceHibernateSupport.getCurrentSession();
- instances = session.createQuery("from InstanceImpl").list();
+ instances = session.createQuery("from InstanceDefinitionImpl").list();
assertEquals(1, instances.size());
instanceImpl = (InstanceDefinitionImpl)instances.get(0);
assertEquals(true, instanceImpl.isModifiable());
@@ -378,7 +378,7 @@
//
TransactionAssert.beginTransaction();
Session session = instanceHibernateSupport.getCurrentSession();
- assertEquals(0, session.createQuery("from InstanceImpl").list().size());
+ assertEquals(0, session.createQuery("from InstanceDefinitionImpl").list().size());
assertEquals(0, portletHibernateSupport.getCurrentSession().createQuery("from PersistentState").list().size());
TransactionAssert.commitTransaction();
}
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-31 11:54:06 UTC (rev 5524)
+++ trunk/server/src/main/org/jboss/portal/test/server/ServerTestRunner.java 2006-10-31 13:54:54 UTC (rev 5525)
@@ -24,10 +24,9 @@
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.TestParametrization;
import org.jboss.portal.common.test.junit.JUnitAdapter;
-import junit.framework.TestSuite;
import junit.framework.AssertionFailedError;
import java.io.File;
@@ -43,8 +42,8 @@
public ServerTestRunner()
{
- Map abc = JUnitAdapter.getParameterMap();
- archiveName = (String)((TestParameterValue)abc.get("archive")).get();
+ TestParametrization abc = JUnitAdapter.getParametrization();
+ archiveName = (String)abc.getParameterValue("archive").get();
}
public ServerTestRunner(String archiveName)
More information about the jboss-svn-commits
mailing list