Exemplo n.º 1
0
  @Test
  public void testPeers() throws Exception {
    final HttpServletRequest req = createCommonHttpServletRequest();

    final NiFiServiceFacade serviceFacade = mock(NiFiServiceFacade.class);

    final SiteToSiteResource resource = getSiteToSiteResource(serviceFacade);

    final Response response = resource.getPeers(req);

    PeersEntity resultEntity = (PeersEntity) response.getEntity();

    assertEquals(200, response.getStatus());
    assertEquals(1, resultEntity.getPeers().size());
  }
Exemplo n.º 2
0
  @Test
  public void testPeersVersionNegotiationDowngrade() throws Exception {
    final HttpServletRequest req = mock(HttpServletRequest.class);
    doReturn("999").when(req).getHeader(eq(HttpHeaders.PROTOCOL_VERSION));

    final NiFiServiceFacade serviceFacade = mock(NiFiServiceFacade.class);

    final SiteToSiteResource resource = getSiteToSiteResource(serviceFacade);

    final Response response = resource.getPeers(req);

    PeersEntity resultEntity = (PeersEntity) response.getEntity();

    assertEquals(200, response.getStatus());
    assertEquals(1, resultEntity.getPeers().size());
    assertEquals(new Integer(1), response.getMetadata().getFirst(HttpHeaders.PROTOCOL_VERSION));
  }