Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding logging to save others in the future #1055

Merged
merged 2 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

import gov.hhs.cdc.trustedintermediary.etor.RSEndpointClient;
import gov.hhs.cdc.trustedintermediary.external.reportstream.ReportStreamEndpointClientException;
import gov.hhs.cdc.trustedintermediary.wrappers.Logger;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.UUID;
import javax.inject.Inject;

/**
* A mock implementation of the RSEndpointClient interface that doesn't require a connection to
Expand All @@ -18,6 +20,8 @@ public class MockRSEndpointClient implements RSEndpointClient {

private static final MockRSEndpointClient INSTANCE = new MockRSEndpointClient();

@Inject Logger logger;

public static MockRSEndpointClient getInstance() {
return INSTANCE;
}
Expand All @@ -38,6 +42,10 @@ public String requestWatersEndpoint(String body, String bearerToken)
} catch (IOException e) {
throw new ReportStreamEndpointClientException("Error writing the lab order", e);
}

logger.logWarning(
"!@#$%^&*() THE BELOW REPORT ID is RaNdOmLy generated and will not populate into report stream !@#$%^&*()");

return "{ \"reportId\": \"" + UUID.randomUUID() + "\" }";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ class MockRSEndpointClientTest extends Specification {
def setup() {
TestApplicationContext.reset()
TestApplicationContext.init()
TestApplicationContext.register(MockRSEndpointClient, MockRSEndpointClient.getInstance())
TestApplicationContext.injectRegisteredImplementations()
}

def cleanup() {
Expand Down
Loading