JBoss Portal SVN: r9497 - in modules/portlet/trunk/test: src/test and 1 other directories.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2008-01-14 05:16:55 -0500 (Mon, 14 Jan 2008)
New Revision: 9497
Modified:
modules/portlet/trunk/test/pom.xml
modules/portlet/trunk/test/src/test/build.xml
modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/metadata/CustomPortletModeTestEverythingTestCase.java
modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/metadata/CustomWindowStateTestEverythingTestCase.java
modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/metadata/EventTestEverythingTestCase.java
modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/metadata/FilterTestEverythingTestCase.java
modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/metadata/GeneralMetaDataTestCase.java
modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/metadata/PortletTestEverythingTestCase.java
modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/metadata/RenderParameterTestEverythingTestCase.java
modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/metadata/SecurityConstraintTestEverythingTestCase.java
modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/metadata/UserAttributeTestEverythingTestCase.java
Log:
run local tests with maven plugin
Modified: modules/portlet/trunk/test/pom.xml
===================================================================
--- modules/portlet/trunk/test/pom.xml 2008-01-14 09:41:39 UTC (rev 9496)
+++ modules/portlet/trunk/test/pom.xml 2008-01-14 10:16:55 UTC (rev 9497)
@@ -195,6 +195,29 @@
<build>
<plugins>
<plugin>
+ <groupId>org.jboss.unit</groupId>
+ <artifactId>jboss-unit-tooling-maven2</artifactId>
+ <executions>
+ <execution>
+ <phase>test</phase>
+ <goals>
+ <goal>execute</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <testsuites>
+ <testsuite>
+ <config>test/local-jboss-unit.xml</config>
+ </testsuite>
+ </testsuites>
+ <reports>
+ <xml>target/tests/reports/xml/local</xml>
+ <html>target/tests/reports/html/local</html>
+ </reports>
+ </configuration>
+ </plugin>
+ <plugin>
<groupId>org.jvnet.maven-antrun-extended-plugin</groupId>
<artifactId>maven-antrun-extended-plugin</artifactId>
<version>1.13</version>
Modified: modules/portlet/trunk/test/src/test/build.xml
===================================================================
--- modules/portlet/trunk/test/src/test/build.xml 2008-01-14 09:41:39 UTC (rev 9496)
+++ modules/portlet/trunk/test/src/test/build.xml 2008-01-14 10:16:55 UTC (rev 9497)
@@ -21,7 +21,6 @@
</target>
<target name="tests.call.all" unless="tests">
- <antcall target="tests.local"/>
<antcall target="tests.jboss"/>
<antcall target="tests.tomcat"/>
</target>
@@ -598,31 +597,4 @@
</target>
- <target name="tests.local">
-
- <taskdef name="jboss-unit" classname="org.jboss.unit.tooling.ant.JBossUnitTask" classpath="${plugin_classpath}"/>
-
- <jboss-unit>
-
- <tests config="${target}/test-classes/test/local-jboss-unit.xml">
-
- </tests>
-
- <reports>
- <xml toDir="${target}/tests/reports/xml/local"/>
- <html toDir="${target}/tests/reports/html/local"/>
- </reports>
-
- <classpath>
- <pathelement location="${target}/classes"/>
- <pathelement location="${target}/test-classes"/>
- <pathelement location="${target}/test-classes/metadata"/>
- <pathelement location="${target}/test-classes/test"/>
- <pathelement path="${test_classpath}"/>
- </classpath>
-
- </jboss-unit >
-
- </target>
-
</project>
\ No newline at end of file
Modified: modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/metadata/CustomPortletModeTestEverythingTestCase.java
===================================================================
--- modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/metadata/CustomPortletModeTestEverythingTestCase.java 2008-01-14 09:41:39 UTC (rev 9496)
+++ modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/metadata/CustomPortletModeTestEverythingTestCase.java 2008-01-14 10:16:55 UTC (rev 9497)
@@ -44,7 +44,7 @@
{
try
{
- String xmlFile = "customPortletMode/portlet1.xml";
+ String xmlFile = "metadata/customPortletMode/portlet1.xml";
PortletApplication10MetaData md = unmarshall10(xmlFile);
assertNotNull(md);
@@ -74,7 +74,7 @@
try
{
- String xmlFile = "customPortletMode/portlet2.xml";
+ String xmlFile = "metadata/customPortletMode/portlet2.xml";
PortletApplication10MetaData md = unmarshall10(xmlFile);
assertNotNull(md);
@@ -117,7 +117,7 @@
try
{
- String xmlFile = "customPortletMode/portlet1-fail.xml";
+ String xmlFile = "metadata/customPortletMode/portlet1-fail.xml";
PortletApplication10MetaData md = unmarshall10(xmlFile);
fail("portlet 2.0 properties are not allowed");
Modified: modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/metadata/CustomWindowStateTestEverythingTestCase.java
===================================================================
--- modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/metadata/CustomWindowStateTestEverythingTestCase.java 2008-01-14 09:41:39 UTC (rev 9496)
+++ modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/metadata/CustomWindowStateTestEverythingTestCase.java 2008-01-14 10:16:55 UTC (rev 9497)
@@ -43,7 +43,7 @@
try
{
- String xmlFile = "customWindowState/portlet1.xml";
+ String xmlFile = "metadata/customWindowState/portlet1.xml";
PortletApplication10MetaData md = unmarshall10(xmlFile);
assertNotNull(md);
@@ -74,7 +74,7 @@
try
{
- String xmlFile = "customWindowState/portlet2.xml";
+ String xmlFile = "metadata/customWindowState/portlet2.xml";
PortletApplication10MetaData md = unmarshall10(xmlFile);
assertNotNull(md);
Modified: modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/metadata/EventTestEverythingTestCase.java
===================================================================
--- modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/metadata/EventTestEverythingTestCase.java 2008-01-14 09:41:39 UTC (rev 9496)
+++ modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/metadata/EventTestEverythingTestCase.java 2008-01-14 10:16:55 UTC (rev 9497)
@@ -48,7 +48,7 @@
try
{
- String xmlFile = "event/portlet-event1.xml";
+ String xmlFile = "metadata/event/portlet-event1.xml";
unmarshall10(xmlFile);
fail();
@@ -65,7 +65,7 @@
try
{
- String xmlFile = "event/portlet-event2.xml";
+ String xmlFile = "metadata/event/portlet-event2.xml";
PortletApplication20MetaData md = unmarshall20(xmlFile);
assertNotNull(md);
@@ -125,7 +125,7 @@
try
{
- String xmlFile = "event/portlet-event2-fail.xml";
+ String xmlFile = "metadata/event/portlet-event2-fail.xml";
PortletApplication10MetaData md = unmarshall10(xmlFile);
assertNotNull(md);
Modified: modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/metadata/FilterTestEverythingTestCase.java
===================================================================
--- modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/metadata/FilterTestEverythingTestCase.java 2008-01-14 09:41:39 UTC (rev 9496)
+++ modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/metadata/FilterTestEverythingTestCase.java 2008-01-14 10:16:55 UTC (rev 9497)
@@ -43,7 +43,7 @@
{
try
{
- unmarshall10("filter/portlet-filter1.xml");
+ unmarshall10("metadata/filter/portlet-filter1.xml");
// no filters in jsr 168
fail();
}
@@ -58,7 +58,7 @@
{
try
{
- String xmlFile = "filter/portlet-filter2.xml";
+ String xmlFile = "metadata/filter/portlet-filter2.xml";
PortletApplication20MetaData md = unmarshall20(xmlFile);
assertNotNull(md);
Modified: modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/metadata/GeneralMetaDataTestCase.java
===================================================================
--- modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/metadata/GeneralMetaDataTestCase.java 2008-01-14 09:41:39 UTC (rev 9496)
+++ modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/metadata/GeneralMetaDataTestCase.java 2008-01-14 10:16:55 UTC (rev 9497)
@@ -45,7 +45,7 @@
{
try
{
- PortletApplication10MetaData md = this.unmarshall10("general/portlet1.xml");
+ PortletApplication10MetaData md = this.unmarshall10("metadata/general/portlet1.xml");
assertNotNull(md);
assertTrue(md instanceof PortletApplication10MetaData);
assertEquals("1.0", md.getVersion());
@@ -62,7 +62,7 @@
{
try
{
- PortletApplication10MetaData md = this.unmarshall10("general/portlet2.xml");
+ PortletApplication10MetaData md = this.unmarshall10("metadata/general/portlet2.xml");
assertNotNull(md);
assertTrue(md instanceof PortletApplication20MetaData);
assertEquals("2.0", md.getVersion());
@@ -79,7 +79,7 @@
{
try
{
- PortletApplication20MetaData md = unmarshall20("general/portlet2-jsr286.xml");
+ PortletApplication20MetaData md = unmarshall20("metadata/general/portlet2-jsr286.xml");
assertEquals("2.0", md.getVersion());
assertTrue(md instanceof PortletApplication20MetaData);
@@ -118,7 +118,7 @@
{
try
{
- PortletApplication10MetaData md = unmarshall10("general/portlet-app_1_0.xml");
+ PortletApplication10MetaData md = unmarshall10("metadata/general/portlet-app_1_0.xml");
assertNotNull(md);
assertTrue(md instanceof PortletApplication10MetaData);
@@ -138,7 +138,7 @@
{
try
{
- PortletApplication10MetaData md = this.unmarshall10("general/portlet-app_2_0.xml");
+ PortletApplication10MetaData md = this.unmarshall10("metadata/general/portlet-app_2_0.xml");
assertEquals("2.0", md.getVersion());
assertTrue(md instanceof PortletApplication20MetaData);
}
Modified: modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/metadata/PortletTestEverythingTestCase.java
===================================================================
--- modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/metadata/PortletTestEverythingTestCase.java 2008-01-14 09:41:39 UTC (rev 9496)
+++ modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/metadata/PortletTestEverythingTestCase.java 2008-01-14 10:16:55 UTC (rev 9497)
@@ -54,7 +54,7 @@
{
try
{
- String xmlFile = "portlet/portlet1.xml";
+ String xmlFile = "metadata/portlet/portlet1.xml";
PortletApplication10MetaData md = unmarshall10(xmlFile);
assertNotNull(md);
@@ -222,7 +222,7 @@
{
try
{
- String xmlFile = "portlet/portlet2.xml";
+ String xmlFile = "metadata/portlet/portlet2.xml";
PortletApplication10MetaData md = unmarshall10(xmlFile);
assertNotNull(md);
@@ -382,7 +382,7 @@
{
try
{
- String xmlFile = "portlet/portlet2-jsr286.xml";
+ String xmlFile = "metadata/portlet/portlet2-jsr286.xml";
PortletApplication10MetaData md = unmarshall10(xmlFile);
assertNotNull(md);
Modified: modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/metadata/RenderParameterTestEverythingTestCase.java
===================================================================
--- modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/metadata/RenderParameterTestEverythingTestCase.java 2008-01-14 09:41:39 UTC (rev 9496)
+++ modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/metadata/RenderParameterTestEverythingTestCase.java 2008-01-14 10:16:55 UTC (rev 9497)
@@ -40,7 +40,7 @@
try
{
- String xmlFile = "renderParameter/portlet2.xml";
+ String xmlFile = "metadata/renderParameter/portlet2.xml";
PortletApplication20MetaData md = unmarshall20(xmlFile);
assertNotNull(md);
Modified: modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/metadata/SecurityConstraintTestEverythingTestCase.java
===================================================================
--- modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/metadata/SecurityConstraintTestEverythingTestCase.java 2008-01-14 09:41:39 UTC (rev 9496)
+++ modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/metadata/SecurityConstraintTestEverythingTestCase.java 2008-01-14 10:16:55 UTC (rev 9497)
@@ -45,7 +45,7 @@
try
{
- String xmlFile = "security/portlet1.xml";
+ String xmlFile = "metadata/security/portlet1.xml";
PortletApplication10MetaData md = unmarshall10(xmlFile);
assertNotNull(md);
@@ -135,7 +135,7 @@
try
{
- String xmlFile = "security/portlet2.xml";
+ String xmlFile = "metadata/security/portlet2.xml";
PortletApplication10MetaData md = unmarshall10( xmlFile);
assertNotNull(md);
Modified: modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/metadata/UserAttributeTestEverythingTestCase.java
===================================================================
--- modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/metadata/UserAttributeTestEverythingTestCase.java 2008-01-14 09:41:39 UTC (rev 9496)
+++ modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/metadata/UserAttributeTestEverythingTestCase.java 2008-01-14 10:16:55 UTC (rev 9497)
@@ -43,7 +43,7 @@
{
try
{
- String xmlFile = "userAttribute/portlet1.xml";
+ String xmlFile = "metadata/userAttribute/portlet1.xml";
PortletApplication10MetaData md = unmarshall10(xmlFile);
assertNotNull(md);
@@ -73,7 +73,7 @@
{
try
{
- String xmlFile = "userAttribute/portlet2.xml";
+ String xmlFile = "metadata/userAttribute/portlet2.xml";
PortletApplication10MetaData md = unmarshall10(xmlFile);
assertNotNull(md);
18 years, 3 months
JBoss Portal SVN: r9496 - modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2008-01-14 04:41:39 -0500 (Mon, 14 Jan 2008)
New Revision: 9496
Modified:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/Assertion.java
Log:
Assertions for JSR286 PLT.6 and PLT.15
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/Assertion.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/Assertion.java 2008-01-14 00:16:23 UTC (rev 9495)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/Assertion.java 2008-01-14 09:41:39 UTC (rev 9496)
@@ -66,7 +66,7 @@
" method must not be invoked within the current client request", Status.disabled("spec?")),
JSR168_18(new TCK(18), "If a permanent unavailability is indicated by the UnavailableException, the" +
- " portlet container must remove the portlet from service immediately, call the portlet�s destroy method, and release" +
+ " portlet container must remove the portlet from service immediately, call the portlet�s destroy method, and release" +
" the portlet object.", Status.disabled("spec?")),
JSR168_19(new TCK(19), "A RuntimeException thrown during the request handling must be handled as a" +
@@ -173,7 +173,7 @@
JSR168_60(new TCK(60), "If the user is not authenticated the getAuthType method must return null"),
JSR168_61(new TCK(61), "If the portlet container supports additional content types for the" +
- " portlet�s output, it must declare the additional content types through the getResponseContentTypes method of the" +
+ " portlet�s output, it must declare the additional content types through the getResponseContentTypes method of the" +
" request object. The returned Enumeration of strings should contain the content types the portlet container" +
" supports in order of preference. The first element of the enumeration must be the same content type returned by" +
" the getResponseContentType method."),
@@ -360,7 +360,7 @@
JSR168_120(new TCK(120), "", Status.jbossUntestable("why?")),
JSR168_121(new TCK(121), "The getRequestDispatcher method takes a String argument describing a" +
- " path within the scope of the PortletContext of a portlet application. This path must begin with a �/� and it is" +
+ " path within the scope of the PortletContext of a portlet application. This path must begin with a �/� and it is" +
" relative to the PortletContext root."),
JSR168_122(new TCK(122), "The getNamedDispatcher method takes a String argument indicating the" +
@@ -429,6 +429,71 @@
// ******************************************************************************************************************
JSR168_1000(new TCK(1000), "todo ???"),
+ // PLT.6 Portlet Config
+ JSR286_26(new TCK(26), "PLT.6.2", "If the root resource bundle does not contain the resources for these values and " +
+ "the values are defined inline, the portlet container must add the inline values as resources of the root " +
+ "resource bundle."),
+ JSR286_27(new TCK(27), "PLT.6.2", "If the portlet definition does not define a resource bundle and the information" +
+ " is defined inline in the deployment descriptor, the portlet container must create a ResourceBundle and populate" +
+ " it, with the inline values, using the keys defined in the PLT.25.10 Resource Bundles Section."),
+ JSR286_28(new TCK(28), "PLT.6.3", "The getDefaultNamespace method of the PortletConfig interface returns the " +
+ "default namespace for events and public render parameters set in the portlet deployment descriptor with " +
+ "the default-namespace element, or the XML default namespace XMLConstants.NULL_NS_URI if no default namespace" +
+ " is provided in the portlet deployment descriptor."),
+ JSR286_29(new TCK(29), "PLT.6.4", "The getPublicRenderParameterNames method of the PortletConfig interface returns" +
+ " the public render parameter names found in the portlet definition in the deployment descriptor with the " +
+ "supported-public-render-parameter element or an empty enumeration if no public render parameters are defined" +
+ " for the current portlet definition."),
+ JSR286_30(new TCK(30), "PLT.6.5", "The getPublishingEventQNames method of the PortletConfig interface returns the" +
+ " publishing event QNames found in the portlet definition in the deployment descriptor with the " +
+ "supported-publishing-event element or an empty enumeration if no publishing events are defined for the " +
+ "current portlet definition."),
+ JSR286_31(new TCK(31), "PLT.6.5", "If the event was defined using the name element instead of the qname element " +
+ "the defined default namespace must be added as namespace for the returned QName."),
+ JSR286_32(new TCK(32), "PLT.6.6", "The getProcessingEventQNames method of the PortletConfig interface returns " +
+ "the processing event QNames found in the portlet definition in the deployment descriptor with the " +
+ "supported-processing-event element or an empty enumeration if no processing events are defined for the current" +
+ " portlet definition."),
+ JSR286_33(new TCK(33), "PLT.6.6", "If the event was defined using the name element instead of the qname element the" +
+ " defined default namespace must be added as namespace for the returned Qname."),
+ JSR286_34(new TCK(34), "PLT.6.7", "The getSupportedLocales method of the PortletConfig interface returns the " +
+ "supported locales found in the portlet definition in the deployment descriptor with the supported-locale " +
+ "element or an empty enumeration if no supported locales are defined for the current portlet definition."),
+
+
+ // PLT.15 Coordination between portlets
+ JSR286_133(new TCK(133), "PLT.15.2.2", "The event must always have a name and may optionally have a value."),
+ JSR286_134(new TCK(134), "PLT.15.2.2", "If the event has a value it must be based on the type defined in the " +
+ "deployment descriptor." ),
+ JSR286_135(new TCK(135), "PLT.15.2.3", "The portlet can publish events via the StateAwareResponse.setEvent " +
+ "method."),
+ JSR286_136(new TCK(136), "PLT.15.2.3", "It is also valid to call StateAwareResponse.setEvent multiple times " +
+ "in the current processAction or processEvent method." ),
+ JSR286_137(new TCK(137), "PLT.15.2.3", "If only the local part is specified the namespace must be the default " +
+ "namespace defined in the portlet deployment descriptor with the default namespace element."),
+ JSR286_138(new TCK(138), "PLT.15.2.3", "If no such element is provided in the portlet deployment descriptor the " +
+ "XML default namespace javax.xml.XMLConstants.NULL_NS_URI must be assumed."),
+ JSR286_139(new TCK(139), "PLT.15.2.3", "Otherwise the setEvent method on the StateAwareResponse must throw a " +
+ "java.lang.IllegalArgumentException. Otherwise the setEvent method on the StateAwareResponse must throw a " +
+ "java.lang.IllegalArgumentException."),
+ JSR286_140(new TCK(140), "PLT.15.2.4.1", "The event definition must contain an event name."),
+ JSR286_141(new TCK(141), "PLT.15.2.4.1", "The portlet container must use the event name entry in the portlet " +
+ "deployment descriptor as event name when submitting an event to the portlet."),
+ JSR286_143(new TCK(142), "PLT.15.2.4", "The portlet can send events which are not declared in the portlet " +
+ "deployment descriptor at runtime using the setEvent method on either the ActionResponse or EventResponse."),
+ JSR286_144(new TCK(143), "PLT.15.2.5", "Events are valid only in the current client request and the portlet " +
+ "container must therefore deliver all events within the current client request."),
+ JSR286_145(new TCK(144), "PLT.15.2.5", "Event distribution must be serialized for a specific portlet window per " +
+ "client request so that at any given time a portlet window is only processing one event in the processEvent " +
+ "method for the current client request."),
+ JSR286_146(new TCK(145), "PLT.15.2.5", "Portlet event processing may occur after the processing of the action, " +
+ "if the portlet was target of an action URL, and must be finished before the render phase."),
+ JSR286_147(new TCK(146), "PLT.15.2.6", "If a portlet throws an exception in the processEvent method, all operations" +
+ " on the EventResponse must be ignored."),
+ JSR286_148(new TCK(147), "PLT.15.2.6", "If a permanent unavailability is indicated by the UnavailableException," +
+ " the portlet container must remove the portlet from service immediately, call the portlet’s destroy method," +
+ " and release the portlet object.")
+
;
/**
@@ -598,6 +663,9 @@
private final String description;
/** . */
+ private final String section;
+
+ /** . */
private Status status;
Assertion(Ref ref, String description)
@@ -605,13 +673,29 @@
this(ref, description, new Active());
}
+ Assertion(Ref ref, String section, String description)
+ {
+ this(ref, description, section, new Active());
+ }
+
Assertion(Ref ref, String description, Status status)
{
this.ref = ref;
this.description = description;
+ this.section = null;
this.status = status;
}
+ Assertion(Ref ref, String section, String description, Status status)
+ {
+ this.ref = ref;
+ this.description = description;
+ this.section = section;
+ this.status = status;
+ }
+
+
+
public Ref getRef()
{
return ref;
@@ -626,4 +710,9 @@
{
return status;
}
+
+ public String getSection()
+ {
+ return section;
+ }
}
18 years, 3 months
JBoss Portal SVN: r9495 - modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-01-13 19:16:23 -0500 (Sun, 13 Jan 2008)
New Revision: 9495
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletController.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletControllerContext.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletControllerContextImpl.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/TestInstanceContext.java
Log:
simplify a bit
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletController.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletController.java 2008-01-13 23:19:42 UTC (rev 9494)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletController.java 2008-01-14 00:16:23 UTC (rev 9495)
@@ -23,12 +23,10 @@
package org.jboss.portal.portlet.test;
import org.jboss.portal.portlet.Portlet;
-import org.jboss.portal.portlet.PortletContext;
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.PortletParametersStateString;
import org.jboss.portal.portlet.PortletParameters;
import org.jboss.portal.portlet.PortletInvokerException;
-import org.jboss.portal.portlet.PortletInvoker;
import org.jboss.portal.portlet.impl.spi.AbstractRequestContext;
import org.jboss.portal.portlet.impl.spi.AbstractUserContext;
import org.jboss.portal.portlet.impl.spi.AbstractWindowContext;
@@ -50,7 +48,6 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import javax.servlet.ServletContext;
import java.io.UnsupportedEncodingException;
import java.io.PrintWriter;
import java.io.IOException;
@@ -85,10 +82,7 @@
}
else
{
- ServletContext servletContext = context.getServletContext();
- PortletInvoker invoker = (PortletInvoker)servletContext.getAttribute("ConsumerPortletInvoker");
- PortletContext target = PortletContext.createPortletContext(action.portletId);
- Portlet portlet = invoker.getPortlet(target);
+ Portlet portlet = context.getPortlet(action.portletId);
HttpServletRequest req = context.getClientRequest();
HttpServletResponse resp = context.getClientResponse();
PortalNavigationalState navState = context.getNavigationalState();
@@ -148,7 +142,7 @@
//
try
{
- return invoker.invoke(actionInvocation);
+ return context.invoke(actionInvocation);
}
catch (PortletInvokerException e)
{
@@ -159,8 +153,6 @@
public void process(PortletControllerContext context, Action action) throws PortletInvokerException, IOException
{
- ServletContext servletContext = context.getServletContext();
- PortletInvoker invoker = (PortletInvoker)servletContext.getAttribute("ConsumerPortletInvoker");
HttpServletRequest req = context.getClientRequest();
HttpServletResponse resp = context.getClientResponse();
PortalNavigationalState navState = context.getNavigationalState();
@@ -175,8 +167,6 @@
{
StateResponse stateResponse = (StateResponse)response;
-
-
//
for (StateResponse.Event event : stateResponse.getEvents())
{
@@ -266,7 +256,7 @@
//
try
{
- for (Iterator i = invoker.getPortlets().iterator(); i.hasNext();)
+ for (Iterator i = context.getPortlets().iterator(); i.hasNext();)
{
Portlet portlet = (Portlet)i.next();
writer.print("<div><div>" + portlet.getContext() + "</div>");
@@ -313,7 +303,7 @@
//
try
{
- invoker.invoke(render);
+ context.invoke(render);
}
catch (PortletInvokerException e)
{
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletControllerContext.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletControllerContext.java 2008-01-13 23:19:42 UTC (rev 9494)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletControllerContext.java 2008-01-14 00:16:23 UTC (rev 9495)
@@ -22,9 +22,15 @@
******************************************************************************/
package org.jboss.portal.portlet.test;
+import org.jboss.portal.portlet.Portlet;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletContext;
+import java.util.Collection;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -41,4 +47,10 @@
HttpServletResponse getClientResponse();
+ Portlet getPortlet(String portletId) throws PortletInvokerException;
+
+ PortletInvocationResponse invoke(PortletInvocation invocation) throws PortletInvokerException;
+
+ Collection<Portlet> getPortlets() throws PortletInvokerException;
+
}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletControllerContextImpl.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletControllerContextImpl.java 2008-01-13 23:19:42 UTC (rev 9494)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletControllerContextImpl.java 2008-01-14 00:16:23 UTC (rev 9495)
@@ -26,6 +26,12 @@
import org.jboss.portal.web.WebRequest;
import org.jboss.portal.web.Body;
import org.jboss.portal.portlet.test.url.ParameterDecoder;
+import org.jboss.portal.portlet.PortletInvoker;
+import org.jboss.portal.portlet.Portlet;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.PortletContext;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.common.util.ParameterMap;
import org.jboss.portal.common.util.Tools;
import org.jboss.portal.Mode;
@@ -35,6 +41,7 @@
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletContext;
import java.io.IOException;
+import java.util.Collection;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -63,6 +70,9 @@
/** . */
private final PortletController.Action action;
+
+ /** . */
+ private final PortletInvoker invoker;
public PortletControllerContextImpl(
HttpServletRequest req,
@@ -77,6 +87,9 @@
}
//
+ PortletInvoker invoker = (PortletInvoker)servletContext.getAttribute("ConsumerPortletInvoker");
+
+ //
String pathInfo = req.getPathInfo();
String targetId;
@@ -146,6 +159,7 @@
this.req = req;
this.resp = resp;
this.servletContext = servletContext;
+ this.invoker = invoker;
}
else
{
@@ -154,6 +168,7 @@
this.req = req;
this.resp = resp;
this.servletContext = servletContext;
+ this.invoker = invoker;
//
if (navStateScope == SESSION_SCOPE)
@@ -187,4 +202,20 @@
{
return resp;
}
+
+ public Portlet getPortlet(String portletId) throws PortletInvokerException
+ {
+ PortletContext target = PortletContext.createPortletContext(action.portletId);
+ return invoker.getPortlet(target);
+ }
+
+ public PortletInvocationResponse invoke(PortletInvocation invocation) throws PortletInvokerException
+ {
+ return invoker.invoke(invocation);
+ }
+
+ public Collection<Portlet> getPortlets() throws PortletInvokerException
+ {
+ return invoker.getPortlets();
+ }
}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/TestInstanceContext.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/TestInstanceContext.java 2008-01-13 23:19:42 UTC (rev 9494)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/TestInstanceContext.java 2008-01-14 00:16:23 UTC (rev 9495)
@@ -37,14 +37,19 @@
public class TestInstanceContext implements InstanceContext
{
+ /** . */
private HttpServletRequest req;
+ /** . */
private boolean modifiable;
+ /** . */
private PortletContext target;
+ /** . */
private boolean useClone;
+ /** . */
private String id;
public TestInstanceContext(
18 years, 3 months
JBoss Portal SVN: r9494 - in modules/portlet/trunk: portlet/src/main/java/org/jboss/portal/portlet/invocation/response and 12 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-01-13 18:19:42 -0500 (Sun, 13 Jan 2008)
New Revision: 9494
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/UpdateNavigationalStateResponse.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/event/
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/event/EventTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/actions/PortletEventTestAction.java
modules/portlet/trunk/test/src/test/resources/jsr286/tck/event-war/
modules/portlet/trunk/test/src/test/resources/jsr286/tck/event-war/WEB-INF/
modules/portlet/trunk/test/src/test/resources/jsr286/tck/event-war/WEB-INF/portlet.xml
modules/portlet/trunk/test/src/test/resources/jsr286/tck/event-war/WEB-INF/web.xml
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/ActionResponseImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/EventResponseImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/StateAwareResponseImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/StateResponse.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/framework/UTP1.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/framework/UTP10.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/framework/UTP11.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/framework/UTP2.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/framework/UTP3.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/framework/UTP4.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/framework/UTP5.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/framework/UTP6.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/framework/UTP7.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/framework/UTP8.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/framework/UTP9.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/JoinPointType.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/PortletTestContext.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/base/AbstractUniversalTestPortlet.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortalServlet.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletController.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletControllerContext.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletControllerContextImpl.java
modules/portlet/trunk/test/src/test/build.xml
modules/portlet/trunk/test/src/test/resources/test/remote-jboss-unit.xml
Log:
- start to implement basic event testing
- refactored a bit the test portlet controller for improving control flow
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/ActionResponseImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/ActionResponseImpl.java 2008-01-13 19:41:37 UTC (rev 9493)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/ActionResponseImpl.java 2008-01-13 23:19:42 UTC (rev 9494)
@@ -28,7 +28,7 @@
import org.jboss.portal.portlet.invocation.ActionInvocation;
import org.jboss.portal.portlet.invocation.response.HTTPRedirectionResponse;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
-import org.jboss.portal.portlet.invocation.response.RenderResponse;
+import org.jboss.portal.portlet.invocation.response.UpdateNavigationalStateResponse;
import javax.portlet.ActionResponse;
import java.io.IOException;
@@ -54,7 +54,7 @@
super(invocation, preq);
//
- RenderResponse rr = new RenderResponse();
+ UpdateNavigationalStateResponse rr = new UpdateNavigationalStateResponse();
rr.setNavigationalState(new PortletParametersStateString());
//
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/EventResponseImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/EventResponseImpl.java 2008-01-13 19:41:37 UTC (rev 9493)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/EventResponseImpl.java 2008-01-13 23:19:42 UTC (rev 9494)
@@ -23,7 +23,7 @@
package org.jboss.portal.portlet.impl.jsr168.api;
import org.jboss.portal.portlet.invocation.EventInvocation;
-import org.jboss.portal.portlet.invocation.response.RenderResponse;
+import org.jboss.portal.portlet.invocation.response.UpdateNavigationalStateResponse;
import org.jboss.portal.portlet.spi.PortletInvocationContext;
import javax.portlet.EventResponse;
@@ -55,8 +55,8 @@
PortletInvocationContext context = invocation.getPortletContext();
//
- ((RenderResponse)response).setMode(context.getMode());
- ((RenderResponse)response).setWindowState(context.getWindowState());
- ((RenderResponse)response).setNavigationalState(context.getNavigationalState());
+ ((UpdateNavigationalStateResponse)response).setMode(context.getMode());
+ ((UpdateNavigationalStateResponse)response).setWindowState(context.getWindowState());
+ ((UpdateNavigationalStateResponse)response).setNavigationalState(context.getNavigationalState());
}
}
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/StateAwareResponseImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/StateAwareResponseImpl.java 2008-01-13 19:41:37 UTC (rev 9493)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/StateAwareResponseImpl.java 2008-01-13 23:19:42 UTC (rev 9494)
@@ -23,7 +23,7 @@
package org.jboss.portal.portlet.impl.jsr168.api;
import org.jboss.portal.portlet.invocation.PortletInvocation;
-import org.jboss.portal.portlet.invocation.response.RenderResponse;
+import org.jboss.portal.portlet.invocation.response.UpdateNavigationalStateResponse;
import org.jboss.portal.portlet.invocation.response.RedirectionResponse;
import org.jboss.portal.portlet.invocation.response.StateResponse;
import org.jboss.portal.portlet.PortletParametersStateString;
@@ -77,7 +77,7 @@
super(invocation, preq);
//
- RenderResponse rr = new RenderResponse();
+ UpdateNavigationalStateResponse rr = new UpdateNavigationalStateResponse();
rr.setNavigationalState(new PortletParametersStateString());
//
@@ -98,7 +98,7 @@
{
throw new WindowStateException("Not supported", windowState);
}
- ((RenderResponse)response).setWindowState(org.jboss.portal.WindowState.create(windowState.toString()));
+ ((UpdateNavigationalStateResponse)response).setWindowState(org.jboss.portal.WindowState.create(windowState.toString()));
decision = WANT_RENDER;
}
else
@@ -124,7 +124,7 @@
throw new PortletModeException("Not supported", portletMode);
}
Mode mode = Mode.create(portletMode.toString());
- ((RenderResponse)response).setMode(mode);
+ ((UpdateNavigationalStateResponse)response).setMode(mode);
}
decision = WANT_RENDER;
}
@@ -162,7 +162,7 @@
//
if (decision == WANT_NOTHING || decision == WANT_RENDER)
{
- ((PortletParametersStateString)((RenderResponse)response).getNavigationalState()).replace(map);
+ ((PortletParametersStateString)((UpdateNavigationalStateResponse)response).getNavigationalState()).replace(map);
decision = WANT_RENDER;
}
else
@@ -178,7 +178,7 @@
//
if (decision == WANT_NOTHING || decision == WANT_RENDER)
{
- ((PortletParametersStateString)((RenderResponse)response).getNavigationalState()).setValue(name, value);
+ ((PortletParametersStateString)((UpdateNavigationalStateResponse)response).getNavigationalState()).setValue(name, value);
decision = WANT_RENDER;
}
else
@@ -194,7 +194,7 @@
//
if (decision == WANT_NOTHING || decision == WANT_RENDER)
{
- ((PortletParametersStateString)((RenderResponse)response).getNavigationalState()).setValues(name, values);
+ ((PortletParametersStateString)((UpdateNavigationalStateResponse)response).getNavigationalState()).setValues(name, values);
decision = WANT_RENDER;
}
else
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/StateResponse.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/StateResponse.java 2008-01-13 19:41:37 UTC (rev 9493)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/StateResponse.java 2008-01-13 23:19:42 UTC (rev 9494)
@@ -25,6 +25,7 @@
import javax.xml.namespace.QName;
import java.util.ArrayList;
import java.util.List;
+import java.util.Collections;
import java.io.Serializable;
/**
@@ -35,7 +36,7 @@
{
/** . */
- private ArrayList<Event> producedEvents;
+ private List<Event> producedEvents = Collections.emptyList();
public void addEvent(Event event)
{
@@ -45,7 +46,7 @@
}
//
- if (producedEvents == null)
+ if (producedEvents.size() == 0)
{
producedEvents = new ArrayList<Event>();
}
Copied: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/UpdateNavigationalStateResponse.java (from rev 9493, modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/RenderResponse.java)
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/UpdateNavigationalStateResponse.java (rev 0)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/UpdateNavigationalStateResponse.java 2008-01-13 23:19:42 UTC (rev 9494)
@@ -0,0 +1,85 @@
+/******************************************************************************
+ * 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.portlet.invocation.response;
+
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.portlet.StateString;
+
+/**
+ * Want to be rendered.
+ *
+ * @todo rename to UpdateNavigationalStateResponse
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5477 $
+ */
+public class UpdateNavigationalStateResponse extends StateResponse
+{
+
+ /** The navigational state returned. */
+ protected StateString state;
+
+ /** The new window state requested. */
+ protected WindowState windowState;
+
+ /** The new mode requested. */
+ protected Mode mode;
+
+ public UpdateNavigationalStateResponse()
+ {
+ state = null;
+ windowState = null;
+ mode = null;
+ }
+
+ public Mode getMode()
+ {
+ return mode;
+ }
+
+ public void setMode(Mode mode)
+ {
+ this.mode = mode;
+ }
+
+ public WindowState getWindowState()
+ {
+ return windowState;
+ }
+
+ public void setWindowState(WindowState windowState)
+ {
+ this.windowState = windowState;
+ }
+
+ public StateString getNavigationalState()
+ {
+ return state;
+ }
+
+ public void setNavigationalState(StateString state)
+ {
+ this.state = state;
+ }
+}
Property changes on: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/UpdateNavigationalStateResponse.java
___________________________________________________________________
Name: svn:executable
+
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/framework/UTP1.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/framework/UTP1.java 2008-01-13 19:41:37 UTC (rev 9493)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/framework/UTP1.java 2008-01-13 23:19:42 UTC (rev 9494)
@@ -53,6 +53,8 @@
public final static JoinPoint RENDER_JOIN_POINT = new JoinPoint(NAME, JoinPointType.PORTLET_RENDER);
+ public final static JoinPoint EVENT_JOIN_POINT = new JoinPoint(NAME, JoinPointType.PORTLET_EVENT);
+
public final static JoinPoint ACTION_JOIN_POINT = new JoinPoint(NAME, JoinPointType.PORTLET_ACTION);
/** Resets helper variables */
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/framework/UTP10.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/framework/UTP10.java 2008-01-13 19:41:37 UTC (rev 9493)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/framework/UTP10.java 2008-01-13 23:19:42 UTC (rev 9494)
@@ -40,10 +40,12 @@
public static final String NAME = "Portlet10";
- public final static JoinPoint RENDER_JOIN_POINT = new JoinPoint(UTP10.NAME, JoinPointType.PORTLET_RENDER);
+ public final static JoinPoint RENDER_JOIN_POINT = new JoinPoint(NAME, JoinPointType.PORTLET_RENDER);
- public final static JoinPoint ACTION_JOIN_POINT = new JoinPoint(UTP10.NAME, JoinPointType.PORTLET_ACTION);
+ public final static JoinPoint EVENT_JOIN_POINT = new JoinPoint(NAME, JoinPointType.PORTLET_EVENT);
+ public final static JoinPoint ACTION_JOIN_POINT = new JoinPoint(NAME, JoinPointType.PORTLET_ACTION);
+
/** Resets helper variables */
public void reset()
{
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/framework/UTP11.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/framework/UTP11.java 2008-01-13 19:41:37 UTC (rev 9493)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/framework/UTP11.java 2008-01-13 23:19:42 UTC (rev 9494)
@@ -42,6 +42,8 @@
public final static JoinPoint RENDER_JOIN_POINT = new JoinPoint(NAME, JoinPointType.PORTLET_RENDER);
+ public final static JoinPoint EVENT_JOIN_POINT = new JoinPoint(NAME, JoinPointType.PORTLET_EVENT);
+
public final static JoinPoint ACTION_JOIN_POINT = new JoinPoint(NAME, JoinPointType.PORTLET_ACTION);
/** Resets helper variables */
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/framework/UTP2.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/framework/UTP2.java 2008-01-13 19:41:37 UTC (rev 9493)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/framework/UTP2.java 2008-01-13 23:19:42 UTC (rev 9494)
@@ -42,6 +42,8 @@
public final static JoinPoint RENDER_JOIN_POINT = new JoinPoint(NAME, JoinPointType.PORTLET_RENDER);
+ public final static JoinPoint EVENT_JOIN_POINT = new JoinPoint(NAME, JoinPointType.PORTLET_EVENT);
+
public final static JoinPoint ACTION_JOIN_POINT = new JoinPoint(NAME, JoinPointType.PORTLET_ACTION);
/** Resets helper variables */
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/framework/UTP3.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/framework/UTP3.java 2008-01-13 19:41:37 UTC (rev 9493)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/framework/UTP3.java 2008-01-13 23:19:42 UTC (rev 9494)
@@ -40,10 +40,12 @@
public static final String NAME = "Portlet3";
- public final static JoinPoint RENDER_JOIN_POINT = new JoinPoint(UTP3.NAME, JoinPointType.PORTLET_RENDER);
+ public final static JoinPoint RENDER_JOIN_POINT = new JoinPoint(NAME, JoinPointType.PORTLET_RENDER);
- public final static JoinPoint ACTION_JOIN_POINT = new JoinPoint(UTP3.NAME, JoinPointType.PORTLET_ACTION);
+ public final static JoinPoint EVENT_JOIN_POINT = new JoinPoint(NAME, JoinPointType.PORTLET_EVENT);
+ public final static JoinPoint ACTION_JOIN_POINT = new JoinPoint(NAME, JoinPointType.PORTLET_ACTION);
+
/** Resets helper variables */
public void reset()
{
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/framework/UTP4.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/framework/UTP4.java 2008-01-13 19:41:37 UTC (rev 9493)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/framework/UTP4.java 2008-01-13 23:19:42 UTC (rev 9494)
@@ -40,10 +40,12 @@
public static final String NAME = "Portlet4";
- public final static JoinPoint RENDER_JOIN_POINT = new JoinPoint(UTP4.NAME, JoinPointType.PORTLET_RENDER);
+ public final static JoinPoint RENDER_JOIN_POINT = new JoinPoint(NAME, JoinPointType.PORTLET_RENDER);
- public final static JoinPoint ACTION_JOIN_POINT = new JoinPoint(UTP4.NAME, JoinPointType.PORTLET_ACTION);
+ public final static JoinPoint EVENT_JOIN_POINT = new JoinPoint(NAME, JoinPointType.PORTLET_EVENT);
+ public final static JoinPoint ACTION_JOIN_POINT = new JoinPoint(NAME, JoinPointType.PORTLET_ACTION);
+
/** Resets helper variables */
public void reset()
{
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/framework/UTP5.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/framework/UTP5.java 2008-01-13 19:41:37 UTC (rev 9493)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/framework/UTP5.java 2008-01-13 23:19:42 UTC (rev 9494)
@@ -40,10 +40,12 @@
public static final String NAME = "Portlet5";
- public final static JoinPoint RENDER_JOIN_POINT = new JoinPoint(UTP5.NAME, JoinPointType.PORTLET_RENDER);
+ public final static JoinPoint RENDER_JOIN_POINT = new JoinPoint(NAME, JoinPointType.PORTLET_RENDER);
- public final static JoinPoint ACTION_JOIN_POINT = new JoinPoint(UTP5.NAME, JoinPointType.PORTLET_ACTION);
+ public final static JoinPoint EVENT_JOIN_POINT = new JoinPoint(NAME, JoinPointType.PORTLET_EVENT);
+ public final static JoinPoint ACTION_JOIN_POINT = new JoinPoint(NAME, JoinPointType.PORTLET_ACTION);
+
/** Resets helper variables */
public void reset()
{
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/framework/UTP6.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/framework/UTP6.java 2008-01-13 19:41:37 UTC (rev 9493)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/framework/UTP6.java 2008-01-13 23:19:42 UTC (rev 9494)
@@ -40,10 +40,12 @@
public static final String NAME = "Portlet6";
- public final static JoinPoint RENDER_JOIN_POINT = new JoinPoint(UTP6.NAME, JoinPointType.PORTLET_RENDER);
+ public final static JoinPoint RENDER_JOIN_POINT = new JoinPoint(NAME, JoinPointType.PORTLET_RENDER);
- public final static JoinPoint ACTION_JOIN_POINT = new JoinPoint(UTP6.NAME, JoinPointType.PORTLET_ACTION);
+ public final static JoinPoint EVENT_JOIN_POINT = new JoinPoint(NAME, JoinPointType.PORTLET_EVENT);
+ public final static JoinPoint ACTION_JOIN_POINT = new JoinPoint(NAME, JoinPointType.PORTLET_ACTION);
+
/** Resets helper variables */
public void reset()
{
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/framework/UTP7.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/framework/UTP7.java 2008-01-13 19:41:37 UTC (rev 9493)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/framework/UTP7.java 2008-01-13 23:19:42 UTC (rev 9494)
@@ -40,10 +40,12 @@
public static final String NAME = "Portlet7";
- public final static JoinPoint RENDER_JOIN_POINT = new JoinPoint(UTP7.NAME, JoinPointType.PORTLET_RENDER);
+ public final static JoinPoint RENDER_JOIN_POINT = new JoinPoint(NAME, JoinPointType.PORTLET_RENDER);
- public final static JoinPoint ACTION_JOIN_POINT = new JoinPoint(UTP7.NAME, JoinPointType.PORTLET_ACTION);
+ public final static JoinPoint EVENT_JOIN_POINT = new JoinPoint(NAME, JoinPointType.PORTLET_EVENT);
+ public final static JoinPoint ACTION_JOIN_POINT = new JoinPoint(NAME, JoinPointType.PORTLET_ACTION);
+
/** Resets helper variables */
public void reset()
{
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/framework/UTP8.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/framework/UTP8.java 2008-01-13 19:41:37 UTC (rev 9493)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/framework/UTP8.java 2008-01-13 23:19:42 UTC (rev 9494)
@@ -40,10 +40,12 @@
public static final String NAME = "Portlet8";
- public final static JoinPoint RENDER_JOIN_POINT = new JoinPoint(UTP8.NAME, JoinPointType.PORTLET_RENDER);
+ public final static JoinPoint RENDER_JOIN_POINT = new JoinPoint(NAME, JoinPointType.PORTLET_RENDER);
- public final static JoinPoint ACTION_JOIN_POINT = new JoinPoint(UTP8.NAME, JoinPointType.PORTLET_ACTION);
+ public final static JoinPoint EVENT_JOIN_POINT = new JoinPoint(NAME, JoinPointType.PORTLET_EVENT);
+ public final static JoinPoint ACTION_JOIN_POINT = new JoinPoint(NAME, JoinPointType.PORTLET_ACTION);
+
/** Resets helper variables */
public void reset()
{
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/framework/UTP9.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/framework/UTP9.java 2008-01-13 19:41:37 UTC (rev 9493)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/framework/UTP9.java 2008-01-13 23:19:42 UTC (rev 9494)
@@ -40,10 +40,12 @@
public static final String NAME = "Portlet9";
- public final static JoinPoint RENDER_JOIN_POINT = new JoinPoint(UTP9.NAME, JoinPointType.PORTLET_RENDER);
+ public final static JoinPoint RENDER_JOIN_POINT = new JoinPoint(NAME, JoinPointType.PORTLET_RENDER);
- public final static JoinPoint ACTION_JOIN_POINT = new JoinPoint(UTP9.NAME, JoinPointType.PORTLET_ACTION);
+ public final static JoinPoint EVENT_JOIN_POINT = new JoinPoint(NAME, JoinPointType.PORTLET_EVENT);
+ public final static JoinPoint ACTION_JOIN_POINT = new JoinPoint(NAME, JoinPointType.PORTLET_ACTION);
+
/** Resets helper variables */
public void reset()
{
Added: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/event/EventTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/event/EventTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/event/EventTestCase.java 2008-01-13 23:19:42 UTC (rev 9494)
@@ -0,0 +1,85 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr286.tck.event;
+
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.unit.Assertion;
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.PortletTestContext;
+import org.jboss.portal.unit.actions.PortletRenderTestAction;
+import org.jboss.portal.unit.actions.PortletActionTestAction;
+import org.jboss.portal.unit.actions.PortletEventTestAction;
+import org.jboss.portal.test.portlet.framework.UTP5;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+
+import javax.portlet.RenderRequest;
+import javax.portlet.Portlet;
+import javax.portlet.RenderResponse;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletException;
+import javax.portlet.EventRequest;
+import javax.portlet.EventResponse;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+(a)TestCase({Assertion.JSR168_1000})
+public class EventTestCase
+{
+ public EventTestCase(PortletTestCase seq)
+ {
+ seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
+ {
+ return new InvokeGetResponse(response.createActionURL().toString());
+ }
+ });
+ seq.bindAction(1, UTP1.ACTION_JOIN_POINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ response.setEvent("Foo", null);
+ }
+ });
+ seq.bindAction(1, UTP1.EVENT_JOIN_POINT, new PortletEventTestAction()
+ {
+ protected void run(Portlet portlet, EventRequest request, EventResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ }
+ });
+ seq.bindAction(1, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
+ {
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/JoinPointType.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/JoinPointType.java 2008-01-13 19:41:37 UTC (rev 9493)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/JoinPointType.java 2008-01-13 23:19:42 UTC (rev 9494)
@@ -30,6 +30,7 @@
{
PORTLET_ACTION("portlet.action"),
+ PORTLET_EVENT("portlet.event"),
PORTLET_RENDER("portlet.render"),
SERVLET_SERVICE("servlet.service");
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/PortletTestContext.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/PortletTestContext.java 2008-01-13 19:41:37 UTC (rev 9493)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/PortletTestContext.java 2008-01-13 23:19:42 UTC (rev 9494)
@@ -78,6 +78,11 @@
responseContext = new ResponseContext(response, new HashMap<String, Serializable>());
}
+ public DriverResponse getResponse()
+ {
+ return responseContext.getResponse();
+ }
+
public int getRequestCount()
{
return requestContext.getRequestCount();
Added: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/actions/PortletEventTestAction.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/actions/PortletEventTestAction.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/actions/PortletEventTestAction.java 2008-01-13 23:19:42 UTC (rev 9494)
@@ -0,0 +1,59 @@
+/******************************************************************************
+ * 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.unit.actions;
+
+import org.jboss.portal.unit.PortletTestContext;
+import org.jboss.portal.unit.TestAction;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.FailureResponse;
+import org.jboss.unit.Failure;
+
+import javax.portlet.Portlet;
+import javax.portlet.PortletException;
+import javax.portlet.EventRequest;
+import javax.portlet.EventResponse;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw Dawidowicz</a>
+ * @version $Revision: 7954 $
+ */
+public abstract class PortletEventTestAction extends TestAction
+{
+
+ public DriverResponse execute(Portlet portlet, EventRequest request, EventResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ try
+ {
+ run(portlet, request, response, context);
+ return null;
+ }
+ catch (AssertionError t)
+ {
+ return new FailureResponse(Failure.createFailure(t));
+ }
+ }
+
+ protected abstract void run(Portlet portlet, EventRequest request, EventResponse response, PortletTestContext context) throws PortletException, IOException;
+
+}
\ No newline at end of file
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/base/AbstractUniversalTestPortlet.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/base/AbstractUniversalTestPortlet.java 2008-01-13 19:41:37 UTC (rev 9493)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/base/AbstractUniversalTestPortlet.java 2008-01-13 23:19:42 UTC (rev 9494)
@@ -27,6 +27,7 @@
import org.jboss.portal.unit.PortletTestCase;
import org.jboss.portal.unit.actions.PortletActionTestAction;
import org.jboss.portal.unit.actions.PortletRenderTestAction;
+import org.jboss.portal.unit.actions.PortletEventTestAction;
import org.jboss.portal.unit.TestAction;
import org.jboss.portal.unit.PortletTestContext;
import org.jboss.portal.test.framework.server.NodeId;
@@ -45,6 +46,9 @@
import javax.portlet.PortletSecurityException;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
+import javax.portlet.EventPortlet;
+import javax.portlet.EventRequest;
+import javax.portlet.EventResponse;
import java.io.IOException;
/**
@@ -53,7 +57,7 @@
* @author <a href="mailto:boleslaw.dawidowicz@jboss.com">Boleslaw Dawidowicz</a>
* @version $Revision: 7954 $
*/
-public abstract class AbstractUniversalTestPortlet implements Portlet
+public abstract class AbstractUniversalTestPortlet implements Portlet, EventPortlet
{
public static String getPortletName()
@@ -74,6 +78,9 @@
/** Joinpoint for render phase. */
private final JoinPoint renderJoinPoint = JoinPoint.createJoinPoint(getClass(), JoinPointType.PORTLET_RENDER);
+ /** Joinpoint for event phase. */
+ private final JoinPoint eventJoinPoint = JoinPoint.createJoinPoint(getClass(), JoinPointType.PORTLET_EVENT);
+
/** Joinpoint for action phase. */
private final JoinPoint actionJoinPoint = JoinPoint.createJoinPoint(getClass(), JoinPointType.PORTLET_ACTION);
@@ -159,6 +166,49 @@
}
}
+ public void processEvent(EventRequest req, EventResponse resp) throws PortletException, IOException
+ {
+ PortletTestContext ctx = PortletTestDriver.getPortletTestContext();
+
+ //
+ if (ctx.getResponse() == null)
+ {
+ log.debug("JoinPoint '" + eventJoinPoint + "' invoked for '"
+ + ctx.getTestName() + "' testId and '" +
+ +ctx.getRequestCount() + "' request count");
+
+ //
+ PortletTestCase portletTestCase = getSequence(ctx.getTestName());
+
+ //
+ if (portletTestCase != null)
+ {
+ //
+ TestAction action = portletTestCase.getAction(ctx.getRequestCount(), NodeId.locate(), eventJoinPoint);
+
+ //
+ if (action == null)
+ {
+ ctx.setResponse(new FailureResponse(Failure.createAssertionFailure("No action for " + ctx.getRequestCount() + " " + NodeId.locate() + " " + eventJoinPoint)));
+ }
+ else if (action instanceof PortletEventTestAction == false)
+ {
+ ctx.setResponse(new FailureResponse(Failure.createAssertionFailure("Action for " + ctx.getRequestCount() + " " + NodeId.locate() + " " + actionJoinPoint + " is not an instance of " + PortletEventTestAction.class.getName() + " but is " + action.getClass().getName())));
+ }
+ else
+ {
+ log.debug("Found action for jointpoint " + eventJoinPoint + " : " + action);
+
+ //
+ DriverResponse response = ((PortletEventTestAction)action).execute(this, req, resp, ctx);
+
+ //
+ ctx.setResponse(response);
+ }
+ }
+ }
+ }
+
/**
* Invokes current action from Sequence. If failed AssertResult was returned in previouse portlet action phase it
* will be marshalled.
@@ -184,7 +234,6 @@
reset();
}
-
// Get the action
TestAction action = null;
PortletTestCase portletTestCase = getSequence(ctx.getTestName());
@@ -200,12 +249,12 @@
log.debug("Found action for joinpoint " + renderJoinPoint + " : " + action);
// Get the result
- DriverResponse sr = ((PortletRenderTestAction)action).execute(this, req, resp, ctx);
+ DriverResponse response = ((PortletRenderTestAction)action).execute(this, req, resp, ctx);
// If we have one result it is meant to be returned to the client
- if (sr != null)
+ if (response != null)
{
- ctx.setResponse(sr);
+ ctx.setResponse(response);
}
}
else
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortalServlet.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortalServlet.java 2008-01-13 19:41:37 UTC (rev 9493)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortalServlet.java 2008-01-13 23:19:42 UTC (rev 9494)
@@ -61,12 +61,12 @@
protected void _service(HttpServletRequest req, HttpServletResponse resp) throws Exception
{
- PortletControllerContext context = new PortletControllerContextImpl(req, PortletControllerContextImpl.SESSION_SCOPE);
+ PortletControllerContextImpl context = new PortletControllerContextImpl(req, resp, getServletContext(), PortletControllerContextImpl.SESSION_SCOPE);
//
- PortletController controller = new PortletController(context, getServletContext(), req);
+ PortletController controller = new PortletController();
//
- controller.process(resp);
+ controller.process(context, context.getRequest());
}
}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletController.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletController.java 2008-01-13 19:41:37 UTC (rev 9493)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletController.java 2008-01-13 23:19:42 UTC (rev 9494)
@@ -29,16 +29,16 @@
import org.jboss.portal.portlet.PortletParameters;
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.PortletInvoker;
-import org.jboss.portal.portlet.RenderURL;
import org.jboss.portal.portlet.impl.spi.AbstractRequestContext;
import org.jboss.portal.portlet.impl.spi.AbstractUserContext;
import org.jboss.portal.portlet.impl.spi.AbstractWindowContext;
import org.jboss.portal.portlet.impl.spi.AbstractPortalContext;
import org.jboss.portal.portlet.impl.spi.AbstractSecurityContext;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
-import org.jboss.portal.portlet.invocation.response.RenderResponse;
+import org.jboss.portal.portlet.invocation.response.UpdateNavigationalStateResponse;
import org.jboss.portal.portlet.invocation.response.HTTPRedirectionResponse;
import org.jboss.portal.portlet.invocation.response.ErrorResponse;
+import org.jboss.portal.portlet.invocation.response.StateResponse;
import org.jboss.portal.portlet.invocation.ActionInvocation;
import org.jboss.portal.portlet.invocation.RenderInvocation;
import org.jboss.portal.web.IllegalRequestException;
@@ -67,173 +67,172 @@
private MarkupInfo MARKUP_INFO = new MarkupInfo(MediaType.HTML, "UTF8");
/** . */
- private final ServletContext servletContext;
-
- /** . */
- private final HttpServletRequest req;
-
- /** . */
- private final PortletInvoker invoker;
-
- /** . */
- private final PortletControllerContext context;
-
- /** . */
private final boolean redirectAfterAction = true;
- public PortletController(PortletControllerContext context, ServletContext servletContext, HttpServletRequest req) throws IllegalRequestException, UnsupportedEncodingException
+ public PortletController() throws IllegalRequestException, UnsupportedEncodingException
{
- this.context = context;
- this.servletContext = servletContext;
-
- //
- this.req = req;
- this.invoker = (PortletInvoker)servletContext.getAttribute("ConsumerPortletInvoker");
}
- public void process(HttpServletResponse resp) throws PortletInvokerException, IOException
+ private PortletInvocationResponse handle(PortletControllerContext context, Action action) throws PortletInvokerException, IOException
{
+ if (action instanceof PortletRender)
+ {
+ UpdateNavigationalStateResponse updateNavigationalState = new UpdateNavigationalStateResponse();
+ updateNavigationalState.setMode(action.mode);
+ updateNavigationalState.setWindowState(action.windowState);
+ updateNavigationalState.setNavigationalState(PortletParametersStateString.create(action.queryParameters));
+ return updateNavigationalState;
+ }
+ else
+ {
+ ServletContext servletContext = context.getServletContext();
+ PortletInvoker invoker = (PortletInvoker)servletContext.getAttribute("ConsumerPortletInvoker");
+ PortletContext target = PortletContext.createPortletContext(action.portletId);
+ Portlet portlet = invoker.getPortlet(target);
+ HttpServletRequest req = context.getClientRequest();
+ HttpServletResponse resp = context.getClientResponse();
+ PortalNavigationalState navState = context.getNavigationalState();
+ PortletURLRenderer renderer = new PortletURLRenderer(navState, portlet, req, resp);
+ WindowNavigationalState windowNS = navState.getWindow(action.portletId);
- //
- Request request = context.getRequest();
+ //
+ StateString portletNS = null;
+ if (windowNS != null)
+ {
+ portletNS = windowNS.getPortletNavigationalState();
+ }
- //
- PortalNavigationalState navState = context.getNavigationalState();
+ //
+ Mode mode = action.mode;
+ if (mode == null && windowNS != null && windowNS.getMode() != null)
+ {
+ mode = windowNS.getMode();
+ }
+ if (mode == null)
+ {
+ mode = Mode.VIEW;
+ }
- //
- if (request != null)
- {
- PortletContext target = PortletContext.createPortletContext(request.portletId);
-
//
- Portlet portlet = invoker.getPortlet(target);
+ WindowState windowState = action.windowState;
+ if (windowState == null && windowNS != null && windowNS.getWindowState() != null)
+ {
+ windowState = windowNS.getWindowState();
+ }
+ if (windowState == null)
+ {
+ windowState = WindowState.NORMAL;
+ }
//
- PortletURLRenderer renderer = new PortletURLRenderer(navState, portlet, req, resp);
+ TestInstanceContext instanceContext = new TestInstanceContext(req, portlet.getContext(), true);
+ TestActionContext actionContext = new TestActionContext(
+ renderer,
+ mode,
+ windowState,
+ portletNS,
+ MARKUP_INFO,
+ PortletParametersStateString.create(action.queryParameters),
+ action.bodyParameters != null ? new PortletParameters(action.bodyParameters) : null);
+ ActionInvocation actionInvocation = new ActionInvocation(actionContext);
//
- WindowNavigationalState windowNS = navState.getWindow(request.portletId);
+ actionInvocation.setRequestContext(new AbstractRequestContext(req, resp));
+ actionInvocation.setInstanceContext(instanceContext);
+ actionInvocation.setUserContext(new AbstractUserContext(req));
+ actionInvocation.setWindowContext(new AbstractWindowContext(portlet.getContext().getId()));
+ actionInvocation.setPortalContext(new AbstractPortalContext());
+ actionInvocation.setSecurityContext(new AbstractSecurityContext(req));
+ actionInvocation.setTarget(instanceContext.getTarget());
//
- PortletInvocationResponse response = null;
-
- if (request instanceof Render)
+ try
{
- RenderResponse render = new RenderResponse();
- render.setMode(request.mode);
- render.setWindowState(request.windowState);
- render.setNavigationalState(PortletParametersStateString.create(request.queryParameters));
- response = render;
+ return invoker.invoke(actionInvocation);
}
- else
+ catch (PortletInvokerException e)
{
- //
- StateString portletNS = null;
- if (windowNS != null)
- {
- portletNS = windowNS.getPortletNavigationalState();
- }
+ return null;
+ }
+ }
+ }
- //
- Mode mode = request.mode;
- if (mode == null && windowNS != null && windowNS.getMode() != null)
- {
- mode = windowNS.getMode();
- }
- if (mode == null)
- {
- mode = Mode.VIEW;
- }
+ public void process(PortletControllerContext context, Action action) throws PortletInvokerException, IOException
+ {
+ ServletContext servletContext = context.getServletContext();
+ PortletInvoker invoker = (PortletInvoker)servletContext.getAttribute("ConsumerPortletInvoker");
+ HttpServletRequest req = context.getClientRequest();
+ HttpServletResponse resp = context.getClientResponse();
+ PortalNavigationalState navState = context.getNavigationalState();
- //
- WindowState windowState = request.windowState;
- if (windowState == null && windowNS != null && windowNS.getWindowState() != null)
- {
- windowState = windowNS.getWindowState();
- }
- if (windowState == null)
- {
- windowState = WindowState.NORMAL;
- }
+ //
+ if (action != null)
+ {
+ PortletInvocationResponse response = handle(context, action);
- //
- TestInstanceContext instanceContext = new TestInstanceContext(req, portlet.getContext(), true);
- TestActionContext actionContext = new TestActionContext(
- renderer,
- mode,
- windowState,
- portletNS,
- MARKUP_INFO,
- PortletParametersStateString.create(request.queryParameters),
- request.bodyParameters != null ? new PortletParameters(request.bodyParameters) : null);
- ActionInvocation action = new ActionInvocation(actionContext);
+ //
+ if (response instanceof StateResponse)
+ {
+ StateResponse stateResponse = (StateResponse)response;
- //
- action.setRequestContext(new AbstractRequestContext(req, resp));
- action.setInstanceContext(instanceContext);
- action.setUserContext(new AbstractUserContext(req));
- action.setWindowContext(new AbstractWindowContext(portlet.getContext().getId()));
- action.setPortalContext(new AbstractPortalContext());
- action.setSecurityContext(new AbstractSecurityContext(req));
- action.setTarget(instanceContext.getTarget());
+
//
- try
+ for (StateResponse.Event event : stateResponse.getEvents())
{
- response = invoker.invoke(action);
+
}
- catch (PortletInvokerException e)
- {
- e.printStackTrace();
- }
+ }
- //
- if (response instanceof RenderResponse && redirectAfterAction)
+/*
+ if (response instanceof RenderResponse && redirectAfterAction)
+ {
+ PortletURLRenderer renderer = new PortletURLRenderer(navState, portlet, req, resp);
+ final RenderResponse render = (RenderResponse)response;
+ String location = renderer.renderURL(new RenderURL()
{
- final RenderResponse render = (RenderResponse)response;
- String location = renderer.renderURL(new RenderURL()
+ public StateString getNavigationalState()
{
- public StateString getNavigationalState()
- {
- return render.getNavigationalState();
- }
- public Mode getMode()
- {
- return render.getMode();
- }
- public WindowState getWindowState()
- {
- return render.getWindowState();
- }
- }, null, null, true);
- response = new HTTPRedirectionResponse(location);
- }
+ return render.getNavigationalState();
+ }
+ public Mode getMode()
+ {
+ return render.getMode();
+ }
+ public WindowState getWindowState()
+ {
+ return render.getWindowState();
+ }
+ }, null, null, true);
+ response = new HTTPRedirectionResponse(location);
}
+*/
//
- if (response instanceof RenderResponse)
+ if (response instanceof UpdateNavigationalStateResponse)
{
- RenderResponse render = (RenderResponse)response;
+ UpdateNavigationalStateResponse updateNavigationalState = (UpdateNavigationalStateResponse)response;
+ WindowNavigationalState windowNS = navState.getWindow(action.portletId);
//
if (windowNS == null)
{
windowNS = new WindowNavigationalState();
- navState.setWindow(portlet.getContext().getId(), windowNS);
+ navState.setWindow(action.portletId, windowNS);
}
//
- if (render.getMode() != null)
+ if (updateNavigationalState.getMode() != null)
{
- windowNS.setMode(render.getMode());
+ windowNS.setMode(updateNavigationalState.getMode());
}
- if (render.getWindowState() != null)
+ if (updateNavigationalState.getWindowState() != null)
{
- windowNS.setWindowState(render.getWindowState());
+ windowNS.setWindowState(updateNavigationalState.getWindowState());
}
- if (render.getNavigationalState() != null)
+ if (updateNavigationalState.getNavigationalState() != null)
{
- windowNS.setPortletNavigationalState(render.getNavigationalState());
+ windowNS.setPortletNavigationalState(updateNavigationalState.getNavigationalState());
}
}
else if (response instanceof HTTPRedirectionResponse)
@@ -332,16 +331,30 @@
writer.print("</body></html>");
}
- static class Request
+ static class Action
{
+ /** . */
final String portletId;
+
+ /** . */
final ParameterMap queryParameters;
+
+ /** . */
final ParameterMap bodyParameters;
+
+ /** . */
final Mode mode;
+
+ /** . */
final WindowState windowState;
- public Request(String portletId, ParameterMap queryParameters, ParameterMap bodyParameters, Mode mode, WindowState windowState)
+ public Action(
+ String portletId,
+ ParameterMap queryParameters,
+ ParameterMap bodyParameters,
+ Mode mode,
+ WindowState windowState)
{
this.portletId = portletId;
this.queryParameters = queryParameters;
@@ -351,17 +364,27 @@
}
}
- static class Action extends Request
+ static class PortletAction extends Action
{
- public Action(String portletId, ParameterMap queryParameters, ParameterMap bodyParameters, Mode mode, WindowState windowState)
+ public PortletAction(
+ String portletId,
+ ParameterMap queryParameters,
+ ParameterMap bodyParameters,
+ Mode mode,
+ WindowState windowState)
{
super(portletId, queryParameters, bodyParameters, mode, windowState);
}
}
- static class Render extends Request
+ static class PortletRender extends Action
{
- public Render(String portletId, ParameterMap queryParameters, ParameterMap bodyParameters, Mode mode, WindowState windowState)
+ public PortletRender(
+ String portletId,
+ ParameterMap queryParameters,
+ ParameterMap bodyParameters,
+ Mode mode,
+ WindowState windowState)
{
super(portletId, queryParameters, bodyParameters, mode, windowState);
}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletControllerContext.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletControllerContext.java 2008-01-13 19:41:37 UTC (rev 9493)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletControllerContext.java 2008-01-13 23:19:42 UTC (rev 9494)
@@ -22,6 +22,10 @@
******************************************************************************/
package org.jboss.portal.portlet.test;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.ServletContext;
+
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
@@ -31,6 +35,10 @@
PortalNavigationalState getNavigationalState();
- PortletController.Request getRequest();
+ ServletContext getServletContext();
+ HttpServletRequest getClientRequest();
+
+ HttpServletResponse getClientResponse();
+
}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletControllerContextImpl.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletControllerContextImpl.java 2008-01-13 19:41:37 UTC (rev 9493)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletControllerContextImpl.java 2008-01-13 23:19:42 UTC (rev 9494)
@@ -32,6 +32,8 @@
import org.jboss.portal.WindowState;
import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.ServletContext;
import java.io.IOException;
/**
@@ -48,20 +50,32 @@
public static final int SESSION_SCOPE = 1;
/** . */
+ private final HttpServletRequest req;
+
+ /** . */
+ private final HttpServletResponse resp;
+
+ /** . */
+ private final ServletContext servletContext;
+
+ /** . */
private final PortalNavigationalState navState;
/** . */
- private final PortletController.Request request;
+ private final PortletController.Action action;
- public PortletControllerContextImpl(HttpServletRequest req, int navStateScope)
+ public PortletControllerContextImpl(
+ HttpServletRequest req,
+ HttpServletResponse resp,
+ ServletContext servletContext,
+ int navStateScope)
throws IllegalRequestException, IOException, ClassNotFoundException
{
-
if (navStateScope < NAV_SCOPE || navStateScope > SESSION_SCOPE)
{
throw new IllegalArgumentException();
}
-
+
//
String pathInfo = req.getPathInfo();
String targetId;
@@ -107,7 +121,7 @@
}
//
- PortletController.Request request;
+ PortletController.Action action;
String type = metaParameters.getValue("type");
//
@@ -119,21 +133,27 @@
if ("action".equals(type))
{
- request = new PortletController.Action(targetId, actualParameters, formParameters, mode, windowState);
+ action = new PortletController.PortletAction(targetId, actualParameters, formParameters, mode, windowState);
}
else
{
- request = new PortletController.Render(targetId, actualParameters, formParameters, mode, windowState);
+ action = new PortletController.PortletRender(targetId, actualParameters, formParameters, mode, windowState);
}
//
this.navState = navState;
- this.request = request;
+ this.action = action;
+ this.req = req;
+ this.resp = resp;
+ this.servletContext = servletContext;
}
else
{
this.navState = new PortalNavigationalState();
- this.request = null;
+ this.action = null;
+ this.req = req;
+ this.resp = resp;
+ this.servletContext = servletContext;
//
if (navStateScope == SESSION_SCOPE)
@@ -143,13 +163,28 @@
}
}
- public PortletController.Request getRequest()
+ public PortletController.Action getRequest()
{
- return request;
+ return action;
}
public PortalNavigationalState getNavigationalState()
{
return navState;
}
+
+ public ServletContext getServletContext()
+ {
+ return servletContext;
+ }
+
+ public HttpServletRequest getClientRequest()
+ {
+ return req;
+ }
+
+ public HttpServletResponse getClientResponse()
+ {
+ return resp;
+ }
}
Modified: modules/portlet/trunk/test/src/test/build.xml
===================================================================
--- modules/portlet/trunk/test/src/test/build.xml 2008-01-13 19:41:37 UTC (rev 9493)
+++ modules/portlet/trunk/test/src/test/build.xml 2008-01-13 23:19:42 UTC (rev 9494)
@@ -220,6 +220,7 @@
<package-jsr286-tck-test test="portletconfig"/>
<package-jsr286-tck-test test="portletconfignonamespace"/>
+ <package-jsr286-tck-test test="event"/>
<jar jarfile="${test.temp.lib}/portlet-test-lib.jar">
<fileset dir="${target}/test-classes"/>
Added: modules/portlet/trunk/test/src/test/resources/jsr286/tck/event-war/WEB-INF/portlet.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/jsr286/tck/event-war/WEB-INF/portlet.xml (rev 0)
+++ modules/portlet/trunk/test/src/test/resources/jsr286/tck/event-war/WEB-INF/portlet.xml 2008-01-13 23:19:42 UTC (rev 9494)
@@ -0,0 +1,38 @@
+<?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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ version="2.0">
+
+ <portlet>
+ <portlet-name>UniversalTestPortletA</portlet-name>
+ <portlet-class>org.jboss.portal.test.portlet.framework.UTP1</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ </portlet>
+
+</portlet-app>
Added: modules/portlet/trunk/test/src/test/resources/jsr286/tck/event-war/WEB-INF/web.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/jsr286/tck/event-war/WEB-INF/web.xml (rev 0)
+++ modules/portlet/trunk/test/src/test/resources/jsr286/tck/event-war/WEB-INF/web.xml 2008-01-13 23:19:42 UTC (rev 9494)
@@ -0,0 +1,32 @@
+<?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>
+ <listener>
+ <listener-class>org.jboss.portal.unit.PortletTestSuite</listener-class>
+ </listener>
+</web-app>
Modified: modules/portlet/trunk/test/src/test/resources/test/remote-jboss-unit.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/test/remote-jboss-unit.xml 2008-01-13 19:41:37 UTC (rev 9493)
+++ modules/portlet/trunk/test/src/test/resources/test/remote-jboss-unit.xml 2008-01-13 23:19:42 UTC (rev 9494)
@@ -155,6 +155,10 @@
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr286-tck-portletconfignonamespace.war"/>
</generic>
+ <generic>
+ <class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
+ <property name="archiveId" value="test-jsr286-tck-event.war"/>
+ </generic>
<!--Misc Tests-->
<!--
18 years, 3 months
JBoss Portal SVN: r9493 - in modules/portlet/trunk: portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api and 5 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-01-13 14:41:37 -0500 (Sun, 13 Jan 2008)
New Revision: 9493
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/EventImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/EventRequestImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/EventResponseImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/EventInvocation.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/StateResponse.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/EventContext.java
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletAPIFactoryImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletContainerImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/StateAwareResponseImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/spi/PortletAPIFactory.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/FragmentResponse.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/HTTPRedirectionResponse.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/RedirectionResponse.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/RenderResponse.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/UnavailableResponse.java
modules/portlet/trunk/test/src/test/resources/test/remote-jboss-unit.xml
Log:
base class and API implementation prototype for 286 eventing
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletAPIFactoryImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletAPIFactoryImpl.java 2008-01-13 18:15:59 UTC (rev 9492)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletAPIFactoryImpl.java 2008-01-13 19:41:37 UTC (rev 9493)
@@ -24,10 +24,13 @@
import org.jboss.portal.portlet.invocation.ActionInvocation;
import org.jboss.portal.portlet.invocation.RenderInvocation;
+import org.jboss.portal.portlet.invocation.EventInvocation;
import org.jboss.portal.portlet.impl.jsr168.api.ActionResponseImpl;
import org.jboss.portal.portlet.impl.jsr168.api.ActionRequestImpl;
import org.jboss.portal.portlet.impl.jsr168.api.RenderRequestImpl;
import org.jboss.portal.portlet.impl.jsr168.api.RenderResponseImpl;
+import org.jboss.portal.portlet.impl.jsr168.api.EventRequestImpl;
+import org.jboss.portal.portlet.impl.jsr168.api.EventResponseImpl;
import org.jboss.portal.portlet.impl.jsr168.spi.PortletAPIFactory;
/**
@@ -46,6 +49,16 @@
return new ActionResponseImpl(invocation, actionRequest);
}
+ public EventRequestImpl createEventRequest(EventInvocation invocation)
+ {
+ return new EventRequestImpl(invocation);
+ }
+
+ public EventResponseImpl createEventResponse(EventInvocation invocation, EventRequestImpl eventRequest)
+ {
+ return new EventResponseImpl(invocation, eventRequest);
+ }
+
public RenderRequestImpl createRenderRequest(RenderInvocation invocation)
{
return new RenderRequestImpl(invocation);
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletContainerImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletContainerImpl.java 2008-01-13 18:15:59 UTC (rev 9492)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletContainerImpl.java 2008-01-13 19:41:37 UTC (rev 9493)
@@ -26,7 +26,6 @@
import org.jboss.portal.common.i18n.ResourceBundleManager;
import org.jboss.portal.common.invocation.InvocationException;
import org.jboss.portal.portlet.PortletInvokerException;
-import org.jboss.portal.portlet.info.PortletInfo;
import org.jboss.portal.portlet.aspects.portlet.ContextDispatcherInterceptor;
import org.jboss.portal.portlet.container.PortletApplication;
import org.jboss.portal.portlet.container.PortletContainer;
@@ -36,12 +35,15 @@
import org.jboss.portal.portlet.impl.jsr168.api.PortletConfigImpl;
import org.jboss.portal.portlet.impl.jsr168.api.RenderRequestImpl;
import org.jboss.portal.portlet.impl.jsr168.api.RenderResponseImpl;
+import org.jboss.portal.portlet.impl.jsr168.api.EventRequestImpl;
+import org.jboss.portal.portlet.impl.jsr168.api.EventResponseImpl;
import org.jboss.portal.portlet.impl.jsr168.spi.PortletAPIFactory;
import org.jboss.portal.portlet.impl.info.ContainerPortletInfo;
import org.jboss.portal.portlet.impl.info.ContainerPreferencesInfo;
import org.jboss.portal.portlet.invocation.ActionInvocation;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.RenderInvocation;
+import org.jboss.portal.portlet.invocation.EventInvocation;
import org.jboss.portal.portlet.invocation.response.ErrorResponse;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.invocation.response.SecurityErrorResponse;
@@ -54,6 +56,7 @@
import javax.portlet.PortletSecurityException;
import javax.portlet.PreferencesValidator;
import javax.portlet.UnavailableException;
+import javax.portlet.EventPortlet;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.Set;
@@ -413,7 +416,7 @@
dreq.removeAttribute(ContextDispatcherInterceptor.REQ_ATT_COMPONENT_INVOCATION);
}
- return aresp.getResult();
+ return aresp.getResponse();
}
protected PortletInvocationResponse invokeRender(RenderInvocation invocation) throws IOException, PortletException
@@ -439,4 +442,32 @@
}
return rresp.getResult();
}
+
+ protected PortletInvocationResponse invokeEvent(EventInvocation invocation) throws IOException, PortletException
+ {
+ // Todo something clever
+ EventPortlet eventPortlet = (EventPortlet)portlet;
+
+ //
+ PortletAPIFactory factory = application.getPortletAPIFactory();
+ EventRequestImpl ereq = factory.createEventRequest(invocation);
+ EventResponseImpl eresp = factory.createEventResponse(invocation, ereq);
+ HttpServletRequest dreq = invocation.getDispatchedRequest();
+ try
+ {
+ dreq.setAttribute(APIConstants.JAVAX_PORTLET_CONFIG, config);
+ dreq.setAttribute(APIConstants.JAVAX_PORTLET_REQUEST, ereq);
+ dreq.setAttribute(APIConstants.JAVAX_PORTLET_RESPONSE, eresp);
+ dreq.setAttribute(ContextDispatcherInterceptor.REQ_ATT_COMPONENT_INVOCATION, invocation);
+ eventPortlet.processEvent(ereq, eresp);
+ }
+ finally
+ {
+ dreq.removeAttribute(APIConstants.JAVAX_PORTLET_CONFIG);
+ dreq.removeAttribute(APIConstants.JAVAX_PORTLET_REQUEST);
+ dreq.removeAttribute(APIConstants.JAVAX_PORTLET_RESPONSE);
+ dreq.removeAttribute(ContextDispatcherInterceptor.REQ_ATT_COMPONENT_INVOCATION);
+ }
+ return eresp.getResponse();
+ }
}
Added: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/EventImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/EventImpl.java (rev 0)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/EventImpl.java 2008-01-13 19:41:37 UTC (rev 9493)
@@ -0,0 +1,60 @@
+/******************************************************************************
+ * 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.portlet.impl.jsr168.api;
+
+import org.jboss.portal.portlet.spi.EventContext;
+
+import javax.portlet.Event;
+import javax.xml.namespace.QName;
+import java.io.Serializable;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class EventImpl implements Event
+{
+
+ /** . */
+ private final EventContext context;
+
+ public EventImpl(EventContext context)
+ {
+ this.context = context;
+ }
+
+ public QName getQName()
+ {
+ return context.getName();
+ }
+
+ public String getName()
+ {
+ return context.getName().getLocalPart();
+ }
+
+ public Serializable getValue()
+ {
+ return context.getPayload();
+ }
+}
Added: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/EventRequestImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/EventRequestImpl.java (rev 0)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/EventRequestImpl.java 2008-01-13 19:41:37 UTC (rev 9493)
@@ -0,0 +1,62 @@
+/******************************************************************************
+ * 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.portlet.impl.jsr168.api;
+
+import org.jboss.portal.portlet.invocation.EventInvocation;
+import org.jboss.portal.portlet.spi.EventContext;
+
+import javax.portlet.EventRequest;
+import javax.portlet.Event;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class EventRequestImpl extends PortletRequestImpl implements EventRequest
+{
+
+ /** . */
+ private EventImpl event;
+
+ public EventRequestImpl(EventInvocation invocation)
+ {
+ super(invocation);
+ }
+
+ public Event getEvent()
+ {
+ if (event == null)
+ {
+ event = new EventImpl((EventContext)invocation.getPortletContext());
+ }
+
+ //
+ return event;
+ }
+
+ public String getMethod()
+ {
+ // Does it make sense in the remote case ?
+ return invocation.getDispatchedRequest().getMethod();
+ }
+}
Added: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/EventResponseImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/EventResponseImpl.java (rev 0)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/EventResponseImpl.java 2008-01-13 19:41:37 UTC (rev 9493)
@@ -0,0 +1,62 @@
+/******************************************************************************
+ * 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.portlet.impl.jsr168.api;
+
+import org.jboss.portal.portlet.invocation.EventInvocation;
+import org.jboss.portal.portlet.invocation.response.RenderResponse;
+import org.jboss.portal.portlet.spi.PortletInvocationContext;
+
+import javax.portlet.EventResponse;
+import javax.portlet.EventRequest;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class EventResponseImpl extends StateAwareResponseImpl implements EventResponse
+{
+ public EventResponseImpl(EventInvocation invocation, PortletRequestImpl preq)
+ {
+ super(invocation, preq);
+ }
+
+ public void setRenderParameters(EventRequest eventRequest)
+ {
+ if (eventRequest == null)
+ {
+ // Do something ???
+ }
+ if (eventRequest != preq)
+ {
+ // Do something ???
+ }
+
+ //
+ PortletInvocationContext context = invocation.getPortletContext();
+
+ //
+ ((RenderResponse)response).setMode(context.getMode());
+ ((RenderResponse)response).setWindowState(context.getWindowState());
+ ((RenderResponse)response).setNavigationalState(context.getNavigationalState());
+ }
+}
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/StateAwareResponseImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/StateAwareResponseImpl.java 2008-01-13 18:15:59 UTC (rev 9492)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/StateAwareResponseImpl.java 2008-01-13 19:41:37 UTC (rev 9493)
@@ -23,11 +23,16 @@
package org.jboss.portal.portlet.impl.jsr168.api;
import org.jboss.portal.portlet.invocation.PortletInvocation;
-import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.invocation.response.RenderResponse;
import org.jboss.portal.portlet.invocation.response.RedirectionResponse;
+import org.jboss.portal.portlet.invocation.response.StateResponse;
import org.jboss.portal.portlet.PortletParametersStateString;
import org.jboss.portal.portlet.impl.jsr168.PortletUtils;
+import org.jboss.portal.portlet.impl.jsr168.PortletApplicationImpl;
+import org.jboss.portal.portlet.impl.info.ContainerEventsInfo;
+import org.jboss.portal.portlet.impl.info.ContainerPortletApplicationInfo;
+import org.jboss.portal.portlet.impl.info.ContainerTypeInfo;
+import org.jboss.portal.portlet.impl.info.ContainerEventInfo;
import org.jboss.portal.Mode;
import org.jboss.portal.common.NotYetImplemented;
import org.apache.log4j.Logger;
@@ -38,6 +43,7 @@
import javax.portlet.PortletMode;
import javax.portlet.PortletModeException;
import javax.xml.namespace.QName;
+import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
import java.util.Map;
@@ -48,13 +54,22 @@
public abstract class StateAwareResponseImpl extends PortletResponseImpl implements StateAwareResponse
{
+ /** . */
private static final Logger log = Logger.getLogger(ActionResponseImpl.class);
+ /** . */
protected static final int WANT_NOTHING = 0;
+
+ /** . */
protected static final int WANT_RENDER = 1;
+
+ /** . */
protected static final int WANT_REDIRECT = 2;
- protected PortletInvocationResponse response;
+ /** . */
+ protected StateResponse response;
+
+ /** . */
protected int decision;
public StateAwareResponseImpl(PortletInvocation invocation, PortletRequestImpl preq)
@@ -70,7 +85,7 @@
this.decision = WANT_NOTHING;
}
- public PortletInvocationResponse getResult()
+ public StateResponse getResponse()
{
return response;
}
@@ -188,14 +203,67 @@
}
}
- public void setEvent(QName qName, Serializable serializable)
+ public void setEvent(QName name, Serializable value)
{
- throw new NotYetImplemented();
+ if (name == null)
+ {
+ throw new IllegalArgumentException("The portlet must specify a name when producing an event");
+ }
+
+ //
+ if (value != null)
+ {
+ Class<? extends Serializable> valueType = value.getClass();
+
+ // Check jaxb annotation
+ XmlRootElement annotation = valueType.getAnnotation(XmlRootElement.class);
+ if (annotation == null)
+ {
+ throw new IllegalArgumentException("The provided event value type " + value.getClass().getName() +
+ " does not have a valid jaxb annotation");
+ }
+
+ //
+ ContainerEventsInfo eventsInfo = preq.container.getInfo().getEvents();
+
+ // Check type
+ for (ContainerEventInfo eventInfo : eventsInfo.getProducedEvents())
+ {
+ if (eventInfo.getName().equals(name))
+ {
+ ContainerTypeInfo typeInfo = eventInfo.getType();
+
+ //
+ if (typeInfo != null)
+ {
+ Class expectedType = typeInfo.getType();
+
+ //
+ if (!expectedType.isInstance(value))
+ {
+ throw new IllegalArgumentException("The provided event value type " + valueType.getName() +
+ " does not match the declared event type " + expectedType.getName());
+ }
+ }
+ }
+ }
+ }
+
+ //
+ response.addEvent(new StateResponse.Event(name, value));
}
- public void setEvent(String s, Serializable serializable)
+ public void setEvent(String localName, Serializable value)
{
- throw new NotYetImplemented();
+ if (localName == null)
+ {
+ throw new IllegalArgumentException("The portlet must specify a local name when producing an event");
+ }
+
+ //
+ ContainerPortletApplicationInfo info = ((PortletApplicationImpl)preq.container.getApplication()).getInfo();
+ QName name = new QName(info.getDefaultNamespace(), localName);
+ setEvent(name, value);
}
public Map<String, String[]> getRenderParameterMap()
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/spi/PortletAPIFactory.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/spi/PortletAPIFactory.java 2008-01-13 18:15:59 UTC (rev 9492)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/spi/PortletAPIFactory.java 2008-01-13 19:41:37 UTC (rev 9493)
@@ -24,10 +24,13 @@
import org.jboss.portal.portlet.invocation.ActionInvocation;
import org.jboss.portal.portlet.invocation.RenderInvocation;
+import org.jboss.portal.portlet.invocation.EventInvocation;
import org.jboss.portal.portlet.impl.jsr168.api.RenderRequestImpl;
import org.jboss.portal.portlet.impl.jsr168.api.ActionRequestImpl;
import org.jboss.portal.portlet.impl.jsr168.api.ActionResponseImpl;
import org.jboss.portal.portlet.impl.jsr168.api.RenderResponseImpl;
+import org.jboss.portal.portlet.impl.jsr168.api.EventRequestImpl;
+import org.jboss.portal.portlet.impl.jsr168.api.EventResponseImpl;
/**
* Factory for portlet API implementation.
@@ -47,6 +50,14 @@
/**
*/
+ EventRequestImpl createEventRequest(EventInvocation invocation);
+
+ /**
+ */
+ EventResponseImpl createEventResponse(EventInvocation invocation, EventRequestImpl eventRequest);
+
+ /**
+ */
RenderRequestImpl createRenderRequest(RenderInvocation invocation);
/**
Added: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/EventInvocation.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/EventInvocation.java (rev 0)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/EventInvocation.java 2008-01-13 19:41:37 UTC (rev 9493)
@@ -0,0 +1,37 @@
+/******************************************************************************
+ * 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.portlet.invocation;
+
+import org.jboss.portal.portlet.spi.EventContext;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class EventInvocation extends PortletInvocation
+{
+ public EventInvocation(EventContext ctx) throws IllegalArgumentException
+ {
+ super(ctx);
+ }
+}
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/FragmentResponse.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/FragmentResponse.java 2008-01-13 18:15:59 UTC (rev 9492)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/FragmentResponse.java 2008-01-13 19:41:37 UTC (rev 9493)
@@ -35,11 +35,16 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 5602 $
*/
-public class FragmentResponse extends PortletInvocationResponse
+public class FragmentResponse extends StateResponse
{
+ /** . */
public static final int TYPE_EMPTY = 0;
+
+ /** . */
public static final int TYPE_CHARS = 1;
+
+ /** . */
public static final int TYPE_BYTES = 2;
/** Any content that should appear in the header. */
@@ -173,7 +178,12 @@
this.contentType = contentType;
}
- /** @throws IllegalStateException if the output stream is already used or if no content type is defined */
+ /**
+ * Returns the writer.
+ *
+ * @return the writer
+ * @throws IllegalStateException if the output stream is already used or if no content type is defined
+ */
public PrintWriter getWriter() throws IllegalStateException
{
if (bytes != null)
@@ -193,10 +203,10 @@
}
/**
- * @throws IOException
+ * @return the output stream
* @throws IllegalStateException if the window writer is already used or if no content type is defined
*/
- public OutputStream getOutputStream() throws IOException, IllegalStateException
+ public OutputStream getOutputStream() throws IllegalStateException
{
if (chars != null)
{
@@ -387,6 +397,8 @@
/**
* Return the content as a string.
+ *
+ * @return the content
*/
public String getContent()
{
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/HTTPRedirectionResponse.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/HTTPRedirectionResponse.java 2008-01-13 18:15:59 UTC (rev 9492)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/HTTPRedirectionResponse.java 2008-01-13 19:41:37 UTC (rev 9493)
@@ -31,7 +31,8 @@
public class HTTPRedirectionResponse extends RedirectionResponse
{
- protected String location;
+ /** . */
+ protected final String location;
public HTTPRedirectionResponse(String location)
{
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/RedirectionResponse.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/RedirectionResponse.java 2008-01-13 18:15:59 UTC (rev 9492)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/RedirectionResponse.java 2008-01-13 19:41:37 UTC (rev 9493)
@@ -28,6 +28,6 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 5448 $
*/
-public class RedirectionResponse extends PortletInvocationResponse
+public abstract class RedirectionResponse extends StateResponse
{
}
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/RenderResponse.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/RenderResponse.java 2008-01-13 18:15:59 UTC (rev 9492)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/RenderResponse.java 2008-01-13 19:41:37 UTC (rev 9493)
@@ -29,10 +29,12 @@
/**
* Want to be rendered.
*
+ * @todo rename to UpdateNavigationalStateResponse
+ *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 5477 $
*/
-public class RenderResponse extends PortletInvocationResponse
+public class RenderResponse extends StateResponse
{
/** The navigational state returned. */
Added: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/StateResponse.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/StateResponse.java (rev 0)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/StateResponse.java 2008-01-13 19:41:37 UTC (rev 9493)
@@ -0,0 +1,94 @@
+/******************************************************************************
+ * 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.portlet.invocation.response;
+
+import javax.xml.namespace.QName;
+import java.util.ArrayList;
+import java.util.List;
+import java.io.Serializable;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class StateResponse extends PortletInvocationResponse
+{
+
+ /** . */
+ private ArrayList<Event> producedEvents;
+
+ public void addEvent(Event event)
+ {
+ if (event == null)
+ {
+ throw new IllegalArgumentException("No null event accepted");
+ }
+
+ //
+ if (producedEvents == null)
+ {
+ producedEvents = new ArrayList<Event>();
+ }
+
+ //
+ producedEvents.add(event);
+ }
+
+ public List<Event> getEvents()
+ {
+ return producedEvents;
+ }
+
+ /**
+ * An event produced by a state response.
+ */
+ public static class Event
+ {
+
+ /** The optional event. */
+ private QName name;
+
+ /** The optional event payload. */
+ private Serializable payload;
+
+ public Event(QName name, Serializable payload)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ this.name = name;
+ this.payload = payload;
+ }
+
+ public QName getName()
+ {
+ return name;
+ }
+
+ public Serializable getPayload()
+ {
+ return payload;
+ }
+ }
+}
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/UnavailableResponse.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/UnavailableResponse.java 2008-01-13 18:15:59 UTC (rev 9492)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/UnavailableResponse.java 2008-01-13 19:41:37 UTC (rev 9493)
@@ -31,9 +31,12 @@
public class UnavailableResponse extends PortletInvocationResponse
{
- private boolean permanent;
- private int seconds;
+ /** . */
+ private final boolean permanent;
+ /** . */
+ private final int seconds;
+
public UnavailableResponse()
{
this.seconds = 0;
Added: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/EventContext.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/EventContext.java (rev 0)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/EventContext.java 2008-01-13 19:41:37 UTC (rev 9493)
@@ -0,0 +1,39 @@
+/******************************************************************************
+ * 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.portlet.spi;
+
+import javax.xml.namespace.QName;
+import java.io.Serializable;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public interface EventContext extends PortletInvocationContext
+{
+
+ QName getName();
+
+ Serializable getPayload();
+
+}
Modified: modules/portlet/trunk/test/src/test/resources/test/remote-jboss-unit.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/test/remote-jboss-unit.xml 2008-01-13 18:15:59 UTC (rev 9492)
+++ modules/portlet/trunk/test/src/test/resources/test/remote-jboss-unit.xml 2008-01-13 19:41:37 UTC (rev 9493)
@@ -5,7 +5,6 @@
xsi:schemaLocation="urn:jboss:jboss-unit:1.0 jboss-unit_1_0.xsd">
<!--Spec TCK Assertions tests-->
-<!--
<generic>
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr168-tck-dispatcher.war"/>
@@ -50,10 +49,8 @@
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr168-tck-windowstates.war"/>
</generic>
--->
<!--API Tests-->
-<!--
<generic>
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr168-api-actionrequest.war"/>
@@ -106,10 +103,8 @@
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr168-api-windowstate.war"/>
</generic>
--->
<!--Ext Tests-->
-<!--
<generic>
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr168-ext-dispatcher.war"/>
@@ -150,7 +145,6 @@
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr168-ext-nocache.war"/>
</generic>
--->
<!--Spec TCK Assertions tests-->
<generic>
18 years, 3 months
JBoss Portal SVN: r9492 - in modules/portlet/trunk: portlet/src/main/java/org/jboss/portal/portlet/impl/metadata/adapter and 3 other directories.
by portal-commits@lists.jboss.org
Author: emuckenhuber
Date: 2008-01-13 13:15:59 -0500 (Sun, 13 Jan 2008)
New Revision: 9492
Removed:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/metadata/adapter/LocaleAdapter.java
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/metadata/portlet/SupportedLocaleMetaData.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/metadata/factory/PortletApplicationModelFactory.java
modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/metadata/PortletTestEverythingTestCase.java
Log:
- removed LocaleAdapter
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java 2008-01-13 16:20:32 UTC (rev 9491)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java 2008-01-13 18:15:59 UTC (rev 9492)
@@ -38,8 +38,10 @@
import org.jboss.portal.portlet.impl.metadata.PortletApplication10MetaData;
import org.jboss.portal.portlet.impl.metadata.PortletApplication20MetaData;
import org.jboss.portal.portlet.info.MetaInfo;
+import org.jboss.portal.common.util.ConversionException;
import org.jboss.portal.common.value.Value;
import org.jboss.portal.common.value.StringValue;
+import org.jboss.portal.common.i18n.LocaleFormat;
import org.jboss.portal.common.i18n.LocalizedString;
import org.jboss.portal.common.i18n.ResourceBundleManager;
import org.jboss.portal.common.reflect.NoSuchClassException;
@@ -218,8 +220,18 @@
List<Locale> locales = new ArrayList<Locale>();
for (SupportedLocaleMetaData supportedLocaleMD : portletMD.getSupportedLocale())
{
- Locale locale = supportedLocaleMD.getLocale();
- locales.add(locale);
+ Locale locale;
+ try
+ {
+ locale = LocaleFormat.DEFAULT.getLocale(supportedLocaleMD.getLocale());
+ locales.add(locale);
+ }
+ catch (ConversionException e)
+ {
+ // FIXME -- basic for now
+ log.error("Could not convert supported locale (" + supportedLocaleMD.getLocale() + ") for portlet: " + portletMD.getPortletName(), e);
+ }
+
}
return locales;
}
@@ -450,7 +462,15 @@
//
for (SupportedLocaleMetaData supportedLocaleMD : portletMD.getSupportedLocale())
{
- capabilities.addLocale(supportedLocaleMD.getLocale());
+ try
+ {
+ capabilities.addLocale(LocaleFormat.DEFAULT.getLocale(supportedLocaleMD.getLocale()));
+ }
+ catch (ConversionException e)
+ {
+ // FIXME -- basic for now
+ log.error("Could not convert supported locale (" + supportedLocaleMD.getLocale() + ") for portlet: " + portletMD.getPortletName(), e);
+ }
}
//
Deleted: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/metadata/adapter/LocaleAdapter.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/metadata/adapter/LocaleAdapter.java 2008-01-13 16:20:32 UTC (rev 9491)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/metadata/adapter/LocaleAdapter.java 2008-01-13 18:15:59 UTC (rev 9492)
@@ -1,51 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.portlet.impl.metadata.adapter;
-
-import org.jboss.portal.common.i18n.LocaleFormat;
-
-import java.util.Locale;
-
-import javax.xml.bind.annotation.adapters.XmlAdapter;
-
-/**
- * @author <a href="mailto:emuckenh@redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class LocaleAdapter extends XmlAdapter<String, Locale>
-{
-
- @Override
- public String marshal(Locale arg0) throws Exception
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public Locale unmarshal(String arg0) throws Exception
- {
- return LocaleFormat.DEFAULT.getLocale(arg0);
- }
-
-}
-
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/metadata/portlet/SupportedLocaleMetaData.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/metadata/portlet/SupportedLocaleMetaData.java 2008-01-13 16:20:32 UTC (rev 9491)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/metadata/portlet/SupportedLocaleMetaData.java 2008-01-13 18:15:59 UTC (rev 9492)
@@ -22,14 +22,9 @@
******************************************************************************/
package org.jboss.portal.portlet.impl.metadata.portlet;
-import java.util.Locale;
-
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlValue;
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-import org.jboss.portal.portlet.impl.metadata.adapter.LocaleAdapter;
-
/**
* @author <a href="mailto:emuckenh@redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
@@ -39,16 +34,15 @@
{
/** The supported locale */
- private Locale locale;
+ private String locale;
@XmlValue
- @XmlJavaTypeAdapter(LocaleAdapter.class)
- public Locale getLocale()
+ public String getLocale()
{
return locale;
}
- public void setLocale(Locale locale)
+ public void setLocale(String locale)
{
this.locale = locale;
}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/metadata/factory/PortletApplicationModelFactory.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/metadata/factory/PortletApplicationModelFactory.java 2008-01-13 16:20:32 UTC (rev 9491)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/metadata/factory/PortletApplicationModelFactory.java 2008-01-13 18:15:59 UTC (rev 9492)
@@ -24,14 +24,11 @@
import java.net.URI;
import java.net.URISyntaxException;
-import java.util.Locale;
import org.apache.log4j.Logger;
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.common.i18n.LocalizedString;
-import org.jboss.portal.common.i18n.LocaleFormat;
-import org.jboss.portal.common.util.ConversionException;
import org.jboss.portal.portlet.TransportGuarantee;
import org.jboss.portal.portlet.impl.metadata.CustomPortletModeMetaData;
import org.jboss.portal.portlet.impl.metadata.CustomWindowStateMetaData;
@@ -607,14 +604,7 @@
SupportedLocaleMetaData md = (SupportedLocaleMetaData) object;
if ("supported-locale".equals(localName))
{
- try
- {
- md.setLocale(LocaleFormat.DEFAULT.getLocale(value));
- }
- catch (ConversionException e)
- {
- throw new RuntimeException("Todo make this reportable ????");
- }
+ md.setLocale(value);
}
}
Modified: modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/metadata/PortletTestEverythingTestCase.java
===================================================================
--- modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/metadata/PortletTestEverythingTestCase.java 2008-01-13 16:20:32 UTC (rev 9491)
+++ modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/metadata/PortletTestEverythingTestCase.java 2008-01-13 18:15:59 UTC (rev 9492)
@@ -109,9 +109,9 @@
List<SupportedLocaleMetaData> localeList = p1.getSupportedLocale();
assertEquals(3, localeList.size());
- assertEquals(new Locale("en"), localeList.get(0).getLocale());
- assertEquals(new Locale("fr"), localeList.get(1).getLocale());
- assertEquals(new Locale("fr", "FR"), localeList.get(2).getLocale());
+ assertEquals("en", localeList.get(0).getLocale());
+ assertEquals("fr", localeList.get(1).getLocale());
+ assertEquals("fr_FR", localeList.get(2).getLocale());
PortletInfoMetaData pimd = p1.getPortletInfo();
assertNotNull(pimd);
@@ -183,9 +183,9 @@
assertEquals(md, p6.getPortletApplication());
assertEquals("Portlet6", p6.getResourceBundle());
assertEquals(3, p6.getSupportedLocale().size());
- assertEquals(new Locale("en"), p6.getSupportedLocale().get(0).getLocale());
- assertEquals(new Locale("fr"), p6.getSupportedLocale().get(1).getLocale());
- assertEquals(new Locale("fr", "FR"), p6.getSupportedLocale().get(2).getLocale());
+ assertEquals("en", p6.getSupportedLocale().get(0).getLocale());
+ assertEquals("fr", p6.getSupportedLocale().get(1).getLocale());
+ assertEquals("fr_FR", p6.getSupportedLocale().get(2).getLocale());
PortletMetaData p7 = md.getPortlet("Portlet7");
assertNotNull(p7);
@@ -277,11 +277,9 @@
List<SupportedLocaleMetaData> localeList = p1.getSupportedLocale();
assertEquals(3, localeList.size());
- assertEquals(new Locale("en"), localeList.get(0).getLocale());
- assertEquals(new Locale("fr"), localeList.get(1).getLocale());
- assertEquals(new Locale("fr", "FR").getLanguage(), localeList.get(2).getLocale().getLanguage());
- assertEquals(new Locale("fr", "FR").getCountry(), localeList.get(2).getLocale().getCountry());
- assertEquals(new Locale("fr", "FR"), localeList.get(2).getLocale());
+ assertEquals("en", localeList.get(0).getLocale());
+ assertEquals("fr", localeList.get(1).getLocale());
+ assertEquals("fr_FR", localeList.get(2).getLocale());
assertEquals("MyResourceBundle", p1.getResourceBundle());
@@ -346,9 +344,9 @@
assertNotNull(p6);
assertEquals("Portlet6", p6.getResourceBundle());
assertEquals(3, p6.getSupportedLocale().size());
- assertEquals(new Locale("en"), p6.getSupportedLocale().get(0).getLocale());
- assertEquals(new Locale("fr"), p6.getSupportedLocale().get(1).getLocale());
- assertEquals(new Locale("fr", "FR"), p6.getSupportedLocale().get(2).getLocale());
+ assertEquals("en", p6.getSupportedLocale().get(0).getLocale());
+ assertEquals("fr", p6.getSupportedLocale().get(1).getLocale());
+ assertEquals("fr_FR", p6.getSupportedLocale().get(2).getLocale());
PortletMetaData p7 = md.getPortlet("Portlet7");
assertNotNull(p7);
@@ -443,9 +441,9 @@
List<SupportedLocaleMetaData> localeList = p1.getSupportedLocale();
assertEquals(3, localeList.size());
- assertEquals(new Locale("en"), localeList.get(0).getLocale());
- assertEquals(new Locale("fr"), localeList.get(1).getLocale());
- assertEquals(new Locale("fr", "FR"), localeList.get(2).getLocale());
+ assertEquals("en", localeList.get(0).getLocale());
+ assertEquals("fr", localeList.get(1).getLocale());
+ assertEquals("fr_FR", localeList.get(2).getLocale());
assertEquals("MyResourceBundle", p1.getResourceBundle());
18 years, 3 months
JBoss Portal SVN: r9491 - modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/metadata/adapter.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-01-13 11:20:32 -0500 (Sun, 13 Jan 2008)
New Revision: 9491
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/metadata/adapter/LocaleAdapter.java
Log:
removed system.out
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/metadata/adapter/LocaleAdapter.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/metadata/adapter/LocaleAdapter.java 2008-01-13 16:07:37 UTC (rev 9490)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/metadata/adapter/LocaleAdapter.java 2008-01-13 16:20:32 UTC (rev 9491)
@@ -35,15 +35,6 @@
public class LocaleAdapter extends XmlAdapter<String, Locale>
{
- public LocaleAdapter()
- {
- System.out.println("Build");
- System.out.println("Build");
- System.out.println("Build");
- System.out.println("Build");
- System.out.println("Build");
- }
-
@Override
public String marshal(Locale arg0) throws Exception
{
@@ -53,7 +44,6 @@
@Override
public Locale unmarshal(String arg0) throws Exception
{
- System.out.println("arg0 = " + arg0);
return LocaleFormat.DEFAULT.getLocale(arg0);
}
18 years, 3 months
JBoss Portal SVN: r9490 - in modules/portlet/trunk: portlet/src/main/java/org/jboss/portal/portlet/impl/metadata/adapter and 7 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-01-13 11:07:37 -0500 (Sun, 13 Jan 2008)
New Revision: 9490
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletconfig/LocalesTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletconfig/NoLocalesTestCase.java
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerCapabilitiesInfo.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/metadata/adapter/LocaleAdapter.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/metadata/factory/PortletApplicationModelFactory.java
modules/portlet/trunk/test/src/test/build.xml
modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/metadata/PortletTestEverythingTestCase.java
modules/portlet/trunk/test/src/test/resources/jsr286/tck/portletconfig-war/WEB-INF/portlet.xml
modules/portlet/trunk/test/src/test/resources/metadata/portlet/portlet1.xml
modules/portlet/trunk/test/src/test/resources/metadata/portlet/portlet2-jsr286.xml
modules/portlet/trunk/test/src/test/resources/metadata/portlet/portlet2.xml
modules/portlet/trunk/test/src/test/resources/test/remote-jboss-unit.xml
Log:
- fixed bugs in the Locale unmarshalling with the model based unmarshaller
- added test cases for non trival locales
- implemented and tested 286 PortletConfig.getSupportedLocales()
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerCapabilitiesInfo.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerCapabilitiesInfo.java 2008-01-13 12:04:18 UTC (rev 9489)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerCapabilitiesInfo.java 2008-01-13 16:07:37 UTC (rev 9490)
@@ -94,6 +94,11 @@
this.supportedLocales = new HashSet<Locale>();
}
+ public void addLocale(Locale locale)
+ {
+ supportedLocales.add(locale);
+ }
+
public void add(String contentType, Mode mode)
{
// Determines which map and key to store the mode under
@@ -371,6 +376,6 @@
public Set<Locale> getLocales(String mimeType)
{
- return getAllLocales();
+ return supportedLocales;
}
}
\ No newline at end of file
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java 2008-01-13 12:04:18 UTC (rev 9489)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java 2008-01-13 16:07:37 UTC (rev 9490)
@@ -448,6 +448,12 @@
ContainerCapabilitiesInfo capabilities = new ContainerCapabilitiesInfo();
//
+ for (SupportedLocaleMetaData supportedLocaleMD : portletMD.getSupportedLocale())
+ {
+ capabilities.addLocale(supportedLocaleMD.getLocale());
+ }
+
+ //
for (SupportsMetaData supportsMD : portletMD.getSupports())
{
// Get the mime type
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/metadata/adapter/LocaleAdapter.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/metadata/adapter/LocaleAdapter.java 2008-01-13 12:04:18 UTC (rev 9489)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/metadata/adapter/LocaleAdapter.java 2008-01-13 16:07:37 UTC (rev 9490)
@@ -22,6 +22,8 @@
******************************************************************************/
package org.jboss.portal.portlet.impl.metadata.adapter;
+import org.jboss.portal.common.i18n.LocaleFormat;
+
import java.util.Locale;
import javax.xml.bind.annotation.adapters.XmlAdapter;
@@ -33,6 +35,15 @@
public class LocaleAdapter extends XmlAdapter<String, Locale>
{
+ public LocaleAdapter()
+ {
+ System.out.println("Build");
+ System.out.println("Build");
+ System.out.println("Build");
+ System.out.println("Build");
+ System.out.println("Build");
+ }
+
@Override
public String marshal(Locale arg0) throws Exception
{
@@ -42,7 +53,8 @@
@Override
public Locale unmarshal(String arg0) throws Exception
{
- return new Locale(arg0);
+ System.out.println("arg0 = " + arg0);
+ return LocaleFormat.DEFAULT.getLocale(arg0);
}
}
Added: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletconfig/LocalesTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletconfig/LocalesTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletconfig/LocalesTestCase.java 2008-01-13 16:07:37 UTC (rev 9490)
@@ -0,0 +1,73 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr286.tck.portletconfig;
+
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.unit.Assertion;
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.PortletTestContext;
+import org.jboss.portal.unit.base.AbstractUniversalTestPortlet;
+import org.jboss.portal.unit.actions.PortletRenderTestAction;
+import org.jboss.portal.test.portlet.framework.UTP9;
+import org.jboss.portal.common.util.Tools;
+import static org.jboss.unit.api.Assert.*;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.Portlet;
+import javax.portlet.PortletConfig;
+import java.util.Enumeration;
+import java.util.Locale;
+import java.util.List;
+import java.util.HashSet;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+(a)TestCase({Assertion.JSR168_1000})
+public class LocalesTestCase
+{
+ public LocalesTestCase(PortletTestCase seq)
+ {
+ seq.bindAction(0, UTP9.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
+ {
+ PortletConfig cfg = ((AbstractUniversalTestPortlet)portlet).getPortletConfig();
+
+ //
+ Enumeration<Locale> locales = cfg.getSupportedLocales();
+ assertNotNull(locales);
+ List<Locale> list = Tools.toList(locales);
+ assertEquals(3, list.size());
+ assertEquals(Tools.toSet(Locale.ENGLISH, Locale.FRANCE, Locale.FRENCH), new HashSet<Locale>(list));
+
+ //
+ return new EndTestResponse();
+ }
+ });
+ }
+}
\ No newline at end of file
Added: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletconfig/NoLocalesTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletconfig/NoLocalesTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletconfig/NoLocalesTestCase.java 2008-01-13 16:07:37 UTC (rev 9490)
@@ -0,0 +1,68 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr286.tck.portletconfig;
+
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.unit.Assertion;
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.PortletTestContext;
+import org.jboss.portal.unit.base.AbstractUniversalTestPortlet;
+import org.jboss.portal.unit.actions.PortletRenderTestAction;
+import org.jboss.portal.test.portlet.framework.UTP8;
+import static org.jboss.unit.api.Assert.*;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.Portlet;
+import javax.portlet.PortletConfig;
+import java.util.Enumeration;
+import java.util.Locale;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+(a)TestCase({Assertion.JSR168_1000})
+public class NoLocalesTestCase
+{
+ public NoLocalesTestCase(PortletTestCase seq)
+ {
+ seq.bindAction(0, UTP8.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
+ {
+ PortletConfig cfg = ((AbstractUniversalTestPortlet)portlet).getPortletConfig();
+
+ //
+ Enumeration<Locale> locales = cfg.getSupportedLocales();
+ assertNotNull(locales);
+ assertFalse(locales.hasMoreElements());
+
+ //
+ return new EndTestResponse();
+ }
+ });
+ }
+}
\ No newline at end of file
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/metadata/factory/PortletApplicationModelFactory.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/metadata/factory/PortletApplicationModelFactory.java 2008-01-13 12:04:18 UTC (rev 9489)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/metadata/factory/PortletApplicationModelFactory.java 2008-01-13 16:07:37 UTC (rev 9490)
@@ -30,6 +30,8 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.common.i18n.LocalizedString;
+import org.jboss.portal.common.i18n.LocaleFormat;
+import org.jboss.portal.common.util.ConversionException;
import org.jboss.portal.portlet.TransportGuarantee;
import org.jboss.portal.portlet.impl.metadata.CustomPortletModeMetaData;
import org.jboss.portal.portlet.impl.metadata.CustomWindowStateMetaData;
@@ -605,7 +607,14 @@
SupportedLocaleMetaData md = (SupportedLocaleMetaData) object;
if ("supported-locale".equals(localName))
{
- md.setLocale(new Locale(value));
+ try
+ {
+ md.setLocale(LocaleFormat.DEFAULT.getLocale(value));
+ }
+ catch (ConversionException e)
+ {
+ throw new RuntimeException("Todo make this reportable ????");
+ }
}
}
Modified: modules/portlet/trunk/test/src/test/build.xml
===================================================================
--- modules/portlet/trunk/test/src/test/build.xml 2008-01-13 12:04:18 UTC (rev 9489)
+++ modules/portlet/trunk/test/src/test/build.xml 2008-01-13 16:07:37 UTC (rev 9490)
@@ -603,7 +603,7 @@
<jboss-unit>
- <tests config="${target}/test-classes/test/local-jboss-unit.xml" >
+ <tests config="${target}/test-classes/test/local-jboss-unit.xml">
</tests>
Modified: modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/metadata/PortletTestEverythingTestCase.java
===================================================================
--- modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/metadata/PortletTestEverythingTestCase.java 2008-01-13 12:04:18 UTC (rev 9489)
+++ modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/metadata/PortletTestEverythingTestCase.java 2008-01-13 16:07:37 UTC (rev 9490)
@@ -108,8 +108,10 @@
assertEquals("MyResourceBundle", p1.getResourceBundle());
List<SupportedLocaleMetaData> localeList = p1.getSupportedLocale();
+ assertEquals(3, localeList.size());
assertEquals(new Locale("en"), localeList.get(0).getLocale());
assertEquals(new Locale("fr"), localeList.get(1).getLocale());
+ assertEquals(new Locale("fr", "FR"), localeList.get(2).getLocale());
PortletInfoMetaData pimd = p1.getPortletInfo();
assertNotNull(pimd);
@@ -180,8 +182,10 @@
assertNotNull(p6);
assertEquals(md, p6.getPortletApplication());
assertEquals("Portlet6", p6.getResourceBundle());
+ assertEquals(3, p6.getSupportedLocale().size());
assertEquals(new Locale("en"), p6.getSupportedLocale().get(0).getLocale());
assertEquals(new Locale("fr"), p6.getSupportedLocale().get(1).getLocale());
+ assertEquals(new Locale("fr", "FR"), p6.getSupportedLocale().get(2).getLocale());
PortletMetaData p7 = md.getPortlet("Portlet7");
assertNotNull(p7);
@@ -272,8 +276,12 @@
assertEquals(Mode.create("HELP"), smd2.getPortletModes().get(1).getPortletMode());
List<SupportedLocaleMetaData> localeList = p1.getSupportedLocale();
+ assertEquals(3, localeList.size());
assertEquals(new Locale("en"), localeList.get(0).getLocale());
assertEquals(new Locale("fr"), localeList.get(1).getLocale());
+ assertEquals(new Locale("fr", "FR").getLanguage(), localeList.get(2).getLocale().getLanguage());
+ assertEquals(new Locale("fr", "FR").getCountry(), localeList.get(2).getLocale().getCountry());
+ assertEquals(new Locale("fr", "FR"), localeList.get(2).getLocale());
assertEquals("MyResourceBundle", p1.getResourceBundle());
@@ -337,8 +345,10 @@
PortletMetaData p6 = md.getPortlet("Portlet6");
assertNotNull(p6);
assertEquals("Portlet6", p6.getResourceBundle());
+ assertEquals(3, p6.getSupportedLocale().size());
assertEquals(new Locale("en"), p6.getSupportedLocale().get(0).getLocale());
assertEquals(new Locale("fr"), p6.getSupportedLocale().get(1).getLocale());
+ assertEquals(new Locale("fr", "FR"), p6.getSupportedLocale().get(2).getLocale());
PortletMetaData p7 = md.getPortlet("Portlet7");
assertNotNull(p7);
@@ -432,8 +442,10 @@
assertEquals(WindowState.create("CUSTOM"), smd2.getWindowStates().get(1).getWindowState());
List<SupportedLocaleMetaData> localeList = p1.getSupportedLocale();
+ assertEquals(3, localeList.size());
assertEquals(new Locale("en"), localeList.get(0).getLocale());
assertEquals(new Locale("fr"), localeList.get(1).getLocale());
+ assertEquals(new Locale("fr", "FR"), localeList.get(2).getLocale());
assertEquals("MyResourceBundle", p1.getResourceBundle());
Modified: modules/portlet/trunk/test/src/test/resources/jsr286/tck/portletconfig-war/WEB-INF/portlet.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/jsr286/tck/portletconfig-war/WEB-INF/portlet.xml 2008-01-13 12:04:18 UTC (rev 9489)
+++ modules/portlet/trunk/test/src/test/resources/jsr286/tck/portletconfig-war/WEB-INF/portlet.xml 2008-01-13 16:07:37 UTC (rev 9490)
@@ -157,6 +157,25 @@
<supported-public-render-parameter>render_param2</supported-public-render-parameter>
</portlet>
+ <portlet>
+ <portlet-name>UniversalTestPortletH</portlet-name>
+ <portlet-class>org.jboss.portal.test.portlet.framework.UTP8</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ </portlet>
+
+ <portlet>
+ <portlet-name>UniversalTestPortletI</portlet-name>
+ <portlet-class>org.jboss.portal.test.portlet.framework.UTP9</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <supported-locale>en</supported-locale>
+ <supported-locale>fr</supported-locale>
+ <supported-locale>fr_FR</supported-locale>
+ </portlet>
+
<default-namespace>urn:default-namespace</default-namespace>
<event-definition>
Modified: modules/portlet/trunk/test/src/test/resources/metadata/portlet/portlet1.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/metadata/portlet/portlet1.xml 2008-01-13 12:04:18 UTC (rev 9489)
+++ modules/portlet/trunk/test/src/test/resources/metadata/portlet/portlet1.xml 2008-01-13 16:07:37 UTC (rev 9490)
@@ -37,6 +37,7 @@
</supports>
<supported-locale>en</supported-locale>
<supported-locale>fr</supported-locale>
+ <supported-locale>fr_FR</supported-locale>
<resource-bundle>MyResourceBundle</resource-bundle>
<portlet-info>
<title>very long portlet title</title>
@@ -164,6 +165,7 @@
</supports>
<supported-locale>en</supported-locale>
<supported-locale>fr</supported-locale>
+ <supported-locale>fr_FR</supported-locale>
<resource-bundle>Portlet6</resource-bundle>
<portlet-info>
<title>Very long portlet title</title>
Modified: modules/portlet/trunk/test/src/test/resources/metadata/portlet/portlet2-jsr286.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/metadata/portlet/portlet2-jsr286.xml 2008-01-13 12:04:18 UTC (rev 9489)
+++ modules/portlet/trunk/test/src/test/resources/metadata/portlet/portlet2-jsr286.xml 2008-01-13 16:07:37 UTC (rev 9490)
@@ -42,6 +42,7 @@
</supports>
<supported-locale>en</supported-locale>
<supported-locale>fr</supported-locale>
+ <supported-locale>fr_FR</supported-locale>
<resource-bundle>MyResourceBundle</resource-bundle>
<portlet-info>
<title>very long portlet title</title>
Modified: modules/portlet/trunk/test/src/test/resources/metadata/portlet/portlet2.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/metadata/portlet/portlet2.xml 2008-01-13 12:04:18 UTC (rev 9489)
+++ modules/portlet/trunk/test/src/test/resources/metadata/portlet/portlet2.xml 2008-01-13 16:07:37 UTC (rev 9490)
@@ -38,6 +38,7 @@
</supports>
<supported-locale>en</supported-locale>
<supported-locale>fr</supported-locale>
+ <supported-locale>fr_FR</supported-locale>
<resource-bundle>MyResourceBundle</resource-bundle>
<portlet-info>
<title>very long portlet title</title>
@@ -165,6 +166,7 @@
</supports>
<supported-locale>en</supported-locale>
<supported-locale>fr</supported-locale>
+ <supported-locale>fr_FR</supported-locale>
<resource-bundle>Portlet6</resource-bundle>
<portlet-info>
<title>Very long portlet title</title>
Modified: modules/portlet/trunk/test/src/test/resources/test/remote-jboss-unit.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/test/remote-jboss-unit.xml 2008-01-13 12:04:18 UTC (rev 9489)
+++ modules/portlet/trunk/test/src/test/resources/test/remote-jboss-unit.xml 2008-01-13 16:07:37 UTC (rev 9490)
@@ -5,6 +5,7 @@
xsi:schemaLocation="urn:jboss:jboss-unit:1.0 jboss-unit_1_0.xsd">
<!--Spec TCK Assertions tests-->
+<!--
<generic>
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr168-tck-dispatcher.war"/>
@@ -49,8 +50,10 @@
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr168-tck-windowstates.war"/>
</generic>
+-->
<!--API Tests-->
+<!--
<generic>
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr168-api-actionrequest.war"/>
@@ -103,8 +106,10 @@
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr168-api-windowstate.war"/>
</generic>
+-->
<!--Ext Tests-->
+<!--
<generic>
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr168-ext-dispatcher.war"/>
@@ -145,6 +150,7 @@
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr168-ext-nocache.war"/>
</generic>
+-->
<!--Spec TCK Assertions tests-->
<generic>
18 years, 3 months
JBoss Portal SVN: r9489 - in modules/portlet/trunk: portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api and 3 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-01-13 07:04:18 -0500 (Sun, 13 Jan 2008)
New Revision: 9489
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletconfig/NoPublicRenderParameterTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletconfig/PublicRenderParameterTestCase.java
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerPortletInfo.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletConfigImpl.java
modules/portlet/trunk/test/src/test/resources/jsr286/tck/portletconfig-war/WEB-INF/portlet.xml
modules/portlet/trunk/test/src/test/resources/test/remote-jboss-unit.xml
Log:
implement public render parameters from PortletConfig and test cases for it
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java 2008-01-13 01:34:39 UTC (rev 9488)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java 2008-01-13 12:04:18 UTC (rev 9489)
@@ -174,6 +174,10 @@
{
portletMD.setInitParams(new ArrayList<InitParamMetaData>());
}
+ if (portletMD.getSupportedPublicRenderParameters() == null)
+ {
+ portletMD.setSupportedPublicRenderParameters(new ArrayList<String>());
+ }
for (PortletPreferenceMetaData portletPreferenceMD : portletMD.getPortletPreferences().getPortletPreferences().values())
{
if (portletPreferenceMD.getValue() == null)
@@ -343,6 +347,12 @@
}
//
+ for (String renderParameter : portletMD.getSupportedPublicRenderParameters())
+ {
+ containerPortletInfo.addRenderParameter(renderParameter);
+ }
+
+ //
return containerPortletInfo;
}
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerPortletInfo.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerPortletInfo.java 2008-01-13 01:34:39 UTC (rev 9488)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerPortletInfo.java 2008-01-13 12:04:18 UTC (rev 9489)
@@ -25,10 +25,10 @@
import org.jboss.portal.portlet.info.PortletInfo;
import org.jboss.portal.common.i18n.ResourceBundleManager;
-import javax.xml.XMLConstants;
import java.util.Map;
import java.util.HashMap;
import java.util.Set;
+import java.util.LinkedHashSet;
/**
* For now implementation that use the portlet container directly.
@@ -71,6 +71,9 @@
private final Map<String, String> initParameters;
/** . */
+ private final Set<String> renderParameterNames;
+
+ /** . */
private final Boolean remotable;
/** . */
@@ -98,6 +101,7 @@
this.name = name;
this.className = className;
this.initParameters = new HashMap<String, String>();
+ this.renderParameterNames = new LinkedHashSet<String>();
this.remotable = remotable;
this.bundleManager = bundleManager;
}
@@ -125,6 +129,7 @@
this.name = name;
this.className = className;
this.initParameters = new HashMap<String, String>();
+ this.renderParameterNames = new LinkedHashSet<String>();
this.remotable = remotable;
this.bundleManager = bundleManager;
}
@@ -159,6 +164,16 @@
return initParameters.get(name);
}
+ public void addRenderParameter(String parameterName)
+ {
+ renderParameterNames.add(parameterName);
+ }
+
+ public Set<String> getRenderParameterNames()
+ {
+ return renderParameterNames;
+ }
+
public ContainerCapabilitiesInfo getCapabilities()
{
return capabilities;
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletConfigImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletConfigImpl.java 2008-01-13 01:34:39 UTC (rev 9488)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletConfigImpl.java 2008-01-13 12:04:18 UTC (rev 9489)
@@ -24,7 +24,6 @@
import org.jboss.portal.common.i18n.ResourceBundleManager;
import org.jboss.portal.common.NotYetImplemented;
-import org.jboss.portal.common.util.Tools;
import org.jboss.portal.portlet.impl.info.ContainerPortletInfo;
import org.jboss.portal.portlet.impl.info.ContainerPortletApplicationInfo;
import org.jboss.portal.portlet.info.EventInfo;
@@ -127,7 +126,7 @@
public Enumeration<String> getPublicRenderParameterNames()
{
- throw new NotYetImplemented();
+ return Collections.enumeration(portletInfo.getRenderParameterNames());
}
public String getDefaultNamespace()
@@ -137,21 +136,22 @@
public Enumeration<QName> getPublishingEventQNames()
{
- return Tools.toEnumeration(publishingEventQNames.iterator());
+ return Collections.enumeration(publishingEventQNames);
}
public Enumeration<QName> getProcessingEventQNames()
{
- return Tools.toEnumeration(processingEventQNames.iterator());
+ return Collections.enumeration(processingEventQNames);
}
public Enumeration<Locale> getSupportedLocales()
{
- throw new NotYetImplemented();
+ return Collections.enumeration(portletInfo.getCapabilities().getAllLocales());
}
public Map<String, String[]> getContainerRuntimeOptions()
{
- throw new NotYetImplemented();
+ // For now we support no container runtime options
+ return Collections.emptyMap();
}
}
Added: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletconfig/NoPublicRenderParameterTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletconfig/NoPublicRenderParameterTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletconfig/NoPublicRenderParameterTestCase.java 2008-01-13 12:04:18 UTC (rev 9489)
@@ -0,0 +1,67 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr286.tck.portletconfig;
+
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.unit.Assertion;
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.PortletTestContext;
+import org.jboss.portal.unit.base.AbstractUniversalTestPortlet;
+import org.jboss.portal.unit.actions.PortletRenderTestAction;
+import org.jboss.portal.test.portlet.framework.UTP6;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import static org.jboss.unit.api.Assert.*;
+
+import javax.portlet.PortletConfig;
+import javax.portlet.Portlet;
+import javax.portlet.RenderResponse;
+import javax.portlet.RenderRequest;
+import java.util.Enumeration;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+(a)TestCase({Assertion.JSR168_1000})
+public class NoPublicRenderParameterTestCase
+{
+ public NoPublicRenderParameterTestCase(PortletTestCase seq)
+ {
+ seq.bindAction(0, UTP6.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
+ {
+ PortletConfig cfg = ((AbstractUniversalTestPortlet)portlet).getPortletConfig();
+
+ //
+ Enumeration<String> names = cfg.getPublicRenderParameterNames();
+ assertNotNull(names);
+ assertFalse(names.hasMoreElements());
+
+ //
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Added: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletconfig/PublicRenderParameterTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletconfig/PublicRenderParameterTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletconfig/PublicRenderParameterTestCase.java 2008-01-13 12:04:18 UTC (rev 9489)
@@ -0,0 +1,72 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr286.tck.portletconfig;
+
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.unit.Assertion;
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.PortletTestContext;
+import org.jboss.portal.unit.base.AbstractUniversalTestPortlet;
+import org.jboss.portal.unit.actions.PortletRenderTestAction;
+import org.jboss.portal.test.portlet.framework.UTP7;
+import org.jboss.portal.common.util.Tools;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import static org.jboss.unit.api.Assert.*;
+
+import javax.portlet.PortletConfig;
+import javax.portlet.Portlet;
+import javax.portlet.RenderResponse;
+import javax.portlet.RenderRequest;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.HashSet;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+(a)TestCase({Assertion.JSR168_1000})
+public class PublicRenderParameterTestCase
+{
+ public PublicRenderParameterTestCase(PortletTestCase seq)
+ {
+ seq.bindAction(0, UTP7.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
+ {
+ PortletConfig cfg = ((AbstractUniversalTestPortlet)portlet).getPortletConfig();
+
+ //
+ Enumeration<String> names = cfg.getPublicRenderParameterNames();
+ assertNotNull(names);
+ List<String> list = Tools.toList(names);
+ assertEquals(2, list.size());
+ assertEquals(Tools.toSet("render_param1", "render_param2"), new HashSet<String>(list));
+
+ //
+ return new EndTestResponse();
+ }
+ });
+ }
+}
\ No newline at end of file
Modified: modules/portlet/trunk/test/src/test/resources/jsr286/tck/portletconfig-war/WEB-INF/portlet.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/jsr286/tck/portletconfig-war/WEB-INF/portlet.xml 2008-01-13 01:34:39 UTC (rev 9488)
+++ modules/portlet/trunk/test/src/test/resources/jsr286/tck/portletconfig-war/WEB-INF/portlet.xml 2008-01-13 12:04:18 UTC (rev 9489)
@@ -139,6 +139,24 @@
</supports>
</portlet>
+ <portlet>
+ <portlet-name>UniversalTestPortletF</portlet-name>
+ <portlet-class>org.jboss.portal.test.portlet.framework.UTP6</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ </portlet>
+
+ <portlet>
+ <portlet-name>UniversalTestPortletG</portlet-name>
+ <portlet-class>org.jboss.portal.test.portlet.framework.UTP7</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <supported-public-render-parameter>render_param1</supported-public-render-parameter>
+ <supported-public-render-parameter>render_param2</supported-public-render-parameter>
+ </portlet>
+
<default-namespace>urn:default-namespace</default-namespace>
<event-definition>
Modified: modules/portlet/trunk/test/src/test/resources/test/remote-jboss-unit.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/test/remote-jboss-unit.xml 2008-01-13 01:34:39 UTC (rev 9488)
+++ modules/portlet/trunk/test/src/test/resources/test/remote-jboss-unit.xml 2008-01-13 12:04:18 UTC (rev 9489)
@@ -5,7 +5,6 @@
xsi:schemaLocation="urn:jboss:jboss-unit:1.0 jboss-unit_1_0.xsd">
<!--Spec TCK Assertions tests-->
-<!--
<generic>
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr168-tck-dispatcher.war"/>
@@ -50,10 +49,8 @@
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr168-tck-windowstates.war"/>
</generic>
--->
<!--API Tests-->
-<!--
<generic>
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr168-api-actionrequest.war"/>
@@ -106,10 +103,8 @@
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr168-api-windowstate.war"/>
</generic>
--->
<!--Ext Tests-->
-<!--
<generic>
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr168-ext-dispatcher.war"/>
@@ -150,7 +145,6 @@
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr168-ext-nocache.war"/>
</generic>
--->
<!--Spec TCK Assertions tests-->
<generic>
18 years, 3 months
JBoss Portal SVN: r9488 - in modules/portlet/trunk: portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api and 9 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-01-12 20:34:39 -0500 (Sat, 12 Jan 2008)
New Revision: 9488
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletconfig/DefaultNamespaceTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletconfignonamespace/
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletconfignonamespace/DefaultNamespaceTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletconfignonamespace/NoEventTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletconfignonamespace/ProcessingEventTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletconfignonamespace/PublishingEventTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletconfignonamespace/PublishingProcessingEventTestCase.java
modules/portlet/trunk/test/src/test/resources/jsr286/tck/portletconfignonamespace-war/
modules/portlet/trunk/test/src/test/resources/jsr286/tck/portletconfignonamespace-war/WEB-INF/
modules/portlet/trunk/test/src/test/resources/jsr286/tck/portletconfignonamespace-war/WEB-INF/portlet.xml
modules/portlet/trunk/test/src/test/resources/jsr286/tck/portletconfignonamespace-war/WEB-INF/web.xml
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletConfigImpl.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletconfig/ProcessingEventTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletconfig/PublishingEventTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletconfig/PublishingProcessingEventTestCase.java
modules/portlet/trunk/test/src/test/build.xml
modules/portlet/trunk/test/src/test/resources/jsr286/tck/portletconfig-war/WEB-INF/portlet.xml
modules/portlet/trunk/test/src/test/resources/test/remote-jboss-unit.xml
Log:
- added test cases for event names when no default namespace is declared
- added test case to check the default namespace value from the portlet config
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java 2008-01-13 00:40:13 UTC (rev 9487)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java 2008-01-13 01:34:39 UTC (rev 9488)
@@ -355,7 +355,17 @@
{
QName name = getName(eventDefinitionReferenceMD.getQname(), eventDefinitionReferenceMD.getName());
ContainerEventInfo event = events.get(name);
- portletEvents.addConsumedEvent(event);
+
+ //
+ if (event != null)
+ {
+ portletEvents.addConsumedEvent(event);
+ }
+ else
+ {
+ log.error("Portlet " + portletMD.getPortletName() + " references the event " + name + " that is not " +
+ "declared at the application level");
+ }
}
//
@@ -363,7 +373,17 @@
{
QName name = getName(eventDefinitionReferenceMD.getQname(), eventDefinitionReferenceMD.getName());
ContainerEventInfo event = events.get(name);
- portletEvents.addProducedEvent(event);
+
+ //
+ if (event != null)
+ {
+ portletEvents.addProducedEvent(event);
+ }
+ else
+ {
+ log.error("Portlet " + portletMD.getPortletName() + " references the event " + name + " that is not " +
+ "declared at the application level");
+ }
}
//
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletConfigImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletConfigImpl.java 2008-01-13 00:40:13 UTC (rev 9487)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletConfigImpl.java 2008-01-13 01:34:39 UTC (rev 9488)
@@ -74,14 +74,16 @@
List<QName> publishingEventQNames = new ArrayList<QName>();
for (EventInfo event : portletInfo.getEvents().getProducedEvents())
{
- publishingEventQNames.add(event.getName());
+ QName eventName = event.getName();
+ publishingEventQNames.add(eventName);
}
//
List<QName> processingEventQNames = new ArrayList<QName>();
for (EventInfo event : portletInfo.getEvents().getConsumedEvents())
{
- processingEventQNames.add(event.getName());
+ QName eventName = event.getName();
+ processingEventQNames.add(eventName);
}
//
Added: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletconfig/DefaultNamespaceTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletconfig/DefaultNamespaceTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletconfig/DefaultNamespaceTestCase.java 2008-01-13 01:34:39 UTC (rev 9488)
@@ -0,0 +1,64 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr286.tck.portletconfig;
+
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.unit.Assertion;
+import org.jboss.portal.unit.PortletTestContext;
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.base.AbstractUniversalTestPortlet;
+import org.jboss.portal.unit.actions.PortletRenderTestAction;
+import org.jboss.portal.test.portlet.framework.UTP5;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import static org.jboss.unit.api.Assert.*;
+
+import javax.portlet.Portlet;
+import javax.portlet.PortletConfig;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+(a)TestCase({Assertion.JSR168_1000})
+public class DefaultNamespaceTestCase
+{
+ public DefaultNamespaceTestCase(PortletTestCase seq)
+ {
+ seq.bindAction(0, UTP5.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
+ {
+ PortletConfig cfg = ((AbstractUniversalTestPortlet)portlet).getPortletConfig();
+
+ //
+ assertEquals("urn:default-namespace", cfg.getDefaultNamespace());
+
+ //
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletconfig/ProcessingEventTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletconfig/ProcessingEventTestCase.java 2008-01-13 00:40:13 UTC (rev 9487)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletconfig/ProcessingEventTestCase.java 2008-01-13 01:34:39 UTC (rev 9488)
@@ -69,7 +69,7 @@
Enumeration<QName> processingEvents = cfg.getProcessingEventQNames();
assertNotNull(processingEvents);
List<QName> processingEventList = Tools.toList(processingEvents);
- assertEquals(6, processingEventList.size());
+ assertEquals(PublishingEventTestCase.EVENT_NAMES.size(), processingEventList.size());
assertEquals(PublishingEventTestCase.EVENT_NAMES, new HashSet<QName>(processingEventList));
//
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletconfig/PublishingEventTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletconfig/PublishingEventTestCase.java 2008-01-13 00:40:13 UTC (rev 9487)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletconfig/PublishingEventTestCase.java 2008-01-13 01:34:39 UTC (rev 9488)
@@ -75,7 +75,7 @@
Enumeration<QName> publishingEvents = cfg.getPublishingEventQNames();
assertNotNull(publishingEvents);
List<QName> publishingEventList = Tools.toList(publishingEvents);
- assertEquals(6, publishingEventList.size());
+ assertEquals(EVENT_NAMES.size(), publishingEventList.size());
assertEquals(EVENT_NAMES, new HashSet<QName>(publishingEventList));
//
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletconfig/PublishingProcessingEventTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletconfig/PublishingProcessingEventTestCase.java 2008-01-13 00:40:13 UTC (rev 9487)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletconfig/PublishingProcessingEventTestCase.java 2008-01-13 01:34:39 UTC (rev 9488)
@@ -64,14 +64,14 @@
Enumeration<QName> publishingEvents = cfg.getPublishingEventQNames();
assertNotNull(publishingEvents);
List<QName> publishingEventList = Tools.toList(publishingEvents);
- assertEquals(6, publishingEventList.size());
+ assertEquals(PublishingEventTestCase.EVENT_NAMES.size(), publishingEventList.size());
assertEquals(PublishingEventTestCase.EVENT_NAMES, new HashSet<QName>(publishingEventList));
//
Enumeration<QName> processingEvents = cfg.getProcessingEventQNames();
assertNotNull(processingEvents);
List<QName> processingEventList = Tools.toList(processingEvents);
- assertEquals(6, processingEventList.size());
+ assertEquals(PublishingEventTestCase.EVENT_NAMES.size(), processingEventList.size());
assertEquals(PublishingEventTestCase.EVENT_NAMES, new HashSet<QName>(processingEventList));
//
Added: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletconfignonamespace/DefaultNamespaceTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletconfignonamespace/DefaultNamespaceTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletconfignonamespace/DefaultNamespaceTestCase.java 2008-01-13 01:34:39 UTC (rev 9488)
@@ -0,0 +1,65 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr286.tck.portletconfignonamespace;
+
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.unit.Assertion;
+import org.jboss.portal.unit.PortletTestContext;
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.base.AbstractUniversalTestPortlet;
+import org.jboss.portal.unit.actions.PortletRenderTestAction;
+import org.jboss.portal.test.portlet.framework.UTP5;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import static org.jboss.unit.api.Assert.*;
+
+import javax.portlet.Portlet;
+import javax.portlet.PortletConfig;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.xml.XMLConstants;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+(a)TestCase({Assertion.JSR168_1000})
+public class DefaultNamespaceTestCase
+{
+ public DefaultNamespaceTestCase(PortletTestCase seq)
+ {
+ seq.bindAction(0, UTP5.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
+ {
+ PortletConfig cfg = ((AbstractUniversalTestPortlet)portlet).getPortletConfig();
+
+ //
+ assertEquals(XMLConstants.NULL_NS_URI, cfg.getDefaultNamespace());
+
+ //
+ return new EndTestResponse();
+ }
+ });
+ }
+}
\ No newline at end of file
Added: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletconfignonamespace/NoEventTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletconfignonamespace/NoEventTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletconfignonamespace/NoEventTestCase.java 2008-01-13 01:34:39 UTC (rev 9488)
@@ -0,0 +1,73 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr286.tck.portletconfignonamespace;
+
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.unit.Assertion;
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.PortletTestContext;
+import org.jboss.portal.unit.base.AbstractUniversalTestPortlet;
+import org.jboss.portal.unit.actions.PortletRenderTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import static org.jboss.unit.api.Assert.*;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.Portlet;
+import javax.portlet.PortletConfig;
+import javax.xml.namespace.QName;
+import java.util.Enumeration;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+(a)TestCase({Assertion.JSR168_1000})
+public class NoEventTestCase
+{
+ public NoEventTestCase(PortletTestCase seq)
+ {
+ seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
+ {
+ PortletConfig cfg = ((AbstractUniversalTestPortlet)portlet).getPortletConfig();
+
+ //
+ Enumeration<QName> publishingEvents = cfg.getPublishingEventQNames();
+ assertNotNull(publishingEvents);
+ assertFalse(publishingEvents.hasMoreElements());
+
+ //
+ Enumeration<QName> processingEvents = cfg.getProcessingEventQNames();
+ assertNotNull(processingEvents);
+ assertFalse(processingEvents.hasMoreElements());
+
+ //
+ return new EndTestResponse();
+ }
+ });
+ }
+}
\ No newline at end of file
Added: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletconfignonamespace/ProcessingEventTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletconfignonamespace/ProcessingEventTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletconfignonamespace/ProcessingEventTestCase.java 2008-01-13 01:34:39 UTC (rev 9488)
@@ -0,0 +1,80 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr286.tck.portletconfignonamespace;
+
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.PortletTestContext;
+import org.jboss.portal.unit.Assertion;
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.unit.base.AbstractUniversalTestPortlet;
+import org.jboss.portal.unit.actions.PortletRenderTestAction;
+import org.jboss.portal.test.portlet.framework.UTP3;
+import org.jboss.portal.common.util.Tools;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import static org.jboss.unit.api.Assert.assertNotNull;
+import static org.jboss.unit.api.Assert.assertFalse;
+import static org.jboss.unit.api.Assert.assertEquals;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletConfig;
+import javax.xml.namespace.QName;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.HashSet;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+(a)TestCase({Assertion.JSR168_1000})
+public class ProcessingEventTestCase
+{
+ public ProcessingEventTestCase(PortletTestCase seq)
+ {
+ seq.bindAction(0, UTP3.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
+ {
+ PortletConfig cfg = ((AbstractUniversalTestPortlet)portlet).getPortletConfig();
+
+ //
+ Enumeration<QName> publishingEvents = cfg.getPublishingEventQNames();
+ assertNotNull(publishingEvents);
+ assertFalse(publishingEvents.hasMoreElements());
+
+ //
+ Enumeration<QName> processingEvents = cfg.getProcessingEventQNames();
+ assertNotNull(processingEvents);
+ List<QName> processingEventList = Tools.toList(processingEvents);
+ assertEquals(PublishingEventTestCase.EVENT_NAMES.size(), processingEventList.size());
+ assertEquals(PublishingEventTestCase.EVENT_NAMES, new HashSet<QName>(processingEventList));
+
+ //
+ return new EndTestResponse();
+ }
+ });
+ }
+}
\ No newline at end of file
Added: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletconfignonamespace/PublishingEventTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletconfignonamespace/PublishingEventTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletconfignonamespace/PublishingEventTestCase.java 2008-01-13 01:34:39 UTC (rev 9488)
@@ -0,0 +1,89 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr286.tck.portletconfignonamespace;
+
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.PortletTestContext;
+import org.jboss.portal.unit.Assertion;
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.unit.base.AbstractUniversalTestPortlet;
+import org.jboss.portal.unit.actions.PortletRenderTestAction;
+import org.jboss.portal.test.portlet.framework.UTP2;
+import org.jboss.portal.common.util.Tools;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import static org.jboss.unit.api.Assert.*;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletConfig;
+import javax.xml.namespace.QName;
+import javax.xml.XMLConstants;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+(a)TestCase({Assertion.JSR168_1000})
+public class PublishingEventTestCase
+{
+
+ static final Set<QName> EVENT_NAMES = Collections.unmodifiableSet(Tools.toSet(
+ new QName("urn:explicit-namespace-1", "event1"),
+ new QName("urn:explicit-namespace-2", "event2"),
+ new QName(XMLConstants.NULL_NS_URI, "event3")
+ ));
+
+
+ public PublishingEventTestCase(PortletTestCase seq)
+ {
+ seq.bindAction(0, UTP2.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
+ {
+ PortletConfig cfg = ((AbstractUniversalTestPortlet)portlet).getPortletConfig();
+
+ //
+ Enumeration<QName> publishingEvents = cfg.getPublishingEventQNames();
+ assertNotNull(publishingEvents);
+ List<QName> publishingEventList = Tools.toList(publishingEvents);
+ assertEquals(EVENT_NAMES.size(), publishingEventList.size());
+ assertEquals(EVENT_NAMES, new HashSet<QName>(publishingEventList));
+
+ //
+ Enumeration<QName> processingEvents = cfg.getProcessingEventQNames();
+ assertNotNull(processingEvents);
+ assertFalse(processingEvents.hasMoreElements());
+
+ //
+ return new EndTestResponse();
+ }
+ });
+ }
+}
\ No newline at end of file
Added: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletconfignonamespace/PublishingProcessingEventTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletconfignonamespace/PublishingProcessingEventTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletconfignonamespace/PublishingProcessingEventTestCase.java 2008-01-13 01:34:39 UTC (rev 9488)
@@ -0,0 +1,81 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr286.tck.portletconfignonamespace;
+
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.PortletTestContext;
+import org.jboss.portal.unit.Assertion;
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.unit.base.AbstractUniversalTestPortlet;
+import org.jboss.portal.unit.actions.PortletRenderTestAction;
+import org.jboss.portal.test.portlet.framework.UTP4;
+import org.jboss.portal.common.util.Tools;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import static org.jboss.unit.api.Assert.assertNotNull;
+import static org.jboss.unit.api.Assert.assertEquals;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletConfig;
+import javax.xml.namespace.QName;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.HashSet;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+(a)TestCase({Assertion.JSR168_1000})
+public class PublishingProcessingEventTestCase
+{
+ public PublishingProcessingEventTestCase(PortletTestCase seq)
+ {
+ seq.bindAction(0, UTP4.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
+ {
+ PortletConfig cfg = ((AbstractUniversalTestPortlet)portlet).getPortletConfig();
+
+ //
+ Enumeration<QName> publishingEvents = cfg.getPublishingEventQNames();
+ assertNotNull(publishingEvents);
+ List<QName> publishingEventList = Tools.toList(publishingEvents);
+ assertEquals(PublishingEventTestCase.EVENT_NAMES.size(), publishingEventList.size());
+ assertEquals(PublishingEventTestCase.EVENT_NAMES, new HashSet<QName>(publishingEventList));
+
+ //
+ Enumeration<QName> processingEvents = cfg.getProcessingEventQNames();
+ assertNotNull(processingEvents);
+ List<QName> processingEventList = Tools.toList(processingEvents);
+ assertEquals(PublishingEventTestCase.EVENT_NAMES.size(), processingEventList.size());
+ assertEquals(PublishingEventTestCase.EVENT_NAMES, new HashSet<QName>(processingEventList));
+
+ //
+ return new EndTestResponse();
+ }
+ });
+ }
+}
\ No newline at end of file
Modified: modules/portlet/trunk/test/src/test/build.xml
===================================================================
--- modules/portlet/trunk/test/src/test/build.xml 2008-01-13 00:40:13 UTC (rev 9487)
+++ modules/portlet/trunk/test/src/test/build.xml 2008-01-13 01:34:39 UTC (rev 9488)
@@ -219,6 +219,7 @@
<package-misc-test test="log4j"/>
<package-jsr286-tck-test test="portletconfig"/>
+ <package-jsr286-tck-test test="portletconfignonamespace"/>
<jar jarfile="${test.temp.lib}/portlet-test-lib.jar">
<fileset dir="${target}/test-classes"/>
Modified: modules/portlet/trunk/test/src/test/resources/jsr286/tck/portletconfig-war/WEB-INF/portlet.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/jsr286/tck/portletconfig-war/WEB-INF/portlet.xml 2008-01-13 00:40:13 UTC (rev 9487)
+++ modules/portlet/trunk/test/src/test/resources/jsr286/tck/portletconfig-war/WEB-INF/portlet.xml 2008-01-13 01:34:39 UTC (rev 9488)
@@ -131,6 +131,14 @@
</supported-publishing-event>
</portlet>
+ <portlet>
+ <portlet-name>UniversalTestPortletE</portlet-name>
+ <portlet-class>org.jboss.portal.test.portlet.framework.UTP5</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ </portlet>
+
<default-namespace>urn:default-namespace</default-namespace>
<event-definition>
Added: modules/portlet/trunk/test/src/test/resources/jsr286/tck/portletconfignonamespace-war/WEB-INF/portlet.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/jsr286/tck/portletconfignonamespace-war/WEB-INF/portlet.xml (rev 0)
+++ modules/portlet/trunk/test/src/test/resources/jsr286/tck/portletconfignonamespace-war/WEB-INF/portlet.xml 2008-01-13 01:34:39 UTC (rev 9488)
@@ -0,0 +1,118 @@
+<?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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ version="2.0">
+
+ <portlet>
+ <portlet-name>UniversalTestPortletA</portlet-name>
+ <portlet-class>org.jboss.portal.test.portlet.framework.UTP1</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ </portlet>
+
+ <portlet>
+ <portlet-name>UniversalTestPortletB</portlet-name>
+ <portlet-class>org.jboss.portal.test.portlet.framework.UTP2</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <supported-publishing-event>
+ <qname xmlns:a="urn:explicit-namespace-1">a:event1</qname>
+ </supported-publishing-event>
+ <supported-publishing-event>
+ <qname xmlns:a="urn:explicit-namespace-2">a:event2</qname>
+ </supported-publishing-event>
+ <supported-publishing-event>
+ <name>event3</name>
+ </supported-publishing-event>
+ </portlet>
+
+ <portlet>
+ <portlet-name>UniversalTestPortletC</portlet-name>
+ <portlet-class>org.jboss.portal.test.portlet.framework.UTP3</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <supported-processing-event>
+ <qname xmlns:a="urn:explicit-namespace-1">a:event1</qname>
+ </supported-processing-event>
+ <supported-processing-event>
+ <qname xmlns:a="urn:explicit-namespace-2">a:event2</qname>
+ </supported-processing-event>
+ <supported-processing-event>
+ <name>event3</name>
+ </supported-processing-event>
+ </portlet>
+
+ <portlet>
+ <portlet-name>UniversalTestPortletD</portlet-name>
+ <portlet-class>org.jboss.portal.test.portlet.framework.UTP4</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <supported-processing-event>
+ <qname xmlns:a="urn:explicit-namespace-1">a:event1</qname>
+ </supported-processing-event>
+ <supported-processing-event>
+ <qname xmlns:a="urn:explicit-namespace-2">a:event2</qname>
+ </supported-processing-event>
+ <supported-processing-event>
+ <name>event3</name>
+ </supported-processing-event>
+ <supported-publishing-event>
+ <qname xmlns:a="urn:explicit-namespace-1">a:event1</qname>
+ </supported-publishing-event>
+ <supported-publishing-event>
+ <qname xmlns:a="urn:explicit-namespace-2">a:event2</qname>
+ </supported-publishing-event>
+ <supported-publishing-event>
+ <name>event3</name>
+ </supported-publishing-event>
+ </portlet>
+
+ <portlet>
+ <portlet-name>UniversalTestPortletE</portlet-name>
+ <portlet-class>org.jboss.portal.test.portlet.framework.UTP5</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ </portlet>
+
+ <event-definition>
+ <qname xmlns:a="urn:explicit-namespace-1">a:event1</qname>
+ </event-definition>
+
+ <event-definition>
+ <qname xmlns:a="urn:explicit-namespace-2">a:event2</qname>
+ </event-definition>
+
+ <event-definition>
+ <name>event3</name>
+ </event-definition>
+
+</portlet-app>
Added: modules/portlet/trunk/test/src/test/resources/jsr286/tck/portletconfignonamespace-war/WEB-INF/web.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/jsr286/tck/portletconfignonamespace-war/WEB-INF/web.xml (rev 0)
+++ modules/portlet/trunk/test/src/test/resources/jsr286/tck/portletconfignonamespace-war/WEB-INF/web.xml 2008-01-13 01:34:39 UTC (rev 9488)
@@ -0,0 +1,32 @@
+<?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>
+ <listener>
+ <listener-class>org.jboss.portal.unit.PortletTestSuite</listener-class>
+ </listener>
+</web-app>
Modified: modules/portlet/trunk/test/src/test/resources/test/remote-jboss-unit.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/test/remote-jboss-unit.xml 2008-01-13 00:40:13 UTC (rev 9487)
+++ modules/portlet/trunk/test/src/test/resources/test/remote-jboss-unit.xml 2008-01-13 01:34:39 UTC (rev 9488)
@@ -5,6 +5,7 @@
xsi:schemaLocation="urn:jboss:jboss-unit:1.0 jboss-unit_1_0.xsd">
<!--Spec TCK Assertions tests-->
+<!--
<generic>
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr168-tck-dispatcher.war"/>
@@ -49,8 +50,10 @@
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr168-tck-windowstates.war"/>
</generic>
+-->
<!--API Tests-->
+<!--
<generic>
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr168-api-actionrequest.war"/>
@@ -103,8 +106,10 @@
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr168-api-windowstate.war"/>
</generic>
+-->
<!--Ext Tests-->
+<!--
<generic>
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr168-ext-dispatcher.war"/>
@@ -145,12 +150,17 @@
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr168-ext-nocache.war"/>
</generic>
+-->
<!--Spec TCK Assertions tests-->
<generic>
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr286-tck-portletconfig.war"/>
</generic>
+ <generic>
+ <class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
+ <property name="archiveId" value="test-jsr286-tck-portletconfignonamespace.war"/>
+ </generic>
<!--Misc Tests-->
<!--
18 years, 3 months