Search in sources :

Example 1 with Flow

use of org.openlca.ilcd.flows.Flow in project olca-modules by GreenDelta.

the class RefTreeTest method testFlowSample.

@Test
public void testFlowSample() {
    InputStream is = ProcessSampleTest.class.getResourceAsStream("sdk_sample_flow.xml");
    Flow p = JAXB.unmarshal(is, Flow.class);
    RefTree tree = RefTree.create(p);
    assertTrue(tree.getRefs().size() > 2);
}
Also used : InputStream(java.io.InputStream) Flow(org.openlca.ilcd.flows.Flow) ProcessSampleTest(org.openlca.ilcd.io.ProcessSampleTest) Test(org.junit.Test)

Example 2 with Flow

use of org.openlca.ilcd.flows.Flow in project olca-modules by GreenDelta.

the class DataSets method putFlow.

private static void putFlow(SodaClient client) throws Exception {
    Flow flow = load(Flow.class, "flow.xml");
    FlowBag bag = new FlowBag(flow, "en");
    if (!client.contains(Flow.class, bag.getId()))
        client.put(flow);
}
Also used : FlowBag(org.openlca.ilcd.util.FlowBag) Flow(org.openlca.ilcd.flows.Flow)

Example 3 with Flow

use of org.openlca.ilcd.flows.Flow in project olca-modules by GreenDelta.

the class FlowUpdateTest method makeFlow.

private Flow makeFlow(String id) {
    Flow flow = new Flow();
    FlowInfo info = new FlowInfo();
    flow.flowInfo = info;
    DataSetInfo dataInfo = new DataSetInfo();
    dataInfo.uuid = id;
    info.dataSetInfo = dataInfo;
    FlowName name = new FlowName();
    dataInfo.name = name;
    LangString.set(name.baseName, "test flow - " + id, "en");
    AdminInfo adminInfo = new AdminInfo();
    Publication pub = new Publication();
    adminInfo.publication = pub;
    pub.version = "01.00.000";
    flow.adminInfo = adminInfo;
    Modelling mav = new Modelling();
    flow.modelling = mav;
    LCIMethod method = new LCIMethod();
    mav.lciMethod = method;
    method.flowType = FlowType.ELEMENTARY_FLOW;
    return flow;
}
Also used : FlowInfo(org.openlca.ilcd.flows.FlowInfo) LCIMethod(org.openlca.ilcd.flows.LCIMethod) FlowName(org.openlca.ilcd.flows.FlowName) AdminInfo(org.openlca.ilcd.flows.AdminInfo) Publication(org.openlca.ilcd.commons.Publication) Modelling(org.openlca.ilcd.flows.Modelling) DataSetInfo(org.openlca.ilcd.flows.DataSetInfo) Flow(org.openlca.ilcd.flows.Flow)

Example 4 with Flow

use of org.openlca.ilcd.flows.Flow in project olca-modules by GreenDelta.

the class FlowUpdateTest method testPutFlow.

@Test
public void testPutFlow() {
    Assume.assumeTrue(TestServer.isAvailable());
    String id = UUID.randomUUID().toString();
    Flow flow = makeFlow(id);
    client.put(flow);
    Assert.assertTrue(client.contains(Flow.class, id));
    flow.adminInfo.publication.version = "02.00.000";
    client.put(flow);
    flow = client.get(Flow.class, id);
    Assert.assertEquals("02.00.000", flow.adminInfo.publication.version);
}
Also used : LangString(org.openlca.ilcd.commons.LangString) Flow(org.openlca.ilcd.flows.Flow) Test(org.junit.Test)

Example 5 with Flow

use of org.openlca.ilcd.flows.Flow in project olca-modules by GreenDelta.

the class NetworkGetTest method testGetFlow.

@Test
public void testGetFlow() {
    Assume.assumeTrue(TestServer.isAvailable());
    String id = "0d7a3ad1-6556-11dd-ad8b-0800200c9a66";
    Flow flow = client.get(Flow.class, id);
    assertEquals(id, flow.flowInfo.dataSetInfo.uuid);
    testContains(Flow.class, id);
}
Also used : Flow(org.openlca.ilcd.flows.Flow) Test(org.junit.Test)

Aggregations

Flow (org.openlca.ilcd.flows.Flow)9 Test (org.junit.Test)4 FlowInfo (org.openlca.ilcd.flows.FlowInfo)3 InputStream (java.io.InputStream)2 Before (org.junit.Before)2 LangString (org.openlca.ilcd.commons.LangString)2 LCIMethod (org.openlca.ilcd.flows.LCIMethod)2 Modelling (org.openlca.ilcd.flows.Modelling)2 FlowBag (org.openlca.ilcd.util.FlowBag)2 Publication (org.openlca.ilcd.commons.Publication)1 Contact (org.openlca.ilcd.contacts.Contact)1 FlowProperty (org.openlca.ilcd.flowproperties.FlowProperty)1 AdminInfo (org.openlca.ilcd.flows.AdminInfo)1 DataSetInfo (org.openlca.ilcd.flows.DataSetInfo)1 FlowName (org.openlca.ilcd.flows.FlowName)1 QuantitativeReference (org.openlca.ilcd.flows.QuantitativeReference)1 ProcessSampleTest (org.openlca.ilcd.io.ProcessSampleTest)1 Source (org.openlca.ilcd.sources.Source)1 UnitGroup (org.openlca.ilcd.units.UnitGroup)1