Package org.mokai

Examples of org.mokai.RoutingEngine


    when( cs.getState() ).thenReturn( State.STARTED );
    when( cs.getStatus() ).thenReturn( Status.UNKNOWN );
    when( cs.getNumQueuedMessages() ).thenReturn(0);
    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 );
View Full Code Here


    Assert.assertEquals( jsonConnection.getString("id"), "test-application" );
  }

  @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

    when( cs.getState() ).thenReturn( State.STARTED );
    when( cs.getStatus() ).thenReturn( Status.UNKNOWN );
    when( cs.getNumQueuedMessages() ).thenReturn(0);
    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 );
View Full Code Here

    Assert.assertEquals( jsonConnection.getString("id"), "test-connection" );
  }

  @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

    when( cs.getState() ).thenReturn( State.STARTED );
    when( cs.getStatus() ).thenReturn( Status.UNKNOWN );
    when( cs.getNumQueuedMessages() ).thenReturn(0);
    when( cs.getPriority() ).thenReturn(1000);

    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();
View Full Code Here

  protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    PrintWriter out = resp.getWriter();

    StringBuffer status = new StringBuffer(); // this is what we will return

    RoutingEngine routingEngine = (RoutingEngine) applicationContext.getBean("routingEngine");

    for (ConnectorService application : routingEngine.getApplications()) {
      status.append(application.getId())
          .append("_")
          .append(application.getStatus())
          .append("_")
          .append(application.getState())
          .append(" ");
    }

    for (ConnectorService connection : routingEngine.getConnections()) {
      status.append(connection.getId())
          .append("_")
          .append(connection.getStatus())
          .append("_")
          .append(connection.getState())
View Full Code Here

TOP

Related Classes of org.mokai.RoutingEngine

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.