use of org.openlca.ilcd.models.Group in project olca-modules by GreenDelta.
the class ModelIOTest method testSimpleModel.
@Test
public void testSimpleModel() throws Exception {
Model model = new Model();
Models.forceDataSetInfo(model).uuid = UUID.randomUUID().toString();
Models.forceModelName(model).name.add(LangString.of("Example model", "en"));
Models.forcePublication(model).version = "01.00.000";
Classification classification = new Classification();
Category category = new Category();
category.level = 0;
category.value = "Life cycle models";
classification.categories.add(category);
Models.forceClassifications(model).add(classification);
Models.forceQuantitativeReference(model).refProcess = 42;
Technology tech = Models.forceTechnology(model);
Group group = new Group();
group.id = 42;
group.name.add(LangString.of("Use phase", "en"));
tech.groups.add(group);
ProcessInstance pi = new ProcessInstance();
tech.processes.add(pi);
GroupRef groupRef = new GroupRef();
groupRef.groupID = 42;
pi.groupRefs.add(groupRef);
Parameter param = new Parameter();
param.name = "distance";
param.value = 42.42;
pi.parameters.add(param);
Connection con = new Connection();
con.outputFlow = UUID.randomUUID().toString();
DownstreamLink link = new DownstreamLink();
link.inputFlow = UUID.randomUUID().toString();
link.process = 42;
con.downstreamLinks.add(link);
pi.connections.add(con);
StringWriter writer = new StringWriter();
XmlBinder binder = new XmlBinder();
binder.toWriter(model, writer);
StringReader reader = new StringReader(writer.toString());
model = JAXB.unmarshal(reader, Model.class);
assertEquals(1, model.info.technology.processes.size());
}
Aggregations