@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()); }
@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)); }