@Override public void close() throws IOException { database.drop(); } });
@ManagedOperation public void dropDatabase(String databaseName) { getDB(databaseName).drop(); }
@Signature public void drop() { getWrappedObject().drop(); }
@Before public void before() { MongoClient client = new MongoClient(); client.getDatabase("jphp-mongo-ext").drop(); }
client.getDatabase(DBNAME).drop();
@ManagedOperation public void dropDatabase(String databaseName) { getDB(databaseName).drop(); }
/** * 删除当前数据库 * * @return * @throws Exception */ public int dropDatabase() throws Exception { this.mongoDatabase.drop(); return 1; }
@Override protected CertPathStore newCertPathStore() { database.drop(); return certPathStore; }
@Override public void deleteTenantData(String tenantId) throws SiteWhereException { MongoDatabase tenantDatabase = getTenantDatabase(tenantId); if (tenantDatabase != null) { tenantDatabase.drop(); } }
@Override protected AccountStore newAccountStore() { database.drop(); return store; } }
@Override public void drop() { db.drop(); }
@Override protected AttachmentStore newAttachmentStore() { database.drop(); return store; } }
private void dropSchemaAndDatabase(EntityManagerFactory entityManagerFactory) { MongoDBDatastoreProvider provider = getProvider( entityManagerFactory.unwrap( SessionFactory.class ) ); try { provider.getDatabase().drop(); } catch ( MongoException ex ) { throw new RuntimeException( ex ); } } }
protected void initMongoDB() { String mongoDBServer = defaultProperty(MONGODB_SERVER_PROPERTY, DEFAULT_MONGODB_SERVER); String mongoDBDbName = defaultProperty(MONGODB_DBNAME_PROPERTY, DEFAULT_MONGODB_DBNAME); try (MongoClient mongoClient = MongoDBConnectionHelper.newMongoClient(mongoDBServer)) { MongoDatabase database = mongoClient.getDatabase(mongoDBDbName); database.drop(); } }
@Override protected void tearDown() throws Exception { super.tearDown(); database.drop(); }
@Override protected void tearDown() throws Exception { super.tearDown(); database.drop(); } }
@Override protected void tearDown() throws Exception { super.tearDown(); database.drop(); }
@Test public void testDropDatabaseAlsoDropsCollectionData() throws Exception { collection.insertOne(json("")); db.drop(); assertThat(collection.countDocuments()).isZero(); }
static void dropDB(@NotNull final Class<?> clazz) throws Exception { MongoConnection con = createConnection(checkNotNull(clazz)); try { con.getDatabase().drop(); } finally { con.close(); } }
private static void dropDB() throws Exception { MongoConnection con = createConnection(); try { con.getDatabase().drop(); } finally { con.close(); } }