use of org.mifos.platform.questionnaire.service.dtos.EventSourceDto in project head by mifos.
the class QuestionnaireServiceIntegrationTest method shouldRetrieveAllEventSources.
@Test
@Transactional(rollbackFor = DataAccessException.class)
public void shouldRetrieveAllEventSources() {
List<EventSourceDto> eventSourceDtos = questionnaireService.getAllEventSources();
assertNotNull(eventSourceDtos);
assertThat(eventSourceDtos, new EventSourcesMatcher(asList(new EventSourceDto("Create", "Client", "Create Client"), new EventSourceDto("View", "Client", "View Client"), new EventSourceDto("Create", "Group", "Create Group"), new EventSourceDto("Approve", "Loan", "Approve Loan"), new EventSourceDto("Close", "Client", "Close Client"), new EventSourceDto("Create", "Loan", "Create Loan"), new EventSourceDto("View", "Loan", "View Loan"), new EventSourceDto("View", "Group", "View Group"), new EventSourceDto("Create", "Center", "Create Center"), new EventSourceDto("View", "Center", "View Center"), new EventSourceDto("Disburse", "Loan", "Disburse Loan"), new EventSourceDto("Create", "Savings", "Create Savings"), new EventSourceDto("View", "Savings", "View Savings"), new EventSourceDto("Create", "Office", "Create Office"), new EventSourceDto("Create", "Personnel", "Create Personnel"), new EventSourceDto("Close", "Loan", "Close Loan"), new EventSourceDto("Close", "Savings", "Close Savings"))));
}
use of org.mifos.platform.questionnaire.service.dtos.EventSourceDto in project head by mifos.
the class QuestionnaireServiceIntegrationTest method shouldNotGetInQuestionGroupsWithAllInactiveQuestions.
@Test
@Transactional(rollbackFor = DataAccessException.class)
public void shouldNotGetInQuestionGroupsWithAllInactiveQuestions() throws SystemException {
String title = "QG1" + currentTimeMillis();
List<SectionDetail> sectionDetails = asList(getSectionWithAllInactiveQuestions("S1"), getSectionWithAllInactiveQuestions("S2"));
defineQuestionGroup(title, "Create", "Client", sectionDetails, true);
List<QuestionGroupDetail> questionGroups = questionnaireService.getQuestionGroups(new EventSourceDto("Create", "Client", "Create.Client"));
assertThat(questionGroups, is(notNullValue()));
assertThat(questionGroups.size(), is(0));
}
use of org.mifos.platform.questionnaire.service.dtos.EventSourceDto in project head by mifos.
the class QuestionnaireServiceIntegrationTest method shouldNotGetInActiveQuestionGroupsByEventAndSource.
@Test
@Transactional(rollbackFor = DataAccessException.class)
public void shouldNotGetInActiveQuestionGroupsByEventAndSource() throws SystemException {
String title = "QG1" + currentTimeMillis();
List<SectionDetail> details = asList(getSection("S1"), getSection("S2"));
QuestionGroupDetail expectedQGDetail = defineQuestionGroup(title, "Create", "Client", details, true);
setState(expectedQGDetail.getId(), QuestionGroupState.INACTIVE);
List<QuestionGroupDetail> questionGroups = questionnaireService.getQuestionGroups(new EventSourceDto("Create", "Client", "Create.Client"));
assertThat(questionGroups, is(notNullValue()));
QuestionGroupDetail actualQGDetail = getMatchingQGDetailById(expectedQGDetail.getId(), questionGroups);
assertThat(actualQGDetail, is(Matchers.nullValue()));
}
use of org.mifos.platform.questionnaire.service.dtos.EventSourceDto in project head by mifos.
the class QuestionnaireValidatorImpl method validateForDefineQuestionGroup.
@Override
public void validateForDefineQuestionGroup(QuestionGroupDetail questionGroupDetail) throws SystemException {
validateQuestionGroupTitle(questionGroupDetail);
validateQuestionGroupSections(questionGroupDetail.getSectionDetails());
List<EventSourceDto> eventSourceDtos = questionGroupDetail.getEventSources();
if (eventSourceDtos == null || eventSourceDtos.size() == 0) {
throw new SystemException(INVALID_EVENT_SOURCE);
} else {
for (EventSourceDto eventSourceDto : eventSourceDtos) {
validateForEventSource(eventSourceDto);
}
}
}
Aggregations