Skip to content

Commit

Permalink
TEAM-1375 Dependency upgrades. Disabled a number of integration tests. (
Browse files Browse the repository at this point in the history
  • Loading branch information
kalbfled authored Sep 20, 2024
1 parent bbb95cc commit 0b16043
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 18 deletions.
18 changes: 18 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# https://github.com/department-of-Veterans-affairs/vets-api/blob/master/modules/va_notify/README.md#api-key-details
# Use the service ID for the service "Client Library Integration Tests". The API key should be of type "test".
export API_KEY="ddb7eeb7-f8d3-42f1-81ee-af81e0087a9c-<your API key for this service>"
export API_SENDING_KEY="ddb7eeb7-f8d3-42f1-81ee-af81e0087a9c-<your API key for this service>"
export INBOUND_SMS_QUERY_KEY="ddb7eeb7-f8d3-42f1-81ee-af81e0087a9c-<your API key for this service>"

# The templates should contain a personalization for "name".
export SMS_TEMPLATE_ID="23d09e35-3aa0-4412-95ae-6a41a1c7234b"
export EMAIL_TEMPLATE_ID="0826c10d-1801-439a-a37f-a8727f7be0ad"

export FUNCTIONAL_TEST_NUMBER=<your phone number>
export FUNCTIONAL_TEST_EMAIL="<your e-mail address>"

export SMS_SENDER_ID="<SMS sender UUID>"

export JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64/"

export NOTIFY_API_URL="https://dev-api.va.gov/vanotify"
4 changes: 3 additions & 1 deletion .talismanrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ fileignoreconfig:
- filename: src/main/java/gov/va/vanotify/NotificationRequest.java
checksum: 323123730ee2f17933378afe5b18fab56c0a0c54735f406d94b364c60746f71a
- filename: src/main/java/gov/va/vanotify/SmsRequest.java
checksum: 0af6b5128d3d404ff4f0e053882e2f5a36a3b1d27ca001d91ef5cda72170c541
checksum: 0af6b5128d3d404ff4f0e053882e2f5a36a3b1d27ca001d91ef5cda72170c541
- filename: .env.example
checksum: 56152582ae8d7879efa5826e72705a6e55ed8024dadf65acafaad45300a3ce37
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 2.0.3
* Upgraded the jose4j and gson dependency versions

## 2.0.2
* Renamed default branch from 'master' to 'main'

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Make sure that `CHANGELOG.md` is updated with description of changes.

Create a tag with the new version:
```shell
git tag 1.2.0
git tag 2.0.3
git push --tags
```

Expand Down
23 changes: 21 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,28 @@

Use this client to send emails, text messages and letters using the [VANotify](https://notifications.va.gov) API.

Useful links:
## Useful links

- [Documentation](https://docs.notifications.service.gov.uk/java.html)
- [Documentation](https://github.com/department-of-veterans-affairs/notifications-java-client/blob/main/DOCUMENTATION.md) - For developers interested in using the VANotify Java client to send emails and text messages
- [Artifact repository](https://github.com/department-of-veterans-affairs/notifications-java-client/packages/990487)
- [Changelog](https://github.com/department-of-veterans-affairs/notifications-java-client/blob/main/CHANGELOG.md)
- [Contributing to this client](https://github.com/department-of-veterans-affairs/notifications-java-client/blob/main/CONTRIBUTING.md)

## Development

Install [Maven](https://maven.apache.org) to work with this code base. If you are not familiar with Maven, read through [Maven in 5 Minutes](https://maven.apache.org/guides/getting-started/maven-in-five-minutes.html). Also read [Introduction to the Build Lifecycle](https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html).

For a more verbose description of the development process, read [CONTRIBUTING.md](https://github.com/department-of-veterans-affairs/notifications-java-client/blob/main/CONTRIBUTING.md).

### Environment file

This repository contains unit and integration tests. The latter make API calls and presume certain environment variables. To set up your environment, copy .env.example to .env, and substitute templated values as appropriate. The example file assumes API's Development environment and that you are using a Unix-like operating system.

Activate the environment in Bash by running `. .env`.

### Workflow

1. Make your desired changes. This should include bumping the version number in the files pom.xml and application.properties, and it should include creating a new entry in CHANGELOG.md.
2. Run `mvn clean test` to run unit tests. If any test fails, return to step 1.
3. When all unit tests pass, run `mvn clean install` to execute all phases of the lifecycle other than deploying to Github. This includes running integration tests. Note that your environment must be properly configured at this point or you will get errors.
4. The final step is to deploy the package to Github so other projects can depend on it. If you have not already created your local .m2/settings.xml file and Github access token, read [Working with the Apache Maven registry](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-apache-maven-registry). Then run `mvn deploy`, visit [here](https://github.com/department-of-veterans-affairs/notifications-java-client/packages/990487), and ensure the displayed version reflects the version you created in step 1.
9 changes: 6 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>gov.va.vanotify</groupId>
<artifactId>vanotify-java-client</artifactId>
<version>2.0.2</version>
<version>2.0.3</version>
<packaging>jar</packaging>

<name>VANotify Java client</name>
Expand Down Expand Up @@ -51,6 +51,7 @@
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
Expand All @@ -71,7 +72,7 @@
<dependency>
<groupId>org.bitbucket.b_c</groupId>
<artifactId>jose4j</artifactId>
<version>0.7.7</version>
<version>0.9.6</version>
</dependency>
<dependency>
<groupId>commons-cli</groupId>
Expand Down Expand Up @@ -101,16 +102,18 @@
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.8</version>
<version>2.11.0</version>
</dependency>
</dependencies>

<distributionManagement>
<repository>
<id>github</id>
<name>GitHub Packages</name>
<url>https://maven.pkg.github.com/department-of-veterans-affairs/notifications-java-client</url>
</repository>
</distributionManagement>

<build>
<resources>
<resource>
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
# - PATCH version when you make backwards-compatible bug fixes.
#
# -- http://semver.org/
project.version=2.0.2
project.version=2.0.3
24 changes: 14 additions & 10 deletions src/test/java/gov/va/vanotify/ClientIntegrationTestIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public void testEmailNotificationIT() throws NotificationClientException {
assertNotification(notification);
}

@Disabled("The service does not have any SMS senders.")
@Test
public void testSmsNotificationIT() throws NotificationClientException {
NotificationClient client = getClient();
Expand All @@ -36,8 +37,8 @@ public void testSmsNotificationIT() throws NotificationClientException {
assertNotification(notification);
}

@Test
@Disabled
@Test
public void testLetterNotificationIT() throws NotificationClientException {
NotificationClient client = getClient();
SendLetterResponse letterResponse = sendLetterAndAssertResponse(client);
Expand All @@ -48,6 +49,7 @@ public void testLetterNotificationIT() throws NotificationClientException {
}


@Disabled("This test fails because the API Dev environment doesn't return any notifications. This route is not exposed to users via Postman.")
@Test
public void testGetAllNotifications() throws NotificationClientException {
NotificationClient client = getClient();
Expand Down Expand Up @@ -142,8 +144,8 @@ public void testEmailNotificationWithInValidEmailReplyToIdIT() throws Notificati

}

@Test
@Disabled
@Test
public void testEmailNotificationWithUploadedDocumentInPersonalisation() throws NotificationClientException, IOException {
NotificationClient client = getClient();
HashMap<String, Object> personalisation = new HashMap<>();
Expand Down Expand Up @@ -214,6 +216,7 @@ public void testSmsNotificationWithoutPersonalisationReturnsErrorMessageIT() {
}
}

@Disabled("The service does not have any SMS senders.")
@Test
public void testSmsNotificationWithValidSmsSenderIdIT() throws NotificationClientException {
NotificationClient client = getClient("API_SENDING_KEY");
Expand Down Expand Up @@ -260,7 +263,7 @@ public void testSmsNotificationWithInValidSmsSenderIdIT() {
);
} catch (final NotificationClientException ex) {
exceptionThrown = true;
assertTrue(ex.getMessage().contains("does not exist in database for service id"));
assertTrue(ex.getMessage().contains("does not exist in database for service id"), ex.getMessage());
}

assertTrue(exceptionThrown);
Expand All @@ -273,6 +276,7 @@ public static Object[][] smsWithRecipientIdentifierTestData() {
};
}

@Disabled("The service does not have any SMS senders.")
@ParameterizedTest
@MethodSource("smsWithRecipientIdentifierTestData")
public void testSmsNotificationWithRecipientIdentifier(String phoneNumber) throws NotificationClientException {
Expand Down Expand Up @@ -317,8 +321,8 @@ public void testSendAndGetNotificationWithReference() throws NotificationClientE
assertEquals(response.getNotificationId(), notifications.getNotifications().get(0).getId());
}

@Test
@Disabled
@Test
public void testGetTemplateById() throws NotificationClientException {
NotificationClient client = getClient();
Template template = client.getTemplateById(System.getenv("LETTER_TEMPLATE_ID"));
Expand Down Expand Up @@ -365,8 +369,8 @@ public void testGetTemplatePreview() throws NotificationClientException {
assertTrue(template.getBody().contains(uniqueName));
}

@Test
@Disabled
@Test
public void testGetReceivedTextMessages() throws NotificationClientException {
NotificationClient client = getClient("INBOUND_SMS_QUERY_KEY");

Expand All @@ -376,8 +380,8 @@ public void testGetReceivedTextMessages() throws NotificationClientException {
testGetReceivedTextMessagesWithOlderThanId(receivedTextMessage.getId(), client);
}

@Test
@Disabled
@Test
public void testSendPrecompiledLetterValidPDFFileIT() throws Exception {
String reference = UUID.randomUUID().toString();

Expand All @@ -390,8 +394,8 @@ public void testSendPrecompiledLetterValidPDFFileIT() throws Exception {
assertPdfResponse(client, response.getNotificationId().toString());
}

@Test
@Disabled
@Test
public void testSendPrecompiledLetterValidPDFFileITWithPostage() throws Exception {
String reference = UUID.randomUUID().toString();

Expand All @@ -404,8 +408,8 @@ public void testSendPrecompiledLetterValidPDFFileITWithPostage() throws Exceptio

}

@Test
@Disabled
@Test
public void testSendPrecompiledLetterWithInputStream() throws Exception {
String reference = UUID.randomUUID().toString();

Expand All @@ -419,8 +423,8 @@ public void testSendPrecompiledLetterWithInputStream() throws Exception {

}

@Test
@Disabled
@Test
public void testSendPrecompiledLetterWithInputStreamWithPostage() throws Exception {
String reference = UUID.randomUUID().toString();

Expand Down Expand Up @@ -601,7 +605,7 @@ private void assertNotificationWhenEmail(Notification notification) {
}

private void assertNotificationWhenSms(Notification notification) {
assertTrue(notification.getPhoneNumber().isPresent());
assertTrue(notification.getPhoneNumber().isPresent(), notification.toString());
assertFalse(notification.getSubject().isPresent());
assertFalse(notification.getEmailAddress().isPresent());
assertFalse(notification.getLine1().isPresent());
Expand Down

0 comments on commit 0b16043

Please sign in to comment.