this.jsonStrategy = couchSetup.getJsonStrategy();
this.metaRepository = couchSetup.getMetaRepository();
}
public void assertConnection() throws CouchHttpException {
CouchHttpResponse response;
try {
response = httpClient.get(new HttpGetRequest());
} catch (Throwable e) {
throw CouchHttpException.internalServerError(e);
}
if (response.isOk()) {
String content = response.getStringContent();
if (!content.contains("couchdb")) {
String msg = String.format("The server at " + httpClient.getBaseUrl() + " is not a couch database.");
throw new CouchHttpException(CouchHttpStatus.CONFLICT, msg);
}
} else {
throw new CouchHttpException(response.getHttpStatus(), response.getErrorReason());
}
}