Search in sources :

Example 1 with Source

use of org.openlca.ilcd.sources.Source in project olca-modules by GreenDelta.

the class SourceWithFileTest method makeSource.

private Source makeSource(String id) {
    Source source = SampleSource.create();
    source.sourceInfo.dataSetInfo.uuid = id;
    return source;
}
Also used : Source(org.openlca.ilcd.sources.Source) SampleSource(org.openlca.ilcd.SampleSource)

Example 2 with Source

use of org.openlca.ilcd.sources.Source in project olca-modules by GreenDelta.

the class SourceWithFileTest method testSimpleSourceUpload.

@Test
public void testSimpleSourceUpload() {
    Assume.assumeTrue(TestServer.isAvailable());
    String id = UUID.randomUUID().toString();
    Source source = makeSource(id);
    client.put(source);
    Source fromServer = client.get(Source.class, id);
    assertEquals(id, fromServer.sourceInfo.dataSetInfo.uuid);
}
Also used : Source(org.openlca.ilcd.sources.Source) SampleSource(org.openlca.ilcd.SampleSource) Test(org.junit.Test)

Example 3 with Source

use of org.openlca.ilcd.sources.Source in project olca-modules by GreenDelta.

the class ILCDImportExportTest method testB_Source.

@Test
public void testB_Source() {
    var id = "2c699413-f88b-4cb5-a56d-98cb4068472f";
    var dataSet = importConf.store().get(Source.class, id);
    var source = new SourceImport(importConf).run(dataSet);
    assertEquals(id, source.refId);
    new SourceExport(exportConf).run(source);
    assertTrue(exportConf.store.contains(Source.class, id));
}
Also used : SourceImport(org.openlca.io.ilcd.input.SourceImport) SourceExport(org.openlca.io.ilcd.output.SourceExport) Source(org.openlca.ilcd.sources.Source) Test(org.junit.Test)

Example 4 with Source

use of org.openlca.ilcd.sources.Source in project olca-modules by GreenDelta.

the class DataSets method putSource.

private static void putSource(SodaClient client) throws Exception {
    Source source = load(Source.class, "source.xml");
    SourceBag bag = new SourceBag(source, "en");
    if (!client.contains(Source.class, bag.getId()))
        client.put(source);
}
Also used : SourceBag(org.openlca.ilcd.util.SourceBag) Source(org.openlca.ilcd.sources.Source)

Example 5 with Source

use of org.openlca.ilcd.sources.Source in project olca-modules by GreenDelta.

the class NetworkGetTest method testGetSource.

@Test
public void testGetSource() {
    Assume.assumeTrue(TestServer.isAvailable());
    String id = "2c699413-f88b-4cb5-a56d-98cb4068472f";
    Source source = client.get(Source.class, id);
    assertEquals(id, source.sourceInfo.dataSetInfo.uuid);
    testContains(Source.class, id);
}
Also used : Source(org.openlca.ilcd.sources.Source) Test(org.junit.Test)

Aggregations

Source (org.openlca.ilcd.sources.Source)13 Test (org.junit.Test)7 SampleSource (org.openlca.ilcd.SampleSource)5 SourceInfo (org.openlca.ilcd.sources.SourceInfo)5 DataSetInfo (org.openlca.ilcd.sources.DataSetInfo)3 File (java.io.File)2 Before (org.junit.Before)2 SourceBag (org.openlca.ilcd.util.SourceBag)2 InputStream (java.io.InputStream)1 Path (java.nio.file.Path)1 LangString (org.openlca.ilcd.commons.LangString)1 Contact (org.openlca.ilcd.contacts.Contact)1 FlowProperty (org.openlca.ilcd.flowproperties.FlowProperty)1 Flow (org.openlca.ilcd.flows.Flow)1 UnitGroup (org.openlca.ilcd.units.UnitGroup)1 SourceImport (org.openlca.io.ilcd.input.SourceImport)1 SourceExport (org.openlca.io.ilcd.output.SourceExport)1