mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-02 18:33:54 +00:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
159b8c3536
3 files changed
+22
-5
No files matched your search
+1
-1
@@ -99,7 +99,7 @@ public class RaceRecord {
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
public String getEventName() {
|
||||
return regattaName;
|
||||
}
|
||||
|
||||
+10
-1
@@ -7,8 +7,10 @@ import java.net.UnknownHostException;
|
||||
import org.junit.Before;
|
||||
|
||||
import com.mongodb.DB;
|
||||
import com.mongodb.DBCollection;
|
||||
import com.mongodb.Mongo;
|
||||
import com.mongodb.MongoException;
|
||||
import com.sap.sailing.domain.persistence.impl.CollectionNames;
|
||||
import com.sap.sailing.mongodb.MongoDBConfiguration;
|
||||
import com.sap.sailing.mongodb.MongoDBService;
|
||||
|
||||
@@ -37,10 +39,17 @@ public abstract class AbstractMongoDBTest {
|
||||
mongo = newMongo();
|
||||
assertNotNull(mongo);
|
||||
db = mongo.getDB(getDBConfiguration().getDatabaseName());
|
||||
db.dropDatabase();
|
||||
dropAllCollections(db);
|
||||
assertNotNull(db);
|
||||
}
|
||||
|
||||
private void dropAllCollections(DB theDB) throws InterruptedException {
|
||||
for (CollectionNames collectionName : CollectionNames.values()) {
|
||||
DBCollection c = theDB.getCollection(collectionName.name());
|
||||
c.drop();
|
||||
}
|
||||
}
|
||||
|
||||
protected MongoDBService getMongoService() {
|
||||
return service;
|
||||
}
|
||||
|
||||
+11
-3
@@ -5,6 +5,7 @@ import static org.junit.Assert.assertNotNull;
|
||||
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.mongodb.BasicDBObject;
|
||||
@@ -27,6 +28,13 @@ import com.sap.sailing.domain.tracking.impl.WindImpl;
|
||||
public class TestStoringAndRetrievingWindData extends AbstractMongoDBTest {
|
||||
private static final String WIND_TEST_COLLECTION = "wind_test_collection";
|
||||
|
||||
@Before
|
||||
@Override
|
||||
public void dropTestDB() throws UnknownHostException, MongoException, InterruptedException {
|
||||
super.dropTestDB();
|
||||
db.getCollection(WIND_TEST_COLLECTION).drop();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDBConnection() throws UnknownHostException, MongoException {
|
||||
DBCollection coll = db.getCollection(WIND_TEST_COLLECTION);
|
||||
@@ -57,8 +65,8 @@ public class TestStoringAndRetrievingWindData extends AbstractMongoDBTest {
|
||||
DBCollection coll = db.getCollection(WIND_TEST_COLLECTION);
|
||||
assertNotNull(coll);
|
||||
DBObject object = coll.findOne();
|
||||
assertEquals(object.get("truebearingdeg"), 234.3);
|
||||
assertEquals(object.get("knotspeed"), 10.7);
|
||||
assertEquals(234.3, object.get("truebearingdeg"));
|
||||
assertEquals(10.7, object.get("knotspeed"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +82,7 @@ public class TestStoringAndRetrievingWindData extends AbstractMongoDBTest {
|
||||
}
|
||||
|
||||
{
|
||||
Thread.sleep(1000); // wait until MongoDB has recorded the change and made it visible
|
||||
Thread.sleep(3000); // wait until MongoDB has recorded the change and made it visible
|
||||
Mongo mongo = newMongo();
|
||||
assertNotNull(mongo);
|
||||
DB db = mongo.getDB(getDBConfiguration().getDatabaseName());
|
||||
|
||||
Reference in new issue
Block a user