use of org.openlca.core.model.descriptors.RootDescriptor in project olca-modules by GreenDelta.
the class FlowPropertyFactorUseSearchTest method testFindInImpactCategory.
@Test
public void testFindInImpactCategory() {
ImpactFactor iFactor = new ImpactFactor();
iFactor.flow = flow;
iFactor.flowPropertyFactor = factor;
ImpactCategory category = new ImpactCategory();
category.impactFactors.add(iFactor);
ImpactCategoryDao dao = new ImpactCategoryDao(database);
dao.insert(category);
List<RootDescriptor> results = search.findUses(factor);
dao.delete(category);
Assert.assertEquals(1, results.size());
Descriptor expected = Descriptor.of(category);
Assert.assertEquals(expected, results.get(0));
}
use of org.openlca.core.model.descriptors.RootDescriptor in project olca-modules by GreenDelta.
the class FlowPropertyFactorUseSearchTest method testFindInProcesses.
@Test
public void testFindInProcesses() {
Process process = createProcess();
List<RootDescriptor> results = search.findUses(factor);
new ProcessDao(database).delete(process);
Descriptor expected = Descriptor.of(process);
Assert.assertEquals(1, results.size());
Assert.assertEquals(expected, results.get(0));
}
use of org.openlca.core.model.descriptors.RootDescriptor in project olca-modules by GreenDelta.
the class RefEntityDaoTest method testGetDescriptorsForCategory.
private <T extends RootEntity, V extends RootDescriptor> void testGetDescriptorsForCategory(RootEntityDao<T, V> dao, T instance, Category category) {
List<V> descriptors = dao.getDescriptors(Optional.ofNullable(category));
Descriptor descriptor = ListUtils.findDescriptor(instance.id, descriptors);
Assert.assertNotNull(descriptor);
new CategoryDao(Tests.getDb()).delete(category);
}
use of org.openlca.core.model.descriptors.RootDescriptor in project olca-modules by GreenDelta.
the class RefEntityDaoTest method testFindForNullCategory.
private <T extends RootEntity, V extends RootDescriptor> void testFindForNullCategory(RootEntityDao<T, V> dao, T instance) {
List<V> descriptors = dao.getDescriptors(Optional.empty());
Descriptor descriptor = ListUtils.findDescriptor(instance.id, descriptors);
Assert.assertNotNull(descriptor);
}
use of org.openlca.core.model.descriptors.RootDescriptor in project olca-modules by GreenDelta.
the class ProcessGrouping method split.
private static List<RootDescriptor> split(List<String> processIds, List<RootDescriptor> processes) {
List<RootDescriptor> matches = new ArrayList<>();
for (String id : processIds) {
for (RootDescriptor p : processes) {
if (p.refId != null && p.refId.equals(id))
matches.add(p);
}
}
processes.removeAll(matches);
return matches;
}
Aggregations