コード例 #1
0
 @Test(expected = NoResourceException.class)
 public void deleteDb_dbNotExist_exception() {
   String dbName = "mazha_test_deletedb_not_exist";
   CouchClient customClient = new CouchClient(getCouchConfig(dbName));
   Preconditions.checkArgument(!isDbExist(dbName), "%s must not exist", dbName);
   customClient.deleteDb();
 }
コード例 #2
0
 @Test(expected = CouchException.class)
 public void createDb_invalidDBNmae_exception() {
   // Couch does not like capital character in db name
   String dbName = "mazha_test_INVALID_DB_NAME";
   CouchClient customClient = new CouchClient(getCouchConfig(dbName));
   customClient.createDb();
 }
コード例 #3
0
 private boolean isDbExist(String dbName) {
   try {
     CouchClient c = new CouchClient(getCouchConfig(dbName));
     c.getDbInfo();
     return true;
   } catch (CouchException ce) {
     return false;
   }
 }
コード例 #4
0
  @Test
  public void deleteDb_dbMustBeDeleted() {
    String dbName = "mazha_test_deletedb" + System.currentTimeMillis();
    CouchClient customClient = new CouchClient(getCouchConfig(dbName));
    ClientTestUtils.deleteQuietly(client);

    customClient.createDb();
    Assert.assertTrue("DB must exist.", isDbExist(dbName));

    customClient.deleteDb();
    Assert.assertFalse("DB must not exist.", isDbExist(dbName));
  }
コード例 #5
0
 @Test(expected = CouchException.class)
 public void getDbInfo_invalidDbName_exception() {
   String dbName = "mazha_test_A";
   CouchClient customClient = new CouchClient(getCouchConfig(dbName));
   customClient.getDbInfo();
 }