in StoreAndLoadCompetitorsTest drop the COMPETITORS, not the COMPETITORS_BAK collection, also now the BOATS collection

Change-Id: Ic65e0bee3de5b8fe76d74c4bcb0fe2cafc01e9aa
This commit is contained in:
Axel Uhl committed 2018-03-19 17:49:05 +01:00
1 parent 98cd6c4f1c
commit a66ffac4b3
2 files changed
+9 -9

No files matched your search

@@ -54,11 +54,9 @@ public class TransientCompetitorStoreImpl implements CompetitorStore, Serializab
private transient WeakHashMap<Competitor, CompetitorWithoutBoatDTO> weakCompetitorDTOCache;
private final Set<Boat> boatsToUpdateDuringGetOrCreate;
private transient WeakHashMap<Boat, BoatDTO> weakBoatDTOCache;
private final NamedReentrantReadWriteLock lock;
@@ -69,7 +67,6 @@ public class TransientCompetitorStoreImpl implements CompetitorStore, Serializab
competitorsToUpdateDuringGetOrCreate = new HashSet<Competitor>();
weakCompetitorDTOCache = new WeakHashMap<Competitor, CompetitorWithoutBoatDTO>();
competitorUpdateListeners = Collections.synchronizedSet(new HashSet<CompetitorStore.CompetitorUpdateListener>());
boatCache = new HashMap<Serializable, Boat>();
boatsByIdAsString = new HashMap<String, Boat>();
boatsToUpdateDuringGetOrCreate = new HashSet<Boat>();
@@ -72,11 +72,14 @@ public class StoreAndLoadCompetitorsTest extends AbstractMongoDBTest {
domainFactory = new DomainFactoryImpl((srlid)->null);
}
private void dropCompetitorCollection() {
private void dropCompetitorAndBoatsCollection() {
DB db = getMongoService().getDB();
DBCollection competitorCollection = db.getCollection(CollectionNames.COMPETITORS_BAK.name());
DBCollection competitorCollection = db.getCollection(CollectionNames.COMPETITORS.name());
competitorCollection.setWriteConcern(WriteConcern.SAFE); // ensure that the drop() has happened
competitorCollection.drop();
DBCollection boatsCollection = db.getCollection(CollectionNames.BOATS.name());
boatsCollection.setWriteConcern(WriteConcern.SAFE); // ensure that the drop() has happened
boatsCollection.drop();
}
@Test
@@ -90,7 +93,7 @@ public class StoreAndLoadCompetitorsTest extends AbstractMongoDBTest {
MongoObjectFactory mongoObjectFactory = PersistenceFactory.INSTANCE.getMongoObjectFactory(getMongoService());
DomainObjectFactory domainObjectFactory = PersistenceFactory.INSTANCE.getDomainObjectFactory(getMongoService(), domainFactory);
dropCompetitorCollection();
dropCompetitorAndBoatsCollection();
DynamicCompetitor c = (DynamicCompetitor) createCompetitor(competitorName1);
c.setShortName(competitorShortName1);
@@ -121,7 +124,7 @@ public class StoreAndLoadCompetitorsTest extends AbstractMongoDBTest {
public void testStoreAndUpdateCompetitorWithUUIDAsId() {
MongoObjectFactory mongoObjectFactory = PersistenceFactory.INSTANCE.getMongoObjectFactory(getMongoService());
DomainObjectFactory domainObjectFactory = PersistenceFactory.INSTANCE.getDomainObjectFactory(getMongoService(), domainFactory);
dropCompetitorCollection();
dropCompetitorAndBoatsCollection();
DynamicCompetitor c = (DynamicCompetitor) createCompetitor("Hasso", UUID.randomUUID());
mongoObjectFactory.storeCompetitor(c);
@@ -135,7 +138,7 @@ public class StoreAndLoadCompetitorsTest extends AbstractMongoDBTest {
public void testStoreAndRemoveCompetitor() {
MongoObjectFactory mongoObjectFactory = PersistenceFactory.INSTANCE.getMongoObjectFactory(getMongoService());
DomainObjectFactory domainObjectFactory = PersistenceFactory.INSTANCE.getDomainObjectFactory(getMongoService(), domainFactory);
dropCompetitorCollection();
dropCompetitorAndBoatsCollection();
DynamicCompetitor c = (DynamicCompetitor) createCompetitor("Hasso");
mongoObjectFactory.storeCompetitor(c);
@@ -149,7 +152,7 @@ public class StoreAndLoadCompetitorsTest extends AbstractMongoDBTest {
public void testStoreAndRemoveCompetitorWithUUIDAsId() {
MongoObjectFactory mongoObjectFactory = PersistenceFactory.INSTANCE.getMongoObjectFactory(getMongoService());
DomainObjectFactory domainObjectFactory = PersistenceFactory.INSTANCE.getDomainObjectFactory(getMongoService(), domainFactory);
dropCompetitorCollection();
dropCompetitorAndBoatsCollection();
DynamicCompetitor c = (DynamicCompetitor) createCompetitor("Hasso", UUID.randomUUID());
mongoObjectFactory.storeCompetitor(c);