Search in sources :

Example 6 with Process

use of org.openlca.ilcd.processes.Process in project olca-modules by GreenDelta.

the class ProcessReadWriteTest method testReadWrite.

@Test
public void testReadWrite() throws Exception {
    Process process = new Process();
    setNameAndComment(process);
    createExchange(process);
    XmlBinder binder = new XmlBinder();
    byte[] bytes = binder.toByteArray(process);
    process = binder.fromStream(Process.class, new ByteArrayInputStream(bytes));
    Assert.assertEquals("process name", process.processInfo.dataSetInfo.name.name.get(0).value);
    Assert.assertEquals("process description", process.processInfo.dataSetInfo.comment.get(0).value);
    Assert.assertEquals(1, process.exchanges.size());
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) Process(org.openlca.ilcd.processes.Process) Test(org.junit.Test)

Example 7 with Process

use of org.openlca.ilcd.processes.Process in project olca-modules by GreenDelta.

the class ProcessTypeTest method with.

private void with(Consumer<Process> fn) throws Exception {
    try (InputStream xml = getClass().getResourceAsStream("sdk_sample_process.xml")) {
        Process p = JAXB.unmarshal(xml, Process.class);
        fn.accept(p);
    }
}
Also used : InputStream(java.io.InputStream) Process(org.openlca.ilcd.processes.Process)

Example 8 with Process

use of org.openlca.ilcd.processes.Process in project olca-modules by GreenDelta.

the class DataSets method putProcess.

private static void putProcess(SodaClient client) throws Exception {
    Process process = load(Process.class, "process.xml");
    ProcessBag bag = new ProcessBag(process, "en");
    if (!client.contains(Process.class, bag.getId()))
        client.put(process);
}
Also used : ProcessBag(org.openlca.ilcd.util.ProcessBag) Process(org.openlca.ilcd.processes.Process)

Example 9 with Process

use of org.openlca.ilcd.processes.Process in project olca-modules by GreenDelta.

the class NetworkGetTest method testGetProcess.

@Test
public void testGetProcess() {
    Assume.assumeTrue(TestServer.isAvailable());
    String id = "76d6aaa4-37e2-40b2-994c-03292b600074";
    Process process = client.get(Process.class, id);
    assertEquals(id, process.processInfo.dataSetInfo.uuid);
    testContains(Process.class, id);
}
Also used : Process(org.openlca.ilcd.processes.Process) Test(org.junit.Test)

Example 10 with Process

use of org.openlca.ilcd.processes.Process in project olca-modules by GreenDelta.

the class RefTreeTest method testNoRef.

@Test
public void testNoRef() {
    Process p = new Process();
    RefTree tree = RefTree.create(p);
    assertTrue(tree.root.childs.isEmpty());
    assertTrue(tree.getRefs().isEmpty());
}
Also used : Process(org.openlca.ilcd.processes.Process) ProcessSampleTest(org.openlca.ilcd.io.ProcessSampleTest) Test(org.junit.Test)

Aggregations

Process (org.openlca.ilcd.processes.Process)11 Test (org.junit.Test)7 InputStream (java.io.InputStream)4 ProcessSampleTest (org.openlca.ilcd.io.ProcessSampleTest)3 Ref (org.openlca.ilcd.commons.Ref)2 ProcessBag (org.openlca.ilcd.util.ProcessBag)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 Before (org.junit.Before)1 DataSetInfo (org.openlca.ilcd.processes.DataSetInfo)1 Exchange (org.openlca.ilcd.processes.Exchange)1 ProcessInfo (org.openlca.ilcd.processes.ProcessInfo)1 ProcessImport (org.openlca.io.ilcd.input.ProcessImport)1 ProcessExport (org.openlca.io.ilcd.output.ProcessExport)1