@Test public void testRun_response400() { when(response.getStatusCode()).thenReturn(400); task.run(); }
@Override public void run() { MultivaluedMap<String, String> params = new MultivaluedMapImpl(); params.add(SFlowQueryParams.MAX_FLOWS, maxFlows); params.add(SFlowQueryParams.MIN_VALUE, minValue); params.add(SFlowQueryParams.AGG_MODE, aggMode); JsonRestClientResponse result = sFlowRTConnection.get(path, params); if (result != null && result.getJsonResponse() != null) { List<FlowCacheData> dataList = GSON.fromJson(result.getJsonResponse(), LIST_OF_FLOW_CACHE_DATA); if (dataList == null) { LOG.trace("Empty reply, not processing"); return; } if (LOG.isTraceEnabled()) { LOG.trace("Got sFlow reply: {}", result.getJsonResponse()); } if (result.getStatusCode() < 300) { sFlowRTConnection.getExecutor().execute((new ProcessDataTask(sFlowRTConnection.getFlowCache(), dataList, BigInteger.valueOf(new Date().getTime()), statisticsManager))); } else if (result.getStatusCode() < 400) { LOG.warn("Status code {}, not processing data. Response: {}", result.getStatusCode(), result.getClientResponse().toString()); } else { LOG.error("Status code {}, not processing data. Response: {}", result.getStatusCode(), result.getClientResponse().toString()); } } }
ReadGbpFlowCacheTask implements Runnable { @Override public void run() { MultivaluedMap<String, String> params = new MultivaluedMapImpl(); params.add(SFlowQueryParams.MAX_FLOWS, maxFlows); params.add(SFlowQueryParams.MIN_VALUE, minValue); params.add(SFlowQueryParams.AGG_MODE, aggMode); JsonRestClientResponse result = sFlowRTConnection.get(path, params); if (result != null && result.getJsonResponse() != null) { List<FlowCacheData> dataList = GSON.fromJson(result.getJsonResponse(), LIST_OF_FLOW_CACHE_DATA); if (dataList == null) { LOG.trace("Empty reply, not processing"); return; } if (LOG.isTraceEnabled()) { LOG.trace("Got sFlow reply: {}", result.getJsonResponse()); } if (result.getStatusCode() < 300) { sFlowRTConnection.getExecutor().execute((new ProcessDataTask(sFlowRTConnection.getFlowCache(), dataList, BigInteger.valueOf(new Date().getTime()), statisticsManager))); } else if (result.getStatusCode() < 400) { LOG.warn("Status code {}, not processing data. Response: {}", result.getStatusCode(), result.getClientResponse().toString()); } else { LOG.error("Status code {}, not processing data. Response: {}", result.getStatusCode(), result.getClientResponse().toString()); } } } }
ReadGbpFlowCacheTask implements Runnable { @Override public void run() { MultivaluedMap<String, String> params = new MultivaluedMapImpl(); params.add(SFlowQueryParams.MAX_FLOWS, maxFlows); params.add(SFlowQueryParams.MIN_VALUE, minValue); params.add(SFlowQueryParams.AGG_MODE, aggMode); JsonRestClientResponse result = sFlowRTConnection.get(path, params); if (result != null && result.getJsonResponse() != null) { List<FlowCacheData> dataList = GSON.fromJson(result.getJsonResponse(), LIST_OF_FLOW_CACHE_DATA); if (dataList == null) { LOG.trace("Empty reply, not processing"); return; } if (LOG.isTraceEnabled()) { LOG.trace("Got sFlow reply: {}", result.getJsonResponse()); } if (result.getStatusCode() < 300) { sFlowRTConnection.getExecutor().execute((new ProcessDataTask(sFlowRTConnection.getFlowCache(), dataList, BigInteger.valueOf(new Date().getTime()), statisticsManager))); } else if (result.getStatusCode() < 400) { LOG.warn("Status code {}, not processing data. Response: {}", result.getStatusCode(), result.getClientResponse().toString()); } else { LOG.error("Status code {}, not processing data. Response: {}", result.getStatusCode(), result.getClientResponse().toString()); } } } ReadGbpFlowCacheTask(String flowCacheName, SFlowRTConnection sFlowRTConnection,
            StatisticsManager statisticsManager, Integer maxFlows, Double minValue, String aggMode); }
ReadGbpFlowCacheTask implements Runnable { @Override public void run() { MultivaluedMap<String, String> params = new MultivaluedMapImpl(); params.add(SFlowQueryParams.MAX_FLOWS, maxFlows); params.add(SFlowQueryParams.MIN_VALUE, minValue); params.add(SFlowQueryParams.AGG_MODE, aggMode); JsonRestClientResponse result = sFlowRTConnection.get(path, params); if (result != null && result.getJsonResponse() != null) { List<FlowCacheData> dataList = GSON.fromJson(result.getJsonResponse(), LIST_OF_FLOW_CACHE_DATA); if (dataList == null) { LOG.trace("Empty reply, not processing"); return; } if (LOG.isTraceEnabled()) { LOG.trace("Got sFlow reply: {}", result.getJsonResponse()); } if (result.getStatusCode() < 300) { sFlowRTConnection.getExecutor().execute((new ProcessDataTask(sFlowRTConnection.getFlowCache(), dataList, BigInteger.valueOf(new Date().getTime()), statisticsManager))); } else if (result.getStatusCode() < 400) { LOG.warn("Status code {}, not processing data. Response: {}", result.getStatusCode(), result.getClientResponse().toString()); } else { LOG.error("Status code {}, not processing data. Response: {}", result.getStatusCode(), result.getClientResponse().toString()); } } } ReadGbpFlowCacheTask(String flowCacheName, SFlowRTConnection sFlowRTConnection,
            StatisticsManager statisticsManager, Integer maxFlows, Double minValue, String aggMode); @Override void run(); }
ReadGbpFlowCacheTask implements Runnable { @Override public void run() { MultivaluedMap<String, String> params = new MultivaluedMapImpl(); params.add(SFlowQueryParams.MAX_FLOWS, maxFlows); params.add(SFlowQueryParams.MIN_VALUE, minValue); params.add(SFlowQueryParams.AGG_MODE, aggMode); JsonRestClientResponse result = sFlowRTConnection.get(path, params); if (result != null && result.getJsonResponse() != null) { List<FlowCacheData> dataList = GSON.fromJson(result.getJsonResponse(), LIST_OF_FLOW_CACHE_DATA); if (dataList == null) { LOG.trace("Empty reply, not processing"); return; } if (LOG.isTraceEnabled()) { LOG.trace("Got sFlow reply: {}", result.getJsonResponse()); } if (result.getStatusCode() < 300) { sFlowRTConnection.getExecutor().execute((new ProcessDataTask(sFlowRTConnection.getFlowCache(), dataList, BigInteger.valueOf(new Date().getTime()), statisticsManager))); } else if (result.getStatusCode() < 400) { LOG.warn("Status code {}, not processing data. Response: {}", result.getStatusCode(), result.getClientResponse().toString()); } else { LOG.error("Status code {}, not processing data. Response: {}", result.getStatusCode(), result.getClientResponse().toString()); } } } ReadGbpFlowCacheTask(String flowCacheName, SFlowRTConnection sFlowRTConnection,
            StatisticsManager statisticsManager, Integer maxFlows, Double minValue, String aggMode); @Override void run();  }