Skip to content

Commit

Permalink
Fix formatting and remaining jakarta10 references
Browse files Browse the repository at this point in the history
  • Loading branch information
shakuzen committed Oct 10, 2023
1 parent 6fec15c commit 1f2b1de
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import io.micrometer.common.KeyValues;
import jakarta.jms.*;

import io.micrometer.jakarta9.instrument.jms.JmsObservationDocumentation.*;

/**
* Default implementation for {@link JmsProcessObservationConvention}.
*
Expand All @@ -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() {
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
}
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import io.micrometer.common.KeyValues;
import jakarta.jms.*;

import io.micrometer.jakarta9.instrument.jms.JmsObservationDocumentation.*;

/**
* Default implementation for {@link JmsPublishObservationConvention}.
*
Expand All @@ -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() {
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
}
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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..");
Expand Down

0 comments on commit 1f2b1de

Please sign in to comment.