List of usage examples for org.springframework.mock.web MockHttpServletRequest MockHttpServletRequest
public MockHttpServletRequest()
From source file:org.slc.sli.dashboard.unit.controller.ErrorControllerTest.java
@Before public void setup() { request = new MockHttpServletRequest(); response = new MockHttpServletResponse(); errorController = PowerMockito.spy(new ErrorController()); portalWSManager = PowerMockito.spy(new PortalWSManagerImpl()); errorController.setPortalWSManager(portalWSManager); }
From source file:org.araneaframework.tests.framework.router.BaseServiceRouterServiceTests.java
public void setUp() throws Exception { service = new MockBaseServiceRouterService(); map = new HashMap(); child1 = new MockEventfulStandardService(); child2 = new MockEventfulStandardService(); req = new MockHttpServletRequest(); res = new MockHttpServletResponse(); input = new StandardServletInputData(req); output = new StandardServletOutputData(req, res); map.put("first", child1); map.put("second", child2); service.setServiceMap(map);//from ww w .j a v a 2 s. c o m service._getComponent().init(MockUtil.getEnv()); }
From source file:org.araneaframework.tests.framework.router.StandardThreadServiceRouterServiceTests.java
public void setUp() throws Exception { service = new StandardThreadServiceRouterService(); map = new HashMap(); child1 = new MockEventfulStandardService(); child2 = new MockEventfulStandardService(); req = new MockHttpServletRequest(); res = new MockHttpServletResponse(); input = new StandardServletInputData(req); output = new StandardServletOutputData(req, res); map.put("child1", child1); map.put("child2", child2); service.setServiceMap(map);//from w w w . j a v a 2 s .c o m service._getComponent().init(MockUtil.getEnv()); service.setDefaultServiceId("child1"); }
From source file:com.luna.common.web.bind.method.annotation.PageableMethodArgumentResolverTest.java
@Before public void setUp() throws NoSuchMethodException { pageable = Controller.class.getDeclaredMethod("pageable", new Class[] { Pageable.class }); pageableAndSort = Controller.class.getDeclaredMethod("pageable", new Class[] { Pageable.class }); methodDefaultPageable = Controller.class.getDeclaredMethod("methodDefaultPageable", new Class[] { Pageable.class }); parameterDefaultPageable = Controller.class.getDeclaredMethod("parameterDefaultPageable", new Class[] { Pageable.class }); customNamePrefixPageableAndSort = Controller.class.getDeclaredMethod("customNamePrefixPageableAndSort", new Class[] { Pageable.class, Pageable.class }); request = new MockHttpServletRequest(); }
From source file:com.google.api.server.spi.PeerAuthTest.java
@Before public void setUp() throws Exception { request = new MockHttpServletRequest(); attr = Attribute.from(request); attr.set(Attribute.RESTRICT_SERVLET, true); attr.set(Attribute.API_METHOD_CONFIG, config); peerAuth = PeerAuth.from(request);/* w ww. j ava 2 s. c o m*/ }
From source file:org.araneaframework.tests.framework.router.StandardSessionServiceRouterServiceTests.java
public void setUp() throws Exception { service = new StandardSessionServiceRouterService(); map = new HashMap(); child1 = new MockEventfulStandardService(); child2 = new MockEventfulStandardService(); req = new MockHttpServletRequest(); res = new MockHttpServletResponse(); input = new StandardServletInputData(req); output = new StandardServletOutputData(req, res); map.put("child1", child1); map.put("child2", child2); service.setServiceMap(map);//w ww . j a va 2 s .com service._getComponent().init(MockUtil.getEnv()); service.setDefaultServiceId("child1"); }
From source file:org.cloudfoundry.identity.api.web.ApiControllerTests.java
@Test public void testWithUser() throws Exception { controller.setInfo(new ClassPathResource("info.tmpl")); HashMap<String, Object> model = new HashMap<String, Object>(); View view = controller.info(model, new UsernamePasswordAuthenticationToken("marissa", "<NONE>")); MockHttpServletResponse response = new MockHttpServletResponse(); view.render(model, new MockHttpServletRequest(), response); String content = response.getContentAsString(); assertTrue("Wrong content: " + content, content.contains("\n \"user\": \"marissa\"")); }
From source file:org.openmrs.module.webservices.rest.web.v1_0.controller.CohortMemberControllerTest.java
@Before public void before() throws Exception { this.service = Context.getCohortService(); this.controller = new CohortMemberController(); this.request = new MockHttpServletRequest(); this.response = new MockHttpServletResponse(); executeDataSet(datasetFilename);//from w w w. j av a 2s . c o m }
From source file:net.lshift.diffa.adapter.scanning.AggregationBuilderTest.java
@Test public void shouldNotAddDateAggregationWhenDifferentParameterIsAvailable() { MockHttpServletRequest req = new MockHttpServletRequest(); req.addParameter("someString-granularity", "prefix(1)"); AggregationBuilder builder = new AggregationBuilder(req); builder.maybeAddDateAggregation("bizDate"); assertEquals(0, builder.toList().size()); }
From source file:nl.dtls.fairdatapoint.api.controller.MetadataControllerTest.java
/** * Check unsupported accept header./*from w w w . j ava 2s. c o m*/ * * @throws Exception */ @Test(expected = Exception.class) public void unsupportedAcceptHeader() throws Exception { MockHttpServletRequest request; MockHttpServletResponse response; Object handler; request = new MockHttpServletRequest(); response = new MockHttpServletResponse(); request.setMethod("GET"); request.addHeader(HttpHeaders.ACCEPT, "application/trig"); request.setRequestURI("/textmining"); handler = handlerMapping.getHandler(request).getHandler(); handlerAdapter.handle(request, response, handler); assertEquals(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE, response.getStatus()); }