@Test public void testInitialize() { when(response.getStatusCode()).thenReturn(300); connection.initialize(); assertTrue(connection.isInitialized()); when(response.getStatusCode()).thenReturn(400); connection.initialize(); assertTrue(connection.isInitialized()); }
public void initialize() { if (LOG.isTraceEnabled()) { LOG.trace("Initializing flow {}", flowCache); } JsonRestClientResponse initResp = putWithoutInitCheck(flowCache.getPath(), flowCache.getJsonDefinition()); Preconditions.checkNotNull(initResp); if (initResp.getStatusCode() < 300) { LOG.info("sFlow connection {} initialization status code {}", getCollectorUri(), initResp.getStatusCode()); } else if (initResp.getStatusCode() < 400) { LOG.warn("sFlow connection {} initialization status code {}", getCollectorUri(), initResp.getStatusCode()); } else { LOG.error("sFlow connection {} initialization status code {}", getCollectorUri(), initResp.getStatusCode()); } this.isInitialized = true; }
SFlowRTConnection { public void initialize() { if (LOG.isTraceEnabled()) { LOG.trace("Initializing flow {}", flowCache); } JsonRestClientResponse initResp = putWithoutInitCheck(flowCache.getPath(), flowCache.getJsonDefinition()); Preconditions.checkNotNull(initResp); if (initResp.getStatusCode() < 300) { LOG.info("sFlow connection {} initialization status code {}", getCollectorUri(), initResp.getStatusCode()); } else if (initResp.getStatusCode() < 400) { LOG.warn("sFlow connection {} initialization status code {}", getCollectorUri(), initResp.getStatusCode()); } else { LOG.error("sFlow connection {} initialization status code {}", getCollectorUri(), initResp.getStatusCode()); } this.isInitialized = true; } }
SFlowRTConnection { public void initialize() { if (LOG.isTraceEnabled()) { LOG.trace("Initializing flow {}", flowCache); } JsonRestClientResponse initResp = putWithoutInitCheck(flowCache.getPath(), flowCache.getJsonDefinition()); Preconditions.checkNotNull(initResp); if (initResp.getStatusCode() < 300) { LOG.info("sFlow connection {} initialization status code {}", getCollectorUri(), initResp.getStatusCode()); } else if (initResp.getStatusCode() < 400) { LOG.warn("sFlow connection {} initialization status code {}", getCollectorUri(), initResp.getStatusCode()); } else { LOG.error("sFlow connection {} initialization status code {}", getCollectorUri(), initResp.getStatusCode()); } this.isInitialized = true; } SFlowRTConnection(ScheduledExecutorService executor, String collectorUri, FlowCache flowCache, JsonRestClient client); }
SFlowRTConnection { public void initialize() { if (LOG.isTraceEnabled()) { LOG.trace("Initializing flow {}", flowCache); } JsonRestClientResponse initResp = putWithoutInitCheck(flowCache.getPath(), flowCache.getJsonDefinition()); Preconditions.checkNotNull(initResp); if (initResp.getStatusCode() < 300) { LOG.info("sFlow connection {} initialization status code {}", getCollectorUri(), initResp.getStatusCode()); } else if (initResp.getStatusCode() < 400) { LOG.warn("sFlow connection {} initialization status code {}", getCollectorUri(), initResp.getStatusCode()); } else { LOG.error("sFlow connection {} initialization status code {}", getCollectorUri(), initResp.getStatusCode()); } this.isInitialized = true; } SFlowRTConnection(ScheduledExecutorService executor, String collectorUri, FlowCache flowCache, JsonRestClient client); @Nullable String getJsonResponse(String path, MultivaluedMap<String, String> params); @Nullable JsonRestClientResponse get(String path,
            MultivaluedMap<String, String> params); @Nullable JsonRestClientResponse put(String path, String someJson); JsonRestClientResponse delete(String path); boolean isInitialized(); FlowCache getFlowCache(); ScheduledExecutorService getExecutor(); String getCollectorUri(); void initialize(); }
SFlowRTConnection { public void initialize() { if (LOG.isTraceEnabled()) { LOG.trace("Initializing flow {}", flowCache); } JsonRestClientResponse initResp = putWithoutInitCheck(flowCache.getPath(), flowCache.getJsonDefinition()); Preconditions.checkNotNull(initResp); if (initResp.getStatusCode() < 300) { LOG.info("sFlow connection {} initialization status code {}", getCollectorUri(), initResp.getStatusCode()); } else if (initResp.getStatusCode() < 400) { LOG.warn("sFlow connection {} initialization status code {}", getCollectorUri(), initResp.getStatusCode()); } else { LOG.error("sFlow connection {} initialization status code {}", getCollectorUri(), initResp.getStatusCode()); } this.isInitialized = true; } SFlowRTConnection(ScheduledExecutorService executor, String collectorUri, FlowCache flowCache, JsonRestClient client); @Nullable String getJsonResponse(String path, MultivaluedMap<String, String> params); @Nullable JsonRestClientResponse get(String path,
            MultivaluedMap<String, String> params); @Nullable JsonRestClientResponse put(String path, String someJson); JsonRestClientResponse delete(String path); boolean isInitialized(); FlowCache getFlowCache(); ScheduledExecutorService getExecutor(); String getCollectorUri(); void initialize();  }