use of org.openlca.core.model.Process in project olca-modules by GreenDelta.
the class ProcessTest method createProcess.
private Process createProcess(Flow product, ProcessDao dao) {
Process p = new Process();
p.name = "process";
p.refId = UUID.randomUUID().toString();
Exchange out = createExchange(p, product, null);
out.isInput = false;
p.exchanges.add(out);
p.quantitativeReference = out;
return dao.insert(p);
}
use of org.openlca.core.model.Process 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.model.Process in project olca-modules by GreenDelta.
the class ExchangeCostTest method checkImport.
private void checkImport(Process originalProc) {
Process importedProc = processDao.getForRefId(originalProc.refId);
Exchange original = originalProc.exchanges.get(0);
Exchange imported = importedProc.exchanges.get(0);
Assert.assertEquals(original.costs, imported.costs);
}
use of org.openlca.core.model.Process in project olca-modules by GreenDelta.
the class ParameterReferencesTest method createProcess.
private Process createProcess(Exchange[] exchanges, Parameter[] parameters) {
Process p = new Process();
p.refId = UUID.randomUUID().toString();
if (parameters != null)
p.parameters.addAll(Arrays.asList(parameters));
if (exchanges != null)
p.exchanges.addAll(Arrays.asList(exchanges));
return p;
}
use of org.openlca.core.model.Process 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