You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by lu...@apache.org on 2024/03/26 08:21:27 UTC

(struts) branch revert-670-issue/WW-5251 updated (21af6e597 -> 2bba8ccd3)

This is an automated email from the ASF dual-hosted git repository.

lukaszlenart pushed a change to branch revert-670-issue/WW-5251
in repository https://gitbox.apache.org/repos/asf/struts.git


 discard 21af6e597 WW-5251 Fixes compilation errors in test
     new 2bba8ccd3 WW-5251 Fixes compilation errors in test

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (21af6e597)
            \
             N -- N -- N   refs/heads/revert-670-issue/WW-5251 (2bba8ccd3)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../struts2/portlet/interceptor/PortletStateInterceptorTest.java    | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)


(struts) 01/01: WW-5251 Fixes compilation errors in test

Posted by lu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

lukaszlenart pushed a commit to branch revert-670-issue/WW-5251
in repository https://gitbox.apache.org/repos/asf/struts.git

commit 2bba8ccd3e33101046970edf4732d937d2226037
Author: Lukasz Lenart <lu...@apache.org>
AuthorDate: Tue Mar 26 09:09:56 2024 +0100

    WW-5251 Fixes compilation errors in test
---
 .../interceptor/ServletConfigInterceptorTest.java  | 35 ++++++++++------------
 .../interceptor/PortletStateInterceptorTest.java   |  6 ++--
 2 files changed, 19 insertions(+), 22 deletions(-)

