use of org.openlca.core.database.ParameterDao in project olca-modules by GreenDelta.
the class FormulaInterpreterTest method setUp.
/**
* sets the following parameters:
*
* fi_tests_global = 32
*
* fi_tests_local = fi_tests_global + 10
*/
@Before
public void setUp() {
globalParam = new Parameter();
globalParam.name = "fi_tests_global";
globalParam.isInputParameter = true;
globalParam.scope = ParameterScope.GLOBAL;
globalParam.value = 32;
new ParameterDao(db).insert(globalParam);
process = new Process();
var localParam = new Parameter();
localParam.name = "fi_tests_local";
localParam.formula = "fi_tests_global + 10";
localParam.isInputParameter = false;
localParam.scope = ParameterScope.PROCESS;
process.parameters.add(localParam);
process = new ProcessDao(db).insert(process);
interpreter = ParameterTable.interpreter(db, Collections.singleton(process.id), Collections.emptySet());
}
use of org.openlca.core.database.ParameterDao in project olca-modules by GreenDelta.
the class FormulaInterpreterTest method tearDown.
@After
public void tearDown() {
new ParameterDao(db).delete(globalParam);
new ProcessDao(db).delete(process);
}
use of org.openlca.core.database.ParameterDao 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.ParameterDao 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.ParameterDao in project olca-modules by GreenDelta.
the class ParameterReferencesTest method createParameter.
private Parameter createParameter(String name, String formula, ParameterScope scope, Uncertainty u) {
Parameter p = new Parameter();
p.name = name;
p.value = 1;
if (formula != null) {
p.isInputParameter = false;
p.formula = formula;
} else
p.isInputParameter = true;
if (scope != null)
p.scope = scope;
else
p.scope = ParameterScope.GLOBAL;
p.refId = UUID.randomUUID().toString();
p.uncertainty = u;
if (p.scope != ParameterScope.GLOBAL)
return p;
return new ParameterDao(db).insert(p);
}
Aggregations