@Test public void testRetrievalOfOnePlusConnections() { stubFor(get(urlEqualTo(connectionUrl)).willReturn(aResponse().withBody("[{\"result\":\"success\"}]"))); List<Connection> connections = underTest.retrieveConnections(); assertEquals(1, connections.size()); assertEquals("success", connections.get(0).getResult()); }
public List<Connection> retrieveConnections() { HttpGet get = new HttpGet(connectionUrl); try { CloseableHttpResponse response = httpClient.execute(get); String body = EntityUtils.toString(response.getEntity()); LOGGER.debug("Received response {}", body); Connection[] connections = (Connection[]) gson.fromJson(body, (Class) Connection[].class); LOGGER.debug("Parsed connections {}", Arrays.toString(connections)); return Arrays.asList(connections); } catch (IOException e) { LOGGER.info(REQUEST_FOR_CONNECTIONS_FAILED, e); throw new ActivityRequestFailed(REQUEST_FOR_CONNECTIONS_FAILED, e); } }
ActivityClient { public List<Connection> retrieveConnections() { HttpGet get = new HttpGet(connectionUrl); try { CloseableHttpResponse response = httpClient.execute(get); String body = EntityUtils.toString(response.getEntity()); LOGGER.debug("Received response {}", body); Connection[] connections = (Connection[]) gson.fromJson(body, (Class) Connection[].class); LOGGER.debug("Parsed connections {}", Arrays.toString(connections)); return Arrays.asList(connections); } catch (IOException e) { LOGGER.info(REQUEST_FOR_CONNECTIONS_FAILED, e); throw new ActivityRequestFailed(REQUEST_FOR_CONNECTIONS_FAILED, e); } } }
ActivityClient { public List<Connection> retrieveConnections() { HttpGet get = new HttpGet(connectionUrl); try { CloseableHttpResponse response = httpClient.execute(get); String body = EntityUtils.toString(response.getEntity()); LOGGER.debug("Received response {}", body); Connection[] connections = (Connection[]) gson.fromJson(body, (Class) Connection[].class); LOGGER.debug("Parsed connections {}", Arrays.toString(connections)); return Arrays.asList(connections); } catch (IOException e) { LOGGER.info(REQUEST_FOR_CONNECTIONS_FAILED, e); throw new ActivityRequestFailed(REQUEST_FOR_CONNECTIONS_FAILED, e); } } private  ActivityClient(String host, int port, int socketTimeout); }
ActivityClient { public List<Connection> retrieveConnections() { HttpGet get = new HttpGet(connectionUrl); try { CloseableHttpResponse response = httpClient.execute(get); String body = EntityUtils.toString(response.getEntity()); LOGGER.debug("Received response {}", body); Connection[] connections = (Connection[]) gson.fromJson(body, (Class) Connection[].class); LOGGER.debug("Parsed connections {}", Arrays.toString(connections)); return Arrays.asList(connections); } catch (IOException e) { LOGGER.info(REQUEST_FOR_CONNECTIONS_FAILED, e); throw new ActivityRequestFailed(REQUEST_FOR_CONNECTIONS_FAILED, e); } } private  ActivityClient(String host, int port, int socketTimeout); static ActivityClientBuilder builder(); List<Query> retrieveQueries(); List<Connection> retrieveConnections(); void clearConnections(); void clearQueries(); void clearPreparedStatementPreparations(); List<PreparedStatementPreparation> retrievePreparedStatementPreparations(); void clearPreparedStatementExecutions(); void clearAllRecordedActivity(); List<PreparedStatementExecution> retrievePreparedStatementExecutions(); List<BatchExecution> retrieveBatches(); void clearBatchExecutions(); }
ActivityClient { public List<Connection> retrieveConnections() { HttpGet get = new HttpGet(connectionUrl); try { CloseableHttpResponse response = httpClient.execute(get); String body = EntityUtils.toString(response.getEntity()); LOGGER.debug("Received response {}", body); Connection[] connections = (Connection[]) gson.fromJson(body, (Class) Connection[].class); LOGGER.debug("Parsed connections {}", Arrays.toString(connections)); return Arrays.asList(connections); } catch (IOException e) { LOGGER.info(REQUEST_FOR_CONNECTIONS_FAILED, e); throw new ActivityRequestFailed(REQUEST_FOR_CONNECTIONS_FAILED, e); } } private  ActivityClient(String host, int port, int socketTimeout); static ActivityClientBuilder builder(); List<Query> retrieveQueries(); List<Connection> retrieveConnections(); void clearConnections(); void clearQueries(); void clearPreparedStatementPreparations(); List<PreparedStatementPreparation> retrievePreparedStatementPreparations(); void clearPreparedStatementExecutions(); void clearAllRecordedActivity(); List<PreparedStatementExecution> retrievePreparedStatementExecutions(); List<BatchExecution> retrieveBatches(); void clearBatchExecutions();  }