Example #1
0
 private static void setCollectionFromName(String line) {
   int idx = line.indexOf(COLLECTION_NAME_LINE);
   if (idx != -1) {
     String collectionName = line.substring(++idx, line.length()).trim();
     if (StringUtils.isNotEmpty(collectionName)) {
       LOG.info("Loading data into " + collectionName + " collection");
       currentCollection = MongoDBTestRunner.getDB().getCollectionFromString(collectionName);
     } else {
       new RuntimeException(
           "Incorrect collection name:"
               + collectionName
               + ". Please write collection name in correct format: # collectionName");
     }
   } else {
     throw new RuntimeException(
         "Incorrect format of data file. Please write collection name in correct format: # collectionName");
   }
 }
Example #2
0
 public static void clearDBData() {
   DB db = MongoDBTestRunner.getDB();
   if (db != null) {
     db.dropDatabase();
   }
 }