You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-scm@portals.apache.org by ms...@apache.org on 2014/08/20 08:42:55 UTC
[42/50] [abbrv] Completed dispatcher request / response tests that
could be generated from the test case assertions file.
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/6e60b5f0/portlet-tck_3.0/V2DispatcherReqRespTests2/src/main/java/javax/portlet/tck/portlets/DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest.java
----------------------------------------------------------------------
diff --git a/portlet-tck_3.0/V2DispatcherReqRespTests2/src/main/java/javax/portlet/tck/portlets/DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest.java b/portlet-tck_3.0/V2DispatcherReqRespTests2/src/main/java/javax/portlet/tck/portlets/DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest.java
index d44cd0d..3c878f8 100644
--- a/portlet-tck_3.0/V2DispatcherReqRespTests2/src/main/java/javax/portlet/tck/portlets/DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest.java
+++ b/portlet-tck_3.0/V2DispatcherReqRespTests2/src/main/java/javax/portlet/tck/portlets/DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest.java
@@ -240,7 +240,7 @@ public class DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest implem
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_getHeaders */
/* Details: "In a target servlet of a forward in the Action phase, */
/* the method HttpServletRequest.getHeaders must return a value */
- /* corresponding to that returned by ActionRequest.getProperty for */
+ /* corresponding to that returned by ActionRequest.getProperties for */
/* the corresponding header name" */
{
PortletURL aurl = portletResp.createActionURL();
@@ -249,17 +249,6 @@ public class DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest implem
tb.writeTo(writer);
}
- /* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_getInputStream */
- /* Details: "In a target servlet of a forward in the Action phase, */
- /* the method HttpServletRequest.getInputStream must provide the same */
- /* functionality as ActionRequest.getPortletInputStream" */
- {
- PortletURL aurl = portletResp.createActionURL();
- aurl.setParameters(portletReq.getPrivateParameterMap());
- TestButton tb = new TestButton("V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_getInputStream", aurl);
- tb.writeTo(writer);
- }
-
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_getIntHeader */
/* Details: "In a target servlet of a forward in the Action phase, */
/* the method HttpServletRequest.getIntHeader must return a value */
@@ -645,17 +634,6 @@ public class DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest implem
tb.writeTo(writer);
}
- /* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_setCharacterEncoding */
- /* Details: "In a target servlet of a forward in the Action phase, */
- /* the method HttpServletRequest.setCharacterEncoding must provide */
- /* the same functionality as ActionRequest.setCharacterEncoding" */
- {
- PortletURL aurl = portletResp.createActionURL();
- aurl.setParameters(portletReq.getPrivateParameterMap());
- TestButton tb = new TestButton("V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_setCharacterEncoding", aurl);
- tb.writeTo(writer);
- }
-
// TestSetupLink for: DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest
{
String val = portletReq.getParameter(PARM_NAME);
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/6e60b5f0/portlet-tck_3.0/V2DispatcherReqRespTests2/src/main/java/javax/portlet/tck/portlets/DispatcherReqRespTests2_SPEC2_19_ForwardServletActionResponse.java
----------------------------------------------------------------------
diff --git a/portlet-tck_3.0/V2DispatcherReqRespTests2/src/main/java/javax/portlet/tck/portlets/DispatcherReqRespTests2_SPEC2_19_ForwardServletActionResponse.java b/portlet-tck_3.0/V2DispatcherReqRespTests2/src/main/java/javax/portlet/tck/portlets/DispatcherReqRespTests2_SPEC2_19_ForwardServletActionResponse.java
index 84d940d..7d7ce62 100644
--- a/portlet-tck_3.0/V2DispatcherReqRespTests2/src/main/java/javax/portlet/tck/portlets/DispatcherReqRespTests2_SPEC2_19_ForwardServletActionResponse.java
+++ b/portlet-tck_3.0/V2DispatcherReqRespTests2/src/main/java/javax/portlet/tck/portlets/DispatcherReqRespTests2_SPEC2_19_ForwardServletActionResponse.java
@@ -210,17 +210,6 @@ public class DispatcherReqRespTests2_SPEC2_19_ForwardServletActionResponse imple
tb.writeTo(writer);
}
- /* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionResponse_sendRedirect */
- /* Details: "In a target servlet of a forward in the Action phase, */
- /* the method HttpServletResponse.sendRedirect must provide the same */
- /* functionality as ActionResponse.sendRedirect" */
- {
- PortletURL aurl = portletResp.createActionURL();
- aurl.setParameters(portletReq.getPrivateParameterMap());
- TestButton tb = new TestButton("V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionResponse_sendRedirect", aurl);
- tb.writeTo(writer);
- }
-
}
}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/6e60b5f0/portlet-tck_3.0/V2DispatcherReqRespTests2/src/main/java/javax/portlet/tck/portlets/DispatcherReqRespTests2_SPEC2_19_ForwardServletEventRequest.java
----------------------------------------------------------------------
diff --git a/portlet-tck_3.0/V2DispatcherReqRespTests2/src/main/java/javax/portlet/tck/portlets/DispatcherReqRespTests2_SPEC2_19_ForwardServletEventRequest.java b/portlet-tck_3.0/V2DispatcherReqRespTests2/src/main/java/javax/portlet/tck/portlets/DispatcherReqRespTests2_SPEC2_19_ForwardServletEventRequest.java
index 956cabc..e388a0e 100644
--- a/portlet-tck_3.0/V2DispatcherReqRespTests2/src/main/java/javax/portlet/tck/portlets/DispatcherReqRespTests2_SPEC2_19_ForwardServletEventRequest.java
+++ b/portlet-tck_3.0/V2DispatcherReqRespTests2/src/main/java/javax/portlet/tck/portlets/DispatcherReqRespTests2_SPEC2_19_ForwardServletEventRequest.java
@@ -223,8 +223,8 @@ public class DispatcherReqRespTests2_SPEC2_19_ForwardServletEventRequest impleme
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletEventRequest_getHeaders */
/* Details: "In a target servlet of a forward in the Event phase, the */
/* method HttpServletRequest.getHeaders must return a value */
- /* corresponding to that returned by EventRequest.getProperty for the */
- /* corresponding header name" */
+ /* corresponding to that returned by EventRequest.getProperties for */
+ /* the corresponding header name" */
{
PortletURL aurl = portletResp.createActionURL();
aurl.setParameters(portletReq.getPrivateParameterMap());
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/6e60b5f0/portlet-tck_3.0/V2DispatcherReqRespTests2/src/main/java/javax/portlet/tck/servlets/DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_servlet.java
----------------------------------------------------------------------
diff --git a/portlet-tck_3.0/V2DispatcherReqRespTests2/src/main/java/javax/portlet/tck/servlets/DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_servlet.java b/portlet-tck_3.0/V2DispatcherReqRespTests2/src/main/java/javax/portlet/tck/servlets/DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_servlet.java
index bbf5883..425f06c 100644
--- a/portlet-tck_3.0/V2DispatcherReqRespTests2/src/main/java/javax/portlet/tck/servlets/DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_servlet.java
+++ b/portlet-tck_3.0/V2DispatcherReqRespTests2/src/main/java/javax/portlet/tck/servlets/DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_servlet.java
@@ -181,8 +181,16 @@ public class DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_servle
/* corresponding to that returned by ActionRequest.getProperty for */
/* the corresponding header name" */
TestResult tr8 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETDATEHEADER);
- /* TODO: implement test */
- tr8.appendTcDetail("Not implemented.");
+ try {
+ long hval = request.getDateHeader(MOD_HEADER);
+ long pval = Long.parseLong(portletReq.getProperty(MOD_HEADER));
+ boolean ok = (hval == pval);
+ if (!ok) {
+ String str = MOD_HEADER + " from HttpServletRequest: " + hval + ", did not equal " + pval + " from ActionRequest";
+ tr8.appendTcDetail(str);
+ }
+ tr8.setTcSuccess(ok);
+ } catch(Exception e) {tr8.appendTcDetail(e.toString());}
tr8.writeTo(writer);
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_getHeader */
@@ -191,8 +199,11 @@ public class DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_servle
/* corresponding to that returned by ActionRequest.getProperty for */
/* the corresponding header name" */
TestResult tr9 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETHEADER);
- /* TODO: implement test */
- tr9.appendTcDetail("Not implemented.");
+ try {
+ String hval = request.getHeader(ACCEPT_HEADER);
+ String pval = portletReq.getProperty(ACCEPT_HEADER);
+ CompareUtils.stringsEqual("HttpServletRequest", hval, "ActionRequest", pval, tr9);
+ } catch(Exception e) {tr9.appendTcDetail(e.toString());}
tr9.writeTo(writer);
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_getHeaderNames */
@@ -201,161 +212,184 @@ public class DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_servle
/* be contained in the Enumeration returned by */
/* ActionRequest.getPropertyNames" */
TestResult tr10 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETHEADERNAMES);
- /* TODO: implement test */
- tr10.appendTcDetail("Not implemented.");
+ try {
+ // he must be contained in pe
+ Enumeration<String> he = request.getHeaderNames();
+ Enumeration<String> pe = portletReq.getPropertyNames();
+ HashSet<String> hs = new HashSet<String>();
+ while (he.hasMoreElements()) {
+ hs.add(he.nextElement());
+ }
+ HashSet<String> ps = new HashSet<String>();
+ while (pe.hasMoreElements()) {
+ ps.add(pe.nextElement());
+ }
+ boolean ok = ps.containsAll(hs);
+ if (!ok) {
+ hs.removeAll(ps);
+ String str = "The following headers from HttpServletRequest are not contained in ActionRequest: ";
+ for (String h : hs) {;
+ str += "\"" + h + "\", ";
+ };
+ tr10.appendTcDetail(str);
+ }
+ tr10.setTcSuccess(ok);
+ } catch(Exception e) {tr10.appendTcDetail(e.toString());}
tr10.writeTo(writer);
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_getHeaders */
/* Details: "In a target servlet of a forward in the Action phase, */
/* the method HttpServletRequest.getHeaders must return a value */
- /* corresponding to that returned by ActionRequest.getProperty for */
+ /* corresponding to that returned by ActionRequest.getProperties for */
/* the corresponding header name" */
TestResult tr11 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETHEADERS);
- /* TODO: implement test */
- tr11.appendTcDetail("Not implemented.");
+ try {
+ Enumeration<String> he = request.getHeaders(ACCEPT_LANG_HEADER);
+ Enumeration<String> pe = portletReq.getProperties(ACCEPT_LANG_HEADER);
+ CompareUtils.enumsEqual("HttpServletRequest parameter names", he, "ActionRequest parameter names", pe,tr11);
+ } catch(Exception e) {tr11.appendTcDetail(e.toString());}
tr11.writeTo(writer);
- /* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_getInputStream */
- /* Details: "In a target servlet of a forward in the Action phase, */
- /* the method HttpServletRequest.getInputStream must provide the same */
- /* functionality as ActionRequest.getPortletInputStream" */
- TestResult tr12 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETINPUTSTREAM);
- /* TODO: implement test */
- tr12.appendTcDetail("Not implemented.");
- tr12.writeTo(writer);
-
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_getIntHeader */
/* Details: "In a target servlet of a forward in the Action phase, */
/* the method HttpServletRequest.getIntHeader must return a value */
/* corresponding to that returned by ActionRequest.getProperty for */
/* the corresponding header name" */
- TestResult tr13 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETINTHEADER);
- /* TODO: implement test */
- tr13.appendTcDetail("Not implemented.");
- tr13.writeTo(writer);
+ TestResult tr12 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETINTHEADER);
+ try {
+ int hval = request.getIntHeader(CONTENT_LENGTH_HEADER);
+ int pval = Integer.parseInt(portletReq.getProperty(CONTENT_LENGTH_HEADER));
+ boolean ok = (hval == pval);
+ if (!ok) {
+ String str = CONTENT_LENGTH_HEADER + " from HttpServletRequest: " + hval + ", did not equal " + pval + " from ActionRequest";
+ tr12.appendTcDetail(str);
+ }
+ tr12.setTcSuccess(ok);
+ } catch(Exception e) {tr12.appendTcDetail(e.toString());}
+ tr12.writeTo(writer);
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_getLocalAddr */
/* Details: "In a target servlet of a forward in the Action phase, */
/* the method HttpServletRequest.getLocalAddr must return null" */
- TestResult tr14 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETLOCALADDR);
+ TestResult tr13 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETLOCALADDR);
try {
String isval = request.getLocalAddr();
- CompareUtils.stringsEqual(isval, null, tr14);
- } catch(Exception e) {tr14.appendTcDetail(e.toString());}
- tr14.writeTo(writer);
+ CompareUtils.stringsEqual(isval, null, tr13);
+ } catch(Exception e) {tr13.appendTcDetail(e.toString());}
+ tr13.writeTo(writer);
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_getLocalName */
/* Details: "In a target servlet of a forward in the Action phase, */
/* the method HttpServletRequest.getLocalName must return null" */
- TestResult tr15 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETLOCALNAME);
+ TestResult tr14 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETLOCALNAME);
try {
String isval = request.getLocalName();
- CompareUtils.stringsEqual(isval, null, tr15);
- } catch(Exception e) {tr15.appendTcDetail(e.toString());}
- tr15.writeTo(writer);
+ CompareUtils.stringsEqual(isval, null, tr14);
+ } catch(Exception e) {tr14.appendTcDetail(e.toString());}
+ tr14.writeTo(writer);
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_getLocalPort */
/* Details: "In a target servlet of a forward in the Action phase, */
/* the method HttpServletRequest.getLocalPort must return 0" */
- TestResult tr16 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETLOCALPORT);
+ TestResult tr15 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETLOCALPORT);
try {
int isval = request.getLocalPort();
- if (isval != 0) tr16.appendTcDetail("Returned value was: " + isval);
- tr16.setTcSuccess(isval == 0);
- } catch(Exception e) {tr16.appendTcDetail(e.toString());}
- tr16.writeTo(writer);
+ if (isval != 0) tr15.appendTcDetail("Returned value was: " + isval);
+ tr15.setTcSuccess(isval == 0);
+ } catch(Exception e) {tr15.appendTcDetail(e.toString());}
+ tr15.writeTo(writer);
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_getLocale */
/* Details: "In a target servlet of a forward in the Action phase, */
/* the method HttpServletRequest.getLocale must provide the same */
/* functionality as ActionRequest.getLocale" */
- TestResult tr17 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETLOCALE);
+ TestResult tr16 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETLOCALE);
try {
Locale hl = request.getLocale();
Locale pl = portletReq.getLocale();
String hval = hl.getDisplayName();
String pval = pl.getDisplayName();
- CompareUtils.stringsEqual("HttpServletRequest", hval, "ActionRequest", pval, tr17);
- } catch(Exception e) {tr17.appendTcDetail(e.toString());}
- tr17.writeTo(writer);
+ CompareUtils.stringsEqual("HttpServletRequest", hval, "ActionRequest", pval, tr16);
+ } catch(Exception e) {tr16.appendTcDetail(e.toString());}
+ tr16.writeTo(writer);
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_getLocales */
/* Details: "In a target servlet of a forward in the Action phase, */
/* the method HttpServletRequest.getLocales must provide the same */
/* functionality as ActionRequest.getLocales" */
- TestResult tr18 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETLOCALES);
+ TestResult tr17 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETLOCALES);
try {
Enumeration<Locale> he = request.getLocales();
Enumeration<Locale> pe = portletReq.getLocales();
- CompareUtils.enumsEqual("HttpServletRequest locales", he, "ActionRequest locales", pe,tr18);
- } catch(Exception e) {tr18.appendTcDetail(e.toString());}
- tr18.writeTo(writer);
+ CompareUtils.enumsEqual("HttpServletRequest locales", he, "ActionRequest locales", pe,tr17);
+ } catch(Exception e) {tr17.appendTcDetail(e.toString());}
+ tr17.writeTo(writer);
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_getMethod */
/* Details: "In a target servlet of a forward in the Action phase, */
/* the method HttpServletRequest.getMethod must provide the same */
/* functionality as ActionRequest.getMethod" */
- TestResult tr19 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETMETHOD);
+ TestResult tr18 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETMETHOD);
try {
String hval = request.getMethod();
String pval = ((ClientDataRequest)portletReq).getMethod();
- CompareUtils.stringsEqual("HttpServletRequest", hval, "ActionRequest", pval, tr19);
- } catch(Exception e) {tr19.appendTcDetail(e.toString());}
- tr19.writeTo(writer);
+ CompareUtils.stringsEqual("HttpServletRequest", hval, "ActionRequest", pval, tr18);
+ } catch(Exception e) {tr18.appendTcDetail(e.toString());}
+ tr18.writeTo(writer);
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_getParameter */
/* Details: "In a target servlet of a forward in the Action phase, */
/* the method HttpServletRequest.getParameter must provide the same */
/* functionality as ActionRequest.getParameter" */
- TestResult tr20 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETPARAMETER);
+ TestResult tr19 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETPARAMETER);
try {
// TestSetupLink
String val = portletReq.getParameter(PARM_NAME);
if (val != null) {
String hval = request.getParameter(PARM_NAME);
String pval = portletReq.getParameter(PARM_NAME);
- CompareUtils.stringsEqual("HttpServletRequest", hval, "ActionRequest", pval, tr20);
- tr20.writeTo(writer);
+ CompareUtils.stringsEqual("HttpServletRequest", hval, "ActionRequest", pval, tr19);
+ tr19.writeTo(writer);
}
- } catch(Exception e) {tr20.appendTcDetail(e.toString());}
+ } catch(Exception e) {tr19.appendTcDetail(e.toString());}
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_getParameterMap */
/* Details: "In a target servlet of a forward in the Action phase, */
/* the method HttpServletRequest.getParameterMap must provide the */
/* same functionality as ActionRequest.getParameterMap" */
- TestResult tr21 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETPARAMETERMAP);
+ TestResult tr20 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETPARAMETERMAP);
try {
// TestSetupLink
String val = portletReq.getParameter(PARM_NAME);
if (val != null) {
Map<String, String[]> hmap = request.getParameterMap();
Map<String, String[]> pmap = portletReq.getParameterMap();
- CompareUtils.mapsEqual("map from HttpServletRequest", hmap, "map from ActionRequest", pmap, tr21);
- tr21.writeTo(writer);
+ CompareUtils.mapsEqual("map from HttpServletRequest", hmap, "map from ActionRequest", pmap, tr20);
+ tr20.writeTo(writer);
}
- } catch(Exception e) {tr21.appendTcDetail(e.toString());}
+ } catch(Exception e) {tr20.appendTcDetail(e.toString());}
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_getParameterNames */
/* Details: "In a target servlet of a forward in the Action phase, */
/* the method HttpServletRequest.getParameterNames must provide the */
/* same functionality as ActionRequest.getParameterNames" */
- TestResult tr22 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETPARAMETERNAMES);
+ TestResult tr21 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETPARAMETERNAMES);
try {
// TestSetupLink
String val = portletReq.getParameter(PARM_NAME);
if (val != null) {
Enumeration<String> he = request.getParameterNames();
Enumeration<String> pe = portletReq.getParameterNames();
- CompareUtils.enumsEqual("HttpServletRequest parameter names", he, "ActionRequest parameter names", pe,tr22);
- tr22.writeTo(writer);
+ CompareUtils.enumsEqual("HttpServletRequest parameter names", he, "ActionRequest parameter names", pe,tr21);
+ tr21.writeTo(writer);
}
- } catch(Exception e) {tr22.appendTcDetail(e.toString());}
+ } catch(Exception e) {tr21.appendTcDetail(e.toString());}
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_getParameterValues */
/* Details: "In a target servlet of a forward in the Action phase, */
/* the method HttpServletRequest.getParameterValues must provide the */
/* same functionality as ActionRequest.getParameterValues" */
- TestResult tr23 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETPARAMETERVALUES);
+ TestResult tr22 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETPARAMETERVALUES);
try {
// TestSetupLink
String val = portletReq.getParameter(PARM_NAME);
@@ -364,320 +398,354 @@ public class DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_servle
String[] pvals = portletReq.getParameterValues(PARM_NAME);
String hval = ((hvals==null) ? "null" : hvals[0]);
String pval = ((pvals==null) ? "null" : pvals[0]);
- CompareUtils.stringsEqual("HttpServletRequest", hval, "ActionRequest", pval, tr23);
- tr23.writeTo(writer);
+ CompareUtils.stringsEqual("HttpServletRequest", hval, "ActionRequest", pval, tr22);
+ tr22.writeTo(writer);
}
- } catch(Exception e) {tr23.appendTcDetail(e.toString());}
+ } catch(Exception e) {tr22.appendTcDetail(e.toString());}
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_getPathInfo */
/* Details: "In a target servlet of a forward in the Action phase, */
/* the method HttpServletRequest.getPathInfo must a value */
/* corresponding to the path used to obtain the */
/* PortletRequestDispatcher" */
- TestResult tr24 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETPATHINFO);
+ TestResult tr23 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETPATHINFO);
try {
String sname = SERVLET_PREFIX + "DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_servlet" + SERVLET_SUFFIX;
String hval = request.getPathInfo();
String pval = null;
- CompareUtils.stringsEqual("HttpServletRequest", hval, " defined: ", pval, tr24);
- } catch(Exception e) {tr24.appendTcDetail(e.toString());}
- tr24.writeTo(writer);
+ CompareUtils.stringsEqual("HttpServletRequest", hval, " defined: ", pval, tr23);
+ } catch(Exception e) {tr23.appendTcDetail(e.toString());}
+ tr23.writeTo(writer);
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_getPathTranslated */
/* Details: "In a target servlet of a forward in the Action phase, */
/* the method HttpServletRequest.getPathTranslated must a value */
/* corresponding to the path used to obtain the */
/* PortletRequestDispatcher" */
- TestResult tr25 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETPATHTRANSLATED);
+ TestResult tr24 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETPATHTRANSLATED);
try {
String sname = SERVLET_PREFIX + "DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_servlet" + SERVLET_SUFFIX;
String hval = request.getPathTranslated();
String pval = null;
- CompareUtils.stringsEqual("HttpServletRequest", hval, " defined: ", pval, tr25);
- } catch(Exception e) {tr25.appendTcDetail(e.toString());}
- tr25.writeTo(writer);
+ CompareUtils.stringsEqual("HttpServletRequest", hval, " defined: ", pval, tr24);
+ } catch(Exception e) {tr24.appendTcDetail(e.toString());}
+ tr24.writeTo(writer);
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_getProtocol */
/* Details: "In a target servlet of a forward in the Action phase, */
/* the method HttpServletRequest.getProtocol must return */
/* \"HTTP/1.1\"" */
- TestResult tr26 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETPROTOCOL);
+ TestResult tr25 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETPROTOCOL);
try {
String isval = request.getProtocol();
- CompareUtils.stringsEqual(isval, "HTTP/1.1", tr26);
- } catch(Exception e) {tr26.appendTcDetail(e.toString());}
- tr26.writeTo(writer);
+ CompareUtils.stringsEqual(isval, "HTTP/1.1", tr25);
+ } catch(Exception e) {tr25.appendTcDetail(e.toString());}
+ tr25.writeTo(writer);
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_getQueryString */
/* Details: "In a target servlet of a forward in the Action phase, */
/* the method HttpServletRequest.getQueryString must a value */
/* corresponding to the query string information used to obtain the */
/* PortletRequestDispatcher" */
- TestResult tr27 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETQUERYSTRING);
+ TestResult tr26 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETQUERYSTRING);
try {
String sname = SERVLET_PREFIX + "DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_servlet" + SERVLET_SUFFIX;
String hval = request.getQueryString();
String pval = QUERY_STRING;
- CompareUtils.stringsEqual("HttpServletRequest", hval, " defined: ", pval, tr27);
- } catch(Exception e) {tr27.appendTcDetail(e.toString());}
- tr27.writeTo(writer);
+ CompareUtils.stringsEqual("HttpServletRequest", hval, " defined: ", pval, tr26);
+ } catch(Exception e) {tr26.appendTcDetail(e.toString());}
+ tr26.writeTo(writer);
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_getRealPath */
/* Details: "In a target servlet of a forward in the Action phase, */
/* the method HttpServletRequest.getRealPath must return null" */
- TestResult tr28 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETREALPATH);
+ TestResult tr27 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETREALPATH);
try {
String isval = request.getRealPath("/WEB-INF/portlet.xml");
- CompareUtils.stringsEqual(isval, null, tr28);
- } catch(Exception e) {tr28.appendTcDetail(e.toString());}
- tr28.writeTo(writer);
+ CompareUtils.stringsEqual(isval, null, tr27);
+ } catch(Exception e) {tr27.appendTcDetail(e.toString());}
+ tr27.writeTo(writer);
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_getRemoteAddr */
/* Details: "In a target servlet of a forward in the Action phase, */
/* the method HttpServletRequest.getRemoteAddr must return null" */
- TestResult tr29 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETREMOTEADDR);
+ TestResult tr28 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETREMOTEADDR);
try {
String isval = request.getRemoteAddr();
- CompareUtils.stringsEqual(isval, null, tr29);
- } catch(Exception e) {tr29.appendTcDetail(e.toString());}
- tr29.writeTo(writer);
+ CompareUtils.stringsEqual(isval, null, tr28);
+ } catch(Exception e) {tr28.appendTcDetail(e.toString());}
+ tr28.writeTo(writer);
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_getRemoteHost */
/* Details: "In a target servlet of a forward in the Action phase, */
/* the method HttpServletRequest.getRemoteHost must return null" */
- TestResult tr30 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETREMOTEHOST);
+ TestResult tr29 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETREMOTEHOST);
try {
String isval = request.getRemoteHost();
- CompareUtils.stringsEqual(isval, null, tr30);
- } catch(Exception e) {tr30.appendTcDetail(e.toString());}
- tr30.writeTo(writer);
+ CompareUtils.stringsEqual(isval, null, tr29);
+ } catch(Exception e) {tr29.appendTcDetail(e.toString());}
+ tr29.writeTo(writer);
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_getRemotePort */
/* Details: "In a target servlet of a forward in the Action phase, */
/* the method HttpServletRequest.getRemotePort must return 0" */
- TestResult tr31 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETREMOTEPORT);
+ TestResult tr30 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETREMOTEPORT);
try {
int isval = request.getRemotePort();
- if (isval != 0) tr31.appendTcDetail("Returned value was: " + isval);
- tr31.setTcSuccess(isval == 0);
- } catch(Exception e) {tr31.appendTcDetail(e.toString());}
- tr31.writeTo(writer);
+ if (isval != 0) tr30.appendTcDetail("Returned value was: " + isval);
+ tr30.setTcSuccess(isval == 0);
+ } catch(Exception e) {tr30.appendTcDetail(e.toString());}
+ tr30.writeTo(writer);
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_getRemoteUser */
/* Details: "In a target servlet of a forward in the Action phase, */
/* the method HttpServletRequest.getRemoteUser must provide the same */
/* functionality as ActionRequest.getRemoteUser" */
- TestResult tr32 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETREMOTEUSER);
+ TestResult tr31 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETREMOTEUSER);
try {
String hval = request.getRemoteUser();
String pval = ((ClientDataRequest)portletReq).getRemoteUser();
- CompareUtils.stringsEqual("HttpServletRequest", hval, "ActionRequest", pval, tr32);
- } catch(Exception e) {tr32.appendTcDetail(e.toString());}
- tr32.writeTo(writer);
+ CompareUtils.stringsEqual("HttpServletRequest", hval, "ActionRequest", pval, tr31);
+ } catch(Exception e) {tr31.appendTcDetail(e.toString());}
+ tr31.writeTo(writer);
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_getRequestDispatcher */
/* Details: "In a target servlet of a forward in the Action phase, */
/* the method HttpServletRequest.getRequestDispatcher must provide */
/* functionality as defined in the servlet specification" */
- TestResult tr33 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETREQUESTDISPATCHER);
- /* TODO: implement test */
- tr33.appendTcDetail("Not implemented.");
- tr33.writeTo(writer);
+ TestResult tr32 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETREQUESTDISPATCHER);
+ try {
+ String sname = SERVLET_PREFIX + "DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_servlet" + SERVLET_SUFFIX;
+ RequestDispatcher hval = request.getRequestDispatcher(sname);
+ if (hval == null) {
+ tr32.appendTcDetail("Could not obtain request dispatcher for " + sname);
+ }
+ tr32.setTcSuccess(hval != null);
+ } catch(Exception e) {tr32.appendTcDetail(e.toString());}
+ tr32.writeTo(writer);
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_getRequestURI */
/* Details: "In a target servlet of a forward in the Action phase, */
/* the method HttpServletRequest.getRequestURI must a value */
/* corresponding to the path and query string information used to */
/* obtain the PortletRequestDispatcher" */
- TestResult tr34 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETREQUESTURI);
+ TestResult tr33 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETREQUESTURI);
try {
String sname = SERVLET_PREFIX + "DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_servlet" + SERVLET_SUFFIX;
String hval = request.getRequestURI();
if (!hval.contains(sname)) {
- tr34.appendTcDetail("Request URI " + hval + " does not contain " + sname);
+ tr33.appendTcDetail("Request URI " + hval + " does not contain " + sname);
}
- tr34.setTcSuccess(hval.contains(sname));
- } catch(Exception e) {tr34.appendTcDetail(e.toString());}
- tr34.writeTo(writer);
+ tr33.setTcSuccess(hval.contains(sname));
+ } catch(Exception e) {tr33.appendTcDetail(e.toString());}
+ tr33.writeTo(writer);
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_getRequestURL */
/* Details: "In a target servlet of a forward in the Action phase, */
/* the method HttpServletRequest.getRequestURL must return null" */
- TestResult tr35 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETREQUESTURL);
+ TestResult tr34 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETREQUESTURL);
try {
StringBuffer isval = request.getRequestURL();
- if (isval != null) tr35.appendTcDetail("Request URL is " + isval.toString());
- tr35.setTcSuccess(isval == null);
- } catch(Exception e) {tr35.appendTcDetail(e.toString());}
- tr35.writeTo(writer);
+ if (isval != null) tr34.appendTcDetail("Request URL is " + isval.toString());
+ tr34.setTcSuccess(isval == null);
+ } catch(Exception e) {tr34.appendTcDetail(e.toString());}
+ tr34.writeTo(writer);
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_getRequestedSessionId */
/* Details: "In a target servlet of a forward in the Action phase, */
/* the method HttpServletRequest.getRequestedSessionId must provide */
/* the same functionality as ActionRequest.getRequestedSessionId" */
- TestResult tr36 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETREQUESTEDSESSIONID);
+ TestResult tr35 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETREQUESTEDSESSIONID);
try {
String hval = request.getRequestedSessionId();
String pval = ((ClientDataRequest)portletReq).getRequestedSessionId();
- CompareUtils.stringsEqual("HttpServletRequest", hval, "ActionRequest", pval, tr36);
- } catch(Exception e) {tr36.appendTcDetail(e.toString());}
- tr36.writeTo(writer);
+ CompareUtils.stringsEqual("HttpServletRequest", hval, "ActionRequest", pval, tr35);
+ } catch(Exception e) {tr35.appendTcDetail(e.toString());}
+ tr35.writeTo(writer);
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_getScheme */
/* Details: "In a target servlet of a forward in the Action phase, */
/* the method HttpServletRequest.getScheme must provide the same */
/* functionality as ActionRequest.getScheme" */
- TestResult tr37 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETSCHEME);
+ TestResult tr36 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETSCHEME);
try {
String hval = request.getScheme();
String pval = ((ClientDataRequest)portletReq).getScheme();
- CompareUtils.stringsEqual("HttpServletRequest", hval, "ActionRequest", pval, tr37);
- } catch(Exception e) {tr37.appendTcDetail(e.toString());}
- tr37.writeTo(writer);
+ CompareUtils.stringsEqual("HttpServletRequest", hval, "ActionRequest", pval, tr36);
+ } catch(Exception e) {tr36.appendTcDetail(e.toString());}
+ tr36.writeTo(writer);
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_getServerName */
/* Details: "In a target servlet of a forward in the Action phase, */
/* the method HttpServletRequest.getServerName must provide the same */
/* functionality as ActionRequest.getServerName" */
- TestResult tr38 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETSERVERNAME);
+ TestResult tr37 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETSERVERNAME);
try {
String hval = request.getServerName();
String pval = ((ClientDataRequest)portletReq).getServerName();
- CompareUtils.stringsEqual("HttpServletRequest", hval, "ActionRequest", pval, tr38);
- } catch(Exception e) {tr38.appendTcDetail(e.toString());}
- tr38.writeTo(writer);
+ CompareUtils.stringsEqual("HttpServletRequest", hval, "ActionRequest", pval, tr37);
+ } catch(Exception e) {tr37.appendTcDetail(e.toString());}
+ tr37.writeTo(writer);
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_getServerPort */
/* Details: "In a target servlet of a forward in the Action phase, */
/* the method HttpServletRequest.getServerPort must provide the same */
/* functionality as ActionRequest.getServerPort" */
- TestResult tr39 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETSERVERPORT);
+ TestResult tr38 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETSERVERPORT);
try {
int hval = request.getServerPort();
int pval = ((ClientDataRequest)portletReq).getServerPort();
String str = "Value " + hval + " from " + "HttpServletRequest" + " does not equal value " + pval + " + ActionRequest";
if (hval != pval) {
- tr39.appendTcDetail(str);
+ tr38.appendTcDetail(str);
}
- tr39.setTcSuccess(hval == pval);
- } catch(Exception e) {tr39.appendTcDetail(e.toString());}
- tr39.writeTo(writer);
+ tr38.setTcSuccess(hval == pval);
+ } catch(Exception e) {tr38.appendTcDetail(e.toString());}
+ tr38.writeTo(writer);
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_getServletPath */
/* Details: "In a target servlet of a forward in the Action phase, */
/* the method HttpServletRequest.getServletPath must a value */
/* corresponding to the path used to obtain the */
/* PortletRequestDispatcher" */
- TestResult tr40 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETSERVLETPATH);
+ TestResult tr39 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETSERVLETPATH);
try {
String sname = SERVLET_PREFIX + "DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_servlet" + SERVLET_SUFFIX;
String hval = request.getServletPath();
String pval = sname;
- CompareUtils.stringsEqual("HttpServletRequest", hval, " defined: ", pval, tr40);
- } catch(Exception e) {tr40.appendTcDetail(e.toString());}
- tr40.writeTo(writer);
+ CompareUtils.stringsEqual("HttpServletRequest", hval, " defined: ", pval, tr39);
+ } catch(Exception e) {tr39.appendTcDetail(e.toString());}
+ tr39.writeTo(writer);
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_getSession */
/* Details: "In a target servlet of a forward in the Action phase, */
/* the method HttpServletRequest.getSession must provide the same */
/* functionality as */
/* ActionRequest.getPortletSession(APPLICATION_SCOPE)" */
- TestResult tr41 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETSESSION);
- /* TODO: implement test */
- tr41.appendTcDetail("Not implemented.");
- tr41.writeTo(writer);
+ TestResult tr40 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETSESSION);
+ try {
+ HttpSession hval = request.getSession();
+ if (hval == null) {
+ tr40.appendTcDetail("Could not get session from HttpServletRequest");
+ }
+ tr40.setTcSuccess(hval != null);
+ } catch(Exception e) {tr40.appendTcDetail(e.toString());}
+ tr40.writeTo(writer);
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_getUserPrincipal */
/* Details: "In a target servlet of a forward in the Action phase, */
/* the method HttpServletRequest.getUserPrincipal must provide the */
/* same functionality as ActionRequest.getUserPrincipal" */
- TestResult tr42 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETUSERPRINCIPAL);
+ TestResult tr41 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_GETUSERPRINCIPAL);
try {
java.security.Principal hpal = request.getUserPrincipal();
java.security.Principal ppal = ((ClientDataRequest)portletReq).getUserPrincipal();
String str = "Value " + hpal.toString() + " from " + "HttpServletRequest" + " does not equal value " + ppal.toString() + " + ActionRequest";
if (!hpal.equals(ppal)) {
- tr42.appendTcDetail(str);
+ tr41.appendTcDetail(str);
}
- tr42.setTcSuccess(hpal.equals(ppal));
- } catch(Exception e) {tr42.appendTcDetail(e.toString());}
- tr42.writeTo(writer);
+ tr41.setTcSuccess(hpal.equals(ppal));
+ } catch(Exception e) {tr41.appendTcDetail(e.toString());}
+ tr41.writeTo(writer);
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_isRequestedSessionIdValid */
/* Details: "In a target servlet of a forward in the Action phase, */
/* the method HttpServletRequest.isRequestedSessionIdValid must */
/* provide the same functionality as */
/* ActionRequest.isRequestedSessionIdValid" */
- TestResult tr43 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_ISREQUESTEDSESSIONIDVALID);
+ TestResult tr42 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_ISREQUESTEDSESSIONIDVALID);
try {
boolean hval = request.isRequestedSessionIdValid();
boolean pval = ((ClientDataRequest)portletReq).isRequestedSessionIdValid();
String str = "Value " + hval + " from " + "HttpServletRequest" + " does not equal value " + pval + " + ActionRequest";
if (hval != pval) {
- tr43.appendTcDetail(str);
+ tr42.appendTcDetail(str);
}
- tr43.setTcSuccess(hval == pval);
- } catch(Exception e) {tr43.appendTcDetail(e.toString());}
- tr43.writeTo(writer);
+ tr42.setTcSuccess(hval == pval);
+ } catch(Exception e) {tr42.appendTcDetail(e.toString());}
+ tr42.writeTo(writer);
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_isSecure */
/* Details: "In a target servlet of a forward in the Action phase, */
/* the method HttpServletRequest.isSecure must provide the same */
/* functionality as ActionRequest.isSecure" */
- TestResult tr44 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_ISSECURE);
+ TestResult tr43 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_ISSECURE);
try {
boolean hval = request.isSecure();
boolean pval = ((ClientDataRequest)portletReq).isSecure();
String str = "Value " + hval + " from " + "HttpServletRequest" + " does not equal value " + pval + " + ActionRequest";
if (hval != pval) {
- tr44.appendTcDetail(str);
+ tr43.appendTcDetail(str);
}
- tr44.setTcSuccess(hval == pval);
- } catch(Exception e) {tr44.appendTcDetail(e.toString());}
- tr44.writeTo(writer);
+ tr43.setTcSuccess(hval == pval);
+ } catch(Exception e) {tr43.appendTcDetail(e.toString());}
+ tr43.writeTo(writer);
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_isUserInRole */
/* Details: "In a target servlet of a forward in the Action phase, */
/* the method HttpServletRequest.isUserInRole must provide the same */
/* functionality as ActionRequest.isUserInRole" */
- TestResult tr45 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_ISUSERINROLE);
+ TestResult tr44 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_ISUSERINROLE);
try {
boolean hval = request.isUserInRole(ROLE_NAME);
boolean pval = ((ClientDataRequest)portletReq).isUserInRole(ROLE_NAME);
String str = "Value " + hval + " from " + "HttpServletRequest" + " does not equal value " + pval + " + ActionRequest";
if (hval != pval) {
- tr45.appendTcDetail(str);
+ tr44.appendTcDetail(str);
}
- tr45.setTcSuccess(hval == pval);
- } catch(Exception e) {tr45.appendTcDetail(e.toString());}
- tr45.writeTo(writer);
+ tr44.setTcSuccess(hval == pval);
+ } catch(Exception e) {tr44.appendTcDetail(e.toString());}
+ tr44.writeTo(writer);
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_removeAttribute */
/* Details: "In a target servlet of a forward in the Action phase, */
/* the method HttpServletRequest.removeAttribute must provide the */
/* same functionality as ActionRequest.removeAttribute" */
- TestResult tr46 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_REMOVEATTRIBUTE);
- /* TODO: implement test */
- tr46.appendTcDetail("Not implemented.");
- tr46.writeTo(writer);
+ TestResult tr45 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_REMOVEATTRIBUTE);
+ try {
+ String hname = ATTR_PREFIX + "V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_removeAttribute1";
+ String pname = ATTR_PREFIX + "V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_removeAttribute2";
+ request.setAttribute(hname, "Value");
+ portletReq.setAttribute(pname, "Value");
+ request.removeAttribute(hname);
+ portletReq.removeAttribute(pname);
+ String hval = (String)request.getAttribute(hname);
+ String pval = (String)portletReq.getAttribute(pname);
+ boolean ok = (hval == null) && (pval == null);
+ String str = "";
+ if (!ok) {;
+ if (hval != null) str += "Attribute could not be removed through HttpServletRequest." ;
+ if (pval != null) str += "Attribute could not be removed through ActionRequest." ;
+ tr45.appendTcDetail(str);
+ };
+ tr45.setTcSuccess(ok);
+ } catch(Exception e) {tr45.appendTcDetail(e.toString());}
+ tr45.writeTo(writer);
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_setAttribute */
/* Details: "In a target servlet of a forward in the Action phase, */
/* the method HttpServletRequest.setAttribute must provide the same */
/* functionality as ActionRequest.setAttribute" */
- TestResult tr47 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_SETATTRIBUTE);
- /* TODO: implement test */
- tr47.appendTcDetail("Not implemented.");
- tr47.writeTo(writer);
-
- /* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_setCharacterEncoding */
- /* Details: "In a target servlet of a forward in the Action phase, */
- /* the method HttpServletRequest.setCharacterEncoding must provide */
- /* the same functionality as ActionRequest.setCharacterEncoding" */
- TestResult tr48 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_SETCHARACTERENCODING);
- /* TODO: implement test */
- tr48.appendTcDetail("Not implemented.");
- tr48.writeTo(writer);
+ TestResult tr46 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONREQUEST_SETATTRIBUTE);
+ try {
+ String hname = ATTR_PREFIX + "V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_setAttribute1";
+ String pname = ATTR_PREFIX + "V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_setAttribute2";
+ request.setAttribute(hname, "Value");
+ portletReq.setAttribute(pname, "Value");
+ String hval = (String)request.getAttribute(hname);
+ String pval = (String)portletReq.getAttribute(pname);
+ request.removeAttribute(hname);
+ portletReq.removeAttribute(pname);
+ boolean ok = (hval.equals("Value") && pval.equals("Value")) ;
+ String str = "";
+ if (!ok) {;
+ if (!hval.equals("Value")) str += "Attribute could not be set/read through HttpServletRequest." ;
+ if (!pval.equals("Value")) str += "Attribute could not be set/read through ActionRequest." ;
+ tr46.appendTcDetail(str);
+ };
+ tr46.setTcSuccess(ok);
+ } catch(Exception e) {tr46.appendTcDetail(e.toString());}
+ tr46.writeTo(writer);
request.getSession().setAttribute(
Constants.RESULT_ATTR_PREFIX + "DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest",
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/6e60b5f0/portlet-tck_3.0/V2DispatcherReqRespTests2/src/main/java/javax/portlet/tck/servlets/DispatcherReqRespTests2_SPEC2_19_ForwardServletActionResponse_servlet.java
----------------------------------------------------------------------
diff --git a/portlet-tck_3.0/V2DispatcherReqRespTests2/src/main/java/javax/portlet/tck/servlets/DispatcherReqRespTests2_SPEC2_19_ForwardServletActionResponse_servlet.java b/portlet-tck_3.0/V2DispatcherReqRespTests2/src/main/java/javax/portlet/tck/servlets/DispatcherReqRespTests2_SPEC2_19_ForwardServletActionResponse_servlet.java
index 6b4b0b8..d20071f 100644
--- a/portlet-tck_3.0/V2DispatcherReqRespTests2/src/main/java/javax/portlet/tck/servlets/DispatcherReqRespTests2_SPEC2_19_ForwardServletActionResponse_servlet.java
+++ b/portlet-tck_3.0/V2DispatcherReqRespTests2/src/main/java/javax/portlet/tck/servlets/DispatcherReqRespTests2_SPEC2_19_ForwardServletActionResponse_servlet.java
@@ -108,8 +108,12 @@ public class DispatcherReqRespTests2_SPEC2_19_ForwardServletActionResponse_servl
/* the method HttpServletResponse.encodeURL must provide the same */
/* functionality as ActionResponse.encodeURL" */
TestResult tr3 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONRESPONSE_ENCODEURL1);
- /* TODO: implement test */
- tr3.appendTcDetail("Not implemented.");
+ try {
+ String turl = "http://www.apache.org/";
+ String hval = (String)response.encodeURL(turl);
+ String pval = (String)portletResp.encodeURL(turl);
+ CompareUtils.stringsEqual("HttpServletResponse", hval, "ActionResponse", pval, tr3);
+ } catch(Exception e) {tr3.appendTcDetail(e.toString());}
tr3.writeTo(writer);
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionResponse_encodeUrl */
@@ -117,8 +121,12 @@ public class DispatcherReqRespTests2_SPEC2_19_ForwardServletActionResponse_servl
/* the method HttpServletResponse.encodeUrl must provide the same */
/* functionality as ActionResponse.encodeURL" */
TestResult tr4 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONRESPONSE_ENCODEURL);
- /* TODO: implement test */
- tr4.appendTcDetail("Not implemented.");
+ try {
+ String turl = "http://www.apache.org/";
+ String hval = (String)response.encodeUrl(turl);
+ String pval = (String)portletResp.encodeURL(turl);
+ CompareUtils.stringsEqual("HttpServletResponse", hval, "ActionResponse", pval, tr4);
+ } catch(Exception e) {tr4.appendTcDetail(e.toString());}
tr4.writeTo(writer);
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionResponse_getBufferSize */
@@ -174,15 +182,6 @@ public class DispatcherReqRespTests2_SPEC2_19_ForwardServletActionResponse_servl
} catch(Exception e) {tr9.appendTcDetail(e.toString());}
tr9.writeTo(writer);
- /* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionResponse_sendRedirect */
- /* Details: "In a target servlet of a forward in the Action phase, */
- /* the method HttpServletResponse.sendRedirect must provide the same */
- /* functionality as ActionResponse.sendRedirect" */
- TestResult tr10 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETACTIONRESPONSE_SENDREDIRECT);
- /* TODO: implement test */
- tr10.appendTcDetail("Not implemented.");
- tr10.writeTo(writer);
-
request.getSession().setAttribute(
Constants.RESULT_ATTR_PREFIX + "DispatcherReqRespTests2_SPEC2_19_ForwardServletActionResponse",
writer.toString());
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/6e60b5f0/portlet-tck_3.0/V2DispatcherReqRespTests2/src/main/java/javax/portlet/tck/servlets/DispatcherReqRespTests2_SPEC2_19_ForwardServletEventRequest_servlet.java
----------------------------------------------------------------------
diff --git a/portlet-tck_3.0/V2DispatcherReqRespTests2/src/main/java/javax/portlet/tck/servlets/DispatcherReqRespTests2_SPEC2_19_ForwardServletEventRequest_servlet.java b/portlet-tck_3.0/V2DispatcherReqRespTests2/src/main/java/javax/portlet/tck/servlets/DispatcherReqRespTests2_SPEC2_19_ForwardServletEventRequest_servlet.java
index 1655b2a..e5b56f2 100644
--- a/portlet-tck_3.0/V2DispatcherReqRespTests2/src/main/java/javax/portlet/tck/servlets/DispatcherReqRespTests2_SPEC2_19_ForwardServletEventRequest_servlet.java
+++ b/portlet-tck_3.0/V2DispatcherReqRespTests2/src/main/java/javax/portlet/tck/servlets/DispatcherReqRespTests2_SPEC2_19_ForwardServletEventRequest_servlet.java
@@ -172,8 +172,16 @@ public class DispatcherReqRespTests2_SPEC2_19_ForwardServletEventRequest_servlet
/* corresponding to that returned by EventRequest.getProperty for the */
/* corresponding header name" */
TestResult tr8 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETEVENTREQUEST_GETDATEHEADER);
- /* TODO: implement test */
- tr8.appendTcDetail("Not implemented.");
+ try {
+ long hval = request.getDateHeader(MOD_HEADER);
+ long pval = Long.parseLong(portletReq.getProperty(MOD_HEADER));
+ boolean ok = (hval == pval);
+ if (!ok) {
+ String str = MOD_HEADER + " from HttpServletRequest: " + hval + ", did not equal " + pval + " from EventRequest";
+ tr8.appendTcDetail(str);
+ }
+ tr8.setTcSuccess(ok);
+ } catch(Exception e) {tr8.appendTcDetail(e.toString());}
tr8.writeTo(writer);
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletEventRequest_getHeader */
@@ -182,8 +190,11 @@ public class DispatcherReqRespTests2_SPEC2_19_ForwardServletEventRequest_servlet
/* corresponding to that returned by EventRequest.getProperty for the */
/* corresponding header name" */
TestResult tr9 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETEVENTREQUEST_GETHEADER);
- /* TODO: implement test */
- tr9.appendTcDetail("Not implemented.");
+ try {
+ String hval = request.getHeader(ACCEPT_HEADER);
+ String pval = portletReq.getProperty(ACCEPT_HEADER);
+ CompareUtils.stringsEqual("HttpServletRequest", hval, "EventRequest", pval, tr9);
+ } catch(Exception e) {tr9.appendTcDetail(e.toString());}
tr9.writeTo(writer);
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletEventRequest_getHeaderNames */
@@ -192,18 +203,42 @@ public class DispatcherReqRespTests2_SPEC2_19_ForwardServletEventRequest_servlet
/* contained in the Enumeration returned by */
/* EventRequest.getPropertyNames" */
TestResult tr10 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETEVENTREQUEST_GETHEADERNAMES);
- /* TODO: implement test */
- tr10.appendTcDetail("Not implemented.");
+ try {
+ // he must be contained in pe
+ Enumeration<String> he = request.getHeaderNames();
+ Enumeration<String> pe = portletReq.getPropertyNames();
+ HashSet<String> hs = new HashSet<String>();
+ while (he.hasMoreElements()) {
+ hs.add(he.nextElement());
+ }
+ HashSet<String> ps = new HashSet<String>();
+ while (pe.hasMoreElements()) {
+ ps.add(pe.nextElement());
+ }
+ boolean ok = ps.containsAll(hs);
+ if (!ok) {
+ hs.removeAll(ps);
+ String str = "The following headers from HttpServletRequest are not contained in EventRequest: ";
+ for (String h : hs) {;
+ str += "\"" + h + "\", ";
+ };
+ tr10.appendTcDetail(str);
+ }
+ tr10.setTcSuccess(ok);
+ } catch(Exception e) {tr10.appendTcDetail(e.toString());}
tr10.writeTo(writer);
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletEventRequest_getHeaders */
/* Details: "In a target servlet of a forward in the Event phase, the */
/* method HttpServletRequest.getHeaders must return a value */
- /* corresponding to that returned by EventRequest.getProperty for the */
- /* corresponding header name" */
+ /* corresponding to that returned by EventRequest.getProperties for */
+ /* the corresponding header name" */
TestResult tr11 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETEVENTREQUEST_GETHEADERS);
- /* TODO: implement test */
- tr11.appendTcDetail("Not implemented.");
+ try {
+ Enumeration<String> he = request.getHeaders(ACCEPT_LANG_HEADER);
+ Enumeration<String> pe = portletReq.getProperties(ACCEPT_LANG_HEADER);
+ CompareUtils.enumsEqual("HttpServletRequest parameter names", he, "EventRequest parameter names", pe,tr11);
+ } catch(Exception e) {tr11.appendTcDetail(e.toString());}
tr11.writeTo(writer);
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletEventRequest_getInputStream */
@@ -222,8 +257,16 @@ public class DispatcherReqRespTests2_SPEC2_19_ForwardServletEventRequest_servlet
/* corresponding to that returned by EventRequest.getProperty for the */
/* corresponding header name" */
TestResult tr13 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETEVENTREQUEST_GETINTHEADER);
- /* TODO: implement test */
- tr13.appendTcDetail("Not implemented.");
+ try {
+ int hval = request.getIntHeader(CONTENT_LENGTH_HEADER);
+ int pval = Integer.parseInt(portletReq.getProperty(CONTENT_LENGTH_HEADER));
+ boolean ok = (hval == pval);
+ if (!ok) {
+ String str = CONTENT_LENGTH_HEADER + " from HttpServletRequest: " + hval + ", did not equal " + pval + " from EventRequest";
+ tr13.appendTcDetail(str);
+ }
+ tr13.setTcSuccess(ok);
+ } catch(Exception e) {tr13.appendTcDetail(e.toString());}
tr13.writeTo(writer);
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletEventRequest_getLocalAddr */
@@ -480,8 +523,14 @@ public class DispatcherReqRespTests2_SPEC2_19_ForwardServletEventRequest_servlet
/* method HttpServletRequest.getRequestDispatcher must provide */
/* functionality as defined in the servlet specification" */
TestResult tr34 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETEVENTREQUEST_GETREQUESTDISPATCHER);
- /* TODO: implement test */
- tr34.appendTcDetail("Not implemented.");
+ try {
+ String sname = SERVLET_PREFIX + "DispatcherReqRespTests2_SPEC2_19_ForwardServletEventRequest_servlet" + SERVLET_SUFFIX;
+ RequestDispatcher hval = request.getRequestDispatcher(sname);
+ if (hval == null) {
+ tr34.appendTcDetail("Could not obtain request dispatcher for " + sname);
+ }
+ tr34.setTcSuccess(hval != null);
+ } catch(Exception e) {tr34.appendTcDetail(e.toString());}
tr34.writeTo(writer);
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletEventRequest_getRequestURI */
@@ -583,8 +632,13 @@ public class DispatcherReqRespTests2_SPEC2_19_ForwardServletEventRequest_servlet
/* functionality as */
/* EventRequest.getPortletSession(APPLICATION_SCOPE)" */
TestResult tr42 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETEVENTREQUEST_GETSESSION);
- /* TODO: implement test */
- tr42.appendTcDetail("Not implemented.");
+ try {
+ HttpSession hval = request.getSession();
+ if (hval == null) {
+ tr42.appendTcDetail("Could not get session from HttpServletRequest");
+ }
+ tr42.setTcSuccess(hval != null);
+ } catch(Exception e) {tr42.appendTcDetail(e.toString());}
tr42.writeTo(writer);
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletEventRequest_getUserPrincipal */
@@ -656,8 +710,24 @@ public class DispatcherReqRespTests2_SPEC2_19_ForwardServletEventRequest_servlet
/* method HttpServletRequest.removeAttribute must provide the same */
/* functionality as EventRequest.removeAttribute" */
TestResult tr47 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETEVENTREQUEST_REMOVEATTRIBUTE);
- /* TODO: implement test */
- tr47.appendTcDetail("Not implemented.");
+ try {
+ String hname = ATTR_PREFIX + "V2DispatcherReqRespTests2_SPEC2_19_ForwardServletEventRequest_removeAttribute1";
+ String pname = ATTR_PREFIX + "V2DispatcherReqRespTests2_SPEC2_19_ForwardServletEventRequest_removeAttribute2";
+ request.setAttribute(hname, "Value");
+ portletReq.setAttribute(pname, "Value");
+ request.removeAttribute(hname);
+ portletReq.removeAttribute(pname);
+ String hval = (String)request.getAttribute(hname);
+ String pval = (String)portletReq.getAttribute(pname);
+ boolean ok = (hval == null) && (pval == null);
+ String str = "";
+ if (!ok) {;
+ if (hval != null) str += "Attribute could not be removed through HttpServletRequest." ;
+ if (pval != null) str += "Attribute could not be removed through EventRequest." ;
+ tr47.appendTcDetail(str);
+ };
+ tr47.setTcSuccess(ok);
+ } catch(Exception e) {tr47.appendTcDetail(e.toString());}
tr47.writeTo(writer);
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletEventRequest_setAttribute */
@@ -665,8 +735,24 @@ public class DispatcherReqRespTests2_SPEC2_19_ForwardServletEventRequest_servlet
/* method HttpServletRequest.setAttribute must provide the same */
/* functionality as EventRequest.setAttribute" */
TestResult tr48 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETEVENTREQUEST_SETATTRIBUTE);
- /* TODO: implement test */
- tr48.appendTcDetail("Not implemented.");
+ try {
+ String hname = ATTR_PREFIX + "V2DispatcherReqRespTests2_SPEC2_19_ForwardServletEventRequest_setAttribute1";
+ String pname = ATTR_PREFIX + "V2DispatcherReqRespTests2_SPEC2_19_ForwardServletEventRequest_setAttribute2";
+ request.setAttribute(hname, "Value");
+ portletReq.setAttribute(pname, "Value");
+ String hval = (String)request.getAttribute(hname);
+ String pval = (String)portletReq.getAttribute(pname);
+ request.removeAttribute(hname);
+ portletReq.removeAttribute(pname);
+ boolean ok = (hval.equals("Value") && pval.equals("Value")) ;
+ String str = "";
+ if (!ok) {;
+ if (!hval.equals("Value")) str += "Attribute could not be set/read through HttpServletRequest." ;
+ if (!pval.equals("Value")) str += "Attribute could not be set/read through EventRequest." ;
+ tr48.appendTcDetail(str);
+ };
+ tr48.setTcSuccess(ok);
+ } catch(Exception e) {tr48.appendTcDetail(e.toString());}
tr48.writeTo(writer);
request.getSession().setAttribute(
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/6e60b5f0/portlet-tck_3.0/V2DispatcherReqRespTests2/src/main/java/javax/portlet/tck/servlets/DispatcherReqRespTests2_SPEC2_19_ForwardServletEventResponse_servlet.java
----------------------------------------------------------------------
diff --git a/portlet-tck_3.0/V2DispatcherReqRespTests2/src/main/java/javax/portlet/tck/servlets/DispatcherReqRespTests2_SPEC2_19_ForwardServletEventResponse_servlet.java b/portlet-tck_3.0/V2DispatcherReqRespTests2/src/main/java/javax/portlet/tck/servlets/DispatcherReqRespTests2_SPEC2_19_ForwardServletEventResponse_servlet.java
index 4770db7..f6e3901 100644
--- a/portlet-tck_3.0/V2DispatcherReqRespTests2/src/main/java/javax/portlet/tck/servlets/DispatcherReqRespTests2_SPEC2_19_ForwardServletEventResponse_servlet.java
+++ b/portlet-tck_3.0/V2DispatcherReqRespTests2/src/main/java/javax/portlet/tck/servlets/DispatcherReqRespTests2_SPEC2_19_ForwardServletEventResponse_servlet.java
@@ -108,8 +108,12 @@ public class DispatcherReqRespTests2_SPEC2_19_ForwardServletEventResponse_servle
/* method HttpServletResponse.encodeURL must provide the same */
/* functionality as EventResponse.encodeURL" */
TestResult tr3 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETEVENTRESPONSE_ENCODEURL1);
- /* TODO: implement test */
- tr3.appendTcDetail("Not implemented.");
+ try {
+ String turl = "http://www.apache.org/";
+ String hval = (String)response.encodeURL(turl);
+ String pval = (String)portletResp.encodeURL(turl);
+ CompareUtils.stringsEqual("HttpServletResponse", hval, "EventResponse", pval, tr3);
+ } catch(Exception e) {tr3.appendTcDetail(e.toString());}
tr3.writeTo(writer);
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletEventResponse_encodeUrl */
@@ -117,8 +121,12 @@ public class DispatcherReqRespTests2_SPEC2_19_ForwardServletEventResponse_servle
/* method HttpServletResponse.encodeUrl must provide the same */
/* functionality as EventResponse.encodeURL" */
TestResult tr4 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETEVENTRESPONSE_ENCODEURL);
- /* TODO: implement test */
- tr4.appendTcDetail("Not implemented.");
+ try {
+ String turl = "http://www.apache.org/";
+ String hval = (String)response.encodeUrl(turl);
+ String pval = (String)portletResp.encodeURL(turl);
+ CompareUtils.stringsEqual("HttpServletResponse", hval, "EventResponse", pval, tr4);
+ } catch(Exception e) {tr4.appendTcDetail(e.toString());}
tr4.writeTo(writer);
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletEventResponse_getBufferSize */
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/6e60b5f0/portlet-tck_3.0/V2DispatcherReqRespTests2/src/main/java/javax/portlet/tck/servlets/DispatcherReqRespTests2_SPEC2_19_ForwardServletRenderRequest_servlet.java
----------------------------------------------------------------------
diff --git a/portlet-tck_3.0/V2DispatcherReqRespTests2/src/main/java/javax/portlet/tck/servlets/DispatcherReqRespTests2_SPEC2_19_ForwardServletRenderRequest_servlet.java b/portlet-tck_3.0/V2DispatcherReqRespTests2/src/main/java/javax/portlet/tck/servlets/DispatcherReqRespTests2_SPEC2_19_ForwardServletRenderRequest_servlet.java
index d174d5a..ab5ae90 100644
--- a/portlet-tck_3.0/V2DispatcherReqRespTests2/src/main/java/javax/portlet/tck/servlets/DispatcherReqRespTests2_SPEC2_19_ForwardServletRenderRequest_servlet.java
+++ b/portlet-tck_3.0/V2DispatcherReqRespTests2/src/main/java/javax/portlet/tck/servlets/DispatcherReqRespTests2_SPEC2_19_ForwardServletRenderRequest_servlet.java
@@ -173,8 +173,16 @@ public class DispatcherReqRespTests2_SPEC2_19_ForwardServletRenderRequest_servle
/* corresponding to that returned by RenderRequest.getProperty for */
/* the corresponding header name" */
TestResult tr8 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETRENDERREQUEST_GETDATEHEADER);
- /* TODO: implement test */
- tr8.appendTcDetail("Not implemented.");
+ try {
+ long hval = request.getDateHeader(MOD_HEADER);
+ long pval = Long.parseLong(portletReq.getProperty(MOD_HEADER));
+ boolean ok = (hval == pval);
+ if (!ok) {
+ String str = MOD_HEADER + " from HttpServletRequest: " + hval + ", did not equal " + pval + " from RenderRequest";
+ tr8.appendTcDetail(str);
+ }
+ tr8.setTcSuccess(ok);
+ } catch(Exception e) {tr8.appendTcDetail(e.toString());}
tr8.writeTo(writer);
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletRenderRequest_getHeader */
@@ -183,8 +191,11 @@ public class DispatcherReqRespTests2_SPEC2_19_ForwardServletRenderRequest_servle
/* corresponding to that returned by RenderRequest.getProperty for */
/* the corresponding header name" */
TestResult tr9 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETRENDERREQUEST_GETHEADER);
- /* TODO: implement test */
- tr9.appendTcDetail("Not implemented.");
+ try {
+ String hval = request.getHeader(ACCEPT_HEADER);
+ String pval = portletReq.getProperty(ACCEPT_HEADER);
+ CompareUtils.stringsEqual("HttpServletRequest", hval, "RenderRequest", pval, tr9);
+ } catch(Exception e) {tr9.appendTcDetail(e.toString());}
tr9.writeTo(writer);
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletRenderRequest_getHeaderNames */
@@ -193,18 +204,42 @@ public class DispatcherReqRespTests2_SPEC2_19_ForwardServletRenderRequest_servle
/* be contained in the Enumeration returned by */
/* RenderRequest.getPropertyNames" */
TestResult tr10 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETRENDERREQUEST_GETHEADERNAMES);
- /* TODO: implement test */
- tr10.appendTcDetail("Not implemented.");
+ try {
+ // he must be contained in pe
+ Enumeration<String> he = request.getHeaderNames();
+ Enumeration<String> pe = portletReq.getPropertyNames();
+ HashSet<String> hs = new HashSet<String>();
+ while (he.hasMoreElements()) {
+ hs.add(he.nextElement());
+ }
+ HashSet<String> ps = new HashSet<String>();
+ while (pe.hasMoreElements()) {
+ ps.add(pe.nextElement());
+ }
+ boolean ok = ps.containsAll(hs);
+ if (!ok) {
+ hs.removeAll(ps);
+ String str = "The following headers from HttpServletRequest are not contained in RenderRequest: ";
+ for (String h : hs) {;
+ str += "\"" + h + "\", ";
+ };
+ tr10.appendTcDetail(str);
+ }
+ tr10.setTcSuccess(ok);
+ } catch(Exception e) {tr10.appendTcDetail(e.toString());}
tr10.writeTo(writer);
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletRenderRequest_getHeaders */
/* Details: "In a target servlet of a forward in the Render phase, */
/* the method HttpServletRequest.getHeaders must return a value */
- /* corresponding to that returned by RenderRequest.getProperty for */
+ /* corresponding to that returned by RenderRequest.getProperties for */
/* the corresponding header name" */
TestResult tr11 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETRENDERREQUEST_GETHEADERS);
- /* TODO: implement test */
- tr11.appendTcDetail("Not implemented.");
+ try {
+ Enumeration<String> he = request.getHeaders(ACCEPT_LANG_HEADER);
+ Enumeration<String> pe = portletReq.getProperties(ACCEPT_LANG_HEADER);
+ CompareUtils.enumsEqual("HttpServletRequest parameter names", he, "RenderRequest parameter names", pe,tr11);
+ } catch(Exception e) {tr11.appendTcDetail(e.toString());}
tr11.writeTo(writer);
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletRenderRequest_getInputStream */
@@ -223,8 +258,16 @@ public class DispatcherReqRespTests2_SPEC2_19_ForwardServletRenderRequest_servle
/* corresponding to that returned by RenderRequest.getProperty for */
/* the corresponding header name" */
TestResult tr13 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETRENDERREQUEST_GETINTHEADER);
- /* TODO: implement test */
- tr13.appendTcDetail("Not implemented.");
+ try {
+ int hval = request.getIntHeader(CONTENT_LENGTH_HEADER);
+ int pval = Integer.parseInt(portletReq.getProperty(CONTENT_LENGTH_HEADER));
+ boolean ok = (hval == pval);
+ if (!ok) {
+ String str = CONTENT_LENGTH_HEADER + " from HttpServletRequest: " + hval + ", did not equal " + pval + " from RenderRequest";
+ tr13.appendTcDetail(str);
+ }
+ tr13.setTcSuccess(ok);
+ } catch(Exception e) {tr13.appendTcDetail(e.toString());}
tr13.writeTo(writer);
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletRenderRequest_getLocalAddr */
@@ -481,8 +524,14 @@ public class DispatcherReqRespTests2_SPEC2_19_ForwardServletRenderRequest_servle
/* the method HttpServletRequest.getRequestDispatcher must provide */
/* functionality as defined in the servlet specification" */
TestResult tr34 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETRENDERREQUEST_GETREQUESTDISPATCHER);
- /* TODO: implement test */
- tr34.appendTcDetail("Not implemented.");
+ try {
+ String sname = SERVLET_PREFIX + "DispatcherReqRespTests2_SPEC2_19_ForwardServletRenderRequest_servlet" + SERVLET_SUFFIX;
+ RequestDispatcher hval = request.getRequestDispatcher(sname);
+ if (hval == null) {
+ tr34.appendTcDetail("Could not obtain request dispatcher for " + sname);
+ }
+ tr34.setTcSuccess(hval != null);
+ } catch(Exception e) {tr34.appendTcDetail(e.toString());}
tr34.writeTo(writer);
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletRenderRequest_getRequestURI */
@@ -584,8 +633,13 @@ public class DispatcherReqRespTests2_SPEC2_19_ForwardServletRenderRequest_servle
/* functionality as */
/* RenderRequest.getPortletSession(APPLICATION_SCOPE)" */
TestResult tr42 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETRENDERREQUEST_GETSESSION);
- /* TODO: implement test */
- tr42.appendTcDetail("Not implemented.");
+ try {
+ HttpSession hval = request.getSession();
+ if (hval == null) {
+ tr42.appendTcDetail("Could not get session from HttpServletRequest");
+ }
+ tr42.setTcSuccess(hval != null);
+ } catch(Exception e) {tr42.appendTcDetail(e.toString());}
tr42.writeTo(writer);
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletRenderRequest_getUserPrincipal */
@@ -658,8 +712,24 @@ public class DispatcherReqRespTests2_SPEC2_19_ForwardServletRenderRequest_servle
/* the method HttpServletRequest.removeAttribute must provide the */
/* same functionality as RenderRequest.removeAttribute" */
TestResult tr47 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETRENDERREQUEST_REMOVEATTRIBUTE);
- /* TODO: implement test */
- tr47.appendTcDetail("Not implemented.");
+ try {
+ String hname = ATTR_PREFIX + "V2DispatcherReqRespTests2_SPEC2_19_ForwardServletRenderRequest_removeAttribute1";
+ String pname = ATTR_PREFIX + "V2DispatcherReqRespTests2_SPEC2_19_ForwardServletRenderRequest_removeAttribute2";
+ request.setAttribute(hname, "Value");
+ portletReq.setAttribute(pname, "Value");
+ request.removeAttribute(hname);
+ portletReq.removeAttribute(pname);
+ String hval = (String)request.getAttribute(hname);
+ String pval = (String)portletReq.getAttribute(pname);
+ boolean ok = (hval == null) && (pval == null);
+ String str = "";
+ if (!ok) {;
+ if (hval != null) str += "Attribute could not be removed through HttpServletRequest." ;
+ if (pval != null) str += "Attribute could not be removed through RenderRequest." ;
+ tr47.appendTcDetail(str);
+ };
+ tr47.setTcSuccess(ok);
+ } catch(Exception e) {tr47.appendTcDetail(e.toString());}
tr47.writeTo(writer);
/* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletRenderRequest_setAttribute */
@@ -667,19 +737,26 @@ public class DispatcherReqRespTests2_SPEC2_19_ForwardServletRenderRequest_servle
/* the method HttpServletRequest.setAttribute must provide the same */
/* functionality as RenderRequest.setAttribute" */
TestResult tr48 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETRENDERREQUEST_SETATTRIBUTE);
- /* TODO: implement test */
- tr48.appendTcDetail("Not implemented.");
+ try {
+ String hname = ATTR_PREFIX + "V2DispatcherReqRespTests2_SPEC2_19_ForwardServletRenderRequest_setAttribute1";
+ String pname = ATTR_PREFIX + "V2DispatcherReqRespTests2_SPEC2_19_ForwardServletRenderRequest_setAttribute2";
+ request.setAttribute(hname, "Value");
+ portletReq.setAttribute(pname, "Value");
+ String hval = (String)request.getAttribute(hname);
+ String pval = (String)portletReq.getAttribute(pname);
+ request.removeAttribute(hname);
+ portletReq.removeAttribute(pname);
+ boolean ok = (hval.equals("Value") && pval.equals("Value")) ;
+ String str = "";
+ if (!ok) {;
+ if (!hval.equals("Value")) str += "Attribute could not be set/read through HttpServletRequest." ;
+ if (!pval.equals("Value")) str += "Attribute could not be set/read through RenderRequest." ;
+ tr48.appendTcDetail(str);
+ };
+ tr48.setTcSuccess(ok);
+ } catch(Exception e) {tr48.appendTcDetail(e.toString());}
tr48.writeTo(writer);
- /* TestCase: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletRenderRequest_setCharacterEncoding */
- /* Details: "In a target servlet of a forward in the Render phase, */
- /* the method HttpServletRequest.setCharacterEncoding does not */
- /* perform any operation" */
- TestResult tr49 = tcd.getTestResultFailed(V2DISPATCHERREQRESPTESTS2_SPEC2_19_FORWARDSERVLETRENDERREQUEST_SETCHARACTERENCODING);
- /* TODO: implement test */
- tr49.appendTcDetail("Not implemented.");
- tr49.writeTo(writer);
-
// TestSetupLink for: DispatcherReqRespTests2_SPEC2_19_ForwardServletRenderRequest
{
String val = portletReq.getParameter(PARM_NAME);