Search in sources :

Example 6 with Source

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

the class NetworkPutSourceTest method testPutSource.

@Test
public void testPutSource() throws Exception {
    Assume.assumeTrue(TestServer.isAvailable());
    String id = UUID.randomUUID().toString();
    Source source = new Source();
    SourceInfo info = new SourceInfo();
    source.sourceInfo = info;
    info.dataSetInfo = makeDataInfo(id);
    source.adminInfo = makeAdminInfo();
    client.put(source);
}
Also used : SourceInfo(org.openlca.ilcd.sources.SourceInfo) LangString(org.openlca.ilcd.commons.LangString) Source(org.openlca.ilcd.sources.Source) Test(org.junit.Test)

Example 7 with Source

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

the class SourceBagTest method setUp.

@Before
public void setUp() throws Exception {
    try (InputStream stream = this.getClass().getResourceAsStream("source.xml")) {
        XmlBinder binder = new XmlBinder();
        Source source = binder.fromStream(Source.class, stream);
        bag = new SourceBag(source, "en");
    }
}
Also used : InputStream(java.io.InputStream) SourceBag(org.openlca.ilcd.util.SourceBag) Source(org.openlca.ilcd.sources.Source) Before(org.junit.Before)

Example 8 with Source

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

the class XmlBinderTest method makeInstances.

@Before
public void makeInstances() {
    instances.add(makeProcess());
    instances.add(new Flow());
    instances.add(new FlowProperty());
    instances.add(new UnitGroup());
    instances.add(new Source());
    instances.add(new Contact());
}
Also used : UnitGroup(org.openlca.ilcd.units.UnitGroup) FlowProperty(org.openlca.ilcd.flowproperties.FlowProperty) Source(org.openlca.ilcd.sources.Source) Flow(org.openlca.ilcd.flows.Flow) Contact(org.openlca.ilcd.contacts.Contact) Before(org.junit.Before)

Example 9 with Source

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

the class ZipStoreTest method testWithSource.

@Test
public void testWithSource() throws Exception {
    DataSetInfo info = new DataSetInfo();
    info.uuid = UUID.randomUUID().toString();
    Source source = SampleSource.create();
    source.sourceInfo = new SourceInfo();
    source.sourceInfo.dataSetInfo = info;
    store.put(source);
    assertTrue(store.contains(Source.class, source.getUUID()));
    Source copy = store.get(Source.class, source.getUUID());
    assertEquals(source.sourceInfo.dataSetInfo.uuid, copy.sourceInfo.dataSetInfo.uuid);
    assertNotNull(store.iterator(Source.class).next());
}
Also used : SourceInfo(org.openlca.ilcd.sources.SourceInfo) DataSetInfo(org.openlca.ilcd.sources.DataSetInfo) Source(org.openlca.ilcd.sources.Source) SampleSource(org.openlca.ilcd.SampleSource) Test(org.junit.Test)

Example 10 with Source

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

the class FileStoreTest method testPut.

@Test
public void testPut() throws Exception {
    DataSetInfo dataSetInfo = new DataSetInfo();
    String id = UUID.randomUUID().toString();
    dataSetInfo.uuid = id;
    Source source = SampleSource.create();
    source.sourceInfo = new SourceInfo();
    source.sourceInfo.dataSetInfo = dataSetInfo;
    fileStore.put(source);
    assertTrue(fileStore.contains(Source.class, id));
}
Also used : SourceInfo(org.openlca.ilcd.sources.SourceInfo) DataSetInfo(org.openlca.ilcd.sources.DataSetInfo) Source(org.openlca.ilcd.sources.Source) SampleSource(org.openlca.ilcd.SampleSource) 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