From 1f2b1de50f60dc6bfe97bf2c0904c50718708824 Mon Sep 17 00:00:00 2001 From: Tommy Ludwig <8924140+shakuzen@users.noreply.github.com> Date: Tue, 10 Oct 2023 21:52:01 +0900 Subject: [PATCH] Fix formatting and remaining jakarta10 references --- ...efaultJmsProcessObservationConvention.java | 26 ++++++++++--------- ...efaultJmsPublishObservationConvention.java | 26 ++++++++++--------- .../jakarta9/NoJavaxArchitectureTests.java | 4 +-- 3 files changed, 30 insertions(+), 26 deletions(-) diff --git a/micrometer-jakarta9/src/main/java/io/micrometer/jakarta9/instrument/jms/DefaultJmsProcessObservationConvention.java b/micrometer-jakarta9/src/main/java/io/micrometer/jakarta9/instrument/jms/DefaultJmsProcessObservationConvention.java index 48b605cf71..5006c7b898 100644 --- a/micrometer-jakarta9/src/main/java/io/micrometer/jakarta9/instrument/jms/DefaultJmsProcessObservationConvention.java +++ b/micrometer-jakarta9/src/main/java/io/micrometer/jakarta9/instrument/jms/DefaultJmsProcessObservationConvention.java @@ -20,6 +20,8 @@ import io.micrometer.common.KeyValues; import jakarta.jms.*; +import io.micrometer.jakarta9.instrument.jms.JmsObservationDocumentation.*; + /** * Default implementation for {@link JmsProcessObservationConvention}. * @@ -28,23 +30,23 @@ */ public class DefaultJmsProcessObservationConvention implements JmsProcessObservationConvention { - private static final KeyValue DESTINATION_TEMPORARY = KeyValue.of(JmsObservationDocumentation.LowCardinalityKeyNames.DESTINATION_TEMPORARY, + private static final KeyValue DESTINATION_TEMPORARY = KeyValue.of(LowCardinalityKeyNames.DESTINATION_TEMPORARY, "true"); - private static final KeyValue DESTINATION_DURABLE = KeyValue.of(JmsObservationDocumentation.LowCardinalityKeyNames.DESTINATION_TEMPORARY, + private static final KeyValue DESTINATION_DURABLE = KeyValue.of(LowCardinalityKeyNames.DESTINATION_TEMPORARY, "false"); - private static final KeyValue EXCEPTION_NONE = KeyValue.of(JmsObservationDocumentation.LowCardinalityKeyNames.EXCEPTION, KeyValue.NONE_VALUE); + private static final KeyValue EXCEPTION_NONE = KeyValue.of(LowCardinalityKeyNames.EXCEPTION, KeyValue.NONE_VALUE); - private static final KeyValue OPERATION_PROCESS = KeyValue.of(JmsObservationDocumentation.LowCardinalityKeyNames.OPERATION, "process"); + private static final KeyValue OPERATION_PROCESS = KeyValue.of(LowCardinalityKeyNames.OPERATION, "process"); - private static final KeyValue DESTINATION_NAME_UNKNOWN = KeyValue.of(JmsObservationDocumentation.HighCardinalityKeyNames.DESTINATION_NAME, + private static final KeyValue DESTINATION_NAME_UNKNOWN = KeyValue.of(HighCardinalityKeyNames.DESTINATION_NAME, "unknown"); - private static final KeyValue MESSAGE_CONVERSATION_ID_UNKNOWN = KeyValue.of(JmsObservationDocumentation.HighCardinalityKeyNames.CONVERSATION_ID, + private static final KeyValue MESSAGE_CONVERSATION_ID_UNKNOWN = KeyValue.of(HighCardinalityKeyNames.CONVERSATION_ID, "unknown"); - private static final KeyValue MESSAGE_ID_UNKNOWN = KeyValue.of(JmsObservationDocumentation.HighCardinalityKeyNames.MESSAGE_ID, "unknown"); + private static final KeyValue MESSAGE_ID_UNKNOWN = KeyValue.of(HighCardinalityKeyNames.MESSAGE_ID, "unknown"); @Override public String getName() { @@ -65,7 +67,7 @@ private KeyValue exception(JmsProcessObservationContext context) { Throwable error = context.getError(); if (error != null) { String simpleName = error.getClass().getSimpleName(); - return KeyValue.of(JmsObservationDocumentation.LowCardinalityKeyNames.EXCEPTION, + return KeyValue.of(LowCardinalityKeyNames.EXCEPTION, !simpleName.isEmpty() ? simpleName : error.getClass().getName()); } return EXCEPTION_NONE; @@ -96,7 +98,7 @@ protected KeyValue correlationId(JmsProcessObservationContext context) { if (message.getJMSCorrelationID() == null) { return MESSAGE_CONVERSATION_ID_UNKNOWN; } - return KeyValue.of(JmsObservationDocumentation.HighCardinalityKeyNames.CONVERSATION_ID, message.getJMSCorrelationID()); + return KeyValue.of(HighCardinalityKeyNames.CONVERSATION_ID, message.getJMSCorrelationID()); } catch (JMSException exc) { return MESSAGE_CONVERSATION_ID_UNKNOWN; @@ -108,11 +110,11 @@ protected KeyValue destinationName(JmsProcessObservationContext context) { Destination jmsDestination = context.getCarrier().getJMSDestination(); if (jmsDestination instanceof Queue) { Queue queue = (Queue) jmsDestination; - return KeyValue.of(JmsObservationDocumentation.HighCardinalityKeyNames.DESTINATION_NAME, queue.getQueueName()); + return KeyValue.of(HighCardinalityKeyNames.DESTINATION_NAME, queue.getQueueName()); } if (jmsDestination instanceof Topic) { Topic topic = (Topic) jmsDestination; - return KeyValue.of(JmsObservationDocumentation.HighCardinalityKeyNames.DESTINATION_NAME, topic.getTopicName()); + return KeyValue.of(HighCardinalityKeyNames.DESTINATION_NAME, topic.getTopicName()); } return DESTINATION_NAME_UNKNOWN; } @@ -127,7 +129,7 @@ protected KeyValue messageId(JmsProcessObservationContext context) { if (message.getJMSMessageID() == null) { return MESSAGE_ID_UNKNOWN; } - return KeyValue.of(JmsObservationDocumentation.HighCardinalityKeyNames.MESSAGE_ID, message.getJMSMessageID()); + return KeyValue.of(HighCardinalityKeyNames.MESSAGE_ID, message.getJMSMessageID()); } catch (JMSException exc) { return MESSAGE_ID_UNKNOWN; diff --git a/micrometer-jakarta9/src/main/java/io/micrometer/jakarta9/instrument/jms/DefaultJmsPublishObservationConvention.java b/micrometer-jakarta9/src/main/java/io/micrometer/jakarta9/instrument/jms/DefaultJmsPublishObservationConvention.java index 16fcc7916a..2b1ff7d15a 100644 --- a/micrometer-jakarta9/src/main/java/io/micrometer/jakarta9/instrument/jms/DefaultJmsPublishObservationConvention.java +++ b/micrometer-jakarta9/src/main/java/io/micrometer/jakarta9/instrument/jms/DefaultJmsPublishObservationConvention.java @@ -20,6 +20,8 @@ import io.micrometer.common.KeyValues; import jakarta.jms.*; +import io.micrometer.jakarta9.instrument.jms.JmsObservationDocumentation.*; + /** * Default implementation for {@link JmsPublishObservationConvention}. * @@ -28,23 +30,23 @@ */ public class DefaultJmsPublishObservationConvention implements JmsPublishObservationConvention { - private static final KeyValue DESTINATION_TEMPORARY = KeyValue.of(JmsObservationDocumentation.LowCardinalityKeyNames.DESTINATION_TEMPORARY, + private static final KeyValue DESTINATION_TEMPORARY = KeyValue.of(LowCardinalityKeyNames.DESTINATION_TEMPORARY, "true"); - private static final KeyValue DESTINATION_DURABLE = KeyValue.of(JmsObservationDocumentation.LowCardinalityKeyNames.DESTINATION_TEMPORARY, + private static final KeyValue DESTINATION_DURABLE = KeyValue.of(LowCardinalityKeyNames.DESTINATION_TEMPORARY, "false"); - private static final KeyValue EXCEPTION_NONE = KeyValue.of(JmsObservationDocumentation.LowCardinalityKeyNames.EXCEPTION, KeyValue.NONE_VALUE); + private static final KeyValue EXCEPTION_NONE = KeyValue.of(LowCardinalityKeyNames.EXCEPTION, KeyValue.NONE_VALUE); - private static final KeyValue OPERATION_PUBLISH = KeyValue.of(JmsObservationDocumentation.LowCardinalityKeyNames.OPERATION, "publish"); + private static final KeyValue OPERATION_PUBLISH = KeyValue.of(LowCardinalityKeyNames.OPERATION, "publish"); - private static final KeyValue MESSAGE_CONVERSATION_ID_UNKNOWN = KeyValue.of(JmsObservationDocumentation.HighCardinalityKeyNames.CONVERSATION_ID, + private static final KeyValue MESSAGE_CONVERSATION_ID_UNKNOWN = KeyValue.of(HighCardinalityKeyNames.CONVERSATION_ID, "unknown"); - private static final KeyValue DESTINATION_NAME_UNKNOWN = KeyValue.of(JmsObservationDocumentation.HighCardinalityKeyNames.DESTINATION_NAME, + private static final KeyValue DESTINATION_NAME_UNKNOWN = KeyValue.of(HighCardinalityKeyNames.DESTINATION_NAME, "unknown"); - private static final KeyValue MESSAGE_ID_UNKNOWN = KeyValue.of(JmsObservationDocumentation.HighCardinalityKeyNames.MESSAGE_ID, "unknown"); + private static final KeyValue MESSAGE_ID_UNKNOWN = KeyValue.of(HighCardinalityKeyNames.MESSAGE_ID, "unknown"); @Override public String getName() { @@ -65,7 +67,7 @@ private KeyValue exception(JmsPublishObservationContext context) { Throwable error = context.getError(); if (error != null) { String simpleName = error.getClass().getSimpleName(); - return KeyValue.of(JmsObservationDocumentation.LowCardinalityKeyNames.EXCEPTION, + return KeyValue.of(LowCardinalityKeyNames.EXCEPTION, !simpleName.isEmpty() ? simpleName : error.getClass().getName()); } return EXCEPTION_NONE; @@ -98,7 +100,7 @@ protected KeyValue correlationId(JmsPublishObservationContext context) { if (message == null || message.getJMSCorrelationID() == null) { return MESSAGE_CONVERSATION_ID_UNKNOWN; } - return KeyValue.of(JmsObservationDocumentation.HighCardinalityKeyNames.CONVERSATION_ID, message.getJMSCorrelationID()); + return KeyValue.of(HighCardinalityKeyNames.CONVERSATION_ID, message.getJMSCorrelationID()); } catch (JMSException exc) { return MESSAGE_CONVERSATION_ID_UNKNOWN; @@ -114,11 +116,11 @@ protected KeyValue destinationName(JmsPublishObservationContext context) { Destination jmsDestination = message.getJMSDestination(); if (jmsDestination instanceof Queue) { Queue queue = (Queue) jmsDestination; - return KeyValue.of(JmsObservationDocumentation.HighCardinalityKeyNames.DESTINATION_NAME, queue.getQueueName()); + return KeyValue.of(HighCardinalityKeyNames.DESTINATION_NAME, queue.getQueueName()); } if (jmsDestination instanceof Topic) { Topic topic = (Topic) jmsDestination; - return KeyValue.of(JmsObservationDocumentation.HighCardinalityKeyNames.DESTINATION_NAME, topic.getTopicName()); + return KeyValue.of(HighCardinalityKeyNames.DESTINATION_NAME, topic.getTopicName()); } return DESTINATION_NAME_UNKNOWN; } @@ -133,7 +135,7 @@ protected KeyValue messageId(JmsPublishObservationContext context) { if (message == null || message.getJMSMessageID() == null) { return MESSAGE_ID_UNKNOWN; } - return KeyValue.of(JmsObservationDocumentation.HighCardinalityKeyNames.MESSAGE_ID, message.getJMSMessageID()); + return KeyValue.of(HighCardinalityKeyNames.MESSAGE_ID, message.getJMSMessageID()); } catch (JMSException exc) { return MESSAGE_ID_UNKNOWN; diff --git a/micrometer-jakarta9/src/test/java/io/micrometer/jakarta9/NoJavaxArchitectureTests.java b/micrometer-jakarta9/src/test/java/io/micrometer/jakarta9/NoJavaxArchitectureTests.java index 3e2496f9c4..c68df2605f 100644 --- a/micrometer-jakarta9/src/test/java/io/micrometer/jakarta9/NoJavaxArchitectureTests.java +++ b/micrometer-jakarta9/src/test/java/io/micrometer/jakarta9/NoJavaxArchitectureTests.java @@ -21,12 +21,12 @@ import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.noClasses; -@AnalyzeClasses(packages = "io.micrometer.jakarta10") +@AnalyzeClasses(packages = "io.micrometer.jakarta9") class NoJavaxArchitectureTests { @ArchTest static final ArchRule noJavaxDependencies = noClasses().that() - .resideInAPackage("io.micrometer.jakarta10..") + .resideInAPackage("io.micrometer.jakarta9..") .should() .dependOnClassesThat() .resideInAPackage("javax..");