Merge remote-tracking branch 'origin/master' into dataMining

This commit is contained in:
Lennart Hensler committed 2014-03-02 10:11:48 +01:00
commit a0f6af0318
5 files changed
+13 -2

No files matched your search

@@ -19,6 +19,7 @@ import com.mongodb.BasicDBObject;
import com.mongodb.DB;
import com.mongodb.DBCollection;
import com.mongodb.DBObject;
import com.mongodb.WriteConcern;
import com.sap.sailing.domain.common.impl.Util.Pair;
import com.sap.sailing.domain.swisstimingadapter.SailMasterMessage;
import com.sap.sailing.domain.swisstimingadapter.SailMasterTransceiver;
@@ -162,7 +163,7 @@ public class StoreAndForward implements Runnable {
private long getLastMessageCount() {
DBObject lastMessageCountRecord = lastMessageCountCollection.findOne();
if (lastMessageCountRecord == null) {
lastMessageCountCollection.insert(new BasicDBObject().append(FieldNames.LAST_MESSAGE_COUNT.name(), 0l));
lastMessageCountCollection.insert(new BasicDBObject().append(FieldNames.LAST_MESSAGE_COUNT.name(), 0l), WriteConcern.SAFE);
}
return lastMessageCountRecord == null ? 0 : ((Number) lastMessageCountRecord.get(FieldNames.LAST_MESSAGE_COUNT.name())).longValue();
}
@@ -261,7 +261,7 @@ public class SwissTimingAdapterPersistenceImpl implements SwissTimingAdapterPers
if(type.isRaceSpecific()) {
objToInsert.put(FieldNames.RACE_ID.name(), message.getRaceID());
messageCollection = database.getCollection(CollectionNames.RACES_MESSAGES.name());
if (message.getSequenceNumber() == null){
if (message.getSequenceNumber() == null) {
DBObject emptyQuery = new BasicDBObject();
DBObject incrementLastMessageCountQuery = new BasicDBObject().
append("$inc", new BasicDBObject().append(FieldNames.LAST_MESSAGE_COUNT.name(), 1));
@@ -333,6 +333,8 @@ public class SwissTimingAdapterPersistenceImpl implements SwissTimingAdapterPers
racesMessageCollection.drop();
DBCollection cmdMessageCollection = database.getCollection(CollectionNames.COMMAND_MESSAGES.name());
cmdMessageCollection.drop();
DBCollection lastMessageCountCollection = database.getCollection(CollectionNames.LAST_MESSAGE_COUNT.name());
lastMessageCountCollection.drop();
database.getLastError(); // wait for the drop() to complete
}
}
@@ -58,6 +58,10 @@ public class ActivelyConnectingStoreAndForwardTest {
public void setUp() throws UnknownHostException, IOException, InterruptedException {
MongoDBService mongoDBService = MongoDBService.INSTANCE;
db = mongoDBService.getDB();
// Now ensure that for the duration of this test, until in tearDown() db.requestDone() is called, the DB connection
// keeps using the same socket / connection to the DB, so we read our own writes.
db.requestStart();
db.requestEnsureConnection();
sailMasterDummyListenerThread = new Thread("ActivelyConnectingStoreAndForwardTest-Listener") {
public void run() {
try {
@@ -107,11 +111,13 @@ public class ActivelyConnectingStoreAndForwardTest {
DBCollection lastMessageCountCollection = db.getCollection(CollectionNames.LAST_MESSAGE_COUNT.name());
lastMessageCountCollection.update(new BasicDBObject(), new BasicDBObject().append(FieldNames.LAST_MESSAGE_COUNT.name(), 0l),
/* upsert */ true, /* multi */ false);
db.getLastError(); // wait for this update to succeed
}
@After
public void tearDown() throws InterruptedException, IOException {
logger.entering(getClass().getName(), "tearDown");
db.requestDone();
storeAndForward.stop();
sailMasterDummyListenerThread.join();
connector.stop();
+2
View File
@@ -14,4 +14,6 @@ Now push your changes to the remote Git repository. It will take some time befor
* [Server-side Integration of Mobile Devices](/doc/theses/20130210_Teschke_Server-side_Integration_Mobile_Devices.pdf) (Bachelor Thesis, Feb 2013, Fredrik Teschke)
* [Data mining the SAP Sailing Analytics](/doc/theses/20130826_Hensler_Implementing_a_Interface_between_SAP_Sailing_Analytics_and_standard_SAP_analysis_tools.pdf) (Bachelor Thesis, Aug 2013, Lennart Hensler)
* [Tracking Sailing Races with mobile Devices](/doc/theses/20130913_Bross_Tracking_Sailing_Races_with_Mobile_Devices.pdf) (T2000_2 Project Thesis, Sep 2013, Jan Broß)