http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/d2605cda/portlet-tck_3.0/V2AddlPortletTests/src/main/java/javax/portlet/tck/portlets/AddlPortletTests_SPEC2_5_ActionHandling.java
----------------------------------------------------------------------
diff --git a/portlet-tck_3.0/V2AddlPortletTests/src/main/java/javax/portlet/tck/portlets/AddlPortletTests_SPEC2_5_ActionHandling.java b/portlet-tck_3.0/V2AddlPortletTests/src/main/java/javax/portlet/tck/portlets/AddlPortletTests_SPEC2_5_ActionHandling.java
index 1dc5dd0..93f0c06 100644
--- a/portlet-tck_3.0/V2AddlPortletTests/src/main/java/javax/portlet/tck/portlets/AddlPortletTests_SPEC2_5_ActionHandling.java
+++ b/portlet-tck_3.0/V2AddlPortletTests/src/main/java/javax/portlet/tck/portlets/AddlPortletTests_SPEC2_5_ActionHandling.java
@@ -1,213 +1,147 @@
-/* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package javax.portlet.tck.portlets;
import java.io.*;
-import java.util.*;
import java.util.logging.*;
-import static java.util.logging.Logger.*;
import javax.xml.namespace.QName;
import javax.portlet.*;
-import javax.portlet.filter.*;
-import javax.servlet.*;
-import javax.servlet.http.*;
import javax.portlet.tck.beans.*;
import javax.portlet.tck.constants.*;
import static javax.portlet.tck.beans.JSR286SpecTestCaseDetails.*;
import static javax.portlet.tck.constants.Constants.*;
import static javax.portlet.PortletSession.*;
-import static javax.portlet.ResourceURL.*;
/**
- * This portlet implements several test cases for the JSR 362 TCK. The test case names
- * are defined in the /src/main/resources/xml-resources/additionalTCs.xml
- * file. The build process will integrate the test case names defined in the
- * additionalTCs.xml file into the complete list of test case names for execution by the driver.
- *
- * This is the main portlet for the test cases. If the test cases call for events, this portlet
- * will initiate the events, but not process them. The processing is done in the companion
- * portlet AddlPortletTests_SPEC2_5_ActionHandling_event
+ * This portlet implements several test cases for the JSR 362 TCK. The test case names are defined
+ * in the /src/main/resources/xml-resources/additionalTCs.xml file. The build process will integrate
+ * the test case names defined in the additionalTCs.xml file into the complete list of test case
+ * names for execution by the driver.
*
+ * This is the main portlet for the test cases. If the test cases call for events, this portlet will
+ * initiate the events, but not process them. The processing is done in the companion portlet
+ * AddlPortletTests_SPEC2_5_ActionHandling_event
+ * @author ahmed
*/
-public class AddlPortletTests_SPEC2_5_ActionHandling implements Portlet, ResourceServingPortlet {
- private static final String LOG_CLASS =
- AddlPortletTests_SPEC2_5_ActionHandling.class.getName();
- private final Logger LOGGER = Logger.getLogger(LOG_CLASS);
-
- private PortletConfig portletConfig = null;
-
- @Override
- public void init(PortletConfig config) throws PortletException {
- this.portletConfig = config;
- }
-
- @Override
- public void destroy() {
- }
-
- @Override
- public void processAction(ActionRequest portletReq, ActionResponse portletResp)
- throws PortletException, IOException {
- LOGGER.entering(LOG_CLASS, "main portlet processAction entry");
-
- portletResp.setRenderParameters(portletReq.getParameterMap());
- long tid = Thread.currentThread().getId();
- portletReq.setAttribute(THREADID_ATTR, tid);
-
- StringWriter writer = new StringWriter();
-
- JSR286SpecTestCaseDetails tcd = new JSR286SpecTestCaseDetails();
-
- // Create result objects for the tests
-
- /* TestCase: V2AddlPortletTests_SPEC2_5_ActionHandling_action5 */
- /* Details: "If the portlet issues a redirect during action */
- /* processing, the portlet container allows the processAction method */
- /* to complete" */
- TestResult tr0 = tcd.getTestResultFailed(V2ADDLPORTLETTESTS_SPEC2_5_ACTIONHANDLING_ACTION5);
- /* TODO: implement test */
- tr0.appendTcDetail("Not implemented.");
- tr0.writeTo(writer);
-
- /* TestCase: V2AddlPortletTests_SPEC2_5_ActionHandling_action6 */
- /* Details: "If the portlet issues a redirect during action */
- /* processing, the portlet container must send the redirect back to */
- /* the user agent and finalize the request processing." */
- TestResult tr1 = tcd.getTestResultFailed(V2ADDLPORTLETTESTS_SPEC2_5_ACTIONHANDLING_ACTION6);
- /* TODO: implement test */
- tr1.appendTcDetail("Not implemented.");
- tr1.writeTo(writer);
-
- /* TestCase: V2AddlPortletTests_SPEC2_5_ActionHandling_action7 */
- /* Details: "If the portlet issues a redirect during action */
- /* processing, events that were set are not processed" */
- TestResult tr2 = tcd.getTestResultFailed(V2ADDLPORTLETTESTS_SPEC2_5_ACTIONHANDLING_ACTION7);
- /* TODO: implement test */
- tr2.appendTcDetail("Not implemented.");
- tr2.writeTo(writer);
-
- /* TestCase: V2AddlPortletTests_SPEC2_5_ActionHandling_exception1 */
- /* Details: "If the portlet throws an PortletException in */
- /* processAction, all operations on the ActionResponse, including set */
- /* events, must be ignored" */
- TestResult tr3 = tcd.getTestResultFailed(V2ADDLPORTLETTESTS_SPEC2_5_ACTIONHANDLING_EXCEPTION1);
- /* TODO: implement test */
- tr3.appendTcDetail("Not implemented.");
- tr3.writeTo(writer);
-
- /* TestCase: V2AddlPortletTests_SPEC2_5_ActionHandling_exception2 */
- /* Details: "If the portlet throws a RuntimeException in */
- /* processAction, all operations on the ActionResponse, including set */
- /* events, must be ignored" */
- TestResult tr4 = tcd.getTestResultFailed(V2ADDLPORTLETTESTS_SPEC2_5_ACTIONHANDLING_EXCEPTION2);
- /* TODO: implement test */
- tr4.appendTcDetail("Not implemented.");
- tr4.writeTo(writer);
-
- portletReq.getPortletSession().setAttribute(
- Constants.RESULT_ATTR_PREFIX + "AddlPortletTests_SPEC2_5_ActionHandling",
- writer.toString(), APPLICATION_SCOPE);
- }
-
- @Override
- public void serveResource(ResourceRequest portletReq, ResourceResponse portletResp)
- throws PortletException, IOException {
- LOGGER.entering(LOG_CLASS, "main portlet serveResource entry");
-
- long tid = Thread.currentThread().getId();
- portletReq.setAttribute(THREADID_ATTR, tid);
-
- PrintWriter writer = portletResp.getWriter();
-
- }
-
- @Override
- public void render(RenderRequest portletReq, RenderResponse portletResp)
- throws PortletException, IOException {
- LOGGER.entering(LOG_CLASS, "main portlet render entry");
-
- long tid = Thread.currentThread().getId();
- portletReq.setAttribute(THREADID_ATTR, tid);
-
- PrintWriter writer = portletResp.getWriter();
-
- PortletSession ps = portletReq.getPortletSession();
- String msg = (String) ps.getAttribute(RESULT_ATTR_PREFIX + "AddlPortletTests_SPEC2_5_ActionHandling", APPLICATION_SCOPE);
- if (msg != null) {
- writer.write("<p>" + msg + "</p><br/>\n");
- ps.removeAttribute(RESULT_ATTR_PREFIX + "AddlPortletTests_SPEC2_5_ActionHandling", APPLICATION_SCOPE);
- }
-
- /* TestCase: V2AddlPortletTests_SPEC2_5_ActionHandling_action5 */
- /* Details: "If the portlet issues a redirect during action */
- /* processing, the portlet container allows the processAction method */
- /* to complete" */
- {
- PortletURL aurl = portletResp.createActionURL();
- aurl.setParameters(portletReq.getPrivateParameterMap());
- TestButton tb = new TestButton("V2AddlPortletTests_SPEC2_5_ActionHandling_action5", aurl);
- tb.writeTo(writer);
- }
-
- /* TestCase: V2AddlPortletTests_SPEC2_5_ActionHandling_action6 */
- /* Details: "If the portlet issues a redirect during action */
- /* processing, the portlet container must send the redirect back to */
- /* the user agent and finalize the request processing." */
- {
- PortletURL aurl = portletResp.createActionURL();
- aurl.setParameters(portletReq.getPrivateParameterMap());
- TestButton tb = new TestButton("V2AddlPortletTests_SPEC2_5_ActionHandling_action6", aurl);
- tb.writeTo(writer);
- }
-
- /* TestCase: V2AddlPortletTests_SPEC2_5_ActionHandling_action7 */
- /* Details: "If the portlet issues a redirect during action */
- /* processing, events that were set are not processed" */
- {
- PortletURL aurl = portletResp.createActionURL();
- aurl.setParameters(portletReq.getPrivateParameterMap());
- TestButton tb = new TestButton("V2AddlPortletTests_SPEC2_5_ActionHandling_action7", aurl);
- tb.writeTo(writer);
- }
-
- /* TestCase: V2AddlPortletTests_SPEC2_5_ActionHandling_exception1 */
- /* Details: "If the portlet throws an PortletException in */
- /* processAction, all operations on the ActionResponse, including set */
- /* events, must be ignored" */
- {
- PortletURL aurl = portletResp.createActionURL();
- aurl.setParameters(portletReq.getPrivateParameterMap());
- TestButton tb = new TestButton("V2AddlPortletTests_SPEC2_5_ActionHandling_exception1", aurl);
- tb.writeTo(writer);
- }
-
- /* TestCase: V2AddlPortletTests_SPEC2_5_ActionHandling_exception2 */
- /* Details: "If the portlet throws a RuntimeException in */
- /* processAction, all operations on the ActionResponse, including set */
- /* events, must be ignored" */
- {
- PortletURL aurl = portletResp.createActionURL();
- aurl.setParameters(portletReq.getPrivateParameterMap());
- TestButton tb = new TestButton("V2AddlPortletTests_SPEC2_5_ActionHandling_exception2", aurl);
- tb.writeTo(writer);
- }
-
- }
+public class AddlPortletTests_SPEC2_5_ActionHandling implements Portlet {
+ private static final String LOG_CLASS = AddlPortletTests_SPEC2_5_ActionHandling.class.getName();
+ private final Logger LOGGER = Logger.getLogger(LOG_CLASS);
+
+
+ @Override
+ public void init(PortletConfig config) throws PortletException {}
+
+ @Override
+ public void destroy() {}
+
+ @Override
+ public void processAction(ActionRequest portletReq, ActionResponse portletResp)
+ throws PortletException, IOException {
+ LOGGER.entering(LOG_CLASS, "main portlet processAction entry");
+ portletResp.sendRedirect(portletReq.getProperty("Referer"));
+
+ StringWriter writer = new StringWriter();
+
+ JSR286SpecTestCaseDetails tcd = new JSR286SpecTestCaseDetails();
+
+ // Create result objects for the tests
+
+ /* TestCase: V2AddlPortletTests_SPEC2_5_ActionHandling_action5 */
+ /* Details: "If the portlet issues a redirect during action */
+ /* processing, the portlet container allows the processAction method */
+ /* to complete" */
+ TestResult tr0 = tcd.getTestResultFailed(V2ADDLPORTLETTESTS_SPEC2_5_ACTIONHANDLING_ACTION5);
+ tr0.setTcSuccess(true);
+ tr0.writeTo(writer);
+
+ /* TestCase: V2AddlPortletTests_SPEC2_5_ActionHandling_action6 */
+ /* Details: "If the portlet issues a redirect during action */
+ /* processing, the portlet container must send the redirect back to */
+ /* the user agent and finalize the request processing." */
+ TestResult tr1 = tcd.getTestResultFailed(V2ADDLPORTLETTESTS_SPEC2_5_ACTIONHANDLING_ACTION6);
+ tr1.setTcSuccess(true);
+ tr1.writeTo(writer);
+
+ /* TestCase: V2AddlPortletTests_SPEC2_5_ActionHandling_action7 */
+ /* Details: "If the portlet issues a redirect during action */
+ /* processing, events that were set are not processed" */
+ QName eventQName = new QName(TCKNAMESPACE, "AddlPortletTests_SPEC2_5_ActionHandling");
+ portletResp.setEvent(eventQName, "Hi!");
+
+ portletReq.getPortletSession().setAttribute(
+ Constants.RESULT_ATTR_PREFIX + "AddlPortletTests_SPEC2_5_ActionHandling_event_tr2", "true",
+ APPLICATION_SCOPE);
+
+ portletReq.getPortletSession().setAttribute(
+ Constants.RESULT_ATTR_PREFIX + "AddlPortletTests_SPEC2_5_ActionHandling", writer.toString(),
+ APPLICATION_SCOPE);
+ }
+
+ @Override
+ public void render(RenderRequest portletReq, RenderResponse portletResp)
+ throws PortletException, IOException {
+ LOGGER.entering(LOG_CLASS, "main portlet render entry");
+
+ long tid = Thread.currentThread().getId();
+ portletReq.setAttribute(THREADID_ATTR, tid);
+
+ PrintWriter writer = portletResp.getWriter();
+
+ PortletSession ps = portletReq.getPortletSession();
+ String msg =
+ (String) ps.getAttribute(RESULT_ATTR_PREFIX + "AddlPortletTests_SPEC2_5_ActionHandling",
+ APPLICATION_SCOPE);
+ if (msg != null) {
+ writer.write("<p>" + msg + "</p><br/>\n");
+ ps.removeAttribute(RESULT_ATTR_PREFIX + "AddlPortletTests_SPEC2_5_ActionHandling",
+ APPLICATION_SCOPE);
+ }
+
+ /* TestCase: V2AddlPortletTests_SPEC2_5_ActionHandling_action5 */
+ /* Details: "If the portlet issues a redirect during action */
+ /* processing, the portlet container allows the processAction method */
+ /* to complete" */
+ {
+ PortletURL aurl = portletResp.createActionURL();
+ aurl.setParameters(portletReq.getPrivateParameterMap());
+ TestButton tb = new TestButton("V2AddlPortletTests_SPEC2_5_ActionHandling_action5", aurl);
+ tb.writeTo(writer);
+ }
+
+ /* TestCase: V2AddlPortletTests_SPEC2_5_ActionHandling_action6 */
+ /* Details: "If the portlet issues a redirect during action */
+ /* processing, the portlet container must send the redirect back to */
+ /* the user agent and finalize the request processing." */
+ {
+ PortletURL aurl = portletResp.createActionURL();
+ aurl.setParameters(portletReq.getPrivateParameterMap());
+ TestButton tb = new TestButton("V2AddlPortletTests_SPEC2_5_ActionHandling_action6", aurl);
+ tb.writeTo(writer);
+ }
+
+ /* TestCase: V2AddlPortletTests_SPEC2_5_ActionHandling_action7 */
+ /* Details: "If the portlet issues a redirect during action */
+ /* processing, events that were set are not processed" */
+ {
+ PortletURL aurl = portletResp.createActionURL();
+ aurl.setParameters(portletReq.getPrivateParameterMap());
+ TestButton tb = new TestButton("V2AddlPortletTests_SPEC2_5_ActionHandling_action7", aurl);
+ tb.writeTo(writer);
+ }
+
+ }
}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/d2605cda/portlet-tck_3.0/V2AddlPortletTests/src/main/java/javax/portlet/tck/portlets/AddlPortletTests_SPEC2_5_ActionHandling_event.java
----------------------------------------------------------------------
diff --git a/portlet-tck_3.0/V2AddlPortletTests/src/main/java/javax/portlet/tck/portlets/AddlPortletTests_SPEC2_5_ActionHandling_event.java b/portlet-tck_3.0/V2AddlPortletTests/src/main/java/javax/portlet/tck/portlets/AddlPortletTests_SPEC2_5_ActionHandling_event.java
new file mode 100644
index 0000000..c263993
--- /dev/null
+++ b/portlet-tck_3.0/V2AddlPortletTests/src/main/java/javax/portlet/tck/portlets/AddlPortletTests_SPEC2_5_ActionHandling_event.java
@@ -0,0 +1,171 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package javax.portlet.tck.portlets;
+
+import java.io.*;
+import java.util.logging.*;
+import javax.xml.namespace.QName;
+import javax.portlet.*;
+import javax.portlet.tck.beans.*;
+import javax.portlet.tck.constants.*;
+import static javax.portlet.tck.constants.Constants.*;
+import static javax.portlet.tck.beans.JSR286SpecTestCaseDetails.*;
+import static javax.portlet.PortletSession.*;
+
+/**
+ * This is the event processing portlet for the test cases. This portlet processes events, but does
+ * not publish them. Events are published in the main portlet for the test cases.
+ * @author ahmed
+ */
+public class AddlPortletTests_SPEC2_5_ActionHandling_event implements Portlet, EventPortlet {
+ private static final String LOG_CLASS =
+ AddlPortletTests_SPEC2_5_ActionHandling_event.class.getName();
+ private final Logger LOGGER = Logger.getLogger(LOG_CLASS);
+
+ private boolean tr2 = false;
+ private boolean tr3 = false;
+ private boolean tr4 = false;
+
+ @Override
+ public void init(PortletConfig config) throws PortletException {}
+
+ @Override
+ public void destroy() {}
+
+ @Override
+ public void processAction(ActionRequest portletReq, ActionResponse portletResp)
+ throws PortletException, IOException {
+ LOGGER.entering(LOG_CLASS, "event companion processAction entry");
+ portletResp.setRenderParameters(portletReq.getParameterMap());
+ long tid = Thread.currentThread().getId();
+ portletReq.setAttribute(THREADID_ATTR, tid);
+
+ String action = portletReq.getParameter("inputval");
+ if (action != null) {
+ if (action.equals("V2AddlPortletTests_SPEC2_5_ActionHandling_exception1")) {
+ /* TestCase: V2AddlPortletTests_SPEC2_5_ActionHandling_exception1 */
+ /* Details: "If the portlet throws an PortletException in */
+ /* processAction, all operations on the ActionResponse, including set */
+ /* events, must be ignored" */
+ // TODO: PortletException is not handled by pluto
+ portletResp.setRenderParameter("tr3_action", "true");
+ portletReq.getPortletSession().setAttribute(
+ Constants.RESULT_ATTR_PREFIX + "AddlPortletTests_SPEC2_5_ActionHandling_event_tr3",
+ "true", APPLICATION_SCOPE);
+ QName eventQName = new QName(TCKNAMESPACE, "AddlPortletTests_SPEC2_5_ActionHandling");
+ portletResp.setEvent(eventQName, "Hi!");
+ throw new PortletException(
+ "PortletException from V2AddlPortletTests_SPEC2_5_ActionHandling_exception1");
+ } else if (action.equals("V2AddlPortletTests_SPEC2_5_ActionHandling_exception2")) {
+ /* TestCase: V2AddlPortletTests_SPEC2_5_ActionHandling_exception2 */
+ /* Details: "If the portlet throws a RuntimeException in */
+ /* processAction, all operations on the ActionResponse, including set */
+ /* events, must be ignored" */
+ // TODO: RuntimeException is not handled by pluto
+ portletResp.setRenderParameter("tr4_action", "true");
+ portletReq.getPortletSession().setAttribute(
+ Constants.RESULT_ATTR_PREFIX + "AddlPortletTests_SPEC2_5_ActionHandling_event_tr4",
+ "true", APPLICATION_SCOPE);
+ QName eventQName = new QName(TCKNAMESPACE, "AddlPortletTests_SPEC2_5_ActionHandling");
+ portletResp.setEvent(eventQName, "Hi!");
+ throw new RuntimeException(
+ "RuntimeException from V2AddlPortletTests_SPEC2_5_ActionHandling_exception2");
+ }
+ }
+ }
+
+ @Override
+ public void processEvent(EventRequest portletReq, EventResponse portletResp)
+ throws PortletException, IOException {
+ LOGGER.entering(LOG_CLASS, "event companion processEvent");
+ this.tr2 = true;
+ this.tr3 = true;
+ this.tr4 = true;
+ }
+
+ @Override
+ public void render(RenderRequest portletReq, RenderResponse portletResp)
+ throws PortletException, IOException {
+
+ LOGGER.entering(LOG_CLASS, "event companion render");
+ JSR286SpecTestCaseDetails tcd = new JSR286SpecTestCaseDetails();
+
+ PortletSession ps = portletReq.getPortletSession();
+ portletResp.setContentType("text/html");
+ PrintWriter writer = portletResp.getWriter();
+ writer.write("<h3>Event Companion Portlet </h3>\n");
+ writer.write("<p>AddlPortletTests_SPEC2_15_ActionHandling_event</p>\n");
+
+ /* TestCase: V2AddlPortletTests_SPEC2_5_ActionHandling_exception1 */
+ /* Details: "If the portlet throws an PortletException in */
+ /* processAction, all operations on the ActionResponse, including set */
+ /* events, must be ignored" */
+ // TODO: PortletException is not handled by pluto
+ String tr3_success = (String) ps.getAttribute(
+ RESULT_ATTR_PREFIX + "AddlPortletTests_SPEC2_5_ActionHandling_event_tr3",
+ APPLICATION_SCOPE);
+ if (tr3_success != null && tr3_success.equals("true") && !this.tr3
+ && portletReq.getParameter("tr3_action") == null) {
+ TestResult tr3 =
+ tcd.getTestResultFailed(V2ADDLPORTLETTESTS_SPEC2_5_ACTIONHANDLING_EXCEPTION1);
+ tr3.setTcSuccess(true);
+ tr3.writeTo(writer);
+ } else {
+ PortletURL aurl = portletResp.createActionURL();
+ aurl.setParameters(portletReq.getPrivateParameterMap());
+ TestButton tb = new TestButton("V2AddlPortletTests_SPEC2_5_ActionHandling_exception1", aurl);
+ tb.writeTo(writer);
+ }
+
+ /* TestCase: V2AddlPortletTests_SPEC2_5_ActionHandling_exception2 */
+ /* Details: "If the portlet throws a RuntimeException in */
+ /* processAction, all operations on the ActionResponse, including set */
+ /* events, must be ignored" */
+ // TODO: RuntimeException is not handled by pluto
+ String tr4_success = (String) ps.getAttribute(
+ RESULT_ATTR_PREFIX + "AddlPortletTests_SPEC2_5_ActionHandling_event_tr4",
+ APPLICATION_SCOPE);
+ if (tr4_success != null && tr4_success.equals("true") && !this.tr4
+ && portletReq.getParameter("tr4_action") == null) {
+ TestResult tr3 =
+ tcd.getTestResultFailed(V2ADDLPORTLETTESTS_SPEC2_5_ACTIONHANDLING_EXCEPTION1);
+ tr3.setTcSuccess(true);
+ tr3.writeTo(writer);
+ } else {
+ PortletURL aurl = portletResp.createActionURL();
+ aurl.setParameters(portletReq.getPrivateParameterMap());
+ TestButton tb = new TestButton("V2AddlPortletTests_SPEC2_5_ActionHandling_exception2", aurl);
+ tb.writeTo(writer);
+ }
+
+ /* TestCase: V2AddlPortletTests_SPEC2_5_ActionHandling_action7 */
+ /* Details: "If the portlet issues a redirect during action */
+ /* processing, events that were set are not processed" */
+ String tr2_success = (String) ps.getAttribute(
+ RESULT_ATTR_PREFIX + "AddlPortletTests_SPEC2_5_ActionHandling_event_tr2",
+ APPLICATION_SCOPE);
+ TestResult tr2 = tcd.getTestResultFailed(V2ADDLPORTLETTESTS_SPEC2_5_ACTIONHANDLING_ACTION7);
+ if (!this.tr2 && tr2_success != null && tr2_success.equals("true")) {
+ tr2.setTcSuccess(true);
+ } else {
+ tr2.appendTcDetail(
+ "Failed because ProcessEvent method of AddlPortletTests_SPEC2_5_ActionHandling_event portlet is called after sending redirect");
+ }
+ tr2.writeTo(writer);
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/d2605cda/portlet-tck_3.0/V2AddlPortletTests/src/main/java/javax/portlet/tck/portlets/AddlPortletTests_SPEC2_5_EventHandling.java
----------------------------------------------------------------------
diff --git a/portlet-tck_3.0/V2AddlPortletTests/src/main/java/javax/portlet/tck/portlets/AddlPortletTests_SPEC2_5_EventHandling.java b/portlet-tck_3.0/V2AddlPortletTests/src/main/java/javax/portlet/tck/portlets/AddlPortletTests_SPEC2_5_EventHandling.java
index c9fb1db..5c10786 100644
--- a/portlet-tck_3.0/V2AddlPortletTests/src/main/java/javax/portlet/tck/portlets/AddlPortletTests_SPEC2_5_EventHandling.java
+++ b/portlet-tck_3.0/V2AddlPortletTests/src/main/java/javax/portlet/tck/portlets/AddlPortletTests_SPEC2_5_EventHandling.java
@@ -1,126 +1,99 @@
-/* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package javax.portlet.tck.portlets;
import java.io.*;
-import java.util.*;
import java.util.logging.*;
-import static java.util.logging.Logger.*;
import javax.xml.namespace.QName;
import javax.portlet.*;
-import javax.portlet.filter.*;
-import javax.servlet.*;
-import javax.servlet.http.*;
import javax.portlet.tck.beans.*;
-import javax.portlet.tck.constants.*;
-import static javax.portlet.tck.beans.JSR286SpecTestCaseDetails.*;
import static javax.portlet.tck.constants.Constants.*;
-import static javax.portlet.PortletSession.*;
-import static javax.portlet.ResourceURL.*;
/**
- * This portlet implements several test cases for the JSR 362 TCK. The test case names
- * are defined in the /src/main/resources/xml-resources/additionalTCs.xml
- * file. The build process will integrate the test case names defined in the
- * additionalTCs.xml file into the complete list of test case names for execution by the driver.
- *
- * This is the main portlet for the test cases. If the test cases call for events, this portlet
- * will initiate the events, but not process them. The processing is done in the companion
- * portlet AddlPortletTests_SPEC2_5_EventHandling_event
+ * This portlet implements several test cases for the JSR 362 TCK. The test case names are defined
+ * in the /src/main/resources/xml-resources/additionalTCs.xml file. The build process will integrate
+ * the test case names defined in the additionalTCs.xml file into the complete list of test case
+ * names for execution by the driver.
*
+ * This is the main portlet for the test cases. If the test cases call for events, this portlet will
+ * initiate the events, but not process them. The processing is done in the companion portlet
+ * AddlPortletTests_SPEC2_5_EventHandling_event
+ * @author ahmed
*/
-public class AddlPortletTests_SPEC2_5_EventHandling implements Portlet, ResourceServingPortlet {
- private static final String LOG_CLASS =
- AddlPortletTests_SPEC2_5_EventHandling.class.getName();
- private final Logger LOGGER = Logger.getLogger(LOG_CLASS);
-
- private PortletConfig portletConfig = null;
-
- @Override
- public void init(PortletConfig config) throws PortletException {
- this.portletConfig = config;
- }
-
- @Override
- public void destroy() {
- }
-
- @Override
- public void processAction(ActionRequest portletReq, ActionResponse portletResp)
- throws PortletException, IOException {
- LOGGER.entering(LOG_CLASS, "main portlet processAction entry");
-
- portletResp.setRenderParameters(portletReq.getParameterMap());
- long tid = Thread.currentThread().getId();
- portletReq.setAttribute(THREADID_ATTR, tid);
-
- StringWriter writer = new StringWriter();
-
- QName eventQName = new QName(TCKNAMESPACE,
- "AddlPortletTests_SPEC2_5_EventHandling");
- portletResp.setEvent(eventQName, "Hi!");
- }
-
- @Override
- public void serveResource(ResourceRequest portletReq, ResourceResponse portletResp)
- throws PortletException, IOException {
- LOGGER.entering(LOG_CLASS, "main portlet serveResource entry");
-
- long tid = Thread.currentThread().getId();
- portletReq.setAttribute(THREADID_ATTR, tid);
-
- PrintWriter writer = portletResp.getWriter();
-
- }
-
- @Override
- public void render(RenderRequest portletReq, RenderResponse portletResp)
- throws PortletException, IOException {
- LOGGER.entering(LOG_CLASS, "main portlet render entry");
-
- long tid = Thread.currentThread().getId();
- portletReq.setAttribute(THREADID_ATTR, tid);
-
- PrintWriter writer = portletResp.getWriter();
-
- /* TestCase: V2AddlPortletTests_SPEC2_5_EventHandling_exception4 */
- /* Details: "If the portlet throws an PortletException in */
- /* processEvent, all operations on the EventResponse, including set */
- /* events, must be ignored" */
- {
- PortletURL aurl = portletResp.createActionURL();
- aurl.setParameters(portletReq.getPrivateParameterMap());
- TestButton tb = new TestButton("V2AddlPortletTests_SPEC2_5_EventHandling_exception4", aurl);
- tb.writeTo(writer);
- }
-
- /* TestCase: V2AddlPortletTests_SPEC2_5_EventHandling_exception5 */
- /* Details: "If the portlet throws a RuntimeException in */
- /* processEvent, all operations on the EventResponse, including set */
- /* events, must be ignored" */
- {
- PortletURL aurl = portletResp.createActionURL();
- aurl.setParameters(portletReq.getPrivateParameterMap());
- TestButton tb = new TestButton("V2AddlPortletTests_SPEC2_5_EventHandling_exception5", aurl);
- tb.writeTo(writer);
- }
-
- }
+public class AddlPortletTests_SPEC2_5_EventHandling implements Portlet {
+ private static final String LOG_CLASS = AddlPortletTests_SPEC2_5_EventHandling.class.getName();
+ private final Logger LOGGER = Logger.getLogger(LOG_CLASS);
+
+
+ @Override
+ public void init(PortletConfig config) throws PortletException {}
+
+ @Override
+ public void destroy() {}
+
+ @Override
+ public void processAction(ActionRequest portletReq, ActionResponse portletResp)
+ throws PortletException, IOException {
+ LOGGER.entering(LOG_CLASS, "main portlet processAction entry");
+
+ portletResp.setRenderParameters(portletReq.getParameterMap());
+ long tid = Thread.currentThread().getId();
+ portletReq.setAttribute(THREADID_ATTR, tid);
+
+ QName eventQName_tr0 =
+ new QName(TCKNAMESPACE, "AddlPortletTests_SPEC2_5_EventHandling_exception4");
+ portletResp.setEvent(eventQName_tr0, "Hi!");
+
+ QName eventQName_tr1 =
+ new QName(TCKNAMESPACE, "AddlPortletTests_SPEC2_5_EventHandling_exception5");
+ portletResp.setEvent(eventQName_tr1, "Hi!");
+ }
+
+ @Override
+ public void render(RenderRequest portletReq, RenderResponse portletResp)
+ throws PortletException, IOException {
+ LOGGER.entering(LOG_CLASS, "main portlet render entry");
+
+ long tid = Thread.currentThread().getId();
+ portletReq.setAttribute(THREADID_ATTR, tid);
+
+ PrintWriter writer = portletResp.getWriter();
+
+ /* TestCase: V2AddlPortletTests_SPEC2_5_EventHandling_exception4 */
+ /* Details: "If the portlet throws an PortletException in */
+ /* processEvent, all operations on the EventResponse, including set */
+ /* events, must be ignored" */
+ {
+ PortletURL aurl = portletResp.createActionURL();
+ aurl.setParameters(portletReq.getPrivateParameterMap());
+ TestButton tb = new TestButton("V2AddlPortletTests_SPEC2_5_EventHandling_exception4", aurl);
+ tb.writeTo(writer);
+ }
+
+ /* TestCase: V2AddlPortletTests_SPEC2_5_EventHandling_exception5 */
+ /* Details: "If the portlet throws a RuntimeException in */
+ /* processEvent, all operations on the EventResponse, including set */
+ /* events, must be ignored" */
+ {
+ PortletURL aurl = portletResp.createActionURL();
+ aurl.setParameters(portletReq.getPrivateParameterMap());
+ TestButton tb = new TestButton("V2AddlPortletTests_SPEC2_5_EventHandling_exception5", aurl);
+ tb.writeTo(writer);
+ }
+
+ }
}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/d2605cda/portlet-tck_3.0/V2AddlPortletTests/src/main/java/javax/portlet/tck/portlets/AddlPortletTests_SPEC2_5_EventHandling_event.java
----------------------------------------------------------------------
diff --git a/portlet-tck_3.0/V2AddlPortletTests/src/main/java/javax/portlet/tck/portlets/AddlPortletTests_SPEC2_5_EventHandling_event.java b/portlet-tck_3.0/V2AddlPortletTests/src/main/java/javax/portlet/tck/portlets/AddlPortletTests_SPEC2_5_EventHandling_event.java
index 3db4030..9147fcd 100644
--- a/portlet-tck_3.0/V2AddlPortletTests/src/main/java/javax/portlet/tck/portlets/AddlPortletTests_SPEC2_5_EventHandling_event.java
+++ b/portlet-tck_3.0/V2AddlPortletTests/src/main/java/javax/portlet/tck/portlets/AddlPortletTests_SPEC2_5_EventHandling_event.java
@@ -19,14 +19,8 @@
package javax.portlet.tck.portlets;
import java.io.*;
-import java.util.*;
import java.util.logging.*;
-import static java.util.logging.Logger.*;
-import javax.xml.namespace.QName;
import javax.portlet.*;
-import javax.portlet.filter.*;
-import javax.servlet.*;
-import javax.servlet.http.*;
import javax.portlet.tck.beans.*;
import javax.portlet.tck.constants.*;
import static javax.portlet.tck.constants.Constants.*;
@@ -36,18 +30,15 @@ import static javax.portlet.PortletSession.*;
/**
* This is the event processing portlet for the test cases. This portlet processes events,
* but does not publish them. Events are published in the main portlet for the test cases.
+ * @author ahmed
*/
-public class AddlPortletTests_SPEC2_5_EventHandling_event implements Portlet, EventPortlet, ResourceServingPortlet {
+public class AddlPortletTests_SPEC2_5_EventHandling_event implements Portlet, EventPortlet {
private static final String LOG_CLASS =
AddlPortletTests_SPEC2_5_EventHandling_event.class.getName();
private final Logger LOGGER = Logger.getLogger(LOG_CLASS);
-
- private PortletConfig portletConfig = null;
@Override
- public void init(PortletConfig config) throws PortletException {
- this.portletConfig = config;
- }
+ public void init(PortletConfig config) throws PortletException {}
@Override
public void destroy() {
@@ -60,12 +51,6 @@ public class AddlPortletTests_SPEC2_5_EventHandling_event implements Portlet, Ev
}
@Override
- public void serveResource(ResourceRequest portletReq, ResourceResponse portletResp)
- throws PortletException, IOException {
- LOGGER.entering(LOG_CLASS, "event companion serveResource - ERROR!!");
- }
-
- @Override
public void processEvent(EventRequest portletReq, EventResponse portletResp)
throws PortletException, IOException {
LOGGER.entering(LOG_CLASS, "event companion processEvent");
@@ -75,51 +60,84 @@ public class AddlPortletTests_SPEC2_5_EventHandling_event implements Portlet, Ev
long tid = Thread.currentThread().getId();
portletReq.setAttribute(THREADID_ATTR, tid);
+
+ Event event = portletReq.getEvent();
+ String qName = event.getName();
+ if (qName.equals("AddlPortletTests_SPEC2_5_EventHandling_exception4")) {
+ /* TestCase: V2AddlPortletTests_SPEC2_5_EventHandling_exception4 */
+ /* Details: "If the portlet throws an PortletException in */
+ /* processEvent, all operations on the EventResponse, including set */
+ /* events, must be ignored" */
+ LOGGER.entering(LOG_CLASS, "First case");
+ portletResp.setRenderParameter("tr0", "true");
+ portletReq.getPortletSession().setAttribute(
+ Constants.RESULT_ATTR_PREFIX + "AddlPortletTests_SPEC2_5_EventHandling_portletException",
+ "true", APPLICATION_SCOPE);
+ throw new PortletException(
+ "PortletException from V2AddlPortletTests_SPEC2_5_EventHandling_exception4");
+ } else if(qName.equals("AddlPortletTests_SPEC2_5_EventHandling_exception5")){
+ /* TestCase: V2AddlPortletTests_SPEC2_5_EventHandling_exception5 */
+ /* Details: "If the portlet throws a RuntimeException in */
+ /* processEvent, all operations on the EventResponse, including set */
+ /* events, must be ignored" */
+ // TODO: RuntimeException is not handled by pluto. So, this test crashes.
+ // Report in JIRA
+ LOGGER.entering(LOG_CLASS, "Second case");
+ portletResp.setRenderParameter("tr1", "true");
+ portletReq.getPortletSession().setAttribute(
+ Constants.RESULT_ATTR_PREFIX + "AddlPortletTests_SPEC2_5_EventHandling_runtimeException",
+ "true", APPLICATION_SCOPE);
+ //throw new RuntimeException(
+ // "RuntimeException from V2AddlPortletTests_SPEC2_5_EventHandling_exception5");
+ }
- StringWriter writer = new StringWriter();
+ }
+ @Override
+ public void render(RenderRequest portletReq, RenderResponse portletResp)
+ throws PortletException, IOException {
+
+ LOGGER.entering(LOG_CLASS, "event companion render");
JSR286SpecTestCaseDetails tcd = new JSR286SpecTestCaseDetails();
-
- // Create result objects for the tests
-
+ portletResp.setContentType("text/html");
+ PrintWriter writer = portletResp.getWriter();
+ writer.write("<h3>Event Companion Portlet </h3>\n");
+ writer.write("<p>AddlPortletTests_SPEC2_5_EventHandling_event</p>\n");
+
+
/* TestCase: V2AddlPortletTests_SPEC2_5_EventHandling_exception4 */
/* Details: "If the portlet throws an PortletException in */
/* processEvent, all operations on the EventResponse, including set */
/* events, must be ignored" */
TestResult tr0 = tcd.getTestResultFailed(V2ADDLPORTLETTESTS_SPEC2_5_EVENTHANDLING_EXCEPTION4);
- /* TODO: implement test */
- tr0.appendTcDetail("Not implemented.");
- tr0.writeTo(writer);
-
+ String dataInEventResponse_tr0 = (String) portletReq.getPortletSession().getAttribute(
+ RESULT_ATTR_PREFIX + "AddlPortletTests_SPEC2_5_EventHandling_portletException",
+ APPLICATION_SCOPE);
+ if (dataInEventResponse_tr0 != null && dataInEventResponse_tr0.equals("true")
+ && portletReq.getParameter("tr0") == null) {
+ tr0.setTcSuccess(true);
+ } else {
+ tr0.appendTcDetail("Failed because data is set in EventResponse: " + dataInEventResponse_tr0);
+ }
+ String msg = tr0.toString();
+
/* TestCase: V2AddlPortletTests_SPEC2_5_EventHandling_exception5 */
/* Details: "If the portlet throws a RuntimeException in */
/* processEvent, all operations on the EventResponse, including set */
/* events, must be ignored" */
+ // TODO: RuntimeException is not handled by pluto. So, this test crashes.
TestResult tr1 = tcd.getTestResultFailed(V2ADDLPORTLETTESTS_SPEC2_5_EVENTHANDLING_EXCEPTION5);
- /* TODO: implement test */
- tr1.appendTcDetail("Not implemented.");
- tr1.writeTo(writer);
-
- portletReq.getPortletSession().setAttribute(
- Constants.RESULT_ATTR_PREFIX + "AddlPortletTests_SPEC2_5_EventHandling",
- writer.toString(), APPLICATION_SCOPE);
-
- }
-
- @Override
- public void render(RenderRequest portletReq, RenderResponse portletResp)
- throws PortletException, IOException {
+ String dataInEventResponse_tr1 = (String) portletReq.getPortletSession().getAttribute(
+ RESULT_ATTR_PREFIX + "AddlPortletTests_SPEC2_5_EventHandling_runtimeException",
+ APPLICATION_SCOPE);
+ if (dataInEventResponse_tr1 != null && dataInEventResponse_tr1.equals("true")
+ && portletReq.getParameter("tr1") == null) {
+ tr1.setTcSuccess(true);
+ } else {
+ tr1.appendTcDetail("Failed because data is set in EventResponse: " + dataInEventResponse_tr1);
+ }
+ msg = msg + tr1.toString();
- LOGGER.entering(LOG_CLASS, "event companion render");
-
- portletResp.setContentType("text/html");
- PrintWriter writer = portletResp.getWriter();
- writer.write("<h3>Event Companion Portlet </h3>\n");
- writer.write("<p>AddlPortletTests_SPEC2_5_EventHandling_event</p>\n");
-
- String msg = (String) portletReq.getPortletSession()
- .getAttribute(RESULT_ATTR_PREFIX + "AddlPortletTests_SPEC2_5_EventHandling", APPLICATION_SCOPE);
- msg = (msg==null) ? "Not ready. click test case link." : msg;
writer.write("<p>" + msg + "</p>\n");
}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/d2605cda/portlet-tck_3.0/V2AddlPortletTests/src/main/java/javax/portlet/tck/portlets/AddlPortletTests_SPEC2_5_Initialization.java
----------------------------------------------------------------------
diff --git a/portlet-tck_3.0/V2AddlPortletTests/src/main/java/javax/portlet/tck/portlets/AddlPortletTests_SPEC2_5_Initialization.java b/portlet-tck_3.0/V2AddlPortletTests/src/main/java/javax/portlet/tck/portlets/AddlPortletTests_SPEC2_5_Initialization.java
index 9c3dfea..14c77dd 100644
--- a/portlet-tck_3.0/V2AddlPortletTests/src/main/java/javax/portlet/tck/portlets/AddlPortletTests_SPEC2_5_Initialization.java
+++ b/portlet-tck_3.0/V2AddlPortletTests/src/main/java/javax/portlet/tck/portlets/AddlPortletTests_SPEC2_5_Initialization.java
@@ -1,113 +1,96 @@
-/* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package javax.portlet.tck.portlets;
import java.io.*;
-import java.util.*;
import java.util.logging.*;
-import static java.util.logging.Logger.*;
-import javax.xml.namespace.QName;
import javax.portlet.*;
-import javax.portlet.filter.*;
-import javax.servlet.*;
-import javax.servlet.http.*;
import javax.portlet.tck.beans.*;
-import javax.portlet.tck.constants.*;
import static javax.portlet.tck.beans.JSR286SpecTestCaseDetails.*;
import static javax.portlet.tck.constants.Constants.*;
-import static javax.portlet.PortletSession.*;
-import static javax.portlet.ResourceURL.*;
/**
- * This portlet implements several test cases for the JSR 362 TCK. The test case names
- * are defined in the /src/main/resources/xml-resources/additionalTCs.xml
- * file. The build process will integrate the test case names defined in the
- * additionalTCs.xml file into the complete list of test case names for execution by the driver.
- *
- * This is the main portlet for the test cases. If the test cases call for events, this portlet
- * will initiate the events, but not process them. The processing is done in the companion
- * portlet AddlPortletTests_SPEC2_5_Initialization_event
+ * This portlet implements several test cases for the JSR 362 TCK. The test case names are defined
+ * in the /src/main/resources/xml-resources/additionalTCs.xml file. The build process will integrate
+ * the test case names defined in the additionalTCs.xml file into the complete list of test case
+ * names for execution by the driver.
*
+ * This is the main portlet for the test cases. If the test cases call for events, this portlet will
+ * initiate the events, but not process them. The processing is done in the companion portlet
+ * AddlPortletTests_SPEC2_5_Initialization_event
+ * @author ahmed
*/
-public class AddlPortletTests_SPEC2_5_Initialization implements Portlet, ResourceServingPortlet {
- private static final String LOG_CLASS =
- AddlPortletTests_SPEC2_5_Initialization.class.getName();
- private final Logger LOGGER = Logger.getLogger(LOG_CLASS);
-
- private PortletConfig portletConfig = null;
-
- @Override
- public void init(PortletConfig config) throws PortletException {
- this.portletConfig = config;
- }
-
- @Override
- public void destroy() {
- }
-
- @Override
- public void processAction(ActionRequest portletReq, ActionResponse portletResp)
- throws PortletException, IOException {
- LOGGER.entering(LOG_CLASS, "main portlet processAction entry");
-
- portletResp.setRenderParameters(portletReq.getParameterMap());
- long tid = Thread.currentThread().getId();
- portletReq.setAttribute(THREADID_ATTR, tid);
-
- StringWriter writer = new StringWriter();
-
- }
-
- @Override
- public void serveResource(ResourceRequest portletReq, ResourceResponse portletResp)
- throws PortletException, IOException {
- LOGGER.entering(LOG_CLASS, "main portlet serveResource entry");
-
- long tid = Thread.currentThread().getId();
- portletReq.setAttribute(THREADID_ATTR, tid);
-
- PrintWriter writer = portletResp.getWriter();
-
- }
-
- @Override
- public void render(RenderRequest portletReq, RenderResponse portletResp)
- throws PortletException, IOException {
- LOGGER.entering(LOG_CLASS, "main portlet render entry");
-
- long tid = Thread.currentThread().getId();
- portletReq.setAttribute(THREADID_ATTR, tid);
-
- PrintWriter writer = portletResp.getWriter();
-
- JSR286SpecTestCaseDetails tcd = new JSR286SpecTestCaseDetails();
-
- // Create result objects for the tests
-
- /* TestCase: V2AddlPortletTests_SPEC2_5_Initialization_initialization6 */
- /* Details: "A RuntimeException thrown during initialization must be */
- /* handled as a PortletException" */
- TestResult tr0 = tcd.getTestResultFailed(V2ADDLPORTLETTESTS_SPEC2_5_INITIALIZATION_INITIALIZATION6);
- /* TODO: implement test */
- tr0.appendTcDetail("Not implemented.");
- tr0.writeTo(writer);
-
- }
+public class AddlPortletTests_SPEC2_5_Initialization implements Portlet {
+ private static final String LOG_CLASS = AddlPortletTests_SPEC2_5_Initialization.class.getName();
+ private final Logger LOGGER = Logger.getLogger(LOG_CLASS);
+
+
+ @Override
+ public void init(PortletConfig config) throws PortletException {
+ LOGGER.entering(LOG_CLASS, "main portlet init entry");
+ // TODO: How do I catch this exception as PortletException? Where can I see the stack trace?
+ // TODO: Might be a pluto bug. Report in JIRA if it is
+ try {
+ throw new RuntimeException(
+ "RuntimeException from V2AddlPortletTests_SPEC2_5_Initialization_initialization6");
+ } catch (Exception e) {
+ LOGGER.entering(LOG_CLASS, e.toString());
+ }
+ throw new RuntimeException(
+ "RuntimeException from V2AddlPortletTests_SPEC2_5_Initialization_initialization6");
+ }
+
+ @Override
+ public void destroy() {}
+
+ @Override
+ public void processAction(ActionRequest portletReq, ActionResponse portletResp)
+ throws PortletException, IOException {
+ LOGGER.entering(LOG_CLASS, "main portlet processAction entry");
+
+ portletResp.setRenderParameters(portletReq.getParameterMap());
+ long tid = Thread.currentThread().getId();
+ portletReq.setAttribute(THREADID_ATTR, tid);
+
+ }
+
+ @Override
+ public void render(RenderRequest portletReq, RenderResponse portletResp)
+ throws PortletException, IOException {
+ LOGGER.entering(LOG_CLASS, "main portlet render entry");
+
+ long tid = Thread.currentThread().getId();
+ portletReq.setAttribute(THREADID_ATTR, tid);
+
+ PrintWriter writer = portletResp.getWriter();
+
+ JSR286SpecTestCaseDetails tcd = new JSR286SpecTestCaseDetails();
+
+ // Create result objects for the tests
+
+ /* TestCase: V2AddlPortletTests_SPEC2_5_Initialization_initialization6 */
+ /* Details: "A RuntimeException thrown during initialization must be */
+ /* handled as a PortletException" */
+ // TODO: Might be a pluto bug. Report in JIRA if it is
+ TestResult tr0 =
+ tcd.getTestResultFailed(V2ADDLPORTLETTESTS_SPEC2_5_INITIALIZATION_INITIALIZATION6);
+ /* TODO: implement test */
+ tr0.appendTcDetail("Not implemented.");
+ tr0.writeTo(writer);
+
+ }
}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/d2605cda/portlet-tck_3.0/V2AddlPortletTests/src/main/java/javax/portlet/tck/portlets/AddlPortletTests_SPEC2_5_RenderGenericPortlet.java
----------------------------------------------------------------------
diff --git a/portlet-tck_3.0/V2AddlPortletTests/src/main/java/javax/portlet/tck/portlets/AddlPortletTests_SPEC2_5_RenderGenericPortlet.java b/portlet-tck_3.0/V2AddlPortletTests/src/main/java/javax/portlet/tck/portlets/AddlPortletTests_SPEC2_5_RenderGenericPortlet.java
index f42a326..95c3e9a 100644
--- a/portlet-tck_3.0/V2AddlPortletTests/src/main/java/javax/portlet/tck/portlets/AddlPortletTests_SPEC2_5_RenderGenericPortlet.java
+++ b/portlet-tck_3.0/V2AddlPortletTests/src/main/java/javax/portlet/tck/portlets/AddlPortletTests_SPEC2_5_RenderGenericPortlet.java
@@ -1,151 +1,143 @@
-/* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package javax.portlet.tck.portlets;
import java.io.*;
-import java.util.*;
import java.util.logging.*;
-import static java.util.logging.Logger.*;
import javax.xml.namespace.QName;
import javax.portlet.*;
-import javax.portlet.filter.*;
-import javax.servlet.*;
-import javax.servlet.http.*;
import javax.portlet.tck.beans.*;
import javax.portlet.tck.constants.*;
import static javax.portlet.tck.beans.JSR286SpecTestCaseDetails.*;
import static javax.portlet.tck.constants.Constants.*;
import static javax.portlet.PortletSession.*;
-import static javax.portlet.ResourceURL.*;
/**
- * This portlet implements several test cases for the JSR 362 TCK. The test case names
- * are defined in the /src/main/resources/xml-resources/additionalTCs.xml
- * file. The build process will integrate the test case names defined in the
- * additionalTCs.xml file into the complete list of test case names for execution by the driver.
- *
- * This is the main portlet for the test cases. If the test cases call for events, this portlet
- * will initiate the events, but not process them. The processing is done in the companion
- * portlet AddlPortletTests_SPEC2_5_RenderGenericPortlet_event
+ * This portlet implements several test cases for the JSR 362 TCK. The test case names are defined
+ * in the /src/main/resources/xml-resources/additionalTCs.xml file. The build process will integrate
+ * the test case names defined in the additionalTCs.xml file into the complete list of test case
+ * names for execution by the driver.
*
+ * This is the main portlet for the test cases. If the test cases call for events, this portlet will
+ * initiate the events, but not process them. The processing is done in the companion portlet
+ * AddlPortletTests_SPEC2_5_RenderGenericPortlet_event
+ * @author ahmed
*/
-public class AddlPortletTests_SPEC2_5_RenderGenericPortlet implements Portlet, ResourceServingPortlet {
- private static final String LOG_CLASS =
- AddlPortletTests_SPEC2_5_RenderGenericPortlet.class.getName();
- private final Logger LOGGER = Logger.getLogger(LOG_CLASS);
-
- private PortletConfig portletConfig = null;
-
- @Override
- public void init(PortletConfig config) throws PortletException {
- this.portletConfig = config;
- }
-
- @Override
- public void destroy() {
- }
-
- @Override
- public void processAction(ActionRequest portletReq, ActionResponse portletResp)
- throws PortletException, IOException {
- LOGGER.entering(LOG_CLASS, "main portlet processAction entry");
-
- portletResp.setRenderParameters(portletReq.getParameterMap());
- long tid = Thread.currentThread().getId();
- portletReq.setAttribute(THREADID_ATTR, tid);
-
- StringWriter writer = new StringWriter();
-
- }
-
- @Override
- public void serveResource(ResourceRequest portletReq, ResourceResponse portletResp)
- throws PortletException, IOException {
- LOGGER.entering(LOG_CLASS, "main portlet serveResource entry");
-
- long tid = Thread.currentThread().getId();
- portletReq.setAttribute(THREADID_ATTR, tid);
-
- PrintWriter writer = portletResp.getWriter();
-
- }
-
- @Override
- public void render(RenderRequest portletReq, RenderResponse portletResp)
- throws PortletException, IOException {
- LOGGER.entering(LOG_CLASS, "main portlet render entry");
-
- long tid = Thread.currentThread().getId();
- portletReq.setAttribute(THREADID_ATTR, tid);
-
- PrintWriter writer = portletResp.getWriter();
-
- JSR286SpecTestCaseDetails tcd = new JSR286SpecTestCaseDetails();
-
- // Create result objects for the tests
-
- /* TestCase: V2AddlPortletTests_SPEC2_5_RenderGenericPortlet_actionDispatching2 */
- /* Details: "If the ActionRequest.ACTION_NAME parameter is not set on */
- /* the action URL, the GenericPortlet processAction method will throw */
- /* a PortletException" */
- TestResult tr0 = tcd.getTestResultFailed(V2ADDLPORTLETTESTS_SPEC2_5_RENDERGENERICPORTLET_ACTIONDISPATCHING2);
- /* TODO: implement test */
- tr0.appendTcDetail("Not implemented.");
- tr0.writeTo(writer);
-
- /* TestCase: V2AddlPortletTests_SPEC2_5_RenderGenericPortlet_eventDispatching1 */
- /* Details: "The GenericPortlet processEvent method will dispatch the */
- /* request to a subclass method annotated with the tag */
- /* @ProcessEvent(qname=<eventname>), where <eventname> */
- /* must be in the format provided by Qname.toString()" */
- TestResult tr1 = tcd.getTestResultFailed(V2ADDLPORTLETTESTS_SPEC2_5_RENDERGENERICPORTLET_EVENTDISPATCHING1);
- /* TODO: implement test */
- tr1.appendTcDetail("Not implemented.");
- tr1.writeTo(writer);
-
- /* TestCase: V2AddlPortletTests_SPEC2_5_RenderGenericPortlet_eventDispatching2 */
- /* Details: "The GenericPortlet processEvent method will dispatch the */
- /* request to a subclass method annotated with the tag */
- /* @ProcessEvent(name=<event_name_local_part>)" */
- TestResult tr2 = tcd.getTestResultFailed(V2ADDLPORTLETTESTS_SPEC2_5_RENDERGENERICPORTLET_EVENTDISPATCHING2);
- /* TODO: implement test */
- tr2.appendTcDetail("Not implemented.");
- tr2.writeTo(writer);
-
- /* TestCase: V2AddlPortletTests_SPEC2_5_RenderGenericPortlet_renderDispatching8 */
- /* Details: "getTitle - If a ResourceBundle containing the title */
- /* string is defined in the deployment descriptor, that title string */
- /* will be used" */
- TestResult tr3 = tcd.getTestResultFailed(V2ADDLPORTLETTESTS_SPEC2_5_RENDERGENERICPORTLET_RENDERDISPATCHING8);
- /* TODO: implement test */
- tr3.appendTcDetail("Not implemented.");
- tr3.writeTo(writer);
-
- /* TestCase: V2AddlPortletTests_SPEC2_5_RenderGenericPortlet_renderDispatching9 */
- /* Details: "getTitle - If a ResourceBundle containing the title */
- /* string is not defined in the deployment descriptor, the title */
- /* defined in the portlet descriptor <title> element is used" */
- TestResult tr4 = tcd.getTestResultFailed(V2ADDLPORTLETTESTS_SPEC2_5_RENDERGENERICPORTLET_RENDERDISPATCHING9);
- /* TODO: implement test */
- tr4.appendTcDetail("Not implemented.");
- tr4.writeTo(writer);
-
- }
+public class AddlPortletTests_SPEC2_5_RenderGenericPortlet extends GenericPortlet {
+ private static final String LOG_CLASS =
+ AddlPortletTests_SPEC2_5_RenderGenericPortlet.class.getName();
+ private final Logger LOGGER = Logger.getLogger(LOG_CLASS);
+
+ @Override
+ public void processAction(ActionRequest portletReq, ActionResponse portletResp)
+ throws PortletException, IOException {
+
+ LOGGER.entering(LOG_CLASS, "main portlet processAction entry");
+ JSR286SpecTestCaseDetails tcd = new JSR286SpecTestCaseDetails();
+ portletResp.setRenderParameters(portletReq.getParameterMap());
+ long tid = Thread.currentThread().getId();
+ portletReq.setAttribute(THREADID_ATTR, tid);
+
+ QName eventQName = new QName(TCKNAMESPACE, "AddlPortletTests_SPEC2_5_RenderGenericPortlet");
+ portletResp.setEvent(eventQName, "Hi!");
+
+ portletResp.setEvent("AddlPortletTests_SPEC2_5_RenderGenericPortlet_localPart", "Hi!");
+
+ TestResult tr0 = tcd
+ .getTestResultFailed("V2AddlPortletTests_SPEC2_5_RenderGenericPortlet_actionDispatching2");
+ try {
+ super.processAction(portletReq, portletResp);
+ } catch (PortletException e) {
+ tr0.setTcSuccess(true);
+ tr0.appendTcDetail(e.toString());
+ }
+ portletReq.getPortletSession().setAttribute(
+ Constants.RESULT_ATTR_PREFIX + "AddlPortletTests_SPEC2_5_RenderGenericPortlet",
+ tr0.toString(), APPLICATION_SCOPE);
+
+ }
+
+ @Override
+ public void render(RenderRequest portletReq, RenderResponse portletResp)
+ throws PortletException, IOException {
+ LOGGER.entering(LOG_CLASS, "main portlet render entry");
+
+ long tid = Thread.currentThread().getId();
+ portletReq.setAttribute(THREADID_ATTR, tid);
+
+ PrintWriter writer = portletResp.getWriter();
+
+
+
+ /* TestCase: V2AddlPortletTests_SPEC2_5_RenderGenericPortlet_actionDispatching2 */
+ /* Details: "If the ActionRequest.ACTION_NAME parameter is not set on */
+ /* the action URL, the GenericPortlet processAction method will throw */
+ /* a PortletException" */
+ {
+ PortletURL aurl = portletResp.createActionURL();
+ aurl.setParameters(portletReq.getPrivateParameterMap());
+ TestButton tb = new TestButton(
+ "V2AddlPortletTests_SPEC2_5_RenderGenericPortlet_actionDispatching2", aurl);
+ tb.writeTo(writer);
+ }
+
+ /* TestCase: V2AddlPortletTests_SPEC2_5_RenderGenericPortlet_eventDispatching1 */
+ /* Details: "The GenericPortlet processEvent method will dispatch the */
+ /* request to a subclass method annotated with the tag */
+ /* @ProcessEvent(qname=<eventname>), where <eventname> */
+ /* must be in the format provided by Qname.toString()" */
+ {
+ PortletURL aurl = portletResp.createActionURL();
+ aurl.setParameters(portletReq.getPrivateParameterMap());
+ TestButton tb =
+ new TestButton("V2AddlPortletTests_SPEC2_5_RenderGenericPortlet_eventDispatching1", aurl);
+ tb.writeTo(writer);
+ }
+
+ /* TestCase: V2AddlPortletTests_SPEC2_5_RenderGenericPortlet_eventDispatching2 */
+ /* Details: "The GenericPortlet processEvent method will dispatch the */
+ /* request to a subclass method annotated with the tag */
+ /* @ProcessEvent(name=<event_name_local_part>)" */
+ {
+ PortletURL aurl = portletResp.createActionURL();
+ aurl.setParameters(portletReq.getPrivateParameterMap());
+ TestButton tb =
+ new TestButton("V2AddlPortletTests_SPEC2_5_RenderGenericPortlet_eventDispatching2", aurl);
+ tb.writeTo(writer);
+ }
+
+ }
+
+ @ProcessEvent(name = "AddlPortletTests_SPEC2_5_RenderGenericPortlet_localPart")
+ public void processEvent(EventRequest portletReq, EventResponse response)
+ throws PortletException, IOException {
+ LOGGER.entering(LOG_CLASS, "event main processEvent");
+ JSR286SpecTestCaseDetails tcd = new JSR286SpecTestCaseDetails();
+
+ /* TestCase: V2AddlPortletTests_SPEC2_5_RenderGenericPortlet_eventDispatching2 */
+ /* Details: "The GenericPortlet processEvent method will dispatch the */
+ /* request to a subclass method annotated with the tag */
+ /* @ProcessEvent(name=<event_name_local_part>)" */
+ TestResult tr2 =
+ tcd.getTestResultFailed(V2ADDLPORTLETTESTS_SPEC2_5_RENDERGENERICPORTLET_EVENTDISPATCHING2);
+ tr2.setTcSuccess(true);
+ portletReq.getPortletSession().setAttribute(
+ Constants.RESULT_ATTR_PREFIX + "AddlPortletTests_SPEC2_5_RenderGenericPortlet_event_b",
+ tr2.toString(), APPLICATION_SCOPE);
+
+ }
}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/d2605cda/portlet-tck_3.0/V2AddlPortletTests/src/main/java/javax/portlet/tck/portlets/AddlPortletTests_SPEC2_5_RenderGenericPortlet_event.java
----------------------------------------------------------------------
diff --git a/portlet-tck_3.0/V2AddlPortletTests/src/main/java/javax/portlet/tck/portlets/AddlPortletTests_SPEC2_5_RenderGenericPortlet_event.java b/portlet-tck_3.0/V2AddlPortletTests/src/main/java/javax/portlet/tck/portlets/AddlPortletTests_SPEC2_5_RenderGenericPortlet_event.java
new file mode 100644
index 0000000..394408f
--- /dev/null
+++ b/portlet-tck_3.0/V2AddlPortletTests/src/main/java/javax/portlet/tck/portlets/AddlPortletTests_SPEC2_5_RenderGenericPortlet_event.java
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package javax.portlet.tck.portlets;
+
+import static javax.portlet.PortletSession.APPLICATION_SCOPE;
+import static javax.portlet.tck.beans.JSR286SpecTestCaseDetails.V2ADDLPORTLETTESTS_SPEC2_5_RENDERGENERICPORTLET_EVENTDISPATCHING1;
+import static javax.portlet.tck.constants.Constants.RESULT_ATTR_PREFIX;
+import static javax.portlet.tck.constants.Constants.THREADID_ATTR;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.logging.Logger;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.Event;
+import javax.portlet.EventRequest;
+import javax.portlet.EventResponse;
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.ProcessEvent;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.tck.beans.JSR286SpecTestCaseDetails;
+import javax.portlet.tck.beans.TestResult;
+import javax.portlet.tck.constants.Constants;
+
+/**
+ * This portlet implements several test cases for the JSR 362 TCK. The test case names are defined
+ * in the /src/main/resources/xml-resources/additionalTCs.xml file. The build process will integrate
+ * the test case names defined in the additionalTCs.xml file into the complete list of test case
+ * names for execution by the driver.
+ *
+ * This is the main portlet for the test cases. If the test cases call for events, this portlet will
+ * initiate the events, but not process them. The processing is done in the companion portlet
+ * AddlPortletTests_SPEC2_5_RenderGenericPortlet_event
+ * @author ahmed
+ */
+public class AddlPortletTests_SPEC2_5_RenderGenericPortlet_event extends GenericPortlet {
+ private static final String LOG_CLASS =
+ AddlPortletTests_SPEC2_5_RenderGenericPortlet_event.class.getName();
+ private final Logger LOGGER = Logger.getLogger(LOG_CLASS);
+
+ @Override
+ public void processAction(ActionRequest portletReq, ActionResponse portletResp)
+ throws PortletException, IOException {
+ LOGGER.entering(LOG_CLASS, "event companion processAction - ERROR!!");
+ }
+
+ @ProcessEvent(qname = "AddlPortletTests_SPEC2_5_RenderGenericPortlet")
+ public void processEvent(EventRequest portletReq, EventResponse portletResp)
+ throws PortletException, IOException {
+ LOGGER.entering(LOG_CLASS, "event companion processEvent");
+ JSR286SpecTestCaseDetails tcd = new JSR286SpecTestCaseDetails();
+
+ /* TestCase: V2AddlPortletTests_SPEC2_5_RenderGenericPortlet_eventDispatching1 */
+ /* Details: "The GenericPortlet processEvent method will dispatch the */
+ /* request to a subclass method annotated with the tag */
+ /* @ProcessEvent(qname=<eventname>), where <eventname> */
+ /* must be in the format provided by Qname.toString()" */
+
+ Event event = portletReq.getEvent();
+ String qName = event.getName();
+ TestResult tr1 =
+ tcd.getTestResultFailed(V2ADDLPORTLETTESTS_SPEC2_5_RENDERGENERICPORTLET_EVENTDISPATCHING1);
+ if (qName.toString().equals("AddlPortletTests_SPEC2_5_RenderGenericPortlet")) {
+ tr1.setTcSuccess(true);
+ } else {
+ tr1.appendTcDetail(
+ "Failed because QName is not AddlPortletTests_SPEC2_5_RenderGenericPortlet");
+ }
+ portletReq.getPortletSession().setAttribute(
+ Constants.RESULT_ATTR_PREFIX + "AddlPortletTests_SPEC2_5_RenderGenericPortlet_event_a",
+ tr1.toString(), APPLICATION_SCOPE);
+ }
+
+ @Override
+ public void render(RenderRequest portletReq, RenderResponse portletResp)
+ throws PortletException, IOException {
+ LOGGER.entering(LOG_CLASS, "event companion render");
+
+ long tid = Thread.currentThread().getId();
+ portletReq.setAttribute(THREADID_ATTR, tid);
+
+ portletResp.setContentType("text/html");
+ PrintWriter writer = portletResp.getWriter();
+ writer.write("<h3>Event Companion Portlet </h3>\n");
+ writer.write("<p>AddlPortletTests_SPEC2_5_RenderGenericPortlet_event</p>\n");
+
+ String msg = (String) portletReq.getPortletSession().getAttribute(
+ RESULT_ATTR_PREFIX + "AddlPortletTests_SPEC2_5_RenderGenericPortlet",
+ APPLICATION_SCOPE)
+ + (String) portletReq.getPortletSession().getAttribute(
+ RESULT_ATTR_PREFIX + "AddlPortletTests_SPEC2_5_RenderGenericPortlet_event_a",
+ APPLICATION_SCOPE)
+ + (String) portletReq.getPortletSession().getAttribute(
+ RESULT_ATTR_PREFIX + "AddlPortletTests_SPEC2_5_RenderGenericPortlet_event_b",
+ APPLICATION_SCOPE);
+ msg = (msg.equals("nullnullnull")) ? "Not ready. click test case link." : msg;
+ writer.write("<p>" + msg + "</p>\n");
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/d2605cda/portlet-tck_3.0/V2AddlPortletTests/src/main/java/javax/portlet/tck/portlets/AddlPortletTests_SPEC2_5_RenderHandling.java
----------------------------------------------------------------------
diff --git a/portlet-tck_3.0/V2AddlPortletTests/src/main/java/javax/portlet/tck/portlets/AddlPortletTests_SPEC2_5_RenderHandling.java b/portlet-tck_3.0/V2AddlPortletTests/src/main/java/javax/portlet/tck/portlets/AddlPortletTests_SPEC2_5_RenderHandling.java
deleted file mode 100644
index d140015..0000000
--- a/portlet-tck_3.0/V2AddlPortletTests/src/main/java/javax/portlet/tck/portlets/AddlPortletTests_SPEC2_5_RenderHandling.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package javax.portlet.tck.portlets;
-
-import java.io.*;
-import java.util.*;
-import java.util.logging.*;
-import static java.util.logging.Logger.*;
-import javax.xml.namespace.QName;
-import javax.portlet.*;
-import javax.portlet.filter.*;
-import javax.servlet.*;
-import javax.servlet.http.*;
-import javax.portlet.tck.beans.*;
-import javax.portlet.tck.constants.*;
-import static javax.portlet.tck.beans.JSR286SpecTestCaseDetails.*;
-import static javax.portlet.tck.constants.Constants.*;
-import static javax.portlet.PortletSession.*;
-import static javax.portlet.ResourceURL.*;
-
-/**
- * This portlet implements several test cases for the JSR 362 TCK. The test case names
- * are defined in the /src/main/resources/xml-resources/additionalTCs.xml
- * file. The build process will integrate the test case names defined in the
- * additionalTCs.xml file into the complete list of test case names for execution by the driver.
- *
- * This is the main portlet for the test cases. If the test cases call for events, this portlet
- * will initiate the events, but not process them. The processing is done in the companion
- * portlet AddlPortletTests_SPEC2_5_RenderHandling_event
- *
- */
-public class AddlPortletTests_SPEC2_5_RenderHandling implements Portlet, ResourceServingPortlet {
- private static final String LOG_CLASS =
- AddlPortletTests_SPEC2_5_RenderHandling.class.getName();
- private final Logger LOGGER = Logger.getLogger(LOG_CLASS);
-
- private PortletConfig portletConfig = null;
-
- @Override
- public void init(PortletConfig config) throws PortletException {
- this.portletConfig = config;
- }
-
- @Override
- public void destroy() {
- }
-
- @Override
- public void processAction(ActionRequest portletReq, ActionResponse portletResp)
- throws PortletException, IOException {
- LOGGER.entering(LOG_CLASS, "main portlet processAction entry");
-
- portletResp.setRenderParameters(portletReq.getParameterMap());
- long tid = Thread.currentThread().getId();
- portletReq.setAttribute(THREADID_ATTR, tid);
-
- StringWriter writer = new StringWriter();
-
- }
-
- @Override
- public void serveResource(ResourceRequest portletReq, ResourceResponse portletResp)
- throws PortletException, IOException {
- LOGGER.entering(LOG_CLASS, "main portlet serveResource entry");
-
- long tid = Thread.currentThread().getId();
- portletReq.setAttribute(THREADID_ATTR, tid);
-
- PrintWriter writer = portletResp.getWriter();
-
- }
-
- @Override
- public void render(RenderRequest portletReq, RenderResponse portletResp)
- throws PortletException, IOException {
- LOGGER.entering(LOG_CLASS, "main portlet render entry");
-
- long tid = Thread.currentThread().getId();
- portletReq.setAttribute(THREADID_ATTR, tid);
-
- PrintWriter writer = portletResp.getWriter();
-
- JSR286SpecTestCaseDetails tcd = new JSR286SpecTestCaseDetails();
-
- // Create result objects for the tests
-
- /* TestCase: V2AddlPortletTests_SPEC2_5_RenderHandling_render1 */
- /* Details: "If the client request is triggered by a render URL, the */
- /* portlet container must invoke the render method for all portlets */
- /* on the page that do not have valid cache entries" */
- TestResult tr0 = tcd.getTestResultFailed(V2ADDLPORTLETTESTS_SPEC2_5_RENDERHANDLING_RENDER1);
- /* TODO: implement test */
- tr0.appendTcDetail("Not implemented.");
- tr0.writeTo(writer);
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/d2605cda/portlet-tck_3.0/V2AddlPortletTests/src/main/java/javax/portlet/tck/portlets/AddlPortletTests_SPEC2_5_ResourceHandling.java
----------------------------------------------------------------------
diff --git a/portlet-tck_3.0/V2AddlPortletTests/src/main/java/javax/portlet/tck/portlets/AddlPortletTests_SPEC2_5_ResourceHandling.java b/portlet-tck_3.0/V2AddlPortletTests/src/main/java/javax/portlet/tck/portlets/AddlPortletTests_SPEC2_5_ResourceHandling.java
index a12c044..135a96e 100644
--- a/portlet-tck_3.0/V2AddlPortletTests/src/main/java/javax/portlet/tck/portlets/AddlPortletTests_SPEC2_5_ResourceHandling.java
+++ b/portlet-tck_3.0/V2AddlPortletTests/src/main/java/javax/portlet/tck/portlets/AddlPortletTests_SPEC2_5_ResourceHandling.java
@@ -1,129 +1,111 @@
-/* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package javax.portlet.tck.portlets;
import java.io.*;
-import java.util.*;
import java.util.logging.*;
-import static java.util.logging.Logger.*;
-import javax.xml.namespace.QName;
import javax.portlet.*;
-import javax.portlet.filter.*;
-import javax.servlet.*;
-import javax.servlet.http.*;
import javax.portlet.tck.beans.*;
-import javax.portlet.tck.constants.*;
import static javax.portlet.tck.beans.JSR286SpecTestCaseDetails.*;
import static javax.portlet.tck.constants.Constants.*;
-import static javax.portlet.PortletSession.*;
import static javax.portlet.ResourceURL.*;
/**
- * This portlet implements several test cases for the JSR 362 TCK. The test case names
- * are defined in the /src/main/resources/xml-resources/additionalTCs.xml
- * file. The build process will integrate the test case names defined in the
- * additionalTCs.xml file into the complete list of test case names for execution by the driver.
- *
- * This is the main portlet for the test cases. If the test cases call for events, this portlet
- * will initiate the events, but not process them. The processing is done in the companion
- * portlet AddlPortletTests_SPEC2_5_ResourceHandling_event
+ * This portlet implements several test cases for the JSR 362 TCK. The test case names are defined
+ * in the /src/main/resources/xml-resources/additionalTCs.xml file. The build process will integrate
+ * the test case names defined in the additionalTCs.xml file into the complete list of test case
+ * names for execution by the driver.
*
+ * This is the main portlet for the test cases. If the test cases call for events, this portlet will
+ * initiate the events, but not process them. The processing is done in the companion portlet
+ * AddlPortletTests_SPEC2_5_ResourceHandling_event
+ * @author ahmed
*/
public class AddlPortletTests_SPEC2_5_ResourceHandling implements Portlet, ResourceServingPortlet {
- private static final String LOG_CLASS =
- AddlPortletTests_SPEC2_5_ResourceHandling.class.getName();
- private final Logger LOGGER = Logger.getLogger(LOG_CLASS);
-
- private PortletConfig portletConfig = null;
-
- @Override
- public void init(PortletConfig config) throws PortletException {
- this.portletConfig = config;
- }
-
- @Override
- public void destroy() {
- }
-
- @Override
- public void processAction(ActionRequest portletReq, ActionResponse portletResp)
- throws PortletException, IOException {
- LOGGER.entering(LOG_CLASS, "main portlet processAction entry");
-
- portletResp.setRenderParameters(portletReq.getParameterMap());
- long tid = Thread.currentThread().getId();
- portletReq.setAttribute(THREADID_ATTR, tid);
-
- StringWriter writer = new StringWriter();
-
- }
-
- @Override
- public void serveResource(ResourceRequest portletReq, ResourceResponse portletResp)
- throws PortletException, IOException {
- LOGGER.entering(LOG_CLASS, "main portlet serveResource entry");
-
- long tid = Thread.currentThread().getId();
- portletReq.setAttribute(THREADID_ATTR, tid);
-
- PrintWriter writer = portletResp.getWriter();
-
- JSR286SpecTestCaseDetails tcd = new JSR286SpecTestCaseDetails();
-
- // Create result objects for the tests
-
- /* TestCase: V2AddlPortletTests_SPEC2_5_ResourceHandling_resource1 */
- /* Details: "If the client request is triggered by a resource URL, */
- /* the portlet container must invoke the serveResource method for the */
- /* target portlet if its content does not have a valid cache entry" */
- TestResult tr0 = tcd.getTestResultFailed(V2ADDLPORTLETTESTS_SPEC2_5_RESOURCEHANDLING_RESOURCE1);
- /* TODO: implement test */
- tr0.appendTcDetail("Not implemented.");
- tr0.writeTo(writer);
-
- }
-
- @Override
- public void render(RenderRequest portletReq, RenderResponse portletResp)
- throws PortletException, IOException {
- LOGGER.entering(LOG_CLASS, "main portlet render entry");
-
- long tid = Thread.currentThread().getId();
- portletReq.setAttribute(THREADID_ATTR, tid);
-
- PrintWriter writer = portletResp.getWriter();
-
- writer.write("<div id=\"AddlPortletTests_SPEC2_5_ResourceHandling\">no resource output.</div>\n");
- ResourceURL resurl = portletResp.createResourceURL();
- resurl.setCacheability(PAGE);
- writer.write("<script>\n");
- writer.write("(function () {\n");
- writer.write(" var xhr = new XMLHttpRequest();\n");
- writer.write(" xhr.onreadystatechange=function() {\n");
- writer.write(" if (xhr.readyState==4 && xhr.status==200) {\n");
- writer.write(" document.getElementById(\"AddlPortletTests_SPEC2_5_ResourceHandling\").innerHTML=xhr.responseText;\n");
- writer.write(" }\n");
- writer.write(" };\n");
- writer.write(" xhr.open(\"GET\",\"" + resurl.toString() + "\",true);\n");
- writer.write(" xhr.send();\n");
- writer.write("})();\n");
- writer.write("</script>\n");
- }
+ private static final String LOG_CLASS = AddlPortletTests_SPEC2_5_ResourceHandling.class.getName();
+ private final Logger LOGGER = Logger.getLogger(LOG_CLASS);
+
+ @Override
+ public void init(PortletConfig config) throws PortletException {}
+
+ @Override
+ public void destroy() {}
+
+ @Override
+ public void processAction(ActionRequest portletReq, ActionResponse portletResp)
+ throws PortletException, IOException {
+ LOGGER.entering(LOG_CLASS, "main portlet processAction entry");
+
+ portletResp.setRenderParameters(portletReq.getParameterMap());
+ long tid = Thread.currentThread().getId();
+ portletReq.setAttribute(THREADID_ATTR, tid);
+
+ }
+
+ @Override
+ public void serveResource(ResourceRequest portletReq, ResourceResponse portletResp)
+ throws PortletException, IOException {
+ LOGGER.entering(LOG_CLASS, "main portlet serveResource entry");
+
+ long tid = Thread.currentThread().getId();
+ portletReq.setAttribute(THREADID_ATTR, tid);
+
+ PrintWriter writer = portletResp.getWriter();
+
+ JSR286SpecTestCaseDetails tcd = new JSR286SpecTestCaseDetails();
+
+ // Create result objects for the tests
+
+ /* TestCase: V2AddlPortletTests_SPEC2_5_ResourceHandling_resource1 */
+ /* Details: "If the client request is triggered by a resource URL, */
+ /* the portlet container must invoke the serveResource method for the */
+ /* target portlet if its content does not have a valid cache entry" */
+ TestResult tr0 = tcd.getTestResultFailed(V2ADDLPORTLETTESTS_SPEC2_5_RESOURCEHANDLING_RESOURCE1);
+ tr0.setTcSuccess(true);
+ tr0.writeTo(writer);
+
+ }
+
+ @Override
+ public void render(RenderRequest portletReq, RenderResponse portletResp)
+ throws PortletException, IOException {
+ LOGGER.entering(LOG_CLASS, "main portlet render entry");
+
+ long tid = Thread.currentThread().getId();
+ portletReq.setAttribute(THREADID_ATTR, tid);
+
+ PrintWriter writer = portletResp.getWriter();
+
+ writer
+ .write("<div id=\"AddlPortletTests_SPEC2_5_ResourceHandling\">no resource output.</div>\n");
+ ResourceURL resurl = portletResp.createResourceURL();
+ resurl.setCacheability(PAGE);
+ writer.write("<script>\n");
+ writer.write("(function () {\n");
+ writer.write(" var xhr = new XMLHttpRequest();\n");
+ writer.write(" xhr.onreadystatechange=function() {\n");
+ writer.write(" if (xhr.readyState==4 && xhr.status==200) {\n");
+ writer.write(
+ " document.getElementById(\"AddlPortletTests_SPEC2_5_ResourceHandling\").innerHTML=xhr.responseText;\n");
+ writer.write(" }\n");
+ writer.write(" };\n");
+ writer.write(" xhr.open(\"GET\",\"" + resurl.toString() + "\",true);\n");
+ writer.write(" xhr.send();\n");
+ writer.write("})();\n");
+ writer.write("</script>\n");
+ }
}
|