use of org.openlca.core.model.MappingFile in project olca-modules by GreenDelta.
the class MappingDaoTest method testGetContent.
@Test
public void testGetContent() throws Exception {
MappingFile file = dao.getForName(FILE_NAME);
String t = new String(BinUtils.gunzip(file.content), StandardCharsets.UTF_8);
Assert.assertEquals(t, CONTENT);
}
use of org.openlca.core.model.MappingFile in project olca-modules by GreenDelta.
the class MappingDaoTest method testGetAll.
@Test
public void testGetAll() {
var all = dao.getAll();
boolean found = false;
for (MappingFile file : all) {
if (FILE_NAME.equals(file.name)) {
found = true;
break;
}
}
Assert.assertTrue(found);
}
use of org.openlca.core.model.MappingFile in project olca-modules by GreenDelta.
the class MappingDaoTest method testGetForFileName.
@Test
public void testGetForFileName() {
MappingFile file = dao.getForName(FILE_NAME);
Assert.assertEquals(FILE_NAME, file.name);
}
use of org.openlca.core.model.MappingFile in project olca-modules by GreenDelta.
the class MappingFileImport method syncFile.
private void syncFile(MappingFile sourceFile) {
if (sourceFile == null || sourceFile.content == null)
return;
var destFile = destDao.getForName(sourceFile.name);
if (destFile != null) {
log.trace("the mapping file {} already exist in the database and " + "was not changed", destFile);
return;
}
log.trace("copy mapping file {}", sourceFile);
destFile = new MappingFile();
destFile.content = sourceFile.content;
destFile.name = sourceFile.name;
destDao.insert(destFile);
}
Aggregations