use of io.lumeer.storage.mongodb.model.MorphiaCollection in project engine by Lumeer.
the class MorphiaCollectionDaoTest method testCreateCollectionExistingName.
@Test
public void testCreateCollectionExistingName() {
createCollection(CODE, NAME);
MorphiaCollection collection = prepareCollection(CODE2, NAME);
assertThatThrownBy(() -> collectionDao.createCollection(collection)).isInstanceOf(DuplicateKeyException.class);
}
use of io.lumeer.storage.mongodb.model.MorphiaCollection in project engine by Lumeer.
the class MorphiaCollectionDaoTest method createCollection.
private MorphiaCollection createCollection(String code, String name) {
MorphiaCollection collection = prepareCollection(code, name);
datastore.insert(collectionDao.databaseCollection(), collection);
return collection;
}
use of io.lumeer.storage.mongodb.model.MorphiaCollection in project engine by Lumeer.
the class MorphiaCollectionDaoTest method testCreateCollectionExistingCode.
@Test
public void testCreateCollectionExistingCode() {
createCollection(CODE, NAME);
MorphiaCollection collection = prepareCollection(CODE, NAME2);
assertThatThrownBy(() -> collectionDao.createCollection(collection)).isInstanceOf(DuplicateKeyException.class);
}
use of io.lumeer.storage.mongodb.model.MorphiaCollection in project engine by Lumeer.
the class MorphiaCollectionDaoTest method testUpdateCollectionNotExisting.
@Test
@Ignore("Stored anyway with the current implementation")
public void testUpdateCollectionNotExisting() {
MorphiaCollection collection = prepareCollection(CODE, NAME);
assertThatThrownBy(() -> collectionDao.updateCollection(COLLECTION_ID, collection)).isInstanceOf(StorageException.class);
}
use of io.lumeer.storage.mongodb.model.MorphiaCollection in project engine by Lumeer.
the class MorphiaCollectionDaoTest method testUpdateCollection.
@Test
public void testUpdateCollection() {
String id = createCollection(CODE, NAME).getId();
MorphiaCollection collection = prepareCollection(CODE2, NAME);
Collection updatedCollection = collectionDao.updateCollection(id, collection);
assertThat(updatedCollection).isNotNull();
assertThat(updatedCollection.getCode()).isEqualTo(CODE2);
Collection storedCollection = datastore.get(collectionDao.databaseCollection(), MorphiaCollection.class, new ObjectId(id));
assertThat(storedCollection).isNotNull();
assertThat(updatedCollection).isEqualTo(storedCollection);
}
Aggregations