use of io.lumeer.engine.api.data.DataDocument in project engine by Lumeer.
the class MongoDataDaoTest method testGetDataByFulltextAttributeName.
@Test
@Ignore("Does not work at the moment")
public void testGetDataByFulltextAttributeName() {
String id1 = createDocument(KEY1, VALUE1);
String id2 = createDocument("fulltext", VALUE1);
String id3 = createDocument(KEY1, VALUE1);
SearchQuery searchQuery = SearchQuery.createBuilder(USER).fulltext("fulltext").build();
List<DataDocument> data = dataDao.getData(COLLECTION_ID, searchQuery);
assertThat(data).extracting(DataDocument::getId).containsOnly(id2);
}
use of io.lumeer.engine.api.data.DataDocument in project engine by Lumeer.
the class MongoDataDaoTest method testGetDataByFulltextAttributeValue.
@Test
public void testGetDataByFulltextAttributeValue() {
String id1 = createDocument(KEY1, VALUE1);
String id2 = createDocument(KEY1, "fulltext");
String id3 = createDocument(KEY1, "something fulltext");
String id4 = createDocument(KEY1, VALUE1);
SearchQuery searchQuery = SearchQuery.createBuilder(USER).fulltext("fulltext").build();
List<DataDocument> data = dataDao.getData(COLLECTION_ID, searchQuery);
assertThat(data).extracting(DataDocument::getId).containsOnly(id2, id3);
}
use of io.lumeer.engine.api.data.DataDocument in project engine by Lumeer.
the class MongoDataDaoTest method testPatchData.
@Test
public void testPatchData() {
String id = createDocument();
DataDocument data = new DataDocument().append(KEY1, VALUE2);
dataDao.patchData(COLLECTION_ID, id, data);
MongoCursor<Document> mongoCursor = dataCollection().find().iterator();
assertThat(mongoCursor.hasNext()).isTrue();
Document document = mongoCursor.next();
assertThat(document).containsEntry(KEY1, VALUE2);
assertThat(document).containsEntry(KEY2, VALUE2);
}
use of io.lumeer.engine.api.data.DataDocument in project engine by Lumeer.
the class MongoDataDaoTest method testUpdateData.
@Test
public void testUpdateData() {
String id = createDocument();
DataDocument data = new DataDocument().append(KEY1, VALUE2);
dataDao.updateData(COLLECTION_ID, id, data);
MongoCursor<Document> mongoCursor = dataCollection().find().iterator();
assertThat(mongoCursor.hasNext()).isTrue();
Document document = mongoCursor.next();
assertThat(document).containsEntry(KEY1, VALUE2);
assertThat(document).doesNotContainKey(KEY2);
}
use of io.lumeer.engine.api.data.DataDocument in project engine by Lumeer.
the class MongoDataDaoTest method testGetSingleDataRecord.
@Test
public void testGetSingleDataRecord() {
String id = createDocument();
DataDocument dataDocument = dataDao.getData(COLLECTION_ID, id);
assertThat(dataDocument).containsEntry(KEY1, VALUE1);
assertThat(dataDocument).containsEntry(KEY2, VALUE2);
}
Aggregations