Search in sources :

Example 1 with DataSetInfo

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

the class NetworkPutSourceTest method makeDataInfo.

private DataSetInfo makeDataInfo(String id) {
    DataSetInfo info = new DataSetInfo();
    String name = "xtest Source - " + new Random().nextInt(1000);
    LangString.set(info.name, name, "en");
    info.uuid = id;
    return info;
}
Also used : Random(java.util.Random) LangString(org.openlca.ilcd.commons.LangString) DataSetInfo(org.openlca.ilcd.sources.DataSetInfo)

Example 2 with DataSetInfo

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

the class SourceBag method getExternalFileURIs.

public List<String> getExternalFileURIs() {
    DataSetInfo info = getDataSetInformation();
    if (info == null)
        return Collections.emptyList();
    List<FileRef> refs = info.files;
    List<String> uris = new ArrayList<>();
    for (FileRef ref : refs) {
        if (ref.uri != null)
            uris.add(ref.uri);
    }
    return uris;
}
Also used : FileRef(org.openlca.ilcd.sources.FileRef) ArrayList(java.util.ArrayList) LangString(org.openlca.ilcd.commons.LangString) DataSetInfo(org.openlca.ilcd.sources.DataSetInfo)

Example 3 with DataSetInfo

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

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

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

the class SampleSource method makeDataInfo.

private static DataSetInfo makeDataInfo() {
    String id = UUID.randomUUID().toString();
    DataSetInfo info = new DataSetInfo();
    LangString.set(info.name, "test source", "en");
    info.uuid = id;
    return info;
}
Also used : LangString(org.openlca.ilcd.commons.LangString) DataSetInfo(org.openlca.ilcd.sources.DataSetInfo)

Aggregations

DataSetInfo (org.openlca.ilcd.sources.DataSetInfo)7 LangString (org.openlca.ilcd.commons.LangString)3 Source (org.openlca.ilcd.sources.Source)3 SourceInfo (org.openlca.ilcd.sources.SourceInfo)3 Test (org.junit.Test)2 SampleSource (org.openlca.ilcd.SampleSource)2 File (java.io.File)1 ArrayList (java.util.ArrayList)1 Random (java.util.Random)1 Classification (org.openlca.ilcd.commons.Classification)1 FileRef (org.openlca.ilcd.sources.FileRef)1