portals-pluto-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From msnickl...@apache.org
Subject [4/7] portals-pluto git commit: Fixed V2AddlPortletTests_SPEC2_5_Initialization_initialization6 test which tests if the portlet goes out of service when RuntimeException/PortletException occurs in initialization of portlet.
Date Mon, 27 Jun 2016 13:25:42 GMT
Fixed V2AddlPortletTests_SPEC2_5_Initialization_initialization6 test which tests if the portlet
goes out of service when RuntimeException/PortletException occurs in initialization of portlet.


Project: http://git-wip-us.apache.org/repos/asf/portals-pluto/repo
Commit: http://git-wip-us.apache.org/repos/asf/portals-pluto/commit/3d41ce09
Tree: http://git-wip-us.apache.org/repos/asf/portals-pluto/tree/3d41ce09
Diff: http://git-wip-us.apache.org/repos/asf/portals-pluto/diff/3d41ce09

Branch: refs/heads/master
Commit: 3d41ce09665ebf73748c885210f554bd8b9e2901
Parents: 11a3704
Author: ahmed <mahmedk91@gmail.com>
Authored: Mon Jun 27 12:57:19 2016 +0200
Committer: ahmed <mahmedk91@gmail.com>
Committed: Mon Jun 27 12:57:19 2016 +0200

----------------------------------------------------------------------
 ...AddlPortletTests_SPEC2_5_Initialization.java |  84 +++----
 ...rtletTests_SPEC2_5_RenderGenericPortlet.java | 241 +++++++++++--------
 2 files changed, 168 insertions(+), 157 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/3d41ce09/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 fde4d10..633b016 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
@@ -17,7 +17,6 @@ package javax.portlet.tck.portlets;
 
 import java.io.IOException;
 import java.io.PrintWriter;
-import java.util.logging.Logger;
 
 import javax.portlet.ActionRequest;
 import javax.portlet.ActionResponse;
@@ -26,79 +25,56 @@ import javax.portlet.PortletConfig;
 import javax.portlet.PortletException;
 import javax.portlet.RenderRequest;
 import javax.portlet.RenderResponse;
-import javax.portlet.tck.beans.JSR286SpecTestCaseDetails;
-import javax.portlet.tck.beans.TestResult;
 
