use of org.hisp.dhis.sms.command.SMSCommand in project dhis2-core by dhis2.
the class SMSCommandServiceTest method createTeiCommand.
private void createTeiCommand() {
trackedEntityAttributeA = createTrackedEntityAttribute('A');
trackedEntityAttributeB = createTrackedEntityAttribute('B');
trackedEntityAttributeService.addTrackedEntityAttribute(trackedEntityAttributeA);
trackedEntityAttributeService.addTrackedEntityAttribute(trackedEntityAttributeB);
programA = createProgram('A');
programService.addProgram(programA);
smsCodeTeiA = new SMSCode();
smsCodeTeiA.setCode("a");
smsCodeTeiA.setTrackedEntityAttribute(trackedEntityAttributeA);
smsCodeTeiB = new SMSCode();
smsCodeTeiB.setCode("b");
smsCodeTeiB.setTrackedEntityAttribute(trackedEntityAttributeB);
teiRegistrationCommand = new SMSCommand();
teiRegistrationCommand.setName(teiCommandName);
teiRegistrationCommand.setProgram(programA);
teiRegistrationCommand.setParserType(ParserType.TRACKED_ENTITY_REGISTRATION_PARSER);
teiRegistrationCommand.setCodes(Sets.newHashSet(smsCodeTeiA, smsCodeTeiB));
teiRegistrationCommand.setSuccessMessage(success);
teiRegistrationCommand.setNoUserMessage(noUserMessage);
defaultMessagesC.put(SUCCESS_MESSAGE, success);
defaultMessagesC.put(NO_USER_MESSAGE, noUserMessage);
}
use of org.hisp.dhis.sms.command.SMSCommand in project dhis2-core by dhis2.
the class SMSCommandServiceTest method testSaveKeyValueParser.
// -------------------------------------------------------------------------
// SAVE
// -------------------------------------------------------------------------
@Test
void testSaveKeyValueParser() {
smsCommandService.save(keyValueCommandA);
SMSCommand keyValueCmd = smsCommandService.getSMSCommand(keyValueCommandName);
assertEquals(keyValueCommandName, keyValueCmd.getName());
assertTrue(keyValueCmd.getCodes().contains(smsCodeA1));
assertTrue(keyValueCmd.getCodes().contains(smsCodeA2));
assertTrue(CompletenessMethod.AT_LEAST_ONE_DATAVALUE.equals(keyValueCmd.getCompletenessMethod()));
}
use of org.hisp.dhis.sms.command.SMSCommand in project dhis2-core by dhis2.
the class SMSCommandServiceTest method testSaveAlertParser.
@Test
void testSaveAlertParser() {
smsCommandService.save(alertParserCommand);
SMSCommand alertCommand = smsCommandService.getSMSCommand(alertMessageCommandName);
assertEquals(alertMessageCommandName, alertCommand.getName());
assertEquals(0, alertCommand.getCodes().size());
assertTrue(CompletenessMethod.AT_LEAST_ONE_DATAVALUE.equals(alertCommand.getCompletenessMethod()));
assertEquals(success, alertCommand.getSuccessMessage());
testDefaults(alertCommand, defaultMessagesB);
}
use of org.hisp.dhis.sms.command.SMSCommand in project dhis2-core by dhis2.
the class SMSCommandServiceTest method testSaveUnregistrationParser.
@Test
void testSaveUnregistrationParser() {
smsCommandService.save(unregisteredParserCommand);
SMSCommand unregCommand = smsCommandService.getSMSCommand(unregistrationCommandName);
assertNotNull(unregCommand);
assertEquals(unregistrationCommandName, unregCommand.getName());
assertEquals(userGroupA, unregCommand.getUserGroup());
testDefaults(unregCommand, defaultMessagesD);
Set<User> users = unregCommand.getUserGroup().getMembers();
assertTrue(users.contains(userA));
assertTrue(users.contains(userB));
}
use of org.hisp.dhis.sms.command.SMSCommand in project dhis2-core by dhis2.
the class SMSCommandServiceTest method createUnregisteredParserCommand.
private void createUnregisteredParserCommand() {
userA = createUser('A');
userB = createUser('B');
userService.addUser(userA);
userService.addUser(userB);
userGroupA = createUserGroup('G', Sets.newHashSet(userA, userB));
userGroupService.addUserGroup(userGroupA);
unregisteredParserCommand = new SMSCommand();
unregisteredParserCommand.setName(unregistrationCommandName);
unregisteredParserCommand.setParserType(ParserType.UNREGISTERED_PARSER);
unregisteredParserCommand.setUserGroup(userGroupA);
}
Aggregations