Search in sources :

Example 1 with MockHttpServletResponse

use of com.zimbra.cs.service.MockHttpServletResponse in project zm-mailbox by Zimbra.

the class ZimbraServletTest method proxyTest.

@Ignore("until bug 60345 is fixed")
@Test
public void proxyTest() throws Exception {
    MockHttpServletRequest req = new MockHttpServletRequest("test".getBytes("UTF-8"), new URL("http://localhost:7070/user1" + uri), "");
    MockHttpServletResponse resp = new MockHttpServletResponse();
    ZimbraServlet.proxyServletRequest(req, resp, Provisioning.getInstance().getLocalServer(), uri, null);
}
Also used : MockHttpServletRequest(com.zimbra.cs.service.MockHttpServletRequest) URL(java.net.URL) MockHttpServletResponse(com.zimbra.cs.service.MockHttpServletResponse) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 2 with MockHttpServletResponse

use of com.zimbra.cs.service.MockHttpServletResponse in project zm-mailbox by Zimbra.

the class ServiceTestUtil method getRequestContext.

public static Map<String, Object> getRequestContext(Account authAcct, Account targetAcct, DocumentService service) throws Exception {
    Map<String, Object> context = new HashMap<String, Object>();
    context.put(SoapEngine.ZIMBRA_CONTEXT, new ZimbraSoapContext(AuthProvider.getAuthToken(authAcct), targetAcct.getId(), SoapProtocol.Soap12, SoapProtocol.Soap12));
    context.put(SoapServlet.SERVLET_REQUEST, new MockHttpServletRequest("test".getBytes("UTF-8"), new URL("http://localhost:7070/service/FooRequest"), ""));
    context.put(SoapEngine.ZIMBRA_ENGINE, new MockSoapEngine(service));
    context.put(SoapServlet.SERVLET_RESPONSE, new MockHttpServletResponse());
    return context;
}
Also used : MockSoapEngine(com.zimbra.soap.MockSoapEngine) HashMap(java.util.HashMap) ZimbraSoapContext(com.zimbra.soap.ZimbraSoapContext) MockHttpServletRequest(com.zimbra.cs.service.MockHttpServletRequest) URL(java.net.URL) MockHttpServletResponse(com.zimbra.cs.service.MockHttpServletResponse)

Aggregations

MockHttpServletRequest (com.zimbra.cs.service.MockHttpServletRequest)2 MockHttpServletResponse (com.zimbra.cs.service.MockHttpServletResponse)2 URL (java.net.URL)2 MockSoapEngine (com.zimbra.soap.MockSoapEngine)1 ZimbraSoapContext (com.zimbra.soap.ZimbraSoapContext)1 HashMap (java.util.HashMap)1 Ignore (org.junit.Ignore)1 Test (org.junit.Test)1