mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-04 03:13:49 +00:00
The DatabaseHelper was delete, since we can't use this approach to reset
the state of the SailingService.
This commit is contained in:
1 parent
c345287ec0
commit
f55cff785d
1 file changed
-57
-57
@@ -1,57 +0,0 @@
|
||||
package com.sap.sailing.selenium.test;
|
||||
|
||||
import com.mongodb.DB;
|
||||
import com.mongodb.MongoException;
|
||||
|
||||
import com.sap.sailing.mongodb.MongoDBConfiguration;
|
||||
import com.sap.sailing.mongodb.MongoDBService;
|
||||
|
||||
public class DatabaseHelper {
|
||||
public static String TEST_DB_NAME = "winddbTest";
|
||||
|
||||
public static void dropDatabase() throws MongoException {
|
||||
dropDatabase(getTestConfiguration());
|
||||
}
|
||||
|
||||
public static void dropDatabase(MongoDBConfiguration configuration) throws MongoException {
|
||||
DatabaseHelper helper = new DatabaseHelper(configuration);
|
||||
DB database = helper.getDatabase();
|
||||
|
||||
database.dropDatabase();
|
||||
}
|
||||
|
||||
private static MongoDBConfiguration getTestConfiguration() {
|
||||
String host = System.getProperty(MongoDBConfiguration.MONGO_HOSTNAME, "127.0.0.1");
|
||||
int port = Integer.valueOf(System.getProperty(MongoDBConfiguration.MONGO_PORT, "27017"));
|
||||
|
||||
return new MongoDBConfiguration(host, port, TEST_DB_NAME);
|
||||
}
|
||||
|
||||
private final MongoDBConfiguration configuration;
|
||||
|
||||
private final MongoDBService service;
|
||||
|
||||
private final DB database;
|
||||
|
||||
public DatabaseHelper() {
|
||||
this(getTestConfiguration());
|
||||
}
|
||||
|
||||
public DatabaseHelper(MongoDBConfiguration configuration) {
|
||||
this.configuration = configuration;
|
||||
this.service = getDBConfiguration().getService();
|
||||
this.database = this.service.getDB();
|
||||
}
|
||||
|
||||
public MongoDBConfiguration getDBConfiguration() {
|
||||
return this.configuration;
|
||||
}
|
||||
|
||||
public MongoDBService getService() {
|
||||
return this.service;
|
||||
}
|
||||
|
||||
public DB getDatabase() {
|
||||
return this.database;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user