use of org.hisp.dhis.sms.command.SMSCommand in project dhis2-core by dhis2.
the class SMSCommandServiceTest method testGetKeyValueParameters.
@Test
void testGetKeyValueParameters() {
smsCommandService.save(keyValueCommandA);
SMSCommand created = smsCommandService.getSMSCommand(keyValueCommandName);
assertNotNull(created);
assertEquals(keyValueCommandName, created.getName());
assertEquals(dataSetA, created.getDataset());
Set<DataElement> dataElements = created.getCodes().stream().map(c -> c.getDataElement()).collect(Collectors.toSet());
assertTrue(dataElements.contains(dataElementA));
assertFalse(dataElements.contains(dataElementC));
}
use of org.hisp.dhis.sms.command.SMSCommand in project dhis2-core by dhis2.
the class SMSCommandServiceTest method testDeleteSmsCodes.
@Test
void testDeleteSmsCodes() {
smsCommandService.save(keyValueCommandA);
SMSCommand commandA = smsCommandService.getSMSCommand(keyValueCommandName);
assertEquals(2, commandA.getCodes().size());
smsCommandService.deleteCodeSet(Sets.newHashSet(smsCodeA1), commandA.getId());
SMSCommand updatedCommand = smsCommandService.getSMSCommand(keyValueCommandName);
assertEquals(1, updatedCommand.getCodes().size());
assertEquals(smsCodeA2, updatedCommand.getCodes().iterator().next());
}
use of org.hisp.dhis.sms.command.SMSCommand in project dhis2-core by dhis2.
the class SMSCommandServiceTest method testDeleteSpecialCharacters.
@Test
void testDeleteSpecialCharacters() {
smsCommandService.save(keyValueCommandA);
SMSCommand createdCommand = smsCommandService.getSMSCommand(keyValueCommandName);
assertEquals(1, createdCommand.getSpecialCharacters().size());
smsCommandService.deleteSpecialCharacterSet(Sets.newHashSet(characterA), createdCommand.getId());
SMSCommand updatedCommand = smsCommandService.getSMSCommand(keyValueCommandName);
assertEquals(0, updatedCommand.getSpecialCharacters().size());
}
use of org.hisp.dhis.sms.command.SMSCommand in project dhis2-core by dhis2.
the class SMSCommandServiceTest method testSaveTeiRegistrationParser.
@Test
void testSaveTeiRegistrationParser() {
smsCommandService.save(teiRegistrationCommand);
SMSCommand teiCommand = smsCommandService.getSMSCommand(teiCommandName);
assertEquals(teiCommandName, teiCommand.getName());
assertEquals(ParserType.TRACKED_ENTITY_REGISTRATION_PARSER, teiCommand.getParserType());
assertEquals(programA, teiCommand.getProgram());
testDefaults(teiCommand, defaultMessagesC);
Set<TrackedEntityAttribute> teiAttributes = teiCommand.getCodes().stream().map(c -> c.getTrackedEntityAttribute()).collect(Collectors.toSet());
assertTrue(teiAttributes.contains(trackedEntityAttributeA));
assertTrue(teiAttributes.contains(trackedEntityAttributeB));
}
use of org.hisp.dhis.sms.command.SMSCommand in project dhis2-core by dhis2.
the class SMSCommandServiceTest method testAddSpecialCharacters.
@Test
void testAddSpecialCharacters() {
smsCommandService.save(keyValueCommandA);
SMSCommand createdCommand = smsCommandService.getSMSCommand(keyValueCommandName);
assertEquals(1, createdCommand.getSpecialCharacters().size());
smsCommandService.addSpecialCharacterSet(Sets.newHashSet(characterB), createdCommand.getId());
SMSCommand updatedCommand = smsCommandService.getSMSCommand(keyValueCommandName);
assertEquals(2, updatedCommand.getSpecialCharacters().size());
}
Aggregations