JBoss Portal SVN: r8637 - modules/portlet/trunk/build.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-10-13 17:51:29 -0400 (Sat, 13 Oct 2007)
New Revision: 8637
Removed:
modules/portlet/trunk/build/local.properties
Log:
remove local.properties that should not be in the build dir
Deleted: modules/portlet/trunk/build/local.properties
===================================================================
--- modules/portlet/trunk/build/local.properties 2007-10-13 21:21:14 UTC (rev 8636)
+++ modules/portlet/trunk/build/local.properties 2007-10-13 21:51:29 UTC (rev 8637)
@@ -1,48 +0,0 @@
-### ====================================================================== ###
-## ##
-## Local project properties. ##
-## ##
-## Define properties that are local to your environment here. This ##
-## file (local.properties) should not be checked in. Modify the ##
-## example to affect all users. ##
-## ##
-### ====================================================================== ###
-
-### General compiler configuration ###
-
-#build.compiler=jikes
-#build.warnings=true
-#build.pedantic=true
-#javac.depend=on
-
-### Javac/Jikes compiler configuration ###
-
-javac.optimize=off
-javac.debug=on
-javac.deprecation=on
-
-### Enable verbose build output ###
-
-#init.verbose=true
-
-### JavaDoc ###
-#docs-javadocs.disable=true
-
-### Do we build xdoclet or get it from thirdparty ###
-### uncomment for thirdparty: comment to use xdoclet module.
-### To use xdoclet module also uncomment the xdoclet line in groups in build/build.xml
-#xdoclet.xdoclet.root=${project.root}/thirdparty/xdoclet
-
-# Portal database, for now : hsqldb, mysql, postgresql are the possible values
-portal.database=mysql
-# The datasource name used in the JNDI binding
-portal.datasource.name=PortalDS
-# Context root for the portal main servlet
-portal.web.context-root=/portal
-# JBoss server/<xxx> directory for JBoss Portal, ie: $JBOSS_HOME/server/default
-portal.deploy.dir=default/deploy
-portal-ha.deploy.dir=all/deploy
-# Show SQL or not
-portal.sql.show=false
-# Uncomment if you want to use a specific JBoss home path otherwise the build will use the JBOSS_HOME env variable
-#jboss.home=
16 years, 8 months
JBoss Portal SVN: r8636 - in modules/test/trunk: tooling/src/main/org/jboss/unit/tooling/ant and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-10-13 17:21:14 -0400 (Sat, 13 Oct 2007)
New Revision: 8636
Modified:
modules/test/trunk/mc/build.xml
modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/TestsType.java
Log:
added some JUL pre default config to limit the instance amount of jboss aop in MC
Modified: modules/test/trunk/mc/build.xml
===================================================================
--- modules/test/trunk/mc/build.xml 2007-10-13 20:33:24 UTC (rev 8635)
+++ modules/test/trunk/mc/build.xml 2007-10-13 21:21:14 UTC (rev 8636)
@@ -189,6 +189,11 @@
<target name="test" depends="output">
<java classname="org.jboss.test.unit.mc.MCTestLifeCycleTests" fork="true">
+
+
+ <sysproperty key="org.jboss.logging.Logger.pluginClass" value="org.jboss.logging.jdk.JDK14LoggerPlugin"/>
+ <sysproperty key="java.util.logging.config.file" value="logging.properties"/>
+
<!--
<jvmarg value="-Xdebug"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,address=7878,server=y,suspend=y"/>
@@ -205,6 +210,7 @@
<path refid="jboss.microcontainer.classpath"/>
<path refid="jboss/common.core.classpath"/>
<path refid="jboss/common.logging.spi.classpath"/>
+ <path refid="jboss/common.logging.jdk.classpath"/>
<path refid="jboss.aop.classpath"/>
<path refid="oswego.concurrent.classpath"/>
<path refid="javassist.javassist.classpath"/>
Modified: modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/TestsType.java
===================================================================
--- modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/TestsType.java 2007-10-13 20:33:24 UTC (rev 8635)
+++ modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/TestsType.java 2007-10-13 21:21:14 UTC (rev 8636)
@@ -117,6 +117,12 @@
pluginProperty.setValue("org.jboss.logging.jdk.JDK14LoggerPlugin");
javaTask.addSysproperty(pluginProperty);
+ // Set JUL to configure using the logging.properties file found in the current dir
+ Environment.Variable julProperty = new Environment.Variable();
+ julProperty.setKey("java.util.logging.config.file");
+ julProperty.setValue("logging.properties");
+ javaTask.addSysproperty(julProperty);
+
// Beginning of jpda option implementation, need to improve it
if (jpda)
{
16 years, 8 months
JBoss Portal SVN: r8635 - in modules/test/trunk/unit/src/main/org/jboss: unit and 3 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-10-13 16:33:24 -0400 (Sat, 13 Oct 2007)
New Revision: 8635
Added:
modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/EventList.java
modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/DelegateRunnerEventFilter.java
Modified:
modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/AbstractTestRunnerTests.java
modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/GenericTestRunnerTests.java
modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/POJOTestRunnerTests.java
modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/TestDriverRunnerTests.java
modules/test/trunk/unit/src/main/org/jboss/unit/TestId.java
modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/generic/GenericTestRunner.java
modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/pojo/POJOTestRunner.java
Log:
implement the modification of test ids when a runner delegates to another runner. Previously test event did not have correct test ids when they were broadcasted to the top level listeners such as reporters
Modified: modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/AbstractTestRunnerTests.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/AbstractTestRunnerTests.java 2007-10-13 19:26:25 UTC (rev 8634)
+++ modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/AbstractTestRunnerTests.java 2007-10-13 20:33:24 UTC (rev 8635)
@@ -51,18 +51,6 @@
public class AbstractTestRunnerTests
{
- protected static class EventList implements TestRunnerEventListener
- {
-
- /** . */
- protected final List<TestRunnerEvent> events = new ArrayList<TestRunnerEvent>();
-
- public void onEvent(TestRunnerEvent event)
- {
- events.add(event);
- }
- }
-
protected static class TestDriverImpl extends AbstractTestDriver
{
@@ -95,39 +83,4 @@
assertEquals(ids, this.ids);
}
}
-
- protected static void assertStartRunnerEvent(TestRunnerEvent event)
- {
- assertInstanceOf(event, StartRunnerEvent.class);
- }
-
- protected static void assertStartTestEvent(TestRunnerEvent event, TestId expectedTestId)
- {
- StartTestEvent startEvent = assertInstanceOf(event, StartTestEvent.class);
- assertEquals(expectedTestId, startEvent.getTestId());
- }
-
- protected static void assertEndTestEvent(TestRunnerEvent event, TestId expectedTestId, TestResult expectedTestResult)
- {
- EndTestEvent endEvent = assertInstanceOf(event, EndTestEvent.class);
- assertEquals(expectedTestId, endEvent.getTestId());
-
- //
- TestResult testResult = endEvent.getTestResult();
- if (expectedTestResult instanceof TestFailure)
- {
- TestFailure expectedTestFailure = (TestFailure)expectedTestResult;
- TestFailure testFailure = assertInstanceOf(testResult, TestFailure.class);
- assertEquals(expectedTestFailure.getFailure().getType(), testFailure.getFailure().getType());
- }
- else if (expectedTestResult instanceof TestSuccess)
- {
- assertInstanceOf(testResult, TestSuccess.class);
- }
- }
-
- protected static void assertEndRunnerEvent(TestRunnerEvent event)
- {
- assertInstanceOf(event, EndRunnerEvent.class);
- }
}
Added: modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/EventList.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/EventList.java (rev 0)
+++ modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/EventList.java 2007-10-13 20:33:24 UTC (rev 8635)
@@ -0,0 +1,117 @@
+/******************************************************************************
+ * 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.test.unit.runner;
+
+import org.jboss.unit.runner.TestRunnerEvent;
+import org.jboss.unit.runner.TestRunnerEventListener;
+import org.jboss.unit.runner.TestResult;
+import org.jboss.unit.runner.results.TestFailure;
+import org.jboss.unit.runner.results.TestSuccess;
+import org.jboss.unit.runner.event.StartRunnerEvent;
+import org.jboss.unit.runner.event.StartTestEvent;
+import org.jboss.unit.runner.event.EndTestEvent;
+import org.jboss.unit.runner.event.EndRunnerEvent;
+import static org.jboss.unit.api.Assert.*;
+import org.jboss.unit.TestId;
+
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class EventList implements TestRunnerEventListener
+{
+
+ /** . */
+ protected final List<TestRunnerEvent> events = new ArrayList<TestRunnerEvent>();
+
+ public void onEvent(TestRunnerEvent event)
+ {
+ events.add(event);
+ }
+
+ protected StartRunnerEvent assertStartRunnerEvent(int index)
+ {
+ assertTrue(events.size() > index);
+ TestRunnerEvent event = assertNotNull(events.get(index));
+ return assertStartRunnerEvent(event);
+ }
+
+ protected StartTestEvent assertStartTestEvent(int index, TestId expectedTestId)
+ {
+ assertTrue(events.size() > index);
+ TestRunnerEvent event = assertNotNull(events.get(index));
+ return assertStartTestEvent(event, expectedTestId);
+ }
+
+ protected EndTestEvent assertEndTestEvent(int index, TestId expectedTestId, TestResult expectedTestResult)
+ {
+ assertTrue(events.size() > index);
+ TestRunnerEvent event = assertNotNull(events.get(index));
+ return assertEndTestEvent(event, expectedTestId, expectedTestResult);
+ }
+
+ protected EndRunnerEvent assertEndRunnerEvent(int index)
+ {
+ assertTrue(events.size() > index);
+ TestRunnerEvent event = assertNotNull(events.get(index));
+ return assertEndRunnerEvent(event);
+ }
+
+ protected static StartRunnerEvent assertStartRunnerEvent(TestRunnerEvent event)
+ {
+ return assertInstanceOf(event, StartRunnerEvent.class);
+ }
+
+ protected static StartTestEvent assertStartTestEvent(TestRunnerEvent event, TestId expectedTestId)
+ {
+ StartTestEvent startEvent = assertInstanceOf(event, StartTestEvent.class);
+ assertEquals(expectedTestId, startEvent.getTestId());
+ return startEvent;
+ }
+
+ protected static EndTestEvent assertEndTestEvent(TestRunnerEvent event, TestId expectedTestId, TestResult expectedTestResult)
+ {
+ EndTestEvent endEvent = assertInstanceOf(event, EndTestEvent.class);
+ assertEquals(expectedTestId, endEvent.getTestId());
+ TestResult testResult = endEvent.getTestResult();
+ if (expectedTestResult instanceof TestFailure)
+ {
+ TestFailure expectedTestFailure = (TestFailure)expectedTestResult;
+ TestFailure testFailure = assertInstanceOf(testResult, TestFailure.class);
+ assertEquals(expectedTestFailure.getFailure().getType(), testFailure.getFailure().getType());
+ }
+ else if (expectedTestResult instanceof TestSuccess)
+ {
+ assertInstanceOf(testResult, TestSuccess.class);
+ }
+ return endEvent;
+ }
+
+ protected static EndRunnerEvent assertEndRunnerEvent(TestRunnerEvent event)
+ {
+ return assertInstanceOf(event, EndRunnerEvent.class);
+ }
+}
Modified: modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/GenericTestRunnerTests.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/GenericTestRunnerTests.java 2007-10-13 19:26:25 UTC (rev 8634)
+++ modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/GenericTestRunnerTests.java 2007-10-13 20:33:24 UTC (rev 8635)
@@ -29,6 +29,7 @@
import org.jboss.unit.runner.model.ParametersDef;
import org.jboss.unit.runner.model.ParameterValueDef;
import org.jboss.unit.runner.ParametrizationSet;
+import org.jboss.unit.runner.results.TestSuccess;
import org.jboss.unit.driver.DriverResponse;
import org.jboss.unit.driver.DriverCommand;
import org.jboss.unit.driver.AbstractTestDriver;
@@ -77,8 +78,16 @@
ParametersDef fooParameters = new ParametersDef();
fooParameters.setParameter("abc", new ParameterValueDef("def", "ghi"));
foo.setParameters(fooParameters);
+ EventList events = new EventList();
GenericTestRunner runner = new GenericTestRunner(suite);
- runner.run(new TestRunnerContextSupport());
+ runner.run(new TestRunnerContextSupport(events));
+ assertEquals(6, events.events.size());
+ events.assertStartRunnerEvent(0);
+ events.assertStartTestEvent(1, new TestId(Driver1.class.getName(), "foo"));
+ events.assertEndTestEvent(2, new TestId(Driver1.class.getName(), "foo"), new TestSuccess(0));
+ events.assertStartTestEvent(3, new TestId(Driver1.class.getName(), "foo"));
+ events.assertEndTestEvent(4, new TestId(Driver1.class.getName(), "foo"), new TestSuccess(0));
+ events.assertEndRunnerEvent(5);
assertEquals(list(new TestId("foo"), new TestId("foo")), Driver1.ids);
HashMap<String, String> expectedParametrization1 = new HashMap<String, String>();
HashMap<String, String> expectedParametrization2 = new HashMap<String, String>();
@@ -99,10 +108,16 @@
ParametersDef fooParameters = new ParametersDef();
fooParameters.setParameter("abc", new ParameterValueDef("def", "ghi"));
foo.setParameters(fooParameters);
- GenericTestRunner runner = new GenericTestRunner(suite);
Map<String,String[]> parametrizations = new HashMap<String, String[]>();
parametrizations.put("abc", new String[]{"def"});
- runner.run(new TestRunnerContextSupport(new ParametrizationSet(parametrizations)));
+ EventList events = new EventList();
+ GenericTestRunner runner = new GenericTestRunner(suite);
+ runner.run(new TestRunnerContextSupport(new ParametrizationSet(parametrizations), events));
+ assertEquals(4, events.events.size());
+ events.assertStartRunnerEvent(0);
+ events.assertStartTestEvent(1, new TestId(Driver1.class.getName(), "foo"));
+ events.assertEndTestEvent(2, new TestId(Driver1.class.getName(), "foo"), new TestSuccess(0));
+ events.assertEndRunnerEvent(3);
assertEquals(list(new TestId("foo")), Driver1.ids);
HashMap<String, String> expectedParametrization1 = new HashMap<String, String>();
expectedParametrization1.put("abc", "def");
@@ -113,8 +128,12 @@
{
Driver1.init();
GenericTestSuiteDef suite = new GenericTestSuiteDef(Driver1.class.getName());
+ EventList events = new EventList();
GenericTestRunner runner = new GenericTestRunner(suite);
- runner.run(new TestRunnerContextSupport());
+ runner.run(new TestRunnerContextSupport(events));
+ assertEquals(2, events.events.size());
+ events.assertStartRunnerEvent(0);
+ events.assertEndRunnerEvent(1);
assertEquals(list(), Driver1.ids);
assertEquals(list(), Driver1.parametrizations);
}
@@ -125,8 +144,14 @@
Driver1.testSuiteInfo.addTest(new SimpleTestCaseInfo("foo"));
GenericTestSuiteDef suite = new GenericTestSuiteDef(Driver1.class.getName());
suite.addTest(new TestDef(new TestId("foo")));
+ EventList events = new EventList();
GenericTestRunner runner = new GenericTestRunner(suite);
- runner.run(new TestRunnerContextSupport());
+ runner.run(new TestRunnerContextSupport(events));
+ assertEquals(4, events.events.size());
+ events.assertStartRunnerEvent(0);
+ events.assertStartTestEvent(1, new TestId(Driver1.class.getName(), "foo"));
+ events.assertEndTestEvent(2, new TestId(Driver1.class.getName(), "foo"), new TestSuccess(0));
+ events.assertEndRunnerEvent(3);
assertEquals(list(new TestId("foo")), Driver1.ids);
assertEquals(list(new HashMap()), Driver1.parametrizations);
}
@@ -138,8 +163,14 @@
Driver1.testSuiteInfo.addTest(new SimpleTestCaseInfo("bar"));
GenericTestSuiteDef suite = new GenericTestSuiteDef(Driver1.class.getName());
suite.addTest(new TestDef(new TestId("foo")));
+ EventList events = new EventList();
GenericTestRunner runner = new GenericTestRunner(suite);
- runner.run(new TestRunnerContextSupport());
+ runner.run(new TestRunnerContextSupport(events));
+ assertEquals(4, events.events.size());
+ events.assertStartRunnerEvent(0);
+ events.assertStartTestEvent(1, new TestId(Driver1.class.getName(), "foo"));
+ events.assertEndTestEvent(2, new TestId(Driver1.class.getName(), "foo"), new TestSuccess(0));
+ events.assertEndRunnerEvent(3);
assertEquals(list(new TestId("foo")), Driver1.ids);
assertEquals(list(new HashMap()), Driver1.parametrizations);
}
@@ -150,8 +181,16 @@
Driver1.testSuiteInfo.addTest(new SimpleTestCaseInfo("foo"));
Driver1.testSuiteInfo.addTest(new SimpleTestCaseInfo("bar"));
GenericTestSuiteDef suite = new GenericTestSuiteDef(Driver1.class.getName());
+ EventList events = new EventList();
GenericTestRunner runner = new GenericTestRunner(suite);
- runner.run(new TestRunnerContextSupport());
+ runner.run(new TestRunnerContextSupport(events));
+ assertEquals(6, events.events.size());
+ events.assertStartRunnerEvent(0);
+ events.assertStartTestEvent(1, new TestId(Driver1.class.getName(), "foo"));
+ events.assertEndTestEvent(2, new TestId(Driver1.class.getName(), "foo"), new TestSuccess(0));
+ events.assertStartTestEvent(3, new TestId(Driver1.class.getName(), "bar"));
+ events.assertEndTestEvent(4, new TestId(Driver1.class.getName(), "bar"), new TestSuccess(0));
+ events.assertEndRunnerEvent(5);
assertEquals(list(new TestId("foo"), new TestId("bar")), Driver1.ids);
assertEquals(list(new HashMap(), new HashMap()), Driver1.parametrizations);
}
Modified: modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/POJOTestRunnerTests.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/POJOTestRunnerTests.java 2007-10-13 19:26:25 UTC (rev 8634)
+++ modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/POJOTestRunnerTests.java 2007-10-13 20:33:24 UTC (rev 8635)
@@ -76,10 +76,10 @@
//
assertEquals(4, listener.events.size());
- assertStartRunnerEvent(listener.events.get(0));
- assertStartTestEvent(listener.events.get(1), new TestId("test"));
- assertEndTestEvent(listener.events.get(2), new TestId("test"), new TestSuccess(0));
- assertEndRunnerEvent(listener.events.get(3));
+ listener.assertStartRunnerEvent(0);
+ listener.assertStartTestEvent(1, new TestId(POJO1.class.getName(), "test"));
+ listener.assertEndTestEvent(2, new TestId(POJO1.class.getName(), "test"), new TestSuccess(0));
+ listener.assertEndRunnerEvent(3);
}
private static void testPOJO1_2()
@@ -111,12 +111,12 @@
//
assertEquals(6, listener.events.size());
- assertStartRunnerEvent(listener.events.get(0));
- assertStartTestEvent(listener.events.get(1), new TestId("test"));
- assertEndTestEvent(listener.events.get(2), new TestId("test"), new TestSuccess(0));
- assertStartTestEvent(listener.events.get(3), new TestId("test"));
- assertEndTestEvent(listener.events.get(4), new TestId("test"), new TestSuccess(0));
- assertEndRunnerEvent(listener.events.get(5));
+ listener.assertStartRunnerEvent(0);
+ listener.assertStartTestEvent(1, new TestId(POJO1.class.getName(), "test"));
+ listener.assertEndTestEvent(2, new TestId(POJO1.class.getName(), "test"), new TestSuccess(0));
+ listener.assertStartTestEvent(3, new TestId(POJO1.class.getName(), "test"));
+ listener.assertEndTestEvent(4, new TestId(POJO1.class.getName(), "test"), new TestSuccess(0));
+ listener.assertEndRunnerEvent(5);
}
public static class POJO1
Modified: modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/TestDriverRunnerTests.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/TestDriverRunnerTests.java 2007-10-13 19:26:25 UTC (rev 8634)
+++ modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/TestDriverRunnerTests.java 2007-10-13 20:33:24 UTC (rev 8635)
@@ -97,12 +97,12 @@
//
assertEquals(6, listener.events.size());
- assertStartRunnerEvent(listener.events.get(0));
- assertStartTestEvent(listener.events.get(1), new TestId("Foo"));
- assertEndTestEvent(listener.events.get(2), new TestId("Foo"), new TestSuccess(0));
- assertStartTestEvent(listener.events.get(3), new TestId("Bar"));
- assertEndTestEvent(listener.events.get(4), new TestId("Bar"), new TestSuccess(0));
- assertEndRunnerEvent(listener.events.get(5));
+ listener.assertStartRunnerEvent(0);
+ listener.assertStartTestEvent(1, new TestId("Foo"));
+ listener.assertEndTestEvent(2, new TestId("Foo"), new TestSuccess(0));
+ listener.assertStartTestEvent(3, new TestId("Bar"));
+ listener.assertEndTestEvent(4, new TestId("Bar"), new TestSuccess(0));
+ listener.assertEndRunnerEvent(5);
}
private static void testInvokeTestCaseWithParameters1()
@@ -133,10 +133,10 @@
//
assertEquals(4, listener.events.size());
- assertStartRunnerEvent(listener.events.get(0));
- assertStartTestEvent(listener.events.get(1), new TestId("Foo"));
- assertEndTestEvent(listener.events.get(2), new TestId("Foo"), new TestSuccess(0));
- assertEndRunnerEvent(listener.events.get(3));
+ listener.assertStartRunnerEvent(0);
+ listener.assertStartTestEvent(1, new TestId("Foo"));
+ listener.assertEndTestEvent(2, new TestId("Foo"), new TestSuccess(0));
+ listener.assertEndRunnerEvent(3);
// Check parametrization
Set<Map<String,String>> s1 = new HashSet<Map<String, String>>();
@@ -178,12 +178,12 @@
//
assertEquals(6, listener.events.size());
- assertStartRunnerEvent(listener.events.get(0));
- assertStartTestEvent(listener.events.get(1), new TestId("Foo"));
- assertEndTestEvent(listener.events.get(2), new TestId("Foo"), new TestSuccess(0));
- assertStartTestEvent(listener.events.get(3), new TestId("Foo"));
- assertEndTestEvent(listener.events.get(4), new TestId("Foo"), new TestSuccess(0));
- assertEndRunnerEvent(listener.events.get(5));
+ listener.assertStartRunnerEvent(0);
+ listener.assertStartTestEvent(1, new TestId("Foo"));
+ listener.assertEndTestEvent(2, new TestId("Foo"), new TestSuccess(0));
+ listener.assertStartTestEvent(3, new TestId("Foo"));
+ listener.assertEndTestEvent(4, new TestId("Foo"), new TestSuccess(0));
+ listener.assertEndRunnerEvent(5);
// Check parametrization
Set<Map<String,String>> s1 = new HashSet<Map<String, String>>();
@@ -215,8 +215,8 @@
//
assertEquals(2, listener.events.size());
- assertStartRunnerEvent(listener.events.get(0));
- assertEndRunnerEvent(listener.events.get(1));
+ listener.assertStartRunnerEvent(0);
+ listener.assertEndRunnerEvent(1);
}
private static void testTestDriverInvokeTestCaseReturnsNull()
@@ -234,10 +234,10 @@
//
assertEquals(4, listener.events.size());
- assertStartRunnerEvent(listener.events.get(0));
- assertStartTestEvent(listener.events.get(1), new TestId("Foo"));
- assertEndTestEvent(listener.events.get(2), new TestId("Foo"), new TestFailure(new Failure("", FailureType.ERROR), 0));
- assertEndRunnerEvent(listener.events.get(3));
+ listener.assertStartRunnerEvent(0);
+ listener.assertStartTestEvent(1, new TestId("Foo"));
+ listener.assertEndTestEvent(2, new TestId("Foo"), new TestFailure(new Failure("", FailureType.ERROR), 0));
+ listener.assertEndRunnerEvent(3);
}
private static void testTestDriverInvokeTestCaseReturnsAnEndTestResponse()
@@ -261,10 +261,10 @@
//
assertEquals(4, listener.events.size());
- assertStartRunnerEvent(listener.events.get(0));
- assertStartTestEvent(listener.events.get(1), new TestId("Foo"));
- assertEndTestEvent(listener.events.get(2), new TestId("Foo"), new TestSuccess(0));
- assertEndRunnerEvent(listener.events.get(3));
+ listener.assertStartRunnerEvent(0);
+ listener.assertStartTestEvent(1, new TestId("Foo"));
+ listener.assertEndTestEvent(2, new TestId("Foo"), new TestSuccess(0));
+ listener.assertEndRunnerEvent(3);
}
private static void testTestDriverInvokeTestCaseReturnsAFailureResponse()
@@ -288,10 +288,10 @@
//
assertEquals(4, listener.events.size());
- assertStartRunnerEvent(listener.events.get(0));
- assertStartTestEvent(listener.events.get(1), new TestId("Foo"));
- assertEndTestEvent(listener.events.get(2), new TestId("Foo"), new TestFailure(new Failure("", FailureType.ERROR), 0));
- assertEndRunnerEvent(listener.events.get(3));
+ listener.assertStartRunnerEvent(0);
+ listener.assertStartTestEvent(1, new TestId("Foo"));
+ listener.assertEndTestEvent(2, new TestId("Foo"), new TestFailure(new Failure("", FailureType.ERROR), 0));
+ listener.assertEndRunnerEvent(3);
}
private static void testTestDriverInvokeTestCaseThrowsRuntimeException()
@@ -315,10 +315,10 @@
//
assertEquals(4, listener.events.size());
- assertStartRunnerEvent(listener.events.get(0));
- assertStartTestEvent(listener.events.get(1), new TestId("Foo"));
- assertEndTestEvent(listener.events.get(2), new TestId("Foo"), new TestFailure(new Failure("", FailureType.ERROR), 0));
- assertEndRunnerEvent(listener.events.get(3));
+ listener.assertStartRunnerEvent(0);
+ listener.assertStartTestEvent(1, new TestId("Foo"));
+ listener.assertEndTestEvent(2, new TestId("Foo"), new TestFailure(new Failure("", FailureType.ERROR), 0));
+ listener.assertEndRunnerEvent(3);
}
private static void testTestDriverInvokeTestCaseThrowsError()
@@ -352,8 +352,8 @@
//
assertEquals(2, listener.events.size());
- assertStartRunnerEvent(listener.events.get(0));
- assertStartTestEvent(listener.events.get(1), new TestId("Foo"));
+ listener.assertStartRunnerEvent(0);
+ listener.assertStartTestEvent(1, new TestId("Foo"));
}
}
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/TestId.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/TestId.java 2007-10-13 19:26:25 UTC (rev 8634)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/TestId.java 2007-10-13 20:33:24 UTC (rev 8635)
@@ -64,6 +64,26 @@
this.names = names;
}
+ public TestId(String name, TestId suffix)
+ {
+ if (suffix == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (name == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ String[] names = new String[1 + suffix.names.length];
+ names[0] = name;
+ System.arraycopy(suffix.names, 0, names, 1, suffix.names.length);
+
+ //
+ this.names = names;
+ }
+
public TestId(String name)
{
if (name == null)
Added: modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/DelegateRunnerEventFilter.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/DelegateRunnerEventFilter.java (rev 0)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/DelegateRunnerEventFilter.java 2007-10-13 20:33:24 UTC (rev 8635)
@@ -0,0 +1,86 @@
+/******************************************************************************
+ * 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.unit.runner.impl;
+
+import org.jboss.unit.runner.TestRunnerEventListener;
+import org.jboss.unit.runner.TestRunnerEvent;
+import org.jboss.unit.runner.event.StartRunnerEvent;
+import org.jboss.unit.runner.event.EndRunnerEvent;
+import org.jboss.unit.runner.event.StartTestEvent;
+import org.jboss.unit.runner.event.EndTestEvent;
+import org.jboss.unit.TestId;
+
+/**
+ * <p>The goal of this listener class is to route events to a target listener and operate on the events
+ * with the following manner:</p>
+ * <p>
+ * <ul>
+ * <li>Absorb any event of type <code>StartRunnerEvent</code> or <code>EndRunnerEvent</code></li>
+ * <li>Event of type <code>StartTestEvent</code> or <code>EndTestEvent</code> have their test id transformed
+ * by adding the <code>testName</code> field as prefix of the id</li>
+ * </ul>
+ * </p>
+ * <p>The use case of this class is a test runner which delegates to another test runner and wants to absorb the
+ * life cycle events emitted by the runner and apply a transformation of the test id of the test life cycle events
+ * emitted by the runner.
+ * </p>
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class DelegateRunnerEventFilter implements TestRunnerEventListener
+{
+
+ /** . */
+ private String testName;
+
+ /** . */
+ private TestRunnerEventListener listener;
+
+ public DelegateRunnerEventFilter(String testName, TestRunnerEventListener listener)
+ {
+ this.testName = testName;
+ this.listener = listener;
+ }
+
+ public void onEvent(TestRunnerEvent event)
+ {
+ if (event instanceof StartRunnerEvent || event instanceof EndRunnerEvent)
+ {
+ return;
+ }
+ if (event instanceof StartTestEvent)
+ {
+ StartTestEvent ste = (StartTestEvent)event;
+ TestId newId = new TestId(testName, ste.getTestId());
+ event = new StartTestEvent(newId, ste.getTestInfo());
+ }
+ else if (event instanceof EndTestEvent)
+ {
+ EndTestEvent ste = (EndTestEvent)event;
+ TestId newId = new TestId(testName, ste.getTestId());
+ event = new EndTestEvent(newId, ste.getTestResult());
+ }
+ listener.onEvent(event);
+ }
+}
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/generic/GenericTestRunner.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/generic/GenericTestRunner.java 2007-10-13 19:26:25 UTC (rev 8634)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/generic/GenericTestRunner.java 2007-10-13 20:33:24 UTC (rev 8635)
@@ -25,11 +25,10 @@
import org.jboss.unit.runner.AbstractTestRunner;
import org.jboss.unit.runner.ParametrizationSet;
import org.jboss.unit.runner.TestRunnerContext;
-import org.jboss.unit.runner.impl.TestRunnerLifeCycleFilter;
import org.jboss.unit.runner.event.RunnerFailureEvent;
-import org.jboss.unit.runner.impl.TestRunnerEventBroadcaster;
import org.jboss.unit.runner.impl.driver.TestDriverRunner;
import org.jboss.unit.runner.impl.TestRunnerContextSupport;
+import org.jboss.unit.runner.impl.DelegateRunnerEventFilter;
import org.jboss.unit.runner.model.generic.GenericTestSuiteDef;
import org.jboss.unit.runner.model.generic.TestDef;
import org.jboss.unit.driver.TestDriver;
@@ -54,13 +53,12 @@
this.def = def;
}
- protected void internalRun(TestRunnerContext context)
+ protected void internalRun(final TestRunnerContext context)
{
String className = def.getClassName();
- // Setup intermediate event filtering
- TestRunnerEventBroadcaster tmp = new TestRunnerEventBroadcaster();
- tmp.addListener(new TestRunnerLifeCycleFilter(context.getEventListener()));
+ //
+ DelegateRunnerEventFilter filter = new DelegateRunnerEventFilter(className, context.getEventListener());
//
try
@@ -85,7 +83,7 @@
parametrizations.combine(context.getParametrizations());
//
- TestRunnerContextSupport genericContext = new TestRunnerContextSupport(context.getProperties(), parametrizations, context.getFilter(), tmp);
+ TestRunnerContextSupport genericContext = new TestRunnerContextSupport(context.getProperties(), parametrizations, context.getFilter(), filter);
//
TestDriverRunner runner = new TestDriverRunner(driver, testDef.getRefId());
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/pojo/POJOTestRunner.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/pojo/POJOTestRunner.java 2007-10-13 19:26:25 UTC (rev 8634)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/pojo/POJOTestRunner.java 2007-10-13 20:33:24 UTC (rev 8635)
@@ -27,8 +27,7 @@
import org.jboss.unit.runner.TestRunnerContext;
import org.jboss.unit.runner.impl.driver.TestDriverRunner;
import org.jboss.unit.runner.impl.TestRunnerContextSupport;
-import org.jboss.unit.runner.impl.TestRunnerEventBroadcaster;
-import org.jboss.unit.runner.impl.TestRunnerLifeCycleFilter;
+import org.jboss.unit.runner.impl.DelegateRunnerEventFilter;
import org.jboss.unit.runner.event.RunnerFailureEvent;
import org.jboss.unit.runner.model.pojo.POJOTestSuiteDef;
import org.jboss.unit.runner.model.pojo.TestClassDef;
@@ -59,16 +58,14 @@
protected void internalRun(TestRunnerContext context)
{
- // Setup intermediate event filtering
- TestRunnerEventBroadcaster tmp = new TestRunnerEventBroadcaster();
- tmp.addListener(new TestRunnerLifeCycleFilter(context.getEventListener()));
-
- //
for (TestClassDef testClass : suite.getTestClasses())
{
String className = testClass.getName();
//
+ DelegateRunnerEventFilter filter = new DelegateRunnerEventFilter(className, context.getEventListener());
+
+ //
try
{
Class clazz = Thread.currentThread().getContextClassLoader().loadClass(className);
@@ -94,7 +91,7 @@
parametrizations.combine(context.getParametrizations());
//
- TestRunnerContextSupport pojoContext = new TestRunnerContextSupport(context.getProperties(), parametrizations, context.getFilter(), tmp);
+ TestRunnerContextSupport pojoContext = new TestRunnerContextSupport(context.getProperties(), parametrizations, context.getFilter(), filter);
//
TestDriverRunner runner = new TestDriverRunner(driver);
16 years, 8 months
JBoss Portal SVN: r8634 - in modules/test/trunk/unit/src/main/org/jboss/test/unit: runner and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-10-13 15:26:25 -0400 (Sat, 13 Oct 2007)
New Revision: 8634
Added:
modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/AbstractTestRunnerTests.java
modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/POJOTestRunnerTests.java
Modified:
modules/test/trunk/unit/src/main/org/jboss/test/unit/AllTests.java
modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/TestDriverRunnerTests.java
Log:
added tests for POJO test runner integration with runtime parameter override
Modified: modules/test/trunk/unit/src/main/org/jboss/test/unit/AllTests.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/test/unit/AllTests.java 2007-10-13 18:07:51 UTC (rev 8633)
+++ modules/test/trunk/unit/src/main/org/jboss/test/unit/AllTests.java 2007-10-13 19:26:25 UTC (rev 8634)
@@ -32,6 +32,7 @@
import org.jboss.test.unit.runner.ParametrizationTests;
import org.jboss.test.unit.runner.TestDriverRunnerTests;
import org.jboss.test.unit.runner.GenericTestRunnerTests;
+import org.jboss.test.unit.runner.POJOTestRunnerTests;
import org.jboss.test.unit.runner.event.TestRunnerEventBroadcasterSupportTests;
import org.jboss.test.unit.runner.event.TestRunnerLifeCycleFilterTests;
import org.jboss.test.unit.runner.model.ModelTests;
@@ -52,6 +53,7 @@
CompositeTestRunnerTests.main(args);
TestDriverRunnerTests.main(args);
GenericTestRunnerTests.main(args);
+ POJOTestRunnerTests.main(args);
//
TestRunnerLifeCycleFilterTests.main(args);
Added: modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/AbstractTestRunnerTests.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/AbstractTestRunnerTests.java (rev 0)
+++ modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/AbstractTestRunnerTests.java 2007-10-13 19:26:25 UTC (rev 8634)
@@ -0,0 +1,133 @@
+/******************************************************************************
+ * 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.test.unit.runner;
+
+import org.jboss.unit.driver.AbstractTestDriver;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.DriverCommand;
+import org.jboss.unit.driver.command.StartTestCommand;
+import org.jboss.unit.TestId;
+import org.jboss.unit.runner.TestRunnerEvent;
+import org.jboss.unit.runner.TestResult;
+import org.jboss.unit.runner.TestRunnerEventListener;
+import org.jboss.unit.runner.results.TestFailure;
+import org.jboss.unit.runner.results.TestSuccess;
+import org.jboss.unit.runner.event.StartRunnerEvent;
+import org.jboss.unit.runner.event.StartTestEvent;
+import org.jboss.unit.runner.event.EndTestEvent;
+import org.jboss.unit.runner.event.EndRunnerEvent;
+import static org.jboss.unit.api.Assert.assertEquals;
+import static org.jboss.unit.api.Assert.assertInstanceOf;
+import org.jboss.unit.info.impl.SimpleTestSuiteInfo;
+import org.jboss.unit.info.TestInfo;
+
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class AbstractTestRunnerTests
+{
+
+ protected static class EventList implements TestRunnerEventListener
+ {
+
+ /** . */
+ protected final List<TestRunnerEvent> events = new ArrayList<TestRunnerEvent>();
+
+ public void onEvent(TestRunnerEvent event)
+ {
+ events.add(event);
+ }
+ }
+
+ protected static class TestDriverImpl extends AbstractTestDriver
+ {
+
+ protected List<TestId> ids = new ArrayList<TestId>();
+
+ /** . */
+ protected SimpleTestSuiteInfo info = new SimpleTestSuiteInfo("blah");
+
+ public TestInfo getInfo()
+ {
+ return info;
+ }
+
+ public final DriverResponse invoke(TestId id, DriverCommand command)
+ {
+ if (command instanceof StartTestCommand)
+ {
+ ids.add(id);
+ }
+ return invoke2(id, command);
+ }
+
+ public DriverResponse invoke2(TestId id, DriverCommand command)
+ {
+ return null;
+ }
+
+ public void assertIdList(List<TestId> ids)
+ {
+ assertEquals(ids, this.ids);
+ }
+ }
+
+ protected static void assertStartRunnerEvent(TestRunnerEvent event)
+ {
+ assertInstanceOf(event, StartRunnerEvent.class);
+ }
+
+ protected static void assertStartTestEvent(TestRunnerEvent event, TestId expectedTestId)
+ {
+ StartTestEvent startEvent = assertInstanceOf(event, StartTestEvent.class);
+ assertEquals(expectedTestId, startEvent.getTestId());
+ }
+
+ protected static void assertEndTestEvent(TestRunnerEvent event, TestId expectedTestId, TestResult expectedTestResult)
+ {
+ EndTestEvent endEvent = assertInstanceOf(event, EndTestEvent.class);
+ assertEquals(expectedTestId, endEvent.getTestId());
+
+ //
+ TestResult testResult = endEvent.getTestResult();
+ if (expectedTestResult instanceof TestFailure)
+ {
+ TestFailure expectedTestFailure = (TestFailure)expectedTestResult;
+ TestFailure testFailure = assertInstanceOf(testResult, TestFailure.class);
+ assertEquals(expectedTestFailure.getFailure().getType(), testFailure.getFailure().getType());
+ }
+ else if (expectedTestResult instanceof TestSuccess)
+ {
+ assertInstanceOf(testResult, TestSuccess.class);
+ }
+ }
+
+ protected static void assertEndRunnerEvent(TestRunnerEvent event)
+ {
+ assertInstanceOf(event, EndRunnerEvent.class);
+ }
+}
Added: modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/POJOTestRunnerTests.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/POJOTestRunnerTests.java (rev 0)
+++ modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/POJOTestRunnerTests.java 2007-10-13 19:26:25 UTC (rev 8634)
@@ -0,0 +1,139 @@
+/******************************************************************************
+ * 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.test.unit.runner;
+
+import org.jboss.unit.runner.impl.pojo.POJOTestRunner;
+import org.jboss.unit.runner.impl.TestRunnerContextSupport;
+import org.jboss.unit.runner.model.pojo.POJOTestSuiteDef;
+import org.jboss.unit.runner.model.pojo.TestClassDef;
+import org.jboss.unit.runner.TestRunnerContext;
+import org.jboss.unit.runner.ParametrizationSet;
+import org.jboss.unit.runner.results.TestSuccess;
+import org.jboss.unit.api.pojo.annotations.Test;
+import org.jboss.unit.api.pojo.annotations.Parameter;
+import static org.jboss.unit.api.Assert.assertEquals;
+import org.jboss.unit.TestId;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+
+import static org.jboss.unit.api.Assert.*;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class POJOTestRunnerTests extends AbstractTestRunnerTests
+{
+ public static void main(String[] args)
+ {
+ testPOJO1_1();
+ testPOJO1_2();
+ }
+
+ private static void testPOJO1_1()
+ {
+ POJO1.instances.clear();
+
+ //
+ TestClassDef testClass = new TestClassDef(POJO1.class.getName());
+ testClass.getParameters().setParameter("foo", "bar_def");
+ POJOTestSuiteDef suite = new POJOTestSuiteDef();
+ suite.addClass(testClass);
+
+ //
+ EventList listener = new EventList();
+ TestRunnerContext ctx = new TestRunnerContextSupport(new ParametrizationSet(), listener);
+ POJOTestRunner runner = new POJOTestRunner(suite);
+ runner.run(ctx);
+
+ //
+ assertEquals(1, POJO1.instances.size());
+ POJO1 pojo1_1 = assertNotNull(POJO1.instances.get(0));
+ assertEquals("bar_def", pojo1_1.foo);
+
+ //
+ assertEquals(4, listener.events.size());
+ assertStartRunnerEvent(listener.events.get(0));
+ assertStartTestEvent(listener.events.get(1), new TestId("test"));
+ assertEndTestEvent(listener.events.get(2), new TestId("test"), new TestSuccess(0));
+ assertEndRunnerEvent(listener.events.get(3));
+ }
+
+ private static void testPOJO1_2()
+ {
+ POJO1.instances.clear();
+
+ //
+ TestClassDef testClass = new TestClassDef(POJO1.class.getName());
+ testClass.getParameters().setParameter("foo", "bar_def");
+ POJOTestSuiteDef suite = new POJOTestSuiteDef();
+ suite.addClass(testClass);
+
+ //
+ Map<String,String[]> parametrizations = new HashMap<String, String[]>();
+ parametrizations.put("foo", new String[]{"bar_runtime_1","bar_runtime_2"});
+
+ //
+ EventList listener = new EventList();
+ TestRunnerContext ctx = new TestRunnerContextSupport(new ParametrizationSet(parametrizations), listener);
+ POJOTestRunner runner = new POJOTestRunner(suite);
+ runner.run(ctx);
+
+ //
+ assertEquals(2, POJO1.instances.size());
+ POJO1 pojo1_1 = assertNotNull(POJO1.instances.get(0));
+ assertEquals("bar_runtime_1", pojo1_1.foo);
+ POJO1 pojo1_2 = assertNotNull(POJO1.instances.get(1));
+ assertEquals("bar_runtime_2", pojo1_2.foo);
+
+ //
+ assertEquals(6, listener.events.size());
+ assertStartRunnerEvent(listener.events.get(0));
+ assertStartTestEvent(listener.events.get(1), new TestId("test"));
+ assertEndTestEvent(listener.events.get(2), new TestId("test"), new TestSuccess(0));
+ assertStartTestEvent(listener.events.get(3), new TestId("test"));
+ assertEndTestEvent(listener.events.get(4), new TestId("test"), new TestSuccess(0));
+ assertEndRunnerEvent(listener.events.get(5));
+ }
+
+ public static class POJO1
+ {
+
+ static List<POJO1> instances = new ArrayList<POJO1>();
+
+ String foo;
+ @Parameter
+ public void setFoo(String foo)
+ {
+ this.foo = foo;
+ }
+ @Test
+ public void test()
+ {
+ instances.add(this);
+ }
+ }
+}
Modified: modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/TestDriverRunnerTests.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/TestDriverRunnerTests.java 2007-10-13 18:07:51 UTC (rev 8633)
+++ modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/TestDriverRunnerTests.java 2007-10-13 19:26:25 UTC (rev 8634)
@@ -24,31 +24,20 @@
import org.jboss.unit.runner.impl.driver.TestDriverRunner;
import org.jboss.unit.runner.impl.TestRunnerContextSupport;
-import org.jboss.unit.runner.TestRunnerEvent;
-import org.jboss.unit.runner.TestResult;
import org.jboss.unit.runner.ParametrizationSet;
-import org.jboss.unit.runner.TestRunnerEventListener;
import org.jboss.unit.runner.results.TestFailure;
import org.jboss.unit.runner.results.TestSuccess;
import org.jboss.unit.runner.event.EndTestEvent;
-import org.jboss.unit.runner.event.StartTestEvent;
-import org.jboss.unit.runner.event.StartRunnerEvent;
-import org.jboss.unit.runner.event.EndRunnerEvent;
import org.jboss.unit.driver.DriverResponse;
import org.jboss.unit.driver.DriverCommand;
-import org.jboss.unit.driver.AbstractTestDriver;
-import org.jboss.unit.driver.command.StartTestCommand;
import org.jboss.unit.driver.response.EndTestResponse;
import org.jboss.unit.driver.response.FailureResponse;
-import org.jboss.unit.info.TestInfo;
-import org.jboss.unit.info.impl.SimpleTestSuiteInfo;
import org.jboss.unit.info.impl.SimpleTestCaseInfo;
import org.jboss.unit.info.impl.SimpleParameterInfo;
import org.jboss.unit.TestId;
import org.jboss.unit.FailureType;
import org.jboss.unit.Failure;
-import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
@@ -57,13 +46,12 @@
import static org.jboss.unit.util.CollectionTools.*;
import static org.jboss.unit.api.Assert.*;
-import static org.jboss.unit.api.Assert.assertEquals;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class TestDriverRunnerTests
+public class TestDriverRunnerTests extends AbstractTestRunnerTests
{
public static void main(String[] args)
@@ -368,83 +356,4 @@
assertStartTestEvent(listener.events.get(1), new TestId("Foo"));
}
- private static class TestDriverImpl extends AbstractTestDriver
- {
-
- List<TestId> ids = new ArrayList<TestId>();
-
- /** . */
- private SimpleTestSuiteInfo info = new SimpleTestSuiteInfo("blah");
-
- public TestInfo getInfo()
- {
- return info;
- }
-
- public final DriverResponse invoke(TestId id, DriverCommand command)
- {
- if (command instanceof StartTestCommand)
- {
- ids.add(id);
- }
- return invoke2(id, command);
- }
-
- public DriverResponse invoke2(TestId id, DriverCommand command)
- {
- return null;
- }
-
- public void assertIdList(List<TestId> ids)
- {
- assertEquals(ids, this.ids);
- }
- }
-
- private static void assertStartRunnerEvent(TestRunnerEvent event)
- {
- assertInstanceOf(event, StartRunnerEvent.class);
- }
-
- private static void assertStartTestEvent(TestRunnerEvent event, TestId expectedTestId)
- {
- StartTestEvent startEvent = assertInstanceOf(event, StartTestEvent.class);
- assertEquals(expectedTestId, startEvent.getTestId());
- }
-
- private static void assertEndTestEvent(TestRunnerEvent event, TestId expectedTestId, TestResult expectedTestResult)
- {
- EndTestEvent endEvent = assertInstanceOf(event, EndTestEvent.class);
- assertEquals(expectedTestId, endEvent.getTestId());
-
- //
- TestResult testResult = endEvent.getTestResult();
- if (expectedTestResult instanceof TestFailure)
- {
- TestFailure expectedTestFailure = (TestFailure)expectedTestResult;
- TestFailure testFailure = assertInstanceOf(testResult, TestFailure.class);
- assertEquals(expectedTestFailure.getFailure().getType(), testFailure.getFailure().getType());
- }
- else if (expectedTestResult instanceof TestSuccess)
- {
- assertInstanceOf(testResult, TestSuccess.class);
- }
- }
-
- private static void assertEndRunnerEvent(TestRunnerEvent event)
- {
- assertInstanceOf(event, EndRunnerEvent.class);
- }
-
- private static class EventList implements TestRunnerEventListener
- {
-
- /** . */
- private final List<TestRunnerEvent> events = new ArrayList<TestRunnerEvent>();
-
- public void onEvent(TestRunnerEvent event)
- {
- events.add(event);
- }
- }
}
16 years, 8 months
JBoss Portal SVN: r8633 - in docs: trunk/referenceGuide/en/modules and 1 other directory.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-10-13 14:07:51 -0400 (Sat, 13 Oct 2007)
New Revision: 8633
Modified:
docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/clustering.xml
docs/trunk/referenceGuide/en/modules/clustering.xml
Log:
- Fixed typo.
Modified: docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/clustering.xml
===================================================================
--- docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/clustering.xml 2007-10-13 17:31:51 UTC (rev 8632)
+++ docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/clustering.xml 2007-10-13 18:07:51 UTC (rev 8633)
@@ -192,7 +192,7 @@
<sect2>
<title>CMS clustering</title>
<para>The CMS backend storage relies on the Apache Jackrabbit project. Jackrabbit does not support clustering out of the box.
- So the portal run the Jackrabbit servicey on one node of the cluster using the
+ So the portal run the Jackrabbit service on one node of the cluster using the
<ulink url="http://www.onjava.com/pub/a/onjava/2003/08/20/jboss_clustering.html">HA-Singleton</ulink> technology.
The file <emphasis>jboss-portal.sar/portal-cms.sar/META-INF/jboss-service.xml</emphasis> contains the configuration. We will
not reproduce it in this documentation as the changes are quite complex and numerous. Access from all nodes of the cluster
@@ -260,10 +260,10 @@
We recommend that you use the following version of JBoss Cache for best performance:
<itemizedlist>
<listitem><emphasis>JBoss Cache 1.4.0.SP1 and above</emphasis></listitem>
- <listitem><emphasis>JGroups 2.2.7 or 2.2.8</emphasis></listitem>
- </itemizedlist>
+ <listitem><emphasis>JGroups 2.2.7 or 2.2.8</emphasis></listitem>
+ </itemizedlist>
When building from source the following command: {core}/build.xml deploy-ha automatically upgrades your JBoss
- Cache version.
+ Cache version.
</para>
<para>
<emphasis>Alternative: </emphasis> If upgrading your JBoss Cache version is not an option, the following configuration
@@ -304,10 +304,10 @@
<attribute name="CacheLoaderFetchTransientState">false</attribute>
<attribute name="CacheLoaderFetchPersistentState">false</attribute>
<attribute name="CacheLoaderAsynchronous">false</attribute> ]]></programlisting>
-
+
</para>
-
-
+
+
<para>Finally we can start both servers, open two shells and execute :
<programlisting><![CDATA[
>cd $JBOSS_HOME/bin
@@ -319,9 +319,9 @@
]]></programlisting>
</para>
</sect1>
-
-
+
+
<sect1 id="portlet_session_replication">
<title>Portlet Session Replication</title>
<para>Web containers offer the capability to replicate sessions of web applications. In the context of a portal using portlets the use case is different. The portal itself is a web application
Modified: docs/trunk/referenceGuide/en/modules/clustering.xml
===================================================================
--- docs/trunk/referenceGuide/en/modules/clustering.xml 2007-10-13 17:31:51 UTC (rev 8632)
+++ docs/trunk/referenceGuide/en/modules/clustering.xml 2007-10-13 18:07:51 UTC (rev 8633)
@@ -192,7 +192,7 @@
<sect2>
<title>CMS clustering</title>
<para>The CMS backend storage relies on the Apache Jackrabbit project. Jackrabbit does not support clustering out of the box.
- So the portal run the Jackrabbit servicey on one node of the cluster using the
+ So the portal run the Jackrabbit service on one node of the cluster using the
<ulink url="http://www.onjava.com/pub/a/onjava/2003/08/20/jboss_clustering.html">HA-Singleton</ulink> technology.
The file <emphasis>jboss-portal.sar/portal-cms.sar/META-INF/jboss-service.xml</emphasis> contains the configuration. We will
not reproduce it in this documentation as the changes are quite complex and numerous. Access from all nodes of the cluster
16 years, 8 months
JBoss Portal SVN: r8632 - in docs: trunk/referenceGuide/en/modules and 1 other directory.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-10-13 13:31:51 -0400 (Sat, 13 Oct 2007)
New Revision: 8632
Modified:
docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/clustering.xml
docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/sso.xml
docs/trunk/referenceGuide/en/modules/clustering.xml
docs/trunk/referenceGuide/en/modules/sso.xml
Log:
- Updated to use 4.2.x information.
Modified: docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/clustering.xml
===================================================================
--- docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/clustering.xml 2007-10-13 17:12:01 UTC (rev 8631)
+++ docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/clustering.xml 2007-10-13 17:31:51 UTC (rev 8632)
@@ -163,22 +163,29 @@
</depends>
</mbean>
]]></programlisting>
- More information can be found <ulink url="http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossCacheHibernate">here</ulink>.
+ More information can be found <ulink
+ url="http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossCacheHibernate">here</ulink>.
</para>
</sect2>
<sect2>
<title>Identity clustering</title>
- <para>JBoss Portal leverages the servlet container authentication for its own authentication mechanism. When the user
- is authenticated on one particular node he will have to reauthenticate again if he use another node of the cluster (during
- a failover for instance). This is valid only for the <emphasis>FORM</emphasis> based authentication which is the default
- form of authentication that JBoss Portal uses. Fortunately JBoss provides transparent reauthentication of the user called
- JBoss clustered SSO. Its configuration is in the file <emphasis>$JBOSS_HOME/server/all/deploy/jbossweb-tomcat55.sar/server.xml</emphasis>
- and the clustered sso valve shall be uncommented
- <programlisting><![CDATA[
-<Valve className="org.jboss.web.tomcat.tc5.sso.ClusteredSingleSignOn" />
-]]></programlisting>
- More information can be found <ulink url="http://www.jboss.org/wiki/Wiki.jsp?page=SingleSignOn">here</ulink>.
+ <para>JBoss Portal leverages the servlet container authentication for its own authentication mechanism. When
+ the user is authenticated on one particular node he will have to reauthenticate again if he use another
+ node of the cluster (during a failover for instance). This is valid only for the <emphasis>FORM</emphasis>
+ based authentication which is the default form of authentication that JBoss Portal uses. Fortunately JBoss
+ provides transparent reauthentication of the user called JBoss clustered SSO. Its configuration can be found
+ in <literal>$JBOSS_HOME/server/all/deploy/jboss-web.deployer/server.xml</literal> and you will need to
+ uncomment the following valve:
+ <programlisting><![CDATA[<Valve className="org.jboss.web.tomcat.service.sso.ClusteredSingleSignOn" />]]></programlisting>
+
+ <note>
+ If you use JBoss 4.0.x, the files and valve are respectively:
+ <literal>$JBOSS_HOME/server/all/deploy/jbossweb-tomcat55.sar/server.xml</literal>
+ <programlisting><![CDATA[<Valve className="org.jboss.web.tomcat.tc5.sso.ClusteredSingleSignOn" />]]></programlisting>
+ </note>
+
+ More information can be found <ulink url="http://www.jboss.org/wiki/Wiki.jsp?page=SingleSignOn">here</ulink>.
</para>
</sect2>
@@ -202,10 +209,12 @@
<title>Setup</title>
<para>We are going to outline how to setup a two node cluster on the same machine in order to test JBoss Portal HA. The only
missing part from the full fledged setup is the addition of a load balancer in front of Tomcat. However a lot of documentation
- exist on the subject. A detailed step by step setup of Apache and mod_jk is available from the <ulink url="http://wiki.jboss.org/wiki/Wiki.jsp?page=UsingMod_jk1.2WithJBoss">JBoss Wiki</ulink>.</para>
+ exist on the subject. A detailed step by step setup of Apache and mod_jk is available from the <ulink
+ url="http://wiki.jboss.org/wiki/Wiki.jsp?page=UsingMod_jk1.2WithJBoss">JBoss Wiki</ulink>.</para>
<para>As we need two application servers running at the same time, we must avoid any conflict. For instance we will
need Tomcat to bind its socket on two different ports otherwise a network conflict will occur. We will leverage
- the service binding manager <ulink url="http://docs.jboss.org/jbossas/jboss4guide/r3/html/ch10.html">this chapter</ulink> of
+ the service binding manager <ulink
+ url="http://docs.jboss.org/jbossas/jboss4guide/r3/html/ch10.html">this chapter</ulink> of
the JBoss AS documentation.</para>
<para>The first step is to copy the <emphasis>all</emphasis> configuration of JBoss into two separate
configurations that we name <emphasis>ports-01</emphasis> and <emphasis>ports-02</emphasis> :
@@ -244,9 +253,9 @@
into <emphasis>$JBOSS_HOME/server/ports-01/deploy</emphasis> and <emphasis>$JBOSS_HOME/server/ports-02/deploy</emphasis>.
</para>
<para>Copy JBoss Portal HA to the deploy directory of the two configurations.</para>
-
+
<!-- adding instruction about jboss cache versioning -->
- <para>
+ <para>
<emphasis>JBoss Cache Configuration Note :</emphasis> To improve CMS performance JBoss Cache is leveraged to cache the content cluster wide.
We recommend that you use the following version of JBoss Cache for best performance:
<itemizedlist>
Modified: docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/sso.xml
===================================================================
--- docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/sso.xml 2007-10-13 17:12:01 UTC (rev 8631)
+++ docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/sso.xml 2007-10-13 17:31:51 UTC (rev 8632)
@@ -19,7 +19,8 @@
the portal you gain access to many systems through portlets using a single identity. Still in many cases you
need to integrate the portal infrastructure with other SSO enabled systems. There are many different Identity Management
solutions on the market. In most cases each SSO framework provides its own way to plug into Java EE application. For custom configurations
- you need to have a good understanding of <link linkend="identity">JBoss Portal Identity management</link> and <link linkend="authentication">authentication</link>
+ you need to have a good understanding of <link linkend="identity">JBoss Portal Identity management</link> and <link
+ linkend="authentication">authentication</link>
mechanisms.</para>
</sect1>
<sect1>
@@ -32,12 +33,14 @@
<sect2>
<title>Enabling Tomcat SSO Valve</title>
<para>
- To enable SSO valve in Tomcat you should edit <emphasis>$JBOSS_HOME/server/default/deploy/jbossweb-tomcat55.sar/server.xml</emphasis> file and uncomment
- following line:
- <programlisting>
- <![CDATA[
-<Valve className=’org.apache.catalina.authenticator.SingleSignOn’/>]]>
- </programlisting>
+ To enable SSO valve in Tomcat you should uncomment the following line
+ <programlisting><![CDATA[<Valve className=’org.apache.catalina.authenticator.SingleSignOn’/>]]></programlisting>
+ in the <literal>$JBOSS_HOME/server/default/deploy/jboss-web.deployer/server.xml</literal> file.
+ <note>
+ On JBoss 4.0.x the configuration file is
+ <literal>$JBOSS_HOME/server/default/deploy/jbossweb-tomcat55.sar/server.xml</literal>
+ </note>
+ More information can be found <ulink url="http://www.jboss.org/wiki/Wiki.jsp?page=SingleSignOn">here</ulink>.
</para>
</sect2>
<sect2>
@@ -45,7 +48,8 @@
<para>
Lets look a little bit closer and configure SSO between portal and other web application. As an example
we'll use <emphasis>jmx-console</emphasis> web-app that comes with every JBoss Application Server installation.
- You can find more information on how to secure <emphasis>jmx-console</emphasis> in <ulink url="http://wiki.jboss.org/wiki/Wiki.jsp?page=SecureTheJmxConsole">JBoss AS wiki</ulink>.
+ You can find more information on how to secure <emphasis>jmx-console</emphasis> in <ulink
+ url="http://wiki.jboss.org/wiki/Wiki.jsp?page=SecureTheJmxConsole">JBoss AS wiki</ulink>.
</para>
<orderedlist>
<listitem>
@@ -127,12 +131,15 @@
</listitem>
<listitem>
<para>
- Edit <emphasis>$JBOSS_HOME/server/default/deploy/jbossweb-tomcat55.sar/server.xml</emphasis> file and uncomment
- following line:
- <programlisting>
- <![CDATA[
-<Valve className=’org.apache.catalina.authenticator.SingleSignOn’/>]]>
- </programlisting>
+ Uncomment the following line
+ <programlisting><![CDATA[<Valve className=’org.apache.catalina.authenticator.SingleSignOn’/>]]></programlisting>
+ in the <literal>$JBOSS_HOME/server/default/deploy/jboss-web.deployer/server.xml</literal> file.
+ <note>
+ On JBoss 4.0.x the configuration file is
+ <literal>$JBOSS_HOME/server/default/deploy/jbossweb-tomcat55.sar/server.xml</literal>
+ </note>
+ More information can be found <ulink
+ url="http://www.jboss.org/wiki/Wiki.jsp?page=SingleSignOn">here</ulink>.
</para>
<para>
Run JBoss Application Server.
Modified: docs/trunk/referenceGuide/en/modules/clustering.xml
===================================================================
--- docs/trunk/referenceGuide/en/modules/clustering.xml 2007-10-13 17:12:01 UTC (rev 8631)
+++ docs/trunk/referenceGuide/en/modules/clustering.xml 2007-10-13 17:31:51 UTC (rev 8632)
@@ -163,22 +163,29 @@
</depends>
</mbean>
]]></programlisting>
- More information can be found <ulink url="http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossCacheHibernate">here</ulink>.
+ More information can be found <ulink
+ url="http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossCacheHibernate">here</ulink>.
</para>
</sect2>
<sect2>
<title>Identity clustering</title>
- <para>JBoss Portal leverages the servlet container authentication for its own authentication mechanism. When the user
- is authenticated on one particular node he will have to reauthenticate again if he use another node of the cluster (during
- a failover for instance). This is valid only for the <emphasis>FORM</emphasis> based authentication which is the default
- form of authentication that JBoss Portal uses. Fortunately JBoss provides transparent reauthentication of the user called
- JBoss clustered SSO. Its configuration is in the file <emphasis>$JBOSS_HOME/server/all/deploy/jbossweb-tomcat55.sar/server.xml</emphasis>
- and the clustered sso valve shall be uncommented
- <programlisting><![CDATA[
-<Valve className="org.jboss.web.tomcat.tc5.sso.ClusteredSingleSignOn" />
-]]></programlisting>
- More information can be found <ulink url="http://www.jboss.org/wiki/Wiki.jsp?page=SingleSignOn">here</ulink>.
+ <para>JBoss Portal leverages the servlet container authentication for its own authentication mechanism. When
+ the user is authenticated on one particular node he will have to reauthenticate again if he use another
+ node of the cluster (during a failover for instance). This is valid only for the <emphasis>FORM</emphasis>
+ based authentication which is the default form of authentication that JBoss Portal uses. Fortunately JBoss
+ provides transparent reauthentication of the user called JBoss clustered SSO. Its configuration can be found
+ in <literal>$JBOSS_HOME/server/all/deploy/jboss-web.deployer/server.xml</literal> and you will need to
+ uncomment the following valve:
+ <programlisting><![CDATA[<Valve className="org.jboss.web.tomcat.service.sso.ClusteredSingleSignOn" />]]></programlisting>
+
+ <note>
+ If you use JBoss 4.0.x, the files and valve are respectively:
+ <literal>$JBOSS_HOME/server/all/deploy/jbossweb-tomcat55.sar/server.xml</literal>
+ <programlisting><![CDATA[<Valve className="org.jboss.web.tomcat.tc5.sso.ClusteredSingleSignOn" />]]></programlisting>
+ </note>
+
+ More information can be found <ulink url="http://www.jboss.org/wiki/Wiki.jsp?page=SingleSignOn">here</ulink>.
</para>
</sect2>
@@ -202,10 +209,12 @@
<title>Setup</title>
<para>We are going to outline how to setup a two node cluster on the same machine in order to test JBoss Portal HA. The only
missing part from the full fledged setup is the addition of a load balancer in front of Tomcat. However a lot of documentation
- exist on the subject. A detailed step by step setup of Apache and mod_jk is available from the <ulink url="http://wiki.jboss.org/wiki/Wiki.jsp?page=UsingMod_jk1.2WithJBoss">JBoss Wiki</ulink>.</para>
+ exist on the subject. A detailed step by step setup of Apache and mod_jk is available from the <ulink
+ url="http://wiki.jboss.org/wiki/Wiki.jsp?page=UsingMod_jk1.2WithJBoss">JBoss Wiki</ulink>.</para>
<para>As we need two application servers running at the same time, we must avoid any conflict. For instance we will
need Tomcat to bind its socket on two different ports otherwise a network conflict will occur. We will leverage
- the service binding manager <ulink url="http://docs.jboss.org/jbossas/jboss4guide/r3/html/ch10.html">this chapter</ulink> of
+ the service binding manager <ulink
+ url="http://docs.jboss.org/jbossas/jboss4guide/r3/html/ch10.html">this chapter</ulink> of
the JBoss AS documentation.</para>
<para>The first step is to copy the <emphasis>all</emphasis> configuration of JBoss into two separate
configurations that we name <emphasis>ports-01</emphasis> and <emphasis>ports-02</emphasis> :
@@ -244,17 +253,17 @@
into <emphasis>$JBOSS_HOME/server/ports-01/deploy</emphasis> and <emphasis>$JBOSS_HOME/server/ports-02/deploy</emphasis>.
</para>
<para>Copy JBoss Portal HA to the deploy directory of the two configurations.</para>
-
+
<!-- adding instruction about jboss cache versioning -->
- <para>
+ <para>
<emphasis>JBoss Cache Configuration Note :</emphasis> To improve CMS performance JBoss Cache is leveraged to cache the content cluster wide.
We recommend that you use the following version of JBoss Cache for best performance:
<itemizedlist>
<listitem><emphasis>JBoss Cache 1.4.0.SP1 and above</emphasis></listitem>
- <listitem><emphasis>JGroups 2.2.7 or 2.2.8</emphasis></listitem>
- </itemizedlist>
+ <listitem><emphasis>JGroups 2.2.7 or 2.2.8</emphasis></listitem>
+ </itemizedlist>
When building from source the following command: {core}/build.xml deploy-ha automatically upgrades your JBoss
- Cache version.
+ Cache version.
</para>
<para>
<emphasis>Alternative: </emphasis> If upgrading your JBoss Cache version is not an option, the following configuration
@@ -295,10 +304,10 @@
<attribute name="CacheLoaderFetchTransientState">false</attribute>
<attribute name="CacheLoaderFetchPersistentState">false</attribute>
<attribute name="CacheLoaderAsynchronous">false</attribute> ]]></programlisting>
-
+
</para>
-
-
+
+
<para>Finally we can start both servers, open two shells and execute :
<programlisting><![CDATA[
>cd $JBOSS_HOME/bin
@@ -310,9 +319,9 @@
]]></programlisting>
</para>
</sect1>
-
-
+
+
<sect1 id="portlet_session_replication">
<title>Portlet Session Replication</title>
<para>Web containers offer the capability to replicate sessions of web applications. In the context of a portal using portlets the use case is different. The portal itself is a web application
Modified: docs/trunk/referenceGuide/en/modules/sso.xml
===================================================================
--- docs/trunk/referenceGuide/en/modules/sso.xml 2007-10-13 17:12:01 UTC (rev 8631)
+++ docs/trunk/referenceGuide/en/modules/sso.xml 2007-10-13 17:31:51 UTC (rev 8632)
@@ -19,7 +19,8 @@
the portal you gain access to many systems through portlets using a single identity. Still in many cases you
need to integrate the portal infrastructure with other SSO enabled systems. There are many different Identity Management
solutions on the market. In most cases each SSO framework provides its own way to plug into Java EE application. For custom configurations
- you need to have a good understanding of <link linkend="identity">JBoss Portal Identity management</link> and <link linkend="authentication">authentication</link>
+ you need to have a good understanding of <link linkend="identity">JBoss Portal Identity management</link> and <link
+ linkend="authentication">authentication</link>
mechanisms.</para>
</sect1>
<sect1>
@@ -32,12 +33,14 @@
<sect2>
<title>Enabling Tomcat SSO Valve</title>
<para>
- To enable SSO valve in Tomcat you should edit <emphasis>$JBOSS_HOME/server/default/deploy/jbossweb-tomcat55.sar/server.xml</emphasis> file and uncomment
- following line:
- <programlisting>
- <![CDATA[
-<Valve className=’org.apache.catalina.authenticator.SingleSignOn’/>]]>
- </programlisting>
+ To enable SSO valve in Tomcat you should uncomment the following line
+ <programlisting><![CDATA[<Valve className=’org.apache.catalina.authenticator.SingleSignOn’/>]]></programlisting>
+ in the <literal>$JBOSS_HOME/server/default/deploy/jboss-web.deployer/server.xml</literal> file.
+ <note>
+ On JBoss 4.0.x the configuration file is
+ <literal>$JBOSS_HOME/server/default/deploy/jbossweb-tomcat55.sar/server.xml</literal>
+ </note>
+ More information can be found <ulink url="http://www.jboss.org/wiki/Wiki.jsp?page=SingleSignOn">here</ulink>.
</para>
</sect2>
<sect2>
@@ -45,7 +48,8 @@
<para>
Lets look a little bit closer and configure SSO between portal and other web application. As an example
we'll use <emphasis>jmx-console</emphasis> web-app that comes with every JBoss Application Server installation.
- You can find more information on how to secure <emphasis>jmx-console</emphasis> in <ulink url="http://wiki.jboss.org/wiki/Wiki.jsp?page=SecureTheJmxConsole">JBoss AS wiki</ulink>.
+ You can find more information on how to secure <emphasis>jmx-console</emphasis> in <ulink
+ url="http://wiki.jboss.org/wiki/Wiki.jsp?page=SecureTheJmxConsole">JBoss AS wiki</ulink>.
</para>
<orderedlist>
<listitem>
@@ -127,12 +131,15 @@
</listitem>
<listitem>
<para>
- Edit <emphasis>$JBOSS_HOME/server/default/deploy/jbossweb-tomcat55.sar/server.xml</emphasis> file and uncomment
- following line:
- <programlisting>
- <![CDATA[
-<Valve className=’org.apache.catalina.authenticator.SingleSignOn’/>]]>
- </programlisting>
+ Uncomment the following line
+ <programlisting><![CDATA[<Valve className=’org.apache.catalina.authenticator.SingleSignOn’/>]]></programlisting>
+ in the <literal>$JBOSS_HOME/server/default/deploy/jboss-web.deployer/server.xml</literal> file.
+ <note>
+ On JBoss 4.0.x the configuration file is
+ <literal>$JBOSS_HOME/server/default/deploy/jbossweb-tomcat55.sar/server.xml</literal>
+ </note>
+ More information can be found <ulink
+ url="http://www.jboss.org/wiki/Wiki.jsp?page=SingleSignOn">here</ulink>.
</para>
<para>
Run JBoss Application Server.
@@ -369,7 +376,7 @@
]]>
</programlisting>
This will expose special service in JBoss Portal that can be leveraged by JOSSO Credential and Identity Stores if the server is deployed on the same
- application server instance.
+ application server instance.
</listitem>
<listitem>
Edit <emphasis>$JBOSS_HOME/server/default/deploy/josso.ear/josso.war/WEB-INF/classes/josso-gateway-config.xml</emphasis> and configure following elements:
16 years, 8 months
JBoss Portal SVN: r8631 - in docs: trunk/referenceGuide/en/modules and 1 other directory.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-10-13 13:12:01 -0400 (Sat, 13 Oct 2007)
New Revision: 8631
Modified:
docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/portalapi.xml
docs/trunk/referenceGuide/en/modules/portalapi.xml
Log:
- Fixed typo.
Modified: docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/portalapi.xml
===================================================================
--- docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/portalapi.xml 2007-10-13 15:22:07 UTC (rev 8630)
+++ docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/portalapi.xml 2007-10-13 17:12:01 UTC (rev 8631)
@@ -375,8 +375,8 @@
it works.</para>
<sect2>
<title>UserAuthenticationEvent example</title>
- <para>In this example, we will create a simple counter of the number of logged-in registered users. In ordder to do that we just need to keep track
- of Sign-in and Sign-out events.</para>
+ <para>In this example, we will create a simple counter of the number of logged-in registered users. In order to
+ do that we just need to keep track of Sign-in and Sign-out events.</para>
<para>First, let's write our listener. It just a class that will implement <emphasis>org.jboss.portal.api.event.PortalEventListener</emphasis> and
its unique method <emphasis>void onEvent(PortalEventContext eventContext, PortalEvent event)</emphasis>. Here is such an example:
<programlisting><![CDATA[
Modified: docs/trunk/referenceGuide/en/modules/portalapi.xml
===================================================================
--- docs/trunk/referenceGuide/en/modules/portalapi.xml 2007-10-13 15:22:07 UTC (rev 8630)
+++ docs/trunk/referenceGuide/en/modules/portalapi.xml 2007-10-13 17:12:01 UTC (rev 8631)
@@ -375,8 +375,8 @@
it works.</para>
<sect2>
<title>UserAuthenticationEvent example</title>
- <para>In this example, we will create a simple counter of the number of logged-in registered users. In ordder to do that we just need to keep track
- of Sign-in and Sign-out events.</para>
+ <para>In this example, we will create a simple counter of the number of logged-in registered users. In order to
+ do that we just need to keep track of Sign-in and Sign-out events.</para>
<para>First, let's write our listener. It just a class that will implement <emphasis>org.jboss.portal.api.event.PortalEventListener</emphasis> and
its unique method <emphasis>void onEvent(PortalEventContext eventContext, PortalEvent event)</emphasis>. Here is such an example:
<programlisting><![CDATA[
16 years, 8 months
JBoss Portal SVN: r8630 - in modules/test/trunk/unit/src/main/org/jboss: unit/info/impl and 4 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-10-13 11:22:07 -0400 (Sat, 13 Oct 2007)
New Revision: 8630
Modified:
modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/GenericTestRunnerTests.java
modules/test/trunk/unit/src/main/org/jboss/unit/info/impl/SimpleTestInfo.java
modules/test/trunk/unit/src/main/org/jboss/unit/runner/ParametrizationSet.java
modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/TestRunnerContextSupport.java
modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/generic/GenericTestRunner.java
modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/pojo/POJOTestRunner.java
Log:
test runtime parameters combination with generic test runner
Modified: modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/GenericTestRunnerTests.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/GenericTestRunnerTests.java 2007-10-13 12:38:42 UTC (rev 8629)
+++ modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/GenericTestRunnerTests.java 2007-10-13 15:22:07 UTC (rev 8630)
@@ -26,7 +26,9 @@
import org.jboss.unit.runner.impl.TestRunnerContextSupport;
import org.jboss.unit.runner.model.generic.GenericTestSuiteDef;
import org.jboss.unit.runner.model.generic.TestDef;
-import org.jboss.unit.driver.TestDriver;
+import org.jboss.unit.runner.model.ParametersDef;
+import org.jboss.unit.runner.model.ParameterValueDef;
+import org.jboss.unit.runner.ParametrizationSet;
import org.jboss.unit.driver.DriverResponse;
import org.jboss.unit.driver.DriverCommand;
import org.jboss.unit.driver.AbstractTestDriver;
@@ -35,6 +37,7 @@
import org.jboss.unit.info.TestInfo;
import org.jboss.unit.info.impl.SimpleTestSuiteInfo;
import org.jboss.unit.info.impl.SimpleTestCaseInfo;
+import org.jboss.unit.info.impl.SimpleParameterInfo;
import org.jboss.unit.TestId;
import static org.jboss.unit.api.Assert.*;
@@ -54,23 +57,69 @@
public static void main(String[] args)
{
- test1();
- test2();
- test3();
- test4();
+ testNoTestCase();
+ testOneTestCase();
+ testTwoTestCases1();
+ testTwoTestCases2();
+ testParametrization();
+ testParametrizationOverride();
}
- private static void test1()
+ private static void testParametrization()
{
Driver1.init();
+ SimpleTestCaseInfo fooInfo = new SimpleTestCaseInfo("foo");
+ fooInfo.addParameter(new SimpleParameterInfo("abc"));
+ Driver1.testSuiteInfo.addTest(fooInfo);
GenericTestSuiteDef suite = new GenericTestSuiteDef(Driver1.class.getName());
+ TestDef foo = new TestDef(new TestId("foo"));
+ suite.addTest(foo);
+ ParametersDef fooParameters = new ParametersDef();
+ fooParameters.setParameter("abc", new ParameterValueDef("def", "ghi"));
+ foo.setParameters(fooParameters);
GenericTestRunner runner = new GenericTestRunner(suite);
runner.run(new TestRunnerContextSupport());
+ assertEquals(list(new TestId("foo"), new TestId("foo")), Driver1.ids);
+ HashMap<String, String> expectedParametrization1 = new HashMap<String, String>();
+ HashMap<String, String> expectedParametrization2 = new HashMap<String, String>();
+ expectedParametrization1.put("abc", "def");
+ expectedParametrization2.put("abc", "ghi");
+ assertEquals(list(expectedParametrization1, expectedParametrization2), Driver1.parametrizations);
+ }
+
+ private static void testParametrizationOverride()
+ {
+ Driver1.init();
+ SimpleTestCaseInfo fooInfo = new SimpleTestCaseInfo("foo");
+ fooInfo.addParameter(new SimpleParameterInfo("abc"));
+ Driver1.testSuiteInfo.addTest(fooInfo);
+ GenericTestSuiteDef suite = new GenericTestSuiteDef(Driver1.class.getName());
+ TestDef foo = new TestDef(new TestId("foo"));
+ suite.addTest(foo);
+ ParametersDef fooParameters = new ParametersDef();
+ fooParameters.setParameter("abc", new ParameterValueDef("def", "ghi"));
+ foo.setParameters(fooParameters);
+ GenericTestRunner runner = new GenericTestRunner(suite);
+ Map<String,String[]> parametrizations = new HashMap<String, String[]>();
+ parametrizations.put("abc", new String[]{"def"});
+ runner.run(new TestRunnerContextSupport(new ParametrizationSet(parametrizations)));
+ assertEquals(list(new TestId("foo")), Driver1.ids);
+ HashMap<String, String> expectedParametrization1 = new HashMap<String, String>();
+ expectedParametrization1.put("abc", "def");
+ assertEquals(list(expectedParametrization1), Driver1.parametrizations);
+ }
+
+ private static void testNoTestCase()
+ {
+ Driver1.init();
+ GenericTestSuiteDef suite = new GenericTestSuiteDef(Driver1.class.getName());
+ GenericTestRunner runner = new GenericTestRunner(suite);
+ runner.run(new TestRunnerContextSupport());
assertEquals(list(), Driver1.ids);
assertEquals(list(), Driver1.parametrizations);
}
- private static void test2()
+ private static void testOneTestCase()
{
Driver1.init();
Driver1.testSuiteInfo.addTest(new SimpleTestCaseInfo("foo"));
@@ -82,7 +131,7 @@
assertEquals(list(new HashMap()), Driver1.parametrizations);
}
- private static void test3()
+ private static void testTwoTestCases1()
{
Driver1.init();
Driver1.testSuiteInfo.addTest(new SimpleTestCaseInfo("foo"));
@@ -95,7 +144,7 @@
assertEquals(list(new HashMap()), Driver1.parametrizations);
}
- private static void test4()
+ private static void testTwoTestCases2()
{
Driver1.init();
Driver1.testSuiteInfo.addTest(new SimpleTestCaseInfo("foo"));
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/info/impl/SimpleTestInfo.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/info/impl/SimpleTestInfo.java 2007-10-13 12:38:42 UTC (rev 8629)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/info/impl/SimpleTestInfo.java 2007-10-13 15:22:07 UTC (rev 8630)
@@ -121,6 +121,25 @@
this.parameters = tmp;
}
+ public void addParameter(ParameterInfo parameter)
+ {
+ if (parameter == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ SimpleParameterInfo tmp = new SimpleParameterInfo(parameter);
+ parameters.put(tmp.getName(), tmp);
+ }
+
+ public void removeParameter(String name)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ parameters.remove(name);
+ }
+
public Set<String> getKeywords()
{
return Collections.unmodifiableSet(keywords);
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/runner/ParametrizationSet.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/runner/ParametrizationSet.java 2007-10-13 12:38:42 UTC (rev 8629)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/runner/ParametrizationSet.java 2007-10-13 15:22:07 UTC (rev 8630)
@@ -49,14 +49,18 @@
this.map = new HashMap<String, String[]>();
}
- public void merge(ParametrizationSet other)
+ public void combine(ParametrizationSet other) throws IllegalArgumentException
{
+ if (other == null)
+ {
+ throw new IllegalArgumentException();
+ }
for (Map.Entry<String,String[]> entry : other.map.entrySet())
{
- if (!map.containsKey(entry.getKey()))
- {
- map.put(entry.getKey(), entry.getValue().clone());
- }
+ String key = entry.getKey();
+
+ //
+ map.put(key, entry.getValue().clone());
}
}
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/TestRunnerContextSupport.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/TestRunnerContextSupport.java 2007-10-13 12:38:42 UTC (rev 8629)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/TestRunnerContextSupport.java 2007-10-13 15:22:07 UTC (rev 8630)
@@ -55,6 +55,11 @@
this(new HashMap<String, String>(), new ParametrizationSet(), NullFilter.getInstance(), eventListener);
}
+ public TestRunnerContextSupport(ParametrizationSet parametrizations)
+ {
+ this(new HashMap<String, String>(), parametrizations, NullFilter.getInstance(), new TestRunnerEventBroadcaster());
+ }
+
public TestRunnerContextSupport(ParametrizationSet parametrizations, TestRunnerEventListener eventListener)
{
this(new HashMap<String, String>(), parametrizations, NullFilter.getInstance(), eventListener);
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/generic/GenericTestRunner.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/generic/GenericTestRunner.java 2007-10-13 12:38:42 UTC (rev 8629)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/generic/GenericTestRunner.java 2007-10-13 15:22:07 UTC (rev 8630)
@@ -80,9 +80,11 @@
for (TestDef testDef : testDefs)
{
// Create parametrization
- ParametrizationSet parametrizations = def.getParameters().getParametrization();
- parametrizations.merge(testDef.getParameters().getParametrization());
+ ParametrizationSet parametrizations = def.getParameters().getParametrization().clone();
+ parametrizations.combine(testDef.getParameters().getParametrization());
+ parametrizations.combine(context.getParametrizations());
+ //
TestRunnerContextSupport genericContext = new TestRunnerContextSupport(context.getProperties(), parametrizations, context.getFilter(), tmp);
//
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/pojo/POJOTestRunner.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/pojo/POJOTestRunner.java 2007-10-13 12:38:42 UTC (rev 8629)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/pojo/POJOTestRunner.java 2007-10-13 15:22:07 UTC (rev 8630)
@@ -89,8 +89,9 @@
}
// Create parametrization
- ParametrizationSet parametrizations = suite.getParameters().getParametrization();
- parametrizations.merge(testClass.getParameters().getParametrization());
+ ParametrizationSet parametrizations = suite.getParameters().getParametrization().clone();
+ parametrizations.combine(testClass.getParameters().getParametrization());
+ parametrizations.combine(context.getParametrizations());
//
TestRunnerContextSupport pojoContext = new TestRunnerContextSupport(context.getProperties(), parametrizations, context.getFilter(), tmp);
16 years, 8 months
JBoss Portal SVN: r8629 - in modules/test/trunk: tooling and 3 other directories.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2007-10-13 08:38:42 -0400 (Sat, 13 Oct 2007)
New Revision: 8629
Added:
modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/ToolingConstants.java
Modified:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/embedded/DataSourceSupport.java
modules/test/trunk/tooling/build.xml
modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/JBossUnitTask.java
modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/TestsType.java
modules/test/trunk/tooling/src/resources/test/bobo-tests.xml
modules/test/trunk/unit/src/main/org/jboss/unit/tooling/Main.java
modules/test/trunk/unit/src/main/org/jboss/unit/tooling/MainBuilder.java
Log:
- add properties support for tooling
- remove tooling dependency on unit module
Modified: modules/test/trunk/test/src/main/org/jboss/portal/test/framework/embedded/DataSourceSupport.java
===================================================================
--- modules/test/trunk/test/src/main/org/jboss/portal/test/framework/embedded/DataSourceSupport.java 2007-10-13 12:27:59 UTC (rev 8628)
+++ modules/test/trunk/test/src/main/org/jboss/portal/test/framework/embedded/DataSourceSupport.java 2007-10-13 12:38:42 UTC (rev 8629)
@@ -304,6 +304,27 @@
{
IOTools.safeClose(in);
}
+ }
+
+ public static Config obtainConfig(String datasources, String dataSourceName) throws Exception
+ {
+ URL url = Thread.currentThread().getContextClassLoader().getResource(datasources);
+
+ Config[] configs = fromXML(url);
+
+ for (Config config : configs)
+ {
+ if (config.getName().equals(dataSourceName))
+ {
+ return config;
+ }
+ }
+
+ throw new IllegalStateException("Could not obtain Config for {datasourceName:datasources} - {" + dataSourceName + ":" + datasources + "}" );
+
}
}
+
+
+
}
Modified: modules/test/trunk/tooling/build.xml
===================================================================
--- modules/test/trunk/tooling/build.xml 2007-10-13 12:27:59 UTC (rev 8628)
+++ modules/test/trunk/tooling/build.xml 2007-10-13 12:38:42 UTC (rev 8629)
@@ -216,17 +216,15 @@
<jboss-unit>
- <tests config="/home/bdaw/Workshop/JBoss/portal/modules/test/trunk/tooling/output/resources/test/bobo-tests.xml">
- <include ids="testOne,otherTestOne"/>
- </tests>
-
+
<tests config="./output/resources/test/bobo-tests.xml" suiteName="one">
<!-- no include tag means invoke all -->
<!-- but you can still exclude some tests -->
+ <property name="propName" value="propValue"/>
<exclude id="otherTestTwo"/>
</tests>
- <tests config="./output/resources/test/bobo-tests.xml">
+ <!--<tests config="./output/resources/test/bobo-tests.xml">
<include id="testOne"/>
<include id="otherTestOne"/>
<exclude ids="testOne,testTwo"/>
@@ -240,13 +238,13 @@
<tests config="output/resources/test/bobo-tests.xml" suiteName="four">
<include keywords="simpleTag"/>
- </tests>
+ </tests>-->
- <tests config="output/resources/test/bobo-tests.xml">
+ <!--<tests config="output/resources/test/bobo-tests.xml">-->
<!-- this one should fail as attribute 'id' is exclusive -->
<!--<include id="otherTestOne" ids="testOne,testTwo" keywords="lola,lolo,loli"/>-->
- </tests>
+ <!--</tests>-->
<!-- provide noConsole="true" to disable console output -->
<reports>
Modified: modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/JBossUnitTask.java
===================================================================
--- modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/JBossUnitTask.java 2007-10-13 12:27:59 UTC (rev 8628)
+++ modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/JBossUnitTask.java 2007-10-13 12:38:42 UTC (rev 8629)
@@ -28,8 +28,6 @@
import org.apache.tools.ant.taskdefs.optional.junit.AggregateTransformer;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.FileSet;
-import org.jboss.unit.tooling.MainBuilder;
-import org.jboss.unit.report.impl.junit.JUnitTestReport;
import java.util.List;
import java.util.LinkedList;
Modified: modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/TestsType.java
===================================================================
--- modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/TestsType.java 2007-10-13 12:27:59 UTC (rev 8628)
+++ modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/TestsType.java 2007-10-13 12:38:42 UTC (rev 8629)
@@ -28,14 +28,18 @@
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.Environment;
import org.apache.tools.ant.taskdefs.Java;
-import org.jboss.unit.tooling.filter.IncludeTestFilter;
-import org.jboss.unit.tooling.filter.ExcludeTestFilter;
-import org.jboss.unit.tooling.Main;
+import static org.jboss.unit.tooling.ant.ToolingConstants.*;
+
import java.util.List;
import java.util.LinkedList;
import java.util.Set;
import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.HashSet;
/**
* @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
@@ -71,8 +75,6 @@
public void execute() throws BuildException
{
- //System.out.println("Executing Task. Includes: " + includes.size() + " excludes: " + excludes.size() + " config: " + config);
-
//Evaluate all the include filters
Java javaTask = createJava();
@@ -153,26 +155,32 @@
private void addArguments(Java javaTask)
{
- javaTask.createArg().setValue(Main.OPT_CONFIG + "=" + config);
+ javaTask.createArg().setValue(OPT_CONFIG + "=" + config);
if (getSuiteName() != null)
{
- javaTask.createArg().setValue(Main.OPT_SUITE_NAME + "=" + getSuiteName());
+ javaTask.createArg().setValue(OPT_SUITE_NAME + "=" + getSuiteName());
}
if (getReports() != null && getReports().getXmlReports() != null)
{
- javaTask.createArg().setValue(Main.OPT_XML_REPORT_DIR + "=" + getReports().getXmlReports().getToDir());
+ javaTask.createArg().setValue(OPT_XML_REPORT_DIR + "=" + getReports().getXmlReports().getToDir());
}
- // Filters to aggregate all the values
- IncludeTestFilter includeFilter = new IncludeTestFilter();
+ Set<String> includeIds = new HashSet<String>();
- ExcludeTestFilter excludeFilter = new ExcludeTestFilter();
+ Set<String> includeKeywords = new HashSet<String>();
+ Set<String> excludeIds = new HashSet<String>();
+
+ Set<String> excludeKeywords = new HashSet<String>();
+
+
+
+
for (IncludeType include : includes)
{
//Check attributes consistency
@@ -185,38 +193,29 @@
if (include.getIds() != null)
{
- includeFilter.addUnparsedNames(include.getIds());
+ addUnparsedString(includeIds, include.getIds());
}
if (include.getKeywords() != null)
{
- includeFilter.addUnparsedKeywords(include.getKeywords());
+ addUnparsedString(includeKeywords, include.getKeywords());
}
- if (include.getIdPatterns() != null)
- {
- includeFilter.addUnparsedNamePatterns(include.getIdPatterns());
- }
if (include.getId() != null)
{
- includeFilter.addUnparsedNames(include.getId());
+ addUnparsedString(includeIds, include.getId());
}
}
- if (includeFilter.getNames().size() != 0)
+ if (includeIds.size() != 0)
{
- javaTask.createArg().setValue(generateArgument(includeFilter.getNames(), Main.OPT_NAMES));
+ javaTask.createArg().setValue(generateArgument(includeIds, OPT_IDS));
}
- if (includeFilter.getNamePatterns().size() != 0)
+ if (includeKeywords.size() != 0)
{
- javaTask.createArg().setValue(generateArgument(includeFilter.getNamePatterns(), Main.OPT_PATTERNS));
+ javaTask.createArg().setValue(generateArgument(includeKeywords, OPT_KEYWORDS));
}
- if (includeFilter.getKeywords().size() != 0)
- {
- javaTask.createArg().setValue(generateArgument(includeFilter.getKeywords(), Main.OPT_KEYWORDS));
- }
-
// List<TestFilter> excludeFilters = new LinkedList<TestFilter>();
for (ExcludeType exclude : excludes)
@@ -229,41 +228,78 @@
if (exclude.getIds() != null)
{
- excludeFilter.addUnparsedNames(exclude.getIds());
+ addUnparsedString(excludeIds, exclude.getIds());
}
if (exclude.getKeywords() != null)
{
- excludeFilter.addUnparsedKeywords(exclude.getKeywords());
+ addUnparsedString(excludeKeywords, exclude.getKeywords());
}
- if (exclude.getIdPatterns() != null)
- {
- excludeFilter.addUnparsedNamePatterns(exclude.getIdPatterns());
- }
if (exclude.getId() != null)
{
- excludeFilter.addUnparsedNames(exclude.getId());
+ addUnparsedString(excludeIds, exclude.getId());
}
}
- if (excludeFilter.getNames().size() != 0)
+ if (excludeIds.size() != 0)
{
- javaTask.createArg().setValue(generateArgument(excludeFilter.getNames(), Main.OPT_EX_NAMES));
+ javaTask.createArg().setValue(generateArgument(excludeIds, OPT_EX_IDS));
}
- if (excludeFilter.getNamePatterns().size() != 0)
+ if (excludeKeywords.size() != 0)
{
- javaTask.createArg().setValue(generateArgument(excludeFilter.getNamePatterns(), Main.OPT_EX_PATTERNS));
+ javaTask.createArg().setValue(generateArgument(excludeKeywords, OPT_EX_KEYWORDS));
}
-
- if (excludeFilter.getKeywords().size() != 0)
+
+
+ if (properties.size() > 0)
{
- javaTask.createArg().setValue(generateArgument(excludeFilter.getKeywords(), Main.OPT_EX_KEYWORDS));
+
+ Map<String,String> taskProperties = new HashMap<String,String>();
+
+ for (PropertyType property : properties)
+ {
+ taskProperties.put(property.getName(),property.getValue());
+ }
+
+ updateProperties(taskProperties);
+
+
+ StringBuilder props = new StringBuilder("[");
+
+ for (Iterator<String> iterator = taskProperties.keySet().iterator(); iterator.hasNext();)
+ {
+ String propertyKey = iterator.next();
+
+ String propertyValue = taskProperties.get(propertyKey);
+
+ props.append(propertyKey + "=" + propertyValue);
+
+ if (iterator.hasNext())
+ {
+ props.append(",");
+ }
+ else
+ {
+ props.append("]");
+ }
+ }
+
+ javaTask.createArg().setValue(OPT_PROPERTIES + "=" + props);
+
}
+ }
- for (PropertyType property : properties)
+ private void addUnparsedString(Set<String> set, String valueString)
+ {
+ if (valueString == null)
{
- javaTask.createArg().setValue(Main.OPT_PROPERTY + "=" + property.getName() + "=" + property.getValue());
+ throw new IllegalArgumentException("valueString cannot be null");
}
+ String[] parsedValues = valueString.split(",");
+ for (String keyword : parsedValues)
+ {
+ set.add(keyword.trim());
+ }
}
private String generateArgument(Set<String> values, String argumentName)
@@ -280,8 +316,82 @@
}
+ private void updateProperties(Map<String,String> propMap)
+ {
+ Hashtable<String, String> sysProps = (Hashtable<String,String>)getProject().getProperties();
+
+
+
+ String sysProperties = (String)sysProps.get(JBOSS_UNIT_PROPERTIES);
+
+ if (sysProperties != null && sysProperties.length() > 0)
+ {
+ Map<String,String> parsedProps = parseProperties(sysProperties);
+ propMap.putAll(parsedProps);
+ }
+
+ for (String sysPropKey : sysProps.keySet())
+ {
+
+ if (sysPropKey.startsWith(JBOSS_UNIT_PROPERTY))
+ {
+ String propertyString = sysPropKey + "=" + sysProps.get(sysPropKey);
+
+ propertyString = propertyString.replaceFirst(JBOSS_UNIT_PROPERTY + "\\.", "");
+
+ //
+ String[] patternValues = propertyString.split("=");
+
+ //
+ if (patternValues.length != 2)
+ {
+ throw new IllegalArgumentException("Property not accepted, it should match a=b and it is " + propertyString);
+ }
+
+ propMap.put(patternValues[0],patternValues[1]);
+
+ }
+
+
+ }
+
+ }
+
+ public static Map<String,String> parseProperties(String propertiesString)
+ {
+ if (!propertiesString.matches("\\[.+=.+(,.+=.+)*\\]"))
+ {
+ throw new IllegalArgumentException("Parameters don't follow proper format: [a=b,c=d,e=f]");
+ }
+
+ Map<String,String> parsedProps = new HashMap<String,String>();
+
+ propertiesString = propertiesString.replaceAll("\\[","").replaceAll("\\]","");
+
+ String propertyGroups[] = propertiesString.split(",");
+
+ for (String propertyGroup : propertyGroups)
+ {
+
+ String property[] = propertyGroup.split("=");
+
+ //
+ if (property.length != 2)
+ {
+ throw new IllegalArgumentException("Property not accepted, it should match a=b and it is " + property);
+ }
+
+ parsedProps.put(property[0],property[1]);
+ }
+ return parsedProps;
+ }
+
+
+
+
+
public void addConfiguredInclude(IncludeType include)
{
this.includes.add(include);
@@ -302,11 +412,6 @@
this.properties.add(property);
}
- public void addTask(Task task)
- {
- //To change body of implemented methods use File | Settings | File Templates.
- }
-
public String getConfig()
{
return config;
Added: modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/ToolingConstants.java
===================================================================
--- modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/ToolingConstants.java (rev 0)
+++ modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/ToolingConstants.java 2007-10-13 12:38:42 UTC (rev 8629)
@@ -0,0 +1,63 @@
+/*
+* 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.unit.tooling.ant;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version $Revision: 0.1 $
+ */
+public final class ToolingConstants
+{
+
+ public static final String JBOSS_UNIT_PROPERTIES = "jboss.unit.properties";
+
+ public static final String JBOSS_UNIT_PROPERTY = "jboss.unit.property";
+
+ public static final String OPT_ID = "--id";
+
+ public static final String OPT_IDS = "--ids";
+
+ public static final String OPT_KEYWORDS = "--keywords";
+
+ public static final String OPT_EX_ID = "--ex_id";
+
+ public static final String OPT_EX_IDS = "--ex_ids";
+
+ public static final String OPT_EX_KEYWORDS = "--ex_keywords";
+
+ public static final String OPT_CONFIG = "--config";
+
+ public static final String OPT_SUITE_NAME = "--suite_name";
+
+ public static final String OPT_NO_CONSOLE = "--no_console";
+
+ public static final String OPT_XML_REPORT_DIR = "--xml_report_dir";
+
+ public static final String OPT_HTML_REPORT_DIR = "--html_report_dir";
+
+ public static final String OPT_PROPERTY = "--property";
+
+ public static final String OPT_PROPERTIES = "--properties";
+
+
+}
Modified: modules/test/trunk/tooling/src/resources/test/bobo-tests.xml
===================================================================
--- modules/test/trunk/tooling/src/resources/test/bobo-tests.xml 2007-10-13 12:27:59 UTC (rev 8628)
+++ modules/test/trunk/tooling/src/resources/test/bobo-tests.xml 2007-10-13 12:38:42 UTC (rev 8629)
@@ -4,10 +4,8 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:jboss:jboss-unit:1.0 jboss-unit_1_0.xsd">
<pojo>
- <test-def id="bobo">
+ <test>
<class name="org.jboss.test.unit.tooling.bobo.BoboTest1"/>
- </test-def>
- <test refid="bobo">
</test>
</pojo>
</jboss-unit>
\ No newline at end of file
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/tooling/Main.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/tooling/Main.java 2007-10-13 12:27:59 UTC (rev 8628)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/tooling/Main.java 2007-10-13 12:38:42 UTC (rev 8629)
@@ -52,32 +52,22 @@
private final TestRunnerEventBroadcaster broadcaster;
-// public static final String JBOSS_UNIT_NAMES = "jboss.unit.names";
-//
-// public static final String JBOSS_UNIT_KEYWORDS = "jboss.unit.keywords";
-//
-// public static final String JBOSS_UNIT_PATTERNS = "jboss.unit.patterns";
-//
-// public static final String JBOSS_UNIT_CONFIG = "jboss.unit.config";
-//
-// public static final String JBOSS_UNIT_SUITE_NAME = "jboss.unit.suite_name";
+ public static final String JBOSS_UNIT_PROPERTIES = "jboss.unit.properties";
+ public static final String JBOSS_UNIT_PROPERTY = "jboss.unit.property";
+
public static final String OPT_ID = "--id";
- public static final String OPT_NAMES = "--names";
+ public static final String OPT_IDS = "--ids";
public static final String OPT_KEYWORDS = "--keywords";
- public static final String OPT_PATTERNS = "--patterns";
-
public static final String OPT_EX_ID = "--ex_id";
- public static final String OPT_EX_NAMES = "--ex_names";
+ public static final String OPT_EX_IDS = "--ex_ids";
public static final String OPT_EX_KEYWORDS = "--ex_keywords";
- public static final String OPT_EX_PATTERNS = "--ex_patterns";
-
public static final String OPT_CONFIG = "--config";
public static final String OPT_SUITE_NAME = "--suite_name";
@@ -95,6 +85,8 @@
*/
public static final String OPT_PROPERTY = "--property";
+ public static final String OPT_PROPERTIES = "--properties";
+
public static final Set options;
public static final Set options_no_arg;
@@ -102,13 +94,11 @@
static {
Set<String> opts = new HashSet<String>();
opts.add(OPT_ID);
- opts.add(OPT_NAMES);
+ opts.add(OPT_IDS);
opts.add(OPT_KEYWORDS);
- opts.add(OPT_PATTERNS);
opts.add(OPT_EX_ID);
- opts.add(OPT_EX_NAMES);
+ opts.add(OPT_EX_IDS);
opts.add(OPT_EX_KEYWORDS);
- opts.add(OPT_EX_PATTERNS);
opts.add(OPT_CONFIG);
opts.add(OPT_SUITE_NAME);
opts.add(OPT_NO_CONSOLE);
@@ -159,6 +149,11 @@
public void execute()
{
+ // For now lets just be verbose. Later we need some real logging + 'debug' switch
+ System.out.println("TestRunnerContext contains: ");
+ System.out.println("Properties: " + properties.toString());
+
+
TestRunnerContextSupport runnerContext = new TestRunnerContextSupport(properties, new ParametrizationSet(), mainFilter, broadcaster);
runner.run(runnerContext);
}
@@ -186,8 +181,6 @@
MainBuilder builder = null;
-
-
if (arguments.keySet().contains(OPT_SUITE_NAME))
{
builder = new MainBuilder(arguments.get(OPT_CONFIG), arguments.get(OPT_SUITE_NAME));
@@ -200,67 +193,72 @@
}
-
- if (arguments.keySet().contains(OPT_NAMES))
+ for (String argument : arguments.keySet())
{
- builder.addUnparsedNames(arguments.get(OPT_NAMES));
- }
- if (arguments.keySet().contains(OPT_ID))
- {
- builder.addName(arguments.get(OPT_ID));
- }
+ if (argument.equals(OPT_IDS))
+ {
+ builder.addUnparsedNames(arguments.get(OPT_IDS));
+ }
- if (arguments.keySet().contains(OPT_KEYWORDS))
- {
- builder.addUnparsedKeywords(arguments.get(OPT_KEYWORDS));
- }
+ if (argument.equals(OPT_ID))
+ {
+ builder.addName(arguments.get(OPT_ID));
+ }
- if (arguments.keySet().contains(OPT_PATTERNS))
- {
- builder.addUnparsedNamePatterns(arguments.get(OPT_PATTERNS));
- }
+ if (argument.equals(OPT_KEYWORDS))
+ {
+ builder.addUnparsedKeywords(arguments.get(OPT_KEYWORDS));
+ }
- if (arguments.keySet().contains(OPT_EX_NAMES))
- {
- builder.addUnparsedExcludeNames(arguments.get(OPT_EX_NAMES));
- }
+ if (argument.equals(OPT_EX_IDS))
+ {
+ builder.addUnparsedExcludeNames(arguments.get(OPT_EX_IDS));
+ }
- if (arguments.keySet().contains(OPT_EX_ID))
- {
- builder.addExcludeName(arguments.get(OPT_EX_ID));
- }
+ if (argument.equals(OPT_EX_ID))
+ {
+ builder.addExcludeName(arguments.get(OPT_EX_ID));
+ }
- if (arguments.keySet().contains(OPT_EX_KEYWORDS))
- {
- builder.addUnparsedExcludeKeywords(arguments.get(OPT_EX_KEYWORDS));
- }
+ if (argument.equals(OPT_EX_KEYWORDS))
+ {
+ builder.addUnparsedExcludeKeywords(arguments.get(OPT_EX_KEYWORDS));
+ }
- if (arguments.keySet().contains(OPT_EX_PATTERNS))
- {
- builder.addUnparsedExcludeNamePatterns(arguments.get(OPT_EX_PATTERNS));
- }
+ if (argument.equals(OPT_NO_CONSOLE))
+ {
+ builder.setNoConsole(true);
+ }
- if (arguments.keySet().contains(OPT_NO_CONSOLE))
- {
- builder.setNoConsole(true);
- }
+ if (argument.equals(OPT_XML_REPORT_DIR))
+ {
+ builder.setXMLReportDir(arguments.get(OPT_XML_REPORT_DIR));
+ }
- if (arguments.keySet().contains(OPT_XML_REPORT_DIR))
- {
- builder.setXMLReportDir(arguments.get(OPT_XML_REPORT_DIR));
- }
+ if (argument.equals(OPT_HTML_REPORT_DIR))
+ {
+ builder.setHTMLReportDir(arguments.get(OPT_HTML_REPORT_DIR));
+ }
- if (arguments.keySet().contains(OPT_HTML_REPORT_DIR))
- {
- builder.setHTMLReportDir(arguments.get(OPT_HTML_REPORT_DIR));
- }
+ if (argument.startsWith(OPT_PROPERTY))
+ {
- if (arguments.keySet().contains(OPT_PROPERTY))
- {
- builder.addUnparsedProperty(arguments.get(OPT_PROPERTY));
+ //pass whole --properties.name=value to be parsed
+ builder.addUnparsedProperty(argument + arguments.get(OPT_PROPERTY));
+ }
+
+ if (argument.equals(OPT_PROPERTIES))
+ {
+ builder.addUnparsedProperties(arguments.get(OPT_PROPERTIES));
+ }
+
}
+
+
+
+
Main main = builder.build();
main.execute();
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/tooling/MainBuilder.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/tooling/MainBuilder.java 2007-10-13 12:27:59 UTC (rev 8628)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/tooling/MainBuilder.java 2007-10-13 12:38:42 UTC (rev 8629)
@@ -275,6 +275,8 @@
throw new IllegalArgumentException("No null property name accepted");
}
+ propertyString = propertyString.replaceFirst(Main.OPT_PROPERTY + "\\.", "");
+
//
String[] patternValues = propertyString.split("=");
@@ -305,7 +307,53 @@
return this;
}
+ public void addUnparsedProperties(String propertiesString)
+ {
+ if (propertiesString == null)
+ {
+ throw new IllegalArgumentException("Properties cannot be null");
+ }
+ Map<String, String> props = parseProperties(propertiesString);
+
+ for (String key : props.keySet())
+ {
+ addProperty(key, props.get(key));
+ }
+
+
+ }
+
+ public static Map<String,String> parseProperties(String propertiesString)
+ {
+ if (!propertiesString.matches("\\[.+=.+(,.+=.+)*\\]"))
+ {
+ throw new IllegalArgumentException("Parameters don't follow proper format: [a=b,c=d,e=f]");
+ }
+
+ Map<String,String> parsedProps = new HashMap<String,String>();
+
+ propertiesString = propertiesString.replaceAll("\\[","").replaceAll("\\]","");
+
+ String propertyGroups[] = propertiesString.split(",");
+
+ for (String propertyGroup : propertyGroups)
+ {
+ String property[] = propertyGroup.split("=");
+
+ //
+ if (property.length != 2)
+ {
+ throw new IllegalArgumentException("Property not accepted, it should match a=b and it is " + property);
+ }
+
+ parsedProps.put(property[0],property[1]);
+ }
+ return parsedProps;
+ }
+
+
+
public String getSuiteName()
{
return suiteName;
@@ -432,5 +480,6 @@
}
+
}
16 years, 8 months
JBoss Portal SVN: r8628 - in modules/test/trunk/unit/src/main/org/jboss: unit/runner and 6 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-10-13 08:27:59 -0400 (Sat, 13 Oct 2007)
New Revision: 8628
Modified:
modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/TestDriverRunnerTests.java
modules/test/trunk/unit/src/main/org/jboss/unit/runner/TestRunnerContext.java
modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/TestRunnerContextSupport.java
modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/composite/CompositeTestRunner.java
modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/driver/TestDriverRunner.java
modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/generic/GenericTestRunner.java
modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/pojo/POJOTestRunner.java
modules/test/trunk/unit/src/main/org/jboss/unit/tooling/Main.java
Log:
preliminary support for runtime parameter override
Modified: modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/TestDriverRunnerTests.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/TestDriverRunnerTests.java 2007-10-13 12:13:10 UTC (rev 8627)
+++ modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/TestDriverRunnerTests.java 2007-10-13 12:27:59 UTC (rev 8628)
@@ -132,13 +132,13 @@
}
};
testDriver.info.addTest(new SimpleTestCaseInfo("Foo"));
- TestDriverRunner runner = new TestDriverRunner(testDriver, parametrizationSet, new TestId());
+ TestDriverRunner runner = new TestDriverRunner(testDriver, new TestId());
//
EventList listener = new EventList();
//
- runner.run(new TestRunnerContextSupport(listener));
+ runner.run(new TestRunnerContextSupport(parametrizationSet, listener));
//
testDriver.assertIdList(list(new TestId("Foo")));
@@ -162,7 +162,7 @@
{
Map<String,String[]> tmp = new HashMap<String, String[]>();
tmp.put("foo", new String[]{"bar1","bar2"});
- ParametrizationSet parametrizationSet = new ParametrizationSet(tmp);
+ ParametrizationSet parametrizations = new ParametrizationSet(tmp);
//
TestDriverImpl testDriver = new TestDriverImpl()
@@ -177,13 +177,13 @@
blah.put("foo", new SimpleParameterInfo("foo"));
caseInfo.setParameters(blah);
testDriver.info.addTest(caseInfo);
- TestDriverRunner runner = new TestDriverRunner(testDriver, parametrizationSet, new TestId());
+ TestDriverRunner runner = new TestDriverRunner(testDriver, new TestId());
//
EventList listener = new EventList();
//
- runner.run(new TestRunnerContextSupport(listener));
+ runner.run(new TestRunnerContextSupport(parametrizations, listener));
//
testDriver.assertIdList(list(new TestId("Foo"), new TestId("Foo")));
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/runner/TestRunnerContext.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/runner/TestRunnerContext.java 2007-10-13 12:13:10 UTC (rev 8627)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/runner/TestRunnerContext.java 2007-10-13 12:27:59 UTC (rev 8628)
@@ -33,7 +33,7 @@
Map<String,String> getProperties();
- Map<String,String> getParameters();
+ ParametrizationSet getParametrizations();
TestFilter getFilter();
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/TestRunnerContextSupport.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/TestRunnerContextSupport.java 2007-10-13 12:13:10 UTC (rev 8627)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/TestRunnerContextSupport.java 2007-10-13 12:27:59 UTC (rev 8628)
@@ -25,6 +25,7 @@
import org.jboss.unit.runner.TestRunnerContext;
import org.jboss.unit.runner.TestFilter;
import org.jboss.unit.runner.TestRunnerEventListener;
+import org.jboss.unit.runner.ParametrizationSet;
import java.util.Map;
import java.util.HashMap;
@@ -40,7 +41,7 @@
private Map<String,String> properties;
/** . */
- private Map<String,String> parameters;
+ private ParametrizationSet parameters;
/** . */
private TestFilter filter;
@@ -51,18 +52,23 @@
public TestRunnerContextSupport(TestRunnerEventListener eventListener)
{
- this(new HashMap<String, String>(), new HashMap<String, String>(), NullFilter.getInstance(), eventListener);
+ this(new HashMap<String, String>(), new ParametrizationSet(), NullFilter.getInstance(), eventListener);
}
+ public TestRunnerContextSupport(ParametrizationSet parametrizations, TestRunnerEventListener eventListener)
+ {
+ this(new HashMap<String, String>(), parametrizations, NullFilter.getInstance(), eventListener);
+ }
+
public TestRunnerContextSupport()
{
- this(new HashMap<String, String>(), new HashMap<String, String>(), NullFilter.getInstance(), new TestRunnerEventBroadcaster());
+ this(new HashMap<String, String>(), new ParametrizationSet(), NullFilter.getInstance(), new TestRunnerEventBroadcaster());
}
- public TestRunnerContextSupport(Map<String, String> properties, Map<String, String> parameters, TestFilter filter, TestRunnerEventListener eventListener)
+ public TestRunnerContextSupport(Map<String, String> properties, ParametrizationSet parametrizations, TestFilter filter, TestRunnerEventListener eventListener)
{
this.properties = properties;
- this.parameters = parameters;
+ this.parameters = parametrizations;
this.filter = filter;
this.eventListener = eventListener;
}
@@ -72,7 +78,7 @@
return properties;
}
- public Map<String, String> getParameters()
+ public ParametrizationSet getParametrizations()
{
return parameters;
}
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/composite/CompositeTestRunner.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/composite/CompositeTestRunner.java 2007-10-13 12:13:10 UTC (rev 8627)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/composite/CompositeTestRunner.java 2007-10-13 12:27:59 UTC (rev 8628)
@@ -55,7 +55,7 @@
// Setup intermediate event filtering
TestRunnerEventBroadcaster tmp = new TestRunnerEventBroadcaster();
tmp.addListener(new TestRunnerLifeCycleFilter(context.getEventListener()));
- TestRunnerContextSupport nestedContext = new TestRunnerContextSupport(context.getProperties(), context.getParameters(), context.getFilter(), tmp);
+ TestRunnerContextSupport nestedContext = new TestRunnerContextSupport(context.getProperties(), context.getParametrizations(), context.getFilter(), tmp);
for (TestRunner runner : runners)
{
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/driver/TestDriverRunner.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/driver/TestDriverRunner.java 2007-10-13 12:13:10 UTC (rev 8627)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/driver/TestDriverRunner.java 2007-10-13 12:27:59 UTC (rev 8628)
@@ -41,7 +41,6 @@
import org.jboss.unit.runner.event.RunnerFailureEvent;
import org.jboss.unit.runner.AbstractTestRunner;
import org.jboss.unit.runner.TestResult;
-import org.jboss.unit.runner.ParametrizationSet;
import org.jboss.unit.runner.TestRunnerContext;
import java.util.Map;
@@ -67,28 +66,19 @@
private final TestDriver driver;
/** . */
- private final ParametrizationSet parametrizationSet;
-
- /** . */
private TestId testId;
- public TestDriverRunner(TestDriver driver, ParametrizationSet parametrizationSet, TestId testId)
+ public TestDriverRunner(TestDriver driver, TestId testId)
{
this.driver = driver;
- this.parametrizationSet = parametrizationSet;
this.testId = testId;
}
- public TestDriverRunner(TestDriver driver,ParametrizationSet parametrizationSet)
+ public TestDriverRunner(TestDriver driver)
{
- this(driver, parametrizationSet, null);
+ this(driver, null);
}
- public TestDriverRunner(TestDriver driver, TestId testId)
- {
- this(driver, new ParametrizationSet(), testId);
- }
-
public TestId getTestId()
{
return testId;
@@ -161,7 +151,9 @@
else
{
TestCaseInfo testCaseInfo = (TestCaseInfo)testInfo;
- for (Map<String,String> parametrization : parametrizationSet.enumerate(testCaseInfo.getParameters().keySet()))
+
+ //
+ for (Map<String,String> parametrization : context.getParametrizations().enumerate(testCaseInfo.getParameters().keySet()))
{
context.getEventListener().onEvent(new StartTestEvent(testId, testCaseInfo));
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/generic/GenericTestRunner.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/generic/GenericTestRunner.java 2007-10-13 12:13:10 UTC (rev 8627)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/generic/GenericTestRunner.java 2007-10-13 12:27:59 UTC (rev 8628)
@@ -61,7 +61,6 @@
// Setup intermediate event filtering
TestRunnerEventBroadcaster tmp = new TestRunnerEventBroadcaster();
tmp.addListener(new TestRunnerLifeCycleFilter(context.getEventListener()));
- TestRunnerContextSupport nestedContext = new TestRunnerContextSupport(context.getProperties(), context.getParameters(), context.getFilter(), tmp);
//
try
@@ -84,16 +83,18 @@
ParametrizationSet parametrizations = def.getParameters().getParametrization();
parametrizations.merge(testDef.getParameters().getParametrization());
+ TestRunnerContextSupport genericContext = new TestRunnerContextSupport(context.getProperties(), parametrizations, context.getFilter(), tmp);
+
//
- TestDriverRunner runner = new TestDriverRunner(driver, parametrizations, testDef.getRefId());
+ TestDriverRunner runner = new TestDriverRunner(driver, testDef.getRefId());
//
- runner.run(nestedContext);
+ runner.run(genericContext);
}
}
catch (Exception e)
{
- nestedContext.getEventListener().onEvent(new RunnerFailureEvent(Failure.createErrorFailure("Cannot execute test class " + className,e)));
+ context.getEventListener().onEvent(new RunnerFailureEvent(Failure.createErrorFailure("Cannot execute test class " + className,e)));
}
}
}
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/pojo/POJOTestRunner.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/pojo/POJOTestRunner.java 2007-10-13 12:13:10 UTC (rev 8627)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/pojo/POJOTestRunner.java 2007-10-13 12:27:59 UTC (rev 8628)
@@ -62,7 +62,6 @@
// Setup intermediate event filtering
TestRunnerEventBroadcaster tmp = new TestRunnerEventBroadcaster();
tmp.addListener(new TestRunnerLifeCycleFilter(context.getEventListener()));
- TestRunnerContextSupport nestedContext = new TestRunnerContextSupport(context.getProperties(), context.getParameters(), context.getFilter(), tmp);
//
for (TestClassDef testClass : suite.getTestClasses())
@@ -94,19 +93,22 @@
parametrizations.merge(testClass.getParameters().getParametrization());
//
- TestDriverRunner runner = new TestDriverRunner(driver, parametrizations);
+ TestRunnerContextSupport pojoContext = new TestRunnerContextSupport(context.getProperties(), parametrizations, context.getFilter(), tmp);
//
+ TestDriverRunner runner = new TestDriverRunner(driver);
+
+ //
for (String testCaseName : testCaseNames)
{
TestId testCaseId = new TestId(testCaseName);
runner.setTestId(testCaseId);
- runner.run(nestedContext);
+ runner.run(pojoContext);
}
}
catch (Exception e)
{
- nestedContext.getEventListener().onEvent(new RunnerFailureEvent(Failure.createErrorFailure("Cannot execute test class " + className,e)));
+ context.getEventListener().onEvent(new RunnerFailureEvent(Failure.createErrorFailure("Cannot execute test class " + className,e)));
}
}
}
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/tooling/Main.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/tooling/Main.java 2007-10-13 12:13:10 UTC (rev 8627)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/tooling/Main.java 2007-10-13 12:27:59 UTC (rev 8628)
@@ -23,6 +23,7 @@
package org.jboss.unit.tooling;
import org.jboss.unit.runner.TestRunner;
+import org.jboss.unit.runner.ParametrizationSet;
import org.jboss.unit.runner.impl.TestRunnerContextSupport;
import org.jboss.unit.runner.impl.TestRunnerEventBroadcaster;
import org.jboss.unit.runner.model.TestSuiteDef;
@@ -158,7 +159,7 @@
public void execute()
{
- TestRunnerContextSupport runnerContext = new TestRunnerContextSupport(properties, new HashMap<String, String>(), mainFilter, broadcaster);
+ TestRunnerContextSupport runnerContext = new TestRunnerContextSupport(properties, new ParametrizationSet(), mainFilter, broadcaster);
runner.run(runnerContext);
}
16 years, 8 months