@Test public void testPrimingPreparedStatementWithMap() { stubFor(post(urlEqualTo(PRIME_PREPARED_PATH)).willReturn(aResponse().withStatus(200))); List<Map<String, ? extends Object>> rows = new ArrayList<Map<String, ? extends Object>>(); Map<String, Object> row = new HashMap<String, Object>(); Map<String, String> map = ImmutableMap.of( "one", "two", "three", "four"); row.put("map_type", map); rows.add(row); PrimingRequest pr = PrimingRequest.preparedStatementBuilder() .withQuery("select * from people where blah = ?") .withRows(rows) .withColumnTypes(ImmutableMap.of("map_type", ColumnTypes.VarcharVarcharMap)) .build(); underTest.primePreparedStatement(pr); verify(postRequestedFor(urlEqualTo(PRIME_PREPARED_PATH)) .withHeader("Content-Type", equalTo("application/json; charset=UTF-8")) .withRequestBody(equalToJson("{\"when\":{\"query\":\"select * from people where blah = ?\"}," + "\"then\":{" + "\"rows\":[" + "{\"map_type\":{\"one\":\"two\",\"three\":\"four\"}}]," + "\"result\":\"success\"," + "\"column_types\":{\"map_type\":\"map<varchar,varchar>\"}}}" ))); }
@Deprecated public void primePreparedStatement(PrimingRequest primeRequest) throws PrimeFailedException { if (primeRequest.primeType != PrimingRequest.PrimingRequestBuilder.PrimeType.PREPARED) { throw new IllegalArgumentException("Can't pass a query prime to primePreparedStatement, use preparedStatementBuilder()"); } prime(primeRequest, primePreparedUrl); }
PrimingClient { @Deprecated public void primePreparedStatement(PrimingRequest primeRequest) throws PrimeFailedException { if (primeRequest.primeType != PrimingRequest.PrimingRequestBuilder.PrimeType.PREPARED) { throw new IllegalArgumentException("Can't pass a query prime to primePreparedStatement, use preparedStatementBuilder()"); } prime(primeRequest, primePreparedUrl); } }
PrimingClient { @Deprecated public void primePreparedStatement(PrimingRequest primeRequest) throws PrimeFailedException { if (primeRequest.primeType != PrimingRequest.PrimingRequestBuilder.PrimeType.PREPARED) { throw new IllegalArgumentException("Can't pass a query prime to primePreparedStatement, use preparedStatementBuilder()"); } prime(primeRequest, primePreparedUrl); } private  PrimingClient(String host, int port); }
PrimingClient { @Deprecated public void primePreparedStatement(PrimingRequest primeRequest) throws PrimeFailedException { if (primeRequest.primeType != PrimingRequest.PrimingRequestBuilder.PrimeType.PREPARED) { throw new IllegalArgumentException("Can't pass a query prime to primePreparedStatement, use preparedStatementBuilder()"); } prime(primeRequest, primePreparedUrl); } private  PrimingClient(String host, int port); static PrimingClientBuilder builder(); void prime(PrimingRequest prime); void prime(PrimingRequest.PrimingRequestBuilder prime); void primeBatch(BatchPrimingRequest batchPrimingRequest); void primeBatch(BatchPrimingRequest.BatchPrimingRequestBuilder batchPrimingRequest); void multiPrime(MultiPrimeRequest primeRequest); @Deprecated void primeQuery(PrimingRequest primeRequest); @Deprecated void primePreparedStatement(PrimingRequest primeRequest); List<PrimingRequest> retrievePreparedPrimes(); List<MultiPrimeRequest> retrievePreparedMultiPrimes(); List<PrimingRequest> retrieveQueryPrimes(); void clearAllPrimes(); void clearQueryPrimes(); void clearPreparedPrimes(); void clearPreparedMultiPrimes(); void clearBatchPrimes(); }
PrimingClient { @Deprecated public void primePreparedStatement(PrimingRequest primeRequest) throws PrimeFailedException { if (primeRequest.primeType != PrimingRequest.PrimingRequestBuilder.PrimeType.PREPARED) { throw new IllegalArgumentException("Can't pass a query prime to primePreparedStatement, use preparedStatementBuilder()"); } prime(primeRequest, primePreparedUrl); } private  PrimingClient(String host, int port); static PrimingClientBuilder builder(); void prime(PrimingRequest prime); void prime(PrimingRequest.PrimingRequestBuilder prime); void primeBatch(BatchPrimingRequest batchPrimingRequest); void primeBatch(BatchPrimingRequest.BatchPrimingRequestBuilder batchPrimingRequest); void multiPrime(MultiPrimeRequest primeRequest); @Deprecated void primeQuery(PrimingRequest primeRequest); @Deprecated void primePreparedStatement(PrimingRequest primeRequest); List<PrimingRequest> retrievePreparedPrimes(); List<MultiPrimeRequest> retrievePreparedMultiPrimes(); List<PrimingRequest> retrieveQueryPrimes(); void clearAllPrimes(); void clearQueryPrimes(); void clearPreparedPrimes(); void clearPreparedMultiPrimes(); void clearBatchPrimes(); static final String DELETING_OF_PRIMES_FAILED; static final String PRIMING_FAILED; }