RequestTests_EventRequest_ApiEvent_event.java 文件源码

java
阅读 16 收藏 0 点赞 0 评论 0

项目:portals-pluto 作者:
@Override
public void processEvent(EventRequest portletReq, EventResponse portletResp)
      throws PortletException, IOException {
   LOGGER.trace("event companion processEvent");


   portletResp.setRenderParameters(portletReq);

   long tid = Thread.currentThread().getId();
   portletReq.setAttribute(THREADID_ATTR, tid);

   StringWriter writer = new StringWriter();

   JSR286ApiTestCaseDetails tcd = new JSR286ApiTestCaseDetails();

   // Create result objects for the tests



   /* TestCase: V2RequestTests_EventRequest_ApiEvent_getEvent              */
   /* Details: "Method getEvent(): Returns the Event object that           */
   /* triggered the call to the processEvent method"                       */
   TestResult tr0 = tcd.getTestResultFailed(V2REQUESTTESTS_EVENTREQUEST_APIEVENT_GETEVENT);
   Event evt=portletReq.getEvent();
   if(evt!=null) {
      tr0.setTcSuccess(true);
   } 
   tr0.writeTo(writer);

   /* TestCase: V2RequestTests_EventRequest_ApiEvent_getMethod             */
   /* Details: "Method getMethod(): Returns a String containing the name   */
   /* of the HTTP method with which the request was made"                  */
   TestResult tr1 = tcd.getTestResultFailed(V2REQUESTTESTS_EVENTREQUEST_APIEVENT_GETMETHOD);
   String getmethod=portletReq.getMethod();
   if(getmethod.equals("POST")) {
      tr1.setTcSuccess(true);
   } else {
      tr1.appendTcDetail("The getMethod() for HTTP Request has the value :" +getmethod);  
   }
   tr1.writeTo(writer);

   portletReq.getPortletSession().setAttribute(
                Constants.RESULT_ATTR_PREFIX + "RequestTests_EventRequest_ApiEvent",
                writer.toString(), APPLICATION_SCOPE);

}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号