use of org.hisp.dhis.common.DimensionalItemId in project dhis2-core by dhis2.
the class DataDimensionExtractorTest method testGetAtomicIdsForProgramDataElement.
@Test
void testGetAtomicIdsForProgramDataElement() {
// Given
final DimensionalItemId programDataElementItem = new DimensionalItemId(PROGRAM_DATA_ELEMENT, "id0", "id1");
final Set<DimensionalItemId> someItemIds = newHashSet(programDataElementItem);
// When
final SetMap<Class<? extends IdentifiableObject>, String> result = new DataDimensionExtractor(null).getAtomicIds(someItemIds);
// Then
assertThat(result.size(), is(equalTo(2)));
assertThat(result.get(Program.class), containsInAnyOrder(programDataElementItem.getId0()));
assertThat(result.get(DataElement.class), containsInAnyOrder(programDataElementItem.getId1()));
}
use of org.hisp.dhis.common.DimensionalItemId in project dhis2-core by dhis2.
the class DataDimensionExtractorTest method testGetAtomicIdsForReportingRate.
@Test
void testGetAtomicIdsForReportingRate() {
// Given
final DimensionalItemId reportingRateItem = new DimensionalItemId(REPORTING_RATE, "id0", "REPORTING_RATE");
final Set<DimensionalItemId> someItemIds = newHashSet(reportingRateItem);
// When
final SetMap<Class<? extends IdentifiableObject>, String> result = new DataDimensionExtractor(null).getAtomicIds(someItemIds);
// Then
assertThat(result.size(), is(equalTo(1)));
assertThat(result.get(DataSet.class), containsInAnyOrder(reportingRateItem.getId0()));
}
use of org.hisp.dhis.common.DimensionalItemId in project dhis2-core by dhis2.
the class CategoryOptionResolverTest method verifyExpressionIsNotResolvedWhenDimensionalItemIdHasNoItem.
@Test
void verifyExpressionIsNotResolvedWhenDimensionalItemIdHasNoItem() {
// arrange
dimensionalItemId = new DimensionalItemId(DimensionItemType.DATA_ELEMENT_OPERAND, uid1, CATEGORY_OPTION_PREFIX + uid2, uid3, createIndicatorExpression());
String expression = createIndicatorExpression();
when(expressionService.getExpressionDimensionalItemIds(expression, INDICATOR_EXPRESSION)).thenReturn(Sets.newHashSet(dimensionalItemId));
// act
String resolvedExpression = resolver.resolve(expression);
// assert
assertResolvedExpressionEquals(resolvedExpression, coc1.getUid(), coc2.getUid(), coc3.getUid());
}
use of org.hisp.dhis.common.DimensionalItemId in project dhis2-core by dhis2.
the class CategoryOptionResolverTest method verifyExpressionIsNotResolvedWhenCoPrefixNotInUid1.
@Test
void verifyExpressionIsNotResolvedWhenCoPrefixNotInUid1() {
// arrange
dimensionalItemId = new DimensionalItemId(DimensionItemType.DATA_ELEMENT_OPERAND, uid1, uid2, uid3, createIndicatorExpression());
String expression = createIndicatorExpression();
when(expressionService.getExpressionDimensionalItemIds(expression, INDICATOR_EXPRESSION)).thenReturn(Sets.newHashSet(dimensionalItemId));
// act
String resolvedExpression = resolver.resolve(expression);
// assert
assertEquals(expression, resolvedExpression);
}
use of org.hisp.dhis.common.DimensionalItemId in project dhis2-core by dhis2.
the class DataElementGroupResolverTest method verifyExpressionIsResolvedProperly.
@Test
void verifyExpressionIsResolvedProperly() {
// arrange
dimensionalItemId = new DimensionalItemId(DimensionItemType.DATA_ELEMENT_OPERAND, DATA_ELEMENT_GROUP_PREFIX + uid1, uid2, uid3, createIndicatorExpression());
String expression = createIndicatorExpression();
when(expressionService.getExpressionDimensionalItemIds(expression, INDICATOR_EXPRESSION)).thenReturn(Sets.newHashSet(dimensionalItemId));
// act
String resolvedExpression = resolver.resolve(expression);
// assert
assertResolvedExpressionEquals(resolvedExpression, de1.getUid(), de2.getUid(), de3.getUid());
}
Aggregations