@Test public void testPurge() { String rsp = "{\"purged\" : { \"Billy\" : [ \"17-b3eb5ac6fbaef4428d712e66483dcb79\"]},\"purge_seq\" : 11}"; final ByteArrayOutputStream output = new ByteArrayOutputStream(); doAnswer(new MarshallEntityAndReturnAnswer(output, HttpResponseStub.valueOf(200, rsp))).when(httpClient).post(eq("/test_db/_purge"), any(HttpEntity.class)); Map<String, List<String>> revisionsToPurge = new HashMap<String, List<String>>(); revisionsToPurge.put("Billy", Collections.singletonList("17-b3eb5ac6fbaef4428d712e66483dcb79")); PurgeResult r = dbCon.purge(revisionsToPurge); assertEquals(11, r.getPurgeSeq()); assertTrue(r.getPurged().containsKey("Billy")); }
@Override public PurgeResult purge(Map<String, List<String>> revisionsToPurge) { HttpEntity entity = createHttpEntity(revisionsToPurge); return restTemplate.post(dbURI.append("_purge").toString(), entity, new StdResponseHandler<PurgeResult>() { @Override public PurgeResult success(HttpResponse hr) throws Exception { return objectMapper.readValue(hr.getContent(), PurgeResult.class); } }); }
StreamedCouchDbConnector extends StdCouchDbConnector { @Override public PurgeResult purge(Map<String, List<String>> revisionsToPurge) { HttpEntity entity = createHttpEntity(revisionsToPurge); return restTemplate.post(dbURI.append("_purge").toString(), entity, new StdResponseHandler<PurgeResult>() { @Override public PurgeResult success(HttpResponse hr) throws Exception { return objectMapper.readValue(hr.getContent(), PurgeResult.class); } }); } }
StreamedCouchDbConnector extends StdCouchDbConnector { @Override public PurgeResult purge(Map<String, List<String>> revisionsToPurge) { HttpEntity entity = createHttpEntity(revisionsToPurge); return restTemplate.post(dbURI.append("_purge").toString(), entity, new StdResponseHandler<PurgeResult>() { @Override public PurgeResult success(HttpResponse hr) throws Exception { return objectMapper.readValue(hr.getContent(), PurgeResult.class); } }); } StreamedCouchDbConnector(String databaseName, CouchDbInstance dbInstance);  StreamedCouchDbConnector(String databaseName, CouchDbInstance dbi, ObjectMapperFactory om); }
StreamedCouchDbConnector extends StdCouchDbConnector { @Override public PurgeResult purge(Map<String, List<String>> revisionsToPurge) { HttpEntity entity = createHttpEntity(revisionsToPurge); return restTemplate.post(dbURI.append("_purge").toString(), entity, new StdResponseHandler<PurgeResult>() { @Override public PurgeResult success(HttpResponse hr) throws Exception { return objectMapper.readValue(hr.getContent(), PurgeResult.class); } }); } StreamedCouchDbConnector(String databaseName, CouchDbInstance dbInstance);  StreamedCouchDbConnector(String databaseName, CouchDbInstance dbi, ObjectMapperFactory om); @Override void create(final Object o); @Override void create(String id, Object node); @Override PurgeResult purge(Map<String, List<String>> revisionsToPurge); @Override void update(final Object o); }
StreamedCouchDbConnector extends StdCouchDbConnector { @Override public PurgeResult purge(Map<String, List<String>> revisionsToPurge) { HttpEntity entity = createHttpEntity(revisionsToPurge); return restTemplate.post(dbURI.append("_purge").toString(), entity, new StdResponseHandler<PurgeResult>() { @Override public PurgeResult success(HttpResponse hr) throws Exception { return objectMapper.readValue(hr.getContent(), PurgeResult.class); } }); } StreamedCouchDbConnector(String databaseName, CouchDbInstance dbInstance);  StreamedCouchDbConnector(String databaseName, CouchDbInstance dbi, ObjectMapperFactory om); @Override void create(final Object o); @Override void create(String id, Object node); @Override PurgeResult purge(Map<String, List<String>> revisionsToPurge); @Override void update(final Object o);  }