use of org.ektorp.impl.StdCouchDbInstance in project apex-malhar by apache.
the class CouchDbStore method connect.
@Override
public void connect() throws IOException {
StdHttpClient.Builder builder = new StdHttpClient.Builder();
if (dbUrl != null) {
try {
builder.url(dbUrl);
} catch (MalformedURLException e) {
throw new IllegalArgumentException(e.getMessage());
}
}
if (userName != null) {
builder.username(userName);
}
if (password != null) {
builder.password(password);
}
HttpClient httpClient = builder.build();
couchInstance = new StdCouchDbInstance(httpClient);
dbConnector = couchInstance.createConnector(dbName, false);
}
use of org.ektorp.impl.StdCouchDbInstance in project apex-malhar by apache.
the class CouchDBTestHelper method setup.
static void setup() {
StdHttpClient.Builder builder = new StdHttpClient.Builder();
HttpClient httpClient = builder.build();
StdCouchDbInstance instance = new StdCouchDbInstance(httpClient);
DbPath dbPath = new DbPath(TEST_DB);
if (instance.checkIfDbExists((dbPath))) {
instance.deleteDatabase(dbPath.getPath());
}
connector = instance.createConnector(TEST_DB, true);
}
use of org.ektorp.impl.StdCouchDbInstance in project apex-malhar by apache.
the class CouchDBTestHelper method teardown.
static void teardown() {
StdHttpClient.Builder builder = new StdHttpClient.Builder();
HttpClient httpClient = builder.build();
StdCouchDbInstance instance = new StdCouchDbInstance(httpClient);
DbPath dbPath = new DbPath(TEST_DB);
if (instance.checkIfDbExists((dbPath))) {
instance.deleteDatabase(dbPath.getPath());
}
}
use of org.ektorp.impl.StdCouchDbInstance in project sw360portal by sw360.
the class DatabaseConnectorTest method testSetUp.
@Test
public void testSetUp() throws Exception {
// Default connector for testing
HttpClient httpClient = new StdHttpClient.Builder().url(COUCH_DB_URL).build();
CouchDbInstance dbInstance = new StdCouchDbInstance(httpClient);
CouchDbConnector db = new StdCouchDbConnector(COUCH_DB_DATABASE, dbInstance, factory);
// Check that the document was inserted
assertTrue(db.contains(id));
}
use of org.ektorp.impl.StdCouchDbInstance in project sw360portal by sw360.
the class DatabaseConnectorTest method tearDown.
@After
public void tearDown() throws Exception {
// Default connector for testing
HttpClient httpClient = new StdHttpClient.Builder().url(COUCH_DB_URL).build();
CouchDbInstance dbInstance = new StdCouchDbInstance(httpClient);
if (dbInstance.checkIfDbExists(COUCH_DB_DATABASE)) {
dbInstance.deleteDatabase(COUCH_DB_DATABASE);
}
}
Aggregations