use of org.openlca.core.database.IDatabase in project olca-modules by GreenDelta.
the class ParameterTableTest method tearDown.
@After
public void tearDown() {
IDatabase db = Tests.getDb();
new ParameterDao(db).deleteAll();
new ProcessDao(db).deleteAll();
}
use of org.openlca.core.database.IDatabase in project olca-modules by GreenDelta.
the class SystemsInSystemsTests method testCalc.
@Test
public void testCalc() {
IDatabase db = Tests.getDb();
UnitGroupDao ugDao = new UnitGroupDao(db);
FlowPropertyDao fpDao = new FlowPropertyDao(db);
FlowDao flowDao = new FlowDao(db);
ProcessDao processDao = new ProcessDao(db);
ProductSystemDao systemDao = new ProductSystemDao(db);
UnitGroup ug6939 = new UnitGroup();
ug6939.refId = UUID.randomUUID().toString();
ug6939.name = "Units of mass";
Unit kg = new Unit();
kg.name = "kg";
kg.conversionFactor = 1.0;
kg.refId = UUID.randomUUID().toString();
}
use of org.openlca.core.database.IDatabase in project olca-modules by GreenDelta.
the class ParameterTableTest method setUp.
@Before
public void setUp() {
IDatabase db = Tests.getDb();
Parameter globalInp = inpParameter(42);
globalInp.scope = ParameterScope.GLOBAL;
Parameter globalDep = depParameter(2);
globalDep.scope = ParameterScope.GLOBAL;
ParameterDao paramDao = new ParameterDao(db);
paramDao.insert(globalInp);
paramDao.insert(globalDep);
process = new Process();
Parameter ppInp = inpParameter(84);
ppInp.scope = ParameterScope.PROCESS;
Parameter ppDep = depParameter(3);
ppDep.scope = ParameterScope.PROCESS;
process.parameters.add(ppInp);
process.parameters.add(ppDep);
new ProcessDao(db).insert(process);
}
use of org.openlca.core.database.IDatabase in project olca-modules by GreenDelta.
the class ProcessTest method testCyclicProvider.
@Test
public void testCyclicProvider() {
IDatabase db = Tests.getDb();
ProcessDao dao = new ProcessDao(db);
Process[] processes = createCyclicModel(db);
doExport(processes[0]);
dao.delete(processes[0]);
dao.delete(processes[1]);
doImport();
assertTestCyclicProvider(processes, dao);
delete(processes[0], Tests.getDb());
delete(processes[1], Tests.getDb());
}
use of org.openlca.core.database.IDatabase in project olca-modules by GreenDelta.
the class ProcessesTest method testFindForLabel.
@Test
public void testFindForLabel() {
IDatabase db = Tests.getDb();
Supplier<ProcessDescriptor> query = () -> Processes.findForLabel(db, "cow milking - CH");
assertNull(query.get());
ProcessDao dao = new ProcessDao(db);
Process p1 = new Process();
p1.name = "cow milking";
dao.insert(p1);
assertEquals(p1.id, query.get().id);
Location loc = new Location();
loc.code = "CH";
Daos.base(db, Location.class).insert(loc);
Process p2 = new Process();
p2.name = "cow milking";
p2.location = loc;
dao.insert(p2);
assertEquals(p2.id, query.get().id);
Daos.base(db, Location.class).delete(loc);
for (Process p : dao.getForName("cow milking")) {
dao.delete(p);
}
assertNull(query.get());
}
Aggregations