use of org.hisp.dhis.common.DimensionalObject.OPTION_SEP in project dhis2-core by dhis2.
the class EnrollmentAnalyticsManagerTest method verifyGetEnrollmentsWithoutMissingValueAndNumericValuesInFilter.
@Test
void verifyGetEnrollmentsWithoutMissingValueAndNumericValuesInFilter() {
String subSelect = "(select \"fWIAEtYVEGk\" from analytics_event_" + programA.getUid() + " where analytics_event_" + programA.getUid() + ".pi = ax.pi and \"fWIAEtYVEGk\" is not null and ps = '" + programStage.getUid() + "' order by executiondate desc limit 1 )";
String numericValues = String.join(OPTION_SEP, "10", "11", "12");
String expected = subSelect + " in (" + String.join(",", numericValues.split(OPTION_SEP)) + ")";
testIt(IN, numericValues, Collections.singleton((capturedSql) -> assertThat(capturedSql, containsString(expected))));
}
use of org.hisp.dhis.common.DimensionalObject.OPTION_SEP in project dhis2-core by dhis2.
the class EnrollmentAnalyticsManagerTest method verifyGetEnrollmentsWithMissingValueAndNumericValuesInFilter.
@Test
void verifyGetEnrollmentsWithMissingValueAndNumericValuesInFilter() {
String subSelect = "(select \"fWIAEtYVEGk\" from analytics_event_" + programA.getUid() + " where analytics_event_" + programA.getUid() + ".pi = ax.pi and \"fWIAEtYVEGk\" is not null and ps = '" + programStage.getUid() + "' order by executiondate desc limit 1 )";
String numericValues = String.join(OPTION_SEP, "10", "11", "12");
String expected = "(" + subSelect + " in (" + String.join(",", numericValues.split(OPTION_SEP)) + ") or " + subSelect + " is null )";
testIt(IN, numericValues + OPTION_SEP + NV, Collections.singleton((capturedSql) -> assertThat(capturedSql, containsString(expected))));
}
use of org.hisp.dhis.common.DimensionalObject.OPTION_SEP in project dhis2-core by dhis2.
the class EventsAnalyticsManagerTest method verifyGetEventsWithoutMissingValueAndNumericValuesInFilter.
@Test
void verifyGetEventsWithoutMissingValueAndNumericValuesInFilter() {
String numericValues = String.join(OPTION_SEP, "10", "11", "12");
String expected = "ax.\"fWIAEtYVEGk\" in (" + String.join(",", numericValues.split(OPTION_SEP)) + ")";
testIt(IN, numericValues, Collections.singleton((capturedSql) -> assertThat(capturedSql, containsString(expected))));
}
use of org.hisp.dhis.common.DimensionalObject.OPTION_SEP in project dhis2-core by dhis2.
the class EventsAnalyticsManagerTest method verifyGetEventsWithMissingValueAndNumericValuesInFilter.
@Test
void verifyGetEventsWithMissingValueAndNumericValuesInFilter() {
String numericValues = String.join(OPTION_SEP, "10", "11", "12");
String expected = "(ax.\"fWIAEtYVEGk\" in (" + String.join(",", numericValues.split(OPTION_SEP)) + ") or ax.\"fWIAEtYVEGk\" is null )";
testIt(IN, numericValues + OPTION_SEP + NV, Collections.singleton((capturedSql) -> assertThat(capturedSql, containsString(expected))));
}
Aggregations