diff --git a/core/src/test/java/org/apache/struts2/interceptor/ServletConfigInterceptorTest.java b/core/src/test/java/org/apache/struts2/interceptor/ServletConfigInterceptorTest.java
index 3cefbf18c..ec3f07e79 100644
--- a/core/src/test/java/org/apache/struts2/interceptor/ServletConfigInterceptorTest.java
+++ b/core/src/test/java/org/apache/struts2/interceptor/ServletConfigInterceptorTest.java
@@ -31,9 +31,6 @@ import org.springframework.mock.web.MockHttpServletRequest;
 import org.springframework.mock.web.MockHttpServletResponse;
 import org.springframework.mock.web.MockServletContext;
 
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -51,14 +48,14 @@ public class ServletConfigInterceptorTest extends StrutsInternalTestCase {
     private ServletConfigInterceptor interceptor;
 
     public void testServletRequestAware() throws Exception {
-        ServletRequestAware mock = (ServletRequestAware) createMock(ServletRequestAware.class);
+        ServletRequestAware mock = createMock(ServletRequestAware.class);
 
         MockHttpServletRequest req = new MockHttpServletRequest();
 
         MockActionInvocation mai = createActionInvocation(mock);
         mai.getInvocationContext().put(StrutsStatics.HTTP_REQUEST, req);
 
-        mock.setServletRequest((HttpServletRequest) req);
+        mock.setServletRequest(req);
         expectLastCall();
 
         replay(mock);
@@ -83,14 +80,14 @@ public class ServletConfigInterceptorTest extends StrutsInternalTestCase {
     }
 
     public void testServletResponseAware() throws Exception {
-        ServletResponseAware mock = (ServletResponseAware) createMock(ServletResponseAware.class);
+        ServletResponseAware mock = createMock(ServletResponseAware.class);
 
         MockHttpServletResponse res = new MockHttpServletResponse();
 
         MockActionInvocation mai = createActionInvocation(mock);
         mai.getInvocationContext().put(StrutsStatics.HTTP_RESPONSE, res);
 
-        mock.setServletResponse((HttpServletResponse) res);
+        mock.setServletResponse(res);
         expectLastCall().times(1);
 
         replay(mock);
@@ -120,7 +117,7 @@ public class ServletConfigInterceptorTest extends StrutsInternalTestCase {
         MockActionInvocation mai = createActionInvocation(mock);
 
         HttpParameters param = HttpParameters.create().build();
-        mai.getInvocationContext().setParameters(param);
+        mai.getInvocationContext().withParameters(param);
 
         param.applyParameters(mock);
         expectLastCall().times(1);
@@ -136,7 +133,7 @@ public class ServletConfigInterceptorTest extends StrutsInternalTestCase {
         MockActionInvocation mai = createActionInvocation(mock);
 
         HttpParameters param = HttpParameters.create().build();
-        mai.getInvocationContext().setParameters(param);
+        mai.getInvocationContext().withParameters(param);
 
         mock.setParameters(param);
         expectLastCall().times(1);
@@ -163,12 +160,12 @@ public class ServletConfigInterceptorTest extends StrutsInternalTestCase {
     }
 
     public void testSessionAware() throws Exception {
-        SessionAware mock = (SessionAware) createMock(SessionAware.class);
+        SessionAware mock = createMock(SessionAware.class);
 
         MockActionInvocation mai = createActionInvocation(mock);
 
-        Map<String, Object> session = new HashMap<String, Object>();
-        mai.getInvocationContext().setSession(session);
+        Map<String, Object> session = new HashMap<>();
+        mai.getInvocationContext().withSession(session);
 
         mock.setSession(session);
         expectLastCall().times(1);
@@ -183,7 +180,7 @@ public class ServletConfigInterceptorTest extends StrutsInternalTestCase {
 
         MockActionInvocation mai = createActionInvocation(mock);
 
-        Map<String, Object> session = new HashMap<String, Object>();
+        Map<String, Object> session = new HashMap<>();
         mai.getInvocationContext().withSession(session);
 
         mock.withSession(session);
@@ -199,7 +196,7 @@ public class ServletConfigInterceptorTest extends StrutsInternalTestCase {
 
         MockActionInvocation mai = createActionInvocation(mock);
 
-        Map<String, Object> app = new HashMap<String, Object>();
+        Map<String, Object> app = new HashMap<>();
         mai.getInvocationContext().withApplication(app);
 
         mock.setApplication(app);
@@ -230,7 +227,7 @@ public class ServletConfigInterceptorTest extends StrutsInternalTestCase {
         MockHttpServletRequest req = new MockHttpServletRequest();
         req.setUserPrincipal(null);
         req.setRemoteUser("Santa");
-        PrincipalAware mock = (PrincipalAware) createMock(PrincipalAware.class);
+        PrincipalAware mock = createMock(PrincipalAware.class);
 
         MockActionInvocation mai = createActionInvocation(mock);
         mai.getInvocationContext().put(StrutsStatics.HTTP_REQUEST, req);
@@ -282,8 +279,8 @@ public class ServletConfigInterceptorTest extends StrutsInternalTestCase {
 
         PrincipalProxy proxy = action.getProxy();
         assertNull(proxy.getUserPrincipal());
-        assertTrue(!proxy.isRequestSecure());
-        assertTrue(!proxy.isUserInRole("no.role"));
+        assertFalse(proxy.isRequestSecure());
+        assertFalse(proxy.isUserInRole("no.role"));
         assertEquals("Santa", proxy.getRemoteUser());
 
     }
@@ -311,14 +308,14 @@ public class ServletConfigInterceptorTest extends StrutsInternalTestCase {
     }
 
     public void testServletContextAware() throws Exception {
-        ServletContextAware mock = (ServletContextAware) createMock(ServletContextAware.class);
+        ServletContextAware mock = createMock(ServletContextAware.class);
 
         MockActionInvocation mai = createActionInvocation(mock);
 
         MockServletContext ctx = new MockServletContext();
         mai.getInvocationContext().put(StrutsStatics.SERVLET_CONTEXT, ctx);
 
-        mock.setServletContext((ServletContext) ctx);
+        mock.setServletContext(ctx);
         expectLastCall().times(1);
 
         replay(mock);
diff --git a/plugins/portlet/src/test/java/org/apache/struts2/portlet/interceptor/PortletStateInterceptorTest.java b/plugins/portlet/src/test/java/org/apache/struts2/portlet/interceptor/PortletStateInterceptorTest.java
index f324cf225..d60b866e4 100644
--- a/plugins/portlet/src/test/java/org/apache/struts2/portlet/interceptor/PortletStateInterceptorTest.java
+++ b/plugins/portlet/src/test/java/org/apache/struts2/portlet/interceptor/PortletStateInterceptorTest.java
@@ -58,7 +58,7 @@ public class PortletStateInterceptorTest extends StrutsTestCasePortletTests {
         Map<String, Object> session = new HashMap<>();
 
         ActionContext ctx = ActionContext.of(ctxMap).bind();
-        ctx.setSession(session);
+        ctx.withSession(session);
         EasyMock.expect(invocation.getInvocationContext()).andStubReturn(ctx);
         actionResponse.setRenderParameter(EVENT_ACTION, "true");
 
@@ -97,7 +97,7 @@ public class PortletStateInterceptorTest extends StrutsTestCasePortletTests {
         ctxMap.put(REQUEST, renderRequest);
 
         ActionContext ctx = ActionContext.of(ctxMap).bind();
-        ctx.setSession(session);
+        ctx.withSession(session);
 
         EasyMock.expect(invocation.getInvocationContext()).andStubReturn(ctx);
         EasyMock.expect(invocation.getStack()).andStubReturn(currentStack);
@@ -138,7 +138,7 @@ public class PortletStateInterceptorTest extends StrutsTestCasePortletTests {
         ctxMap.put(REQUEST, renderRequest);
 
         ActionContext ctx = ActionContext.of(ctxMap).bind();
-        ctx.setSession(session);
+        ctx.withSession(session);
 
         EasyMock.expect(invocation.getInvocationContext()).andStubReturn(ctx);
         EasyMock.expect(invocation.getStack()).andStubReturn(currentStack);