Class DummySmsClient

java.lang.Object
ch.tocco.nice2.optional.sms.api.services.DummySmsClient
All Implemented Interfaces:
SmsClient

@Component public class DummySmsClient extends Object implements SmsClient
A dummy client that simply creates response objects without involving networking or other resources. To use this client, adopt the application.properties to contain `sms.provider=dummy`.
  • Constructor Details

    • DummySmsClient

      public DummySmsClient()
  • Method Details

    • getName

      public String getName()
      Specified by:
      getName in interface SmsClient
    • sendSms

      public SmsClient.SmsResponse sendSms(SmsClient.Sms sms, boolean simulateSms)
      Creates a response for any given sms. The `simulateSms` flag is ignored. The sms message can contain trailing property lines like in git commit messages that can contain properties to control some behavior: - `Error:true` makes the client return a failed message - `Sleep:200` makes the client thread sleep for the specified amount of milliseconds These properties must be one at a line and the whole block must be separated by an empty line to the previous text. Keys are case insensitive.
      Specified by:
      sendSms in interface SmsClient
    • checkSmsResponse

      public boolean checkSmsResponse(SmsClient.SmsResponse smsResponse)
      Checks whether the given response was created by this client and is a successful response.
      Specified by:
      checkSmsResponse in interface SmsClient
      Returns:
      true if the sms has been sent correctly.
    • checkSmsRecipient

      public boolean checkSmsRecipient(Entity smsRecipient)
      Description copied from interface: SmsClient
      Checks whether the given entity is a valid sms recipient for this SmsClient or not
      Specified by:
      checkSmsRecipient in interface SmsClient
      Returns:
      true if the given entity is a valid sms recipient