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);
}
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());
}
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));
}
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;
}
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;
}
Aggregations