JBoss Portal SVN: r8667 - in modules/test/trunk/unit/src/main/org/jboss: unit and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-10-15 18:09:35 -0400 (Mon, 15 Oct 2007)
New Revision: 8667
Modified:
modules/test/trunk/unit/src/main/org/jboss/test/unit/TestIdTests.java
modules/test/trunk/unit/src/main/org/jboss/unit/TestId.java
Log:
more meta tests
Modified: modules/test/trunk/unit/src/main/org/jboss/test/unit/TestIdTests.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/test/unit/TestIdTests.java 2007-10-15 22:04:06 UTC (rev 8666)
+++ modules/test/trunk/unit/src/main/org/jboss/test/unit/TestIdTests.java 2007-10-15 22:09:35 UTC (rev 8667)
@@ -45,18 +45,40 @@
testCtor();
testCtorThrowsIAE();
testRange();
+ testRangeThrowsIAE();
+ testGetNameThrowsIAE();
}
- private static void testRange()
+ private static void testGetNameThrowsIAE()
{
- assertValue(new TestId().range(0));
- assertValue(new TestId("abc").range(1));
- assertValue(new TestId("abc", "def").range(1), "def");
- assertValue(new TestId("abc", "def").range(2));
- assertValue(new TestId("abc", "def", "ghi").range(1), "def", "ghi");
- assertValue(new TestId("abc", "def", "ghi").range(2), "ghi");
+ try
+ {
+ new TestId().getName(-1);
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ try
+ {
+ new TestId("abc").getName(-1);
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ try
+ {
+ new TestId("abc").getName(1);
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ }
- //
+ private static void testRangeThrowsIAE()
+ {
try
{
new TestId().range(-1);
@@ -91,6 +113,16 @@
}
}
+ private static void testRange()
+ {
+ assertValue(new TestId().range(0));
+ assertValue(new TestId("abc").range(1));
+ assertValue(new TestId("abc", "def").range(1), "def");
+ assertValue(new TestId("abc", "def").range(2));
+ assertValue(new TestId("abc", "def", "ghi").range(1), "def", "ghi");
+ assertValue(new TestId("abc", "def", "ghi").range(2), "ghi");
+ }
+
private static void testEquals()
{
assertEquals(new TestId(), new TestId());
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-15 22:04:06 UTC (rev 8666)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/TestId.java 2007-10-15 22:09:35 UTC (rev 8667)
@@ -149,6 +149,11 @@
this.names = tmp;
}
+ /**
+ * Returns an iterator over the names composing this id.
+ *
+ * @return the name iterator
+ */
public Iterator<String> iterator()
{
return new Iterator<String>()
@@ -182,19 +187,38 @@
*
* @param index the name index to return
* @return the specified name
- * @throws ArrayIndexOutOfBoundsException if the index is lower than zero or greater than the value returned by <code>getLength()</code>
+ * @throws IllegalArgumentException if the index is lower than zero or greater than the value returned by <code>getLength()</code>
*/
- public String getName(int index) throws ArrayIndexOutOfBoundsException
+ public String getName(int index) throws IllegalArgumentException
{
+ if (index < 0)
+ {
+ throw new IllegalArgumentException("Index cannot be negative");
+ }
+ if (index >= names.length)
+ {
+ throw new IllegalArgumentException("Index cannot be greater than the length " + names.length);
+ }
return names[index];
}
+ /**
+ * Return the number of names composing this id.
+ *
+ * @return the length
+ */
public int getLength()
{
return names.length;
}
- public TestId range(int from)
+ /**
+ * Create a new id by using the names from the specified index up to the last one.
+ * @param from the specified index
+ * @return a new id
+ * throws IllegalArgumentException if the specified index is negative or greater than the length
+ */
+ public TestId range(int from) throws IllegalArgumentException
{
if (from < 0)
{
16 years, 8 months
JBoss Portal SVN: r8666 - in modules/test/trunk/unit/src/main/org/jboss: unit and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-10-15 18:04:06 -0400 (Mon, 15 Oct 2007)
New Revision: 8666
Added:
modules/test/trunk/unit/src/main/org/jboss/test/unit/TestIdTests.java
Modified:
modules/test/trunk/unit/src/main/org/jboss/test/unit/AllTests.java
modules/test/trunk/unit/src/main/org/jboss/unit/TestId.java
Log:
more meta tests
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-15 20:58:30 UTC (rev 8665)
+++ modules/test/trunk/unit/src/main/org/jboss/test/unit/AllTests.java 2007-10-15 22:04:06 UTC (rev 8666)
@@ -48,6 +48,9 @@
public static void main(String[] args) throws Exception
{
AssertTests.main(args);
+ TestIdTests.main(args);
+
+ //
AbstractPOJOTests.main(args);
JUnitPOJOTests.main(args);
CompositeTestRunnerTests.main(args);
Added: modules/test/trunk/unit/src/main/org/jboss/test/unit/TestIdTests.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/test/unit/TestIdTests.java (rev 0)
+++ modules/test/trunk/unit/src/main/org/jboss/test/unit/TestIdTests.java 2007-10-15 22:04:06 UTC (rev 8666)
@@ -0,0 +1,185 @@
+/******************************************************************************
+ * 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;
+
+import org.jboss.unit.TestId;
+
+import static org.jboss.unit.api.Assert.*;
+import static org.jboss.unit.util.CollectionTools.*;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.ArrayList;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class TestIdTests
+{
+
+ public static void main(String[] args)
+ {
+ testEquals();
+ testCtor();
+ testCtorThrowsIAE();
+ testRange();
+ }
+
+ private static void testRange()
+ {
+ assertValue(new TestId().range(0));
+ assertValue(new TestId("abc").range(1));
+ assertValue(new TestId("abc", "def").range(1), "def");
+ assertValue(new TestId("abc", "def").range(2));
+ assertValue(new TestId("abc", "def", "ghi").range(1), "def", "ghi");
+ assertValue(new TestId("abc", "def", "ghi").range(2), "ghi");
+
+ //
+ try
+ {
+ new TestId().range(-1);
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ try
+ {
+ new TestId().range(1);
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ try
+ {
+ new TestId("abc").range(-1);
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ try
+ {
+ new TestId("abc").range(2);
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ }
+
+ private static void testEquals()
+ {
+ assertEquals(new TestId(), new TestId());
+ assertNotEquals(new TestId(), new TestId("abc"));
+ assertNotEquals(new TestId(), new TestId("abc", "def"));
+ assertNotEquals(new TestId("abc"), new TestId());
+ assertEquals(new TestId("abc"), new TestId("abc"));
+ assertNotEquals(new TestId("abc"), new TestId("abc", "def"));
+ assertNotEquals(new TestId("abc", "def"), new TestId());
+ assertNotEquals(new TestId("abc", "def"), new TestId("abc"));
+ assertEquals(new TestId("abc", "def"), new TestId("abc", "def"));
+ }
+
+ private static void testCtor()
+ {
+ assertValue(new TestId());
+ assertValue(new TestId("abc"), "abc");
+ assertValue(new TestId("abc", "def"), "abc", "def");
+ assertValue(new TestId("abc", new TestId("def", "ghi")), "abc", "def", "ghi");
+ assertValue(new TestId(new TestId("abc", "def"), "ghi"), "abc", "def", "ghi");
+ assertValue(new TestId(list("abc", "def")), "abc", "def");
+ }
+
+ private static void testCtorThrowsIAE()
+ {
+ try
+ {
+ new TestId((String[])null);
+ fail();
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ try
+ {
+ new TestId((String)null);
+ fail();
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ try
+ {
+ new TestId((TestId)null, "abc");
+ fail();
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ try
+ {
+ new TestId("abc", (TestId)null);
+ fail();
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ try
+ {
+ new TestId((Collection<String>)null);
+ fail();
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ try
+ {
+ new TestId(Collections.singletonList((String)null));
+ fail();
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ }
+
+ private static void assertValue(TestId id, String... names)
+ {
+ assertEquals(names.length, id.getLength());
+ for (int i = 0;i < id.getLength();i++)
+ {
+ String name = id.getName(i);
+ assertEquals(names[i], name);
+ }
+ ArrayList<String> tmp = new ArrayList<String>();
+ for (Iterator<String> i = id.iterator();i.hasNext();)
+ {
+ tmp.add(i.next());
+ }
+ assertEquals(names, tmp.toArray(new String[tmp.size()]));
+
+ }
+}
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-15 20:58:30 UTC (rev 8665)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/TestId.java 2007-10-15 22:04:06 UTC (rev 8666)
@@ -44,7 +44,12 @@
this.names = new String[0];
}
- public TestId(TestId prefix, String name)
+ /**
+ * @param prefix the prefix
+ * @param name the name
+ * @throws IllegalArgumentException if any argument is null
+ */
+ public TestId(TestId prefix, String name) throws IllegalArgumentException
{
if (prefix == null)
{
@@ -64,7 +69,13 @@
this.names = names;
}
- public TestId(String name, TestId suffix)
+ /**
+ *
+ * @param name the name
+ * @param suffix the suffix
+ * @throws IllegalArgumentException if any argument is null
+ */
+ public TestId(String name, TestId suffix) throws IllegalArgumentException
{
if (suffix == null)
{
@@ -84,18 +95,11 @@
this.names = names;
}
- public TestId(String name)
- {
- if (name == null)
- {
- throw new IllegalArgumentException();
- }
- //
- this.names = new String[]{name};
- }
-
- public TestId(String... names)
+ /**
+ * @param names if the names array is null or any composite of this name is null
+ */
+ public TestId(String... names) throws IllegalArgumentException
{
if (names == null)
{
@@ -118,7 +122,11 @@
this.names = tmp;
}
- public TestId(Collection<String> names)
+ /**
+ * @param names the collection of names
+ * @throws IllegalArgumentException if the collection argument is null or any value in the collection is null
+ */
+ public TestId(Collection<String> names) throws IllegalArgumentException
{
if (names == null)
{
@@ -169,7 +177,14 @@
};
}
- public String getName(int index)
+ /**
+ * Return a name in the id.
+ *
+ * @param index the name index to return
+ * @return the specified name
+ * @throws ArrayIndexOutOfBoundsException if the index is lower than zero or greater than the value returned by <code>getLength()</code>
+ */
+ public String getName(int index) throws ArrayIndexOutOfBoundsException
{
return names[index];
}
16 years, 8 months
JBoss Portal SVN: r8665 - in modules/test/trunk: unit/src/main/org/jboss/unit/driver/impl/composite and 1 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-10-15 16:58:30 -0400 (Mon, 15 Oct 2007)
New Revision: 8665
Modified:
modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/RemoteTestDriverServer.java
modules/test/trunk/unit/src/main/org/jboss/unit/driver/impl/composite/CompositeTestDriver.java
modules/test/trunk/unit/src/main/org/jboss/unit/report/impl/writer/PrintListener.java
Log:
- allow the composite test driver to have a name
- reworked the remote test driver server to use delegation instead of inheritence which allow to decouple the life cycle of the server and the life cycle of the support for the tests
Modified: modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/RemoteTestDriverServer.java
===================================================================
--- modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/RemoteTestDriverServer.java 2007-10-15 20:14:01 UTC (rev 8664)
+++ modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/RemoteTestDriverServer.java 2007-10-15 20:58:30 UTC (rev 8665)
@@ -23,7 +23,14 @@
package org.jboss.unit.remote.driver;
import org.jboss.unit.TestId;
+import org.jboss.unit.Failure;
+import org.jboss.unit.info.TestInfo;
+import org.jboss.unit.info.impl.SimpleTestSuiteInfo;
import org.jboss.unit.driver.TestDriver;
+import org.jboss.unit.driver.DriverContext;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.DriverCommand;
+import org.jboss.unit.driver.response.FailureResponse;
import org.jboss.unit.driver.impl.composite.CompositeTestDriver;
import org.jboss.unit.remote.RequestContext;
import org.jboss.unit.remote.ResponseContext;
@@ -32,46 +39,93 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 5636 $
*/
-public class RemoteTestDriverServer extends CompositeTestDriver implements RemoteTestDriver
+public class RemoteTestDriverServer implements RemoteTestDriver
{
- public void pushContext(TestId testId, RequestContext requestContext)
+ /** . */
+ private CompositeTestDriver drivers = new CompositeTestDriver();
+
+ public CompositeTestDriver getDrivers()
{
- String name = testId.getName(0);
+ return drivers;
+ }
+ public void setDrivers(CompositeTestDriver drivers)
+ {
+ this.drivers = drivers;
+ }
+
+ public void initDriver(DriverContext context)
+ {
+ }
+
+ public void destroyDriver()
+ {
+ }
+
+ public TestInfo getInfo()
+ {
+ if (drivers == null)
+ {
+ return new SimpleTestSuiteInfo("Empty");
+ }
+
//
- TestDriver driver = drivers.get(name);
+ return drivers.getInfo();
+ }
+ public DriverResponse invoke(TestId id, DriverCommand command)
+ {
+ if (drivers == null)
+ {
+ return new FailureResponse(Failure.createErrorFailure("No such test with id " + id));
+ }
+
//
- if (driver instanceof RemoteTestDriver)
+ return drivers.invoke(id, command);
+ }
+
+ public void pushContext(TestId testId, RequestContext requestContext)
+ {
+ if (drivers != null)
{
- RemoteTestDriver remoteDriver = (RemoteTestDriver)driver;
+ String name = testId.getName(0);
//
- remoteDriver.pushContext(testId.range(1), requestContext);
+ TestDriver driver = drivers.get(name);
+
+ //
+ if (driver instanceof RemoteTestDriver)
+ {
+ RemoteTestDriver remoteDriver = (RemoteTestDriver)driver;
+
+ //
+ remoteDriver.pushContext(testId.range(1), requestContext);
+ }
}
}
public ResponseContext popContext(TestId testId)
{
- String name = testId.getName(0);
+ if (drivers != null)
+ {
+ String name = testId.getName(0);
- //
- TestDriver driver = drivers.get(name);
+ //
+ TestDriver driver = drivers.get(name);
- //
- //
- if (driver instanceof RemoteTestDriver)
- {
- RemoteTestDriver remoteDriver = (RemoteTestDriver)driver;
+ //
+ if (driver instanceof RemoteTestDriver)
+ {
+ RemoteTestDriver remoteDriver = (RemoteTestDriver)driver;
- //
- return remoteDriver.popContext(testId.range(1));
+ //
+ return remoteDriver.popContext(testId.range(1));
+ }
}
- else
- {
- return null;
- }
+
+ //
+ return null;
}
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/driver/impl/composite/CompositeTestDriver.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/driver/impl/composite/CompositeTestDriver.java 2007-10-15 20:14:01 UTC (rev 8664)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/driver/impl/composite/CompositeTestDriver.java 2007-10-15 20:58:30 UTC (rev 8665)
@@ -43,11 +43,22 @@
{
/** . */
- private final SimpleTestSuiteInfo info = new SimpleTestSuiteInfo("Main");
+ private final SimpleTestSuiteInfo info;
/** . */
protected final Map<String, TestDriver> drivers = new HashMap<String, TestDriver>();
+
+ public CompositeTestDriver()
+ {
+ this("Main");
+ }
+
+ public CompositeTestDriver(String name)
+ {
+ info = new SimpleTestSuiteInfo(name);
+ }
+
public TestInfo getInfo()
{
return info;
@@ -79,6 +90,11 @@
return driver.invoke(driverId, command);
}
+ public TestDriver get(String name)
+ {
+ return drivers.get(name);
+ }
+
public void mount(TestDriver driver)
{
synchronized(TestDriver.class)
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/report/impl/writer/PrintListener.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/report/impl/writer/PrintListener.java 2007-10-15 20:14:01 UTC (rev 8664)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/report/impl/writer/PrintListener.java 2007-10-15 20:58:30 UTC (rev 8665)
@@ -168,6 +168,7 @@
sb.append(FORMAT.format((System.currentTimeMillis() - stat.timestamp) / 1000.0));
sb.append(" sec");
sb.append(NEW_LINE);
+ sb.append(NEW_LINE);
out.print(sb);
}
16 years, 8 months
JBoss Portal SVN: r8664 - modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-10-15 16:14:01 -0400 (Mon, 15 Oct 2007)
New Revision: 8664
Modified:
modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/RemoteTestDriverClient.java
Log:
retrieve test info in the init method of the remote test driver client
Modified: modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/RemoteTestDriverClient.java
===================================================================
--- modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/RemoteTestDriverClient.java 2007-10-15 20:11:35 UTC (rev 8663)
+++ modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/RemoteTestDriverClient.java 2007-10-15 20:14:01 UTC (rev 8664)
@@ -62,6 +62,9 @@
// Services
/** . */
+ private SimpleTestSuiteInfo info;
+
+ /** . */
private DriverContext context;
/** . */
@@ -183,6 +186,15 @@
throwable.printStackTrace();
failed = new FailureResponse(Failure.createFailure("Could not deploy beans", throwable));
}
+
+ // Always retrieve meta data from the default node
+ Node node = nodeManager.getNode(NodeId.DEFAULT);
+
+ //
+ TestDriver server = getServer(node);
+
+ //
+ info = new SimpleTestSuiteInfo((TestSuiteInfo)server.getInfo());
}
public void destroyDriver()
@@ -202,14 +214,7 @@
public TestInfo getInfo()
{
- // Always retrieve meta data from the default node
- Node node = nodeManager.getNode(NodeId.DEFAULT);
-
- //
- TestDriver server = getServer(node);
-
- //
- return new SimpleTestSuiteInfo((TestSuiteInfo)server.getInfo());
+ return info;
}
public DriverResponse invoke(TestId testId, DriverCommand command)
16 years, 8 months
JBoss Portal SVN: r8663 - modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/driver.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-10-15 16:11:35 -0400 (Mon, 15 Oct 2007)
New Revision: 8663
Modified:
modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/driver/TestDriverRunner.java
Log:
re enable test case filtering
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-15 20:09:04 UTC (rev 8662)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/driver/TestDriverRunner.java 2007-10-15 20:11:35 UTC (rev 8663)
@@ -136,8 +136,8 @@
{
if (currentId.equals(targetId))
{
-// if (context.getFilter().include(currentId, currentInfo))
-// {
+ if (context.getFilter().include(currentId, currentInfo))
+ {
if (currentInfo instanceof TestSuiteInfo)
{
TestSuiteInfo testSuiteInfo = (TestSuiteInfo)currentInfo;
@@ -207,7 +207,7 @@
context.getEventListener().onEvent(new EndTestCaseEvent(currentId, result));
}
}
-// }
+ }
}
else
{
16 years, 8 months
JBoss Portal SVN: r8662 - in modules/test/trunk/unit/src/main/org/jboss: test/unit/runner and 4 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-10-15 16:09:04 -0400 (Mon, 15 Oct 2007)
New Revision: 8662
Added:
modules/test/trunk/unit/src/main/org/jboss/unit/runner/event/EndTestCaseEvent.java
modules/test/trunk/unit/src/main/org/jboss/unit/runner/event/StartTestCaseEvent.java
Removed:
modules/test/trunk/unit/src/main/org/jboss/unit/runner/event/EndTestEvent.java
modules/test/trunk/unit/src/main/org/jboss/unit/runner/event/StartTestEvent.java
Modified:
modules/test/trunk/unit/src/main/org/jboss/test/unit/report/junit/JUnitReporterTests.java
modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/AbstractTestRunnerTests.java
modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/EventList.java
modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/TestDriverRunnerTests.java
modules/test/trunk/unit/src/main/org/jboss/unit/report/impl/junit/JUnitReporter.java
modules/test/trunk/unit/src/main/org/jboss/unit/report/impl/junit/JUnitTestReport.java
modules/test/trunk/unit/src/main/org/jboss/unit/report/impl/writer/PrintListener.java
modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/driver/TestDriverRunner.java
Log:
renamed StartTestEvent and EndTestEvent to StartTestCaseEvent and EndTestCaseEvent
Modified: modules/test/trunk/unit/src/main/org/jboss/test/unit/report/junit/JUnitReporterTests.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/test/unit/report/junit/JUnitReporterTests.java 2007-10-15 20:06:37 UTC (rev 8661)
+++ modules/test/trunk/unit/src/main/org/jboss/test/unit/report/junit/JUnitReporterTests.java 2007-10-15 20:09:04 UTC (rev 8662)
@@ -28,10 +28,10 @@
import org.jboss.unit.api.Assert;
import org.jboss.unit.runner.TestResult;
import org.jboss.unit.runner.event.EndRunnerEvent;
-import org.jboss.unit.runner.event.EndTestEvent;
+import org.jboss.unit.runner.event.EndTestCaseEvent;
import org.jboss.unit.runner.event.RunnerFailureEvent;
import org.jboss.unit.runner.event.StartRunnerEvent;
-import org.jboss.unit.runner.event.StartTestEvent;
+import org.jboss.unit.runner.event.StartTestCaseEvent;
import org.jboss.unit.runner.results.TestFailure;
import org.jboss.unit.runner.results.TestSuccess;
import org.w3c.dom.Element;
@@ -96,11 +96,11 @@
report.startTestSuite(new StartRunnerEvent());
TestId testId = new TestId("foo");
- StartTestEvent startTestEvent = new StartTestEvent(testId, new MyTestInfo());
+ StartTestCaseEvent startTestEvent = new StartTestCaseEvent(testId, new MyTestInfo());
report.startTest(startTestEvent);
TestResult testResult = new TestSuccess(20);
- EndTestEvent endTestEvent = new EndTestEvent(testId, testResult);
+ EndTestCaseEvent endTestEvent = new EndTestCaseEvent(testId, testResult);
report.endTest(endTestEvent);
// end report
report.endTestSuite(new EndRunnerEvent());
@@ -125,12 +125,12 @@
report.startTestSuite(new StartRunnerEvent());
TestId testId = new TestId("foo");
- StartTestEvent startTestEvent = new StartTestEvent(testId, new MyTestInfo());
+ StartTestCaseEvent startTestEvent = new StartTestCaseEvent(testId, new MyTestInfo());
report.startTest(startTestEvent);
Failure f = new Failure("foo", new AssertionError("expecting something different."), FailureType.ASSERTION);
TestResult testResult = new TestFailure(f, 20);
- EndTestEvent endTestEvent = new EndTestEvent(testId, testResult);
+ EndTestCaseEvent endTestEvent = new EndTestCaseEvent(testId, testResult);
report.endTest(endTestEvent);
// end report
report.endTestSuite(new EndRunnerEvent());
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-15 20:06:37 UTC (rev 8661)
+++ modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/AbstractTestRunnerTests.java 2007-10-15 20:09:04 UTC (rev 8662)
@@ -27,17 +27,7 @@
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;
Modified: 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 2007-10-15 20:06:37 UTC (rev 8661)
+++ modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/EventList.java 2007-10-15 20:09:04 UTC (rev 8662)
@@ -28,8 +28,8 @@
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.StartTestCaseEvent;
+import org.jboss.unit.runner.event.EndTestCaseEvent;
import org.jboss.unit.runner.event.EndRunnerEvent;
import org.jboss.unit.runner.event.StartTestSuiteEvent;
import org.jboss.unit.runner.event.EndTestSuiteEvent;
@@ -89,14 +89,14 @@
return endEvent;
}
- protected StartTestEvent assertStartTestEvent(int index, TestId expectedTestId)
+ protected StartTestCaseEvent 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)
+ protected EndTestCaseEvent assertEndTestEvent(int index, TestId expectedTestId, TestResult expectedTestResult)
{
assertTrue(events.size() > index);
TestRunnerEvent event = assertNotNull(events.get(index));
@@ -115,16 +115,16 @@
return assertInstanceOf(event, StartRunnerEvent.class);
}
- protected static StartTestEvent assertStartTestEvent(TestRunnerEvent event, TestId expectedTestId)
+ protected static StartTestCaseEvent assertStartTestEvent(TestRunnerEvent event, TestId expectedTestId)
{
- StartTestEvent startEvent = assertInstanceOf(event, StartTestEvent.class);
+ StartTestCaseEvent startEvent = assertInstanceOf(event, StartTestCaseEvent.class);
assertEquals(expectedTestId, startEvent.getTestId());
return startEvent;
}
- protected static EndTestEvent assertEndTestEvent(TestRunnerEvent event, TestId expectedTestId, TestResult expectedTestResult)
+ protected static EndTestCaseEvent assertEndTestEvent(TestRunnerEvent event, TestId expectedTestId, TestResult expectedTestResult)
{
- EndTestEvent endEvent = assertInstanceOf(event, EndTestEvent.class);
+ EndTestCaseEvent endEvent = assertInstanceOf(event, EndTestCaseEvent.class);
assertEquals(expectedTestId, endEvent.getTestId());
TestResult testResult = endEvent.getTestResult();
if (expectedTestResult instanceof TestFailure)
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-15 20:06:37 UTC (rev 8661)
+++ modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/TestDriverRunnerTests.java 2007-10-15 20:09:04 UTC (rev 8662)
@@ -27,7 +27,7 @@
import org.jboss.unit.runner.ParametrizationSet;
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.EndTestCaseEvent;
import org.jboss.unit.driver.DriverResponse;
import org.jboss.unit.driver.DriverCommand;
import org.jboss.unit.driver.response.EndTestResponse;
@@ -182,7 +182,7 @@
Set<Map<String,String>> s1 = new HashSet<Map<String, String>>();
s1.add(new HashMap<String,String>());
Set<Map<String,String>> s2 = new HashSet<Map<String, String>>();
- s2.add(((EndTestEvent)listener.events.get(3)).getTestResult().getParametrization());
+ s2.add(((EndTestCaseEvent)listener.events.get(3)).getTestResult().getParametrization());
assertEquals(s1, s2);
}
@@ -236,8 +236,8 @@
s1.add(p1);
s1.add(p2);
Set<Map<String,String>> s2 = new HashSet<Map<String, String>>();
- s2.add(((EndTestEvent)listener.events.get(3)).getTestResult().getParametrization());
- s2.add(((EndTestEvent)listener.events.get(5)).getTestResult().getParametrization());
+ s2.add(((EndTestCaseEvent)listener.events.get(3)).getTestResult().getParametrization());
+ s2.add(((EndTestCaseEvent)listener.events.get(5)).getTestResult().getParametrization());
assertEquals(s1, s2);
}
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/report/impl/junit/JUnitReporter.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/report/impl/junit/JUnitReporter.java 2007-10-15 20:06:37 UTC (rev 8661)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/report/impl/junit/JUnitReporter.java 2007-10-15 20:09:04 UTC (rev 8662)
@@ -30,10 +30,10 @@
import org.jboss.unit.runner.TestRunnerEventListener;
import org.jboss.unit.runner.TestRunnerEvent;
import org.jboss.unit.runner.event.EndRunnerEvent;
-import org.jboss.unit.runner.event.EndTestEvent;
+import org.jboss.unit.runner.event.EndTestCaseEvent;
import org.jboss.unit.runner.event.RunnerFailureEvent;
import org.jboss.unit.runner.event.StartRunnerEvent;
-import org.jboss.unit.runner.event.StartTestEvent;
+import org.jboss.unit.runner.event.StartTestCaseEvent;
/**
*
@@ -99,13 +99,13 @@
{
report.runnerFailed((RunnerFailureEvent) event);
}
- else if (event instanceof StartTestEvent)
+ else if (event instanceof StartTestCaseEvent)
{
- report.startTest((StartTestEvent) event);
+ report.startTest((StartTestCaseEvent) event);
}
- else if (event instanceof EndTestEvent)
+ else if (event instanceof EndTestCaseEvent)
{
- report.endTest((EndTestEvent) event);
+ report.endTest((EndTestCaseEvent) event);
}
}
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/report/impl/junit/JUnitTestReport.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/report/impl/junit/JUnitTestReport.java 2007-10-15 20:06:37 UTC (rev 8661)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/report/impl/junit/JUnitTestReport.java 2007-10-15 20:09:04 UTC (rev 8662)
@@ -54,10 +54,10 @@
import org.jboss.unit.info.TestInfo;
import org.jboss.unit.runner.TestResult;
import org.jboss.unit.runner.event.EndRunnerEvent;
-import org.jboss.unit.runner.event.EndTestEvent;
+import org.jboss.unit.runner.event.EndTestCaseEvent;
import org.jboss.unit.runner.event.RunnerFailureEvent;
import org.jboss.unit.runner.event.StartRunnerEvent;
-import org.jboss.unit.runner.event.StartTestEvent;
+import org.jboss.unit.runner.event.StartTestCaseEvent;
import org.jboss.unit.runner.results.TestFailure;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -129,7 +129,7 @@
*/
}
- public void startTest(StartTestEvent event)
+ public void startTest(StartTestCaseEvent event)
{
this.startedTests.put(event.getTestId(), event.getTestInfo());
this.tests++;
@@ -149,7 +149,7 @@
rootElement.appendChild(e);
}
- public void endTest(EndTestEvent event)
+ public void endTest(EndTestCaseEvent event)
{
TestId testId = event.getTestId();
TestResult result = event.getTestResult();
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/report/impl/writer/PrintListener.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/report/impl/writer/PrintListener.java 2007-10-15 20:06:37 UTC (rev 8661)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/report/impl/writer/PrintListener.java 2007-10-15 20:09:04 UTC (rev 8662)
@@ -23,15 +23,14 @@
package org.jboss.unit.report.impl.writer;
import org.jboss.unit.Failure;
-import org.jboss.unit.TestId;
import org.jboss.unit.runner.TestResult;
import org.jboss.unit.runner.TestRunnerEvent;
import org.jboss.unit.runner.TestRunnerEventListener;
import org.jboss.unit.runner.event.EndRunnerEvent;
-import org.jboss.unit.runner.event.EndTestEvent;
+import org.jboss.unit.runner.event.EndTestCaseEvent;
import org.jboss.unit.runner.event.RunnerFailureEvent;
import org.jboss.unit.runner.event.StartRunnerEvent;
-import org.jboss.unit.runner.event.StartTestEvent;
+import org.jboss.unit.runner.event.StartTestCaseEvent;
import org.jboss.unit.runner.event.StartTestSuiteEvent;
import org.jboss.unit.runner.event.EndTestSuiteEvent;
import org.jboss.unit.runner.results.TestFailure;
@@ -135,9 +134,9 @@
StartTestSuiteEvent stse = (StartTestSuiteEvent)event;
stack.add(new SuiteStat(stse.getTestInfo().getName()));
}
- else if (event instanceof StartTestEvent)
+ else if (event instanceof StartTestCaseEvent)
{
- StartTestEvent ste = (StartTestEvent)event;
+ StartTestCaseEvent ste = (StartTestCaseEvent)event;
currentTestCaseName = ste.getTestInfo().getName();
}
else if (event instanceof EndTestSuiteEvent)
@@ -172,12 +171,12 @@
out.print(sb);
}
- else if (event instanceof EndTestEvent)
+ else if (event instanceof EndTestCaseEvent)
{
stack.getLast().count++;
//
- EndTestEvent endTestEvent = (EndTestEvent)event;
+ EndTestCaseEvent endTestEvent = (EndTestCaseEvent)event;
TestResult testResult = endTestEvent.getTestResult();
StringBuffer name = new StringBuffer(currentTestCaseName);
Copied: modules/test/trunk/unit/src/main/org/jboss/unit/runner/event/EndTestCaseEvent.java (from rev 8634, modules/test/trunk/unit/src/main/org/jboss/unit/runner/event/EndTestEvent.java)
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/runner/event/EndTestCaseEvent.java (rev 0)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/runner/event/EndTestCaseEvent.java 2007-10-15 20:09:04 UTC (rev 8662)
@@ -0,0 +1,57 @@
+/******************************************************************************
+ * 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.event;
+
+import org.jboss.unit.runner.TestRunnerEvent;
+import org.jboss.unit.runner.TestResult;
+import org.jboss.unit.TestId;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class EndTestCaseEvent extends TestRunnerEvent
+{
+
+ /** . */
+ private final TestId testId;
+
+ /** . */
+ private final TestResult testResult;
+
+ public EndTestCaseEvent(TestId testId, TestResult testResult)
+ {
+ this.testId = testId;
+ this.testResult = testResult;
+ }
+
+ public TestId getTestId()
+ {
+ return testId;
+ }
+
+ public TestResult getTestResult()
+ {
+ return testResult;
+ }
+}
Deleted: modules/test/trunk/unit/src/main/org/jboss/unit/runner/event/EndTestEvent.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/runner/event/EndTestEvent.java 2007-10-15 20:06:37 UTC (rev 8661)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/runner/event/EndTestEvent.java 2007-10-15 20:09:04 UTC (rev 8662)
@@ -1,57 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.unit.runner.event;
-
-import org.jboss.unit.runner.TestRunnerEvent;
-import org.jboss.unit.runner.TestResult;
-import org.jboss.unit.TestId;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class EndTestEvent extends TestRunnerEvent
-{
-
- /** . */
- private final TestId testId;
-
- /** . */
- private final TestResult testResult;
-
- public EndTestEvent(TestId testId, TestResult testResult)
- {
- this.testId = testId;
- this.testResult = testResult;
- }
-
- public TestId getTestId()
- {
- return testId;
- }
-
- public TestResult getTestResult()
- {
- return testResult;
- }
-}
Copied: modules/test/trunk/unit/src/main/org/jboss/unit/runner/event/StartTestCaseEvent.java (from rev 8634, modules/test/trunk/unit/src/main/org/jboss/unit/runner/event/StartTestEvent.java)
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/runner/event/StartTestCaseEvent.java (rev 0)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/runner/event/StartTestCaseEvent.java 2007-10-15 20:09:04 UTC (rev 8662)
@@ -0,0 +1,57 @@
+/******************************************************************************
+ * 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.event;
+
+import org.jboss.unit.runner.TestRunnerEvent;
+import org.jboss.unit.TestId;
+import org.jboss.unit.info.TestInfo;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class StartTestCaseEvent extends TestRunnerEvent
+{
+
+ /** . */
+ private final TestId testId;
+
+ /** . */
+ private final TestInfo testInfo;
+
+ public StartTestCaseEvent(TestId testId, TestInfo testInfo)
+ {
+ this.testId = testId;
+ this.testInfo = testInfo;
+ }
+
+ public TestId getTestId()
+ {
+ return testId;
+ }
+
+ public TestInfo getTestInfo()
+ {
+ return testInfo;
+ }
+}
Deleted: modules/test/trunk/unit/src/main/org/jboss/unit/runner/event/StartTestEvent.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/runner/event/StartTestEvent.java 2007-10-15 20:06:37 UTC (rev 8661)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/runner/event/StartTestEvent.java 2007-10-15 20:09:04 UTC (rev 8662)
@@ -1,57 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.unit.runner.event;
-
-import org.jboss.unit.runner.TestRunnerEvent;
-import org.jboss.unit.TestId;
-import org.jboss.unit.info.TestInfo;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class StartTestEvent extends TestRunnerEvent
-{
-
- /** . */
- private final TestId testId;
-
- /** . */
- private final TestInfo testInfo;
-
- public StartTestEvent(TestId testId, TestInfo testInfo)
- {
- this.testId = testId;
- this.testInfo = testInfo;
- }
-
- public TestId getTestId()
- {
- return testId;
- }
-
- public TestInfo getTestInfo()
- {
- return testInfo;
- }
-}
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-15 20:06:37 UTC (rev 8661)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/driver/TestDriverRunner.java 2007-10-15 20:09:04 UTC (rev 8662)
@@ -36,8 +36,8 @@
import org.jboss.unit.FailureType;
import org.jboss.unit.runner.results.TestSuccess;
import org.jboss.unit.runner.results.TestFailure;
-import org.jboss.unit.runner.event.StartTestEvent;
-import org.jboss.unit.runner.event.EndTestEvent;
+import org.jboss.unit.runner.event.StartTestCaseEvent;
+import org.jboss.unit.runner.event.EndTestCaseEvent;
import org.jboss.unit.runner.event.RunnerFailureEvent;
import org.jboss.unit.runner.event.StartTestSuiteEvent;
import org.jboss.unit.runner.event.EndTestSuiteEvent;
@@ -167,7 +167,7 @@
//
for (Map<String,String> parametrization : context.getParametrizations().enumerate(testCaseInfo.getParameters().keySet()))
{
- context.getEventListener().onEvent(new StartTestEvent(currentId, testCaseInfo));
+ context.getEventListener().onEvent(new StartTestCaseEvent(currentId, testCaseInfo));
//
StartTestCommand command = new StartTestCommand(parametrization);
@@ -204,7 +204,7 @@
}
//
- context.getEventListener().onEvent(new EndTestEvent(currentId, result));
+ context.getEventListener().onEvent(new EndTestCaseEvent(currentId, result));
}
}
// }
16 years, 8 months
JBoss Portal SVN: r8661 - in modules/test/trunk: unit/src/main/org/jboss/test/unit and 11 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-10-15 16:06:37 -0400 (Mon, 15 Oct 2007)
New Revision: 8661
Added:
modules/test/trunk/unit/src/main/org/jboss/unit/runner/event/EndTestSuiteEvent.java
modules/test/trunk/unit/src/main/org/jboss/unit/runner/event/StartTestSuiteEvent.java
Modified:
modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/RemoteTestDriverClient.java
modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/TestConversation.java
modules/test/trunk/unit/src/main/org/jboss/test/unit/AllTests.java
modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/EventList.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/report/impl/writer/PrintListener.java
modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/DelegateRunnerEventFilter.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/runner/model/ModelBuilder.java
modules/test/trunk/unit/src/main/org/jboss/unit/runner/model/generic/GenericTestSuiteDef.java
modules/test/trunk/unit/src/resources/jboss-unit-jar/org/jboss/unit/runner/model/jboss-unit_1_0.xsd
modules/test/trunk/unit/src/resources/test/org/jboss/test/unit/runner/model/f2.xml
Log:
- introduced test suite events
- improve the console formatter to look like junit console report
Modified: modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/RemoteTestDriverClient.java
===================================================================
--- modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/RemoteTestDriverClient.java 2007-10-15 19:28:21 UTC (rev 8660)
+++ modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/RemoteTestDriverClient.java 2007-10-15 20:06:37 UTC (rev 8661)
@@ -36,6 +36,7 @@
import org.jboss.portal.test.framework.server.NodeId;
import org.jboss.portal.test.framework.server.Node;
import org.jboss.portal.test.framework.server.NodeManager;
+import org.jboss.portal.test.framework.deployment.Deployer;
import org.jboss.kernel.plugins.bootstrap.basic.BasicBootstrap;
import org.jboss.kernel.plugins.deployment.xml.BeanXMLDeployer;
import org.jboss.kernel.spi.deployment.KernelDeployment;
@@ -72,6 +73,9 @@
/** . */
private String archivePath;
+ /** . */
+ private Deployer deployer;
+
// public String getInitialNodeId()
// {
// return initialNodeId;
@@ -109,6 +113,17 @@
this.protocolHandler = protocolHandler;
}
+ public Deployer getDeployer()
+ {
+ return deployer;
+ }
+
+ @Inject(bean="Deployer")
+ public void setDeployer(Deployer deployer)
+ {
+ this.deployer = deployer;
+ }
+
public RemoteTestDriver getServer(Node node)
{
return (RemoteTestDriver)node.lookupService(RemoteTestDriver.SERVICE_ID);
@@ -154,6 +169,14 @@
beanDeployer = new BeanXMLDeployer(getKernel());
deployment = beanDeployer.deploy(url);
beanDeployer.validate();
+
+ // Perform the remote deployment if necessary
+ String archiveId = context.getProperty("archiveId");
+ if (archiveId != null)
+ {
+ Node node = nodeManager.getNode(NodeId.DEFAULT);
+ deployer.deploy(archivePath, archiveId, node);
+ }
}
catch (Throwable throwable)
{
Modified: modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/TestConversation.java
===================================================================
--- modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/TestConversation.java 2007-10-15 19:28:21 UTC (rev 8660)
+++ modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/TestConversation.java 2007-10-15 20:06:37 UTC (rev 8661)
@@ -26,9 +26,11 @@
import org.jboss.unit.driver.DriverCommand;
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.remote.RequestContext;
import org.jboss.unit.remote.ResponseContext;
import org.jboss.unit.TestId;
+import org.jboss.unit.Failure;
import org.jboss.portal.test.framework.server.Node;
import java.util.Map;
@@ -109,7 +111,7 @@
DriverResponse response = respCtx.getResponse();
//
- if (response instanceof EndTestResponse)
+ if (response instanceof EndTestResponse || response instanceof FailureResponse)
{
return response;
}
@@ -118,6 +120,12 @@
commandContext = protocolHandler.handleResponse(this, respCtx);
//
+ if (commandContext == null)
+ {
+ return new FailureResponse(Failure.createErrorFailure("Response " + response + " was not handled"));
+ }
+
+ //
return handleCommand(commandContext);
}
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-15 19:28:21 UTC (rev 8660)
+++ modules/test/trunk/unit/src/main/org/jboss/test/unit/AllTests.java 2007-10-15 20:06:37 UTC (rev 8661)
@@ -66,11 +66,11 @@
//
BlahTests.main(args);
-
+
//
BlahTestTwo.main(args);
-
- //
+
+ //
JUnitReporterTests.main(args);
}
}
Modified: 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 2007-10-15 19:28:21 UTC (rev 8660)
+++ modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/EventList.java 2007-10-15 20:06:37 UTC (rev 8661)
@@ -31,6 +31,8 @@
import org.jboss.unit.runner.event.StartTestEvent;
import org.jboss.unit.runner.event.EndTestEvent;
import org.jboss.unit.runner.event.EndRunnerEvent;
+import org.jboss.unit.runner.event.StartTestSuiteEvent;
+import org.jboss.unit.runner.event.EndTestSuiteEvent;
import static org.jboss.unit.api.Assert.*;
import org.jboss.unit.TestId;
@@ -59,6 +61,34 @@
return assertStartRunnerEvent(event);
}
+ protected StartTestSuiteEvent assertStartTestSuiteEvent(int index, TestId expectedTestId)
+ {
+ assertTrue(events.size() > index);
+ TestRunnerEvent event = assertNotNull(events.get(index));
+ return assertStartTestSuiteEvent(event, expectedTestId);
+ }
+
+ protected StartTestSuiteEvent assertStartTestSuiteEvent(TestRunnerEvent event, TestId expectedTestId)
+ {
+ StartTestSuiteEvent startEvent = assertInstanceOf(event, StartTestSuiteEvent.class);
+ assertEquals(expectedTestId, startEvent.getTestId());
+ return startEvent;
+ }
+
+ protected EndTestSuiteEvent assertEndTestSuiteEvent(int index, TestId expectedTestId)
+ {
+ assertTrue(events.size() > index);
+ TestRunnerEvent event = assertNotNull(events.get(index));
+ return assertEndTestSuiteEvent(event, expectedTestId);
+ }
+
+ protected EndTestSuiteEvent assertEndTestSuiteEvent(TestRunnerEvent event, TestId expectedTestId)
+ {
+ EndTestSuiteEvent endEvent = assertInstanceOf(event, EndTestSuiteEvent.class);
+ assertEquals(expectedTestId, endEvent.getTestId());
+ return endEvent;
+ }
+
protected StartTestEvent assertStartTestEvent(int index, TestId expectedTestId)
{
assertTrue(events.size() > index);
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-15 19:28:21 UTC (rev 8660)
+++ modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/GenericTestRunnerTests.java 2007-10-15 20:06:37 UTC (rev 8661)
@@ -75,7 +75,7 @@
Driver1.init();
SimpleTestCaseInfo fooInfo = new SimpleTestCaseInfo("foo");
Driver1.testSuiteInfo.addTest(fooInfo);
- GenericTestSuiteDef suite = new GenericTestSuiteDef("generic", Driver1.class.getName());
+ GenericTestSuiteDef suite = new GenericTestSuiteDef(Driver1.class.getName());
suite.setProperty("foo_def", "foo_def_value");
GenericTestRunner runner = new GenericTestRunner(suite);
runner.run(new TestRunnerContextSupport());
@@ -89,7 +89,7 @@
Driver1.init();
SimpleTestCaseInfo fooInfo = new SimpleTestCaseInfo("foo");
Driver1.testSuiteInfo.addTest(fooInfo);
- GenericTestSuiteDef suite = new GenericTestSuiteDef("generic", Driver1.class.getName());
+ GenericTestSuiteDef suite = new GenericTestSuiteDef(Driver1.class.getName());
GenericTestRunner runner = new GenericTestRunner(suite);
Map<String, String> properties = new HashMap<String, String>();
properties.put("foo_runner", "foo_runner_value");
@@ -104,7 +104,7 @@
Driver1.init();
SimpleTestCaseInfo fooInfo = new SimpleTestCaseInfo("foo");
Driver1.testSuiteInfo.addTest(fooInfo);
- GenericTestSuiteDef suite = new GenericTestSuiteDef("generic", Driver1.class.getName());
+ GenericTestSuiteDef suite = new GenericTestSuiteDef(Driver1.class.getName());
suite.setProperty("foo_def", "foo_def_value");
suite.setProperty("bar", "bar_def_value");
GenericTestRunner runner = new GenericTestRunner(suite);
@@ -125,7 +125,7 @@
SimpleTestCaseInfo fooInfo = new SimpleTestCaseInfo("foo");
fooInfo.addParameter(new SimpleParameterInfo("abc"));
Driver1.testSuiteInfo.addTest(fooInfo);
- GenericTestSuiteDef suite = new GenericTestSuiteDef("generic", Driver1.class.getName());
+ GenericTestSuiteDef suite = new GenericTestSuiteDef(Driver1.class.getName());
TestDef foo = new TestDef(new TestId("foo"));
suite.addTest(foo);
ParametersDef fooParameters = new ParametersDef();
@@ -134,13 +134,14 @@
EventList events = new EventList();
GenericTestRunner runner = new GenericTestRunner(suite);
runner.run(new TestRunnerContextSupport(events));
- assertEquals(6, events.events.size());
+ assertEquals(8, 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);
+ events.assertStartTestSuiteEvent(1, new TestId());
+ events.assertStartTestEvent(2, new TestId("foo"));
+ events.assertEndTestEvent(3, new TestId("foo"), new TestSuccess(0));
+ events.assertStartTestEvent(4, new TestId("foo"));
+ events.assertEndTestEvent(5, new TestId("foo"), new TestSuccess(0));
+ events.assertEndRunnerEvent(7);
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>();
@@ -155,7 +156,7 @@
SimpleTestCaseInfo fooInfo = new SimpleTestCaseInfo("foo");
fooInfo.addParameter(new SimpleParameterInfo("abc"));
Driver1.testSuiteInfo.addTest(fooInfo);
- GenericTestSuiteDef suite = new GenericTestSuiteDef("generic", Driver1.class.getName());
+ GenericTestSuiteDef suite = new GenericTestSuiteDef(Driver1.class.getName());
TestDef foo = new TestDef(new TestId("foo"));
suite.addTest(foo);
ParametersDef fooParameters = new ParametersDef();
@@ -166,11 +167,11 @@
EventList events = new EventList();
GenericTestRunner runner = new GenericTestRunner(suite);
runner.run(new TestRunnerContextSupport(new ParametrizationSet(parametrizations), events));
- assertEquals(4, events.events.size());
+ 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.assertEndRunnerEvent(3);
+ events.assertStartTestEvent(2, new TestId("foo"));
+ events.assertEndTestEvent(3, new TestId("foo"), new TestSuccess(0));
+ events.assertEndRunnerEvent(5);
assertEquals(list(new TestId("foo")), Driver1.ids);
HashMap<String, String> expectedParametrization1 = new HashMap<String, String>();
expectedParametrization1.put("abc", "def");
@@ -180,13 +181,13 @@
private static void testNoTestCase()
{
Driver1.init();
- GenericTestSuiteDef suite = new GenericTestSuiteDef("generic", Driver1.class.getName());
+ GenericTestSuiteDef suite = new GenericTestSuiteDef(Driver1.class.getName());
EventList events = new EventList();
GenericTestRunner runner = new GenericTestRunner(suite);
runner.run(new TestRunnerContextSupport(events));
- assertEquals(2, events.events.size());
+ assertEquals(4, events.events.size());
events.assertStartRunnerEvent(0);
- events.assertEndRunnerEvent(1);
+ events.assertEndRunnerEvent(3);
assertEquals(list(), Driver1.ids);
assertEquals(list(), Driver1.parametrizations);
}
@@ -195,16 +196,16 @@
{
Driver1.init();
Driver1.testSuiteInfo.addTest(new SimpleTestCaseInfo("foo"));
- GenericTestSuiteDef suite = new GenericTestSuiteDef("generic", Driver1.class.getName());
+ 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(events));
- assertEquals(4, events.events.size());
+ 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.assertEndRunnerEvent(3);
+ events.assertStartTestEvent(2, new TestId("foo"));
+ events.assertEndTestEvent(3, new TestId("foo"), new TestSuccess(0));
+ events.assertEndRunnerEvent(5);
assertEquals(list(new TestId("foo")), Driver1.ids);
assertEquals(list(new HashMap()), Driver1.parametrizations);
}
@@ -214,16 +215,16 @@
Driver1.init();
Driver1.testSuiteInfo.addTest(new SimpleTestCaseInfo("foo"));
Driver1.testSuiteInfo.addTest(new SimpleTestCaseInfo("bar"));
- GenericTestSuiteDef suite = new GenericTestSuiteDef("generic", Driver1.class.getName());
+ 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(events));
- assertEquals(4, events.events.size());
+ 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.assertEndRunnerEvent(3);
+ events.assertStartTestEvent(2, new TestId("foo"));
+ events.assertEndTestEvent(3, new TestId("foo"), new TestSuccess(0));
+ events.assertEndRunnerEvent(5);
assertEquals(list(new TestId("foo")), Driver1.ids);
assertEquals(list(new HashMap()), Driver1.parametrizations);
}
@@ -233,17 +234,17 @@
Driver1.init();
Driver1.testSuiteInfo.addTest(new SimpleTestCaseInfo("foo"));
Driver1.testSuiteInfo.addTest(new SimpleTestCaseInfo("bar"));
- GenericTestSuiteDef suite = new GenericTestSuiteDef("generic", Driver1.class.getName());
+ GenericTestSuiteDef suite = new GenericTestSuiteDef(Driver1.class.getName());
EventList events = new EventList();
GenericTestRunner runner = new GenericTestRunner(suite);
runner.run(new TestRunnerContextSupport(events));
- assertEquals(6, events.events.size());
+ assertEquals(8, 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);
+ events.assertStartTestEvent(2, new TestId("foo"));
+ events.assertEndTestEvent(3, new TestId("foo"), new TestSuccess(0));
+ events.assertStartTestEvent(4, new TestId("bar"));
+ events.assertEndTestEvent(5, new TestId("bar"), new TestSuccess(0));
+ events.assertEndRunnerEvent(7);
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-15 19:28:21 UTC (rev 8660)
+++ modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/POJOTestRunnerTests.java 2007-10-15 20:06:37 UTC (rev 8661)
@@ -75,11 +75,11 @@
assertEquals("bar_def", pojo1_1.foo);
//
- assertEquals(4, listener.events.size());
+ assertEquals(6, listener.events.size());
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);
+ listener.assertStartTestEvent(2, new TestId("test"));
+ listener.assertEndTestEvent(3, new TestId("test"), new TestSuccess(0));
+ listener.assertEndRunnerEvent(5);
}
private static void testPOJO1_2()
@@ -110,13 +110,13 @@
assertEquals("bar_runtime_2", pojo1_2.foo);
//
- assertEquals(6, listener.events.size());
+ assertEquals(8, listener.events.size());
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);
+ listener.assertStartTestEvent(2, new TestId("test"));
+ listener.assertEndTestEvent(3, new TestId("test"), new TestSuccess(0));
+ listener.assertStartTestEvent(4, new TestId("test"));
+ listener.assertEndTestEvent(5, new TestId("test"), new TestSuccess(0));
+ listener.assertEndRunnerEvent(7);
}
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-15 19:28:21 UTC (rev 8660)
+++ modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/TestDriverRunnerTests.java 2007-10-15 20:06:37 UTC (rev 8661)
@@ -34,6 +34,7 @@
import org.jboss.unit.driver.response.FailureResponse;
import org.jboss.unit.info.impl.SimpleTestCaseInfo;
import org.jboss.unit.info.impl.SimpleParameterInfo;
+import org.jboss.unit.info.impl.SimpleTestSuiteInfo;
import org.jboss.unit.TestId;
import org.jboss.unit.FailureType;
import org.jboss.unit.Failure;
@@ -71,8 +72,43 @@
//
testInvokeTestSuite();
+
+ //
+ testEvents1();
}
+ private static void testEvents1()
+ {
+ TestDriverImpl testDriver = new TestDriverImpl()
+ {
+ public DriverResponse invoke2(TestId id, DriverCommand command)
+ {
+ return new EndTestResponse();
+ }
+ };
+ SimpleTestSuiteInfo fooSuite = new SimpleTestSuiteInfo("Foo");
+ fooSuite.addTest(new SimpleTestCaseInfo("Bar"));
+ testDriver.info.addTest(fooSuite);
+ TestDriverRunner runner = new TestDriverRunner(testDriver, new TestId("Foo","Bar"));
+ EventList listener = new EventList();
+
+ //
+ runner.run(new TestRunnerContextSupport(listener));
+
+ //
+ testDriver.assertIdList(list(new TestId("Foo", "Bar")));
+
+ //
+ assertEquals(8, listener.events.size());
+ listener.assertStartRunnerEvent(0);
+ listener.assertStartTestSuiteEvent(1, new TestId());
+ listener.assertStartTestSuiteEvent(2, new TestId("Foo"));
+ listener.assertEndTestEvent(4, new TestId("Foo", "Bar"), new TestSuccess(0));
+ listener.assertEndTestSuiteEvent(5, new TestId("Foo"));
+ listener.assertEndTestSuiteEvent(6, new TestId());
+ listener.assertEndRunnerEvent(7);
+ }
+
private static void testInvokeTestSuite()
{
TestDriverImpl testDriver = new TestDriverImpl()
@@ -96,13 +132,15 @@
testDriver.assertIdList(list(new TestId("Foo"), new TestId("Bar")));
//
- assertEquals(6, listener.events.size());
+ assertEquals(8, listener.events.size());
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);
+ listener.assertStartTestSuiteEvent(1, new TestId());
+ listener.assertStartTestEvent(2, new TestId("Foo"));
+ listener.assertEndTestEvent(3, new TestId("Foo"), new TestSuccess(0));
+ listener.assertStartTestEvent(4, new TestId("Bar"));
+ listener.assertEndTestEvent(5, new TestId("Bar"), new TestSuccess(0));
+ listener.assertEndTestSuiteEvent(6, new TestId());
+ listener.assertEndRunnerEvent(7);
}
private static void testInvokeTestCaseWithParameters1()
@@ -132,17 +170,19 @@
testDriver.assertIdList(list(new TestId("Foo")));
//
- assertEquals(4, listener.events.size());
+ assertEquals(6, listener.events.size());
listener.assertStartRunnerEvent(0);
- listener.assertStartTestEvent(1, new TestId("Foo"));
- listener.assertEndTestEvent(2, new TestId("Foo"), new TestSuccess(0));
- listener.assertEndRunnerEvent(3);
+ listener.assertStartTestSuiteEvent(1, new TestId());
+ listener.assertStartTestEvent(2, new TestId("Foo"));
+ listener.assertEndTestEvent(3, new TestId("Foo"), new TestSuccess(0));
+ listener.assertEndTestSuiteEvent(4, new TestId());
+ listener.assertEndRunnerEvent(5);
// Check parametrization
Set<Map<String,String>> s1 = new HashSet<Map<String, String>>();
s1.add(new HashMap<String,String>());
Set<Map<String,String>> s2 = new HashSet<Map<String, String>>();
- s2.add(((EndTestEvent)listener.events.get(2)).getTestResult().getParametrization());
+ s2.add(((EndTestEvent)listener.events.get(3)).getTestResult().getParametrization());
assertEquals(s1, s2);
}
@@ -177,13 +217,15 @@
testDriver.assertIdList(list(new TestId("Foo"), new TestId("Foo")));
//
- assertEquals(6, listener.events.size());
+ assertEquals(8, listener.events.size());
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);
+ listener.assertStartTestSuiteEvent(1, new TestId());
+ listener.assertStartTestEvent(2, new TestId("Foo"));
+ listener.assertEndTestEvent(3, new TestId("Foo"), new TestSuccess(0));
+ listener.assertStartTestEvent(4, new TestId("Foo"));
+ listener.assertEndTestEvent(5, new TestId("Foo"), new TestSuccess(0));
+ listener.assertEndTestSuiteEvent(6, new TestId());
+ listener.assertEndRunnerEvent(7);
// Check parametrization
Set<Map<String,String>> s1 = new HashSet<Map<String, String>>();
@@ -194,8 +236,8 @@
s1.add(p1);
s1.add(p2);
Set<Map<String,String>> s2 = new HashSet<Map<String, String>>();
- s2.add(((EndTestEvent)listener.events.get(2)).getTestResult().getParametrization());
- s2.add(((EndTestEvent)listener.events.get(4)).getTestResult().getParametrization());
+ s2.add(((EndTestEvent)listener.events.get(3)).getTestResult().getParametrization());
+ s2.add(((EndTestEvent)listener.events.get(5)).getTestResult().getParametrization());
assertEquals(s1, s2);
}
@@ -214,9 +256,9 @@
testDriver.assertIdList(new ArrayList<TestId>());
//
- assertEquals(2, listener.events.size());
+ assertEquals(4, listener.events.size());
listener.assertStartRunnerEvent(0);
- listener.assertEndRunnerEvent(1);
+ listener.assertEndRunnerEvent(3);
}
private static void testTestDriverInvokeTestCaseReturnsNull()
@@ -233,11 +275,13 @@
testDriver.assertIdList(list(new TestId("Foo")));
//
- assertEquals(4, listener.events.size());
+ assertEquals(6, listener.events.size());
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);
+ listener.assertStartTestSuiteEvent(1, new TestId());
+ listener.assertStartTestEvent(2, new TestId("Foo"));
+ listener.assertEndTestEvent(3, new TestId("Foo"), new TestFailure(new Failure("", FailureType.ERROR), 0));
+ listener.assertEndTestSuiteEvent(4, new TestId());
+ listener.assertEndRunnerEvent(5);
}
private static void testTestDriverInvokeTestCaseReturnsAnEndTestResponse()
@@ -260,11 +304,13 @@
testDriver.assertIdList(list(new TestId("Foo")));
//
- assertEquals(4, listener.events.size());
+ assertEquals(6, listener.events.size());
listener.assertStartRunnerEvent(0);
- listener.assertStartTestEvent(1, new TestId("Foo"));
- listener.assertEndTestEvent(2, new TestId("Foo"), new TestSuccess(0));
- listener.assertEndRunnerEvent(3);
+ listener.assertStartTestSuiteEvent(1, new TestId());
+ listener.assertStartTestEvent(2, new TestId("Foo"));
+ listener.assertEndTestEvent(3, new TestId("Foo"), new TestSuccess(0));
+ listener.assertEndTestSuiteEvent(4, new TestId());
+ listener.assertEndRunnerEvent(5);
}
private static void testTestDriverInvokeTestCaseReturnsAFailureResponse()
@@ -287,11 +333,13 @@
testDriver.assertIdList(list(new TestId("Foo")));
//
- assertEquals(4, listener.events.size());
+ assertEquals(6, listener.events.size());
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);
+ listener.assertStartTestSuiteEvent(1, new TestId());
+ listener.assertStartTestEvent(2, new TestId("Foo"));
+ listener.assertEndTestEvent(3, new TestId("Foo"), new TestFailure(new Failure("", FailureType.ERROR), 0));
+ listener.assertEndTestSuiteEvent(4, new TestId());
+ listener.assertEndRunnerEvent(5);
}
private static void testTestDriverInvokeTestCaseThrowsRuntimeException()
@@ -314,11 +362,13 @@
testDriver.assertIdList(list(new TestId("Foo")));
//
- assertEquals(4, listener.events.size());
+ assertEquals(6, listener.events.size());
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);
+ listener.assertStartTestSuiteEvent(1, new TestId());
+ listener.assertStartTestEvent(2, new TestId("Foo"));
+ listener.assertEndTestEvent(3, new TestId("Foo"), new TestFailure(new Failure("", FailureType.ERROR), 0));
+ listener.assertEndTestSuiteEvent(4, new TestId());
+ listener.assertEndRunnerEvent(5);
}
private static void testTestDriverInvokeTestCaseThrowsError()
@@ -351,9 +401,10 @@
testDriver.assertIdList(list(new TestId("Foo")));
//
- assertEquals(2, listener.events.size());
+ assertEquals(3, listener.events.size());
listener.assertStartRunnerEvent(0);
- listener.assertStartTestEvent(1, new TestId("Foo"));
+ listener.assertStartTestSuiteEvent(1, new TestId());
+ listener.assertStartTestEvent(2, new TestId("Foo"));
}
}
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/report/impl/writer/PrintListener.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/report/impl/writer/PrintListener.java 2007-10-15 19:28:21 UTC (rev 8660)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/report/impl/writer/PrintListener.java 2007-10-15 20:06:37 UTC (rev 8661)
@@ -32,13 +32,18 @@
import org.jboss.unit.runner.event.RunnerFailureEvent;
import org.jboss.unit.runner.event.StartRunnerEvent;
import org.jboss.unit.runner.event.StartTestEvent;
+import org.jboss.unit.runner.event.StartTestSuiteEvent;
+import org.jboss.unit.runner.event.EndTestSuiteEvent;
import org.jboss.unit.runner.results.TestFailure;
import org.jboss.unit.runner.results.TestSuccess;
-import java.io.PrintStream;
import java.io.Writer;
import java.io.PrintWriter;
import java.io.OutputStream;
+import java.text.NumberFormat;
+import java.util.LinkedList;
+import java.util.Iterator;
+import java.util.Map;
/**
* A listener which output messages on a specified stream.
@@ -50,8 +55,20 @@
{
/** . */
+ private final static String NEW_LINE = System.getProperty("line.separator");
+
+ /** . */
+ private NumberFormat FORMAT = NumberFormat.getInstance();
+
+ /** . */
private final PrintWriter out;
+ /** The test suite stats. */
+ private LinkedList<SuiteStat> stack = new LinkedList<SuiteStat>();
+
+ /** The current test case name. */
+ private String currentTestCaseName;
+
/**
* Builds with the <code>System.out</code> print stream.
*/
@@ -113,30 +130,127 @@
out.println("Runner failure: " + failure.getType() + " " + failure.getMessage());
failure.getCause().printStackTrace(out);
}
+ else if (event instanceof StartTestSuiteEvent)
+ {
+ StartTestSuiteEvent stse = (StartTestSuiteEvent)event;
+ stack.add(new SuiteStat(stse.getTestInfo().getName()));
+ }
else if (event instanceof StartTestEvent)
{
- StartTestEvent startTestEvent = (StartTestEvent)event;
- out.println("Starting id=" + startTestEvent.getTestId() + " name=" + startTestEvent.getTestInfo().getName() + " description=" + startTestEvent.getTestInfo().getDescription());
+ StartTestEvent ste = (StartTestEvent)event;
+ currentTestCaseName = ste.getTestInfo().getName();
}
+ else if (event instanceof EndTestSuiteEvent)
+ {
+ StringBuffer tmp = new StringBuffer();
+ for (Iterator<SuiteStat> i = stack.iterator();i.hasNext();)
+ {
+ SuiteStat stat = i.next();
+ tmp.append(stat.name);
+ if (i.hasNext())
+ {
+ tmp.append('.');
+ }
+ }
+
+ //
+ SuiteStat stat = stack.removeLast();
+
+ StringBuffer sb = new StringBuffer("Testsuite: ");
+ sb.append(tmp);
+ sb.append(NEW_LINE);
+ sb.append("Tests run: ");
+ sb.append(stat.count);
+ sb.append(", Failures: ");
+ sb.append(stat.failures);
+ sb.append(", Errors: ");
+ sb.append(stat.errors);
+ sb.append(", Time elapsed: ");
+ sb.append(FORMAT.format((System.currentTimeMillis() - stat.timestamp) / 1000.0));
+ sb.append(" sec");
+ sb.append(NEW_LINE);
+ out.print(sb);
+
+ }
else if (event instanceof EndTestEvent)
{
+ stack.getLast().count++;
+
+ //
EndTestEvent endTestEvent = (EndTestEvent)event;
- TestId testId = endTestEvent.getTestId();
TestResult testResult = endTestEvent.getTestResult();
+
+ StringBuffer name = new StringBuffer(currentTestCaseName);
+ Map<String, String> parametrization = testResult.getParametrization();
+ if (!parametrization.isEmpty())
+ {
+ name.append('?');
+ for (Iterator<Map.Entry<String, String>> i = parametrization.entrySet().iterator();i.hasNext();)
+ {
+ Map.Entry entry = i.next();
+ name.append(entry.getKey()).append('=').append(entry.getValue());
+ if (i.hasNext())
+ {
+ name.append('&');
+ }
+ }
+ }
+
+ //
+ out.println("Testcase: " + name + " took " + FORMAT.format(testResult.getDurationMillis() / 1000.0) + " sec");
+
if (testResult instanceof TestSuccess)
{
- out.println("Test id=" + testId + " is successful (" + testResult.getDurationMillis() + "ms)");
}
else if (testResult instanceof TestFailure)
{
TestFailure testFailure = (TestFailure)testResult;
Failure failure = testFailure.getFailure();
- out.println("Test id=" + testId + " " + failure.getType() + " failed " + failure.getMessage() + " (" + testResult.getDurationMillis() + "ms)");
+
+ //
+ switch(failure.getType())
+ {
+ case ASSERTION:
+ out.println("\tFAILED");
+ stack.getLast().failures++;
+ break;
+ case ERROR:
+ out.println("\tCaused an ERROR");
+ stack.getLast().errors++;
+ break;
+ }
+
+ //
+ out.print(failure.getMessage());
if (failure.getCause() != null)
{
failure.getCause().printStackTrace(out);
}
+ out.println();
}
}
}
+
+ private static class SuiteStat
+ {
+ /** . */
+ private final String name;
+
+ /** . */
+ private int failures = 0;
+
+ /** . */
+ private int errors = 0;
+
+ /** . */
+ private int count = 0;
+
+ /** . */
+ private long timestamp = System.currentTimeMillis();
+
+ private SuiteStat(String name)
+ {
+ this.name = name;
+ }
+ }
}
Added: modules/test/trunk/unit/src/main/org/jboss/unit/runner/event/EndTestSuiteEvent.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/runner/event/EndTestSuiteEvent.java (rev 0)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/runner/event/EndTestSuiteEvent.java 2007-10-15 20:06:37 UTC (rev 8661)
@@ -0,0 +1,47 @@
+/******************************************************************************
+ * 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.event;
+
+import org.jboss.unit.TestId;
+import org.jboss.unit.runner.TestRunnerEvent;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class EndTestSuiteEvent extends TestRunnerEvent
+{
+
+ /** . */
+ private final TestId testId;
+
+ public EndTestSuiteEvent(TestId testId)
+ {
+ this.testId = testId;
+ }
+
+ public TestId getTestId()
+ {
+ return testId;
+ }
+}
Added: modules/test/trunk/unit/src/main/org/jboss/unit/runner/event/StartTestSuiteEvent.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/runner/event/StartTestSuiteEvent.java (rev 0)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/runner/event/StartTestSuiteEvent.java 2007-10-15 20:06:37 UTC (rev 8661)
@@ -0,0 +1,57 @@
+/******************************************************************************
+ * 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.event;
+
+import org.jboss.unit.runner.TestRunnerEvent;
+import org.jboss.unit.TestId;
+import org.jboss.unit.info.TestSuiteInfo;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class StartTestSuiteEvent extends TestRunnerEvent
+{
+
+ /** . */
+ private final TestId testId;
+
+ /** . */
+ private final TestSuiteInfo testInfo;
+
+ public StartTestSuiteEvent(TestId testId, TestSuiteInfo testInfo)
+ {
+ this.testId = testId;
+ this.testInfo = testInfo;
+ }
+
+ public TestId getTestId()
+ {
+ return testId;
+ }
+
+ public TestSuiteInfo getTestInfo()
+ {
+ return testInfo;
+ }
+}
Modified: 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 2007-10-15 19:28:21 UTC (rev 8660)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/DelegateRunnerEventFilter.java 2007-10-15 20:06:37 UTC (rev 8661)
@@ -26,9 +26,6 @@
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
@@ -52,14 +49,10 @@
{
/** . */
- private String testName;
-
- /** . */
private TestRunnerEventListener listener;
- public DelegateRunnerEventFilter(String testName, TestRunnerEventListener listener)
+ public DelegateRunnerEventFilter(TestRunnerEventListener listener)
{
- this.testName = testName;
this.listener = listener;
}
@@ -69,18 +62,6 @@
{
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/driver/TestDriverRunner.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/driver/TestDriverRunner.java 2007-10-15 19:28:21 UTC (rev 8660)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/driver/TestDriverRunner.java 2007-10-15 20:06:37 UTC (rev 8661)
@@ -39,6 +39,8 @@
import org.jboss.unit.runner.event.StartTestEvent;
import org.jboss.unit.runner.event.EndTestEvent;
import org.jboss.unit.runner.event.RunnerFailureEvent;
+import org.jboss.unit.runner.event.StartTestSuiteEvent;
+import org.jboss.unit.runner.event.EndTestSuiteEvent;
import org.jboss.unit.runner.AbstractTestRunner;
import org.jboss.unit.runner.TestResult;
import org.jboss.unit.runner.TestRunnerContext;
@@ -114,10 +116,7 @@
TestSuiteInfo info = (TestSuiteInfo)driver.getInfo();
//
- TestInfo testInfo = info.findTest(testId);
-
- //
- internalRun(context, testInfo, testId);
+ internalRun(context, info, testId, new TestId());
}
finally
{
@@ -133,68 +132,119 @@
}
}
- private void internalRun(TestRunnerContext context, TestInfo testInfo, TestId testId)
+ private void internalRun(final TestRunnerContext context, final TestInfo currentInfo, final TestId targetId, final TestId currentId)
{
- if (context.getFilter().include(testId, testInfo))
+ if (currentId.equals(targetId))
{
- if (testInfo instanceof TestSuiteInfo)
- {
- TestSuiteInfo testSuiteInfo = (TestSuiteInfo)testInfo;
-
- //
- for (String name : testSuiteInfo.getNames())
+// if (context.getFilter().include(currentId, currentInfo))
+// {
+ if (currentInfo instanceof TestSuiteInfo)
{
- TestInfo childTestInfo = testSuiteInfo.getTest(name);
- internalRun(context, childTestInfo, new TestId(testId, name));
- }
- }
- else
- {
- TestCaseInfo testCaseInfo = (TestCaseInfo)testInfo;
+ TestSuiteInfo testSuiteInfo = (TestSuiteInfo)currentInfo;
- //
- for (Map<String,String> parametrization : context.getParametrizations().enumerate(testCaseInfo.getParameters().keySet()))
- {
- context.getEventListener().onEvent(new StartTestEvent(testId, testCaseInfo));
-
//
- StartTestCommand command = new StartTestCommand(parametrization);
+ context.getEventListener().onEvent(new StartTestSuiteEvent(currentId, testSuiteInfo));
//
- TestResult result = null;
+ for (String name : testSuiteInfo.getNames())
+ {
+ TestInfo childInfo = testSuiteInfo.getTest(name);
+ //
+ TestId childId = new TestId(currentId, name);
+
+ //
+ internalRun(context, childInfo, childId, childId);
+ }
+
//
- long duration = -System.currentTimeMillis();
+ context.getEventListener().onEvent(new EndTestSuiteEvent(testId));
+ }
+ else
+ {
+ TestCaseInfo testCaseInfo = (TestCaseInfo)currentInfo;
//
- DriverResponse response = null;
- try
+ for (Map<String,String> parametrization : context.getParametrizations().enumerate(testCaseInfo.getParameters().keySet()))
{
+ context.getEventListener().onEvent(new StartTestEvent(currentId, testCaseInfo));
+
+ //
+ StartTestCommand command = new StartTestCommand(parametrization);
+
+ //
+ TestResult result = null;
+
+ //
+ long duration = -System.currentTimeMillis();
+
+ //
+ DriverResponse response = null;
try
{
- response = driver.invoke(testId, command);
+ try
+ {
+ response = driver.invoke(currentId, command);
+ }
+ finally
+ {
+ duration += System.currentTimeMillis();
+ }
}
- finally
+ catch (Exception e)
{
- duration += System.currentTimeMillis();
+ Failure failure = new Failure("The test driver threw an unexpected exception ", e, FailureType.ERROR);
+ result = new TestFailure(failure, parametrization, duration);
}
+
+ //
+ if (result == null)
+ {
+ result = unwrap(response, parametrization, duration);
+ }
+
+ //
+ context.getEventListener().onEvent(new EndTestEvent(currentId, result));
}
- catch (Exception e)
- {
- Failure failure = new Failure("The test driver threw an unexpected exception ", e, FailureType.ERROR);
- result = new TestFailure(failure, parametrization, duration);
- }
+ }
+// }
+ }
+ else
+ {
+ String name = targetId.getName(currentId.getLength());
+ //
+ if (currentInfo instanceof TestSuiteInfo)
+ {
+ //
+ TestSuiteInfo currentSuiteInfo = (TestSuiteInfo)currentInfo;
+
+ //
+ TestInfo nextInfo = currentSuiteInfo.getTest(name);
+
+ //
+ if (nextInfo != null)
+ {
+ TestId nextId = new TestId(currentId, name);
+
//
- if (result == null)
- {
- result = unwrap(response, parametrization, duration);
- }
+ context.getEventListener().onEvent(new StartTestSuiteEvent(currentId, currentSuiteInfo));
//
- context.getEventListener().onEvent(new EndTestEvent(testId, result));
+ internalRun(context, nextInfo, targetId, nextId);
+
+ //
+ context.getEventListener().onEvent(new EndTestSuiteEvent(currentId));
}
+ else
+ {
+
+ }
}
+ else
+ {
+
+ }
}
}
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-15 19:28:21 UTC (rev 8660)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/generic/GenericTestRunner.java 2007-10-15 20:06:37 UTC (rev 8661)
@@ -60,7 +60,7 @@
String className = def.getClassName();
//
- DelegateRunnerEventFilter filter = new DelegateRunnerEventFilter(className, context.getEventListener());
+ DelegateRunnerEventFilter filter = new DelegateRunnerEventFilter(context.getEventListener());
//
try
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-15 19:28:21 UTC (rev 8660)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/pojo/POJOTestRunner.java 2007-10-15 20:06:37 UTC (rev 8661)
@@ -65,7 +65,7 @@
String className = testClass.getName();
//
- DelegateRunnerEventFilter filter = new DelegateRunnerEventFilter(className, context.getEventListener());
+ DelegateRunnerEventFilter filter = new DelegateRunnerEventFilter(context.getEventListener());
//
try
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/runner/model/ModelBuilder.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/runner/model/ModelBuilder.java 2007-10-15 19:28:21 UTC (rev 8660)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/runner/model/ModelBuilder.java 2007-10-15 20:06:37 UTC (rev 8661)
@@ -171,16 +171,9 @@
}
//
- Attr nameAttr = suiteElt.getAttributeNode("name");
- if (nameAttr == null)
- {
- throw new IllegalArgumentException();
- }
+ GenericTestSuiteDef suite = new GenericTestSuiteDef(nameAttrOfClassElt.getValue());
//
- GenericTestSuiteDef suite = new GenericTestSuiteDef(nameAttr.getValue(), nameAttrOfClassElt.getValue());
-
- //
for (Element testElt : children(suiteElt, "test"))
{
Attr refidAttr = testElt.getAttributeNode("refid");
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/runner/model/generic/GenericTestSuiteDef.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/runner/model/generic/GenericTestSuiteDef.java 2007-10-15 19:28:21 UTC (rev 8660)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/runner/model/generic/GenericTestSuiteDef.java 2007-10-15 20:06:37 UTC (rev 8661)
@@ -41,22 +41,13 @@
private final List<TestDef> tests = new ArrayList<TestDef>();
/** . */
- private final String name;
-
- /** . */
private final String className;
- public GenericTestSuiteDef(String name, String className)
+ public GenericTestSuiteDef(String className)
{
- this.name = name;
this.className = className;
}
- public String getName()
- {
- return name;
- }
-
public String getClassName()
{
return className;
Modified: modules/test/trunk/unit/src/resources/jboss-unit-jar/org/jboss/unit/runner/model/jboss-unit_1_0.xsd
===================================================================
--- modules/test/trunk/unit/src/resources/jboss-unit-jar/org/jboss/unit/runner/model/jboss-unit_1_0.xsd 2007-10-15 19:28:21 UTC (rev 8660)
+++ modules/test/trunk/unit/src/resources/jboss-unit-jar/org/jboss/unit/runner/model/jboss-unit_1_0.xsd 2007-10-15 20:06:37 UTC (rev 8661)
@@ -79,7 +79,6 @@
<xsd:element name="parameter" type="parameterType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="test" type="generic_testType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required"/>
</xsd:complexType>
<xsd:complexType name="generic_testType">
Modified: modules/test/trunk/unit/src/resources/test/org/jboss/test/unit/runner/model/f2.xml
===================================================================
--- modules/test/trunk/unit/src/resources/test/org/jboss/test/unit/runner/model/f2.xml 2007-10-15 19:28:21 UTC (rev 8660)
+++ modules/test/trunk/unit/src/resources/test/org/jboss/test/unit/runner/model/f2.xml 2007-10-15 20:06:37 UTC (rev 8661)
@@ -3,7 +3,7 @@
xmlns="urn:jboss:jboss-unit:1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:jboss:jboss-unit:1.0 jboss-unit_1_0.xsd">
- <generic name="foo_generic">
+ <generic>
<class name="foo_generic"/>
<parameter name="red" value="blue"/>
<test refid="foo"/>
16 years, 8 months
JBoss Portal SVN: r8660 - in branches/UIServer: core/src/main/org/jboss/portal/core/controller/classic and 12 other directories.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2007-10-15 15:28:21 -0400 (Mon, 15 Oct 2007)
New Revision: 8660
Added:
branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/processor/ProcessorResponse.java
branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/protocol/Component.java
branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/protocol/Container.java
Removed:
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/Component.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/Container.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/Page.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/Window.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/protocol/
Modified:
branches/UIServer/core-uiserver/build.xml
branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/processor/Processor.java
branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/protocol/Page.java
branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/protocol/PortalObject.java
branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/protocol/Window.java
branches/UIServer/core/src/main/org/jboss/portal/core/controller/Controller.java
branches/UIServer/core/src/main/org/jboss/portal/core/controller/classic/ClassicResponseHandler.java
branches/UIServer/core/src/main/org/jboss/portal/core/controller/classic/OtherResponseHandler.java
branches/UIServer/core/src/main/org/jboss/portal/core/model/instance/PortletInstanceResponseHandler.java
branches/UIServer/core/src/main/org/jboss/portal/core/model/portal/PortalObjectResponseHandler.java
branches/UIServer/core/src/main/org/jboss/portal/core/processor/MainProcessor.java
branches/UIServer/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
branches/UIServer/uiserver/src/main/org/jboss/portal/test/uiserver/layout/TestFlexibleGrid.java
branches/UIServer/uiserver/src/main/org/jboss/portal/test/uiserver/layout/TestRegionLayoutManager.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/LayoutManager.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/LayoutService.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/classic/FlexibleGrid.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/classic/FlexibleGridLayoutManager.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/classic/RegionLayoutManager.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/UIServer.java
Log:
(Core Portal-Presentation Framework-HTTP layer)- architecture for interaction during sending response back from Portal
Modified: branches/UIServer/core/src/main/org/jboss/portal/core/controller/Controller.java
===================================================================
--- branches/UIServer/core/src/main/org/jboss/portal/core/controller/Controller.java 2007-10-15 15:21:39 UTC (rev 8659)
+++ branches/UIServer/core/src/main/org/jboss/portal/core/controller/Controller.java 2007-10-15 19:28:21 UTC (rev 8660)
@@ -39,11 +39,13 @@
import org.jboss.portal.core.model.instance.InstanceContainer;
import org.jboss.portal.core.model.CustomizationManager;
import org.jboss.portal.common.invocation.InterceptorStackFactory;
+import org.jboss.portal.common.util.MarkupInfo;
import org.jboss.portal.security.spi.auth.PortalAuthorizationManagerFactory;
import org.jboss.portal.jems.as.system.AbstractJBossService;
import org.jboss.portal.server.RequestController;
import org.jboss.portal.server.ServerInvocation;
import org.jboss.portal.server.ServerException;
+import org.jboss.portal.web.ServletContextDispatcher;
import org.jboss.portal.web.spi.ServletContainerContext;
import javax.servlet.ServletException;
@@ -307,7 +309,7 @@
ControllerResponse response = forward.getResponse();
processCommandResponse(controllerContext, command, response);
}
- else if (handlerResponse instanceof HTTPResponse)
+ /*else if (handlerResponse instanceof HTTPResponse)
{
HTTPResponse hr = (HTTPResponse)handlerResponse;
sendResponse(controllerContext, hr);
@@ -316,13 +318,13 @@
{
AjaxResponse ar = (AjaxResponse)handlerResponse;
sendResponse(controllerContext, ar);
- }
+ }*/
}
/**
* All http responses in the stack should be handled here.
*/
- protected void sendResponse(ControllerContext ctx, HTTPResponse resp)
+ /*protected void sendResponse(ControllerContext ctx, HTTPResponse resp)
{
try
{
@@ -335,13 +337,13 @@
catch (ServletException e)
{
log.error("Cound not send http response", e);
- }
- }
+ }
+ }*/
/**
* All http responses in the stack should be handled here.
*/
- protected void sendResponse(ControllerContext ctx, AjaxResponse resp)
+ /*protected void sendResponse(ControllerContext ctx, AjaxResponse resp)
{
try
{
@@ -355,5 +357,5 @@
{
log.error("Cound not send http response", e);
}
- }
-}
+ }*/
+}
\ No newline at end of file
Modified: branches/UIServer/core/src/main/org/jboss/portal/core/controller/classic/ClassicResponseHandler.java
===================================================================
--- branches/UIServer/core/src/main/org/jboss/portal/core/controller/classic/ClassicResponseHandler.java 2007-10-15 15:21:39 UTC (rev 8659)
+++ branches/UIServer/core/src/main/org/jboss/portal/core/controller/classic/ClassicResponseHandler.java 2007-10-15 19:28:21 UTC (rev 8660)
@@ -60,7 +60,15 @@
if (requiresRedirect(controllerCommand, urlContext, forward))
{
String url = controllerContext.renderURL(forward.getCommand(), forward.getURLContext(), null);
- return HTTPResponse.sendRedirect(url);
+
+ /**
+ * Used for integration with the new Presentation Framework
+ */
+ controllerContext.getServerInvocation().getServerContext().getClientRequest().setAttribute("pfTask", "redirect");
+ controllerContext.getServerInvocation().getServerContext().getClientRequest().setAttribute("url", url);
+
+ //return HTTPResponse.sendRedirect(url);
+ return null;
}
}
Modified: branches/UIServer/core/src/main/org/jboss/portal/core/controller/classic/OtherResponseHandler.java
===================================================================
--- branches/UIServer/core/src/main/org/jboss/portal/core/controller/classic/OtherResponseHandler.java 2007-10-15 15:21:39 UTC (rev 8659)
+++ branches/UIServer/core/src/main/org/jboss/portal/core/controller/classic/OtherResponseHandler.java 2007-10-15 19:28:21 UTC (rev 8660)
@@ -49,6 +49,8 @@
import org.apache.log4j.Logger;
import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletResponse;
+
import java.io.IOException;
/**
@@ -72,9 +74,15 @@
if (controllerResponse instanceof PageRendition)
{
final PageRendition rendition = (PageRendition)controllerResponse;
+
+ /**
+ * Used for integration with the new Presentation Framework
+ */
+ invocation.getServerContext().getClientRequest().setAttribute("pfTask", "aggregate");
+ invocation.getServerContext().getClientRequest().setAttribute("pageResult", rendition.getPageResult());
// Defer execution of rendition to the right place which is in the classic controller send response
- return new HTTPResponse()
+ /*return new HTTPResponse()
{
public void sendResponse(ServerInvocationContext ctx) throws IOException, ServletException
{
@@ -82,7 +90,8 @@
MarkupInfo markupInfo = (MarkupInfo)invocation.getResponse().getContentInfo();
rendition.render(markupInfo, dispatcher);
}
- };
+ };*/
+ return null;
}
else if (controllerResponse instanceof SignOutResponse)
{
@@ -101,14 +110,30 @@
URLContext urlContext = invocation.getServerContext().getURLContext();
location = controllerContext.renderURL(renderCmd, urlContext.asNonAuthenticated(), null);
}
+
+ /**
+ * Used for integration with the new Presentation Framework
+ */
+ invocation.getServerContext().getClientRequest().setAttribute("pfTask", "redirect");
+ invocation.getServerContext().getClientRequest().setAttribute("url", location);
//
- return HTTPResponse.sendRedirect(location);
+ //return HTTPResponse.sendRedirect(location);
+ return null;
}
else if (controllerResponse instanceof StreamContentResponse)
{
StreamContentResponse scr = (StreamContentResponse)controllerResponse;
- return HTTPResponse.sendBinary(scr.getContentType(), scr.getInputStream());
+
+ /**
+ * Used for integration with the new Presentation Framework
+ */
+ invocation.getServerContext().getClientRequest().setAttribute("pfTask", "stream");
+ invocation.getServerContext().getClientRequest().setAttribute("contentType", scr.getContentType());
+ invocation.getServerContext().getClientRequest().setAttribute("inputStream", scr.getInputStream());
+
+ //return HTTPResponse.sendBinary(scr.getContentType(), scr.getInputStream());
+ return null;
}
else if (controllerResponse instanceof SecurityErrorResponse)
{
@@ -118,14 +143,29 @@
{
if (controllerContext.getUser() != null)
{
- return HTTPResponse.sendForbidden();
+ /**
+ * Used for integration with the new Presentation Framework
+ */
+ invocation.getServerContext().getClientRequest().setAttribute("pfTask", "error");
+ invocation.getServerContext().getClientRequest().setAttribute("errorCode", new Integer(HttpServletResponse.SC_FORBIDDEN));
+
+ //return HTTPResponse.sendForbidden();
+ return null;
}
else
{
urlContext = URLContext.newInstance(urlContext.isSecure(), true);
ServerURL serverURL = controllerContext.getController().getURLFactory().doMapping(controllerContext, controllerContext.getServerInvocation(), controllerCommand);
String url = controllerContext.getServerInvocation().getResponse().renderURL(serverURL, urlContext, null);
- return HTTPResponse.sendRedirect(url);
+
+ /**
+ * Used for integration with the new Presentation Framework
+ */
+ invocation.getServerContext().getClientRequest().setAttribute("pfTask", "redirect");
+ invocation.getServerContext().getClientRequest().setAttribute("url", url);
+
+ //return HTTPResponse.sendRedirect(url);
+ return null;
}
}
else
@@ -133,7 +173,15 @@
urlContext = URLContext.newInstance(true, urlContext.isAuthenticated());
ServerURL serverURL = controllerContext.getController().getURLFactory().doMapping(controllerContext, controllerContext.getServerInvocation(), controllerCommand);
String url = controllerContext.getServerInvocation().getResponse().renderURL(serverURL, urlContext, null);
- return HTTPResponse.sendRedirect(url);
+
+ /**
+ * Used for integration with the new Presentation Framework
+ */
+ invocation.getServerContext().getClientRequest().setAttribute("pfTask", "redirect");
+ invocation.getServerContext().getClientRequest().setAttribute("url", url);
+
+ //return HTTPResponse.sendRedirect(url);
+ return null;
}
}
else if (controllerResponse instanceof ErrorResponse)
@@ -148,15 +196,29 @@
{
log.error("An error occured", cause);
}
-
- return HTTPResponse.sendError();
+
+ /**
+ * Used for integration with the new Presentation Framework
+ */
+ invocation.getServerContext().getClientRequest().setAttribute("pfTask", "error");
+ invocation.getServerContext().getClientRequest().setAttribute("errorCode", new Integer(HttpServletResponse.SC_INTERNAL_SERVER_ERROR));
+
+ //return HTTPResponse.sendError();
+ return null;
}
else if (controllerResponse instanceof UnavailableResourceResponse)
{
UnavailableResourceResponse unavailable = (UnavailableResourceResponse)controllerResponse;
+
+ /**
+ * Used for integration with the new Presentation Framework
+ */
+ invocation.getServerContext().getClientRequest().setAttribute("pfTask", "error");
+ invocation.getServerContext().getClientRequest().setAttribute("errorCode", new Integer(HttpServletResponse.SC_NOT_FOUND));
//
- return HTTPResponse.sendNotFound();
+ //return HTTPResponse.sendNotFound();
+ return null;
}
else
{
Modified: branches/UIServer/core/src/main/org/jboss/portal/core/model/instance/PortletInstanceResponseHandler.java
===================================================================
--- branches/UIServer/core/src/main/org/jboss/portal/core/model/instance/PortletInstanceResponseHandler.java 2007-10-15 15:21:39 UTC (rev 8659)
+++ branches/UIServer/core/src/main/org/jboss/portal/core/model/instance/PortletInstanceResponseHandler.java 2007-10-15 19:28:21 UTC (rev 8660)
@@ -57,7 +57,14 @@
RenderPortletInstanceCommand render= new RenderPortletInstanceCommand(upir.getInstanceId(), upir.getNavigationalState());
final PageRendition rendition = (PageRendition)controllerContext.execute(render);
final ServerInvocation invocation = controllerContext.getServerInvocation();
- return new HTTPResponse()
+
+ /**
+ * Used for integration with the new Presentation Framework
+ */
+ invocation.getServerContext().getClientRequest().setAttribute("pfTask", "aggregate");
+ invocation.getServerContext().getClientRequest().setAttribute("pageResult", rendition.getPageResult());
+
+ /*return new HTTPResponse()
{
public void sendResponse(ServerInvocationContext ctx) throws IOException, ServletException
{
@@ -65,7 +72,8 @@
MarkupInfo markupInfo = (MarkupInfo)invocation.getResponse().getContentInfo();
rendition.render(markupInfo, dispatcher);
}
- };
+ };*/
+ return null;
}
catch (ControllerException e)
{
Modified: branches/UIServer/core/src/main/org/jboss/portal/core/model/portal/PortalObjectResponseHandler.java
===================================================================
--- branches/UIServer/core/src/main/org/jboss/portal/core/model/portal/PortalObjectResponseHandler.java 2007-10-15 15:21:39 UTC (rev 8659)
+++ branches/UIServer/core/src/main/org/jboss/portal/core/model/portal/PortalObjectResponseHandler.java 2007-10-15 19:28:21 UTC (rev 8660)
@@ -78,7 +78,14 @@
{
final PageRendition rendition = (PageRendition)resp;
final ServerInvocation invocation = controllerContext.getServerInvocation();
- return new HTTPResponse()
+
+ /**
+ * Used for integration with the new Presentation Framework
+ */
+ invocation.getServerContext().getClientRequest().setAttribute("pfTask", "aggregate");
+ invocation.getServerContext().getClientRequest().setAttribute("pageResult", rendition.getPageResult());
+
+ /*return new HTTPResponse()
{
public void sendResponse(ServerInvocationContext ctx) throws IOException, ServletException
{
@@ -86,7 +93,8 @@
MarkupInfo markupInfo = (MarkupInfo)invocation.getResponse().getContentInfo();
rendition.render(markupInfo, dispatcher);
}
- };
+ };*/
+ return null;
}
else
{
Modified: branches/UIServer/core/src/main/org/jboss/portal/core/processor/MainProcessor.java
===================================================================
--- branches/UIServer/core/src/main/org/jboss/portal/core/processor/MainProcessor.java 2007-10-15 15:21:39 UTC (rev 8659)
+++ branches/UIServer/core/src/main/org/jboss/portal/core/processor/MainProcessor.java 2007-10-15 19:28:21 UTC (rev 8660)
@@ -22,15 +22,34 @@
******************************************************************************/
package org.jboss.portal.core.processor;
+import java.io.InputStream;
+import java.util.Map;
+import java.util.List;
+import java.util.Iterator;
+import java.util.ArrayList;
+
import org.apache.log4j.Logger;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.ServletOutputStream;
+
+import org.jboss.portal.common.util.MarkupInfo;
+import org.jboss.portal.common.io.IOTools;
import org.jboss.portal.jems.as.system.AbstractJBossService;
+import org.jboss.portal.web.ServletContextDispatcher;
import org.jboss.portal.server.RequestControllerDispatcher;
import org.jboss.portal.server.ServerException;
import org.jboss.portal.server.RequestController;
+import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.theme.page.PageResult;
+import org.jboss.portal.theme.page.WindowContext;
+import org.jboss.portal.theme.page.WindowResult;
import org.jboss.portal.uiserver.processor.Processor;
import org.jboss.portal.uiserver.processor.ProcessorRequest;
+import org.jboss.portal.uiserver.processor.ProcessorResponse;
+import org.jboss.portal.uiserver.protocol.Page;
+import org.jboss.portal.uiserver.protocol.Window;
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
@@ -46,55 +65,160 @@
/**
*
*/
- private RequestController temp = null;
+ private RequestController requestController = null;
-
/**
*
+ * @return
+ */
+ public RequestController getRequestController()
+ {
+ return requestController;
+ }
+
+ /**
+ *
+ * @param requestController
*/
- public void process(ProcessorRequest request) throws ServerException
+ public void setRequestController(RequestController requestController)
+ {
+ this.requestController = requestController;
+ }
+
+ /**
+ *
+ */
+ public ProcessorResponse process(ProcessorRequest request) throws ServerException
{
try
{
- //This should process the request sent in from the UIServer using whatever framework the core Portal implements
- //Basically based on the information sent in by the ProcessorRequest this component should have all the information
- //it needs to perform necessary action inside the Portal
-
+ /*
+ This should process the request sent in from the UIServer using whatever framework the core Portal implements
+ Basically based on the information sent in by the ProcessorRequest this component should have all the information
+ it needs to perform necessary action inside the Portal
+ the Processor should use the values sent in the ProcessorRequest object to perform
+ the appropriate action and then send its Response back to the UIServer which should process
+ the Response and sent a Response back to the client
+ */
+ ProcessorResponse response = null;
- //the Processor should use the values sent in the ProcessorRequest object to perform
- //the appropriate action and then send its Response back to the UIServer which should process
- //the Response and sent a Response back to the client
+ //For now, just for prototype sake just use the existing Controller to produce the outcome
+ request.getServerInvocation().setHandler(new RequestControllerDispatcher(this.requestController));
+ request.getServerInvocation().invokeNext();
+
+ //Get access to the core Portal objects to be used after the execution of the incoming Portal request
+ //by the Portal Controller
+ ServerInvocation invocation = request.getServerInvocation();
+ ServletContextDispatcher dispatcher = new ServletContextDispatcher(invocation.getServerContext().getClientRequest(),
+ invocation.getServerContext().getClientResponse(), invocation.getRequest().getServer().getServletContainerContext());
+ String task = (String)invocation.getServerContext().getClientRequest().getAttribute("pfTask");
+ if(task.equals("aggregate"))
+ {
+ //Handle page aggregation and sending result back to the client
+ MarkupInfo markupInfo = (MarkupInfo)invocation.getResponse().getContentInfo();
+ PageResult pageResult = (PageResult)invocation.getServerContext().getClientRequest().getAttribute("pageResult");
+
+ //Now generate a ProcessorResponse by mapping the data produced during the execution of
+ //the Portal Request
+ String contentType = markupInfo.getContentType() + "; charset=" + markupInfo.getCharset();
+ Page pageToBeDisplayed = new Page();
+ pageToBeDisplayed.setCurrentlyDisplayed(true);
+
+ //Setup information inside the page object
+ pageToBeDisplayed.setName(pageResult.getPageName());
+ List windows = this.getWindows(pageResult.getWindowContextMap());
+ if(windows != null)
+ {
+ pageToBeDisplayed.getChildren().addAll(windows);
+ }
+
+ //
+ List updatedPages = new ArrayList();
+ updatedPages.add(pageToBeDisplayed);
+
+ //Generate the response to be sent back for processing by the Presentation Framework
+ response = new ProcessorResponse(dispatcher, contentType, markupInfo.getCharset(), updatedPages);
+ }
+ else if(task.equals("stream"))
+ {
+ //Handle sending back binary content back to the client
+ String contentType = (String)invocation.getServerContext().getClientRequest().getAttribute("contentType");
+ InputStream in = (InputStream)invocation.getServerContext().getClientRequest().getAttribute("inputStream");
+
+ //Process and see if binary content needs to be sent back...
+ //In this case write the response to the OutputStream directly
+ //There is no need for any Presentation Framework processing
+ if(contentType != null && in != null)
+ {
+ HttpServletResponse resp = invocation.getServerContext().getClientResponse();
+ resp.setContentType(contentType);
+ ServletOutputStream sout = null;
+ try
+ {
+ sout = resp.getOutputStream();
+ byte[] buf = new byte[2048];
+ int len;
+ while ((len = in.read(buf)) > 0)
+ {
+ sout.write(buf, 0, len);
+ }
+ sout.flush();
+ }
+ finally
+ {
+ IOTools.safeClose(in);
+ IOTools.safeClose(sout);
+ }
+ }
+ }
+ else if(task.equals("redirect"))
+ {
+ //Handle sendRedirect back to the client
+ String url = (String)invocation.getServerContext().getClientRequest().getAttribute("url");
+ invocation.getServerContext().getClientResponse().sendRedirect(url);
+ }
+ else if(task.equals("error"))
+ {
+ //Handle sendingErrror back to the client
+ Integer errorCode = (Integer)invocation.getServerContext().getClientRequest().getAttribute("errorCode");
+ invocation.getServerContext().getClientResponse().sendError(errorCode.intValue());
+ }
- //Just outputting values coming in on ProcessorRequest.....Just for testing
- log.info("Action="+request.getActionType());
- log.info("Portal="+request.getPortal());
- log.info("Target="+request.getTarget());
- //For now, just for prototype sake just use the existing Controller to produce the outcome
- request.getServerInvocation().setHandler(new RequestControllerDispatcher(this.temp));
- request.getServerInvocation().invokeNext();
+ return response;
}
catch(Exception e)
{
throw new ServerException(e);
}
}
-
+
/**
*
+ * @param windowContexts
* @return
*/
- public RequestController getTemp()
+ private List getWindows(Map windowContexts)
{
- return temp;
+ List windows = null;
+
+ if(windowContexts != null)
+ {
+ windows = new ArrayList();
+ for(Iterator itr=windowContexts.keySet().iterator(); itr.hasNext();)
+ {
+ String windowId = (String)itr.next();
+ WindowContext windowContext = (WindowContext)windowContexts.get(windowId);
+ WindowResult windowResult = windowContext.getResult();
+
+ Window window = new Window(windowId, windowResult.getTitle(),
+ windowResult.getContent(), windowResult.getHeaderContent(),
+ windowResult.getWindowState(), windowResult.getMode());
+
+ windows.add(window);
+ }
+ }
+
+ return windows;
}
-
- /**
- *
- * @param temp
- */
- public void setTemp(RequestController temp)
- {
- this.temp = temp;
- }
}
Modified: branches/UIServer/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
===================================================================
--- branches/UIServer/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-10-15 15:21:39 UTC (rev 8659)
+++ branches/UIServer/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-10-15 19:28:21 UTC (rev 8660)
@@ -1053,7 +1053,7 @@
<!-- The controller -->
<mbean
code="org.jboss.portal.core.controller.Controller"
- name="portal:service=Temp"
+ name="portal:service=RequestController"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
@@ -1097,7 +1097,7 @@
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
- <depends optional-attribute-name="Temp" proxy-type="attribute">portal:service=Temp</depends>
+ <depends optional-attribute-name="RequestController" proxy-type="attribute">portal:service=RequestController</depends>
<depends>portal:container=PortalObject</depends>
<depends>portal:service=PageService</depends>
<depends>portal:commandFactory=DefaultPortal</depends>
Modified: branches/UIServer/core-uiserver/build.xml
===================================================================
--- branches/UIServer/core-uiserver/build.xml 2007-10-15 15:21:39 UTC (rev 8659)
+++ branches/UIServer/core-uiserver/build.xml 2007-10-15 19:28:21 UTC (rev 8660)
@@ -96,7 +96,9 @@
<!-- Configure modules -->
<call target="configure-modules"/>
<path id="dependentmodule.classpath">
+ <path refid="jboss.portlet-api.classpath"/>
<path refid="jboss.portal-server.classpath"/>
+ <path refid="jboss.portal-web.classpath"/>
</path>
<!--+=======================================+-->
Modified: branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/processor/Processor.java
===================================================================
--- branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/processor/Processor.java 2007-10-15 15:21:39 UTC (rev 8659)
+++ branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/processor/Processor.java 2007-10-15 19:28:21 UTC (rev 8660)
@@ -39,5 +39,5 @@
* @param request
* @throws ServerException
*/
- public void process(ProcessorRequest request) throws ServerException;
+ public ProcessorResponse process(ProcessorRequest request) throws ServerException;
}
Added: branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/processor/ProcessorResponse.java
===================================================================
--- branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/processor/ProcessorResponse.java (rev 0)
+++ branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/processor/ProcessorResponse.java 2007-10-15 19:28:21 UTC (rev 8660)
@@ -0,0 +1,171 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.uiserver.processor;
+
+import java.io.Serializable;
+import java.util.List;
+
+import org.jboss.portal.web.ServletContextDispatcher;
+
+import org.jboss.portal.uiserver.protocol.Page;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class ProcessorResponse implements Serializable
+{
+ /**
+ *
+ */
+ private ServletContextDispatcher dispatcher = null;
+
+ /**
+ * Contains a list of pages that need to be updated on the client. These pages may not necessarily
+ * be the currently displayed page, but nevertheless, these are pages whose window content changed
+ * as a result of this particular Portal request processing.
+ *
+ * For most usecases this probably only consist of the Page that is currently being displayed on the client
+ */
+ private List updatedPages = null;
+
+ /**
+ * Content Type of the response being sent back to the client
+ */
+ private String contentType = null;
+
+ /**
+ * Character Set of the response being sent back to the client
+ */
+ private String charSet = null;
+
+
+ /**
+ *
+ * @param dispatcher
+ * @param updatedPages
+ */
+ public ProcessorResponse(ServletContextDispatcher dispatcher, String contentType, String charSet, List updatedPages)
+ {
+ this.dispatcher = dispatcher;
+ this.contentType = contentType;
+ this.charSet = charSet;
+ this.updatedPages = updatedPages;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public ServletContextDispatcher getDispatcher()
+ {
+ return dispatcher;
+ }
+
+ /**
+ *
+ * @param dispatcher
+ */
+ public void setDispatcher(ServletContextDispatcher dispatcher)
+ {
+ this.dispatcher = dispatcher;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public List getUpdatedPages()
+ {
+ return updatedPages;
+ }
+
+ /**
+ *
+ * @param updatedPages
+ */
+ public void setUpdatedPages(List updatedPages)
+ {
+ this.updatedPages = updatedPages;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getCharSet()
+ {
+ return charSet;
+ }
+
+ /**
+ *
+ * @param charSet
+ */
+ public void setCharSet(String charSet)
+ {
+ this.charSet = charSet;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getContentType()
+ {
+ return contentType;
+ }
+
+ /**
+ *
+ * @param contentType
+ */
+ public void setContentType(String contentType)
+ {
+ this.contentType = contentType;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public Page findDisplayedPage()
+ {
+ Page displayedPage = null;
+
+ if(this.updatedPages != null)
+ {
+ for(int i=0; i<this.updatedPages.size(); i++)
+ {
+ Page cour = (Page)this.updatedPages.get(i);
+ if(cour.isCurrentlyDisplayed())
+ {
+ displayedPage = cour;
+ break;
+ }
+ }
+ }
+
+ return displayedPage;
+ }
+}
Added: branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/protocol/Component.java
===================================================================
--- branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/protocol/Component.java (rev 0)
+++ branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/protocol/Component.java 2007-10-15 19:28:21 UTC (rev 8660)
@@ -0,0 +1,53 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.uiserver.protocol;
+
+import java.io.Serializable;
+
+/**
+ * Component represents a UI entity that will be rendered eventually on the client
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public interface Component extends Serializable
+{
+ /**
+ *
+ * @return
+ */
+ public String getId();
+
+ /**
+ *
+ * @param id
+ */
+ public void setId(String id);
+
+
+ /**
+ *
+ * @return
+ */
+ public String getMarkup();
+}
Added: branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/protocol/Container.java
===================================================================
--- branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/protocol/Container.java (rev 0)
+++ branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/protocol/Container.java 2007-10-15 19:28:21 UTC (rev 8660)
@@ -0,0 +1,134 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.uiserver.protocol;
+
+import java.io.Serializable;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * Container is an organizational entity which aggregates the Components that will be rendered on the client
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class Container implements Serializable
+{
+ /**
+ * required unique id of the container. uniqueness in relation to
+ * other containers added to the same instance of the page
+ */
+ protected String id = null;
+
+
+ /**
+ *
+ */
+ private List components = null;
+
+ /**
+ *
+ *
+ */
+ public Container(String id)
+ {
+ this.id = id;
+ this.components = new ArrayList();
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getId()
+ {
+ return id;
+ }
+
+ /**
+ *
+ * @param id
+ */
+ public void setId(String id)
+ {
+ this.id = id;
+ }
+
+
+ /**
+ *
+ * @return
+ */
+ public List getComponents()
+ {
+ return components;
+ }
+
+ /**
+ *
+ * @param components
+ */
+ public void setComponents(List components)
+ {
+ this.components = components;
+ }
+
+ /**
+ *
+ * @param componentId
+ * @return
+ */
+ public Component getComponent(String componentId)
+ {
+ Component component = null;
+
+ if(this.components != null)
+ {
+ for(int i=0;i<this.components.size();i++)
+ {
+ Component cour = (Component)this.components.get(i);
+ if(cour.getId().equals(componentId))
+ {
+ component = cour;
+ break;
+ }
+ }
+ }
+
+ return component;
+ }
+
+ /**
+ *
+ * @param component
+ */
+ public void addComponent(Component component)
+ {
+ if(this.components == null)
+ {
+ this.components = new ArrayList();
+ }
+
+ this.components.add(component);
+ }
+}
Modified: branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/protocol/Page.java
===================================================================
--- branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/protocol/Page.java 2007-10-15 15:21:39 UTC (rev 8659)
+++ branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/protocol/Page.java 2007-10-15 19:28:21 UTC (rev 8660)
@@ -22,6 +22,10 @@
******************************************************************************/
package org.jboss.portal.uiserver.protocol;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ArrayList;
+
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
*
@@ -29,10 +33,100 @@
public class Page extends PortalObject
{
/**
+ * A page consists of multiple containers that are to be displayed/aggregated along with their corresponding
+ * UI components
+ */
+ private List containers = null;
+
+ /**
+ * Signifies if this page is currently being displayed on the client
+ */
+ private boolean currentlyDisplayed = false;
+
+ /**
*
+ *
*/
+ public Page()
+ {
+ super();
+ this.containers = new ArrayList();
+ }
+
+ /**
+ *
+ */
public String toString()
{
return "Page: "+super.toString();
}
+
+ /**
+ *
+ * @return
+ */
+ public List getWindows()
+ {
+ List windows = new ArrayList();
+
+ if(this.children != null)
+ {
+ for(Iterator itr=this.children.iterator(); itr.hasNext();)
+ {
+ Object child = itr.next();
+
+ if(child instanceof Window)
+ {
+ windows.add(child);
+ }
+ }
+ }
+
+ return windows;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public List getContainers()
+ {
+ return containers;
+ }
+
+ /**
+ *
+ * @param containers
+ */
+ public void setContainers(List containers)
+ {
+ this.containers = containers;
+ }
+
+ /**
+ *
+ * @param container
+ */
+ public void addContainer(Container container)
+ {
+ this.getContainers().add(container);
+ }
+
+ /**
+ *
+ * @return
+ */
+ public boolean isCurrentlyDisplayed()
+ {
+ return currentlyDisplayed;
+ }
+
+ /**
+ *
+ * @param currentlyDisplayed
+ */
+ public void setCurrentlyDisplayed(boolean currentlyDisplayed)
+ {
+ this.currentlyDisplayed = currentlyDisplayed;
+ }
}
Modified: branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/protocol/PortalObject.java
===================================================================
--- branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/protocol/PortalObject.java 2007-10-15 15:21:39 UTC (rev 8659)
+++ branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/protocol/PortalObject.java 2007-10-15 19:28:21 UTC (rev 8660)
@@ -23,9 +23,11 @@
package org.jboss.portal.uiserver.protocol;
import java.io.Serializable;
+import java.util.Map;
import java.util.Collection;
import java.util.ArrayList;
import java.util.Iterator;
+import java.util.HashMap;
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
@@ -37,6 +39,7 @@
protected String name = null;
protected PortalObject parent = null;
protected Collection children = null;
+ protected Map properties = null;
/**
*
@@ -45,6 +48,7 @@
public PortalObject()
{
this.children = new ArrayList();
+ this.properties = new HashMap(5);
}
/**
@@ -172,7 +176,25 @@
/**
*
+ * @return
+ */
+ public Map getProperties()
+ {
+ return properties;
+ }
+
+ /**
+ *
+ * @param properties
*/
+ public void setProperties(Map properties)
+ {
+ this.properties = properties;
+ }
+
+ /**
+ *
+ */
public String toString()
{
String rep = null;
Modified: branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/protocol/Window.java
===================================================================
--- branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/protocol/Window.java 2007-10-15 15:21:39 UTC (rev 8659)
+++ branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/protocol/Window.java 2007-10-15 19:28:21 UTC (rev 8660)
@@ -22,18 +22,219 @@
******************************************************************************/
package org.jboss.portal.uiserver.protocol;
+import java.util.Map;
+import java.util.HashMap;
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+
+
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
*
*/
-public class Window extends PortalObject
+public class Window extends PortalObject implements Component
{
/**
+ * Title for this Window
+ */
+ private String title = null;
+
+ /**
+ * Content/Markup to be displayed inside this Window
+ */
+ private String content = null;
+
+ /**
+ * Content/Markup related to the header of this Window
+ */
+ private final String headerContent;
+
+ /**
+ * The State of this Window such as Normal, Maximized, Minimized etc
+ */
+ private final WindowState windowState;
+
+ /**
+ * The Mode of this Window such as View, Edit, Help etc
+ */
+ private final Mode mode;
+
+ /**
+ * Runtime View related meta data associated with this particular window.
*
+ * The meta data is provided in the form of Name/Value pairs with Name being the key of the and Value being the Value
+ * of a Map entry
*/
+ private Map viewMetaData = null;
+
+
+ /**
+ *
+ *
+ */
+ public Window()
+ {
+ super();
+ this.viewMetaData = new HashMap(5);
+ this.headerContent = null;
+ this.windowState = null;
+ this.mode = null;
+ }
+
+ /**
+ *
+ *
+ */
+ public Window(String id,String title, String content, String headerContent, WindowState windowState, Mode mode)
+ {
+ super();
+ this.viewMetaData = new HashMap(5);
+ this.id = id;
+ this.title = title;
+ this.content = content;
+ this.headerContent = headerContent;
+ this.windowState = windowState;
+ this.mode = mode;
+ }
+
+ /**
+ *
+ * @param id
+ * @param content
+ */
+ public Window(String id, String content)
+ {
+ super();
+ this.viewMetaData = new HashMap(5);
+ this.id = id;
+ this.content = content;
+ this.headerContent = null;
+ this.windowState = null;
+ this.mode = null;
+ }
+
+ /**
+ *
+ * @param id
+ * @param content
+ */
+ public Window(String id)
+ {
+ super();
+ this.viewMetaData = new HashMap(5);
+ this.id = id;
+ this.headerContent = null;
+ this.windowState = null;
+ this.mode = null;
+ }
+
+
+ /**
+ *
+ * @return
+ */
+ public String getContent()
+ {
+ return content;
+ }
+
+
+ /**
+ *
+ * @param content
+ */
+ public void setContent(String content)
+ {
+ this.content = content;
+ }
+
+
+ /**
+ *
+ * @return
+ */
+ public String getHeaderContent()
+ {
+ return headerContent;
+ }
+
+
+ /**
+ *
+ * @return
+ */
+ public Mode getMode()
+ {
+ return mode;
+ }
+
+
+ /**
+ *
+ * @return
+ */
+ public String getTitle()
+ {
+ return title;
+ }
+
+
+ /**
+ *
+ * @param title
+ */
+ public void setTitle(String title)
+ {
+ this.title = title;
+ }
+
+
+ /**
+ *
+ * @return
+ */
+ public WindowState getWindowState()
+ {
+ return windowState;
+ }
+
+
+ /**
+ *
+ */
public String toString()
{
return "Window: "+super.toString();
}
+
+ /**
+ *
+ */
+ public String getMarkup()
+ {
+ String markup = "";
+
+ markup = this.content;
+
+ return markup;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public Map getViewMetaData()
+ {
+ return viewMetaData;
+ }
+
+ /**
+ *
+ * @param viewMetaData
+ */
+ public void setViewMetaData(Map viewMetaData)
+ {
+ this.viewMetaData = viewMetaData;
+ }
}
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/test/uiserver/layout/TestFlexibleGrid.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/test/uiserver/layout/TestFlexibleGrid.java 2007-10-15 15:21:39 UTC (rev 8659)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/test/uiserver/layout/TestFlexibleGrid.java 2007-10-15 19:28:21 UTC (rev 8660)
@@ -28,9 +28,9 @@
import java.io.FileOutputStream;
-import org.jboss.portal.uiserver.layout.Container;
-import org.jboss.portal.uiserver.layout.Window;
-import org.jboss.portal.uiserver.layout.Page;
+import org.jboss.portal.uiserver.protocol.Container;
+import org.jboss.portal.uiserver.protocol.Window;
+import org.jboss.portal.uiserver.protocol.Page;
import org.jboss.portal.uiserver.layout.classic.FlexibleGrid;
import org.jboss.portal.uiserver.layout.classic.FlexibleGridConstraints;
import org.jboss.portal.uiserver.layout.classic.FlexibleGridLayoutManager;
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/test/uiserver/layout/TestRegionLayoutManager.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/test/uiserver/layout/TestRegionLayoutManager.java 2007-10-15 15:21:39 UTC (rev 8659)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/test/uiserver/layout/TestRegionLayoutManager.java 2007-10-15 19:28:21 UTC (rev 8660)
@@ -28,9 +28,9 @@
import java.io.FileOutputStream;
-import org.jboss.portal.uiserver.layout.Container;
-import org.jboss.portal.uiserver.layout.Window;
-import org.jboss.portal.uiserver.layout.Page;
+import org.jboss.portal.uiserver.protocol.Container;
+import org.jboss.portal.uiserver.protocol.Window;
+import org.jboss.portal.uiserver.protocol.Page;
import org.jboss.portal.uiserver.layout.classic.RegionConstraints;
import org.jboss.portal.uiserver.layout.classic.RegionLayoutManager;
Deleted: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/Component.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/Component.java 2007-10-15 15:21:39 UTC (rev 8659)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/Component.java 2007-10-15 19:28:21 UTC (rev 8660)
@@ -1,73 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.uiserver.layout;
-
-import java.io.Serializable;
-
-/**
- * Component represents a UI entity that will be rendered eventually on the client
- *
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- *
- */
-public abstract class Component implements Serializable
-{
- /**
- * required unique id of the component. uniqueness in relation to
- * other components added to the same instance of the container
- */
- protected String id = null;
-
- /**
- *
- * @param id
- */
- public Component(String id)
- {
- this.id = id;
- }
-
- /**
- *
- * @return
- */
- public String getId()
- {
- return id;
- }
-
- /**
- *
- * @param id
- */
- public void setId(String id)
- {
- this.id = id;
- }
-
- /**
- *
- * @return
- */
- public abstract String getMarkup();
-}
Deleted: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/Container.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/Container.java 2007-10-15 15:21:39 UTC (rev 8659)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/Container.java 2007-10-15 19:28:21 UTC (rev 8660)
@@ -1,134 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.uiserver.layout;
-
-import java.io.Serializable;
-import java.util.List;
-import java.util.ArrayList;
-
-/**
- * Container is an organizational entity which aggregates the Components that will be rendered on the client
- *
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- *
- */
-public class Container implements Serializable
-{
- /**
- * required unique id of the container. uniqueness in relation to
- * other containers added to the same instance of the page
- */
- protected String id = null;
-
-
- /**
- *
- */
- private List components = null;
-
- /**
- *
- *
- */
- public Container(String id)
- {
- this.id = id;
- this.components = new ArrayList();
- }
-
- /**
- *
- * @return
- */
- public String getId()
- {
- return id;
- }
-
- /**
- *
- * @param id
- */
- public void setId(String id)
- {
- this.id = id;
- }
-
-
- /**
- *
- * @return
- */
- public List getComponents()
- {
- return components;
- }
-
- /**
- *
- * @param components
- */
- public void setComponents(List components)
- {
- this.components = components;
- }
-
- /**
- *
- * @param componentId
- * @return
- */
- public Component getComponent(String componentId)
- {
- Component component = null;
-
- if(this.components != null)
- {
- for(int i=0;i<this.components.size();i++)
- {
- Component cour = (Component)this.components.get(i);
- if(cour.getId().equals(componentId))
- {
- component = cour;
- break;
- }
- }
- }
-
- return component;
- }
-
- /**
- *
- * @param component
- */
- public void addComponent(Component component)
- {
- if(this.components == null)
- {
- this.components = new ArrayList();
- }
-
- this.components.add(component);
- }
-}
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/LayoutManager.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/LayoutManager.java 2007-10-15 15:21:39 UTC (rev 8659)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/LayoutManager.java 2007-10-15 19:28:21 UTC (rev 8660)
@@ -22,6 +22,8 @@
******************************************************************************/
package org.jboss.portal.uiserver.layout;
+import org.jboss.portal.uiserver.protocol.Page;
+
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
*
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/LayoutService.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/LayoutService.java 2007-10-15 15:21:39 UTC (rev 8659)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/LayoutService.java 2007-10-15 19:28:21 UTC (rev 8660)
@@ -22,6 +22,8 @@
******************************************************************************/
package org.jboss.portal.uiserver.layout;
+import org.jboss.portal.uiserver.protocol.Page;
+
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
*
Deleted: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/Page.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/Page.java 2007-10-15 15:21:39 UTC (rev 8659)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/Page.java 2007-10-15 19:28:21 UTC (rev 8660)
@@ -1,83 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.uiserver.layout;
-
-import java.io.Serializable;
-import java.util.List;
-import java.util.ArrayList;
-
-/**
- * A Page is a domain level representation of the final output produced by the Portal.
- *
- * It aggregates the output of multiple containers. It is decoupled from any particular LayoutManager
- *
- * Eventually the LayoutService processes an instance of a Page to properly layout the containers depending on
- * the layout strategy of the LayoutManager
- *
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- *
- */
-public class Page implements Serializable
-{
- /**
- * A page consists of multiple containers that are to be displayed/aggregated along with their corresponding
- * UI components
- */
- private List containers = null;
-
- /**
- *
- *
- */
- public Page()
- {
- this.containers = new ArrayList();
- }
-
- /**
- *
- * @return
- */
- public List getContainers()
- {
- return containers;
- }
-
- /**
- *
- * @param containers
- */
- public void setContainers(List containers)
- {
- this.containers = containers;
- }
-
- /**
- *
- * @param container
- */
- public void addContainer(Container container)
- {
- this.getContainers().add(container);
- }
-}
Deleted: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/Window.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/Window.java 2007-10-15 15:21:39 UTC (rev 8659)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/Window.java 2007-10-15 19:28:21 UTC (rev 8660)
@@ -1,87 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.uiserver.layout;
-
-/**
- * Window is a UI component which represents a Portlet Window and its corresponding markup which will be eventually rendered on the client
- *
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- *
- */
-public class Window extends Component
-{
- /**
- *
- */
- private String content = null;
-
- /**
- *
- * @param id
- */
- public Window(String id)
- {
- super(id);
- }
-
- /**
- *
- * @param id
- * @param content markup content produced by a portlet to be displayed inside this window
- */
- public Window(String id,String content)
- {
- this(id);
- this.content = content;
- }
-
- /**
- *
- * @return
- */
- public String getContent()
- {
- return content;
- }
-
- /**
- *
- * @param content
- */
- public void setContent(String content)
- {
- this.content = content;
- }
-
- /**
- *
- */
- public String getMarkup()
- {
- String markup = "";
-
- markup = this.content;
-
- return markup;
- }
-}
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/classic/FlexibleGrid.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/classic/FlexibleGrid.java 2007-10-15 15:21:39 UTC (rev 8659)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/classic/FlexibleGrid.java 2007-10-15 19:28:21 UTC (rev 8660)
@@ -24,8 +24,8 @@
import org.apache.log4j.Logger;
-import org.jboss.portal.uiserver.layout.Container;
-import org.jboss.portal.uiserver.layout.Window;
+import org.jboss.portal.uiserver.protocol.Container;
+import org.jboss.portal.uiserver.protocol.Window;
import java.io.Serializable;
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/classic/FlexibleGridLayoutManager.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/classic/FlexibleGridLayoutManager.java 2007-10-15 15:21:39 UTC (rev 8659)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/classic/FlexibleGridLayoutManager.java 2007-10-15 19:28:21 UTC (rev 8660)
@@ -22,10 +22,11 @@
******************************************************************************/
package org.jboss.portal.uiserver.layout.classic;
-import org.jboss.portal.uiserver.layout.Container;
+import org.jboss.portal.uiserver.protocol.Container;
+import org.jboss.portal.uiserver.protocol.Page;
import org.jboss.portal.uiserver.layout.LayoutManager;
-import org.jboss.portal.uiserver.layout.Page;
+
import java.util.List;
import java.util.ArrayList;
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/classic/RegionLayoutManager.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/classic/RegionLayoutManager.java 2007-10-15 15:21:39 UTC (rev 8659)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/classic/RegionLayoutManager.java 2007-10-15 19:28:21 UTC (rev 8660)
@@ -26,9 +26,9 @@
import java.util.ArrayList;
import org.jboss.portal.uiserver.layout.LayoutManager;
-import org.jboss.portal.uiserver.layout.Page;
-import org.jboss.portal.uiserver.layout.Container;
-import org.jboss.portal.uiserver.layout.Window;
+import org.jboss.portal.uiserver.protocol.Page;
+import org.jboss.portal.uiserver.protocol.Container;
+import org.jboss.portal.uiserver.protocol.Window;
/**
* This layout manager splits the page up into Regions. Containers which contain the Portlet Windows
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/UIServer.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/UIServer.java 2007-10-15 15:21:39 UTC (rev 8659)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/UIServer.java 2007-10-15 19:28:21 UTC (rev 8660)
@@ -32,9 +32,11 @@
import org.jboss.mx.util.MBeanProxy;
import org.jboss.mx.util.MBeanServerLocator;
-import org.jboss.portal.uiserver.layout.Container;
-import org.jboss.portal.uiserver.layout.Page;
-import org.jboss.portal.uiserver.layout.Window;
+import org.jboss.portal.uiserver.protocol.Container;
+import org.jboss.portal.uiserver.protocol.Page;
+import org.jboss.portal.uiserver.protocol.Window;
+import org.jboss.portal.uiserver.protocol.PortalObject;
+import org.jboss.portal.uiserver.protocol.Portal;
import org.jboss.portal.uiserver.layout.LayoutManager;
import org.jboss.portal.uiserver.layout.classic.FlexibleGrid;
import org.jboss.portal.uiserver.layout.classic.FlexibleGridConstraints;
@@ -42,13 +44,10 @@
import org.jboss.portal.uiserver.layout.classic.RegionLayoutManager;
import org.jboss.portal.uiserver.layout.classic.RegionConstraints;
-import org.jboss.portal.uiserver.protocol.PageResult;
-import org.jboss.portal.uiserver.protocol.WindowResult;
-import org.jboss.portal.uiserver.protocol.PortalObject;
-import org.jboss.portal.uiserver.protocol.Portal;
import org.jboss.portal.uiserver.processor.Processor;
import org.jboss.portal.uiserver.processor.ProcessorRequest;
+import org.jboss.portal.uiserver.processor.ProcessorResponse;
import org.jboss.portal.uiserver.spi.PortalObjectReader;
import org.jboss.portal.jems.as.system.AbstractJBossService;
@@ -94,74 +93,128 @@
*
*/
public void handle(ServerInvocation invocation) throws ServerException
- {
- String portalRequestPath = invocation.getServerContext().getPortalRequestPath();
-
- //Process the incoming request and produce a proper ProcessorRequest to be
- //processed by the core Portal component
- Portal portal = null;
- PortalObject target = null;
- String actionType = "render";
- StringTokenizer st = new StringTokenizer(portalRequestPath, "/");
- StringBuffer buffer = new StringBuffer("/");
- while(st.hasMoreTokens())
+ {
+ try
{
- String token = st.nextToken();
- if(portal == null)
+ String portalRequestPath = invocation.getServerContext().getPortalRequestPath();
+
+ //Process the incoming request and produce a proper ProcessorRequest to be
+ //processed by the core Portal component
+ Portal portal = null;
+ PortalObject target = null;
+ String actionType = "render";
+ StringTokenizer st = new StringTokenizer(portalRequestPath, "/");
+ StringBuffer buffer = new StringBuffer("/");
+ while(st.hasMoreTokens())
{
- portal = this.portalObjectReader.findPortal(token);
- if(portal != null)
+ String token = st.nextToken();
+ if(portal == null)
{
+ portal = this.portalObjectReader.findPortal(token);
+ if(portal != null)
+ {
+ buffer.append(token);
+ if(st.hasMoreTokens())
+ {
+ buffer.append("/");
+ }
+ }
+ }
+ else
+ {
buffer.append(token);
+ String id = buffer.toString();
if(st.hasMoreTokens())
{
buffer.append("/");
}
- }
- }
- else
- {
- buffer.append(token);
- String id = buffer.toString();
- if(st.hasMoreTokens())
- {
- buffer.append("/");
- }
-
- if(target == null)
- {
- target = portal.findChild(id);
+
if(target == null)
{
- target = this.portalObjectReader.findPortalObject(portal, id);
+ target = portal.findChild(id);
+ if(target == null)
+ {
+ target = this.portalObjectReader.findPortalObject(portal, id);
+ }
}
- }
- else
- {
- PortalObject cour = target.findChild(id);
- if(cour == null)
- {
- target = this.portalObjectReader.findPortalObject(target, id);
- }
else
{
- target = cour;
+ PortalObject cour = target.findChild(id);
+ if(cour == null)
+ {
+ target = this.portalObjectReader.findPortalObject(target, id);
+ }
+ else
+ {
+ target = cour;
+ }
}
+ }
+ }
+
+ String actionParam = invocation.getServerContext().getClientRequest().getParameter("action");
+ if(actionParam != null && actionParam.trim().length()>0 && actionParam.equals("1"))
+ {
+ actionType = "action";
+ }
+
+ ProcessorRequest processorRequest = new ProcessorRequest(actionType, invocation, portal, target);
+ ProcessorResponse processorResponse = this.processor.process(processorRequest);
+
+ //Go ahead and render to the client based on ProcessorResponse received from the core Portal
+ if(processorResponse != null)
+ {
+ Page displayedPage = processorResponse.findDisplayedPage();
+ if(displayedPage != null)
+ {
+ this.render(invocation.getServerContext().getClientResponse().getWriter(),
+ displayedPage);
}
- }
- }
-
- String actionParam = invocation.getServerContext().getClientRequest().getParameter("action");
- if(actionParam != null && actionParam.trim().length()>0 && actionParam.equals("1"))
+ }
+ }
+ catch(Exception e)
{
- actionType = "action";
+ throw new ServerException(e);
}
-
- ProcessorRequest processorRequest = new ProcessorRequest(actionType, invocation, portal, target);
- this.processor.process(processorRequest);
+ }
+ //-----------------------------------------------------------------------------------------------------------------------------------------------------------
+ /**
+ *
+ */
+ public PortalObjectReader getPortalObjectReader()
+ {
+ return portalObjectReader;
}
/**
+ *
+ * @param portalObjectReader
+ */
+ public void setPortalObjectReader(PortalObjectReader portalObjectReader)
+ {
+ this.portalObjectReader = portalObjectReader;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public Processor getProcessor()
+ {
+ return processor;
+ }
+
+ /**
+ *
+ * @param processor
+ */
+ public void setProcessor(Processor processor)
+ {
+ this.processor = processor;
+ }
+ //---------All these are just helper methods for the prototype-----------------------------------------------------------------------------------------------
+ //----It containts mostly hard coded logic for the prototype-------------------------------------------------------------------------------------------------
+ /**
* Based on the latest design discussion, this method is not needed.
*
* This will be an implementation detail of the UIServer processing the Response that is sent back to it
@@ -170,7 +223,7 @@
* @param clientConnection
* @param page
*/
- public void render(PrintWriter clientConnection, PageResult pageResult)
+ private void render(PrintWriter clientConnection, Page pageResult)
{
/**
* Special Note: Currently this prototype code and layout configuration including page result creation is hard coded for the purpose
@@ -183,20 +236,19 @@
*
*/
-
/**
* Some flexible grid layout testing code
*/
- //Object[] gridData = this.getFlexibleGridLayoutManager(pageResult);
- //Page page = (Page)gridData[0];
- //LayoutManager layoutManager = (LayoutManager)gridData[1];
+ Object[] gridData = this.getFlexibleGridLayoutManager(pageResult);
+ Page page = (Page)gridData[0];
+ LayoutManager layoutManager = (LayoutManager)gridData[1];
/**
* Some region layout testing code
*/
- Object[] regionData = this.getRegionBasedLayoutManager(pageResult);
- Page page = (Page)regionData[0];
- LayoutManager layoutManager = (LayoutManager)regionData[1];
+ //Object[] regionData = this.getRegionBasedLayoutManager(pageResult);
+ //Page page = (Page)regionData[0];
+ //LayoutManager layoutManager = (LayoutManager)regionData[1];
//Peform Page Layout
String output = layoutManager.doLayout(page);
@@ -212,49 +264,13 @@
//Sending the results back to the Client
clientConnection.write(buffer.toString());
clientConnection.flush();
- }
- //-----------------------------------------------------------------------------------------------------------------------------------------------------------
- /**
- *
- */
- public PortalObjectReader getPortalObjectReader()
- {
- return portalObjectReader;
}
-
+
/**
*
- * @param portalObjectReader
*/
- public void setPortalObjectReader(PortalObjectReader portalObjectReader)
+ private Object[] getFlexibleGridLayoutManager(Page pageResult)
{
- this.portalObjectReader = portalObjectReader;
- }
-
- /**
- *
- * @return
- */
- public Processor getProcessor()
- {
- return processor;
- }
-
- /**
- *
- * @param processor
- */
- public void setProcessor(Processor processor)
- {
- this.processor = processor;
- }
- //---------All these are just helper methods for the prototype-----------------------------------------------------------------------------------------------
- //----It containts mostly hard coded logic for the prototype-------------------------------------------------------------------------------------------------
- /**
- *
- */
- private Object[] getFlexibleGridLayoutManager(PageResult pageResult)
- {
/**
* Hard coding the FlexibleGridLayout Management here
*/
@@ -305,7 +321,7 @@
int counter = 0;
for(Iterator itr=windows.iterator();itr.hasNext();)
{
- WindowResult result = (WindowResult)itr.next();
+ Window result = (Window)itr.next();
switch(counter)
{
@@ -380,7 +396,7 @@
* @param pageResult
* @return
*/
- private Object[] getRegionBasedLayoutManager(PageResult pageResult)
+ private Object[] getRegionBasedLayoutManager(Page pageResult)
{
Page page = new Page();
Container left = new Container("left");
@@ -393,7 +409,7 @@
int counter = 0;
for(Iterator itr=windows.iterator();itr.hasNext();)
{
- WindowResult result = (WindowResult)itr.next();
+ Window result = (Window)itr.next();
Window uiWindow = new Window(result.getId());
uiWindow.setContent(result.getContent());
switch(counter)
16 years, 8 months
JBoss Portal SVN: r8659 - in modules: portlet/trunk/build and 2 other directories.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-10-15 11:21:39 -0400 (Mon, 15 Oct 2007)
New Revision: 8659
Modified:
modules/identity/trunk/build/build-thirdparty.xml
modules/portlet/trunk/build/build-thirdparty.xml
modules/test/trunk/build/build-thirdparty.xml
modules/web/trunk/build/build-thirdparty.xml
Log:
Using trunk versions of the modules
Modified: modules/identity/trunk/build/build-thirdparty.xml
===================================================================
--- modules/identity/trunk/build/build-thirdparty.xml 2007-10-15 10:24:27 UTC (rev 8658)
+++ modules/identity/trunk/build/build-thirdparty.xml 2007-10-15 15:21:39 UTC (rev 8659)
@@ -47,8 +47,8 @@
are pushed to the http://repository.jboss.com site.
-->
- <componentref name="jboss-portal/modules/common" version="1.0.0-SNAPSHOT"/>
- <componentref name="jboss-portal/modules/test" version="1.0.0-SNAPSHOT"/>
+ <componentref name="jboss-portal/modules/common" version="trunk-SNAPSHOT"/>
+ <componentref name="jboss-portal/modules/test" version="trunk-SNAPSHOT"/>
<componentref name="apache-log4j" version="1.2.8"/>
<componentref name="apache-logging" version="1.0.5.SP1-jboss"/>
<componentref name="apache-xerces" version="2.7.1"/>
Modified: modules/portlet/trunk/build/build-thirdparty.xml
===================================================================
--- modules/portlet/trunk/build/build-thirdparty.xml 2007-10-15 10:24:27 UTC (rev 8658)
+++ modules/portlet/trunk/build/build-thirdparty.xml 2007-10-15 15:21:39 UTC (rev 8659)
@@ -46,9 +46,9 @@
are pushed to the http://repository.jboss.com site.
-->
- <componentref name="jboss-portal/modules/common" version="1.0.0-SNAPSHOT"/>
- <componentref name="jboss-portal/modules/web" version="1.0.0-SNAPSHOT"/>
- <componentref name="jboss-portal/modules/test" version="1.0.0-SNAPSHOT"/>
+ <componentref name="jboss-portal/modules/common" version="trunk-SNAPSHOT"/>
+ <componentref name="jboss-portal/modules/web" version="trunk-SNAPSHOT"/>
+ <componentref name="jboss-portal/modules/test" version="trunk-SNAPSHOT"/>
<componentref name="sun-servlet" version="2.4"/>
<componentref name="sun-jaf" version="1.1"/>
Modified: modules/test/trunk/build/build-thirdparty.xml
===================================================================
--- modules/test/trunk/build/build-thirdparty.xml 2007-10-15 10:24:27 UTC (rev 8658)
+++ modules/test/trunk/build/build-thirdparty.xml 2007-10-15 15:21:39 UTC (rev 8659)
@@ -47,7 +47,7 @@
are pushed to the http://repository.jboss.com site.
-->
- <componentref name="jboss-portal/modules/common" version="1.0.0-SNAPSHOT"/>
+ <componentref name="jboss-portal/modules/common" version="trunk-SNAPSHOT"/>
<componentref name="apache-ant" version="1.6.5"/>
Modified: modules/web/trunk/build/build-thirdparty.xml
===================================================================
--- modules/web/trunk/build/build-thirdparty.xml 2007-10-15 10:24:27 UTC (rev 8658)
+++ modules/web/trunk/build/build-thirdparty.xml 2007-10-15 15:21:39 UTC (rev 8659)
@@ -47,8 +47,8 @@
are pushed to the http://repository.jboss.com site.
-->
- <componentref name="jboss-portal/modules/common" version="1.0.0-SNAPSHOT"/>
- <componentref name="jboss-portal/modules/test" version="1.0.0-SNAPSHOT"/>
+ <componentref name="jboss-portal/modules/common" version="trunk-SNAPSHOT"/>
+ <componentref name="jboss-portal/modules/test" version="trunk-SNAPSHOT"/>
<componentref name="sun-servlet" version="2.4"/>
<componentref name="apache-tomcat" version="5.0.30"/>
<componentref name="sun-jaf" version="1.0.2"/>
16 years, 8 months
JBoss Portal SVN: r8658 - modules/portlet/branches.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-10-15 06:24:27 -0400 (Mon, 15 Oct 2007)
New Revision: 8658
Removed:
modules/portlet/branches/JBP_PORTLET_BRANCH_1_1/
Log:
Delete branch (premature)
16 years, 8 months