RestComm / smscgateway

RestComm SMS Gateway (SMSC) to send/receive SMS from/to Operators Network (GSM)
http://www.restcomm.com/
GNU Affero General Public License v3.0
127 stars 111 forks source link

[#289] Flag to tag timeouts as permanent failure #290

Open yevgenys opened 6 years ago

yevgenys commented 6 years ago

refactored SMSCShellExecutor:removed duplicates for CLI get command; added new option to CLI get command; added tests for CLI get command; added new flag 'markTimeoutAsPermanentFailure' to SmscPropertiesManagement; added functionality for new flag; Fixes #289

reduced code in ShellExecutor; added discovery of new getters via reflection: no need to add manual call of getter method, getter will be discovered automatically

    private void initSmscPropertiesManagementGetters() {
        smscPropertiesManagementGetters = new HashMap<>();
        Class c = smscPropertiesManagement.getClass();
        for (Method method : c.getMethods()) {
            String methodName = method.getName();
            if (methodName.startsWith("get")) {
                smscPropertiesManagementGetters.put(methodName.substring(3).toLowerCase(), method);
            } else if (methodName.startsWith("is")) {
                smscPropertiesManagementGetters.put(methodName.substring(2).toLowerCase(), method);
            }
        }
    }

then just call function addProperty(sb, "${getterNameWithout_get|is}");