@Test public void retrievingPreparedStatementExecutionsWithSerialCLAndTimestamp() throws Exception { stubFor(get(urlEqualTo(preparedStatementExecutionUrl)) .willReturn(aResponse().withStatus(200).withBody( "[{\n" + " \"preparedStatementText\": \"select * from people where name = ?\",\n" + " \"consistency\": \"ONE\",\n" + " \"variables\": [\"Chris\"],\n" + " \"variableTypes\": [\"text\"],\n" + " \"serialConsistency\": \"SERIAL\",\n" + " \"timestamp\": 1234567890\n" + "}]" ))); List<PreparedStatementExecution> executions = underTest.retrievePreparedStatementExecutions(); assertEquals(1, executions.size()); PreparedStatementExecution singleExecution = executions.get(0); assertEquals("ONE", singleExecution.getConsistency()); assertEquals("select * from people where name = ?", singleExecution.getPreparedStatementText()); assertEquals(Arrays.asList("Chris"), singleExecution.getVariables()); assertEquals(Arrays.asList(TEXT), singleExecution.getVariableTypes()); assertEquals("SERIAL", singleExecution.getSerialConsistency()); assertEquals(new Long(1234567890), singleExecution.getTimestamp()); }
public List<PreparedStatementExecution> retrievePreparedStatementExecutions() { HttpGet get = new HttpGet(preparedStatementExecutionUrl); try { CloseableHttpResponse response = httpClient.execute(get); String body = EntityUtils.toString(response.getEntity()); LOGGER.debug("Received response {}", body); int statusCode = response.getStatusLine().getStatusCode(); if (statusCode != 200) { String errorMessage = String.format("Non 200 status code when retrieving prepared statement executions %s", statusCode); LOGGER.info(errorMessage); throw new ActivityRequestFailed(errorMessage); } PreparedStatementExecution[] executions = (PreparedStatementExecution[]) gson.fromJson(body, (Class) PreparedStatementExecution[].class); LOGGER.debug("Parsed prepared statement executions {}", Arrays.toString(executions)); return Arrays.asList(executions); } catch (IOException e) { LOGGER.info(REQUEST_FAILED, e); throw new ActivityRequestFailed(REQUEST_FAILED, e); } }
ActivityClient { public List<PreparedStatementExecution> retrievePreparedStatementExecutions() { HttpGet get = new HttpGet(preparedStatementExecutionUrl); try { CloseableHttpResponse response = httpClient.execute(get); String body = EntityUtils.toString(response.getEntity()); LOGGER.debug("Received response {}", body); int statusCode = response.getStatusLine().getStatusCode(); if (statusCode != 200) { String errorMessage = String.format("Non 200 status code when retrieving prepared statement executions %s", statusCode); LOGGER.info(errorMessage); throw new ActivityRequestFailed(errorMessage); } PreparedStatementExecution[] executions = (PreparedStatementExecution[]) gson.fromJson(body, (Class) PreparedStatementExecution[].class); LOGGER.debug("Parsed prepared statement executions {}", Arrays.toString(executions)); return Arrays.asList(executions); } catch (IOException e) { LOGGER.info(REQUEST_FAILED, e); throw new ActivityRequestFailed(REQUEST_FAILED, e); } } }
ActivityClient { public List<PreparedStatementExecution> retrievePreparedStatementExecutions() { HttpGet get = new HttpGet(preparedStatementExecutionUrl); try { CloseableHttpResponse response = httpClient.execute(get); String body = EntityUtils.toString(response.getEntity()); LOGGER.debug("Received response {}", body); int statusCode = response.getStatusLine().getStatusCode(); if (statusCode != 200) { String errorMessage = String.format("Non 200 status code when retrieving prepared statement executions %s", statusCode); LOGGER.info(errorMessage); throw new ActivityRequestFailed(errorMessage); } PreparedStatementExecution[] executions = (PreparedStatementExecution[]) gson.fromJson(body, (Class) PreparedStatementExecution[].class); LOGGER.debug("Parsed prepared statement executions {}", Arrays.toString(executions)); return Arrays.asList(executions); } catch (IOException e) { LOGGER.info(REQUEST_FAILED, e); throw new ActivityRequestFailed(REQUEST_FAILED, e); } } private  ActivityClient(String host, int port, int socketTimeout); }
ActivityClient { public List<PreparedStatementExecution> retrievePreparedStatementExecutions() { HttpGet get = new HttpGet(preparedStatementExecutionUrl); try { CloseableHttpResponse response = httpClient.execute(get); String body = EntityUtils.toString(response.getEntity()); LOGGER.debug("Received response {}", body); int statusCode = response.getStatusLine().getStatusCode(); if (statusCode != 200) { String errorMessage = String.format("Non 200 status code when retrieving prepared statement executions %s", statusCode); LOGGER.info(errorMessage); throw new ActivityRequestFailed(errorMessage); } PreparedStatementExecution[] executions = (PreparedStatementExecution[]) gson.fromJson(body, (Class) PreparedStatementExecution[].class); LOGGER.debug("Parsed prepared statement executions {}", Arrays.toString(executions)); return Arrays.asList(executions); } catch (IOException e) { LOGGER.info(REQUEST_FAILED, e); throw new ActivityRequestFailed(REQUEST_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<PreparedStatementExecution> retrievePreparedStatementExecutions() { HttpGet get = new HttpGet(preparedStatementExecutionUrl); try { CloseableHttpResponse response = httpClient.execute(get); String body = EntityUtils.toString(response.getEntity()); LOGGER.debug("Received response {}", body); int statusCode = response.getStatusLine().getStatusCode(); if (statusCode != 200) { String errorMessage = String.format("Non 200 status code when retrieving prepared statement executions %s", statusCode); LOGGER.info(errorMessage); throw new ActivityRequestFailed(errorMessage); } PreparedStatementExecution[] executions = (PreparedStatementExecution[]) gson.fromJson(body, (Class) PreparedStatementExecution[].class); LOGGER.debug("Parsed prepared statement executions {}", Arrays.toString(executions)); return Arrays.asList(executions); } catch (IOException e) { LOGGER.info(REQUEST_FAILED, e); throw new ActivityRequestFailed(REQUEST_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();  }