| 1 | package fr.sii.ogham.sms.builder.ovh; | |
| 2 | ||
| 3 | import java.net.MalformedURLException; | |
| 4 | import java.net.URL; | |
| 5 | ||
| 6 | import org.slf4j.Logger; | |
| 7 | import org.slf4j.LoggerFactory; | |
| 8 | ||
| 9 | import fr.sii.ogham.core.builder.Builder; | |
| 10 | import fr.sii.ogham.core.builder.MessagingBuilder; | |
| 11 | import fr.sii.ogham.core.builder.configuration.ConfigurationValueBuilder; | |
| 12 | import fr.sii.ogham.core.builder.configuration.ConfigurationValueBuilderHelper; | |
| 13 | import fr.sii.ogham.core.builder.configurer.Configurer; | |
| 14 | import fr.sii.ogham.core.builder.context.BuildContext; | |
| 15 | import fr.sii.ogham.core.builder.context.DefaultBuildContext; | |
| 16 | import fr.sii.ogham.core.fluent.AbstractParent; | |
| 17 | import fr.sii.ogham.sms.builder.SmsBuilder; | |
| 18 | import fr.sii.ogham.sms.message.Sms; | |
| 19 | import fr.sii.ogham.sms.sender.impl.OvhSmsSender; | |
| 20 | import fr.sii.ogham.sms.sender.impl.ovh.DefaultSmsCodingDetector; | |
| 21 | import fr.sii.ogham.sms.sender.impl.ovh.OvhAuthParams; | |
| 22 | import fr.sii.ogham.sms.sender.impl.ovh.OvhOptions; | |
| 23 | import fr.sii.ogham.sms.sender.impl.ovh.SmsCoding; | |
| 24 | ||
| 25 | /** | |
| 26 | * Configures how to send {@link Sms} using OVH HTTP API. | |
| 27 | * | |
| 28 | * <p> | |
| 29 | * To send {@link Sms} using OVH, you need to register this builder into a | |
| 30 | * {@link MessagingBuilder} like this: | |
| 31 | * | |
| 32 | * <pre> | |
| 33 | * <code> | |
| 34 | * MessagingBuilder msgBuilder = ... | |
| 35 | * msgBuilder.sms() | |
| 36 | * .sender(OvhSmsBuilder.class) // registers the builder and accesses to that builder for configuring it | |
| 37 | * </code> | |
| 38 | * </pre> | |
| 39 | * | |
| 40 | * Once the builder is registered, sending sms through OVH requires URL, | |
| 41 | * account, login and password values. You can define it using: | |
| 42 | * | |
| 43 | * <pre> | |
| 44 | * <code> | |
| 45 | * msgBuilder.email() | |
| 46 | * .sender(OvhSmsBuilder.class) // registers the builder and accesses to that builder for configuring it | |
| 47 | * .url("https://www.ovh.com/cgi-bin/sms/http2sms.cgi") | |
| 48 | * </code> | |
| 49 | * </pre> | |
| 50 | * | |
| 51 | * Or you can also use property keys (using interpolation): | |
| 52 | * | |
| 53 | * <pre> | |
| 54 | * <code> | |
| 55 | * msgBuilder | |
| 56 | * .environment() | |
| 57 | * .properties() | |
| 58 | * .set("custom.property.for.url", "https://www.ovh.com/cgi-bin/sms/http2sms.cgi") | |
| 59 | * .and() | |
| 60 | * .and() | |
| 61 | * .email() | |
| 62 | * .sender(OvhSmsBuilder.class) // registers the builder and accesses to that builder for configuring it | |
| 63 | * .url() | |
| 64 | * .properties("${custom.property.for.url}") | |
| 65 | * </code> | |
| 66 | * </pre> | |
| 67 | * | |
| 68 | * | |
| 69 | * @author Aurélien Baudet | |
| 70 | * | |
| 71 | */ | |
| 72 | public class OvhSmsBuilder extends AbstractParent<SmsBuilder> implements Builder<OvhSmsSender> { | |
| 73 | private static final Logger LOG = LoggerFactory.getLogger(OvhSmsBuilder.class); | |
| 74 | ||
| 75 | private final BuildContext buildContext; | |
| 76 | private final ConfigurationValueBuilderHelper<OvhSmsBuilder, URL> urlValueBuilder; | |
| 77 | private final ConfigurationValueBuilderHelper<OvhSmsBuilder, String> accountValueBuilder; | |
| 78 | private final ConfigurationValueBuilderHelper<OvhSmsBuilder, String> loginValueBuilder; | |
| 79 | private final ConfigurationValueBuilderHelper<OvhSmsBuilder, String> passwordValueBuilder; | |
| 80 | private OvhOptionsBuilder ovhOptionsBuilder; | |
| 81 | ||
| 82 | /** | |
| 83 | * Default constructor when using OVH SMS sender without all Ogham work. | |
| 84 | * | |
| 85 | * <strong>WARNING: use is only if you know what you are doing !</strong> | |
| 86 | */ | |
| 87 | public OvhSmsBuilder() { | |
| 88 | this(null, new DefaultBuildContext()); | |
| 89 | } | |
| 90 | ||
| 91 | /** | |
| 92 | * Constructor that is called when using Ogham builder: | |
| 93 | * | |
| 94 | * <pre> | |
| 95 | * MessagingBuilder msgBuilder = ... | |
| 96 | * msgBuilder | |
| 97 | * .email() | |
| 98 | * .sender(OvhSmsBuilder.class) | |
| 99 | * </pre> | |
| 100 | * | |
| 101 | * @param parent | |
| 102 | * the parent builder instance for fluent chaining | |
| 103 | * @param buildContext | |
| 104 | * for registering instances and property evaluation | |
| 105 | */ | |
| 106 | public OvhSmsBuilder(SmsBuilder parent, BuildContext buildContext) { | |
| 107 | super(parent); | |
| 108 | this.buildContext = buildContext; | |
| 109 | urlValueBuilder = buildContext.newConfigurationValueBuilder(this, URL.class); | |
| 110 | accountValueBuilder = buildContext.newConfigurationValueBuilder(this, String.class); | |
| 111 | loginValueBuilder = buildContext.newConfigurationValueBuilder(this, String.class); | |
| 112 | passwordValueBuilder = buildContext.newConfigurationValueBuilder(this, String.class); | |
| 113 | } | |
| 114 | ||
| 115 | /** | |
| 116 | * Set the URL of the OVH SMS HTTP API. | |
| 117 | * | |
| 118 | * <p> | |
| 119 | * The value set using this method takes precedence over any property and | |
| 120 | * default value configured using {@link #url()}. | |
| 121 | * | |
| 122 | * <pre> | |
| 123 | * .url(new URL("http://localhost")) | |
| 124 | * .url() | |
| 125 | * .properties("${custom.property.high-priority}", "${custom.property.low-priority}") | |
| 126 | * .defaultValue(new URL("https://www.ovh.com/cgi-bin/sms/http2sms.cgi")) | |
| 127 | * </pre> | |
| 128 | * | |
| 129 | * <pre> | |
| 130 | * .url(new URL("http://localhost")) | |
| 131 | * .url() | |
| 132 | * .properties("${custom.property.high-priority}", "${custom.property.low-priority}") | |
| 133 | * .defaultValue(new URL("https://www.ovh.com/cgi-bin/sms/http2sms.cgi")) | |
| 134 | * </pre> | |
| 135 | * | |
| 136 | * In both cases, {@code url(new URL("http://localhost"))} is used. | |
| 137 | * | |
| 138 | * <p> | |
| 139 | * If this method is called several times, only the last value is used. | |
| 140 | * | |
| 141 | * <p> | |
| 142 | * If {@code null} value is set, it is like not setting a value at all. The | |
| 143 | * property/default value configuration is applied. | |
| 144 | * | |
| 145 | * @param url | |
| 146 | * the url for Ovh HTTP API | |
| 147 | * @return this instance for fluent chaining | |
| 148 | */ | |
| 149 | public OvhSmsBuilder url(URL url) { | |
| 150 |
2
1. url : removed call to fr/sii/ogham/core/builder/configuration/ConfigurationValueBuilderHelper::setValue → NO_COVERAGE 2. url : removed call to fr/sii/ogham/core/builder/configuration/ConfigurationValueBuilderHelper::setValue → KILLED |
urlValueBuilder.setValue(url); |
| 151 |
2
1. url : replaced return value with null for fr/sii/ogham/sms/builder/ovh/OvhSmsBuilder::url → NO_COVERAGE 2. url : replaced return value with null for fr/sii/ogham/sms/builder/ovh/OvhSmsBuilder::url → KILLED |
return this; |
| 152 | } | |
| 153 | ||
| 154 | /** | |
| 155 | * Set the URL of the OVH SMS HTTP API. | |
| 156 | * | |
| 157 | * <p> | |
| 158 | * The value set using this method takes precedence over any property and | |
| 159 | * default value configured using {@link #url()}. | |
| 160 | * | |
| 161 | * <pre> | |
| 162 | * .url("http://localhost") | |
| 163 | * .url() | |
| 164 | * .properties("${custom.property.high-priority}", "${custom.property.low-priority}") | |
| 165 | * .defaultValue("https://www.ovh.com/cgi-bin/sms/http2sms.cgi") | |
| 166 | * </pre> | |
| 167 | * | |
| 168 | * <pre> | |
| 169 | * .url("http://localhost") | |
| 170 | * .url() | |
| 171 | * .properties("${custom.property.high-priority}", "${custom.property.low-priority}") | |
| 172 | * .defaultValue("https://www.ovh.com/cgi-bin/sms/http2sms.cgi") | |
| 173 | * </pre> | |
| 174 | * | |
| 175 | * In both cases, {@code url("http://localhost")} is used. | |
| 176 | * | |
| 177 | * <p> | |
| 178 | * If this method is called several times, only the last value is used. | |
| 179 | * | |
| 180 | * <p> | |
| 181 | * If {@code null} value is set, it is like not setting a value at all. The | |
| 182 | * property/default value configuration is applied. | |
| 183 | * | |
| 184 | * @param url | |
| 185 | * the url for Ovh HTTP API | |
| 186 | * @return this instance for fluent chaining | |
| 187 | * @throws IllegalArgumentException | |
| 188 | * when URL is not valid | |
| 189 | */ | |
| 190 | public OvhSmsBuilder url(String url) { | |
| 191 | try { | |
| 192 |
2
1. url : replaced return value with null for fr/sii/ogham/sms/builder/ovh/OvhSmsBuilder::url → NO_COVERAGE 2. url : replaced return value with null for fr/sii/ogham/sms/builder/ovh/OvhSmsBuilder::url → KILLED |
return url(new URL(url)); |
| 193 | } catch (MalformedURLException e) { | |
| 194 | throw new IllegalArgumentException("Invalid URL " + url, e); | |
| 195 | } | |
| 196 | } | |
| 197 | ||
| 198 | /** | |
| 199 | * Set the URL of the OVH SMS HTTP API. | |
| 200 | * | |
| 201 | * <p> | |
| 202 | * This method is mainly used by {@link Configurer}s to register some | |
| 203 | * property keys and/or a default value. The aim is to let developer be able | |
| 204 | * to externalize its configuration (using system properties, configuration | |
| 205 | * file or anything else). If the developer doesn't configure any value for | |
| 206 | * the registered properties, the default value is used (if set). | |
| 207 | * | |
| 208 | * <pre> | |
| 209 | * .url() | |
| 210 | * .properties("${custom.property.high-priority}", "${custom.property.low-priority}") | |
| 211 | * .defaultValue(new URL("https://www.ovh.com/cgi-bin/sms/http2sms.cgi")) | |
| 212 | * </pre> | |
| 213 | * | |
| 214 | * <p> | |
| 215 | * Non-null value set using {@link #url(URL)} takes precedence over property | |
| 216 | * values and default value. | |
| 217 | * | |
| 218 | * <pre> | |
| 219 | * .url(new URL("http://localhost")) | |
| 220 | * .url() | |
| 221 | * .properties("${custom.property.high-priority}", "${custom.property.low-priority}") | |
| 222 | * .defaultValue(new URL("https://www.ovh.com/cgi-bin/sms/http2sms.cgi")) | |
| 223 | * </pre> | |
| 224 | * | |
| 225 | * The value {@code new URL("http://localhost")} is used regardless of the | |
| 226 | * value of the properties and default value. | |
| 227 | * | |
| 228 | * <p> | |
| 229 | * See {@link ConfigurationValueBuilder} for more information. | |
| 230 | * | |
| 231 | * | |
| 232 | * @return the builder to configure property keys/default value | |
| 233 | */ | |
| 234 | public ConfigurationValueBuilder<OvhSmsBuilder, URL> url() { | |
| 235 |
4
1. url : replaced return value with null for fr/sii/ogham/sms/builder/ovh/OvhSmsBuilder::url → NO_COVERAGE 2. url : replaced return value with null for fr/sii/ogham/sms/builder/ovh/OvhSmsBuilder::url → KILLED 3. url : replaced return value with null for fr/sii/ogham/sms/builder/ovh/OvhSmsBuilder::url → KILLED 4. url : replaced return value with null for fr/sii/ogham/sms/builder/ovh/OvhSmsBuilder::url → KILLED |
return urlValueBuilder; |
| 236 | } | |
| 237 | ||
| 238 | /** | |
| 239 | * Set the OVH account identifier. | |
| 240 | * | |
| 241 | * <p> | |
| 242 | * The value set using this method takes precedence over any property and | |
| 243 | * default value configured using {@link #account()}. | |
| 244 | * | |
| 245 | * <pre> | |
| 246 | * .account("my-account") | |
| 247 | * .account() | |
| 248 | * .properties("${custom.property.high-priority}", "${custom.property.low-priority}") | |
| 249 | * .defaultValue("default-account") | |
| 250 | * </pre> | |
| 251 | * | |
| 252 | * <pre> | |
| 253 | * .account("my-account") | |
| 254 | * .account() | |
| 255 | * .properties("${custom.property.high-priority}", "${custom.property.low-priority}") | |
| 256 | * .defaultValue("default-account") | |
| 257 | * </pre> | |
| 258 | * | |
| 259 | * In both cases, {@code account("my-account")} is used. | |
| 260 | * | |
| 261 | * <p> | |
| 262 | * If this method is called several times, only the last value is used. | |
| 263 | * | |
| 264 | * <p> | |
| 265 | * If {@code null} value is set, it is like not setting a value at all. The | |
| 266 | * property/default value configuration is applied. | |
| 267 | * | |
| 268 | * @param account | |
| 269 | * the account identifier | |
| 270 | * @return this instance for fluent chaining | |
| 271 | */ | |
| 272 | public OvhSmsBuilder account(String account) { | |
| 273 |
2
1. account : removed call to fr/sii/ogham/core/builder/configuration/ConfigurationValueBuilderHelper::setValue → NO_COVERAGE 2. account : removed call to fr/sii/ogham/core/builder/configuration/ConfigurationValueBuilderHelper::setValue → KILLED |
accountValueBuilder.setValue(account); |
| 274 |
2
1. account : replaced return value with null for fr/sii/ogham/sms/builder/ovh/OvhSmsBuilder::account → NO_COVERAGE 2. account : replaced return value with null for fr/sii/ogham/sms/builder/ovh/OvhSmsBuilder::account → KILLED |
return this; |
| 275 | } | |
| 276 | ||
| 277 | /** | |
| 278 | * Set the OVH account identifier. | |
| 279 | * | |
| 280 | * <p> | |
| 281 | * This method is mainly used by {@link Configurer}s to register some | |
| 282 | * property keys and/or a default value. The aim is to let developer be able | |
| 283 | * to externalize its configuration (using system properties, configuration | |
| 284 | * file or anything else). If the developer doesn't configure any value for | |
| 285 | * the registered properties, the default value is used (if set). | |
| 286 | * | |
| 287 | * <pre> | |
| 288 | * .account() | |
| 289 | * .properties("${custom.property.high-priority}", "${custom.property.low-priority}") | |
| 290 | * .defaultValue("default-account") | |
| 291 | * </pre> | |
| 292 | * | |
| 293 | * <p> | |
| 294 | * Non-null value set using {@link #account(String)} takes precedence over | |
| 295 | * property values and default value. | |
| 296 | * | |
| 297 | * <pre> | |
| 298 | * .account("my-account") | |
| 299 | * .account() | |
| 300 | * .properties("${custom.property.high-priority}", "${custom.property.low-priority}") | |
| 301 | * .defaultValue("default-account") | |
| 302 | * </pre> | |
| 303 | * | |
| 304 | * The value {@code "my-account"} is used regardless of the value of the | |
| 305 | * properties and default value. | |
| 306 | * | |
| 307 | * <p> | |
| 308 | * See {@link ConfigurationValueBuilder} for more information. | |
| 309 | * | |
| 310 | * | |
| 311 | * @return the builder to configure property keys/default value | |
| 312 | */ | |
| 313 | public ConfigurationValueBuilder<OvhSmsBuilder, String> account() { | |
| 314 |
4
1. account : replaced return value with null for fr/sii/ogham/sms/builder/ovh/OvhSmsBuilder::account → NO_COVERAGE 2. account : replaced return value with null for fr/sii/ogham/sms/builder/ovh/OvhSmsBuilder::account → KILLED 3. account : replaced return value with null for fr/sii/ogham/sms/builder/ovh/OvhSmsBuilder::account → KILLED 4. account : replaced return value with null for fr/sii/ogham/sms/builder/ovh/OvhSmsBuilder::account → KILLED |
return accountValueBuilder; |
| 315 | } | |
| 316 | ||
| 317 | /** | |
| 318 | * Set the OVH username. | |
| 319 | * | |
| 320 | * <p> | |
| 321 | * The value set using this method takes precedence over any property and | |
| 322 | * default value configured using {@link #login()}. | |
| 323 | * | |
| 324 | * <pre> | |
| 325 | * .login("my-username") | |
| 326 | * .login() | |
| 327 | * .properties("${custom.property.high-priority}", "${custom.property.low-priority}") | |
| 328 | * .defaultValue("default-username") | |
| 329 | * </pre> | |
| 330 | * | |
| 331 | * <pre> | |
| 332 | * .login("my-username") | |
| 333 | * .login() | |
| 334 | * .properties("${custom.property.high-priority}", "${custom.property.low-priority}") | |
| 335 | * .defaultValue("default-username") | |
| 336 | * </pre> | |
| 337 | * | |
| 338 | * In both cases, {@code login("my-username")} is used. | |
| 339 | * | |
| 340 | * <p> | |
| 341 | * If this method is called several times, only the last value is used. | |
| 342 | * | |
| 343 | * <p> | |
| 344 | * If {@code null} value is set, it is like not setting a value at all. The | |
| 345 | * property/default value configuration is applied. | |
| 346 | * | |
| 347 | * @param login | |
| 348 | * the OVH username | |
| 349 | * @return this instance for fluent chaining | |
| 350 | */ | |
| 351 | public OvhSmsBuilder login(String login) { | |
| 352 |
2
1. login : removed call to fr/sii/ogham/core/builder/configuration/ConfigurationValueBuilderHelper::setValue → NO_COVERAGE 2. login : removed call to fr/sii/ogham/core/builder/configuration/ConfigurationValueBuilderHelper::setValue → KILLED |
loginValueBuilder.setValue(login); |
| 353 |
2
1. login : replaced return value with null for fr/sii/ogham/sms/builder/ovh/OvhSmsBuilder::login → NO_COVERAGE 2. login : replaced return value with null for fr/sii/ogham/sms/builder/ovh/OvhSmsBuilder::login → KILLED |
return this; |
| 354 | } | |
| 355 | ||
| 356 | /** | |
| 357 | * Set the OVH username. | |
| 358 | * | |
| 359 | * <p> | |
| 360 | * This method is mainly used by {@link Configurer}s to register some | |
| 361 | * property keys and/or a default value. The aim is to let developer be able | |
| 362 | * to externalize its configuration (using system properties, configuration | |
| 363 | * file or anything else). If the developer doesn't configure any value for | |
| 364 | * the registered properties, the default value is used (if set). | |
| 365 | * | |
| 366 | * <pre> | |
| 367 | * .login() | |
| 368 | * .properties("${custom.property.high-priority}", "${custom.property.low-priority}") | |
| 369 | * .defaultValue("default-username") | |
| 370 | * </pre> | |
| 371 | * | |
| 372 | * <p> | |
| 373 | * Non-null value set using {@link #login(String)} takes precedence over | |
| 374 | * property values and default value. | |
| 375 | * | |
| 376 | * <pre> | |
| 377 | * .login("my-username") | |
| 378 | * .login() | |
| 379 | * .properties("${custom.property.high-priority}", "${custom.property.low-priority}") | |
| 380 | * .defaultValue("default-username") | |
| 381 | * </pre> | |
| 382 | * | |
| 383 | * The value {@code "my-username"} is used regardless of the value of the | |
| 384 | * properties and default value. | |
| 385 | * | |
| 386 | * <p> | |
| 387 | * See {@link ConfigurationValueBuilder} for more information. | |
| 388 | * | |
| 389 | * | |
| 390 | * @return the builder to configure property keys/default value | |
| 391 | */ | |
| 392 | public ConfigurationValueBuilder<OvhSmsBuilder, String> login() { | |
| 393 |
4
1. login : replaced return value with null for fr/sii/ogham/sms/builder/ovh/OvhSmsBuilder::login → NO_COVERAGE 2. login : replaced return value with null for fr/sii/ogham/sms/builder/ovh/OvhSmsBuilder::login → KILLED 3. login : replaced return value with null for fr/sii/ogham/sms/builder/ovh/OvhSmsBuilder::login → KILLED 4. login : replaced return value with null for fr/sii/ogham/sms/builder/ovh/OvhSmsBuilder::login → KILLED |
return loginValueBuilder; |
| 394 | } | |
| 395 | ||
| 396 | /** | |
| 397 | * Set the OVH password. | |
| 398 | * | |
| 399 | * <p> | |
| 400 | * The value set using this method takes precedence over any property and | |
| 401 | * default value configured using {@link #password()}. | |
| 402 | * | |
| 403 | * <pre> | |
| 404 | * .password("my-password") | |
| 405 | * .password() | |
| 406 | * .properties("${custom.property.high-priority}", "${custom.property.low-priority}") | |
| 407 | * .defaultValue("default-password") | |
| 408 | * </pre> | |
| 409 | * | |
| 410 | * <pre> | |
| 411 | * .password("my-password") | |
| 412 | * .password() | |
| 413 | * .properties("${custom.property.high-priority}", "${custom.property.low-priority}") | |
| 414 | * .defaultValue("default-password") | |
| 415 | * </pre> | |
| 416 | * | |
| 417 | * In both cases, {@code password("my-password")} is used. | |
| 418 | * | |
| 419 | * <p> | |
| 420 | * If this method is called several times, only the last value is used. | |
| 421 | * | |
| 422 | * <p> | |
| 423 | * If {@code null} value is set, it is like not setting a value at all. The | |
| 424 | * property/default value configuration is applied. | |
| 425 | * | |
| 426 | * @param password | |
| 427 | * the OVH password | |
| 428 | * @return this instance for fluent chaining | |
| 429 | */ | |
| 430 | public OvhSmsBuilder password(String password) { | |
| 431 |
2
1. password : removed call to fr/sii/ogham/core/builder/configuration/ConfigurationValueBuilderHelper::setValue → NO_COVERAGE 2. password : removed call to fr/sii/ogham/core/builder/configuration/ConfigurationValueBuilderHelper::setValue → KILLED |
passwordValueBuilder.setValue(password); |
| 432 |
2
1. password : replaced return value with null for fr/sii/ogham/sms/builder/ovh/OvhSmsBuilder::password → NO_COVERAGE 2. password : replaced return value with null for fr/sii/ogham/sms/builder/ovh/OvhSmsBuilder::password → KILLED |
return this; |
| 433 | } | |
| 434 | ||
| 435 | /** | |
| 436 | * Set the OVH password. | |
| 437 | * | |
| 438 | * <p> | |
| 439 | * This method is mainly used by {@link Configurer}s to register some | |
| 440 | * property keys and/or a default value. The aim is to let developer be able | |
| 441 | * to externalize its configuration (using system properties, configuration | |
| 442 | * file or anything else). If the developer doesn't configure any value for | |
| 443 | * the registered properties, the default value is used (if set). | |
| 444 | * | |
| 445 | * <pre> | |
| 446 | * .password() | |
| 447 | * .properties("${custom.property.high-priority}", "${custom.property.low-priority}") | |
| 448 | * .defaultValue("default-password") | |
| 449 | * </pre> | |
| 450 | * | |
| 451 | * <p> | |
| 452 | * Non-null value set using {@link #password(String)} takes precedence over | |
| 453 | * property values and default value. | |
| 454 | * | |
| 455 | * <pre> | |
| 456 | * .password("my-password") | |
| 457 | * .password() | |
| 458 | * .properties("${custom.property.high-priority}", "${custom.property.low-priority}") | |
| 459 | * .defaultValue("default-password") | |
| 460 | * </pre> | |
| 461 | * | |
| 462 | * The value {@code "my-password"} is used regardless of the value of the | |
| 463 | * properties and default value. | |
| 464 | * | |
| 465 | * <p> | |
| 466 | * See {@link ConfigurationValueBuilder} for more information. | |
| 467 | * | |
| 468 | * | |
| 469 | * @return the builder to configure property keys/default value | |
| 470 | */ | |
| 471 | public ConfigurationValueBuilder<OvhSmsBuilder, String> password() { | |
| 472 |
4
1. password : replaced return value with null for fr/sii/ogham/sms/builder/ovh/OvhSmsBuilder::password → NO_COVERAGE 2. password : replaced return value with null for fr/sii/ogham/sms/builder/ovh/OvhSmsBuilder::password → KILLED 3. password : replaced return value with null for fr/sii/ogham/sms/builder/ovh/OvhSmsBuilder::password → KILLED 4. password : replaced return value with null for fr/sii/ogham/sms/builder/ovh/OvhSmsBuilder::password → KILLED |
return passwordValueBuilder; |
| 473 | } | |
| 474 | ||
| 475 | /** | |
| 476 | * Configures OVH SMS options: | |
| 477 | * <ul> | |
| 478 | * <li>Enable/disable the "STOP" indication at the end of the message | |
| 479 | * (useful to disable for non-commercial SMS)</li> | |
| 480 | * <li>Define the SMS encoding (see {@link SmsCoding}): 1 for 7bit encoding, | |
| 481 | * 2 for 8bit encoding (UTF-8). If you use UTF-8, your SMS will have a | |
| 482 | * maximum size of 70 characters instead of 160</li> | |
| 483 | * <li>Define a tag to mark sent messages (a 20 maximum character | |
| 484 | * string)</li> | |
| 485 | * </ul> | |
| 486 | * | |
| 487 | * @return the builder to configure OVH SMS options | |
| 488 | */ | |
| 489 | public OvhOptionsBuilder options() { | |
| 490 |
4
1. options : negated conditional → KILLED 2. options : negated conditional → KILLED 3. options : negated conditional → KILLED 4. options : negated conditional → KILLED |
if (ovhOptionsBuilder == null) { |
| 491 | ovhOptionsBuilder = new OvhOptionsBuilder(this, buildContext); | |
| 492 | } | |
| 493 |
4
1. options : replaced return value with null for fr/sii/ogham/sms/builder/ovh/OvhSmsBuilder::options → KILLED 2. options : replaced return value with null for fr/sii/ogham/sms/builder/ovh/OvhSmsBuilder::options → KILLED 3. options : replaced return value with null for fr/sii/ogham/sms/builder/ovh/OvhSmsBuilder::options → KILLED 4. options : replaced return value with null for fr/sii/ogham/sms/builder/ovh/OvhSmsBuilder::options → KILLED |
return ovhOptionsBuilder; |
| 494 | } | |
| 495 | ||
| 496 | @Override | |
| 497 | public OvhSmsSender build() { | |
| 498 | URL url = buildUrl(); | |
| 499 | OvhAuthParams authParams = buildAuth(); | |
| 500 |
8
1. build : negated conditional → SURVIVED 2. build : negated conditional → SURVIVED 3. build : negated conditional → NO_COVERAGE 4. build : negated conditional → NO_COVERAGE 5. build : negated conditional → KILLED 6. build : negated conditional → KILLED 7. build : negated conditional → KILLED 8. build : negated conditional → KILLED |
if (url == null || authParams.getAccount() == null || authParams.getLogin() == null || authParams.getPassword() == null) { |
| 501 | return null; | |
| 502 | } | |
| 503 | LOG.info("Sending SMS using OVH API is registered"); | |
| 504 | LOG.debug("OVH account: account={}, login={}", authParams.getAccount(), authParams.getLogin()); | |
| 505 |
2
1. build : replaced return value with null for fr/sii/ogham/sms/builder/ovh/OvhSmsBuilder::build → NO_COVERAGE 2. build : replaced return value with null for fr/sii/ogham/sms/builder/ovh/OvhSmsBuilder::build → KILLED |
return buildContext.register(new OvhSmsSender(url, authParams, buildOptions(), buildContext.register(new DefaultSmsCodingDetector()))); |
| 506 | } | |
| 507 | ||
| 508 | private URL buildUrl() { | |
| 509 |
2
1. buildUrl : replaced return value with null for fr/sii/ogham/sms/builder/ovh/OvhSmsBuilder::buildUrl → SURVIVED 2. buildUrl : replaced return value with null for fr/sii/ogham/sms/builder/ovh/OvhSmsBuilder::buildUrl → KILLED |
return urlValueBuilder.getValue(); |
| 510 | } | |
| 511 | ||
| 512 | private OvhAuthParams buildAuth() { | |
| 513 | String accountValue = accountValueBuilder.getValue(); | |
| 514 | String loginValue = loginValueBuilder.getValue(); | |
| 515 | String passwordValue = passwordValueBuilder.getValue(); | |
| 516 |
4
1. buildAuth : replaced return value with null for fr/sii/ogham/sms/builder/ovh/OvhSmsBuilder::buildAuth → KILLED 2. buildAuth : replaced return value with null for fr/sii/ogham/sms/builder/ovh/OvhSmsBuilder::buildAuth → KILLED 3. buildAuth : replaced return value with null for fr/sii/ogham/sms/builder/ovh/OvhSmsBuilder::buildAuth → KILLED 4. buildAuth : replaced return value with null for fr/sii/ogham/sms/builder/ovh/OvhSmsBuilder::buildAuth → KILLED |
return buildContext.register(new OvhAuthParams(accountValue, loginValue, passwordValue)); |
| 517 | } | |
| 518 | ||
| 519 | private OvhOptions buildOptions() { | |
| 520 |
2
1. buildOptions : replaced return value with null for fr/sii/ogham/sms/builder/ovh/OvhSmsBuilder::buildOptions → NO_COVERAGE 2. buildOptions : replaced return value with null for fr/sii/ogham/sms/builder/ovh/OvhSmsBuilder::buildOptions → KILLED |
return ovhOptionsBuilder.build(); |
| 521 | } | |
| 522 | } | |
Mutations | ||
| 150 |
1.1 2.2 |
|
| 151 |
1.1 2.2 |
|
| 192 |
1.1 2.2 |
|
| 235 |
1.1 2.2 3.3 4.4 |
|
| 273 |
1.1 2.2 |
|
| 274 |
1.1 2.2 |
|
| 314 |
1.1 2.2 3.3 4.4 |
|
| 352 |
1.1 2.2 |
|
| 353 |
1.1 2.2 |
|
| 393 |
1.1 2.2 3.3 4.4 |
|
| 431 |
1.1 2.2 |
|
| 432 |
1.1 2.2 |
|
| 472 |
1.1 2.2 3.3 4.4 |
|
| 490 |
1.1 2.2 3.3 4.4 |
|
| 493 |
1.1 2.2 3.3 4.4 |
|
| 500 |
1.1 2.2 3.3 4.4 5.5 6.6 7.7 8.8 |
|
| 505 |
1.1 2.2 |
|
| 509 |
1.1 2.2 |
|
| 516 |
1.1 2.2 3.3 4.4 |
|
| 520 |
1.1 2.2 |