use of io.lumeer.api.model.ImportedCollection in project engine by Lumeer.
the class ImportFacade method importDocuments.
public Collection importDocuments(String format, ImportedCollection importedCollection) {
Collection collectionToCreate = importedCollection.getCollection();
collectionToCreate.setName(generateCollectionName(collectionToCreate.getName()));
Collection collection = collectionFacade.createCollection(collectionToCreate);
switch(format.toLowerCase()) {
case FORMAT_CSV:
parseCSVFile(collection, importedCollection.getData());
break;
}
return collection;
}
use of io.lumeer.api.model.ImportedCollection in project engine by Lumeer.
the class ImportFacadeIT method testImportEmptyCSV.
@Test
public void testImportEmptyCSV() {
final String emptyCSV = "";
ImportedCollection importedCollection = createImportObject(emptyCSV);
Collection collection = importFacade.importDocuments(ImportFacade.FORMAT_CSV, importedCollection);
assertThat(collection).isNotNull();
List<DataDocument> data = dataDao.getData(collection.getId(), query());
assertThat(data).isEmpty();
}
use of io.lumeer.api.model.ImportedCollection in project engine by Lumeer.
the class ImportFacadeIT method testImportCollectionInfo.
@Test
public void testImportCollectionInfo() {
final String emptyCSV = "";
ImportedCollection importedCollection = createImportObject(emptyCSV);
Collection collection = importFacade.importDocuments(ImportFacade.FORMAT_CSV, importedCollection);
assertThat(collection).isNotNull();
assertThat(collection.getName()).isEqualTo(COLLECTION_NAME);
assertThat(collection.getCode()).isEqualTo(COLLECTION_CODE);
assertThat(collection.getIcon()).isEqualTo(COLLECTION_ICON);
assertThat(collection.getColor()).isEqualTo(COLLECTION_COLOR);
}
Aggregations