Skip to content

Commit

Permalink
updated pom.xml and bumped servlet versions
Browse files Browse the repository at this point in the history
all written tests passing, tests added to Jakarta build as well.
  • Loading branch information
matthewtanner91 committed Mar 1, 2024
1 parent 1c204ed commit dee3d6f
Show file tree
Hide file tree
Showing 11 changed files with 77 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<dependency>
<groupId>com.moesif.servlet</groupId>
<artifactId>moesif-servlet-jakarta</artifactId>
<version>2.1.2</version>
<version>2.2.0</version>
</dependency>
</dependencies>

Expand Down
2 changes: 1 addition & 1 deletion jersey-servlet-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
<dependency>
<groupId>com.moesif.servlet</groupId>
<artifactId>moesif-servlet</artifactId>
<version>1.7.11</version>
<version>1.8.0</version>
</dependency>

<dependency>
Expand Down
4 changes: 2 additions & 2 deletions moesif-servlet-jakarta/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.moesif.servlet</groupId>
<artifactId>moesif-servlet-jakarta</artifactId>
<version>2.1.2</version>
<version>2.2.0</version>
<packaging>jar</packaging>
<name>moesif-servlet-jakarta</name>
<description>Moesif SDK for Java Servlet to log and analyze API calls using Jakarta</description>
Expand Down Expand Up @@ -52,7 +52,7 @@
<dependency>
<groupId>com.moesif.api</groupId>
<artifactId>moesifapi</artifactId>
<version>1.7.7</version>
<version>1.8.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
}

}
4 changes: 2 additions & 2 deletions moesif-servlet/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.moesif.servlet</groupId>
<artifactId>moesif-servlet</artifactId>
<version>1.7.11</version>
<version>1.8.0</version>
<packaging>jar</packaging>
<name>moesif-servlet</name>
<description>Moesif SDK for Java Servlet to log and analyze API calls</description>
Expand Down Expand Up @@ -57,7 +57,7 @@
<dependency>
<groupId>com.moesif.api</groupId>
<artifactId>moesifapi</artifactId>
<version>1.7.7</version>
<version>1.8.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
Expand Down
4 changes: 2 additions & 2 deletions moesif-springrequest/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.moesif.springrequest</groupId>
<artifactId>moesif-springrequest</artifactId>
<version>1.1.2</version>
<version>1.2.0</version>
<packaging>jar</packaging>
<name>moesif-springrequest</name>
<description>Moesif SDK for Java to log and analyze outgoing API calls</description>
Expand Down Expand Up @@ -55,7 +55,7 @@
<dependency>
<groupId>com.moesif.api</groupId>
<artifactId>moesifapi</artifactId>
<version>1.7.7</version>
<version>1.8.0</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
Expand Down
2 changes: 1 addition & 1 deletion servlet-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<dependency>
<groupId>com.moesif.servlet</groupId>
<artifactId>moesif-servlet</artifactId>
<version>1.7.11</version>
<version>1.8.0</version>
</dependency>
</dependencies>

Expand Down
2 changes: 1 addition & 1 deletion spark-servlet-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
<dependency>
<groupId>com.moesif.servlet</groupId>
<artifactId>moesif-servlet</artifactId>
<version>1.7.11</version>
<version>1.8.0</version>
</dependency>
<!--
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion spring-boot-servlet-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<dependency>
<groupId>com.moesif.servlet</groupId>
<artifactId>moesif-servlet</artifactId>
<version>1.7.11</version>
<version>1.8.0</version>
</dependency>


Expand Down
2 changes: 1 addition & 1 deletion spring-boot-starter-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<dependency>
<groupId>com.moesif.servlet</groupId>
<artifactId>moesif-servlet</artifactId>
<version>1.7.11</version>
<version>1.8.0</version>
</dependency>
</dependencies>

Expand Down
2 changes: 1 addition & 1 deletion springrequest-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<dependency>
<groupId>com.moesif.springrequest</groupId>
<artifactId>moesif-springrequest</artifactId>
<version>1.1.2</version>
<version>1.2.0</version>
</dependency>

<dependency>
Expand Down

0 comments on commit dee3d6f

Please sign in to comment.