Package org.jogger.http

Examples of org.jogger.http.Cookie


    when( cs.getPriority() ).thenReturn(1000);

    RoutingEngine routingEngine = getSpringContext().getBean(RoutingEngine.class);
    when(routingEngine.getConnections()).thenReturn( Collections.singletonList(cs) );

    MockResponse response = get("/connections").addCookie(new Cookie("access_token", "true")).run();

    Assert.assertEquals( response.getStatus(), Response.OK );

    JSONArray jsonResponse = new JSONArray( response.getOutputAsString() );
    Assert.assertNotNull( jsonResponse );
View Full Code Here


  @Test
  public void shouldListEmptyConnections() throws Exception {
    RoutingEngine routingEngine = getSpringContext().getBean(RoutingEngine.class);
    when(routingEngine.getConnections()).thenReturn( new ArrayList<ConnectorService>() );

    MockResponse response = get("/connections").addCookie(new Cookie("access_token", "true")).run();

    Assert.assertEquals( response.getStatus(), Response.OK );
    Assert.assertEquals( response.getOutputAsString() , "[]");
  }
View Full Code Here

    RoutingEngine routingEngine = getSpringContext().getBean(RoutingEngine.class);
    when(routingEngine.getConnection("test-connection")).thenReturn(cs);

    MockResponse response = post("/connections/test-connection/stop")
        .addCookie(new Cookie("access_token", "true"))
        .run();

    Assert.assertEquals( response.getStatus(), Response.OK );
    verify(cs).stop();
    verify(cs, never()).start();
View Full Code Here

    if ( !"admin".equals(username) || !isPasswordValid(password) ) {
      response.unauthorized();
    }

    Cookie cookie = new Cookie("access_token", "SO8ERHEHFSKJFHI7S3G3WODY7WFG64");
    cookie.setMaxAge( 3600 * 24 * 14 );
    cookie.setHttpOnly(true);
    response.setCookie( cookie );
  }
View Full Code Here

    return input.getString(field);
  }

  public void delete(Request request, Response response) {
    Cookie cookie = request.getCookie("access_token");

    if (cookie != null) {
      response.removeCookie(cookie);
    }
  }
View Full Code Here

    when( cs.getPriority() ).thenReturn(1000);

    RoutingEngine routingEngine = getSpringContext().getBean(RoutingEngine.class);
    Mockito.when(routingEngine.getApplications()).thenReturn( Collections.singletonList(cs) );

    MockResponse response = get("/applications").addCookie(new Cookie("access_token", "true")).run();

    Assert.assertEquals( response.getStatus(), Response.OK );

    JSONArray jsonResponse = new JSONArray( response.getOutputAsString() );
    Assert.assertNotNull( jsonResponse );
View Full Code Here

  @Test
  public void shouldListEmptyApplications() throws Exception {
    RoutingEngine routingEngine = getSpringContext().getBean(RoutingEngine.class);
    Mockito.when(routingEngine.getApplications()).thenReturn( new ArrayList<ConnectorService>() );

    MockResponse response = get("/applications").addCookie(new Cookie("access_token", "true")).run();

    Assert.assertEquals( response.getStatus(), Response.OK );
    Assert.assertEquals( response.getOutputAsString() , "[]");
  }
View Full Code Here

TOP

Related Classes of org.jogger.http.Cookie

Copyright © 2018 www.massapicom. 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.