Search in sources :

Example 1 with SourceInfo

use of org.openlca.ilcd.sources.SourceInfo 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 2 with SourceInfo

use of org.openlca.ilcd.sources.SourceInfo 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 3 with SourceInfo

use of org.openlca.ilcd.sources.SourceInfo 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)

Example 4 with SourceInfo

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

the class SampleSource method create.

public static Source create() {
    Source source = new Source();
    SourceInfo info = new SourceInfo();
    source.sourceInfo = info;
    info.dataSetInfo = makeDataInfo();
    source.adminInfo = makeAdminInfo();
    return source;
}
Also used : SourceInfo(org.openlca.ilcd.sources.SourceInfo) Source(org.openlca.ilcd.sources.Source)

Example 5 with SourceInfo

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

the class SourceExport method run.

public Source run(org.openlca.core.model.Source source) {
    if (config.store.contains(Source.class, source.refId))
        return config.store.get(Source.class, source.refId);
    this.source = source;
    log.trace("Run source export with {}", source);
    Source iSource = new Source();
    iSource.version = "1.1";
    iSource.adminInfo = makeAdminInfo();
    SourceInfo info = new SourceInfo();
    iSource.sourceInfo = info;
    DataSetInfo dataSetInfo = makeDateSetInfo();
    info.dataSetInfo = dataSetInfo;
    File extFile = getExternalFile();
    if (extFile == null)
        config.store.put(iSource);
    else {
        addFileRef(dataSetInfo, extFile);
        config.store.put(iSource, new File[] { extFile });
    }
    return iSource;
}
Also used : SourceInfo(org.openlca.ilcd.sources.SourceInfo) DataSetInfo(org.openlca.ilcd.sources.DataSetInfo) File(java.io.File) Source(org.openlca.ilcd.sources.Source)

Aggregations

Source (org.openlca.ilcd.sources.Source)5 SourceInfo (org.openlca.ilcd.sources.SourceInfo)5 Test (org.junit.Test)3 DataSetInfo (org.openlca.ilcd.sources.DataSetInfo)3 SampleSource (org.openlca.ilcd.SampleSource)2 File (java.io.File)1 LangString (org.openlca.ilcd.commons.LangString)1