-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated pom.xml and bumped servlet versions
all written tests passing, tests added to Jakarta build as well.
- Loading branch information
1 parent
1c204ed
commit dee3d6f
Showing
11 changed files
with
77 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,8 @@ | |
import com.moesif.api.models.CampaignModel; | ||
import com.moesif.api.models.CampaignBuilder; | ||
import static org.mockito.Mockito.when; | ||
import com.moesif.api.models.SubscriptionBuilder; | ||
import com.moesif.api.models.SubscriptionModel; | ||
|
||
|
||
public class MoesifServletTests extends TestCase { | ||
|
@@ -241,5 +243,67 @@ public void testUpdateCompaniesBatch() throws Throwable { | |
filter.updateCompaniesBatch(companies); | ||
} | ||
|
||
public void testUpdateSubscription() throws Throwable { | ||
|
||
// Only subscriptionId is required | ||
// metadata can be any custom object | ||
SubscriptionModel subscription = new SubscriptionBuilder() | ||
.subscriptionId("sub_12345") | ||
.companyId("67890") | ||
.currentPeriodStart(new Date()) | ||
.currentPeriodEnd(new Date()) | ||
.status("active") | ||
.metadata(APIHelper.deserialize("{" + | ||
"\"email\": \"[email protected]\"," + | ||
"\"string_field\": \"value_1\"," + | ||
"\"number_field\": 0," + | ||
"\"object_field\": {" + | ||
"\"field_1\": \"value_1\"," + | ||
"\"field_2\": \"value_2\"" + | ||
"}" + | ||
"}")) | ||
.build(); | ||
|
||
filter.updateSubscription(subscription); | ||
} | ||
|
||
public void testUpdateSubscriptionsBatch() throws Throwable { | ||
|
||
List<SubscriptionModel> subscriptions = new ArrayList<SubscriptionModel>(); | ||
|
||
HashMap<String, Object> metadata = new HashMap<String, Object>(); | ||
metadata = APIHelper.deserialize("{" + | ||
"\"email\": \"[email protected]\"," + | ||
"\"string_field\": \"value_1\"," + | ||
"\"number_field\": 0," + | ||
"\"object_field\": {" + | ||
"\"field_1\": \"value_1\"," + | ||
"\"field_2\": \"value_2\"" + | ||
"}" + | ||
"}"); | ||
|
||
SubscriptionModel subscriptionA = new SubscriptionBuilder() | ||
.subscriptionId("sub_12345") | ||
.companyId("67890") | ||
.currentPeriodStart(new Date()) | ||
.currentPeriodEnd(new Date()) | ||
.status("active") | ||
.metadata(metadata) | ||
.build(); | ||
|
||
SubscriptionModel subscriptionB = new SubscriptionBuilder() | ||
.subscriptionId("sub_67890") | ||
.companyId("12345") | ||
.currentPeriodStart(new Date()) | ||
.currentPeriodEnd(new Date()) | ||
.status("active") | ||
.metadata(metadata) | ||
.build(); | ||
|
||
subscriptions.add(subscriptionA); | ||
subscriptions.add(subscriptionB); | ||
|
||
filter.updateSubscriptionsBatch(subscriptions); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters