fixed Portlet UnavailableException tests (SPR-7542)
This commit is contained in:
parent
4c154d3cab
commit
803b336354
|
|
@ -159,7 +159,7 @@ public class ComplexPortletApplicationContext extends StaticPortletApplicationCo
|
|||
pvs.add("exceptionMappings",
|
||||
"java.lang.IllegalAccessException=failed-illegalaccess\n" +
|
||||
"PortletRequestBindingException=failed-binding\n" +
|
||||
"UnavailableException=failed-unavailable");
|
||||
"NoHandlerFoundException=failed-unavailable");
|
||||
pvs.add("defaultErrorView", "failed-default-1");
|
||||
registerSingleton("exceptionResolver", SimpleMappingExceptionResolver.class, pvs);
|
||||
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ public class DispatcherPortletTests extends TestCase {
|
|||
simpleDispatcherPortlet.processAction(request, response);
|
||||
String exceptionParam = response.getRenderParameter(DispatcherPortlet.ACTION_EXCEPTION_RENDER_PARAMETER);
|
||||
assertNotNull(exceptionParam);
|
||||
assertTrue(exceptionParam.startsWith(UnavailableException.class.getName()));
|
||||
assertTrue(exceptionParam.startsWith(NoHandlerFoundException.class.getName()));
|
||||
}
|
||||
|
||||
public void testSimpleFormViewNoBindOnNewForm() throws Exception {
|
||||
|
|
@ -246,7 +246,7 @@ public class DispatcherPortletTests extends TestCase {
|
|||
simpleDispatcherPortlet.doDispatch(request, response);
|
||||
fail("Should have thrown UnavailableException");
|
||||
}
|
||||
catch (UnavailableException ex) {
|
||||
catch (NoHandlerFoundException ex) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
|
@ -279,7 +279,7 @@ public class DispatcherPortletTests extends TestCase {
|
|||
complexDispatcherPortlet.processAction(request, response);
|
||||
String exceptionParam = response.getRenderParameter(DispatcherPortlet.ACTION_EXCEPTION_RENDER_PARAMETER);
|
||||
assertNotNull(exceptionParam);
|
||||
assertTrue(exceptionParam.startsWith(UnavailableException.class.getName()));
|
||||
assertTrue(exceptionParam.startsWith(NoHandlerFoundException.class.getName()));
|
||||
}
|
||||
|
||||
public void testPortletModeParameterMappingInvalidHelpRenderRequest() throws Exception {
|
||||
|
|
@ -289,7 +289,7 @@ public class DispatcherPortletTests extends TestCase {
|
|||
request.setParameter("action", "help3");
|
||||
complexDispatcherPortlet.doDispatch(request, response);
|
||||
Map model = (Map) request.getAttribute(ViewRendererServlet.MODEL_ATTRIBUTE);
|
||||
assertTrue(model.get("exception").getClass().equals(UnavailableException.class));
|
||||
assertTrue(model.get("exception").getClass().equals(NoHandlerFoundException.class));
|
||||
InternalResourceView view = (InternalResourceView) request.getAttribute(ViewRendererServlet.VIEW_ATTRIBUTE);
|
||||
assertEquals("failed-unavailable", view.getBeanName());
|
||||
}
|
||||
|
|
@ -405,7 +405,7 @@ public class DispatcherPortletTests extends TestCase {
|
|||
complexDispatcherPortlet.processAction(request, response);
|
||||
String exceptionParam = response.getRenderParameter(DispatcherPortlet.ACTION_EXCEPTION_RENDER_PARAMETER);
|
||||
assertNotNull(exceptionParam);
|
||||
assertTrue(exceptionParam.startsWith(UnavailableException.class.getName()));
|
||||
assertTrue(exceptionParam.startsWith(NoHandlerFoundException.class.getName()));
|
||||
}
|
||||
|
||||
public void testNoDetectAllHandlerMappingsWithParameterRenderRequest() throws Exception {
|
||||
|
|
@ -420,7 +420,7 @@ public class DispatcherPortletTests extends TestCase {
|
|||
complexDispatcherPortlet.doDispatch(request, response);
|
||||
Map model = (Map) request.getAttribute(ViewRendererServlet.MODEL_ATTRIBUTE);
|
||||
Exception exception = (Exception) model.get("exception");
|
||||
assertTrue(exception.getClass().equals(UnavailableException.class));
|
||||
assertTrue(exception.getClass().equals(NoHandlerFoundException.class));
|
||||
InternalResourceView view = (InternalResourceView) request.getAttribute(ViewRendererServlet.VIEW_ATTRIBUTE);
|
||||
assertEquals("failed-unavailable", view.getBeanName());
|
||||
}
|
||||
|
|
@ -900,9 +900,9 @@ public class DispatcherPortletTests extends TestCase {
|
|||
|
||||
try {
|
||||
simpleDispatcherPortlet.doDispatch(request, response);
|
||||
fail("should have failed to find a handler and raised an UnavailableException");
|
||||
fail("should have failed to find a handler and raised an NoHandlerFoundExceptionException");
|
||||
}
|
||||
catch (UnavailableException ex) {
|
||||
catch (NoHandlerFoundException ex) {
|
||||
// expected
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ import javax.portlet.PortletSession;
|
|||
import javax.portlet.RenderRequest;
|
||||
import javax.portlet.RenderResponse;
|
||||
import javax.portlet.StateAwareResponse;
|
||||
import javax.portlet.UnavailableException;
|
||||
import javax.portlet.WindowState;
|
||||
import javax.servlet.http.Cookie;
|
||||
|
||||
|
|
@ -86,6 +85,7 @@ import org.springframework.web.context.request.WebRequest;
|
|||
import org.springframework.web.context.support.GenericWebApplicationContext;
|
||||
import org.springframework.web.portlet.DispatcherPortlet;
|
||||
import org.springframework.web.portlet.ModelAndView;
|
||||
import org.springframework.web.portlet.NoHandlerFoundException;
|
||||
import org.springframework.web.portlet.bind.annotation.ActionMapping;
|
||||
import org.springframework.web.portlet.bind.annotation.EventMapping;
|
||||
import org.springframework.web.portlet.bind.annotation.RenderMapping;
|
||||
|
|
@ -419,9 +419,9 @@ public class Portlet20AnnotationControllerTests {
|
|||
MockRenderResponse response = new MockRenderResponse();
|
||||
try {
|
||||
portlet.render(request, response);
|
||||
fail("Should have thrown UnavailableException");
|
||||
fail("Should have thrown NoHandlerFoundException");
|
||||
}
|
||||
catch (UnavailableException ex) {
|
||||
catch (NoHandlerFoundException ex) {
|
||||
// expected
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue