Search in sources :

Example 1 with MappingFile

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);
}
Also used : MappingFile(org.openlca.core.model.MappingFile) Test(org.junit.Test)

Example 2 with MappingFile

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);
}
Also used : MappingFile(org.openlca.core.model.MappingFile) Test(org.junit.Test)

Example 3 with MappingFile

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);
}
Also used : MappingFile(org.openlca.core.model.MappingFile) Test(org.junit.Test)

Example 4 with MappingFile

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);
}
Also used : MappingFile(org.openlca.core.model.MappingFile)

Aggregations

MappingFile (org.openlca.core.model.MappingFile)4 Test (org.junit.Test)3