diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 355e7866..cde38de4 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -73,6 +73,7 @@ docs/MessageDeliveryWebhook.md docs/MessageDirection.md docs/MessageRequest.md docs/MessageResult.md +docs/MessageResultAllOfTfn.md docs/MessageStatus.md docs/MessageStatusWebhook.md docs/MessagesList.md @@ -132,6 +133,7 @@ docs/SetTalk.md docs/Sms.md docs/StartRecordCall.md docs/TFN.md +docs/TFNCampaign.md docs/TerminateConference.md docs/TranscribeReason.md docs/TranscribeTermReason.md @@ -230,6 +232,7 @@ src/main/java/com/github/freeclimbapi/MessageDeliveryWebhook.java src/main/java/com/github/freeclimbapi/MessageDirection.java src/main/java/com/github/freeclimbapi/MessageRequest.java src/main/java/com/github/freeclimbapi/MessageResult.java +src/main/java/com/github/freeclimbapi/MessageResultAllOfTfn.java src/main/java/com/github/freeclimbapi/MessageStatus.java src/main/java/com/github/freeclimbapi/MessageStatusWebhook.java src/main/java/com/github/freeclimbapi/MessagesList.java @@ -295,6 +298,7 @@ src/main/java/com/github/freeclimbapi/Sms.java src/main/java/com/github/freeclimbapi/StartRecordCall.java src/main/java/com/github/freeclimbapi/StringUtil.java src/main/java/com/github/freeclimbapi/TFN.java +src/main/java/com/github/freeclimbapi/TFNCampaign.java src/main/java/com/github/freeclimbapi/TerminateConference.java src/main/java/com/github/freeclimbapi/TranscribeReason.java src/main/java/com/github/freeclimbapi/TranscribeTermReason.java @@ -379,6 +383,7 @@ src/test/java/com/github/freeclimbapi/MakeCallRequestTest.java src/test/java/com/github/freeclimbapi/MessageDeliveryWebhookTest.java src/test/java/com/github/freeclimbapi/MessageDirectionTest.java src/test/java/com/github/freeclimbapi/MessageRequestTest.java +src/test/java/com/github/freeclimbapi/MessageResultAllOfTfnTest.java src/test/java/com/github/freeclimbapi/MessageResultTest.java src/test/java/com/github/freeclimbapi/MessageStatusTest.java src/test/java/com/github/freeclimbapi/MessageStatusWebhookTest.java @@ -438,6 +443,7 @@ src/test/java/com/github/freeclimbapi/SetListenTest.java src/test/java/com/github/freeclimbapi/SetTalkTest.java src/test/java/com/github/freeclimbapi/SmsTest.java src/test/java/com/github/freeclimbapi/StartRecordCallTest.java +src/test/java/com/github/freeclimbapi/TFNCampaignTest.java src/test/java/com/github/freeclimbapi/TFNTest.java src/test/java/com/github/freeclimbapi/TerminateConferenceTest.java src/test/java/com/github/freeclimbapi/TranscribeReasonTest.java diff --git a/CHANGELOG.md b/CHANGELOG.md index 565eaca7..0dbc4d7e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,19 +8,35 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] None + + + +## [6.1.0] - 2025-01-08 + +### Added + +- CampaignTFN and MessageResultsAllOfTfn models + +### Changed + +- PerclCommand serialization bug has been resolved with edits to the build method + ## [6.0.0] - 2025-01-08 ### Added + - Webhook classes - More idiomated Enum management ### Changed + - Use upgraded openapi generator ### Removed -- *AllOf model files + +- \*AllOf model files diff --git a/README.md b/README.md index 909ff68a..4ab700f6 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ Add this dependency to your project's POM: com.github.freeclimbapi freeclimb-java-client - 6.0.0 + 6.1.0 compile ``` @@ -56,7 +56,7 @@ Add this dependency to your project's build file: } dependencies { - implementation "com.github.freeclimbapi:freeclimb-java-client:6.0.0" + implementation "com.github.freeclimbapi:freeclimb-java-client:6.1.0" implementation("com.squareup.okhttp3:okhttp:4.9.3") implementation("com.squareup.okhttp3:logging-interceptor:4.9.3") } @@ -72,7 +72,7 @@ mvn clean package Then manually install the following JARs: -* `target/freeclimb-java-client-6.0.0.jar` +* `target/freeclimb-java-client-6.1.0.jar` * `target/lib/*.jar` ## Getting Started @@ -271,6 +271,7 @@ Class | Method | HTTP request | Description - [MessageDirection](docs/MessageDirection.md) - [MessageRequest](docs/MessageRequest.md) - [MessageResult](docs/MessageResult.md) + - [MessageResultAllOfTfn](docs/MessageResultAllOfTfn.md) - [MessageStatus](docs/MessageStatus.md) - [MessageStatusWebhook](docs/MessageStatusWebhook.md) - [MessagesList](docs/MessagesList.md) @@ -330,6 +331,7 @@ Class | Method | HTTP request | Description - [Sms](docs/Sms.md) - [StartRecordCall](docs/StartRecordCall.md) - [TFN](docs/TFN.md) + - [TFNCampaign](docs/TFNCampaign.md) - [TerminateConference](docs/TerminateConference.md) - [TranscribeReason](docs/TranscribeReason.md) - [TranscribeTermReason](docs/TranscribeTermReason.md) diff --git a/build.gradle b/build.gradle index af5dc171..9dda8f13 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ apply plugin: 'java' apply plugin: 'com.diffplug.spotless' group = 'com.github.freeclimbapi' -version = '6.0.0' +version = '6.1.0' buildscript { repositories { @@ -119,6 +119,7 @@ dependencies { implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" testImplementation 'junit:junit:4.13.2' testImplementation 'org.mockito:mockito-core:3.12.4' + implementation 'org.json:json:20171018' } javadoc { diff --git a/build.sbt b/build.sbt index 5c64ac5f..3c892eb0 100644 --- a/build.sbt +++ b/build.sbt @@ -2,7 +2,7 @@ lazy val root = (project in file(".")). settings( organization := "com.github.freeclimbapi", name := "freeclimb-java-client", - version := "6.0.0", + version := "6.1.0", scalaVersion := "2.11.4", scalacOptions ++= Seq("-feature"), javacOptions in compile ++= Seq("-Xlint:deprecation"), diff --git a/docs/MessageResult.md b/docs/MessageResult.md index a2bbb168..2918bdb6 100644 --- a/docs/MessageResult.md +++ b/docs/MessageResult.md @@ -23,6 +23,9 @@ Name | Type | Description | Notes **campaignId** | **String** | The unique identifier for the campaign associated with the message | [optional] **segmentCount** | **BigDecimal** | The number of segments into which the message was split | [optional] **mediaUrls** | **List<URI>** | an array of HTTP URLs which were attached this this message | [optional] +**tfn** | [**MessageResultAllOfTfn**](MessageResultAllOfTfn.md) | | [optional] +**phoneNumberId** | **String** | String that uniquely identifies the phoneNumber resource used to send this Message | [optional] +**applicationId** | **String** | String that uniquely identifies the Application resource used to send this Message | [optional] diff --git a/docs/MessageResultAllOfTfn.md b/docs/MessageResultAllOfTfn.md new file mode 100644 index 00000000..08a624e8 --- /dev/null +++ b/docs/MessageResultAllOfTfn.md @@ -0,0 +1,13 @@ + + +# MessageResultAllOfTfn + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**campaignId** | **String** | TFNCampaignId | + + + diff --git a/docs/TFNCampaign.md b/docs/TFNCampaign.md new file mode 100644 index 00000000..d245ab7d --- /dev/null +++ b/docs/TFNCampaign.md @@ -0,0 +1,21 @@ + + +# TFNCampaign + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**accountId** | **String** | ID of the account that created this participant. | +**campaignId** | **String** | TFNCampaignId | +**useCase** | **String** | | +**registrationStatus** | **SMSTollFreeCampaignRegistrationStatus** | | +**dateCreated** | **String** | | +**dateUpdated** | **String** | | +**dateCreatedISO** | **String** | | +**dateUpdatedISO** | **String** | | +**revision** | **Integer** | | + + + diff --git a/openapi.json b/openapi.json index 16e35209..c59fcdb7 100644 --- a/openapi.json +++ b/openapi.json @@ -3596,11 +3596,84 @@ "format": "uri" }, "nullable": true + }, + "tfn": { + "type": "object", + "required": [ + "campaignId" + ], + "properties": { + "campaignId": { + "$ref": "#/components/schemas/TFNCampaignId" + } + }, + "nullable": true + }, + "phoneNumberId": { + "type": "string", + "description": "String that uniquely identifies the phoneNumber resource used to send this Message", + "nullable": true + }, + "applicationId": { + "type": "string", + "description": "String that uniquely identifies the Application resource used to send this Message", + "nullable": true } } } ] }, + "TFNCampaign": { + "type": "object", + "required": [ + "accountId", + "campaignId", + "useCase", + "registrationStatus", + "dateCreated", + "dateUpdated", + "dateCreatedISO", + "dateUpdatedISO", + "revision" + ], + "properties": { + "accountId": { + "type": "string", + "description": "ID of the account that created this participant.", + "nullable": true + }, + "campaignId": { + "$ref": "#/components/schemas/TFNCampaignId" + }, + "useCase": { + "type": "string" + }, + "registrationStatus": { + "$ref": "#/components/schemas/SMSTollFreeCampaignRegistrationStatus" + }, + "dateCreated": { + "type": "string" + }, + "dateUpdated": { + "type": "string" + }, + "dateCreatedISO": { + "type": "string" + }, + "dateUpdatedISO": { + "type": "string" + }, + "revision": { + "type": "integer" + } + } + }, + "TFNCampaignId": { + "type": "string", + "description": "TFNCampaignId", + "pattern": "cmptfn_[a-fA-F0-9]{40}", + "example": "cmptfn_387ec3f6e03b340553f35f29c8f118cdf3eae08a" + }, "CreateConferenceRequest": { "type": "object", "properties": { diff --git a/pom.xml b/pom.xml index 24792d9e..3bb703e5 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ freeclimb-java-client jar freeclimb-java-client - 6.0.0 + 6.1.0 https://github.com/freeclimbapi/java-sdk FreeClimb Java Client @@ -318,6 +318,12 @@ ${mockito-core-version} test + + org.json + json + ${org-json-version} + test + 1.8 @@ -334,6 +340,7 @@ 0.2.2 1.6.0 1.3.5 + 20171018 4.13.2 UTF-8 2.43.0 diff --git a/src/main/java/com/github/freeclimbapi/ApiClient.java b/src/main/java/com/github/freeclimbapi/ApiClient.java index 1c8df208..b14089f5 100644 --- a/src/main/java/com/github/freeclimbapi/ApiClient.java +++ b/src/main/java/com/github/freeclimbapi/ApiClient.java @@ -121,7 +121,7 @@ private void init() { json = new JSON(); // Set default User-Agent. - setUserAgent("OpenAPI-Generator/6.0.0/java"); + setUserAgent("OpenAPI-Generator/6.1.0/java"); authentications = new HashMap(); } diff --git a/src/main/java/com/github/freeclimbapi/models/MessageResult.java b/src/main/java/com/github/freeclimbapi/models/MessageResult.java index 62ff5e50..44bc81b4 100644 --- a/src/main/java/com/github/freeclimbapi/models/MessageResult.java +++ b/src/main/java/com/github/freeclimbapi/models/MessageResult.java @@ -111,6 +111,21 @@ public static String getDiscriminatorValue() { @SerializedName(SERIALIZED_NAME_MEDIA_URLS) private List mediaUrls = null; + public static final String SERIALIZED_NAME_TFN = "tfn"; + + @SerializedName(SERIALIZED_NAME_TFN) + private MessageResultAllOfTfn tfn; + + public static final String SERIALIZED_NAME_PHONE_NUMBER_ID = "phoneNumberId"; + + @SerializedName(SERIALIZED_NAME_PHONE_NUMBER_ID) + private String phoneNumberId; + + public static final String SERIALIZED_NAME_APPLICATION_ID = "applicationId"; + + @SerializedName(SERIALIZED_NAME_APPLICATION_ID) + private String applicationId; + public MessageResult() {} public MessageResult uri(String uri) { @@ -469,6 +484,75 @@ public void setMediaUrls(List mediaUrls) { this.mediaUrls = mediaUrls; } + public MessageResult tfn(MessageResultAllOfTfn tfn) { + + this.tfn = tfn; + return this; + } + + /** + * Get tfn + * + * @return tfn + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + public MessageResultAllOfTfn getTfn() { + return tfn; + } + + public void setTfn(MessageResultAllOfTfn tfn) { + this.tfn = tfn; + } + + public MessageResult phoneNumberId(String phoneNumberId) { + + this.phoneNumberId = phoneNumberId; + return this; + } + + /** + * String that uniquely identifies the phoneNumber resource used to send this Message + * + * @return phoneNumberId + */ + @javax.annotation.Nullable + @ApiModelProperty( + value = + "String that uniquely identifies the phoneNumber resource used to send this" + + " Message") + public String getPhoneNumberId() { + return phoneNumberId; + } + + public void setPhoneNumberId(String phoneNumberId) { + this.phoneNumberId = phoneNumberId; + } + + public MessageResult applicationId(String applicationId) { + + this.applicationId = applicationId; + return this; + } + + /** + * String that uniquely identifies the Application resource used to send this Message + * + * @return applicationId + */ + @javax.annotation.Nullable + @ApiModelProperty( + value = + "String that uniquely identifies the Application resource used to send this" + + " Message") + public String getApplicationId() { + return applicationId; + } + + public void setApplicationId(String applicationId) { + this.applicationId = applicationId; + } + @Override public boolean equals(Object o) { if (this == o) { @@ -493,7 +577,10 @@ public boolean equals(Object o) { && Objects.equals(this.brandId, messageResult.brandId) && Objects.equals(this.campaignId, messageResult.campaignId) && Objects.equals(this.segmentCount, messageResult.segmentCount) - && Objects.equals(this.mediaUrls, messageResult.mediaUrls); + && Objects.equals(this.mediaUrls, messageResult.mediaUrls) + && Objects.equals(this.tfn, messageResult.tfn) + && Objects.equals(this.phoneNumberId, messageResult.phoneNumberId) + && Objects.equals(this.applicationId, messageResult.applicationId); } private static boolean equalsNullable(JsonNullable a, JsonNullable b) { @@ -523,7 +610,10 @@ public int hashCode() { brandId, campaignId, segmentCount, - mediaUrls); + mediaUrls, + tfn, + phoneNumberId, + applicationId); } private static int hashCodeNullable(JsonNullable a) { @@ -553,6 +643,9 @@ public String toString() { sb.append(" campaignId: ").append(toIndentedString(campaignId)).append("\n"); sb.append(" segmentCount: ").append(toIndentedString(segmentCount)).append("\n"); sb.append(" mediaUrls: ").append(toIndentedString(mediaUrls)).append("\n"); + sb.append(" tfn: ").append(toIndentedString(tfn)).append("\n"); + sb.append(" phoneNumberId: ").append(toIndentedString(phoneNumberId)).append("\n"); + sb.append(" applicationId: ").append(toIndentedString(applicationId)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/src/main/java/com/github/freeclimbapi/models/MessageResultAllOfTfn.java b/src/main/java/com/github/freeclimbapi/models/MessageResultAllOfTfn.java new file mode 100644 index 00000000..464a810a --- /dev/null +++ b/src/main/java/com/github/freeclimbapi/models/MessageResultAllOfTfn.java @@ -0,0 +1,95 @@ +/* + * FreeClimb API + * FreeClimb is a cloud-based application programming interface (API) that puts the power of the Vail platform in your hands. FreeClimb simplifies the process of creating applications that can use a full range of telephony features without requiring specialized or on-site telephony equipment. Using the FreeClimb REST API to write applications is easy! You have the option to use the language of your choice or hit the API directly. Your application can execute a command by issuing a RESTful request to the FreeClimb API. The base URL to send HTTP requests to the FreeClimb REST API is: /apiserver. FreeClimb authenticates and processes your request. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@freeclimb.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.github.freeclimbapi.models; + +import com.github.freeclimbapi.enums.*; +import com.google.gson.annotations.SerializedName; +import io.swagger.annotations.ApiModelProperty; +import java.util.*; +import java.util.Objects; + +/** MessageResultAllOfTfn */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class MessageResultAllOfTfn { + public static String getDiscriminatorValue() { + return null; + } + + public static final String SERIALIZED_NAME_CAMPAIGN_ID = "campaignId"; + + @SerializedName(SERIALIZED_NAME_CAMPAIGN_ID) + private String campaignId; + + public MessageResultAllOfTfn() {} + + public MessageResultAllOfTfn campaignId(String campaignId) { + + this.campaignId = campaignId; + return this; + } + + /** + * TFNCampaignId + * + * @return campaignId + */ + @javax.annotation.Nonnull + @ApiModelProperty( + example = "cmptfn_387ec3f6e03b340553f35f29c8f118cdf3eae08a", + required = true, + value = "TFNCampaignId") + public String getCampaignId() { + return campaignId; + } + + public void setCampaignId(String campaignId) { + this.campaignId = campaignId; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MessageResultAllOfTfn messageResultAllOfTfn = (MessageResultAllOfTfn) o; + return Objects.equals(this.campaignId, messageResultAllOfTfn.campaignId); + } + + @Override + public int hashCode() { + return Objects.hash(campaignId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MessageResultAllOfTfn {\n"); + sb.append(" campaignId: ").append(toIndentedString(campaignId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/github/freeclimbapi/models/PerclCommand.java b/src/main/java/com/github/freeclimbapi/models/PerclCommand.java index 821b159f..ebfdf06f 100644 --- a/src/main/java/com/github/freeclimbapi/models/PerclCommand.java +++ b/src/main/java/com/github/freeclimbapi/models/PerclCommand.java @@ -19,6 +19,7 @@ import java.util.*; import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Objects; import java.util.concurrent.Callable; @@ -108,9 +109,10 @@ public Map> build() throws Exception { if (key != "command" && value != null) { if (value instanceof PerclCommand) { commandValue.put(key, ((PerclCommand) value).build()); - } else if (value.getClass().isArray()) { + } else if (value instanceof List) { + Object[] valueArray = ((List) value).toArray(); ArrayList subList = new ArrayList(); - for (Object el : subList) { + for (Object el : valueArray) { if (el != null) { if (el instanceof PerclCommand) { subList.add(((PerclCommand) el).build()); diff --git a/src/main/java/com/github/freeclimbapi/models/Play.java b/src/main/java/com/github/freeclimbapi/models/Play.java index e5d153f3..67df544a 100644 --- a/src/main/java/com/github/freeclimbapi/models/Play.java +++ b/src/main/java/com/github/freeclimbapi/models/Play.java @@ -172,7 +172,7 @@ public String toString() { @Override public Map> attributeTypeMap() { Map> attributes = new HashMap(); - attributes.put("_file", () -> this.getFile()); + attributes.put("file", () -> this.getFile()); attributes.put("loop", () -> this.getLoop()); attributes.put("privacyMode", () -> this.getPrivacyMode()); return attributes; diff --git a/src/main/java/com/github/freeclimbapi/models/PlayEarlyMedia.java b/src/main/java/com/github/freeclimbapi/models/PlayEarlyMedia.java index 2c0ccf30..f4afd0fa 100644 --- a/src/main/java/com/github/freeclimbapi/models/PlayEarlyMedia.java +++ b/src/main/java/com/github/freeclimbapi/models/PlayEarlyMedia.java @@ -112,7 +112,7 @@ public String toString() { @Override public Map> attributeTypeMap() { Map> attributes = new HashMap(); - attributes.put("_file", () -> this.getFile()); + attributes.put("file", () -> this.getFile()); return attributes; } diff --git a/src/main/java/com/github/freeclimbapi/models/TFNCampaign.java b/src/main/java/com/github/freeclimbapi/models/TFNCampaign.java new file mode 100644 index 00000000..1caf1f2b --- /dev/null +++ b/src/main/java/com/github/freeclimbapi/models/TFNCampaign.java @@ -0,0 +1,331 @@ +/* + * FreeClimb API + * FreeClimb is a cloud-based application programming interface (API) that puts the power of the Vail platform in your hands. FreeClimb simplifies the process of creating applications that can use a full range of telephony features without requiring specialized or on-site telephony equipment. Using the FreeClimb REST API to write applications is easy! You have the option to use the language of your choice or hit the API directly. Your application can execute a command by issuing a RESTful request to the FreeClimb API. The base URL to send HTTP requests to the FreeClimb REST API is: /apiserver. FreeClimb authenticates and processes your request. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@freeclimb.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.github.freeclimbapi.models; + +import com.github.freeclimbapi.enums.*; +import com.google.gson.annotations.SerializedName; +import io.swagger.annotations.ApiModelProperty; +import java.util.*; +import java.util.Objects; + +/** TFNCampaign */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class TFNCampaign { + public static String getDiscriminatorValue() { + return null; + } + + public static final String SERIALIZED_NAME_ACCOUNT_ID = "accountId"; + + @SerializedName(SERIALIZED_NAME_ACCOUNT_ID) + private String accountId; + + public static final String SERIALIZED_NAME_CAMPAIGN_ID = "campaignId"; + + @SerializedName(SERIALIZED_NAME_CAMPAIGN_ID) + private String campaignId; + + public static final String SERIALIZED_NAME_USE_CASE = "useCase"; + + @SerializedName(SERIALIZED_NAME_USE_CASE) + private String useCase; + + public static final String SERIALIZED_NAME_REGISTRATION_STATUS = "registrationStatus"; + + @SerializedName(SERIALIZED_NAME_REGISTRATION_STATUS) + private SMSTollFreeCampaignRegistrationStatus registrationStatus; + + public static final String SERIALIZED_NAME_DATE_CREATED = "dateCreated"; + + @SerializedName(SERIALIZED_NAME_DATE_CREATED) + private String dateCreated; + + public static final String SERIALIZED_NAME_DATE_UPDATED = "dateUpdated"; + + @SerializedName(SERIALIZED_NAME_DATE_UPDATED) + private String dateUpdated; + + public static final String SERIALIZED_NAME_DATE_CREATED_I_S_O = "dateCreatedISO"; + + @SerializedName(SERIALIZED_NAME_DATE_CREATED_I_S_O) + private String dateCreatedISO; + + public static final String SERIALIZED_NAME_DATE_UPDATED_I_S_O = "dateUpdatedISO"; + + @SerializedName(SERIALIZED_NAME_DATE_UPDATED_I_S_O) + private String dateUpdatedISO; + + public static final String SERIALIZED_NAME_REVISION = "revision"; + + @SerializedName(SERIALIZED_NAME_REVISION) + private Integer revision; + + public TFNCampaign() {} + + public TFNCampaign accountId(String accountId) { + + this.accountId = accountId; + return this; + } + + /** + * ID of the account that created this participant. + * + * @return accountId + */ + @javax.annotation.Nullable + @ApiModelProperty(required = true, value = "ID of the account that created this participant.") + public String getAccountId() { + return accountId; + } + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + public TFNCampaign campaignId(String campaignId) { + + this.campaignId = campaignId; + return this; + } + + /** + * TFNCampaignId + * + * @return campaignId + */ + @javax.annotation.Nonnull + @ApiModelProperty( + example = "cmptfn_387ec3f6e03b340553f35f29c8f118cdf3eae08a", + required = true, + value = "TFNCampaignId") + public String getCampaignId() { + return campaignId; + } + + public void setCampaignId(String campaignId) { + this.campaignId = campaignId; + } + + public TFNCampaign useCase(String useCase) { + + this.useCase = useCase; + return this; + } + + /** + * Get useCase + * + * @return useCase + */ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + public String getUseCase() { + return useCase; + } + + public void setUseCase(String useCase) { + this.useCase = useCase; + } + + public TFNCampaign registrationStatus( + SMSTollFreeCampaignRegistrationStatus registrationStatus) { + + this.registrationStatus = registrationStatus; + return this; + } + + /** + * Get registrationStatus + * + * @return registrationStatus + */ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + public SMSTollFreeCampaignRegistrationStatus getRegistrationStatus() { + return registrationStatus; + } + + public void setRegistrationStatus(SMSTollFreeCampaignRegistrationStatus registrationStatus) { + this.registrationStatus = registrationStatus; + } + + public TFNCampaign dateCreated(String dateCreated) { + + this.dateCreated = dateCreated; + return this; + } + + /** + * Get dateCreated + * + * @return dateCreated + */ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + public String getDateCreated() { + return dateCreated; + } + + public void setDateCreated(String dateCreated) { + this.dateCreated = dateCreated; + } + + public TFNCampaign dateUpdated(String dateUpdated) { + + this.dateUpdated = dateUpdated; + return this; + } + + /** + * Get dateUpdated + * + * @return dateUpdated + */ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + public String getDateUpdated() { + return dateUpdated; + } + + public void setDateUpdated(String dateUpdated) { + this.dateUpdated = dateUpdated; + } + + public TFNCampaign dateCreatedISO(String dateCreatedISO) { + + this.dateCreatedISO = dateCreatedISO; + return this; + } + + /** + * Get dateCreatedISO + * + * @return dateCreatedISO + */ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + public String getDateCreatedISO() { + return dateCreatedISO; + } + + public void setDateCreatedISO(String dateCreatedISO) { + this.dateCreatedISO = dateCreatedISO; + } + + public TFNCampaign dateUpdatedISO(String dateUpdatedISO) { + + this.dateUpdatedISO = dateUpdatedISO; + return this; + } + + /** + * Get dateUpdatedISO + * + * @return dateUpdatedISO + */ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + public String getDateUpdatedISO() { + return dateUpdatedISO; + } + + public void setDateUpdatedISO(String dateUpdatedISO) { + this.dateUpdatedISO = dateUpdatedISO; + } + + public TFNCampaign revision(Integer revision) { + + this.revision = revision; + return this; + } + + /** + * Get revision + * + * @return revision + */ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + public Integer getRevision() { + return revision; + } + + public void setRevision(Integer revision) { + this.revision = revision; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TFNCampaign tfNCampaign = (TFNCampaign) o; + return Objects.equals(this.accountId, tfNCampaign.accountId) + && Objects.equals(this.campaignId, tfNCampaign.campaignId) + && Objects.equals(this.useCase, tfNCampaign.useCase) + && Objects.equals(this.registrationStatus, tfNCampaign.registrationStatus) + && Objects.equals(this.dateCreated, tfNCampaign.dateCreated) + && Objects.equals(this.dateUpdated, tfNCampaign.dateUpdated) + && Objects.equals(this.dateCreatedISO, tfNCampaign.dateCreatedISO) + && Objects.equals(this.dateUpdatedISO, tfNCampaign.dateUpdatedISO) + && Objects.equals(this.revision, tfNCampaign.revision); + } + + @Override + public int hashCode() { + return Objects.hash( + accountId, + campaignId, + useCase, + registrationStatus, + dateCreated, + dateUpdated, + dateCreatedISO, + dateUpdatedISO, + revision); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TFNCampaign {\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" campaignId: ").append(toIndentedString(campaignId)).append("\n"); + sb.append(" useCase: ").append(toIndentedString(useCase)).append("\n"); + sb.append(" registrationStatus: ") + .append(toIndentedString(registrationStatus)) + .append("\n"); + sb.append(" dateCreated: ").append(toIndentedString(dateCreated)).append("\n"); + sb.append(" dateUpdated: ").append(toIndentedString(dateUpdated)).append("\n"); + sb.append(" dateCreatedISO: ").append(toIndentedString(dateCreatedISO)).append("\n"); + sb.append(" dateUpdatedISO: ").append(toIndentedString(dateUpdatedISO)).append("\n"); + sb.append(" revision: ").append(toIndentedString(revision)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/test/java/com/github/freeclimbapi/manual/PerclScriptBuildTest.java b/src/test/java/com/github/freeclimbapi/manual/PerclScriptBuildTest.java new file mode 100644 index 00000000..469bb09c --- /dev/null +++ b/src/test/java/com/github/freeclimbapi/manual/PerclScriptBuildTest.java @@ -0,0 +1,152 @@ +package com.github.freeclimbapi; + +import com.github.freeclimbapi.enums.*; +import com.github.freeclimbapi.models.*; +import java.util.*; +import org.json.JSONArray; +import org.json.JSONObject; +import org.junit.Assert; +import org.junit.Test; + +public class PerclScriptBuildTest { + + private final PerclScript instance = new PerclScript(); + + JSONObject getPerclCommand(String command, JSONObject value) { + JSONObject perclCommand = new JSONObject(); + perclCommand.put(command, value); + return perclCommand; + } + + JSONArray createExpectedPercl() { + JSONArray result = new JSONArray(); + result.put(getPerclCommand("Pause", new JSONObject())); + result.put(getPerclCommand("SendDigits", new JSONObject())); + result.put(getPerclCommand("Pause", new JSONObject())); + JSONObject getDigits = new JSONObject(); + JSONArray getDigitPrompts = new JSONArray(); + JSONObject playValue = new JSONObject(); + playValue.put("file", "https://123.com/press_any_key.wav"); + getDigitPrompts.put(getPerclCommand("Play", playValue)); + getDigitPrompts.put(getPerclCommand("Pause", new JSONObject())); + getDigitPrompts.put(getPerclCommand("Play", playValue)); + getDigitPrompts.put(getPerclCommand("Pause", new JSONObject())); + getDigitPrompts.put(getPerclCommand("Play", playValue)); + getDigitPrompts.put(getPerclCommand("Pause", new JSONObject())); + getDigits.put("prompts", getDigitPrompts); + result.put(getPerclCommand("GetDigits", getDigits)); + return result; + } + + public JSONArray expectedPerclJsonArray = createExpectedPercl(); + + public String expectedPerclJson = expectedPerclJsonArray.toString(); + + @Test + public void buildArrayListToJsonTest() throws Exception { + Pause pause = new Pause(); + SendDigits sendDigits = new SendDigits(); + GetDigits digits = new GetDigits(); + instance.addCommand(pause); + instance.addCommand(sendDigits); + instance.addCommand(pause); + + ArrayList prompts = new ArrayList<>(); + + for (int i = 0; i < 3; i++) { + Play play = new Play(); + Pause agentPause = new Pause(); + + play.setFile("https://123.com" + "/press_any_key.wav"); + + prompts.add(play); + prompts.add(agentPause); + } + + digits.setPrompts(prompts); + instance.addCommand(digits); + String perclJson = instance.toJson(); + Assert.assertEquals(perclJson, expectedPerclJson); + } + + @Test + public void buildLinkedListToJsonTest() throws Exception { + Pause pause = new Pause(); + SendDigits sendDigits = new SendDigits(); + GetDigits digits = new GetDigits(); + instance.addCommand(pause); + instance.addCommand(sendDigits); + instance.addCommand(pause); + + LinkedList prompts = new LinkedList<>(); + + for (int i = 0; i < 3; i++) { + Play play = new Play(); + Pause agentPause = new Pause(); + + play.setFile("https://123.com" + "/press_any_key.wav"); + + prompts.add(play); + prompts.add(agentPause); + } + + digits.setPrompts(prompts); + instance.addCommand(digits); + String perclJson = instance.toJson(); + Assert.assertEquals(perclJson, expectedPerclJson); + } + + @Test + public void buildVectorToJsonTest() throws Exception { + Pause pause = new Pause(); + SendDigits sendDigits = new SendDigits(); + GetDigits digits = new GetDigits(); + instance.addCommand(pause); + instance.addCommand(sendDigits); + instance.addCommand(pause); + + Vector prompts = new Vector<>(); + + for (int i = 0; i < 3; i++) { + Play play = new Play(); + Pause agentPause = new Pause(); + + play.setFile("https://123.com" + "/press_any_key.wav"); + + prompts.add(play); + prompts.add(agentPause); + } + + digits.setPrompts(prompts); + instance.addCommand(digits); + String perclJson = instance.toJson(); + Assert.assertEquals(perclJson, expectedPerclJson); + } + + @Test + public void buildStackToJsonTest() throws Exception { + Pause pause = new Pause(); + SendDigits sendDigits = new SendDigits(); + GetDigits digits = new GetDigits(); + instance.addCommand(pause); + instance.addCommand(sendDigits); + instance.addCommand(pause); + + Stack prompts = new Stack<>(); + + for (int i = 0; i < 3; i++) { + Play play = new Play(); + Pause agentPause = new Pause(); + + play.setFile("https://123.com" + "/press_any_key.wav"); + + prompts.add(play); + prompts.add(agentPause); + } + + digits.setPrompts(prompts); + instance.addCommand(digits); + String perclJson = instance.toJson(); + Assert.assertEquals(perclJson, expectedPerclJson); + } +} diff --git a/src/test/java/com/github/freeclimbapi/manual/RequestVerifierTest.java b/src/test/java/com/github/freeclimbapi/manual/RequestVerifierTest.java index 61c16a4a..383234b6 100644 --- a/src/test/java/com/github/freeclimbapi/manual/RequestVerifierTest.java +++ b/src/test/java/com/github/freeclimbapi/manual/RequestVerifierTest.java @@ -1,21 +1,12 @@ package com.github.freeclimbapi; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.io.File; -import java.math.BigDecimal; -import com.github.freeclimbapi.utils.*; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertThrows; -import java.security.NoSuchAlgorithmException; + +import com.github.freeclimbapi.utils.*; import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; +import org.junit.Test; public class RequestVerifierTest { @@ -25,170 +16,218 @@ public class RequestVerifierTest { public void checkRequestBodyTest() throws Exception { String requestBody = ""; String signingSecret = "sigsec_ead6d3b6904196c60835d039e91b3341c77a7793"; - String requestHeader = "t=1679931346,v1=4945505e46930b6e31df721c069f10cd3a4cfb3c8e2ec67d2663fae49f95644f,v1=1ba18712726898fbbe48cd862dd096a709f7ad761a5bab14bda9ac24d963a6a8"; + String requestHeader = + "t=1679931346,v1=4945505e46930b6e31df721c069f10cd3a4cfb3c8e2ec67d2663fae49f95644f,v1=1ba18712726898fbbe48cd862dd096a709f7ad761a5bab14bda9ac24d963a6a8"; Integer tolerance = 5 * 60 * 1000; - RuntimeException exception = assertThrows( - RuntimeException.class, - () -> { - RequestVerifier.verifyRequestSignature(requestBody, requestHeader, signingSecret, tolerance); - }); + RuntimeException exception = + assertThrows( + RuntimeException.class, + () -> { + RequestVerifier.verifyRequestSignature( + requestBody, requestHeader, signingSecret, tolerance); + }); assertEquals("Request Body cannot be empty or null", exception.getMessage()); - } @Test public void checkRequestHeaderTest() { - String requestBody = "{\"accountId\":\"AC1334ffb694cd8d969f51cddf5f7c9b478546d50c\",\"callId\":\"CAccb0b00506553cda09b51c5477f672a49e0b2213\",\"callStatus\":\"ringing\",\"conferenceId\":null,\"direction\":\"inbound\",\"from\":\"+13121000109\",\"parentCallId\":null,\"queueId\":null,\"requestType\":\"inboundCall\",\"to\":\"+13121000096\"}"; + String requestBody = + "{\"accountId\":\"AC1334ffb694cd8d969f51cddf5f7c9b478546d50c\",\"callId\":\"CAccb0b00506553cda09b51c5477f672a49e0b2213\",\"callStatus\":\"ringing\",\"conferenceId\":null,\"direction\":\"inbound\",\"from\":\"+13121000109\",\"parentCallId\":null,\"queueId\":null,\"requestType\":\"inboundCall\",\"to\":\"+13121000096\"}"; String signingSecret = "sigsec_ead6d3b6904196c60835d039e91b3341c77a7793"; - String requestHeader = "v1=c3957749baf61df4b1506802579cc69a74c77a1ae21447b930e5a704f9ec4120,v1=1ba18712726898fbbe48cd862dd096a709f7ad761a5bab14bda9ac24d963a6a8"; + String requestHeader = + "v1=c3957749baf61df4b1506802579cc69a74c77a1ae21447b930e5a704f9ec4120,v1=1ba18712726898fbbe48cd862dd096a709f7ad761a5bab14bda9ac24d963a6a8"; Integer tolerance = 5 * 60 * 1000; - RuntimeException exception = assertThrows( - RuntimeException.class, - () -> { - RequestVerifier.verifyRequestSignature(requestBody, requestHeader, signingSecret, tolerance); - }); + RuntimeException exception = + assertThrows( + RuntimeException.class, + () -> { + RequestVerifier.verifyRequestSignature( + requestBody, requestHeader, signingSecret, tolerance); + }); assertEquals("Error with request header, timestamp is not present", exception.getMessage()); } @Test public void checkRequestHeaderTest2() { - String requestBody = "{\"accountId\":\"AC1334ffb694cd8d969f51cddf5f7c9b478546d50c\",\"callId\":\"CAccb0b00506553cda09b51c5477f672a49e0b2213\",\"callStatus\":\"ringing\",\"conferenceId\":null,\"direction\":\"inbound\",\"from\":\"+13121000109\",\"parentCallId\":null,\"queueId\":null,\"requestType\":\"inboundCall\",\"to\":\"+13121000096\"}"; + String requestBody = + "{\"accountId\":\"AC1334ffb694cd8d969f51cddf5f7c9b478546d50c\",\"callId\":\"CAccb0b00506553cda09b51c5477f672a49e0b2213\",\"callStatus\":\"ringing\",\"conferenceId\":null,\"direction\":\"inbound\",\"from\":\"+13121000109\",\"parentCallId\":null,\"queueId\":null,\"requestType\":\"inboundCall\",\"to\":\"+13121000096\"}"; String signingSecret = "sigsec_ead6d3b6904196c60835d039e91b3341c77a7793"; String requestHeader = "t=1679944186"; Integer tolerance = 5 * 60 * 1000; - RuntimeException exception = assertThrows( - RuntimeException.class, - () -> { - RequestVerifier.verifyRequestSignature(requestBody, requestHeader, signingSecret, tolerance); - }); + RuntimeException exception = + assertThrows( + RuntimeException.class, + () -> { + RequestVerifier.verifyRequestSignature( + requestBody, requestHeader, signingSecret, tolerance); + }); - assertEquals("Error with request header, signatures are not present", exception.getMessage()); + assertEquals( + "Error with request header, signatures are not present", exception.getMessage()); } @Test public void checkRequestHeaderTest3() { - String requestBody = "{\"accountId\":\"AC1334ffb694cd8d969f51cddf5f7c9b478546d50c\",\"callId\":\"CAccb0b00506553cda09b51c5477f672a49e0b2213\",\"callStatus\":\"ringing\",\"conferenceId\":null,\"direction\":\"inbound\",\"from\":\"+13121000109\",\"parentCallId\":null,\"queueId\":null,\"requestType\":\"inboundCall\",\"to\":\"+13121000096\"}"; + String requestBody = + "{\"accountId\":\"AC1334ffb694cd8d969f51cddf5f7c9b478546d50c\",\"callId\":\"CAccb0b00506553cda09b51c5477f672a49e0b2213\",\"callStatus\":\"ringing\",\"conferenceId\":null,\"direction\":\"inbound\",\"from\":\"+13121000109\",\"parentCallId\":null,\"queueId\":null,\"requestType\":\"inboundCall\",\"to\":\"+13121000096\"}"; String signingSecret = "sigsec_ead6d3b6904196c60835d039e91b3341c77a7793"; String requestHeader = ""; int tolerance = 5 * 60; - RuntimeException exception = assertThrows( - RuntimeException.class, - () -> { - RequestVerifier.verifyRequestSignature(requestBody, requestHeader, signingSecret, tolerance); - }); + RuntimeException exception = + assertThrows( + RuntimeException.class, + () -> { + RequestVerifier.verifyRequestSignature( + requestBody, requestHeader, signingSecret, tolerance); + }); assertEquals("Error with request header, Request header is empty", exception.getMessage()); } @Test public void checkSigningSecretTest() { - String requestBody = "{\"accountId\":\"AC1334ffb694cd8d969f51cddf5f7c9b478546d50c\",\"callId\":\"CAccb0b00506553cda09b51c5477f672a49e0b2213\",\"callStatus\":\"ringing\",\"conferenceId\":null,\"direction\":\"inbound\",\"from\":\"+13121000109\",\"parentCallId\":null,\"queueId\":null,\"requestType\":\"inboundCall\",\"to\":\"+13121000096\"}"; + String requestBody = + "{\"accountId\":\"AC1334ffb694cd8d969f51cddf5f7c9b478546d50c\",\"callId\":\"CAccb0b00506553cda09b51c5477f672a49e0b2213\",\"callStatus\":\"ringing\",\"conferenceId\":null,\"direction\":\"inbound\",\"from\":\"+13121000109\",\"parentCallId\":null,\"queueId\":null,\"requestType\":\"inboundCall\",\"to\":\"+13121000096\"}"; String signingSecret = ""; - String requestHeader = "t=1679944186,v1=c3957749baf61df4b1506802579cc69a74c77a1ae21447b930e5a704f9ec4120,v1=1ba18712726898fbbe48cd862dd096a709f7ad761a5bab14bda9ac24d963a6a8"; + String requestHeader = + "t=1679944186,v1=c3957749baf61df4b1506802579cc69a74c77a1ae21447b930e5a704f9ec4120,v1=1ba18712726898fbbe48cd862dd096a709f7ad761a5bab14bda9ac24d963a6a8"; Integer tolerance = 5 * 60; - RuntimeException exception = assertThrows( - RuntimeException.class, - () -> { - RequestVerifier.verifyRequestSignature(requestBody, requestHeader, signingSecret, tolerance); - }); + RuntimeException exception = + assertThrows( + RuntimeException.class, + () -> { + RequestVerifier.verifyRequestSignature( + requestBody, requestHeader, signingSecret, tolerance); + }); assertEquals("Signing secret cannot be empty or null", exception.getMessage()); } @Test public void checkToleranceTest() { - String requestBody = "{\"accountId\":\"AC1334ffb694cd8d969f51cddf5f7c9b478546d50c\",\"callId\":\"CAccb0b00506553cda09b51c5477f672a49e0b2213\",\"callStatus\":\"ringing\",\"conferenceId\":null,\"direction\":\"inbound\",\"from\":\"+13121000109\",\"parentCallId\":null,\"queueId\":null,\"requestType\":\"inboundCall\",\"to\":\"+13121000096\"}"; + String requestBody = + "{\"accountId\":\"AC1334ffb694cd8d969f51cddf5f7c9b478546d50c\",\"callId\":\"CAccb0b00506553cda09b51c5477f672a49e0b2213\",\"callStatus\":\"ringing\",\"conferenceId\":null,\"direction\":\"inbound\",\"from\":\"+13121000109\",\"parentCallId\":null,\"queueId\":null,\"requestType\":\"inboundCall\",\"to\":\"+13121000096\"}"; String signingSecret = "sigsec_ead6d3b6904196c60835d039e91b3341c77a7793"; - String requestHeader = "t=1679944186,v1=c3957749baf61df4b1506802579cc69a74c77a1ae21447b930e5a704f9ec4120,v1=1ba18712726898fbbe48cd862dd096a709f7ad761a5bab14bda9ac24d963a6a8"; + String requestHeader = + "t=1679944186,v1=c3957749baf61df4b1506802579cc69a74c77a1ae21447b930e5a704f9ec4120,v1=1ba18712726898fbbe48cd862dd096a709f7ad761a5bab14bda9ac24d963a6a8"; Integer tolerance = Integer.MAX_VALUE; - RuntimeException exception = assertThrows( - RuntimeException.class, - () -> { - RequestVerifier.verifyRequestSignature(requestBody, requestHeader, signingSecret, tolerance); - }); + RuntimeException exception = + assertThrows( + RuntimeException.class, + () -> { + RequestVerifier.verifyRequestSignature( + requestBody, requestHeader, signingSecret, tolerance); + }); assertEquals("Tolerance value must be a positive integer", exception.getMessage()); } @Test public void checkToleranceTest2() { - String requestBody = "{\"accountId\":\"AC1334ffb694cd8d969f51cddf5f7c9b478546d50c\",\"callId\":\"CAccb0b00506553cda09b51c5477f672a49e0b2213\",\"callStatus\":\"ringing\",\"conferenceId\":null,\"direction\":\"inbound\",\"from\":\"+13121000109\",\"parentCallId\":null,\"queueId\":null,\"requestType\":\"inboundCall\",\"to\":\"+13121000096\"}"; + String requestBody = + "{\"accountId\":\"AC1334ffb694cd8d969f51cddf5f7c9b478546d50c\",\"callId\":\"CAccb0b00506553cda09b51c5477f672a49e0b2213\",\"callStatus\":\"ringing\",\"conferenceId\":null,\"direction\":\"inbound\",\"from\":\"+13121000109\",\"parentCallId\":null,\"queueId\":null,\"requestType\":\"inboundCall\",\"to\":\"+13121000096\"}"; String signingSecret = "sigsec_ead6d3b6904196c60835d039e91b3341c77a7793"; - String requestHeader = "t=1679944186,v1=c3957749baf61df4b1506802579cc69a74c77a1ae21447b930e5a704f9ec4120,v1=1ba18712726898fbbe48cd862dd096a709f7ad761a5bab14bda9ac24d963a6a8"; + String requestHeader = + "t=1679944186,v1=c3957749baf61df4b1506802579cc69a74c77a1ae21447b930e5a704f9ec4120,v1=1ba18712726898fbbe48cd862dd096a709f7ad761a5bab14bda9ac24d963a6a8"; Integer tolerance = -5; - RuntimeException exception = assertThrows( - RuntimeException.class, - () -> { - RequestVerifier.verifyRequestSignature(requestBody, requestHeader, signingSecret, tolerance); - }); + RuntimeException exception = + assertThrows( + RuntimeException.class, + () -> { + RequestVerifier.verifyRequestSignature( + requestBody, requestHeader, signingSecret, tolerance); + }); assertEquals("Tolerance value must be a positive integer", exception.getMessage()); } @Test public void checkToleranceTest3() { - String requestBody = "{\"accountId\":\"AC1334ffb694cd8d969f51cddf5f7c9b478546d50c\",\"callId\":\"CAccb0b00506553cda09b51c5477f672a49e0b2213\",\"callStatus\":\"ringing\",\"conferenceId\":null,\"direction\":\"inbound\",\"from\":\"+13121000109\",\"parentCallId\":null,\"queueId\":null,\"requestType\":\"inboundCall\",\"to\":\"+13121000096\"}"; + String requestBody = + "{\"accountId\":\"AC1334ffb694cd8d969f51cddf5f7c9b478546d50c\",\"callId\":\"CAccb0b00506553cda09b51c5477f672a49e0b2213\",\"callStatus\":\"ringing\",\"conferenceId\":null,\"direction\":\"inbound\",\"from\":\"+13121000109\",\"parentCallId\":null,\"queueId\":null,\"requestType\":\"inboundCall\",\"to\":\"+13121000096\"}"; String signingSecret = "sigsec_ead6d3b6904196c60835d039e91b3341c77a7793"; - String requestHeader = "t=1679944186,v1=c3957749baf61df4b1506802579cc69a74c77a1ae21447b930e5a704f9ec4120,v1=1ba18712726898fbbe48cd862dd096a709f7ad761a5bab14bda9ac24d963a6a8"; + String requestHeader = + "t=1679944186,v1=c3957749baf61df4b1506802579cc69a74c77a1ae21447b930e5a704f9ec4120,v1=1ba18712726898fbbe48cd862dd096a709f7ad761a5bab14bda9ac24d963a6a8"; int tolerance = 0; - RuntimeException exception = assertThrows( - RuntimeException.class, - () -> { - RequestVerifier.verifyRequestSignature(requestBody, requestHeader, signingSecret, tolerance); - }); + RuntimeException exception = + assertThrows( + RuntimeException.class, + () -> { + RequestVerifier.verifyRequestSignature( + requestBody, requestHeader, signingSecret, tolerance); + }); assertEquals("Tolerance value must be a positive integer", exception.getMessage()); } @Test public void verifyToleranceTest() { - String requestBody = "{\"accountId\":\"AC1334ffb694cd8d969f51cddf5f7c9b478546d50c\",\"callId\":\"CAccb0b00506553cda09b51c5477f672a49e0b2213\",\"callStatus\":\"ringing\",\"conferenceId\":null,\"direction\":\"inbound\",\"from\":\"+13121000109\",\"parentCallId\":null,\"queueId\":null,\"requestType\":\"inboundCall\",\"to\":\"+13121000096\"}"; + String requestBody = + "{\"accountId\":\"AC1334ffb694cd8d969f51cddf5f7c9b478546d50c\",\"callId\":\"CAccb0b00506553cda09b51c5477f672a49e0b2213\",\"callStatus\":\"ringing\",\"conferenceId\":null,\"direction\":\"inbound\",\"from\":\"+13121000109\",\"parentCallId\":null,\"queueId\":null,\"requestType\":\"inboundCall\",\"to\":\"+13121000096\"}"; String signingSecret = "sigsec_ead6d3b6904196c60835d039e91b3341c77a7793"; Integer currentTime = (int) (System.currentTimeMillis() / 1000L); Integer timeCalcuation = currentTime - (6 * 60); - String requestHeader = "t=" + timeCalcuation.toString() - + ",v1=1d798c86e977ff734dec3a8b8d67fe8621dcc1df46ef4212e0bfe2e122b01bfd,v1=1ba18712726898fbbe48cd862dd096a709f7ad761a5bab14bda9ac24d963a6a8"; + String requestHeader = + "t=" + + timeCalcuation.toString() + + ",v1=1d798c86e977ff734dec3a8b8d67fe8621dcc1df46ef4212e0bfe2e122b01bfd,v1=1ba18712726898fbbe48cd862dd096a709f7ad761a5bab14bda9ac24d963a6a8"; Integer tolerance = 5 * 60; - RuntimeException exception = assertThrows( - RuntimeException.class, - () -> { - RequestVerifier.verifyRequestSignature(requestBody, requestHeader, signingSecret, tolerance); - }); + RuntimeException exception = + assertThrows( + RuntimeException.class, + () -> { + RequestVerifier.verifyRequestSignature( + requestBody, requestHeader, signingSecret, tolerance); + }); assertEquals( - "Request time exceeded tolerance threshold. Request: " + timeCalcuation.toString() + ", CurrentTime: " - + Integer.toString(currentTime) + ", tolerance: " + tolerance, + "Request time exceeded tolerance threshold. Request: " + + timeCalcuation.toString() + + ", CurrentTime: " + + Integer.toString(currentTime) + + ", tolerance: " + + tolerance, exception.getMessage()); } @Test public void verifySignatureTest() { - String requestBody = "{\"accountId\":\"AC1334ffb694cd8d969f51cddf5f7c9b478546d50c\",\"callId\":\"CAccb0b00506553cda09b51c5477f672a49e0b2213\",\"callStatus\":\"ringing\",\"conferenceId\":null,\"direction\":\"inbound\",\"from\":\"+13121000109\",\"parentCallId\":null,\"queueId\":null,\"requestType\":\"inboundCall\",\"to\":\"+13121000096\"}"; + String requestBody = + "{\"accountId\":\"AC1334ffb694cd8d969f51cddf5f7c9b478546d50c\",\"callId\":\"CAccb0b00506553cda09b51c5477f672a49e0b2213\",\"callStatus\":\"ringing\",\"conferenceId\":null,\"direction\":\"inbound\",\"from\":\"+13121000109\",\"parentCallId\":null,\"queueId\":null,\"requestType\":\"inboundCall\",\"to\":\"+13121000096\"}"; String signingSecret = "sigsec_ead6d3b6904196c60835d039e91b3341c77a7794"; Integer currentTime = (int) (System.currentTimeMillis() / 1000L); - String requestHeader = "t=" + currentTime.toString() - + ",v1=1d798c86e977ff734dec3a8b8d67fe8621dcc1df46ef4212e0bfe2e122b01bfd,v1=1ba18712726898fbbe48cd862dd096a709f7ad761a5bab14bda9ac24d963a6a8"; + String requestHeader = + "t=" + + currentTime.toString() + + ",v1=1d798c86e977ff734dec3a8b8d67fe8621dcc1df46ef4212e0bfe2e122b01bfd,v1=1ba18712726898fbbe48cd862dd096a709f7ad761a5bab14bda9ac24d963a6a8"; Integer tolerance = 5 * 60; - RuntimeException exception = assertThrows( - RuntimeException.class, - () -> { - RequestVerifier.verifyRequestSignature(requestBody, requestHeader, signingSecret, tolerance); - }); + RuntimeException exception = + assertThrows( + RuntimeException.class, + () -> { + RequestVerifier.verifyRequestSignature( + requestBody, requestHeader, signingSecret, tolerance); + }); assertEquals( - "Unverified signature request, If this request was unexpected, it may be from a bad actor. Please proceed with caution. If the request was exepected, please check any typos or issues with the signingSecret", + "Unverified signature request, If this request was unexpected, it may be from a bad" + + " actor. Please proceed with caution. If the request was exepected, please" + + " check any typos or issues with the signingSecret", exception.getMessage()); } @Test public void verifyRequestSignatureTest() throws NoSuchAlgorithmException, InvalidKeyException { - String requestBody = "{\"accountId\":\"AC1334ffb694cd8d969f51cddf5f7c9b478546d50c\",\"callId\":\"CAccb0b00506553cda09b51c5477f672a49e0b2213\",\"callStatus\":\"ringing\",\"conferenceId\":null,\"direction\":\"inbound\",\"from\":\"+13121000109\",\"parentCallId\":null,\"queueId\":null,\"requestType\":\"inboundCall\",\"to\":\"+13121000096\"}"; + String requestBody = + "{\"accountId\":\"AC1334ffb694cd8d969f51cddf5f7c9b478546d50c\",\"callId\":\"CAccb0b00506553cda09b51c5477f672a49e0b2213\",\"callStatus\":\"ringing\",\"conferenceId\":null,\"direction\":\"inbound\",\"from\":\"+13121000109\",\"parentCallId\":null,\"queueId\":null,\"requestType\":\"inboundCall\",\"to\":\"+13121000096\"}"; String signingSecret = "sigsec_ead6d3b6904196c60835d039e91b3341c77a7793"; - String requestHeader = "t=2130000000,v1=c3957749baf61df4b1506802579cc69a74c77a1ae21447b930e5a704f9ec4120,v1=6835006e70c9b9f610e8fb3a8b36b52b3f28c12d0a2dab75091c46ca7ec11b20"; + String requestHeader = + "t=2130000000,v1=c3957749baf61df4b1506802579cc69a74c77a1ae21447b930e5a704f9ec4120,v1=6835006e70c9b9f610e8fb3a8b36b52b3f28c12d0a2dab75091c46ca7ec11b20"; Integer tolerance = 5 * 60; - RequestVerifier.verifyRequestSignature(requestBody, requestHeader, signingSecret, tolerance); + RequestVerifier.verifyRequestSignature( + requestBody, requestHeader, signingSecret, tolerance); } -} \ No newline at end of file +} diff --git a/src/test/java/com/github/freeclimbapi/models/MessageResultAllOfTfnTest.java b/src/test/java/com/github/freeclimbapi/models/MessageResultAllOfTfnTest.java new file mode 100644 index 00000000..407f2e2e --- /dev/null +++ b/src/test/java/com/github/freeclimbapi/models/MessageResultAllOfTfnTest.java @@ -0,0 +1,127 @@ +/* + * FreeClimb API + * FreeClimb is a cloud-based application programming interface (API) that puts the power of the Vail platform in your hands. FreeClimb simplifies the process of creating applications that can use a full range of telephony features without requiring specialized or on-site telephony equipment. Using the FreeClimb REST API to write applications is easy! You have the option to use the language of your choice or hit the API directly. Your application can execute a command by issuing a RESTful request to the FreeClimb API. The base URL to send HTTP requests to the FreeClimb REST API is: /apiserver. FreeClimb authenticates and processes your request. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@freeclimb.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.github.freeclimbapi; + +import com.github.freeclimbapi.enums.*; +import com.github.freeclimbapi.models.*; +import java.util.*; +import org.junit.Assert; +import org.junit.Test; + +/** Model tests for MessageResultAllOfTfn */ +public class MessageResultAllOfTfnTest { + + private final MessageResultAllOfTfn model = new MessageResultAllOfTfn(); + + /** Test the property 'campaignId' */ + @Test + public void campaignIdTest() { + + model.setCampaignId("TEST_STRING"); + Assert.assertEquals("TEST_STRING", model.getCampaignId()); + } + + /** Test the method 'equalsTrue' */ + @Test + public void equalsTrueTest() { + MessageResultAllOfTfn test1 = new MessageResultAllOfTfn(); + + test1.setCampaignId("TS"); + + MessageResultAllOfTfn test2 = new MessageResultAllOfTfn(); + + test2.setCampaignId("TS"); + + Assert.assertTrue(test1.equals(test2)); + } + + /** Test the method 'equalsFalse' */ + @Test + public void equalsFalseTest() { + MessageResultAllOfTfn test1 = new MessageResultAllOfTfn(); + + test1.setCampaignId("TS"); + + MessageResultAllOfTfn test2 = new MessageResultAllOfTfn(); + + test2.setCampaignId("TS2"); + + Assert.assertFalse(test1.equals(test2)); + } + + /** Test the method 'hashCodeType' */ + @Test + public void hashCodeTypeTest() { + MessageResultAllOfTfn test1 = new MessageResultAllOfTfn(); + + test1.setCampaignId("TS"); + + int hashCode1 = test1.hashCode(); + Assert.assertTrue(Integer.class.isInstance(hashCode1)); + } + + /** Test the method 'toStringEquals' */ + @Test + public void toStringEqualsTest() { + MessageResultAllOfTfn test1 = new MessageResultAllOfTfn(); + + test1.setCampaignId("TS"); + + MessageResultAllOfTfn test2 = new MessageResultAllOfTfn(); + + test2.setCampaignId("TS"); + + String toString1 = test1.toString(); + String toString2 = test2.toString(); + Assert.assertEquals(toString1, toString2); + } + + /** Test the method 'hashCodeEqualsTrue' */ + @Test + public void hashCodeEqualsTrueTest() { + MessageResultAllOfTfn test1 = new MessageResultAllOfTfn(); + + test1.setCampaignId("TS"); + + MessageResultAllOfTfn test2 = new MessageResultAllOfTfn(); + + test2.setCampaignId("TS"); + + Assert.assertEquals(test1.hashCode(), test2.hashCode()); + } + + /** Test the method 'hashCodeEqualsFalse' */ + @Test + public void hashCodeEqualsFalseTest() { + MessageResultAllOfTfn test1 = new MessageResultAllOfTfn(); + + test1.setCampaignId("TS"); + + MessageResultAllOfTfn test2 = new MessageResultAllOfTfn(); + + test2.setCampaignId("TS2"); + + Assert.assertNotEquals(test1.hashCode(), test2.hashCode()); + } + + /** Test the method 'toStringType' */ + @Test + public void toStringTypeTest() { + MessageResultAllOfTfn test1 = new MessageResultAllOfTfn(); + + test1.setCampaignId("TS"); + + String toString1 = test1.toString(); + Assert.assertTrue(String.class.isInstance(toString1)); + } +} diff --git a/src/test/java/com/github/freeclimbapi/models/MessageResultTest.java b/src/test/java/com/github/freeclimbapi/models/MessageResultTest.java index 5beaec2d..55167e1d 100644 --- a/src/test/java/com/github/freeclimbapi/models/MessageResultTest.java +++ b/src/test/java/com/github/freeclimbapi/models/MessageResultTest.java @@ -179,6 +179,26 @@ public void mediaUrlsTest() { Assert.assertEquals(testList, model.getMediaUrls()); } + /** Test the property 'tfn' */ + @Test + public void tfnTest() {} + + /** Test the property 'phoneNumberId' */ + @Test + public void phoneNumberIdTest() { + + model.setPhoneNumberId("TEST_STRING"); + Assert.assertEquals("TEST_STRING", model.getPhoneNumberId()); + } + + /** Test the property 'applicationId' */ + @Test + public void applicationIdTest() { + + model.setApplicationId("TEST_STRING"); + Assert.assertEquals("TEST_STRING", model.getApplicationId()); + } + /** Test the method 'equalsTrue' */ @Test public void equalsTrueTest() { @@ -220,6 +240,11 @@ public void equalsTrueTest() { List testList = new ArrayList(); test1.setMediaUrls(testList); + + test1.setPhoneNumberId("TS"); + + test1.setApplicationId("TS"); + MessageResult test2 = new MessageResult(); test2.setUri("TS"); @@ -259,6 +284,10 @@ public void equalsTrueTest() { List testList2 = testList; test2.setMediaUrls(testList2); + test2.setPhoneNumberId("TS"); + + test2.setApplicationId("TS"); + Assert.assertTrue(test1.equals(test2)); } @@ -303,6 +332,11 @@ public void equalsFalseTest() { List testList = new ArrayList(); test1.setMediaUrls(testList); + + test1.setPhoneNumberId("TS"); + + test1.setApplicationId("TS"); + MessageResult test2 = new MessageResult(); test2.setUri("TS2"); @@ -342,6 +376,10 @@ public void equalsFalseTest() { List testList2 = null; test2.setMediaUrls(testList2); + test2.setPhoneNumberId("TS2"); + + test2.setApplicationId("TS2"); + Assert.assertFalse(test1.equals(test2)); } @@ -387,6 +425,10 @@ public void hashCodeTypeTest() { List testList = new ArrayList(); test1.setMediaUrls(testList); + test1.setPhoneNumberId("TS"); + + test1.setApplicationId("TS"); + int hashCode1 = test1.hashCode(); Assert.assertTrue(Integer.class.isInstance(hashCode1)); } @@ -432,6 +474,11 @@ public void toStringEqualsTest() { List testList = new ArrayList(); test1.setMediaUrls(testList); + + test1.setPhoneNumberId("TS"); + + test1.setApplicationId("TS"); + MessageResult test2 = new MessageResult(); test2.setUri("TS"); @@ -471,6 +518,10 @@ public void toStringEqualsTest() { List testList2 = testList; test2.setMediaUrls(testList2); + test2.setPhoneNumberId("TS"); + + test2.setApplicationId("TS"); + String toString1 = test1.toString(); String toString2 = test2.toString(); Assert.assertEquals(toString1, toString2); @@ -517,6 +568,11 @@ public void hashCodeEqualsTrueTest() { List testList = new ArrayList(); test1.setMediaUrls(testList); + + test1.setPhoneNumberId("TS"); + + test1.setApplicationId("TS"); + MessageResult test2 = new MessageResult(); test2.setUri("TS"); @@ -555,6 +611,11 @@ public void hashCodeEqualsTrueTest() { List testList2 = testList; test2.setMediaUrls(testList2); + + test2.setPhoneNumberId("TS"); + + test2.setApplicationId("TS"); + Assert.assertEquals(test1.hashCode(), test2.hashCode()); } @@ -599,6 +660,11 @@ public void hashCodeEqualsFalseTest() { List testList = new ArrayList(); test1.setMediaUrls(testList); + + test1.setPhoneNumberId("TS"); + + test1.setApplicationId("TS"); + MessageResult test2 = new MessageResult(); test2.setUri("TS2"); @@ -637,6 +703,11 @@ public void hashCodeEqualsFalseTest() { List testList2 = null; test2.setMediaUrls(testList2); + + test2.setPhoneNumberId("TS2"); + + test2.setApplicationId("TS2"); + Assert.assertNotEquals(test1.hashCode(), test2.hashCode()); } @@ -682,6 +753,10 @@ public void toStringTypeTest() { List testList = new ArrayList(); test1.setMediaUrls(testList); + test1.setPhoneNumberId("TS"); + + test1.setApplicationId("TS"); + String toString1 = test1.toString(); Assert.assertTrue(String.class.isInstance(toString1)); } diff --git a/src/test/java/com/github/freeclimbapi/models/PlayEarlyMediaTest.java b/src/test/java/com/github/freeclimbapi/models/PlayEarlyMediaTest.java index a889b307..654bb789 100644 --- a/src/test/java/com/github/freeclimbapi/models/PlayEarlyMediaTest.java +++ b/src/test/java/com/github/freeclimbapi/models/PlayEarlyMediaTest.java @@ -139,6 +139,6 @@ public void buildTest() throws Exception { Map> build = model.build(); Map attributes = build.get(model.getCommand()); - Assert.assertEquals(attributes.get("_file"), model.getFile()); + Assert.assertEquals(attributes.get("file"), model.getFile()); } } diff --git a/src/test/java/com/github/freeclimbapi/models/PlayTest.java b/src/test/java/com/github/freeclimbapi/models/PlayTest.java index 413fff57..f4e42dda 100644 --- a/src/test/java/com/github/freeclimbapi/models/PlayTest.java +++ b/src/test/java/com/github/freeclimbapi/models/PlayTest.java @@ -184,7 +184,7 @@ public void buildTest() throws Exception { model.setPrivacyMode(false); Map> build = model.build(); Map attributes = build.get(model.getCommand()); - Assert.assertEquals(attributes.get("_file"), model.getFile()); + Assert.assertEquals(attributes.get("file"), model.getFile()); Assert.assertEquals(attributes.get("loop"), model.getLoop()); Assert.assertEquals(attributes.get("privacyMode"), model.getPrivacyMode()); } diff --git a/src/test/java/com/github/freeclimbapi/models/TFNCampaignTest.java b/src/test/java/com/github/freeclimbapi/models/TFNCampaignTest.java new file mode 100644 index 00000000..fd9ccde2 --- /dev/null +++ b/src/test/java/com/github/freeclimbapi/models/TFNCampaignTest.java @@ -0,0 +1,388 @@ +/* + * FreeClimb API + * FreeClimb is a cloud-based application programming interface (API) that puts the power of the Vail platform in your hands. FreeClimb simplifies the process of creating applications that can use a full range of telephony features without requiring specialized or on-site telephony equipment. Using the FreeClimb REST API to write applications is easy! You have the option to use the language of your choice or hit the API directly. Your application can execute a command by issuing a RESTful request to the FreeClimb API. The base URL to send HTTP requests to the FreeClimb REST API is: /apiserver. FreeClimb authenticates and processes your request. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@freeclimb.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.github.freeclimbapi; + +import com.github.freeclimbapi.enums.*; +import com.github.freeclimbapi.models.*; +import java.util.*; +import org.junit.Assert; +import org.junit.Test; + +/** Model tests for TFNCampaign */ +public class TFNCampaignTest { + + private final TFNCampaign model = new TFNCampaign(); + + /** Test the property 'accountId' */ + @Test + public void accountIdTest() { + + model.setAccountId("TEST_STRING"); + Assert.assertEquals("TEST_STRING", model.getAccountId()); + } + + /** Test the property 'campaignId' */ + @Test + public void campaignIdTest() { + + model.setCampaignId("TEST_STRING"); + Assert.assertEquals("TEST_STRING", model.getCampaignId()); + } + + /** Test the property 'useCase' */ + @Test + public void useCaseTest() { + + model.setUseCase("TEST_STRING"); + Assert.assertEquals("TEST_STRING", model.getUseCase()); + } + + /** Test the property 'registrationStatus' */ + @Test + public void registrationStatusTest() { + model.setRegistrationStatus(SMSTollFreeCampaignRegistrationStatus.UNREGISTERED); + Assert.assertEquals( + model.getRegistrationStatus(), SMSTollFreeCampaignRegistrationStatus.UNREGISTERED); + model.setRegistrationStatus(SMSTollFreeCampaignRegistrationStatus.INITIATED); + Assert.assertEquals( + model.getRegistrationStatus(), SMSTollFreeCampaignRegistrationStatus.INITIATED); + model.setRegistrationStatus(SMSTollFreeCampaignRegistrationStatus.PENDING); + Assert.assertEquals( + model.getRegistrationStatus(), SMSTollFreeCampaignRegistrationStatus.PENDING); + model.setRegistrationStatus(SMSTollFreeCampaignRegistrationStatus.DECLINED); + Assert.assertEquals( + model.getRegistrationStatus(), SMSTollFreeCampaignRegistrationStatus.DECLINED); + model.setRegistrationStatus(SMSTollFreeCampaignRegistrationStatus.REGISTERED); + Assert.assertEquals( + model.getRegistrationStatus(), SMSTollFreeCampaignRegistrationStatus.REGISTERED); + } + + /** Test the property 'dateCreated' */ + @Test + public void dateCreatedTest() { + + model.setDateCreated("TEST_STRING"); + Assert.assertEquals("TEST_STRING", model.getDateCreated()); + } + + /** Test the property 'dateUpdated' */ + @Test + public void dateUpdatedTest() { + + model.setDateUpdated("TEST_STRING"); + Assert.assertEquals("TEST_STRING", model.getDateUpdated()); + } + + /** Test the property 'dateCreatedISO' */ + @Test + public void dateCreatedISOTest() { + + model.setDateCreatedISO("TEST_STRING"); + Assert.assertEquals("TEST_STRING", model.getDateCreatedISO()); + } + + /** Test the property 'dateUpdatedISO' */ + @Test + public void dateUpdatedISOTest() { + + model.setDateUpdatedISO("TEST_STRING"); + Assert.assertEquals("TEST_STRING", model.getDateUpdatedISO()); + } + + /** Test the property 'revision' */ + @Test + public void revisionTest() { + + model.setRevision(1); + Assert.assertEquals(1, (int) model.getRevision()); + } + + /** Test the method 'equalsTrue' */ + @Test + public void equalsTrueTest() { + TFNCampaign test1 = new TFNCampaign(); + + test1.setAccountId("TS"); + + test1.setCampaignId("TS"); + + test1.setUseCase("TS"); + + test1.setRegistrationStatus(SMSTollFreeCampaignRegistrationStatus.UNREGISTERED); + + test1.setDateCreated("TS"); + + test1.setDateUpdated("TS"); + + test1.setDateCreatedISO("TS"); + + test1.setDateUpdatedISO("TS"); + + test1.setRevision(1); + TFNCampaign test2 = new TFNCampaign(); + + test2.setAccountId("TS"); + + test2.setCampaignId("TS"); + + test2.setUseCase("TS"); + + test2.setRegistrationStatus(SMSTollFreeCampaignRegistrationStatus.UNREGISTERED); + + test2.setDateCreated("TS"); + + test2.setDateUpdated("TS"); + + test2.setDateCreatedISO("TS"); + + test2.setDateUpdatedISO("TS"); + + test2.setRevision(1); + + Assert.assertTrue(test1.equals(test2)); + } + + /** Test the method 'equalsFalse' */ + @Test + public void equalsFalseTest() { + TFNCampaign test1 = new TFNCampaign(); + + test1.setAccountId("TS"); + + test1.setCampaignId("TS"); + + test1.setUseCase("TS"); + + test1.setRegistrationStatus(SMSTollFreeCampaignRegistrationStatus.INITIATED); + + test1.setDateCreated("TS"); + + test1.setDateUpdated("TS"); + + test1.setDateCreatedISO("TS"); + + test1.setDateUpdatedISO("TS"); + + test1.setRevision(1); + TFNCampaign test2 = new TFNCampaign(); + + test2.setAccountId("TS2"); + + test2.setCampaignId("TS2"); + + test2.setUseCase("TS2"); + + test2.setRegistrationStatus(SMSTollFreeCampaignRegistrationStatus.UNREGISTERED); + + test2.setDateCreated("TS2"); + + test2.setDateUpdated("TS2"); + + test2.setDateCreatedISO("TS2"); + + test2.setDateUpdatedISO("TS2"); + + test2.setRevision(0); + + Assert.assertFalse(test1.equals(test2)); + } + + /** Test the method 'hashCodeType' */ + @Test + public void hashCodeTypeTest() { + TFNCampaign test1 = new TFNCampaign(); + + test1.setAccountId("TS"); + + test1.setCampaignId("TS"); + + test1.setUseCase("TS"); + + test1.setRegistrationStatus(SMSTollFreeCampaignRegistrationStatus.UNREGISTERED); + + test1.setDateCreated("TS"); + + test1.setDateUpdated("TS"); + + test1.setDateCreatedISO("TS"); + + test1.setDateUpdatedISO("TS"); + + test1.setRevision(1); + + int hashCode1 = test1.hashCode(); + Assert.assertTrue(Integer.class.isInstance(hashCode1)); + } + + /** Test the method 'toStringEquals' */ + @Test + public void toStringEqualsTest() { + TFNCampaign test1 = new TFNCampaign(); + + test1.setAccountId("TS"); + + test1.setCampaignId("TS"); + + test1.setUseCase("TS"); + + test1.setRegistrationStatus(SMSTollFreeCampaignRegistrationStatus.UNREGISTERED); + + test1.setDateCreated("TS"); + + test1.setDateUpdated("TS"); + + test1.setDateCreatedISO("TS"); + + test1.setDateUpdatedISO("TS"); + + test1.setRevision(1); + TFNCampaign test2 = new TFNCampaign(); + + test2.setAccountId("TS"); + + test2.setCampaignId("TS"); + + test2.setUseCase("TS"); + + test2.setRegistrationStatus(SMSTollFreeCampaignRegistrationStatus.UNREGISTERED); + + test2.setDateCreated("TS"); + + test2.setDateUpdated("TS"); + + test2.setDateCreatedISO("TS"); + + test2.setDateUpdatedISO("TS"); + + test2.setRevision(1); + + String toString1 = test1.toString(); + String toString2 = test2.toString(); + Assert.assertEquals(toString1, toString2); + } + + /** Test the method 'hashCodeEqualsTrue' */ + @Test + public void hashCodeEqualsTrueTest() { + TFNCampaign test1 = new TFNCampaign(); + + test1.setAccountId("TS"); + + test1.setCampaignId("TS"); + + test1.setUseCase("TS"); + + test1.setRegistrationStatus(SMSTollFreeCampaignRegistrationStatus.UNREGISTERED); + + test1.setDateCreated("TS"); + + test1.setDateUpdated("TS"); + + test1.setDateCreatedISO("TS"); + + test1.setDateUpdatedISO("TS"); + + test1.setRevision(1); + TFNCampaign test2 = new TFNCampaign(); + + test2.setAccountId("TS"); + + test2.setCampaignId("TS"); + + test2.setUseCase("TS"); + + test2.setRegistrationStatus(SMSTollFreeCampaignRegistrationStatus.UNREGISTERED); + + test2.setDateCreated("TS"); + + test2.setDateUpdated("TS"); + + test2.setDateCreatedISO("TS"); + + test2.setDateUpdatedISO("TS"); + + test2.setRevision(1); + Assert.assertEquals(test1.hashCode(), test2.hashCode()); + } + + /** Test the method 'hashCodeEqualsFalse' */ + @Test + public void hashCodeEqualsFalseTest() { + TFNCampaign test1 = new TFNCampaign(); + + test1.setAccountId("TS"); + + test1.setCampaignId("TS"); + + test1.setUseCase("TS"); + + test1.setRegistrationStatus(SMSTollFreeCampaignRegistrationStatus.INITIATED); + + test1.setDateCreated("TS"); + + test1.setDateUpdated("TS"); + + test1.setDateCreatedISO("TS"); + + test1.setDateUpdatedISO("TS"); + + test1.setRevision(1); + TFNCampaign test2 = new TFNCampaign(); + + test2.setAccountId("TS2"); + + test2.setCampaignId("TS2"); + + test2.setUseCase("TS2"); + + test2.setRegistrationStatus(SMSTollFreeCampaignRegistrationStatus.UNREGISTERED); + + test2.setDateCreated("TS2"); + + test2.setDateUpdated("TS2"); + + test2.setDateCreatedISO("TS2"); + + test2.setDateUpdatedISO("TS2"); + + test2.setRevision(0); + Assert.assertNotEquals(test1.hashCode(), test2.hashCode()); + } + + /** Test the method 'toStringType' */ + @Test + public void toStringTypeTest() { + TFNCampaign test1 = new TFNCampaign(); + + test1.setAccountId("TS"); + + test1.setCampaignId("TS"); + + test1.setUseCase("TS"); + + test1.setRegistrationStatus(SMSTollFreeCampaignRegistrationStatus.UNREGISTERED); + + test1.setDateCreated("TS"); + + test1.setDateUpdated("TS"); + + test1.setDateCreatedISO("TS"); + + test1.setDateUpdatedISO("TS"); + + test1.setRevision(1); + + String toString1 = test1.toString(); + Assert.assertTrue(String.class.isInstance(toString1)); + } +}