use of org.apache.nifi.web.NiFiServiceFacade in project nifi by apache.
the class TestSiteToSiteResource method testPeersVersionNegotiationDowngrade.
@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));
}
use of org.apache.nifi.web.NiFiServiceFacade in project nifi by apache.
the class TestSiteToSiteResource method testPeers.
@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());
final PeerDTO peer = resultEntity.getPeers().iterator().next();
assertEquals(8080, peer.getPort());
}
use of org.apache.nifi.web.NiFiServiceFacade in project nifi by apache.
the class TestSiteToSiteResource method testPeersPortForwarding.
@Test
public void testPeersPortForwarding() throws Exception {
final HttpServletRequest req = createCommonHttpServletRequest();
final NiFiServiceFacade serviceFacade = mock(NiFiServiceFacade.class);
final Map<String, String> additionalProperties = new HashMap<>();
additionalProperties.put(NiFiProperties.WEB_HTTP_PORT_FORWARDING, "80");
final SiteToSiteResource resource = getSiteToSiteResource(serviceFacade, additionalProperties);
final Response response = resource.getPeers(req);
PeersEntity resultEntity = (PeersEntity) response.getEntity();
assertEquals(200, response.getStatus());
assertEquals(1, resultEntity.getPeers().size());
final PeerDTO peer = resultEntity.getPeers().iterator().next();
assertEquals(80, peer.getPort());
}
Aggregations