use of org.hisp.dhis.sms.command.SMSCommand in project dhis2-core by dhis2.
the class SMSCommandServiceTest method testGetCommandByName.
@Test
void testGetCommandByName() {
smsCommandService.save(keyValueCommandA);
SMSCommand created = smsCommandService.getSMSCommand(keyValueCommandName);
assertNotNull(created);
assertEquals(keyValueCommandName, created.getName());
testDefaults(created, defaultMessagesA);
}
use of org.hisp.dhis.sms.command.SMSCommand in project dhis2-core by dhis2.
the class SMSCommandServiceTest method testSaveEventRegistrationParser.
@Test
void testSaveEventRegistrationParser() {
smsCommandService.save(eventRegistrationCommand);
SMSCommand eventRegistrationCommand = smsCommandService.getSMSCommand(eventRegistrationCommandName);
assertEquals(eventRegistrationCommandName, eventRegistrationCommand.getName());
assertEquals(programD, eventRegistrationCommand.getProgram());
assertEquals(programStageD, eventRegistrationCommand.getProgramStage());
testDefaults(eventRegistrationCommand, defaultMessagesE);
Set<DataElement> dataElements = eventRegistrationCommand.getCodes().stream().map(c -> c.getDataElement()).collect(Collectors.toSet());
assertTrue(dataElements.contains(dataElementD));
assertFalse(dataElements.contains(dataElementC));
}
use of org.hisp.dhis.sms.command.SMSCommand in project dhis2-core by dhis2.
the class SMSCommandServiceTest method testAddSmsCodes.
// -------------------------------------------------------------------------
// UPDATE
// -------------------------------------------------------------------------
@Test
void testAddSmsCodes() {
smsCommandService.save(keyValueCommandA);
SMSCommand createdCommand = smsCommandService.getSMSCommand(keyValueCommandName);
assertEquals(2, createdCommand.getCodes().size());
smsCommandService.addSmsCodes(Sets.newHashSet(smsCodeC), createdCommand.getId());
SMSCommand updatedCommand = smsCommandService.getSMSCommand(keyValueCommandName);
assertEquals(3, updatedCommand.getCodes().size());
}
use of org.hisp.dhis.sms.command.SMSCommand in project dhis2-core by dhis2.
the class SMSCommandServiceTest method testDelete.
// -------------------------------------------------------------------------
// DELETE
// -------------------------------------------------------------------------
@Test
void testDelete() {
smsCommandService.save(keyValueCommandA);
SMSCommand createdCommand = smsCommandService.getSMSCommand(keyValueCommandName);
assertNotNull(createdCommand);
assertEquals(keyValueCommandName, createdCommand.getName());
smsCommandService.delete(createdCommand);
SMSCommand deleteCommand = smsCommandService.getSMSCommand(keyValueCommandName);
assertNull(deleteCommand);
}
use of org.hisp.dhis.sms.command.SMSCommand in project dhis2-core by dhis2.
the class SMSCommandServiceTest method testGetSMSCommandByNameAndParser.
// -------------------------------------------------------------------------
// GET
// -------------------------------------------------------------------------
@Test
void testGetSMSCommandByNameAndParser() {
smsCommandService.save(keyValueCommandA);
SMSCommand keyValueCmd = smsCommandService.getSMSCommand(keyValueCommandName, ParserType.KEY_VALUE_PARSER);
assertNotNull(keyValueCmd);
SMSCommand noCommand = smsCommandService.getSMSCommand(keyValueCommandName, ParserType.ALERT_PARSER);
assertNull(noCommand);
}
Aggregations