/** * Drops the database if it exists. * * @param dbName name of database to drop * @throws MongoException if the operation fails */ public void dropDatabase(final String dbName) { getDB(dbName).dropDatabase(); }
protected void cleanup() { DB db = getDb(); if (db != null) { db.dropDatabase(); } }
public static void clearDBData() { DB db = MongoDBTestRunner.getDB(); if (db != null) { db.dropDatabase(); } } }
@Test public void testOldStyleIndexing() { getMorphia().map(OldStyleIndexing.class); getDb().dropDatabase(); getAds().ensureIndexes(); testIndex(getAds().getCollection(OldStyleIndexing.class).getIndexInfo(), new BasicDBObject("field", 1), new BasicDBObject("field2", -1), new BasicDBObject("f3", 1)); }
private void truncateMongo() { if (db != null) { db.dropDatabase(); } }
/** * */ private void truncateMongo() { if (db != null) { db.dropDatabase(); } }
private static void dropDB() throws UnknownHostException { MongoClient mongoClient = new MongoClient(new ServerAddress("localhost", 27017)); DB db = mongoClient.getDB("sparktest"); db.dropDatabase(); }
@Test public void testEnumMapping() { getDs().getDB().dropDatabase(); getMorphia().map(ContainsEnum.class); getDs().save(new ContainsEnum()); Assert.assertEquals(1, getDs().find(ContainsEnum.class).field("foo").equal(Foo.BAR) .count()); Assert.assertEquals(1, getDs().find(ContainsEnum.class).filter("foo", Foo.BAR) .count()); Assert.assertEquals(1, getDs().find(ContainsEnum.class).disableValidation().filter("foo", Foo.BAR) .count()); }
mongoDB.dropDatabase();
mongoDB.dropDatabase();
mongoDB.dropDatabase();
/** * Drops the database if it exists. * * @param dbName name of database to drop * @throws MongoException if the operation fails */ public void dropDatabase(final String dbName) { getDB(dbName).dropDatabase(); }
private void dropDatabase(DB database) { boolean nonSystemCollectionsExists = false; for (final String collectionString : database.getCollectionNames()) { if (collectionString.startsWith("system")) { continue; } nonSystemCollectionsExists = true; break; } if (!nonSystemCollectionsExists) { database.dropDatabase(); } }
@Override protected AccountStore newAccountStore() { database.dropDatabase(); return store; } }
@Override protected AttachmentStore newAttachmentStore() { database.dropDatabase(); return store; } }
@Setup public void setupDatastore() throws Exception { MongoClient mongo = getMongoClient(); db = mongo.getDB( properties.getProperty( "database" ) ); db.dropDatabase(); rand = new Random(); } }
@Override protected void tearDown() throws Exception { super.tearDown(); database.dropDatabase(); }
@Override protected void tearDown() throws Exception { super.tearDown(); database.dropDatabase(); }
@Override protected void tearDown() throws Exception { super.tearDown(); database.dropDatabase(); } }
public void execute() throws Exception { startServer(); RepositoryItem repositoryItem = getRepository().createRepositoryItem(); Repository repo = getRepository(); if (repo instanceof MongoRepository) { MongoRepository mrepo = (MongoRepository) repo; mrepo.getGridFS().getDB().dropDatabase(); } prepareToUploadVideo(repositoryItem); prepareToDownloadVideo(repositoryItem); stopServer(); }