use of com.mongodb.MongoClient in project java-design-patterns by iluwatar.
the class MongoTicketRepositoryTest method init.
@BeforeEach
public void init() {
MongoConnectionPropertiesLoader.load();
MongoClient mongoClient = new MongoClient(System.getProperty("mongo-host"), Integer.parseInt(System.getProperty("mongo-port")));
mongoClient.dropDatabase(TEST_DB);
mongoClient.close();
repository = new MongoTicketRepository(TEST_DB, TEST_TICKETS_COLLECTION, TEST_COUNTERS_COLLECTION);
}
use of com.mongodb.MongoClient in project java-design-patterns by iluwatar.
the class MongoEventLogTest method init.
@BeforeEach
public void init() {
MongoConnectionPropertiesLoader.load();
MongoClient mongoClient = new MongoClient(System.getProperty("mongo-host"), Integer.parseInt(System.getProperty("mongo-port")));
mongoClient.dropDatabase(TEST_DB);
mongoClient.close();
mongoEventLog = new MongoEventLog(TEST_DB, TEST_EVENTS_COLLECTION);
}
use of com.mongodb.MongoClient in project java-design-patterns by iluwatar.
the class DbManager method connect.
/**
* Connect to DB
*/
public static void connect() throws ParseException {
useMongoDB = true;
mongoClient = new MongoClient();
db = mongoClient.getDatabase("test");
}
use of com.mongodb.MongoClient in project spring-data-mongodb by spring-projects.
the class ExecutableRemoveOperationSupportTests method setUp.
@Before
public void setUp() {
template = new MongoTemplate(new SimpleMongoDbFactory(new MongoClient(), "ExecutableRemoveOperationSupportTests"));
template.dropCollection(STAR_WARS);
han = new Person();
han.firstname = "han";
han.id = "id-1";
luke = new Person();
luke.firstname = "luke";
luke.id = "id-2";
template.save(han);
template.save(luke);
}
use of com.mongodb.MongoClient in project spring-data-mongodb by spring-projects.
the class ExecutableUpdateOperationSupportTests method setUp.
@Before
public void setUp() {
template = new MongoTemplate(new SimpleMongoDbFactory(new MongoClient(), "ExecutableUpdateOperationSupportTests"));
template.dropCollection(STAR_WARS);
han = new Person();
han.firstname = "han";
han.id = "id-1";
luke = new Person();
luke.firstname = "luke";
luke.id = "id-2";
template.save(han);
template.save(luke);
}
Aggregations