Skip to content
Snippets Groups Projects
Commit 4fb9e59e authored by OZGCloud's avatar OZGCloud
Browse files

OZG-4994 OZG-5061 build query

parent 34d445f0
No related branches found
No related tags found
No related merge requests found
......@@ -25,9 +25,11 @@ class StatisticRemoteService {
static final String COUNT_VORGANG_STATUS_RESULT_NAME_FORMAT = "countVorgangStatus_%s";
static final String COUNT_WIEDERVORLAGE_NEXT_FRIST_RESULT_NAME = "countWiedervorlage";
static final String EXISTS_WIEDERVORLAGE_OVERDUE_RESULT_NAME = "existsWiedervorlageOverdue";
static final String COUNT_VORGAENGE_WITH_UNREAD_MESSAGES_RESULT_NAME = "countVorgaengeWithUnreadMessages";
static final String STATUS_PATH = "Vorgang.status";
static final String WIEDERVORLAGE_NEXT_FRIST_PATH_TEMPLATE = "ClientAttribute.%s.nextWiedervorlageFrist";
static final String VORGAENGE_WITH_UNREAD_MESSAGES_PATH = "ClientAttribute.OzgCloud_NachrichtenManager.hasNewPostfachNachricht";
static final String OPERAND_TODAY_DATE = "today()";
......@@ -93,4 +95,13 @@ class StatisticRemoteService {
.map(mapper::toResult)
.collect(Collectors.toMap(StatisticResult::getName, Function.identity()));
}
public GrpcVorgangStatisticQuery buildCountVorgaengeWithUnreadMessagesQuery() {
return GrpcVorgangStatisticQuery.newBuilder()
.setResultName(COUNT_VORGAENGE_WITH_UNREAD_MESSAGES_RESULT_NAME)
.setPath(VORGAENGE_WITH_UNREAD_MESSAGES_PATH)
.setGroupMethod(GroupMethod.COUNT)
.setOperator(Operator.UNEQUAL)
.build();
}
}
\ No newline at end of file
......@@ -270,4 +270,40 @@ class StatisticRemoteServiceTest {
.hasEntrySatisfying(RESULT_NAME, statisticResult -> assertThat(statisticResult.getIntValue()).isEqualTo(RESULT_INT));
}
}
@Nested
class TestBuildCountVorgaengeWithUnreadMessagesQuery {
@Test
void shouldHaveResultName() {
var query = callService();
assertThat(query.getResultName()).isEqualTo(COUNT_VORGAENGE_WITH_UNREAD_MESSAGES_RESULT_NAME);
}
@Test
void shouldHavePath() {
var query = callService();
assertThat(query.getPath()).isEqualTo(VORGAENGE_WITH_UNREAD_MESSAGES_PATH);
}
@Test
void shouldHaveGroupingMethod() {
var query = callService();
assertThat(query.getGroupMethod()).isEqualTo(GroupMethod.COUNT);
}
@Test
void shouldHaveOperator() {
var query = callService();
assertThat(query.getOperator()).isEqualTo(Operator.UNEQUAL);
}
private GrpcVorgangStatisticQuery callService() {
return service.buildCountVorgaengeWithUnreadMessagesQuery();
}
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment