use of org.hisp.dhis.outboundmessage.OutboundMessage in project dhis2-core by dhis2.
the class BulkSmsGateway method buildCsvUrl.
private String buildCsvUrl(List<OutboundMessage> smsBatch) {
String csvData = "msisdn,message\n";
for (OutboundMessage sms : smsBatch) {
csvData += getRecipients(sms.getRecipients());
csvData += "," + sms.getText() + "\n";
}
return csvData;
}
use of org.hisp.dhis.outboundmessage.OutboundMessage in project dhis2-core by dhis2.
the class SmsMessageSenderTest method setUp.
// -------------------------------------------------------------------------
// Supportive methods
// -------------------------------------------------------------------------
private void setUp() {
okStatus = new OutboundMessageResponse();
okStatus.setResponseObject(GatewayResponse.RESULT_CODE_0);
failedStatus = new OutboundMessageResponse();
failedStatus.setResponseObject(GatewayResponse.FAILED);
smsGatewayConfig = new BulkSmsGatewayConfig();
smsGatewayConfig.setUrlTemplate("");
smsGatewayConfig.setName(gateway);
smsGatewayConfig.setUsername(" ");
smsGatewayConfig.setPassword("");
smsGatewayConfig.setUrlTemplate("");
smsGatewayConfig.setDefault(true);
OutboundMessage outboundMessageA = new OutboundMessage(subject, text, recipientsNormalized);
OutboundMessage outboundMessageB = new OutboundMessage(subject, text, recipientsNonNormalized);
OutboundMessage outboundMessageC = new OutboundMessage(subject, text, recipientsNormalized);
OutboundMessage outboundMessageD = new OutboundMessage(subject, text, recipientsNonNormalized);
outboundMessages = Arrays.asList(outboundMessageA, outboundMessageB, outboundMessageC, outboundMessageD);
User userA = new User();
userA.setPhoneNumber("47401111111");
User userB = new User();
userB.setPhoneNumber("47402222222");
User userC = new User();
userC.setPhoneNumber("47403333333");
User userD = new User();
userD.setPhoneNumber("47404444444");
users = Sets.newHashSet(userA, userB, userC, userD);
sender = new User();
sender.setPhoneNumber("4740555555");
}
use of org.hisp.dhis.outboundmessage.OutboundMessage in project dhis2-core by dhis2.
the class SmsMessageSenderTest method createOutBoundMessagesWithOutMaxRecipients.
private void createOutBoundMessagesWithOutMaxRecipients() {
OutboundMessage outboundMessageA = new OutboundMessage(subject, text, recipientsNormalized);
OutboundMessage outboundMessageB = new OutboundMessage(subject, text, recipientsNonNormalized);
OutboundMessage outboundMessageC = new OutboundMessage(subject, text, recipientsNormalized);
OutboundMessage outboundMessageD = new OutboundMessage(subject, text, recipientsNonNormalized);
outboundMessages = Arrays.asList(outboundMessageA, outboundMessageB, outboundMessageC, outboundMessageD);
}
use of org.hisp.dhis.outboundmessage.OutboundMessage in project dhis2-core by dhis2.
the class SmsMessageSenderTest method createOutBoundMessagesWithMaxRecipients.
private void createOutBoundMessagesWithMaxRecipients() {
generateRecipients(500);
OutboundMessage outboundMessageA = new OutboundMessage(subject, text, generatedRecipients);
OutboundMessage outboundMessageB = new OutboundMessage(subject, text, recipientsNonNormalized);
OutboundMessage outboundMessageC = new OutboundMessage(subject, text, recipientsNormalized);
OutboundMessage outboundMessageD = new OutboundMessage(subject, text, recipientsNonNormalized);
outboundMessages = Arrays.asList(outboundMessageA, outboundMessageB, outboundMessageC, outboundMessageD);
}
use of org.hisp.dhis.outboundmessage.OutboundMessage in project dhis2-core by dhis2.
the class SMPPClient method sendBatch.
public List<OutboundMessageResponse> sendBatch(OutboundMessageBatch batch, SMPPGatewayConfig config) {
SMPPSession session = start(config);
if (session == null) {
return Collections.emptyList();
}
List<OutboundMessageResponse> responses = new ArrayList<>();
for (OutboundMessage message : batch.getMessages()) {
OutboundMessageResponse response = send(session, message.getText(), message.getRecipients(), config);
responses.add(response);
}
stop(session);
return responses;
}
Aggregations