Search in sources :

Example 6 with GenericHttpGatewayConfig

use of org.hisp.dhis.sms.config.GenericHttpGatewayConfig in project dhis2-core by dhis2.

the class BulkSmsGatewayTest method testAccept.

@Test
void testAccept() {
    boolean result = bulkSmsGateway.accept(smsGatewayConfig);
    assertTrue(result);
    smsGatewayConfig = new GenericHttpGatewayConfig();
    result = bulkSmsGateway.accept(smsGatewayConfig);
    assertFalse(result);
}
Also used : GenericHttpGatewayConfig(org.hisp.dhis.sms.config.GenericHttpGatewayConfig) Test(org.junit.jupiter.api.Test) DhisConvenienceTest(org.hisp.dhis.DhisConvenienceTest)

Example 7 with GenericHttpGatewayConfig

use of org.hisp.dhis.sms.config.GenericHttpGatewayConfig in project dhis2-core by dhis2.

the class V2_34_6__Convert_systemsetting_value_column_from_bytea_to_string method updateSmsConfiguration.

private void updateSmsConfiguration(SmsConfiguration smsConfiguration) {
    if (smsConfiguration == null) {
        return;
    }
    List<SmsGatewayConfig> existingGatewayConfigs = smsConfiguration.getGateways();
    List<SmsGatewayConfig> updatedGatewayConfigs = new ArrayList<>();
    for (SmsGatewayConfig gatewayConfig : existingGatewayConfigs) {
        if (gatewayConfig instanceof GenericHttpGetGatewayConfig) {
            GenericHttpGatewayConfig newGatewayConfig = convertToNewSmsGenericConfig((GenericHttpGetGatewayConfig) gatewayConfig);
            updatedGatewayConfigs.add(newGatewayConfig);
        } else {
            updatedGatewayConfigs.add(gatewayConfig);
        }
    }
    smsConfiguration.setGateways(updatedGatewayConfigs);
}
Also used : ArrayList(java.util.ArrayList) SmsGatewayConfig(org.hisp.dhis.sms.config.SmsGatewayConfig) GenericHttpGatewayConfig(org.hisp.dhis.sms.config.GenericHttpGatewayConfig) GenericHttpGetGatewayConfig(org.hisp.dhis.sms.config.GenericHttpGetGatewayConfig)

Aggregations

GenericHttpGatewayConfig (org.hisp.dhis.sms.config.GenericHttpGatewayConfig)7 SmsConfiguration (org.hisp.dhis.sms.config.SmsConfiguration)3 SmsGatewayConfig (org.hisp.dhis.sms.config.SmsGatewayConfig)3 ArrayList (java.util.ArrayList)1 DhisConvenienceTest (org.hisp.dhis.DhisConvenienceTest)1 BulkSmsGatewayConfig (org.hisp.dhis.sms.config.BulkSmsGatewayConfig)1 ClickatellGatewayConfig (org.hisp.dhis.sms.config.ClickatellGatewayConfig)1 GenericGatewayParameter (org.hisp.dhis.sms.config.GenericGatewayParameter)1 GenericHttpGetGatewayConfig (org.hisp.dhis.sms.config.GenericHttpGetGatewayConfig)1 SimplisticHttpGetGateWay (org.hisp.dhis.sms.config.SimplisticHttpGetGateWay)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1 Test (org.junit.jupiter.api.Test)1 GetMapping (org.springframework.web.bind.annotation.GetMapping)1 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)1