Package waffle.mock.http

Examples of waffle.mock.http.SimpleHttpRequest.addHeader()


    private static final Logger LOGGER = LoggerFactory.getLogger(WaffleInfoServletTests.class);

    @Test
    public void testGetInfo() throws Exception {
        SimpleHttpRequest request = new SimpleHttpRequest();
        request.addHeader("hello", "waffle");

        SimpleHttpResponse response = new SimpleHttpResponse();

        WaffleInfoServlet servlet = new WaffleInfoServlet();
        servlet.doGet(request, response);
View Full Code Here


            clientContext.initialize(null, null, WindowsAccountImpl.getCurrentUsername());
            SimpleHttpRequest request = new SimpleHttpRequest();
            request.setMethod("POST");
            request.setContentLength(0);
            String clientToken = BaseEncoding.base64().encode(clientContext.getToken());
            request.addHeader("Authorization", securityPackage + " " + clientToken);
            SimpleHttpResponse response = new SimpleHttpResponse();
            this.filter.doFilter(request, response, null);
            assertTrue(response.getHeader("WWW-Authenticate").startsWith(securityPackage + " "));
            assertEquals("keep-alive", response.getHeader("Connection"));
            assertEquals(2, response.getHeaderNamesSize());
View Full Code Here

            // negotiate
            boolean authenticated = false;
            SimpleHttpRequest request = new SimpleHttpRequest();
            while (true) {
                String clientToken = BaseEncoding.base64().encode(clientContext.getToken());
                request.addHeader("Authorization", securityPackage + " " + clientToken);

                SimpleHttpResponse response = new SimpleHttpResponse();
                this.filter.doFilter(request, response, filterChain);

                Subject subject = (Subject) request.getSession().getAttribute("javax.security.auth.subject");
View Full Code Here

        SimpleHttpRequest request = new SimpleHttpRequest();
        WindowsPrincipal windowsPrincipal = new WindowsPrincipal(mockWindowsIdentity);
        request.setUserPrincipal(windowsPrincipal);
        request.setMethod("POST");
        request.setContentLength(0);
        request.addHeader("Authorization", "NTLM TlRMTVNTUAABAAAABzIAAAYABgArAAAACwALACAAAABXT1JLU1RBVElPTkRPTUFJTg==");
        SimpleFilterChain filterChain = new SimpleFilterChain();
        SimpleHttpResponse response = new SimpleHttpResponse();
        this.filter.doFilter(request, response, filterChain);
        assertEquals(401, response.getStatus());
        String[] wwwAuthenticates = response.getHeaderValues("WWW-Authenticate");
View Full Code Here

        SimpleHttpRequest request = new SimpleHttpRequest();
        WindowsPrincipal windowsPrincipal = new WindowsPrincipal(mockWindowsIdentity);
        request.setUserPrincipal(windowsPrincipal);
        request.setMethod("PUT");
        request.setContentLength(0);
        request.addHeader("Authorization", "NTLM TlRMTVNTUAABAAAABzIAAAYABgArAAAACwALACAAAABXT1JLU1RBVElPTkRPTUFJTg==");
        SimpleFilterChain filterChain = new SimpleFilterChain();
        SimpleHttpResponse response = new SimpleHttpResponse();
        this.filter.doFilter(request, response, filterChain);
        assertEquals(401, response.getStatus());
        String[] wwwAuthenticates = response.getHeaderValues("WWW-Authenticate");
View Full Code Here

    @Test
    public void testIsNull() {
        SimpleHttpRequest request = new SimpleHttpRequest();
        AuthorizationHeader header = new AuthorizationHeader(request);
        assertTrue(header.isNull());
        request.addHeader("Authorization", "");
        assertTrue(header.isNull());
        request.addHeader("Authorization", "12344234");
        assertFalse(header.isNull());
    }
View Full Code Here

        SimpleHttpRequest request = new SimpleHttpRequest();
        AuthorizationHeader header = new AuthorizationHeader(request);
        assertTrue(header.isNull());
        request.addHeader("Authorization", "");
        assertTrue(header.isNull());
        request.addHeader("Authorization", "12344234");
        assertFalse(header.isNull());
    }

    @Test
    public void testGetSecurityPackage() {
View Full Code Here

    @Test
    public void testGetSecurityPackage() {
        SimpleHttpRequest request = new SimpleHttpRequest();
        AuthorizationHeader header = new AuthorizationHeader(request);
        request.addHeader("Authorization", "NTLM TlRMTVNTUAABAAAABzIAAAYABgArAAAACwALACAAAABXT1JLU1RBVElPTkRPTUFJTg==");
        assertEquals("NTLM", header.getSecurityPackage());
        request.addHeader("Authorization",
                "Negotiate TlRMTVNTUAABAAAABzIAAAYABgArAAAACwALACAAAABXT1JLU1RBVElPTkRPTUFJTg==");
        assertEquals("Negotiate", header.getSecurityPackage());
    }
View Full Code Here

    public void testGetSecurityPackage() {
        SimpleHttpRequest request = new SimpleHttpRequest();
        AuthorizationHeader header = new AuthorizationHeader(request);
        request.addHeader("Authorization", "NTLM TlRMTVNTUAABAAAABzIAAAYABgArAAAACwALACAAAABXT1JLU1RBVElPTkRPTUFJTg==");
        assertEquals("NTLM", header.getSecurityPackage());
        request.addHeader("Authorization",
                "Negotiate TlRMTVNTUAABAAAABzIAAAYABgArAAAACwALACAAAABXT1JLU1RBVElPTkRPTUFJTg==");
        assertEquals("Negotiate", header.getSecurityPackage());
    }

    @Test
View Full Code Here

    @Test
    public void testIsNtlmType1Message() {
        SimpleHttpRequest request = new SimpleHttpRequest();
        AuthorizationHeader header = new AuthorizationHeader(request);
        assertFalse(header.isNtlmType1Message());
        request.addHeader("Authorization", "");
        assertFalse(header.isNtlmType1Message());
        request.addHeader("Authorization", "NTLM TlRMTVNTUAABAAAABzIAAAYABgArAAAACwALACAAAABXT1JLU1RBVElPTkRPTUFJTg==");
        assertTrue(header.isNtlmType1Message());
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.