JBoss Portal SVN: r8687 - in modules/test/trunk/unit/src/main/org/jboss: unit/report and 1 other directories.
by portal-commits@lists.jboss.org
Author: emuckenhuber
Date: 2007-10-18 06:10:11 -0400 (Thu, 18 Oct 2007)
New Revision: 8687
Modified:
modules/test/trunk/unit/src/main/org/jboss/test/unit/report/junit/JUnitReporterTests.java
modules/test/trunk/unit/src/main/org/jboss/unit/report/
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
Log:
- generating testcase name based on TestInfo names
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-18 06:17:01 UTC (rev 8686)
+++ modules/test/trunk/unit/src/main/org/jboss/test/unit/report/junit/JUnitReporterTests.java 2007-10-18 10:10:11 UTC (rev 8687)
@@ -60,7 +60,7 @@
{
MyTestReport report = new MyTestReport(testSuiteName);
// add StartRunnerEvent
- report.startTestSuite(new StartRunnerEvent());
+ report.startJUnitTestSuite(new StartRunnerEvent());
// add RunnerFailureEvent
Failure f = new Failure("fehler", FailureType.ERROR);
RunnerFailureEvent rfe = new RunnerFailureEvent(f);
@@ -97,7 +97,7 @@
private static void testTestCase()
{
MyTestReport report = new MyTestReport(testSuiteName);
- report.startTestSuite(new StartRunnerEvent());
+ report.startJUnitTestSuite(new StartRunnerEvent());
TestId testId = new TestId("foo");
StartTestCaseEvent startTestEvent = new StartTestCaseEvent(testId, new MyTestInfo());
@@ -130,10 +130,11 @@
private static void testTestCaseClass()
{
MyTestReport report = new MyTestReport(testSuiteName);
- report.startTestSuite(new StartRunnerEvent());
+ report.startJUnitTestSuite(new StartRunnerEvent());
// Set current tested class name
- report.setCurrentTestedClassName("org.jboss.portal.test.testedClass1");
+ report.addTestedSuiteName("org.jboss.portal.test.testedClass1");
+ report.addTestedSuiteName("blah");
TestId testId = new TestId("foo");
StartTestCaseEvent startTestEvent = new StartTestCaseEvent(testId, new MyTestInfo());
@@ -153,17 +154,17 @@
Element testCase = child(e, TESTCASE);
Assert.assertEquals(TESTCASE, testCase.getNodeName());
- Assert.assertEquals("org.jboss.portal.test.testedClass1.foo", testCase.getAttribute(ATTR_NAME));
+ Assert.assertEquals("org.jboss.portal.test.testedClass1.blah.foo", testCase.getAttribute(ATTR_NAME));
Assert.assertEquals("0.02", testCase.getAttribute(ATTR_TIME));
-
- Assert.assertNull(child(e, ERROR));
+
+ Assert.assertNull(child(e, ERROR));
}
private static void testTestCaseFailure()
{
MyTestReport report = new MyTestReport(testSuiteName);
- report.startTestSuite(new StartRunnerEvent());
+ report.startJUnitTestSuite(new StartRunnerEvent());
TestId testId = new TestId("foo");
StartTestCaseEvent startTestEvent = new StartTestCaseEvent(testId, new MyTestInfo());
Property changes on: modules/test/trunk/unit/src/main/org/jboss/unit/report
___________________________________________________________________
Name: svn:ignore
+ junit
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-18 06:17:01 UTC (rev 8686)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/report/impl/junit/JUnitReporter.java 2007-10-18 10:10:11 UTC (rev 8687)
@@ -31,6 +31,7 @@
import org.jboss.unit.runner.TestRunnerEvent;
import org.jboss.unit.runner.event.EndRunnerEvent;
import org.jboss.unit.runner.event.EndTestCaseEvent;
+import org.jboss.unit.runner.event.EndTestSuiteEvent;
import org.jboss.unit.runner.event.RunnerFailureEvent;
import org.jboss.unit.runner.event.StartRunnerEvent;
import org.jboss.unit.runner.event.StartTestCaseEvent;
@@ -82,7 +83,7 @@
{
if (event instanceof StartRunnerEvent)
{
- report.startTestSuite((StartRunnerEvent) event);
+ report.startJUnitTestSuite((StartRunnerEvent) event);
}
else if (event instanceof EndRunnerEvent)
{
@@ -102,8 +103,12 @@
}
else if (event instanceof StartTestSuiteEvent)
{
- report.setCurrentTestedClassName(((StartTestSuiteEvent) event).getTestInfo().getName());
+ report.addTestedSuiteName(((StartTestSuiteEvent) event).getTestInfo().getName());
}
+ else if (event instanceof EndTestSuiteEvent)
+ {
+ report.removeLastTestedSuite();
+ }
else if (event instanceof StartTestCaseEvent)
{
report.startTest((StartTestCaseEvent) 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-18 06:17:01 UTC (rev 8686)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/report/impl/junit/JUnitTestReport.java 2007-10-18 10:10:11 UTC (rev 8687)
@@ -35,6 +35,8 @@
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
import java.util.Map;
import javax.xml.parsers.DocumentBuilder;
@@ -105,8 +107,8 @@
/** The timeStamp */
private String timeStamp;
- /** The current testSuiteName */
- private String currentTestedClassName;
+ /** The tested classes Stack */
+ private LinkedList<String> testSuiteNames = new LinkedList<String>();
/** .*/
private NumberFormat FORMAT = NumberFormat.getInstance();
@@ -121,7 +123,7 @@
}
- public void startTestSuite(StartRunnerEvent event)
+ public void startJUnitTestSuite(StartRunnerEvent event)
{
/** Create root element */
this.document = getDocumentBuilder().newDocument();
@@ -137,11 +139,18 @@
*/
}
- public void setCurrentTestedClassName(String testedClassName)
+ // add tested class to stack (starttestsuiteevent)
+ public void addTestedSuiteName(String testedClassName)
{
- this.currentTestedClassName = testedClassName;
+ this.testSuiteNames.add(testedClassName);
}
+ // remove last from stack (endtestsuiteevent)
+ public void removeLastTestedSuite()
+ {
+ this.testSuiteNames.removeLast();
+ }
+
public void startTest(StartTestCaseEvent event)
{
this.startedTests.put(event.getTestId(), event.getTestInfo());
@@ -170,10 +179,10 @@
/** The testcase name */
StringBuffer nb = new StringBuffer();
/** The current tested Class */
- if (this.currentTestedClassName != null)
+ for(String testSuiteName : this.testSuiteNames)
{
- nb.append(this.currentTestedClassName);
- nb.append(".");
+ nb.append(testSuiteName);
+ nb.append(".");
}
/** TestId */
for(int i = 0; i < testId.getLength(); i ++)
16 years, 8 months
JBoss Portal SVN: r8686 - in branches/UIServer: core/src/resources/portal-core-sar/META-INF and 11 other directories.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2007-10-18 02:17:01 -0400 (Thu, 18 Oct 2007)
New Revision: 8686
Added:
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/Portal.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/GWTClientFilter.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/PortalEntryPoint.java
branches/UIServer/uiserver/src/resources/client/ajax/src/org/jboss/portal/uiserver/ajax/Portal.gwt.xml
branches/UIServer/uiserver/src/resources/client/ajax/src/org/jboss/portal/uiserver/ajax/public/index.html
branches/UIServer/uiserver/src/resources/portal-uiserver.sar/
branches/UIServer/uiserver/src/resources/portal-uiserver.sar/META-INF/
branches/UIServer/uiserver/src/resources/portal-uiserver.sar/META-INF/jboss-service.xml
branches/UIServer/uiserver/src/resources/portal-uiserver.war/
branches/UIServer/uiserver/src/resources/portal-uiserver.war/WEB-INF/
branches/UIServer/uiserver/src/resources/portal-uiserver.war/WEB-INF/jboss-web.xml
branches/UIServer/uiserver/src/resources/portal-uiserver.war/WEB-INF/web.xml
branches/UIServer/uiserver/src/resources/portal-uiserver.war/asyncPages.html
branches/UIServer/uiserver/src/resources/portal-uiserver.war/layout.html
branches/UIServer/uiserver/src/resources/portal-uiserver.war/partialRefresh.html
Removed:
branches/UIServer/uiserver/src/resources/client/ajax/uiserver-poc.war/
Modified:
branches/UIServer/core/build.xml
branches/UIServer/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
branches/UIServer/uiserver/build.xml
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/PortletServiceImpl.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/UIServer.java
Log:
First pass of integrating a GWT-based AJAX client with PF (PF=Presentation Framework). Code still raw. Mainly trying to backup code before leaving town.
Modified: branches/UIServer/core/build.xml
===================================================================
--- branches/UIServer/core/build.xml 2007-10-17 16:48:30 UTC (rev 8685)
+++ branches/UIServer/core/build.xml 2007-10-18 06:17:01 UTC (rev 8686)
@@ -348,7 +348,7 @@
<!--dtd-->
<copy todir="${build.resources}/jboss-portal/dtd">
<fileset dir="${jboss.portal-identity.root}/resources/dtd" includes="*.dtd"/>
- </copy>
+ </copy>
</target>
@@ -380,19 +380,16 @@
</target>
<!-- Build the jboss-portal.sar -->
- <target name="pre-output">
- <copy todir="${build.resources}/jboss-portal/lib">
- <fileset dir="${jboss.portal-uiserver.root}/lib" includes="portal-uiserver-lib.jar"/>
- </copy>
- <copy todir="${build.resources}/jboss-portal.sar/lib">
- <fileset dir="${jboss.portal-uiserver.root}/lib" includes="portal-uiserver-lib.jar"/>
- </copy>
- <copy todir="${build.resources}/jboss-portal/lib">
- <fileset dir="${jboss.portal-core-uiserver.root}/lib" includes="portal-core-uiserver-lib.jar"/>
- </copy>
- <copy todir="${build.resources}/jboss-portal.sar/lib">
- <fileset dir="${jboss.portal-core-uiserver.root}/lib" includes="portal-core-uiserver-lib.jar"/>
- </copy>
+ <target name="pre-output">
+ <copy todir="${build.resources}/jboss-portal/lib">
+ <fileset dir="${jboss.portal-core-uiserver.root}/lib" includes="portal-core-uiserver-lib.jar"/>
+ </copy>
+ <copy todir="${build.resources}/jboss-portal.sar/lib">
+ <fileset dir="${jboss.portal-core-uiserver.root}/lib" includes="portal-core-uiserver-lib.jar"/>
+ </copy>
+ <copy todir="${build.resources}/jboss-portal/portal-uiserver.sar">
+ <fileset dir="${jboss.portal-uiserver.root}/resources/portal-uiserver.sar"/>
+ </copy>
</target>
<target name="output" depends="artifacts,pre-output">
<!-- Build configurations -->
@@ -745,6 +742,7 @@
-->
<target name="deploy-explode" depends="output,explode">
<require file="${jboss.home}/server/${portal.deploy.dir}"/>
+ <delete dir="${jboss.home}/server/${portal.deploy.dir}/jboss-portal.sar"/>
<copy todir="${jboss.home}/server/${portal.deploy.dir}/jboss-portal.sar" overwrite="true">
<fileset dir="${build.lib}/jboss-portal-exploded.sar"/>
</copy>
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-17 16:48:30 UTC (rev 8685)
+++ branches/UIServer/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-10-18 06:17:01 UTC (rev 8686)
@@ -1128,26 +1128,7 @@
<depends>portal:service=ContentProviderRegistry</depends>
<depends>portal:service=ResponseHandler,type=Selector</depends>
<depends>portal:service=ControlPolicy,type=Page</depends>
- </mbean>
- <mbean
- code="org.jboss.portal.uiserver.service.UIServer"
- name="portal:service=Controller"
- xmbean-dd=""
- xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
- <xmbean/>
- <depends optional-attribute-name="PortalObjectReader" proxy-type="attribute">portal:container=PortalObjectReader</depends>
- <depends optional-attribute-name="Processor" proxy-type="attribute">portal:service=Processor</depends>
- <depends>portal:service=PageService</depends>
- <depends>portal:commandFactory=DefaultPortal</depends>
- <depends>portal:urlFactory=Delegating</depends>
- <depends>portal:service=InterceptorStackFactory,type=Command</depends>
- <depends>portal:container=Instance</depends>
- <depends>portal:service=PortalAuthorizationManagerFactory</depends>
- <depends>portal:service=CustomizationManager</depends>
- <depends>portal:service=ContentProviderRegistry</depends>
- <depends>portal:service=ResponseHandler,type=Selector</depends>
- <depends>portal:service=ControlPolicy,type=Page</depends>
- </mbean>
+ </mbean>
<!-- The controller factory -->
Modified: branches/UIServer/uiserver/build.xml
===================================================================
--- branches/UIServer/uiserver/build.xml 2007-10-17 16:48:30 UTC (rev 8685)
+++ branches/UIServer/uiserver/build.xml 2007-10-18 06:17:01 UTC (rev 8686)
@@ -210,7 +210,60 @@
</fileset>
<fileset dir="../portlet/output/classes">
</fileset>
- </jar>
+ </jar>
+
+ <!-- portal-uiserver.war -->
+ <!-- compile the GWT Java code into JavaScript/Web resources -->
+ <!--
+ These are only standalone GWT prototypes
+ <delete dir="${build.resources}/portal-uiserver.war/org.jboss.portal.uiserver.ajax.PortalLayout"/>
+ <java classpathref="gwt.gwt.classpath" fork="true" classname="com.google.gwt.dev.GWTCompiler">
+ <classpath>
+ <pathelement path="src/main"/>
+ <pathelement path="src/resources/client/ajax/src"/>
+ </classpath>
+ <arg line="-out ${build.resources}/portal-uiserver.war/"/>
+ <arg line="org.jboss.portal.uiserver.ajax.PortalLayout"/>
+ </java>
+
+ <delete dir="${build.resources}/portal-uiserver.war/org.jboss.portal.uiserver.ajax.PartialRefresh"/>
+ <java classpathref="gwt.gwt.classpath" fork="true" classname="com.google.gwt.dev.GWTCompiler">
+ <classpath>
+ <pathelement path="src/main"/>
+ <pathelement path="src/resources/client/ajax/src"/>
+ </classpath>
+ <arg line="-out ${build.resources}/portal-uiserver.war/"/>
+ <arg line="org.jboss.portal.uiserver.ajax.PartialRefresh"/>
+ </java>
+ -->
+
+ <delete dir="${build.resources}/portal-uiserver.war/org.jboss.portal.uiserver.ajax.Portal"/>
+ <java classpathref="gwt.gwt.classpath" fork="true" classname="com.google.gwt.dev.GWTCompiler">
+ <classpath>
+ <pathelement path="src/main"/>
+ <pathelement path="src/resources/client/ajax/src"/>
+ </classpath>
+ <arg line="-out ${build.resources}/portal-uiserver.war/"/>
+ <arg line="org.jboss.portal.uiserver.ajax.Portal"/>
+ </java>
+ <jar jarfile="${build.lib}/portal-uiserver.war">
+ <fileset dir="${build.resources}/portal-uiserver.war"></fileset>
+ </jar>
+ <copy todir="${build.resources}/portal-uiserver.war">
+ <fileset dir="${build.resources}/portal-uiserver.war/org.jboss.portal.uiserver.ajax.Portal"/>
+ </copy>
+ <delete dir="${build.resources}/portal-uiserver.war/org.jboss.portal.uiserver.ajax.Portal"/>
+
+
+ <!-- portal-uiserver.sar -->
+ <copy file="${gwt.gwt.root}/lib/gwt-user.jar" todir="${build.resources}/portal-uiserver.sar/lib" overwrite="true"/>
+ <copy file="${build.lib}/portal-uiserver-lib.jar" todir="${build.resources}/portal-uiserver.sar/lib" overwrite="true"/>
+ <copy todir="${build.resources}/portal-uiserver.sar/portal-uiserver.war">
+ <fileset dir="${build.resources}/portal-uiserver.war"/>
+ </copy>
+ <jar jarfile="${build.lib}/portal-uiserver.sar">
+ <fileset dir="${build.resources}/portal-uiserver.sar"></fileset>
+ </jar>
</target>
<target name="output" depends="artifacts">
@@ -246,47 +299,5 @@
<!-- ================================================================== -->
<!-- Deployment -->
- <!-- ================================================================== -->
- <target name="deploy-poc" depends="output">
- <!-- compile the GWT Java code into JavaScript/Web resources -->
- <delete dir="${build.resources}/client/ajax/uiserver-poc.war/org.jboss.portal.uiserver.ajax.PortalLayout"/>
- <java classpathref="gwt.gwt.classpath" fork="true" classname="com.google.gwt.dev.GWTCompiler">
- <classpath>
- <pathelement path="src/main"/>
- <pathelement path="src/resources/client/ajax/src"/>
- </classpath>
- <arg line="-out ${build.resources}/client/ajax/uiserver-poc.war/"/>
- <arg line="org.jboss.portal.uiserver.ajax.PortalLayout"/>
- </java>
-
- <delete dir="${build.resources}/client/ajax/uiserver-poc.war/org.jboss.portal.uiserver.ajax.PartialRefresh"/>
- <java classpathref="gwt.gwt.classpath" fork="true" classname="com.google.gwt.dev.GWTCompiler">
- <classpath>
- <pathelement path="src/main"/>
- <pathelement path="src/resources/client/ajax/src"/>
- </classpath>
- <arg line="-out ${build.resources}/client/ajax/uiserver-poc.war/"/>
- <arg line="org.jboss.portal.uiserver.ajax.PartialRefresh"/>
- </java>
-
- <delete dir="${build.resources}/client/ajax/uiserver-poc.war/org.jboss.portal.uiserver.ajax.AsyncPages"/>
- <java classpathref="gwt.gwt.classpath" fork="true" classname="com.google.gwt.dev.GWTCompiler">
- <classpath>
- <pathelement path="src/main"/>
- <pathelement path="src/resources/client/ajax/src"/>
- </classpath>
- <arg line="-out ${build.resources}/client/ajax/uiserver-poc.war/"/>
- <arg line="org.jboss.portal.uiserver.ajax.AsyncPages"/>
- </java>
-
- <copy file="${build.lib}/portal-uiserver-lib.jar" todir="${build.resources}/client/ajax/uiserver-poc.war/WEB-INF/lib" overwrite="true"/>
- <copy file="src/resources/client/ajax/uiserver-poc.war/WEB-INF/lib/gwt-user.jar" todir="${build.resources}/client/ajax/uiserver-poc.war/WEB-INF/lib" overwrite="true"/>
-
- <jar jarfile="${build.lib}/uiserver-poc.war">
- <fileset dir="${build.resources}/client/ajax/uiserver-poc.war"></fileset>
- </jar>
-
- <!-- deploy the poc war file into the application server for testing -->
- <copy file="${build.lib}/uiserver-poc.war" todir="${jboss.home}/server/${portal.deploy.dir}" overwrite="true"/>
- </target>
+ <!-- ================================================================== -->
</project>
Added: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/Portal.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/Portal.java (rev 0)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/Portal.java 2007-10-18 06:17:01 UTC (rev 8686)
@@ -0,0 +1,429 @@
+package org.jboss.portal.uiserver.ajax.client;
+
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.core.client.EntryPoint;
+
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.Element;
+import com.google.gwt.user.client.Event;
+import com.google.gwt.user.client.HTTPRequest;
+import com.google.gwt.user.client.ResponseTextHandler;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.Widget;
+import com.google.gwt.user.client.ui.Panel;
+import com.google.gwt.user.client.ui.RootPanel;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.VerticalPanel;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.ClickListener;
+import com.google.gwt.user.client.ui.TabBar;
+import com.google.gwt.user.client.ui.TabListener;
+import com.google.gwt.user.client.ui.SourcesTabEvents;
+
+import com.google.gwt.user.client.rpc.ServiceDefTarget;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+
+/**
+ * Entry point classes define <code>onModuleLoad()</code>.
+ */
+public class Portal implements EntryPoint
+{
+ /**
+ * This is the entry point method.
+ */
+ public void onModuleLoad()
+ {
+ this.loadPortal();
+ }
+
+ /**
+ *
+ *
+ */
+ private void loadPortal()
+ {
+ //Load the navigation bar....use a tabbed bar
+ TabBar pageNavigator = new TabBar();
+ pageNavigator.addTab("Page 1");
+ pageNavigator.addTab("Page 2");
+ pageNavigator.addTab("Page 3");
+ pageNavigator.selectTab(0);
+ pageNavigator.addTabListener(new TabListenerImpl());
+ RootPanel.get("pageNavigator").add(pageNavigator);
+
+ //Load the main page to be displayed
+ HorizontalPanel page = new HorizontalPanel();
+ RootPanel.get("currentPage").add(page);
+ this.loadPartialRefreshPage("Page 1");
+ }
+
+ /**
+ *
+ *
+ */
+ private void loadPartialRefreshPage(String pageId)
+ {
+ PortletServiceAsync portletService = (PortletServiceAsync)GWT.create(PortletService.class);
+ ((ServiceDefTarget)portletService).setServiceEntryPoint(GWT.getModuleBaseURL()+"/portletService");
+
+ AsyncCallback callback = new AsyncCallback()
+ {
+ public void onSuccess(Object result)
+ {
+ Page portalPage = (Page)result;
+ displayPortalPage(portalPage);
+ }
+
+ public void onFailure(Throwable caught)
+ {
+ }
+ };
+
+ portletService.getPage(pageId, callback);
+ }
+
+ /**
+ *
+ * @param window
+ * @param newState
+ */
+ private void handleWindowStateChanged(String window, String newState)
+ {
+ PortletServiceAsync portletService = (PortletServiceAsync)GWT.create(PortletService.class);
+ ((ServiceDefTarget)portletService).setServiceEntryPoint(GWT.getModuleBaseURL()+"/portletService");
+
+ AsyncCallback callback = new AsyncCallback()
+ {
+ public void onSuccess(Object result)
+ {
+ Page portalPage = (Page)result;
+ displayPortalPage(portalPage);
+ }
+
+ public void onFailure(Throwable caught)
+ {
+ }
+ };
+
+ portletService.setState(window, newState, callback);
+ }
+
+ /**
+ *
+ * @param window
+ * @param newState
+ */
+ private void handleWindowModeChanged(String window, String newMode)
+ {
+ PortletServiceAsync portletService = (PortletServiceAsync)GWT.create(PortletService.class);
+ ((ServiceDefTarget)portletService).setServiceEntryPoint(GWT.getModuleBaseURL()+"/portletService");
+
+ AsyncCallback callback = new AsyncCallback()
+ {
+ public void onSuccess(Object result)
+ {
+ Page portalPage = (Page)result;
+ displayPortalPage(portalPage);
+ }
+
+ public void onFailure(Throwable caught)
+ {
+ }
+ };
+
+ portletService.setMode(window, newMode, callback);
+ }
+
+ /**
+ *
+ * @param url
+ * @param portletWindow
+ */
+ private void handlePartialRefreshLink(String url, Widget windowContent)
+ {
+ HTTPRequest.asyncGet(url, new ResponseTextHandlerImpl(windowContent));
+ }
+
+ /**
+ *
+ * @param url
+ * @param portletWindow
+ */
+ private void handlePartialRefreshForm(String url, String method, String postData, Widget windowContent)
+ {
+ if(method.equalsIgnoreCase("post"))
+ {
+ HTTPRequest.asyncPost(url, postData, new ResponseTextHandlerImpl(windowContent));
+ }
+ else if(method.equalsIgnoreCase("get"))
+ {
+ if(postData != null && postData.trim().length() > 0)
+ {
+ url = url + "?" + postData;
+ }
+ HTTPRequest.asyncGet(url, new ResponseTextHandlerImpl(windowContent));
+ }
+ }
+
+ /**
+ *
+ * @author soshah
+ *
+ */
+ private class ResponseTextHandlerImpl implements ResponseTextHandler
+ {
+ private Widget windowContent = null;
+
+ public ResponseTextHandlerImpl(Widget windowContent)
+ {
+ this.windowContent = windowContent;
+ }
+ public void onCompletion(String responseText)
+ {
+ HTML html = new HTML(responseText);
+ Panel window = (Panel)this.windowContent.getParent();
+ this.windowContent.removeFromParent();
+ window.add(html);
+ }
+ }
+
+ /**
+ *
+ * @param url
+ * @return
+ */
+ private boolean isPartialRefreshAllowed(String url)
+ {
+ String basePortalURL = GWT.getModuleBaseURL();
+ String portalContext = "org.jboss.portal.uiserver.Portal"; //This is hard coded for now, but must be populated from the Portal deployment environment
+ //If Portal is installed at Root context, this value will be an empty string
+
+ if(url.startsWith(basePortalURL))
+ {
+ //This is an Absolute URL, but it points back to
+ //the Portal
+ //An Async Page Refresh call should be allowed in this case
+ return true;
+ }
+
+ if(url.startsWith("http://"))
+ {
+ //This is an Absolute URL and does not point back
+ //to the Portal
+ //Async Page Refresh call should not be allowed
+ return false;
+ }
+ else
+ {
+ //This is a relative URL.
+
+ //Make sure it points back to the Portal for an Async Page Refresh
+ //If it points to some other resource like another third-party web application etc, the response
+ //has nothing to do with Portal
+ //(unless ofcourse the client side processor of the Portal, wants to
+ //take this response and aggregate this inside the current Portal Page and Window being displayed. This is an exceptional usecase
+ //and not desired behavior for every scenario from end user standpoint)
+ //As standard behavior, Async Page Refresh to be done, only when Portlet Markup is sending a request back to the Portal
+ if(url.startsWith("/"))
+ {
+ if(!portalContext.equals(""))
+ {
+ String urlContext = null;
+ int index = url.indexOf('/', 1);
+ if(index != -1)
+ {
+ urlContext = url.substring(1, index);
+ }
+ else
+ {
+ urlContext = url.substring(1);
+ }
+
+ if(!portalContext.equals(urlContext))
+ {
+ //This request is not being sent to the Portal. It is being sent to some other web application
+ return false;
+ }
+ }
+ else
+ {
+ //If Portal is running on root context, there is no way to tell from client side, if this request is actually
+ //to be sent to the Portal or some other web application. Hence, in the interest of functional safety/correctness
+ //no Async Page Refresh here
+ //If Portal is running on Root context, Partial Refresh will happen only for pure relative links
+ return false;
+ }
+ }
+
+ //If I get here, Async Page Refresh through the Portal should be allowed
+ return true;
+ }
+ }
+
+ /**
+ *
+ * @param currentForm
+ * @return
+ */
+ public native String serializeForm(Element currentForm)
+ /*-{
+ var formData = $wnd.Form.serialize(currentForm);
+ return formData;
+ }-*/;
+
+ /**
+ *
+ * @param portalPage
+ */
+ private void displayPortalPage(Page portalPage)
+ {
+ //Event Listener for the decoration components like
+ //Normal, Maximized, Minimized
+ ClickListener listener = new ClickListener()
+ {
+ public void onClick(Widget sender)
+ {
+ Button cour = (Button)sender;
+ String windowName = sender.getParent().getTitle();
+ if(cour.getText().equals("Normal"))
+ {
+ handleWindowStateChanged(windowName, Window.NORMAL);
+ }
+ else if(cour.getText().equals("Minimized"))
+ {
+ handleWindowStateChanged(windowName, Window.MINIMIZED);
+ }
+ else if(cour.getText().equals("Maximized"))
+ {
+ handleWindowStateChanged(windowName, Window.MAXIMIZED);
+ }
+ else if(cour.getText().equals("Edit"))
+ {
+ handleWindowModeChanged(windowName, Window.EDIT);
+ }
+ }
+ };
+
+ //Event Listener for actions perfomed inside the portlet window content
+ //itself.
+ ClickListener contentListener = new ClickListener()
+ {
+ public void onClick(Widget sender)
+ {
+ Event event = DOM.eventGetCurrentEvent();
+ Element target = DOM.eventGetTarget(event);
+
+ if(target.toString().toUpperCase().trim().indexOf("</A>") != -1)
+ {
+ String link = DOM.getElementAttribute(target, "HREF");
+
+ //A link inside the portlet window was clicked
+ //Load its content asynchronously inside this window
+ boolean isPartialRefreshAllowed = isPartialRefreshAllowed(link);
+ if(isPartialRefreshAllowed)
+ {
+ DOM.eventPreventDefault(event);
+ handlePartialRefreshLink(link, sender);
+ }
+ }
+ else if(target.toString().toUpperCase().trim().indexOf("INPUT") != -1 &&
+ target.toString().toUpperCase().trim().indexOf("SUBMIT") != -1
+ )
+ {
+ Element currentForm = DOM.getParent(target);
+ String enctype = DOM.getElementAttribute(currentForm, "enctype");
+ String action = DOM.getElementAttribute(currentForm, "action");
+ boolean isPartialRefreshAllowed = isPartialRefreshAllowed(action);
+ if((isPartialRefreshAllowed) && (enctype == null || !enctype.equals("multipart/form-data")))
+ {
+ DOM.eventPreventDefault(event);
+
+ //Call a native javascript function here
+ String method = DOM.getElementAttribute(currentForm, "method");
+ String serializedForm = serializeForm(currentForm);
+
+ handlePartialRefreshForm(action, method, serializedForm, sender);
+ }
+ }
+ }
+ };
+
+ //Dispalying the fully aggregated page
+ Window[] windows = portalPage.windows;
+ HorizontalPanel page = (HorizontalPanel)RootPanel.get("currentPage").getWidget(0);
+ page.clear();
+ for(int i=0; i<windows.length; i++)
+ {
+ Window pageWindow = windows[i];
+ if(pageWindow.isVisible)
+ {
+ VerticalPanel window = new VerticalPanel();
+ window.setBorderWidth(2);
+
+ //Create the decoration panel
+ HorizontalPanel decoration = new HorizontalPanel();
+ decoration.setTitle(pageWindow.name);
+
+ Button normal = new Button("Normal");
+ Button minimized = new Button("Minimized");
+ Button maximized = new Button("Maximized");
+ Button edit = new Button("Edit");
+
+ decoration.add(normal);
+ decoration.add(minimized);
+ decoration.add(maximized);
+ decoration.add(edit);
+ window.add(decoration);
+
+ //Create the actual content of the portlet to be displayed inside the window
+ HTML windowContent = new HTML(pageWindow.content);
+ window.add(windowContent);
+
+ //Event listeners for this Window
+ normal.addClickListener(listener);
+ minimized.addClickListener(listener);
+ maximized.addClickListener(listener);
+ edit.addClickListener(listener);
+ windowContent.addClickListener(contentListener);
+
+ //Add this window to the Page
+ page.add(window);
+ }
+ }
+ }
+
+ //------------Page Navigation related logic-----------------------------------------------------------------------------------------------------
+ /**
+ *
+ */
+ private class TabListenerImpl implements TabListener
+ {
+ /**
+ *
+ */
+ public boolean onBeforeTabSelected(SourcesTabEvents sender, int tabIndex)
+ {
+ return true;
+ }
+
+ /**
+ *
+ */
+ public void onTabSelected(SourcesTabEvents sender, int tabIndex)
+ {
+ if(tabIndex == 0)
+ {
+ loadPartialRefreshPage("Page 1");
+ }
+ else if(tabIndex == 1)
+ {
+ loadPartialRefreshPage("Page 2");
+ }
+ else if(tabIndex == 2)
+ {
+ loadPartialRefreshPage("Page 3");
+ }
+ }
+ }
+}
Added: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/GWTClientFilter.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/GWTClientFilter.java (rev 0)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/GWTClientFilter.java 2007-10-18 06:17:01 UTC (rev 8686)
@@ -0,0 +1,142 @@
+/******************************************************************************
+ * 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.service;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class GWTClientFilter implements Filter
+{
+ /**
+ *
+ */
+ public void destroy()
+ {
+ }
+
+ /**
+ *
+ */
+ public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException
+ {
+ HttpServletRequest request = (HttpServletRequest)servletRequest;
+ HttpServletResponse response = (HttpServletResponse)servletResponse;
+ String contextPath = request.getContextPath();
+ String resource = request.getRequestURI().replaceFirst(contextPath, "");
+ while(resource.startsWith("/"))
+ {
+ if(resource.length() > 1)
+ {
+ resource = resource.substring(1);
+ }
+ else
+ {
+ resource = "";
+ }
+ }
+
+ if(resource == null || resource.trim().length() == 0)
+ {
+ response.sendRedirect("index.html");
+ return;
+ }
+
+ //Now make sure the resource requested is a GWT resource
+ if( resource.equals("index.html") ||
+ resource.equals("portal.css") ||
+ resource.equals("gwt.js") ||
+ resource.equals("prototype.js") ||
+ resource.contains(".cache.") ||
+ resource.contains(".nocache.") ||
+ resource.contains(".gwt.rpc")
+ )
+ {
+ String gwtResource = this.readContent(resource);
+ response.getOutputStream().write(gwtResource.getBytes());
+ response.getOutputStream().flush();
+ return;
+ }
+
+ //Propagate the request further
+ filterChain.doFilter(servletRequest, servletResponse);
+ }
+
+ /**
+ *
+ */
+ public void init(FilterConfig arg0) throws ServletException
+ {
+ }
+
+ /**
+ *
+ * @param path
+ * @return
+ */
+ private String readContent(String path)
+ {
+ String content = null;
+
+ InputStream is = null;
+ try
+ {
+ is = Thread.currentThread().getContextClassLoader().getResourceAsStream(path);
+ StringBuffer contentBuffer = new StringBuffer();
+ int bytesRead = 0;
+ byte[] data = new byte[1024];
+ while((bytesRead=is.read(data)) != -1)
+ {
+ byte[] cour = new byte[bytesRead];
+ System.arraycopy(data, 0, cour, 0, bytesRead);
+ contentBuffer.append(new String(cour));
+ }
+ content = contentBuffer.toString();
+ }
+ catch(Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ finally
+ {
+ if(is != null)
+ {
+ try{is.close();}catch(Exception e){}
+ }
+ }
+
+ return content;
+ }
+}
Added: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/PortalEntryPoint.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/PortalEntryPoint.java (rev 0)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/PortalEntryPoint.java 2007-10-18 06:17:01 UTC (rev 8686)
@@ -0,0 +1,452 @@
+/******************************************************************************
+ * 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.service;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.charset.Charset;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+import org.jboss.mx.util.MBeanProxy;
+import org.jboss.mx.util.MBeanServerLocator;
+import org.jboss.portal.common.http.QueryStringParser;
+import org.jboss.portal.common.invocation.InterceptorStackFactory;
+import org.jboss.portal.common.invocation.InvocationException;
+import org.jboss.portal.common.net.URLTools;
+import org.jboss.portal.common.util.Exceptions;
+import org.jboss.portal.server.PortalConstants;
+import org.jboss.portal.server.RequestController;
+import org.jboss.portal.server.RequestControllerDispatcher;
+import org.jboss.portal.server.RequestControllerFactory;
+import org.jboss.portal.server.Server;
+import org.jboss.portal.server.ServerException;
+import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.server.ServerInvocationContext;
+import org.jboss.portal.server.ServerRequest;
+import org.jboss.portal.server.ServerResponse;
+import org.jboss.portal.server.impl.ServerInvocationContextImpl;
+import org.jboss.portal.server.request.URLContext;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class PortalEntryPoint extends HttpServlet
+{
+ /** . */
+ private static final int GET_METHOD = 0;
+
+ /** . */
+ private static final int POST_METHOD = 1;
+
+ /** Describes a default servlet mapping. */
+ private static final int DEFAULT_SERVLET_MAPPING = 0;
+
+ /** Describes a root path mapping. */
+ private static final int ROOT_PATH_MAPPING = 1;
+
+ /** Describes a path mapping. */
+ private static final int PATH_MAPPING = 2;
+
+ /** The logger. */
+ protected Logger log = Logger.getLogger(getClass());
+
+ /** The server. */
+ private Server server;
+
+ /** The interceptor stack. */
+ private InterceptorStackFactory interceptorStack;
+
+ /** Are we or not the default servlet ? */
+ private boolean asDefaultServlet;
+
+ /** The controller for this servlet. */
+ private RequestControllerFactory controllerFactory;
+
+ /** The controller name. */
+ private String controllerFactoryName;
+
+ /** Configure the as default servlet. */
+ public void init() throws ServletException
+ {
+ asDefaultServlet = getAsDefaultServletInitValue();
+ controllerFactoryName = getServletConfig().getInitParameter("controllerFactoryName");
+ }
+
+ /**
+ *
+ */
+ protected final Server getServer()
+ {
+ if (server == null)
+ {
+ try
+ {
+ MBeanServer mbeanServer = MBeanServerLocator.locateJBoss();
+ server = (Server)MBeanProxy.get(Server.class, new ObjectName("portal:service=Server"), mbeanServer);
+ }
+ catch (Exception e)
+ {
+ String msg = "Cannot get portal server";
+ log.error(msg, e);
+ throw new IllegalStateException(msg);
+ }
+ }
+ return server;
+ }
+
+ protected final InterceptorStackFactory getInterceptorStackFactory()
+ {
+ if (interceptorStack == null)
+ {
+ try
+ {
+ MBeanServer mbeanServer = MBeanServerLocator.locateJBoss();
+ interceptorStack = (InterceptorStackFactory)MBeanProxy.get(InterceptorStackFactory.class, new ObjectName("portal:service=InterceptorStackFactory,type=Server"), mbeanServer);
+ }
+ catch (Exception e)
+ {
+ String msg = "Cannot get interceptor stack";
+ log.error(msg, e);
+ throw new IllegalStateException(msg);
+ }
+ }
+ return interceptorStack;
+ }
+
+ protected final RequestControllerFactory getControllerFactory()
+ {
+ if (controllerFactory == null)
+ {
+ try
+ {
+ MBeanServer mbeanServer = MBeanServerLocator.locateJBoss();
+ controllerFactory = (RequestControllerFactory)MBeanProxy.get(RequestControllerFactory.class, new ObjectName(controllerFactoryName), mbeanServer);
+ }
+ catch (Exception e)
+ {
+ String msg = "Cannot get controller " + controllerFactoryName;
+ log.error(msg, e);
+ throw new IllegalStateException(msg);
+ }
+ }
+ return controllerFactory;
+ }
+
+ private String retrieveMediaType(String contentType)
+ {
+ String mediaType = contentType;
+
+ //
+ if (mediaType != null)
+ {
+ // Remove any parameters
+ int index = mediaType.indexOf(';');
+ if (index != -1)
+ {
+ mediaType = contentType.substring(0, index);
+ }
+
+ // Trim
+ mediaType = mediaType.trim();
+
+ // Media type matching is case insensitive, so we convert to lower case
+ mediaType = mediaType.toLowerCase();
+ }
+ return mediaType;
+ }
+
+ protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
+ {
+ //
+ String servletPath = req.getServletPath();
+ String requestURI = req.getRequestURI();
+ String contextPath = req.getContextPath();
+
+ String resource = req.getRequestURI().replaceFirst(contextPath, "");
+ while(resource.startsWith("/"))
+ {
+ if(resource.length() > 1)
+ {
+ resource = resource.substring(1);
+ }
+ else
+ {
+ resource = "";
+ }
+ }
+
+ if(resource == null || resource.trim().length() == 0)
+ {
+ resp.sendRedirect("index.html");
+ return;
+ }
+
+ int method;
+ if ("GET".equals(req.getMethod()))
+ {
+ method = GET_METHOD;
+ }
+ else if ("POST".equals(req.getMethod()))
+ {
+ method = POST_METHOD;
+ }
+ else
+ {
+ throw new ServletException();
+ }
+
+ // Compute the media type in the content type
+ String mediaType = retrieveMediaType(req.getContentType());
+
+ // Only affect the charset encoding if the servlet container will decode the request
+ if (method == POST_METHOD && PortalConstants.APPLICATION_X_WWW_FORM_URLENCODED.equals(mediaType))
+ {
+ // Now we must ensure that we have either an equals or a trailing space after the media-type
+ String characterEncoding = req.getCharacterEncoding();
+ if (characterEncoding == null)
+ {
+ // Set out charset for the portal request
+ req.setCharacterEncoding(PortalConstants.UTF_8.name());
+ }
+ else
+ {
+ Charset charset = Charset.forName(characterEncoding);
+ if (!PortalConstants.UTF_8.equals(charset))
+ {
+ throw new ServletException("Unaccepted charset " + characterEncoding);
+ }
+ }
+ }
+
+ // Determine the mapping we have
+ int mapping = DEFAULT_SERVLET_MAPPING;
+ if (!asDefaultServlet)
+ {
+ if (servletPath.length() == 0)
+ {
+ mapping = ROOT_PATH_MAPPING;
+ }
+ else
+ {
+ mapping = PATH_MAPPING;
+ }
+ }
+
+ // Determine the host for this request
+ String portalHost = req.getServerName();
+
+ // Determine the request path
+ String portalRequestPath = null;
+ String portalContextPath = null;
+ switch (mapping)
+ {
+ case DEFAULT_SERVLET_MAPPING:
+ portalRequestPath = requestURI.substring(contextPath.length());
+ portalContextPath = requestURI.substring(0, contextPath.length());
+ break;
+ case ROOT_PATH_MAPPING:
+ portalRequestPath = requestURI.substring(contextPath.length());
+ portalContextPath = requestURI.substring(0, contextPath.length());
+ break;
+ case PATH_MAPPING:
+ portalRequestPath = requestURI.substring(contextPath.length() + servletPath.length());
+ portalContextPath = requestURI.substring(0, contextPath.length() + servletPath.length());
+ break;
+ }
+
+ // Apply the url decoding
+ portalRequestPath = URLTools.decodeXWWWFormURL(portalRequestPath);
+ portalContextPath = URLTools.decodeXWWWFormURL(portalContextPath);
+
+ //
+ URLContext urlContext = URLContext.newInstance(req.isSecure(), req.getRemoteUser() != null);
+
+ // ***************
+ // ***************
+ // ***************
+ // ***************
+
+ // Parse the query string to have the get parameters
+ // The resulting map has its parameters decoded from the x-www-form-url encoding
+ Map queryParameterMap = Collections.EMPTY_MAP;
+ String queryString = req.getQueryString();
+ if (queryString != null)
+ {
+ queryParameterMap = QueryStringParser.parseQueryString(queryString);
+ }
+
+ //
+ Map bodyParameterMap = null;
+ if (method == POST_METHOD && PortalConstants.APPLICATION_X_WWW_FORM_URLENCODED.equals(mediaType))
+ {
+ bodyParameterMap = Collections.EMPTY_MAP;
+ for (Iterator i = req.getParameterMap().entrySet().iterator(); i.hasNext();)
+ {
+ Map.Entry entry = (Map.Entry)i.next();
+
+ // Get param name
+ String paramName = (String)entry.getKey();
+
+ // Values that are aggregated from the query string and the body
+ String[] paramValues = (String[])entry.getValue();
+
+ // Values decoded from the query string
+ String[] queryValues = (String[])queryParameterMap.get(paramName);
+ if (queryValues != null)
+ {
+ int bodyValuesLength = paramValues.length - queryValues.length;
+ if (bodyValuesLength > 0)
+ {
+ String[] bodyValues = new String[bodyValuesLength];
+ System.arraycopy(paramValues, queryValues.length, bodyValues, 0, bodyValuesLength);
+ if (bodyParameterMap.isEmpty())
+ {
+ bodyParameterMap = new HashMap();
+ }
+ bodyParameterMap.put(paramName, bodyValues);
+ }
+ }
+ else
+ {
+ if (bodyParameterMap.isEmpty())
+ {
+ bodyParameterMap = new HashMap();
+ }
+ bodyParameterMap.put(paramName, paramValues);
+ }
+ }
+
+ // Make the map unmodifiable
+ bodyParameterMap = bodyParameterMap.isEmpty() ? bodyParameterMap : Collections.unmodifiableMap(bodyParameterMap);
+ }
+
+ // ***************
+ // ***************
+ // ***************
+ // ***************
+
+ //
+ Server server = getServer();
+
+ //
+ ServerInvocationContext invocationCtx = new ServerInvocationContextImpl(
+ req,
+ resp,
+ portalHost,
+ portalRequestPath,
+ portalContextPath,
+ queryParameterMap,
+ bodyParameterMap,
+ urlContext,
+ mediaType);
+
+ //
+ ServerRequest request = new ServerRequest(invocationCtx);
+ request.setServer(server);
+
+ //
+ ServerResponse response = new ServerResponse(request, invocationCtx);
+
+ //
+ ServerInvocation invocation = new ServerInvocation(invocationCtx);
+ invocation.setRequest(request);
+ invocation.setResponse(response);
+
+ //
+ RequestControllerFactory controllerFactory = getControllerFactory();
+ RequestController controller = controllerFactory.createRequestController(invocation);
+ invocation.setHandler(new RequestControllerDispatcher(controller));
+
+ //
+ try
+ {
+ InterceptorStackFactory stack = getInterceptorStackFactory();
+ invocation.invoke(stack.getInterceptorStack());
+ }
+ catch (ServerException e)
+ {
+ log.error("Server exception", e);
+ Throwable nested = Exceptions.unwrap(e);
+ throw new ServletException(nested);
+ }
+ catch (InvocationException e)
+ {
+ log.error("Invocation exception", e);
+ Throwable nested = Exceptions.unwrap(e);
+ throw new ServletException(nested);
+ }
+ catch (ServletException e)
+ {
+ throw e;
+ }
+ catch (IOException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ log.error("Unexpected exception", e);
+ Throwable nested = Exceptions.unwrap(e);
+ throw new ServletException(nested);
+ }
+ }
+
+
+ /**
+ * Return the value for the servlet mapping. This implementation get the value from an init parameter of the servlet
+ * called <b>asDefaultServlet</b>
+ */
+ protected boolean getAsDefaultServletInitValue()
+ {
+ ServletConfig config = getServletConfig();
+ String value = config.getInitParameter("asDefaultServlet");
+ if ("true".equalsIgnoreCase(value))
+ {
+ log.debug("Servlet loaded as default servlet mapping");
+ return true;
+ }
+ else if ("false".equalsIgnoreCase(value))
+ {
+ log.debug("Servlet loaded as path mapping servlet");
+ return false;
+ }
+ else
+ {
+ log.warn("Servlet mapping cannot be determined with init parameter value=" + value);
+ return false;
+ }
+ }
+}
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/PortletServiceImpl.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/PortletServiceImpl.java 2007-10-17 16:48:30 UTC (rev 8685)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/PortletServiceImpl.java 2007-10-18 06:17:01 UTC (rev 8686)
@@ -27,9 +27,8 @@
public String getPortlet(String portletId)
{
String portletContent = null;
- String basePath = "org.jboss.portal.uiserver.ajax.PortalLayout";
- String contentPath = basePath + "/" + portletId;
+ String contentPath = portletId;
InputStream is = null;
try
{
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-17 16:48:30 UTC (rev 8685)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/UIServer.java 2007-10-18 06:17:01 UTC (rev 8686)
@@ -27,11 +27,6 @@
import java.util.List;
import java.util.StringTokenizer;
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-import org.jboss.mx.util.MBeanProxy;
-import org.jboss.mx.util.MBeanServerLocator;
-
import org.jboss.portal.uiserver.protocol.Container;
import org.jboss.portal.uiserver.protocol.Page;
import org.jboss.portal.uiserver.protocol.Window;
@@ -160,7 +155,7 @@
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)
{
@@ -170,7 +165,7 @@
this.render(invocation.getServerContext().getClientResponse().getWriter(),
displayedPage);
}
- }
+ }
}
catch(Exception e)
{
@@ -234,18 +229,13 @@
*
* Basically the UIServer would delegate functions to its various components and then send back the result to the client
*
- */
-
- /**
- * Some flexible grid layout testing code
- */
+ */
+ //Some flexible grid layout testing code
Object[] gridData = this.getFlexibleGridLayoutManager(pageResult);
Page page = (Page)gridData[0];
LayoutManager layoutManager = (LayoutManager)gridData[1];
- /**
- * Some region layout testing code
- */
+ //Some region layout testing code
//Object[] regionData = this.getRegionBasedLayoutManager(pageResult);
//Page page = (Page)regionData[0];
//LayoutManager layoutManager = (LayoutManager)regionData[1];
Added: branches/UIServer/uiserver/src/resources/client/ajax/src/org/jboss/portal/uiserver/ajax/Portal.gwt.xml
===================================================================
--- branches/UIServer/uiserver/src/resources/client/ajax/src/org/jboss/portal/uiserver/ajax/Portal.gwt.xml (rev 0)
+++ branches/UIServer/uiserver/src/resources/client/ajax/src/org/jboss/portal/uiserver/ajax/Portal.gwt.xml 2007-10-18 06:17:01 UTC (rev 8686)
@@ -0,0 +1,10 @@
+<module>
+ <!-- Inherit the core Web Toolkit stuff -->
+ <inherits name="com.google.gwt.user.User"/>
+
+ <!-- Specify the app entry point class -->
+ <entry-point class="org.jboss.portal.uiserver.ajax.client.Portal"/>
+
+ <!-- RPC related configuration -->
+ <servlet path="/portletService" class="org.jboss.portal.uiserver.service.PortletServiceImpl"/>
+</module>
Added: branches/UIServer/uiserver/src/resources/client/ajax/src/org/jboss/portal/uiserver/ajax/public/index.html
===================================================================
--- branches/UIServer/uiserver/src/resources/client/ajax/src/org/jboss/portal/uiserver/ajax/public/index.html (rev 0)
+++ branches/UIServer/uiserver/src/resources/client/ajax/src/org/jboss/portal/uiserver/ajax/public/index.html 2007-10-18 06:17:01 UTC (rev 8686)
@@ -0,0 +1,44 @@
+<html>
+ <head>
+
+ <!-- -->
+ <!-- Any title is fine -->
+ <!-- -->
+ <title>JBoss Portal</title>
+
+ <link href="portal.css" rel="stylesheet" type="text/css">
+
+ <!-- -->
+ <!-- This script loads your compiled module. -->
+ <!-- If you add any GWT meta tags, they must -->
+ <!-- be added before this line. -->
+ <!-- -->
+ <script language='javascript' src='prototype.js'></script>
+ <script language='javascript' src='org.jboss.portal.uiserver.ajax.Portal.nocache.js'></script>
+ </head>
+
+ <!-- -->
+ <!-- The body can have arbitrary html, or -->
+ <!-- you can leave the body empty if you want -->
+ <!-- to create a completely dynamic ui -->
+ <!-- -->
+ <body>
+ <!-- OPTIONAL: include this if you want history support -->
+ <iframe src="javascript:''" id="__gwt_historyFrame" style="width:0;height:0;border:0"></iframe>
+
+ <h1>JBoss Portal</h1>
+
+ <!-- AJAX Client for Portal Proof of Concept -->
+ <p>
+ Asynchronous Page Management
+ </p>
+ <table align="center">
+ <tr>
+ <td id="pageNavigator"></td>
+ </tr>
+ <tr>
+ <td id="currentPage"></td>
+ </tr>
+ </table>
+ </body>
+</html>
Added: branches/UIServer/uiserver/src/resources/portal-uiserver.sar/META-INF/jboss-service.xml
===================================================================
--- branches/UIServer/uiserver/src/resources/portal-uiserver.sar/META-INF/jboss-service.xml (rev 0)
+++ branches/UIServer/uiserver/src/resources/portal-uiserver.sar/META-INF/jboss-service.xml 2007-10-18 06:17:01 UTC (rev 8686)
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<server>
+ <mbean
+ code="org.jboss.portal.uiserver.service.UIServer"
+ name="portal:service=Controller"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ <depends optional-attribute-name="PortalObjectReader" proxy-type="attribute">portal:container=PortalObjectReader</depends>
+ <depends optional-attribute-name="Processor" proxy-type="attribute">portal:service=Processor</depends>
+ <depends>portal:service=PageService</depends>
+ <depends>portal:commandFactory=DefaultPortal</depends>
+ <depends>portal:urlFactory=Delegating</depends>
+ <depends>portal:service=InterceptorStackFactory,type=Command</depends>
+ <depends>portal:container=Instance</depends>
+ <depends>portal:service=PortalAuthorizationManagerFactory</depends>
+ <depends>portal:service=CustomizationManager</depends>
+ <depends>portal:service=ContentProviderRegistry</depends>
+ <depends>portal:service=ResponseHandler,type=Selector</depends>
+ <depends>portal:service=ControlPolicy,type=Page</depends>
+ </mbean>
+</server>
Added: branches/UIServer/uiserver/src/resources/portal-uiserver.war/WEB-INF/jboss-web.xml
===================================================================
--- branches/UIServer/uiserver/src/resources/portal-uiserver.war/WEB-INF/jboss-web.xml (rev 0)
+++ branches/UIServer/uiserver/src/resources/portal-uiserver.war/WEB-INF/jboss-web.xml 2007-10-18 06:17:01 UTC (rev 8686)
@@ -0,0 +1,26 @@
+<?xml version="1.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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<jboss-web>
+</jboss-web>
\ No newline at end of file
Added: branches/UIServer/uiserver/src/resources/portal-uiserver.war/WEB-INF/web.xml
===================================================================
--- branches/UIServer/uiserver/src/resources/portal-uiserver.war/WEB-INF/web.xml (rev 0)
+++ branches/UIServer/uiserver/src/resources/portal-uiserver.war/WEB-INF/web.xml 2007-10-18 06:17:01 UTC (rev 8686)
@@ -0,0 +1,110 @@
+<?xml version="1.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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE web-app PUBLIC
+ "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app>
+ <!-- Add the GWT Client Filter to run the Portal in full Web 2.0 Ajax Mode. In turn, to run in Classic Html Mode, turn this filter off -->
+ <filter>
+ <filter-name>GWTClientFilter</filter-name>
+ <filter-class>org.jboss.portal.uiserver.service.GWTClientFilter</filter-class>
+ </filter>
+ <filter-mapping>
+ <filter-name>GWTClientFilter</filter-name>
+ <servlet-name>PortalEntryPoint</servlet-name>
+ </filter-mapping>
+
+
+ <!-- The portal servlet is the main entrance point -->
+ <servlet>
+ <servlet-name>PortalEntryPoint</servlet-name>
+ <servlet-class>org.jboss.portal.uiserver.service.PortalEntryPoint</servlet-class>
+ <init-param>
+ <param-name>asDefaultServlet</param-name>
+ <param-value>false</param-value>
+ <description>The servlet needs to know wether it is set as a default servlet or not</description>
+ </init-param>
+ <init-param>
+ <param-name>controllerFactoryName</param-name>
+ <param-value>portal:service=ControllerFactory</param-value>
+ <description>The request controller factory for the portal servlet</description>
+ </init-param>
+ <load-on-startup>0</load-on-startup>
+ <security-role-ref>
+ <role-name>Authenticated</role-name>
+ <role-link>Authenticated</role-link>
+ </security-role-ref>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>PortalEntryPoint</servlet-name>
+ <url-pattern>/*</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>PortalEntryPoint</servlet-name>
+ <url-pattern>/sec/*</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>PortalEntryPoint</servlet-name>
+ <url-pattern>/auth/*</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>PortalEntryPoint</servlet-name>
+ <url-pattern>/authsec/*</url-pattern>
+ </servlet-mapping>
+
+ <!-- GWT Prototyping only -->
+ <servlet>
+ <servlet-name>PortletService</servlet-name>
+ <servlet-class>org.jboss.portal.uiserver.service.PortletServiceImpl</servlet-class>
+ <load-on-startup>0</load-on-startup>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>PortletService</servlet-name>
+ <url-pattern>/portletService/*</url-pattern>
+ </servlet-mapping>
+
+ <!-- these are only for standalone prototype testing...this is not integrated with portal -->
+ <!--
+ <servlet-mapping>
+ <servlet-name>PortletService</servlet-name>
+ <url-pattern>/org.jboss.portal.uiserver.ajax.PortalLayout/portletService/*</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>PortletService</servlet-name>
+ <url-pattern>/org.jboss.portal.uiserver.ajax.PartialRefresh/portletService/*</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>PortletService</servlet-name>
+ <url-pattern>/org.jboss.portal.uiserver.ajax.AsyncPages/portletService/*</url-pattern>
+ </servlet-mapping>
+ -->
+</web-app>
Added: branches/UIServer/uiserver/src/resources/portal-uiserver.war/asyncPages.html
===================================================================
--- branches/UIServer/uiserver/src/resources/portal-uiserver.war/asyncPages.html (rev 0)
+++ branches/UIServer/uiserver/src/resources/portal-uiserver.war/asyncPages.html 2007-10-18 06:17:01 UTC (rev 8686)
@@ -0,0 +1,7 @@
+<html>
+ <head>
+ <meta http-equiv="refresh" content="0;url=org.jboss.portal.uiserver.ajax.AsyncPages/asyncPages.html">
+ </head>
+ <body>
+ </body>
+</html>
\ No newline at end of file
Added: branches/UIServer/uiserver/src/resources/portal-uiserver.war/layout.html
===================================================================
--- branches/UIServer/uiserver/src/resources/portal-uiserver.war/layout.html (rev 0)
+++ branches/UIServer/uiserver/src/resources/portal-uiserver.war/layout.html 2007-10-18 06:17:01 UTC (rev 8686)
@@ -0,0 +1,7 @@
+<html>
+ <head>
+ <meta http-equiv="refresh" content="0;url=org.jboss.portal.uiserver.ajax.PortalLayout/layout.html">
+ </head>
+ <body>
+ </body>
+</html>
\ No newline at end of file
Added: branches/UIServer/uiserver/src/resources/portal-uiserver.war/partialRefresh.html
===================================================================
--- branches/UIServer/uiserver/src/resources/portal-uiserver.war/partialRefresh.html (rev 0)
+++ branches/UIServer/uiserver/src/resources/portal-uiserver.war/partialRefresh.html 2007-10-18 06:17:01 UTC (rev 8686)
@@ -0,0 +1,7 @@
+<html>
+ <head>
+ <meta http-equiv="refresh" content="0;url=org.jboss.portal.uiserver.ajax.PartialRefresh/partialRefresh.html">
+ </head>
+ <body>
+ </body>
+</html>
\ No newline at end of file
16 years, 8 months
JBoss Portal SVN: r8685 - modules/test/trunk/unit/src/main/org/jboss/unit/report/impl/writer.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-10-17 12:48:30 -0400 (Wed, 17 Oct 2007)
New Revision: 8685
Modified:
modules/test/trunk/unit/src/main/org/jboss/unit/report/impl/writer/PrintListener.java
Log:
rollback my previous commit
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-17 16:38:22 UTC (rev 8684)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/report/impl/writer/PrintListener.java 2007-10-17 16:48:30 UTC (rev 8685)
@@ -134,10 +134,6 @@
StartTestSuiteEvent stse = (StartTestSuiteEvent)event;
stack.add(new SuiteStat(stse.getTestInfo().getName()));
}
- else if (event instanceof EndTestSuiteEvent)
- {
- stack.removeLast();
- }
else if (event instanceof StartTestCaseEvent)
{
StartTestCaseEvent ste = (StartTestCaseEvent)event;
16 years, 8 months
JBoss Portal SVN: r8684 - modules/test/trunk/unit/src/main/org/jboss/unit/report/impl/writer.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-10-17 12:38:22 -0400 (Wed, 17 Oct 2007)
New Revision: 8684
Modified:
modules/test/trunk/unit/src/main/org/jboss/unit/report/impl/writer/PrintListener.java
Log:
correct minor bug in PrintListener
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-17 15:08:55 UTC (rev 8683)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/report/impl/writer/PrintListener.java 2007-10-17 16:38:22 UTC (rev 8684)
@@ -134,6 +134,10 @@
StartTestSuiteEvent stse = (StartTestSuiteEvent)event;
stack.add(new SuiteStat(stse.getTestInfo().getName()));
}
+ else if (event instanceof EndTestSuiteEvent)
+ {
+ stack.removeLast();
+ }
else if (event instanceof StartTestCaseEvent)
{
StartTestCaseEvent ste = (StartTestCaseEvent)event;
16 years, 8 months
JBoss Portal SVN: r8683 - in modules/test/trunk/unit/src/main/org/jboss: unit/report/impl/junit and 1 other directory.
by portal-commits@lists.jboss.org
Author: emuckenhuber
Date: 2007-10-17 11:08:55 -0400 (Wed, 17 Oct 2007)
New Revision: 8683
Modified:
modules/test/trunk/unit/src/main/org/jboss/test/unit/report/junit/JUnitReporterTests.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
Log:
- display also the class name in the testcase name
- fixed the testcase time (now in seconds instead of milliseconds)
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-17 13:58:54 UTC (rev 8682)
+++ modules/test/trunk/unit/src/main/org/jboss/test/unit/report/junit/JUnitReporterTests.java 2007-10-17 15:08:55 UTC (rev 8683)
@@ -53,6 +53,7 @@
testTestSuite();
testTestCase();
testTestCaseFailure();
+ testTestCaseClass();
}
private static void testTestSuite()
@@ -89,7 +90,10 @@
Assert.assertEquals("fehler", error.getAttribute(ATTR_MESSAGE));
}
-
+ /**
+ * Successful testCase
+ *
+ */
private static void testTestCase()
{
MyTestReport report = new MyTestReport(testSuiteName);
@@ -114,11 +118,48 @@
Element testCase = child(e, TESTCASE);
Assert.assertEquals(TESTCASE, testCase.getNodeName());
Assert.assertEquals("foo", testCase.getAttribute(ATTR_NAME));
- Assert.assertEquals("20", testCase.getAttribute(ATTR_TIME));
+ Assert.assertEquals("0.02", testCase.getAttribute(ATTR_TIME));
Assert.assertNull(child(e, ERROR));
}
+ /**
+ * Successful testCase with class info
+ *
+ */
+ private static void testTestCaseClass()
+ {
+ MyTestReport report = new MyTestReport(testSuiteName);
+ report.startTestSuite(new StartRunnerEvent());
+
+ // Set current tested class name
+ report.setCurrentTestedClassName("org.jboss.portal.test.testedClass1");
+
+ TestId testId = new TestId("foo");
+ StartTestCaseEvent startTestEvent = new StartTestCaseEvent(testId, new MyTestInfo());
+ report.startTest(startTestEvent);
+
+ TestResult testResult = new TestSuccess(20);
+ EndTestCaseEvent endTestEvent = new EndTestCaseEvent(testId, testResult);
+ report.endTest(endTestEvent);
+ // end report
+ report.endTestSuite(new EndRunnerEvent());
+ Element e = report.getRootElement();
+
+ Assert.assertEquals(TESTSUITE, e.getNodeName());
+ Assert.assertEquals("1", e.getAttribute(ATTR_TESTS));
+ Assert.assertEquals("0", e.getAttribute(ATTR_ERRORS));
+ Assert.assertEquals("0", e.getAttribute(ATTR_FAILURES));
+
+ Element testCase = child(e, TESTCASE);
+ Assert.assertEquals(TESTCASE, testCase.getNodeName());
+ Assert.assertEquals("org.jboss.portal.test.testedClass1.foo", testCase.getAttribute(ATTR_NAME));
+ Assert.assertEquals("0.02", testCase.getAttribute(ATTR_TIME));
+
+ Assert.assertNull(child(e, ERROR));
+ }
+
+
private static void testTestCaseFailure()
{
MyTestReport report = new MyTestReport(testSuiteName);
@@ -144,7 +185,7 @@
Element testCase = child(e, TESTCASE);
Assert.assertEquals(TESTCASE, testCase.getNodeName());
Assert.assertEquals("foo", testCase.getAttribute(ATTR_NAME));
- Assert.assertEquals("20", testCase.getAttribute(ATTR_TIME));
+ Assert.assertEquals("0.02", testCase.getAttribute(ATTR_TIME));
Element error = child(testCase, FAILURE);
Assert.assertEquals("expecting something different.", error.getAttribute(ATTR_MESSAGE));
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-17 13:58:54 UTC (rev 8682)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/report/impl/junit/JUnitReporter.java 2007-10-17 15:08:55 UTC (rev 8683)
@@ -34,6 +34,7 @@
import org.jboss.unit.runner.event.RunnerFailureEvent;
import org.jboss.unit.runner.event.StartRunnerEvent;
import org.jboss.unit.runner.event.StartTestCaseEvent;
+import org.jboss.unit.runner.event.StartTestSuiteEvent;
/**
*
@@ -99,6 +100,10 @@
{
report.runnerFailed((RunnerFailureEvent) event);
}
+ else if (event instanceof StartTestSuiteEvent)
+ {
+ report.setCurrentTestedClassName(((StartTestSuiteEvent) event).getTestInfo().getName());
+ }
else if (event instanceof StartTestCaseEvent)
{
report.startTest((StartTestCaseEvent) 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-17 13:58:54 UTC (rev 8682)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/report/impl/junit/JUnitTestReport.java 2007-10-17 15:08:55 UTC (rev 8683)
@@ -30,6 +30,7 @@
import java.io.Writer;
import java.net.InetAddress;
import java.net.UnknownHostException;
+import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
@@ -58,6 +59,7 @@
import org.jboss.unit.runner.event.RunnerFailureEvent;
import org.jboss.unit.runner.event.StartRunnerEvent;
import org.jboss.unit.runner.event.StartTestCaseEvent;
+import org.jboss.unit.runner.event.StartTestSuiteEvent;
import org.jboss.unit.runner.results.TestFailure;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -100,8 +102,14 @@
/** The failed count */
private int failed;
+ /** The timeStamp */
private String timeStamp;
+
+ /** The current testSuiteName */
+ private String currentTestedClassName;
+ /** .*/
+ private NumberFormat FORMAT = NumberFormat.getInstance();
public JUnitTestReport()
{
@@ -129,6 +137,11 @@
*/
}
+ public void setCurrentTestedClassName(String testedClassName)
+ {
+ this.currentTestedClassName = testedClassName;
+ }
+
public void startTest(StartTestCaseEvent event)
{
this.startedTests.put(event.getTestId(), event.getTestInfo());
@@ -156,6 +169,13 @@
Element test = document.createElement(XMLConstants.TESTCASE);
/** The testcase name */
StringBuffer nb = new StringBuffer();
+ /** The current tested Class */
+ if (this.currentTestedClassName != null)
+ {
+ nb.append(this.currentTestedClassName);
+ nb.append(".");
+ }
+ /** TestId */
for(int i = 0; i < testId.getLength(); i ++)
{
if (i > 0)
@@ -165,6 +185,7 @@
nb.append(testId.getName(i));
}
String testName = nb.toString();
+
/** The testcase parameters */
StringBuffer parameters = new StringBuffer();
for(Iterator<String> i = result.getParametrization().keySet().iterator(); i.hasNext(); )
@@ -181,9 +202,10 @@
if ( parameters.length() > 0)
testName = testName + "?" + parameters.toString();
+
/** Test case attributes */
test.setAttribute(XMLConstants.ATTR_NAME, testName);
- test.setAttribute(XMLConstants.ATTR_TIME, new Long(result.getDurationMillis()).toString());
+ test.setAttribute(XMLConstants.ATTR_TIME, FORMAT.format(result.getDurationMillis() / 1000.0));
/** Check if test was started */
TestInfo info = this.startedTests.get(testId);
if ( info != null)
16 years, 8 months
JBoss Portal SVN: r8681 - modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/annotations.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-10-17 09:57:21 -0400 (Wed, 17 Oct 2007)
New Revision: 8681
Removed:
modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/annotations/DefaultValues.java
Log:
for now removed the @DefaultValues annodations as it is not implemented
Deleted: modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/annotations/DefaultValues.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/annotations/DefaultValues.java 2007-10-17 13:54:39 UTC (rev 8680)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/api/pojo/annotations/DefaultValues.java 2007-10-17 13:57:21 UTC (rev 8681)
@@ -1,34 +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.api.pojo.annotations;
-
-/**
- * Not used yet.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public @interface DefaultValues
-{
- String[] values() default {};
-}
16 years, 8 months
JBoss Portal SVN: r8680 - in modules/test/trunk/unit/src: main/org/jboss/test/unit/sample and 2 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-10-17 09:54:39 -0400 (Wed, 17 Oct 2007)
New Revision: 8680
Added:
modules/test/trunk/unit/src/main/org/jboss/test/unit/sample/
modules/test/trunk/unit/src/main/org/jboss/test/unit/sample/SampleTests.java
modules/test/trunk/unit/src/resources/test/org/jboss/test/unit/sample/
Removed:
modules/test/trunk/unit/src/main/org/jboss/test/unit/sample/BlahTestTwo.java
modules/test/trunk/unit/src/main/org/jboss/test/unit/sample/BlahTests.java
modules/test/trunk/unit/src/resources/test/org/jboss/test/unit/blah/
Modified:
modules/test/trunk/unit/src/main/org/jboss/test/unit/AllTests.java
modules/test/trunk/unit/src/main/org/jboss/test/unit/sample/TestedClass1.java
modules/test/trunk/unit/src/main/org/jboss/test/unit/sample/TestedClass2.java
modules/test/trunk/unit/src/resources/test/org/jboss/test/unit/sample/f1.xml
Log:
renamed the "blah" to "sample"
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-17 13:38:34 UTC (rev 8679)
+++ modules/test/trunk/unit/src/main/org/jboss/test/unit/AllTests.java 2007-10-17 13:54:39 UTC (rev 8680)
@@ -23,8 +23,7 @@
package org.jboss.test.unit;
import org.jboss.test.unit.api.AssertTests;
-import org.jboss.test.unit.blah.BlahTestTwo;
-import org.jboss.test.unit.blah.BlahTests;
+import org.jboss.test.unit.sample.SampleTests;
import org.jboss.test.unit.pojo.AbstractPOJOTests;
import org.jboss.test.unit.pojo.junit.JUnitPOJOTests;
import org.jboss.test.unit.report.junit.JUnitReporterTests;
@@ -68,12 +67,9 @@
InfoTests.main(args);
//
- BlahTests.main(args);
+ SampleTests.main(args);
//
- BlahTestTwo.main(args);
-
- //
JUnitReporterTests.main(args);
}
}
Copied: modules/test/trunk/unit/src/main/org/jboss/test/unit/sample (from rev 8670, modules/test/trunk/unit/src/main/org/jboss/test/unit/blah)
Deleted: modules/test/trunk/unit/src/main/org/jboss/test/unit/sample/BlahTestTwo.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/test/unit/blah/BlahTestTwo.java 2007-10-16 15:05:25 UTC (rev 8670)
+++ modules/test/trunk/unit/src/main/org/jboss/test/unit/sample/BlahTestTwo.java 2007-10-17 13:54:39 UTC (rev 8680)
@@ -1,65 +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.test.unit.blah;
-
-import java.io.InputStream;
-
-import org.jboss.unit.report.impl.junit.JUnitReporter;
-import org.jboss.unit.report.impl.writer.PrintListener;
-import org.jboss.unit.runner.TestRunner;
-import org.jboss.unit.runner.TestRunnerEventListener;
-import org.jboss.unit.runner.impl.TestRunnerEventBroadcaster;
-import org.jboss.unit.runner.impl.TestRunnerContextSupport;
-import org.jboss.unit.runner.model.ModelBuilder;
-import org.jboss.unit.runner.model.TestSuiteDef;
-import org.xml.sax.InputSource;
-
-/**
- * @author <a href="mailto:emuckenh@redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class BlahTestTwo
-{
-
- public static void main(String[] args) throws Exception
- {
-
- InputStream in = BlahTests.class.getResourceAsStream("f1.xml");
- InputSource source = new InputSource(in);
- ModelBuilder builder = new ModelBuilder(source);
- TestSuiteDef suite = builder.build();
-
- TestRunner runner = suite.createRunner();
-
- TestRunnerEventListener junitReporter = new JUnitReporter("output", BlahTestTwo.class.getName());
- // add listeners
-
- TestRunnerEventBroadcaster broadcaster = new TestRunnerEventBroadcaster();
- broadcaster.addListener(junitReporter);
- broadcaster.addListener(new PrintListener());
-
- // run the test
- runner.run(new TestRunnerContextSupport(broadcaster));
-
- }
-}
Deleted: modules/test/trunk/unit/src/main/org/jboss/test/unit/sample/BlahTests.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/test/unit/blah/BlahTests.java 2007-10-16 15:05:25 UTC (rev 8670)
+++ modules/test/trunk/unit/src/main/org/jboss/test/unit/sample/BlahTests.java 2007-10-17 13:54:39 UTC (rev 8680)
@@ -1,59 +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.test.unit.blah;
-
-import org.jboss.unit.report.impl.writer.PrintListener;
-import org.jboss.unit.runner.TestRunner;
-import org.jboss.unit.runner.impl.TestRunnerEventBroadcaster;
-import org.jboss.unit.runner.impl.TestRunnerContextSupport;
-import org.jboss.unit.runner.model.ModelBuilder;
-import org.jboss.unit.runner.model.TestSuiteDef;
-import org.xml.sax.InputSource;
-
-import java.io.InputStream;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class BlahTests
-{
-
- public static void main(String[] args) throws Exception
- {
-
- InputStream in = BlahTests.class.getResourceAsStream("f1.xml");
- InputSource source = new InputSource(in);
- ModelBuilder builder = new ModelBuilder(source);
- TestSuiteDef suite = builder.build();
-
- TestRunner runner = suite.createRunner();
-
- TestRunnerEventBroadcaster broadcaster = new TestRunnerEventBroadcaster();
- broadcaster.addListener(new PrintListener());
-
- runner.run(new TestRunnerContextSupport(broadcaster));
-
- }
-
-}
Added: modules/test/trunk/unit/src/main/org/jboss/test/unit/sample/SampleTests.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/test/unit/sample/SampleTests.java (rev 0)
+++ modules/test/trunk/unit/src/main/org/jboss/test/unit/sample/SampleTests.java 2007-10-17 13:54:39 UTC (rev 8680)
@@ -0,0 +1,92 @@
+/******************************************************************************
+ * 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.sample;
+
+import org.jboss.unit.report.impl.writer.PrintListener;
+import org.jboss.unit.report.impl.junit.JUnitReporter;
+import org.jboss.unit.runner.TestRunner;
+import org.jboss.unit.runner.TestRunnerEventListener;
+import org.jboss.unit.runner.impl.TestRunnerEventBroadcaster;
+import org.jboss.unit.runner.impl.TestRunnerContextSupport;
+import org.jboss.unit.runner.model.ModelBuilder;
+import org.jboss.unit.runner.model.TestSuiteDef;
+import org.jboss.unit.runner.model.BuilderException;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+import javax.xml.parsers.ParserConfigurationException;
+import java.io.InputStream;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class SampleTests
+{
+
+ public static void main(String[] args) throws Exception
+ {
+
+ test1();
+ test2();
+
+ }
+
+ private static void test1()
+ throws ParserConfigurationException, IOException, SAXException, BuilderException
+ {
+ InputStream in = SampleTests.class.getResourceAsStream("f1.xml");
+ InputSource source = new InputSource(in);
+ ModelBuilder builder = new ModelBuilder(source);
+ TestSuiteDef suite = builder.build();
+
+ TestRunner runner = suite.createRunner();
+
+ TestRunnerEventBroadcaster broadcaster = new TestRunnerEventBroadcaster();
+ broadcaster.addListener(new PrintListener());
+
+ runner.run(new TestRunnerContextSupport(broadcaster));
+ }
+
+ private static void test2()
+ throws ParserConfigurationException, IOException, SAXException, BuilderException
+ {
+ InputStream in = SampleTests.class.getResourceAsStream("f1.xml");
+ InputSource source = new InputSource(in);
+ ModelBuilder builder = new ModelBuilder(source);
+ TestSuiteDef suite = builder.build();
+
+ TestRunner runner = suite.createRunner();
+
+ TestRunnerEventListener junitReporter = new JUnitReporter("output", SampleTests.class.getName());
+ // add listeners
+
+ TestRunnerEventBroadcaster broadcaster = new TestRunnerEventBroadcaster();
+ broadcaster.addListener(junitReporter);
+ broadcaster.addListener(new PrintListener());
+
+ // run the test
+ runner.run(new TestRunnerContextSupport(broadcaster));
+ }
+}
Modified: modules/test/trunk/unit/src/main/org/jboss/test/unit/sample/TestedClass1.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/test/unit/blah/TestedClass1.java 2007-10-16 15:05:25 UTC (rev 8670)
+++ modules/test/trunk/unit/src/main/org/jboss/test/unit/sample/TestedClass1.java 2007-10-17 13:54:39 UTC (rev 8680)
@@ -20,7 +20,7 @@
* 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.blah;
+package org.jboss.test.unit.sample;
import org.jboss.unit.api.pojo.annotations.Test;
Modified: modules/test/trunk/unit/src/main/org/jboss/test/unit/sample/TestedClass2.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/test/unit/blah/TestedClass2.java 2007-10-16 15:05:25 UTC (rev 8670)
+++ modules/test/trunk/unit/src/main/org/jboss/test/unit/sample/TestedClass2.java 2007-10-17 13:54:39 UTC (rev 8680)
@@ -20,7 +20,7 @@
* 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.blah;
+package org.jboss.test.unit.sample;
import static org.jboss.unit.api.Assert.assertEquals;
import org.jboss.unit.api.pojo.annotations.Parameter;
Copied: modules/test/trunk/unit/src/resources/test/org/jboss/test/unit/sample (from rev 8670, modules/test/trunk/unit/src/resources/test/org/jboss/test/unit/blah)
Modified: modules/test/trunk/unit/src/resources/test/org/jboss/test/unit/sample/f1.xml
===================================================================
--- modules/test/trunk/unit/src/resources/test/org/jboss/test/unit/blah/f1.xml 2007-10-16 15:05:25 UTC (rev 8670)
+++ modules/test/trunk/unit/src/resources/test/org/jboss/test/unit/sample/f1.xml 2007-10-17 13:54:39 UTC (rev 8680)
@@ -5,15 +5,15 @@
xsi:schemaLocation="urn:jboss:jboss-unit:1.0 jboss-unit_1_0.xsd">
<pojo>
<test>
- <class name="org.jboss.test.unit.blah.TestedClass1"/>
+ <class name="org.jboss.test.unit.sample.TestedClass1"/>
</test>
<test>
- <class name="org.jboss.test.unit.blah.TestedClass1">
+ <class name="org.jboss.test.unit.sample.TestedClass1">
<case name="testFoo"/>
</class>
</test>
<test>
- <class name="org.jboss.test.unit.blah.TestedClass2">
+ <class name="org.jboss.test.unit.sample.TestedClass2">
</class>
<parameter name="foo">
<value>foo</value>
16 years, 8 months
JBoss Portal SVN: r8679 - modules/identity/trunk/sso.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2007-10-17 09:38:34 -0400 (Wed, 17 Oct 2007)
New Revision: 8679
Modified:
modules/identity/trunk/sso/build.xml
Log:
- missing classpath
Modified: modules/identity/trunk/sso/build.xml
===================================================================
--- modules/identity/trunk/sso/build.xml 2007-10-17 13:35:21 UTC (rev 8678)
+++ modules/identity/trunk/sso/build.xml 2007-10-17 13:38:34 UTC (rev 8679)
@@ -95,7 +95,7 @@
<path refid="jboss.microcontainer.classpath"/>
<path refid="jboss.jbossxb.classpath"/>
<path refid="apache.xerces.classpath"/>
- <!--<path refid="jbossas/core.libs.classpath"/>-->
+ <path refid="jbossas/core.libs.classpath"/>
<path refid="jboss/common.logging.spi.classpath"/>
16 years, 8 months
JBoss Portal SVN: r8678 - in modules/test/trunk/unit/src/main/org/jboss: unit/info/impl and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-10-17 09:35:21 -0400 (Wed, 17 Oct 2007)
New Revision: 8678
Modified:
modules/test/trunk/unit/src/main/org/jboss/test/unit/info/InfoTests.java
modules/test/trunk/unit/src/main/org/jboss/unit/info/impl/SimpleTestCaseInfo.java
modules/test/trunk/unit/src/main/org/jboss/unit/info/impl/SimpleTestInfo.java
modules/test/trunk/unit/src/main/org/jboss/unit/info/impl/SimpleTestSuiteInfo.java
Log:
honor the contract defined by TestInfo.getParameters() for the SimpleTestSuiteInfo implementation
Modified: modules/test/trunk/unit/src/main/org/jboss/test/unit/info/InfoTests.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/test/unit/info/InfoTests.java 2007-10-17 13:16:16 UTC (rev 8677)
+++ modules/test/trunk/unit/src/main/org/jboss/test/unit/info/InfoTests.java 2007-10-17 13:35:21 UTC (rev 8678)
@@ -49,8 +49,41 @@
testParameterInfo();
testTestCaseInfo();
testSuiteInfo();
+ testSuiteParameterInfo();
}
+ private static void testSuiteParameterInfo()
+ {
+ SimpleTestSuiteInfo testSuite = new SimpleTestSuiteInfo("my_test_suite");
+
+ //
+ SimpleTestCaseInfo fooTestCase = new SimpleTestCaseInfo("foo_test_case");
+ fooTestCase.addParameter(new SimpleParameterInfo("foo_param"));
+ testSuite.addTest(fooTestCase);
+ assertEquals(set("foo_param"), testSuite.getParameters().keySet());
+
+ //
+ SimpleTestCaseInfo barTestCase = new SimpleTestCaseInfo("bar_test_case");
+ barTestCase.addParameter(new SimpleParameterInfo("bar_param"));
+ testSuite.addTest(barTestCase);
+ assertEquals(set("foo_param", "bar_param"), testSuite.getParameters().keySet());
+
+ //
+ barTestCase.addParameter(new SimpleParameterInfo("bar_param2"));
+ barTestCase.removeParameter("bar_param");
+ barTestCase.addParameter(new SimpleParameterInfo("bar_param2"));
+ testSuite.addTest(barTestCase);
+ assertEquals(set("foo_param", "bar_param2"), testSuite.getParameters().keySet());
+
+ //
+ testSuite.removeTest("foo_test_case");
+ assertEquals(set("bar_param2"), testSuite.getParameters().keySet());
+
+ //
+ testSuite.removeTest("bar_test_case");
+ assertEquals(set(), testSuite.getParameters().keySet());
+ }
+
private static void testParameterInfo()
{
try
@@ -230,14 +263,6 @@
}
try
{
- testSuite.setParameters(null);
- fail();
- }
- catch (IllegalArgumentException e)
- {
- }
- try
- {
testSuite.getParameters().clear();
fail();
}
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/info/impl/SimpleTestCaseInfo.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/info/impl/SimpleTestCaseInfo.java 2007-10-17 13:16:16 UTC (rev 8677)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/info/impl/SimpleTestCaseInfo.java 2007-10-17 13:35:21 UTC (rev 8678)
@@ -23,7 +23,11 @@
package org.jboss.unit.info.impl;
import org.jboss.unit.info.TestCaseInfo;
+import org.jboss.unit.info.ParameterInfo;
+import java.util.Map;
+import java.util.HashMap;
+
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
@@ -44,4 +48,39 @@
{
return getName();
}
+
+ public void setParameters(Map<String, ? extends ParameterInfo> parameters)
+ {
+ if (parameters == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ Map<String, SimpleParameterInfo> tmp = new HashMap<String, SimpleParameterInfo>();
+ for (Map.Entry<String, ? extends ParameterInfo> entry : parameters.entrySet())
+ {
+ tmp.put(entry.getKey(), new SimpleParameterInfo(entry.getValue()));
+ }
+ this.parameters = tmp;
+ }
+
+ public void addParameter(ParameterInfo parameter)
+ {
+ if (parameter == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ SimpleParameterInfo tmp = new SimpleParameterInfo(parameter);
+ parameters.put(tmp.getName(), tmp);
+ }
+
+ public void removeParameter(String name)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ parameters.remove(name);
+ }
}
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/info/impl/SimpleTestInfo.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/info/impl/SimpleTestInfo.java 2007-10-17 13:16:16 UTC (rev 8677)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/info/impl/SimpleTestInfo.java 2007-10-17 13:35:21 UTC (rev 8678)
@@ -39,16 +39,16 @@
{
/** . */
- private final String name;
+ protected final String name;
/** . */
- private String description;
+ protected String description;
/** . */
- private Map<String, SimpleParameterInfo> parameters;
+ protected Map<String, SimpleParameterInfo> parameters;
/** . */
- private Set<String> keywords;
+ protected Set<String> keywords;
public SimpleTestInfo(String name)
{
@@ -105,41 +105,6 @@
return Collections.unmodifiableMap(parameters);
}
- public void setParameters(Map<String, ? extends ParameterInfo> parameters)
- {
- if (parameters == null)
- {
- throw new IllegalArgumentException();
- }
-
- //
- Map<String, SimpleParameterInfo> tmp = new HashMap<String, SimpleParameterInfo>();
- for (Map.Entry<String, ? extends ParameterInfo> entry : parameters.entrySet())
- {
- tmp.put(entry.getKey(), new SimpleParameterInfo(entry.getValue()));
- }
- this.parameters = tmp;
- }
-
- public void addParameter(ParameterInfo parameter)
- {
- if (parameter == null)
- {
- throw new IllegalArgumentException();
- }
- SimpleParameterInfo tmp = new SimpleParameterInfo(parameter);
- parameters.put(tmp.getName(), tmp);
- }
-
- public void removeParameter(String name)
- {
- if (name == null)
- {
- throw new IllegalArgumentException();
- }
- parameters.remove(name);
- }
-
public Set<String> getKeywords()
{
return Collections.unmodifiableSet(keywords);
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/info/impl/SimpleTestSuiteInfo.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/info/impl/SimpleTestSuiteInfo.java 2007-10-17 13:16:16 UTC (rev 8677)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/info/impl/SimpleTestSuiteInfo.java 2007-10-17 13:35:21 UTC (rev 8678)
@@ -119,6 +119,9 @@
throw new IllegalArgumentException();
}
tests.put(test.getName(), create(test));
+
+ // Update parameter map
+ updateParameters();
}
public void removeTest(String testName)
@@ -128,8 +131,24 @@
throw new IllegalArgumentException();
}
tests.remove(testName);
+
+ // Update parameter map
+ updateParameters();
}
+ /**
+ * Rebuild the suite parameters from the children parameters.
+ */
+ private void updateParameters()
+ {
+ Map<String, SimpleParameterInfo> parameters = new HashMap<String, SimpleParameterInfo>();
+ for (SimpleTestInfo child : tests.values())
+ {
+ parameters.putAll(child.parameters);
+ }
+ this.parameters = parameters;
+ }
+
private SimpleTestInfo create(TestInfo test)
{
if (test instanceof TestSuiteInfo)
16 years, 8 months