-import static javax.portlet.tck.beans.JSR286SpecTestCaseDetails.V2ADDLPORTLETTESTS_SPEC2_5_INITIALIZATION_INITIALIZATION6;
 import static javax.portlet.tck.constants.Constants.THREADID_ATTR;
 
 /**
- * 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 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
+ * 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 {
-  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 {
-    // 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 {
+   @Override
+   public void init(PortletConfig config) throws PortletException {
       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 {
+            "RuntimeException from V2AddlPortletTests_SPEC2_5_Initialization_initialization6");
+   }
 
-    portletResp.setRenderParameters(portletReq.getParameterMap());
-    long tid = Thread.currentThread().getId();
-    portletReq.setAttribute(THREADID_ATTR, tid);
+   @Override
+   public void destroy() {
+   }
 
-  }
+   @Override
+   public void processAction(ActionRequest portletReq,
+         ActionResponse portletResp) throws PortletException, IOException {
 
-  @Override
-  public void render(RenderRequest portletReq, RenderResponse portletResp)
-      throws PortletException, IOException {
+      portletResp.setRenderParameters(portletReq.getParameterMap());
+      long tid = Thread.currentThread().getId();
+      portletReq.setAttribute(THREADID_ATTR, tid);
 
-    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 {
 
-    JSR286SpecTestCaseDetails tcd = new JSR286SpecTestCaseDetails();
+      long tid = Thread.currentThread().getId();
+      portletReq.setAttribute(THREADID_ATTR, tid);
 
-    // Create result objects for the tests
+      PrintWriter writer = portletResp.getWriter();
 
-    /* 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);
+      writer.write("<p id=\"V2AddlPortletTests_SPEC2_5_Initialization_initialization6\">Portlet
is initialized.</p>");    
 
-  }
+   }
 
 }

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/3d41ce09/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 3b675ac..a6458fb 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
@@ -33,6 +33,7 @@ import javax.portlet.tck.beans.TestButton;
 import javax.portlet.tck.beans.TestResult;
 import javax.xml.namespace.QName;
 
+import static javax.portlet.tck.beans.JSR286SpecTestCaseDetails.V2ADDLPORTLETTESTS_SPEC2_5_INITIALIZATION_INITIALIZATION6;
 import static javax.portlet.tck.beans.JSR286SpecTestCaseDetails.V2ADDLPORTLETTESTS_SPEC2_5_RENDERGENERICPORTLET_EVENTDISPATCHING2;
 import static javax.portlet.tck.constants.Constants.THREADID_ATTR;
 import static javax.portlet.tck.constants.Constants.TCKNAMESPACE;
@@ -40,113 +41,147 @@ import static javax.portlet.tck.constants.Constants.RESULT_ATTR_PREFIX;
 import static javax.portlet.PortletSession.APPLICATION_SCOPE;
 
 /**
- * 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 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
+ * 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 extends GenericPortlet {
-
-  @Override
-  public void processAction(ActionRequest portletReq, ActionResponse portletResp)
-      throws PortletException, IOException {
-
-    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(
-        RESULT_ATTR_PREFIX + "AddlPortletTests_SPEC2_5_RenderGenericPortlet", tr0.toString(),
-        APPLICATION_SCOPE);
-
-  }
-
-  @Override
-  public void render(RenderRequest portletReq, RenderResponse portletResp)
-      throws PortletException, IOException {
-
-    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=&lt;eventname&gt;), where &lt;eventname&gt; */
-    /* 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=&lt;event_name_local_part&gt;)" */
-    {
-      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 {
-    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=&lt;event_name_local_part&gt;)" */
-    TestResult tr2 =
-        tcd.getTestResultFailed(V2ADDLPORTLETTESTS_SPEC2_5_RENDERGENERICPORTLET_EVENTDISPATCHING2);
-    tr2.setTcSuccess(true);
-    portletReq.getPortletSession().setAttribute(
-        RESULT_ATTR_PREFIX + "AddlPortletTests_SPEC2_5_RenderGenericPortlet_event_b",
-        tr2.toString(), APPLICATION_SCOPE);
-
-  }
+public class AddlPortletTests_SPEC2_5_RenderGenericPortlet
+      extends GenericPortlet {
+
+   @Override
+   public void processAction(ActionRequest portletReq,
+         ActionResponse portletResp) throws PortletException, IOException {
+
+      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(
+            RESULT_ATTR_PREFIX
+                  + "AddlPortletTests_SPEC2_5_RenderGenericPortlet",
+            tr0.toString(), APPLICATION_SCOPE);
+
+   }
+
+   @Override
+   public void render(RenderRequest portletReq, RenderResponse portletResp)
+         throws PortletException, IOException {
+
+      JSR286SpecTestCaseDetails tcd = new JSR286SpecTestCaseDetails();
+
+      long tid = Thread.currentThread().getId();
+      portletReq.setAttribute(THREADID_ATTR, tid);
+
+      PrintWriter writer = portletResp.getWriter();
+
+      /* 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);
+      tr0.appendTcDetail(""
+            + "<script>"
+            + "   var initializationPortlet = document.getElementById('V2AddlPortletTests_SPEC2_5_Initialization_initialization6');"
+            + "   if(initializationPortlet==null){"
+            + "      document.getElementById('V2AddlPortletTests_SPEC2_5_Initialization_initialization6-result').innerHTML
= 'Test Succeeded';"
+            + "   }"
+            + "</script>");
+      tr0.writeTo(writer);
+
+      /*
+      /* 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=&lt;eventname&gt;), where &lt;eventname&gt;
*/
+      /* 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=&lt;event_name_local_part&gt;)" */
+      {
+         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 {
+      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=&lt;event_name_local_part&gt;)" */
+      TestResult tr2 = tcd.getTestResultFailed(
+            V2ADDLPORTLETTESTS_SPEC2_5_RENDERGENERICPORTLET_EVENTDISPATCHING2);
+      tr2.setTcSuccess(true);
+      portletReq.getPortletSession().setAttribute(
+            RESULT_ATTR_PREFIX
+                  + "AddlPortletTests_SPEC2_5_RenderGenericPortlet_event_b",
+            tr2.toString(), APPLICATION_SCOPE);
+
+   }
 
 }


Mime
View raw message