diff --git a/app/src/main/java/gov/hhs/cdc/trustedintermediary/external/javalin/App.java b/app/src/main/java/gov/hhs/cdc/trustedintermediary/external/javalin/App.java index 22be3e584..ae2952487 100644 --- a/app/src/main/java/gov/hhs/cdc/trustedintermediary/external/javalin/App.java +++ b/app/src/main/java/gov/hhs/cdc/trustedintermediary/external/javalin/App.java @@ -10,7 +10,7 @@ import gov.hhs.cdc.trustedintermediary.external.azure.AzureSecrets; import gov.hhs.cdc.trustedintermediary.external.hapi.HapiFhirImplementation; import gov.hhs.cdc.trustedintermediary.external.inmemory.KeyCache; -import gov.hhs.cdc.trustedintermediary.external.inmemory.LoggingMetricMetaData; +import gov.hhs.cdc.trustedintermediary.external.inmemory.LoggingMetricMetadata; import gov.hhs.cdc.trustedintermediary.external.jackson.Jackson; import gov.hhs.cdc.trustedintermediary.external.jjwt.JjwtEngine; import gov.hhs.cdc.trustedintermediary.external.localfile.LocalSecrets; @@ -22,7 +22,7 @@ import gov.hhs.cdc.trustedintermediary.wrappers.HapiFhir; import gov.hhs.cdc.trustedintermediary.wrappers.HttpClient; import gov.hhs.cdc.trustedintermediary.wrappers.Logger; -import gov.hhs.cdc.trustedintermediary.wrappers.MetricMetaData; +import gov.hhs.cdc.trustedintermediary.wrappers.MetricMetadata; import gov.hhs.cdc.trustedintermediary.wrappers.Secrets; import gov.hhs.cdc.trustedintermediary.wrappers.YamlCombiner; import gov.hhs.cdc.trustedintermediary.wrappers.formatter.Formatter; @@ -86,6 +86,6 @@ private static void registerClasses() { : AzureSecrets.getInstance()); ApplicationContext.register( OrganizationsSettings.class, OrganizationsSettings.getInstance()); - ApplicationContext.register(MetricMetaData.class, LoggingMetricMetaData.getInstance()); + ApplicationContext.register(MetricMetadata.class, LoggingMetricMetadata.getInstance()); } } diff --git a/etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/metadata/EtorMetaDataStep.java b/etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/metadata/EtorMetadataStep.java similarity index 89% rename from etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/metadata/EtorMetaDataStep.java rename to etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/metadata/EtorMetadataStep.java index 55c1950eb..267d3d188 100644 --- a/etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/metadata/EtorMetaDataStep.java +++ b/etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/metadata/EtorMetadataStep.java @@ -1,7 +1,7 @@ package gov.hhs.cdc.trustedintermediary.etor.metadata; /** Etor specific steps from the general shared metadata steps */ -public enum EtorMetaDataStep { +public enum EtorMetadataStep { RECEIVED_FROM_REPORT_STREAM, ORDER_CONVERTED_TO_OML, diff --git a/etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/orders/OrderController.java b/etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/orders/OrderController.java index 71ea436a6..a070d0c6a 100644 --- a/etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/orders/OrderController.java +++ b/etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/orders/OrderController.java @@ -1,12 +1,12 @@ package gov.hhs.cdc.trustedintermediary.etor.orders; import gov.hhs.cdc.trustedintermediary.domainconnector.DomainRequest; -import gov.hhs.cdc.trustedintermediary.etor.metadata.EtorMetaDataStep; +import gov.hhs.cdc.trustedintermediary.etor.metadata.EtorMetadataStep; import gov.hhs.cdc.trustedintermediary.external.hapi.HapiOrder; import gov.hhs.cdc.trustedintermediary.wrappers.FhirParseException; import gov.hhs.cdc.trustedintermediary.wrappers.HapiFhir; import gov.hhs.cdc.trustedintermediary.wrappers.Logger; -import gov.hhs.cdc.trustedintermediary.wrappers.MetricMetaData; +import gov.hhs.cdc.trustedintermediary.wrappers.MetricMetadata; import javax.inject.Inject; import org.hl7.fhir.r4.model.Bundle; @@ -17,7 +17,7 @@ public class OrderController { @Inject HapiFhir fhir; @Inject Logger logger; - @Inject MetricMetaData metaData; + @Inject MetricMetadata metadata; private OrderController() {} @@ -28,7 +28,7 @@ public static OrderController getInstance() { public Order parseOrders(DomainRequest request) throws FhirParseException { logger.logInfo("Parsing orders"); var fhirBundle = fhir.parseResource(request.getBody(), Bundle.class); - metaData.put(fhirBundle.getId(), EtorMetaDataStep.RECEIVED_FROM_REPORT_STREAM); + metadata.put(fhirBundle.getId(), EtorMetadataStep.RECEIVED_FROM_REPORT_STREAM); return new HapiOrder(fhirBundle); } } diff --git a/etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/orders/SendOrderUseCase.java b/etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/orders/SendOrderUseCase.java index 3add71f22..6ba944f44 100644 --- a/etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/orders/SendOrderUseCase.java +++ b/etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/orders/SendOrderUseCase.java @@ -1,9 +1,9 @@ package gov.hhs.cdc.trustedintermediary.etor.orders; -import gov.hhs.cdc.trustedintermediary.etor.metadata.EtorMetaDataStep; +import gov.hhs.cdc.trustedintermediary.etor.metadata.EtorMetadataStep; import gov.hhs.cdc.trustedintermediary.etor.metadata.PartnerMetadata; import gov.hhs.cdc.trustedintermediary.etor.metadata.PartnerMetadataStorage; -import gov.hhs.cdc.trustedintermediary.wrappers.MetricMetaData; +import gov.hhs.cdc.trustedintermediary.wrappers.MetricMetadata; import java.time.Instant; import javax.inject.Inject; @@ -12,7 +12,7 @@ public class SendOrderUseCase { private static final SendOrderUseCase INSTANCE = new SendOrderUseCase(); @Inject OrderConverter converter; @Inject OrderSender sender; - @Inject MetricMetaData metaData; + @Inject MetricMetadata metadata; @Inject PartnerMetadataStorage partnerMetadataStorage; private SendOrderUseCase() {} @@ -28,9 +28,9 @@ public void convertAndSend(final Order order) throws UnableToSendOrderExcepti partnerMetadataStorage.saveMetadata(partnerMetadata); var omlOrder = converter.convertMetadataToOmlOrder(order); - metaData.put(order.getFhirResourceId(), EtorMetaDataStep.ORDER_CONVERTED_TO_OML); + metadata.put(order.getFhirResourceId(), EtorMetadataStep.ORDER_CONVERTED_TO_OML); omlOrder = converter.addContactSectionToPatientResource(omlOrder); - metaData.put(order.getFhirResourceId(), EtorMetaDataStep.CONTACT_SECTION_ADDED_TO_PATIENT); + metadata.put(order.getFhirResourceId(), EtorMetadataStep.CONTACT_SECTION_ADDED_TO_PATIENT); sender.sendOrder(omlOrder); } } diff --git a/etor/src/main/java/gov/hhs/cdc/trustedintermediary/external/localfile/LocalFileOrderSender.java b/etor/src/main/java/gov/hhs/cdc/trustedintermediary/external/localfile/LocalFileOrderSender.java index 6c7108b39..b39327065 100644 --- a/etor/src/main/java/gov/hhs/cdc/trustedintermediary/external/localfile/LocalFileOrderSender.java +++ b/etor/src/main/java/gov/hhs/cdc/trustedintermediary/external/localfile/LocalFileOrderSender.java @@ -1,12 +1,12 @@ package gov.hhs.cdc.trustedintermediary.external.localfile; -import gov.hhs.cdc.trustedintermediary.etor.metadata.EtorMetaDataStep; +import gov.hhs.cdc.trustedintermediary.etor.metadata.EtorMetadataStep; import gov.hhs.cdc.trustedintermediary.etor.orders.Order; import gov.hhs.cdc.trustedintermediary.etor.orders.OrderSender; import gov.hhs.cdc.trustedintermediary.etor.orders.UnableToSendOrderException; import gov.hhs.cdc.trustedintermediary.wrappers.HapiFhir; import gov.hhs.cdc.trustedintermediary.wrappers.Logger; -import gov.hhs.cdc.trustedintermediary.wrappers.MetricMetaData; +import gov.hhs.cdc.trustedintermediary.wrappers.MetricMetadata; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Paths; @@ -21,7 +21,7 @@ public class LocalFileOrderSender implements OrderSender { @Inject HapiFhir fhir; @Inject Logger logger; - @Inject MetricMetaData metaData; + @Inject MetricMetadata metadata; public static LocalFileOrderSender getInstance() { return INSTANCE; @@ -35,7 +35,7 @@ public void sendOrder(final Order order) throws UnableToSendOrderException { logger.logInfo("Sending the order to the hard drive at {}", fileLocation.toAbsolutePath()); try { - metaData.put(order.getFhirResourceId(), EtorMetaDataStep.SENT_TO_REPORT_STREAM); + metadata.put(order.getFhirResourceId(), EtorMetadataStep.SENT_TO_REPORT_STREAM); String serialized = fhir.encodeResourceToJson(order.getUnderlyingOrder()); Files.writeString(fileLocation, serialized, StandardCharsets.UTF_8); } catch (Exception e) { diff --git a/etor/src/main/java/gov/hhs/cdc/trustedintermediary/external/reportstream/ReportStreamOrderSender.java b/etor/src/main/java/gov/hhs/cdc/trustedintermediary/external/reportstream/ReportStreamOrderSender.java index db41308bb..53f96af2e 100644 --- a/etor/src/main/java/gov/hhs/cdc/trustedintermediary/external/reportstream/ReportStreamOrderSender.java +++ b/etor/src/main/java/gov/hhs/cdc/trustedintermediary/external/reportstream/ReportStreamOrderSender.java @@ -1,7 +1,7 @@ package gov.hhs.cdc.trustedintermediary.external.reportstream; import gov.hhs.cdc.trustedintermediary.context.ApplicationContext; -import gov.hhs.cdc.trustedintermediary.etor.metadata.EtorMetaDataStep; +import gov.hhs.cdc.trustedintermediary.etor.metadata.EtorMetadataStep; import gov.hhs.cdc.trustedintermediary.etor.orders.Order; import gov.hhs.cdc.trustedintermediary.etor.orders.OrderSender; import gov.hhs.cdc.trustedintermediary.etor.orders.UnableToSendOrderException; @@ -11,7 +11,7 @@ import gov.hhs.cdc.trustedintermediary.wrappers.HttpClient; import gov.hhs.cdc.trustedintermediary.wrappers.HttpClientException; import gov.hhs.cdc.trustedintermediary.wrappers.Logger; -import gov.hhs.cdc.trustedintermediary.wrappers.MetricMetaData; +import gov.hhs.cdc.trustedintermediary.wrappers.MetricMetadata; import gov.hhs.cdc.trustedintermediary.wrappers.SecretRetrievalException; import gov.hhs.cdc.trustedintermediary.wrappers.Secrets; import gov.hhs.cdc.trustedintermediary.wrappers.formatter.Formatter; @@ -55,7 +55,7 @@ public class ReportStreamOrderSender implements OrderSender { @Inject private Secrets secrets; @Inject private Cache cache; - @Inject MetricMetaData metaData; + @Inject MetricMetadata metadata; public static ReportStreamOrderSender getInstance() { return INSTANCE; @@ -70,7 +70,7 @@ public void sendOrder(final Order order) throws UnableToSendOrderException { String bearerToken = getRsToken(); String rsResponseBody = sendRequestBody(json, bearerToken); logRsSubmissionId(rsResponseBody); - metaData.put(order.getFhirResourceId(), EtorMetaDataStep.SENT_TO_REPORT_STREAM); + metadata.put(order.getFhirResourceId(), EtorMetadataStep.SENT_TO_REPORT_STREAM); } protected void logRsSubmissionId(String rsResponseBody) { diff --git a/etor/src/test/groovy/gov/hhs/cdc/trustedintermediary/etor/orders/OrderControllerTest.groovy b/etor/src/test/groovy/gov/hhs/cdc/trustedintermediary/etor/orders/OrderControllerTest.groovy index 9886d3d4a..4407c3c7f 100644 --- a/etor/src/test/groovy/gov/hhs/cdc/trustedintermediary/etor/orders/OrderControllerTest.groovy +++ b/etor/src/test/groovy/gov/hhs/cdc/trustedintermediary/etor/orders/OrderControllerTest.groovy @@ -2,10 +2,10 @@ package gov.hhs.cdc.trustedintermediary.etor.orders import gov.hhs.cdc.trustedintermediary.context.TestApplicationContext import gov.hhs.cdc.trustedintermediary.domainconnector.DomainRequest -import gov.hhs.cdc.trustedintermediary.etor.metadata.EtorMetaDataStep +import gov.hhs.cdc.trustedintermediary.etor.metadata.EtorMetadataStep import gov.hhs.cdc.trustedintermediary.wrappers.FhirParseException import gov.hhs.cdc.trustedintermediary.wrappers.HapiFhir -import gov.hhs.cdc.trustedintermediary.wrappers.MetricMetaData +import gov.hhs.cdc.trustedintermediary.wrappers.MetricMetadata import org.hl7.fhir.r4.model.Bundle import spock.lang.Specification @@ -15,7 +15,7 @@ class OrderControllerTest extends Specification { TestApplicationContext.reset() TestApplicationContext.init() TestApplicationContext.register(OrderController, OrderController.getInstance()) - TestApplicationContext.register(MetricMetaData, Mock(MetricMetaData)) + TestApplicationContext.register(MetricMetadata, Mock(MetricMetadata)) } def "parseOrders happy path works"() { @@ -47,7 +47,7 @@ class OrderControllerTest extends Specification { OrderController.getInstance().parseOrders(new DomainRequest()) then: - 1 * OrderController.getInstance().metaData.put(_, EtorMetaDataStep.RECEIVED_FROM_REPORT_STREAM) + 1 * OrderController.getInstance().metadata.put(_, EtorMetadataStep.RECEIVED_FROM_REPORT_STREAM) } def "parseOrders throws an exception when unable to parse de request"() { diff --git a/etor/src/test/groovy/gov/hhs/cdc/trustedintermediary/etor/orders/SendOrderUsecaseTest.groovy b/etor/src/test/groovy/gov/hhs/cdc/trustedintermediary/etor/orders/SendOrderUsecaseTest.groovy index 483a05f3b..ff876d138 100644 --- a/etor/src/test/groovy/gov/hhs/cdc/trustedintermediary/etor/orders/SendOrderUsecaseTest.groovy +++ b/etor/src/test/groovy/gov/hhs/cdc/trustedintermediary/etor/orders/SendOrderUsecaseTest.groovy @@ -2,9 +2,9 @@ package gov.hhs.cdc.trustedintermediary.etor.orders import gov.hhs.cdc.trustedintermediary.OrderMock import gov.hhs.cdc.trustedintermediary.context.TestApplicationContext -import gov.hhs.cdc.trustedintermediary.etor.metadata.EtorMetaDataStep +import gov.hhs.cdc.trustedintermediary.etor.metadata.EtorMetadataStep import gov.hhs.cdc.trustedintermediary.etor.metadata.PartnerMetadataStorage -import gov.hhs.cdc.trustedintermediary.wrappers.MetricMetaData +import gov.hhs.cdc.trustedintermediary.wrappers.MetricMetadata import spock.lang.Specification class SendOrderUsecaseTest extends Specification { @@ -13,7 +13,7 @@ class SendOrderUsecaseTest extends Specification { TestApplicationContext.reset() TestApplicationContext.init() TestApplicationContext.register(SendOrderUseCase, SendOrderUseCase.getInstance()) - TestApplicationContext.register(MetricMetaData, Mock(MetricMetaData)) + TestApplicationContext.register(MetricMetadata, Mock(MetricMetadata)) TestApplicationContext.register(PartnerMetadataStorage, Mock(PartnerMetadataStorage)) } @@ -45,7 +45,7 @@ class SendOrderUsecaseTest extends Specification { SendOrderUseCase.getInstance().convertAndSend(new OrderMock(null, null, null)) then: - 1 * SendOrderUseCase.getInstance().metaData.put(_, EtorMetaDataStep.ORDER_CONVERTED_TO_OML) + 1 * SendOrderUseCase.getInstance().metadata.put(_, EtorMetadataStep.ORDER_CONVERTED_TO_OML) } def "metadata is registered for adding the contact section to an order"() { @@ -58,7 +58,7 @@ class SendOrderUsecaseTest extends Specification { SendOrderUseCase.getInstance().convertAndSend(new OrderMock(null, null, null)) then: - 1 * SendOrderUseCase.getInstance().metaData.put(_, EtorMetaDataStep.CONTACT_SECTION_ADDED_TO_PATIENT) + 1 * SendOrderUseCase.getInstance().metadata.put(_, EtorMetadataStep.CONTACT_SECTION_ADDED_TO_PATIENT) } def "send fails to send"() { diff --git a/etor/src/test/groovy/gov/hhs/cdc/trustedintermediary/external/localfile/LocalFileOrderSenderTest.groovy b/etor/src/test/groovy/gov/hhs/cdc/trustedintermediary/external/localfile/LocalFileOrderSenderTest.groovy index 434333933..88b3c478e 100644 --- a/etor/src/test/groovy/gov/hhs/cdc/trustedintermediary/external/localfile/LocalFileOrderSenderTest.groovy +++ b/etor/src/test/groovy/gov/hhs/cdc/trustedintermediary/external/localfile/LocalFileOrderSenderTest.groovy @@ -2,10 +2,10 @@ package gov.hhs.cdc.trustedintermediary.external.localfile import gov.hhs.cdc.trustedintermediary.OrderMock import gov.hhs.cdc.trustedintermediary.context.TestApplicationContext -import gov.hhs.cdc.trustedintermediary.etor.metadata.EtorMetaDataStep +import gov.hhs.cdc.trustedintermediary.etor.metadata.EtorMetadataStep import gov.hhs.cdc.trustedintermediary.etor.orders.UnableToSendOrderException import gov.hhs.cdc.trustedintermediary.wrappers.HapiFhir -import gov.hhs.cdc.trustedintermediary.wrappers.MetricMetaData +import gov.hhs.cdc.trustedintermediary.wrappers.MetricMetadata import java.nio.file.Files import java.nio.file.Paths import spock.lang.Specification @@ -15,7 +15,7 @@ class LocalFileOrderSenderTest extends Specification{ def setup() { TestApplicationContext.reset() TestApplicationContext.init() - TestApplicationContext.register(MetricMetaData, Mock(MetricMetaData)) + TestApplicationContext.register(MetricMetadata, Mock(MetricMetadata)) TestApplicationContext.register(LocalFileOrderSender, LocalFileOrderSender.getInstance()) } @@ -79,6 +79,6 @@ class LocalFileOrderSenderTest extends Specification{ LocalFileOrderSender.getInstance().sendOrder(mockOrder) then: - 1 * LocalFileOrderSender.getInstance().metaData.put(_ as String, EtorMetaDataStep.SENT_TO_REPORT_STREAM) + 1 * LocalFileOrderSender.getInstance().metadata.put(_ as String, EtorMetadataStep.SENT_TO_REPORT_STREAM) } } diff --git a/etor/src/test/groovy/gov/hhs/cdc/trustedintermediary/external/reportstream/ReportStreamOrderSenderTest.groovy b/etor/src/test/groovy/gov/hhs/cdc/trustedintermediary/external/reportstream/ReportStreamOrderSenderTest.groovy index ba5caa14d..f75b96a01 100644 --- a/etor/src/test/groovy/gov/hhs/cdc/trustedintermediary/external/reportstream/ReportStreamOrderSenderTest.groovy +++ b/etor/src/test/groovy/gov/hhs/cdc/trustedintermediary/external/reportstream/ReportStreamOrderSenderTest.groovy @@ -2,7 +2,7 @@ package gov.hhs.cdc.trustedintermediary.external.reportstream import gov.hhs.cdc.trustedintermediary.OrderMock import gov.hhs.cdc.trustedintermediary.context.TestApplicationContext -import gov.hhs.cdc.trustedintermediary.etor.metadata.EtorMetaDataStep +import gov.hhs.cdc.trustedintermediary.etor.metadata.EtorMetadataStep import gov.hhs.cdc.trustedintermediary.etor.orders.OrderSender import gov.hhs.cdc.trustedintermediary.etor.orders.UnableToSendOrderException import gov.hhs.cdc.trustedintermediary.external.inmemory.KeyCache @@ -13,7 +13,7 @@ import gov.hhs.cdc.trustedintermediary.wrappers.HapiFhir import gov.hhs.cdc.trustedintermediary.wrappers.HttpClient import gov.hhs.cdc.trustedintermediary.wrappers.HttpClientException import gov.hhs.cdc.trustedintermediary.wrappers.Logger -import gov.hhs.cdc.trustedintermediary.wrappers.MetricMetaData +import gov.hhs.cdc.trustedintermediary.wrappers.MetricMetadata import gov.hhs.cdc.trustedintermediary.wrappers.Secrets import gov.hhs.cdc.trustedintermediary.wrappers.formatter.Formatter import gov.hhs.cdc.trustedintermediary.wrappers.formatter.FormatterProcessingException @@ -28,7 +28,7 @@ class ReportStreamOrderSenderTest extends Specification { TestApplicationContext.reset() TestApplicationContext.init() TestApplicationContext.register(OrderSender, ReportStreamOrderSender.getInstance()) - TestApplicationContext.register(MetricMetaData, Mock(MetricMetaData)) + TestApplicationContext.register(MetricMetadata, Mock(MetricMetadata)) } def "sendRequestBody works"() { @@ -304,7 +304,7 @@ class ReportStreamOrderSenderTest extends Specification { ReportStreamOrderSender.getInstance().sendOrder(new OrderMock(null, null, "Mock order")) then: - 1 * ReportStreamOrderSender.getInstance().metaData.put(_, EtorMetaDataStep.SENT_TO_REPORT_STREAM) + 1 * ReportStreamOrderSender.getInstance().metadata.put(_, EtorMetadataStep.SENT_TO_REPORT_STREAM) } def "retrievePrivateKey works when cache is empty" () { diff --git a/shared/src/main/java/gov/hhs/cdc/trustedintermediary/external/inmemory/LoggingMetricMetaData.java b/shared/src/main/java/gov/hhs/cdc/trustedintermediary/external/inmemory/LoggingMetricMetadata.java similarity index 54% rename from shared/src/main/java/gov/hhs/cdc/trustedintermediary/external/inmemory/LoggingMetricMetaData.java rename to shared/src/main/java/gov/hhs/cdc/trustedintermediary/external/inmemory/LoggingMetricMetadata.java index 1da1fc84b..41e8d4858 100644 --- a/shared/src/main/java/gov/hhs/cdc/trustedintermediary/external/inmemory/LoggingMetricMetaData.java +++ b/shared/src/main/java/gov/hhs/cdc/trustedintermediary/external/inmemory/LoggingMetricMetadata.java @@ -1,8 +1,8 @@ package gov.hhs.cdc.trustedintermediary.external.inmemory; -import gov.hhs.cdc.trustedintermediary.metadata.MetaDataEntry; +import gov.hhs.cdc.trustedintermediary.metadata.MetadataEntry; import gov.hhs.cdc.trustedintermediary.wrappers.Logger; -import gov.hhs.cdc.trustedintermediary.wrappers.MetricMetaData; +import gov.hhs.cdc.trustedintermediary.wrappers.MetricMetadata; import java.util.Map; import javax.inject.Inject; @@ -10,20 +10,20 @@ * Implementation of a class that can be used throughout the project to collect a list of metadata * events */ -public class LoggingMetricMetaData implements MetricMetaData { - private static final LoggingMetricMetaData INSTANCE = new LoggingMetricMetaData(); +public class LoggingMetricMetadata implements MetricMetadata { + private static final LoggingMetricMetadata INSTANCE = new LoggingMetricMetadata(); @Inject Logger logger; - public static LoggingMetricMetaData getInstance() { + public static LoggingMetricMetadata getInstance() { return INSTANCE; } - private LoggingMetricMetaData() {} + private LoggingMetricMetadata() {} @Override public void put(String bundleId, T step) { - MetaDataEntry entry = extractMetricsFromBundle(bundleId, step); + MetadataEntry entry = extractMetricsFromBundle(bundleId, step); var metadataMap = Map.of( "BundleId", @@ -33,10 +33,10 @@ public void put(String bundleId, T step) { "Entry Step", entry.entryStep()); - logger.logMap("MetaData Event Occurred:", metadataMap); + logger.logMap("Metadata Event Occurred:", metadataMap); } - private MetaDataEntry extractMetricsFromBundle(String bundleId, T step) { - return new MetaDataEntry<>(bundleId, step); + private MetadataEntry extractMetricsFromBundle(String bundleId, T step) { + return new MetadataEntry<>(bundleId, step); } } diff --git a/shared/src/main/java/gov/hhs/cdc/trustedintermediary/metadata/MetaDataEntry.java b/shared/src/main/java/gov/hhs/cdc/trustedintermediary/metadata/MetadataEntry.java similarity index 67% rename from shared/src/main/java/gov/hhs/cdc/trustedintermediary/metadata/MetaDataEntry.java rename to shared/src/main/java/gov/hhs/cdc/trustedintermediary/metadata/MetadataEntry.java index dc45a5fa3..482bffe1a 100644 --- a/shared/src/main/java/gov/hhs/cdc/trustedintermediary/metadata/MetaDataEntry.java +++ b/shared/src/main/java/gov/hhs/cdc/trustedintermediary/metadata/MetadataEntry.java @@ -3,9 +3,9 @@ import java.time.Instant; /** An instance of a metadata event to be used for internal troubleshooting of messages */ -public record MetaDataEntry(String bundleId, T entryStep, Instant entryTime) { +public record MetadataEntry(String bundleId, T entryStep, Instant entryTime) { - public MetaDataEntry(String bundleId, T entryStep) { + public MetadataEntry(String bundleId, T entryStep) { this(bundleId, entryStep, Instant.now()); } } diff --git a/shared/src/main/java/gov/hhs/cdc/trustedintermediary/wrappers/MetricMetaData.java b/shared/src/main/java/gov/hhs/cdc/trustedintermediary/wrappers/MetricMetadata.java similarity index 82% rename from shared/src/main/java/gov/hhs/cdc/trustedintermediary/wrappers/MetricMetaData.java rename to shared/src/main/java/gov/hhs/cdc/trustedintermediary/wrappers/MetricMetadata.java index 0004b752e..a018520a4 100644 --- a/shared/src/main/java/gov/hhs/cdc/trustedintermediary/wrappers/MetricMetaData.java +++ b/shared/src/main/java/gov/hhs/cdc/trustedintermediary/wrappers/MetricMetadata.java @@ -1,7 +1,7 @@ package gov.hhs.cdc.trustedintermediary.wrappers; /** Interface to provide a blueprint for working with metadate */ -public interface MetricMetaData { +public interface MetricMetadata { void put(String value, T step); } diff --git a/shared/src/test/groovy/gov/hhs/cdc/trustedintermediary/external/inmemory/LoggingMetricMetaDataTest.groovy b/shared/src/test/groovy/gov/hhs/cdc/trustedintermediary/external/inmemory/LoggingMetricMetadataTest.groovy similarity index 76% rename from shared/src/test/groovy/gov/hhs/cdc/trustedintermediary/external/inmemory/LoggingMetricMetaDataTest.groovy rename to shared/src/test/groovy/gov/hhs/cdc/trustedintermediary/external/inmemory/LoggingMetricMetadataTest.groovy index c4de7f215..7b9bf6a7d 100644 --- a/shared/src/test/groovy/gov/hhs/cdc/trustedintermediary/external/inmemory/LoggingMetricMetaDataTest.groovy +++ b/shared/src/test/groovy/gov/hhs/cdc/trustedintermediary/external/inmemory/LoggingMetricMetadataTest.groovy @@ -2,15 +2,15 @@ package gov.hhs.cdc.trustedintermediary.external.inmemory import gov.hhs.cdc.trustedintermediary.context.TestApplicationContext import gov.hhs.cdc.trustedintermediary.wrappers.Logger -import gov.hhs.cdc.trustedintermediary.wrappers.MetricMetaData +import gov.hhs.cdc.trustedintermediary.wrappers.MetricMetadata import spock.lang.Specification -class LoggingMetricMetaDataTest extends Specification { +class LoggingMetricMetadataTest extends Specification { def setup() { TestApplicationContext.reset() TestApplicationContext.init() - TestApplicationContext.register(MetricMetaData, LoggingMetricMetaData.getInstance()) + TestApplicationContext.register(MetricMetadata, LoggingMetricMetadata.getInstance()) TestApplicationContext.injectRegisteredImplementations() } @@ -21,7 +21,7 @@ class LoggingMetricMetaDataTest extends Specification { TestApplicationContext.injectRegisteredImplementations() when: - LoggingMetricMetaData.getInstance().put("Key", _) + LoggingMetricMetadata.getInstance().put("Key", _) then: 1 * logger.logMap(_ as String, _ as Map) >> { String message, Map keyValue -> diff --git a/shared/src/test/groovy/gov/hhs/cdc/trustedintermediary/metadata/MetaDataEntryTest.groovy b/shared/src/test/groovy/gov/hhs/cdc/trustedintermediary/metadata/MetadataEntryTest.groovy similarity index 68% rename from shared/src/test/groovy/gov/hhs/cdc/trustedintermediary/metadata/MetaDataEntryTest.groovy rename to shared/src/test/groovy/gov/hhs/cdc/trustedintermediary/metadata/MetadataEntryTest.groovy index 761cf0c3c..012ea63e7 100644 --- a/shared/src/test/groovy/gov/hhs/cdc/trustedintermediary/metadata/MetaDataEntryTest.groovy +++ b/shared/src/test/groovy/gov/hhs/cdc/trustedintermediary/metadata/MetadataEntryTest.groovy @@ -3,11 +3,11 @@ package gov.hhs.cdc.trustedintermediary.metadata import gov.hhs.cdc.trustedintermediary.PojoTestUtils import spock.lang.Specification -class MetaDataEntryTest extends Specification { +class MetadataEntryTest extends Specification { def "test getters and setters"() { when: - PojoTestUtils.validateGettersAndSetters(MetaDataEntry.class) + PojoTestUtils.validateGettersAndSetters(MetadataEntry.class) then: noExceptionThrown()