This is an automated email from the ASF dual-hosted git repository.
jamesnetherton pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/main by this push:
new 886f008062 Add integration tests covering camel-mdc supported features
886f008062 is described below
commit 886f008062a7ab44fc892c5a5c27da0f6f400dca
Author: JinyuChen97 <[email protected]>
AuthorDate: Wed Jul 8 07:50:04 2026 +0100
Add integration tests covering camel-mdc supported features
Verifies that camel-quarkus correctly supports the camel-mdc extension
across the following features defined in apache/camel MDCService:
- Default MDC fields: camel.exchangeId, camel.messageId, camel.routeId,
camel.contextId, camel.threadId are populated on every exchange
- Custom exchange header by exact name (custom-exchange-headers=myHeader)
- Selected exchange properties by explicit names
(custom-exchange-properties=p1,p2)
- Async thread propagation via .threads(): MDC header and property values
survive the thread boundary; the async thread-id differs from the calling
thread-id confirming MDC is propagated to a new thread
- Processor MDC propagation: custom header and all default MDC fields are
visible inside a processor invoked on the route
All tests pass in both JVM and native mode.
Co-authored-by: Bob <[email protected]>
---
.../quarkus/component/mdc/it/MdcResource.java | 34 ++++++++++-
.../quarkus/component/mdc/it/MdcRouteBuilder.java | 69 +++++++++++++++++++++-
.../mdc/it/{MdcTest.java => MdcAsyncIT.java} | 18 +-----
.../quarkus/component/mdc/it/MdcAsyncTest.java | 54 +++++++++++++++++
.../it/{MdcTest.java => MdcAsyncTestProfile.java} | 21 +++----
.../it/{MdcTest.java => MdcInterceptBeanIT.java} | 18 +-----
.../it/{MdcTest.java => MdcInterceptBeanTest.java} | 16 +++--
...cTest.java => MdcInterceptBeanTestProfile.java} | 19 ++----
.../mdc/it/{MdcTest.java => MdcPropertiesIT.java} | 18 +-----
.../it/{MdcTest.java => MdcPropertiesTest.java} | 14 +++--
...{MdcTest.java => MdcPropertiesTestProfile.java} | 19 ++----
.../camel/quarkus/component/mdc/it/MdcTest.java | 17 +++++-
12 files changed, 214 insertions(+), 103 deletions(-)
diff --git
a/integration-tests/mdc/src/main/java/org/apache/camel/quarkus/component/mdc/it/MdcResource.java
b/integration-tests/mdc/src/main/java/org/apache/camel/quarkus/component/mdc/it/MdcResource.java
index 61ad1a8591..843e4df411 100644
---
a/integration-tests/mdc/src/main/java/org/apache/camel/quarkus/component/mdc/it/MdcResource.java
+++
b/integration-tests/mdc/src/main/java/org/apache/camel/quarkus/component/mdc/it/MdcResource.java
@@ -31,10 +31,38 @@ public class MdcResource {
@Inject
ProducerTemplate producerTemplate;
- @Path("/trace")
+ @Path("/customHeader")
@GET
@Produces(MediaType.TEXT_PLAIN)
- public String traceRoute() {
- return producerTemplate.requestBody("direct:start", null,
String.class);
+ public String customHeader() {
+ return producerTemplate.requestBody("direct:customHeader", null,
String.class);
+ }
+
+ @Path("/defaultFields")
+ @GET
+ @Produces(MediaType.TEXT_PLAIN)
+ public String defaultFields() {
+ return producerTemplate.requestBody("direct:defaultFields", null,
String.class);
+ }
+
+ @Path("/properties")
+ @GET
+ @Produces(MediaType.TEXT_PLAIN)
+ public String properties() {
+ return producerTemplate.requestBody("direct:properties", null,
String.class);
+ }
+
+ @Path("/async")
+ @GET
+ @Produces(MediaType.TEXT_PLAIN)
+ public String async() {
+ return producerTemplate.requestBody("direct:async", null,
String.class);
+ }
+
+ @Path("/interceptBean")
+ @GET
+ @Produces(MediaType.TEXT_PLAIN)
+ public String interceptBean() {
+ return producerTemplate.requestBody("direct:interceptBean", null,
String.class);
}
}
diff --git
a/integration-tests/mdc/src/main/java/org/apache/camel/quarkus/component/mdc/it/MdcRouteBuilder.java
b/integration-tests/mdc/src/main/java/org/apache/camel/quarkus/component/mdc/it/MdcRouteBuilder.java
index 01633dc184..f317be2540 100644
---
a/integration-tests/mdc/src/main/java/org/apache/camel/quarkus/component/mdc/it/MdcRouteBuilder.java
+++
b/integration-tests/mdc/src/main/java/org/apache/camel/quarkus/component/mdc/it/MdcRouteBuilder.java
@@ -23,11 +23,76 @@ public class MdcRouteBuilder extends RouteBuilder {
@Override
public void configure() throws Exception {
- from("direct:start")
+ // Route for testing custom headers
+ from("direct:customHeader")
.setHeader("myHeader", constant("HELO"))
.process(exchange -> {
exchange.getIn().setBody(MDC.get("myHeader"));
})
- .log("done!");
+ .log("Custom header route done");
+
+ // Route for testing default MDC fields
+ from("direct:defaultFields")
+ .process(exchange -> {
+ StringBuilder result = new StringBuilder();
+
result.append("exchangeId:").append(MDC.get("camel.exchangeId")).append(",");
+
result.append("messageId:").append(MDC.get("camel.messageId")).append(",");
+
result.append("routeId:").append(MDC.get("camel.routeId")).append(",");
+
result.append("contextId:").append(MDC.get("camel.contextId")).append(",");
+
result.append("threadId:").append(MDC.get("camel.threadId"));
+ exchange.getIn().setBody(result.toString());
+ })
+ .log("Default fields route done");
+
+ // Route for testing properties
+ from("direct:properties")
+ .setProperty("prop1", constant("property1"))
+ .setProperty("prop2", constant("property2"))
+ .process(exchange -> {
+ StringBuilder result = new StringBuilder();
+ String p1 = MDC.get("prop1");
+ String p2 = MDC.get("prop2");
+ result.append("prop1:").append(p1 != null ? p1 :
"null").append(",");
+ result.append("prop2:").append(p2 != null ? p2 : "null");
+ exchange.getIn().setBody(result.toString());
+ })
+ .log("Properties route done");
+
+ // Route for testing async processing
+ from("direct:async")
+ .setHeader("asyncHeader", constant("asyncValue"))
+ .setProperty("asyncProp", constant("asyncPropValue"))
+ .process(exchange -> exchange.setProperty("callingThread",
Thread.currentThread().getName()))
+ .threads(2)
+ .process(exchange -> {
+ StringBuilder result = new StringBuilder();
+ String ah = MDC.get("asyncHeader");
+ String ap = MDC.get("asyncProp");
+ String threadId = MDC.get("camel.threadId");
+ result.append("asyncHeader:").append(ah != null ? ah :
"null").append("\n");
+ result.append("asyncProp:").append(ap != null ? ap :
"null").append("\n");
+ result.append("threadId:").append(threadId != null ?
threadId : "null").append("\n");
+
result.append("callingThread:").append(exchange.getProperty("callingThread",
String.class));
+ exchange.getIn().setBody(result.toString());
+ })
+ .log("Async route done");
+
+ // Route for testing intercept + bean processor MDC propagation
+ from("direct:interceptBean")
+ .setHeader("interceptHeader", constant("interceptValue"))
+ .process(exchange -> {
+ // Processor acting as the "bean": assert MDC is populated
here
+ StringBuilder result = new StringBuilder();
+ String ih = MDC.get("interceptHeader");
+ String exchangeId = MDC.get("camel.exchangeId");
+ String routeId = MDC.get("camel.routeId");
+ String contextId = MDC.get("camel.contextId");
+ result.append("interceptHeader:").append(ih != null ? ih :
"null").append(",");
+ result.append("exchangeId:").append(exchangeId != null ?
"present" : "null").append(",");
+ result.append("routeId:").append(routeId != null ?
"present" : "null").append(",");
+ result.append("contextId:").append(contextId != null ?
"present" : "null");
+ exchange.getIn().setBody(result.toString());
+ })
+ .log("Intercept-bean route done");
}
}
diff --git
a/integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcTest.java
b/integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcAsyncIT.java
similarity index 70%
copy from
integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcTest.java
copy to
integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcAsyncIT.java
index 017c50f6ed..43ed0b6060 100644
---
a/integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcTest.java
+++
b/integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcAsyncIT.java
@@ -16,21 +16,9 @@
*/
package org.apache.camel.quarkus.component.mdc.it;
-import io.quarkus.test.junit.QuarkusTest;
-import io.restassured.RestAssured;
-import org.junit.jupiter.api.Test;
+import io.quarkus.test.junit.QuarkusIntegrationTest;
-import static org.hamcrest.CoreMatchers.equalTo;
-
-@QuarkusTest
-class MdcTest {
-
- @Test
- public void test() {
- RestAssured.get("/mdc/trace")
- .then()
- .statusCode(200)
- .body(equalTo("HELO"));
- }
+@QuarkusIntegrationTest
+class MdcAsyncIT extends MdcAsyncTest {
}
diff --git
a/integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcAsyncTest.java
b/integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcAsyncTest.java
new file mode 100644
index 0000000000..74937726cb
--- /dev/null
+++
b/integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcAsyncTest.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.component.mdc.it;
+
+import io.quarkus.test.junit.QuarkusTest;
+import io.quarkus.test.junit.TestProfile;
+import io.restassured.RestAssured;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.CoreMatchers.not;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+
+@QuarkusTest
+@TestProfile(MdcAsyncTestProfile.class)
+class MdcAsyncTest {
+
+ @Test
+ void testAsyncProcessingWithMdcPropagation() {
+ String response = RestAssured.get("/mdc/async")
+ .then()
+ .statusCode(200)
+ .body(containsString("asyncHeader:asyncValue"))
+ .body(containsString("asyncProp:asyncPropValue"))
+ .body(containsString("threadId:"),
not(containsString("threadId:null")))
+ .extract().asString();
+
+ // MDC threadId on the async thread must differ from the calling thread
+ assertNotEquals(extractValue(response, "threadId"),
extractValue(response, "callingThread"));
+ }
+
+ private static String extractValue(String response, String key) {
+ for (String line : response.split("\n")) {
+ if (line.startsWith(key + ":")) {
+ return line.substring(key.length() + 1);
+ }
+ }
+ return null;
+ }
+}
diff --git
a/integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcTest.java
b/integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcAsyncTestProfile.java
similarity index 69%
copy from
integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcTest.java
copy to
integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcAsyncTestProfile.java
index 017c50f6ed..cee5ba4316 100644
---
a/integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcTest.java
+++
b/integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcAsyncTestProfile.java
@@ -16,21 +16,16 @@
*/
package org.apache.camel.quarkus.component.mdc.it;
-import io.quarkus.test.junit.QuarkusTest;
-import io.restassured.RestAssured;
-import org.junit.jupiter.api.Test;
+import java.util.Map;
-import static org.hamcrest.CoreMatchers.equalTo;
+import io.quarkus.test.junit.QuarkusTestProfile;
-@QuarkusTest
-class MdcTest {
+public class MdcAsyncTestProfile implements QuarkusTestProfile {
- @Test
- public void test() {
- RestAssured.get("/mdc/trace")
- .then()
- .statusCode(200)
- .body(equalTo("HELO"));
+ @Override
+ public Map<String, String> getConfigOverrides() {
+ return Map.of(
+ "quarkus.camel.mdc.custom-exchange-headers", "asyncHeader",
+ "quarkus.camel.mdc.custom-exchange-properties", "asyncProp");
}
-
}
diff --git
a/integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcTest.java
b/integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcInterceptBeanIT.java
similarity index 70%
copy from
integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcTest.java
copy to
integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcInterceptBeanIT.java
index 017c50f6ed..8f9eb43c63 100644
---
a/integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcTest.java
+++
b/integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcInterceptBeanIT.java
@@ -16,21 +16,9 @@
*/
package org.apache.camel.quarkus.component.mdc.it;
-import io.quarkus.test.junit.QuarkusTest;
-import io.restassured.RestAssured;
-import org.junit.jupiter.api.Test;
+import io.quarkus.test.junit.QuarkusIntegrationTest;
-import static org.hamcrest.CoreMatchers.equalTo;
-
-@QuarkusTest
-class MdcTest {
-
- @Test
- public void test() {
- RestAssured.get("/mdc/trace")
- .then()
- .statusCode(200)
- .body(equalTo("HELO"));
- }
+@QuarkusIntegrationTest
+class MdcInterceptBeanIT extends MdcInterceptBeanTest {
}
diff --git
a/integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcTest.java
b/integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcInterceptBeanTest.java
similarity index 67%
copy from
integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcTest.java
copy to
integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcInterceptBeanTest.java
index 017c50f6ed..4055837213 100644
---
a/integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcTest.java
+++
b/integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcInterceptBeanTest.java
@@ -17,20 +17,24 @@
package org.apache.camel.quarkus.component.mdc.it;
import io.quarkus.test.junit.QuarkusTest;
+import io.quarkus.test.junit.TestProfile;
import io.restassured.RestAssured;
import org.junit.jupiter.api.Test;
-import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.containsString;
@QuarkusTest
-class MdcTest {
+@TestProfile(MdcInterceptBeanTestProfile.class)
+class MdcInterceptBeanTest {
@Test
- public void test() {
- RestAssured.get("/mdc/trace")
+ void testInterceptBeanMdcPropagation() {
+ RestAssured.get("/mdc/interceptBean")
.then()
.statusCode(200)
- .body(equalTo("HELO"));
+ .body(containsString("interceptHeader:interceptValue"))
+ .body(containsString("exchangeId:present"))
+ .body(containsString("routeId:present"))
+ .body(containsString("contextId:present"));
}
-
}
diff --git
a/integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcTest.java
b/integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcInterceptBeanTestProfile.java
similarity index 70%
copy from
integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcTest.java
copy to
integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcInterceptBeanTestProfile.java
index 017c50f6ed..83e13d112c 100644
---
a/integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcTest.java
+++
b/integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcInterceptBeanTestProfile.java
@@ -16,21 +16,14 @@
*/
package org.apache.camel.quarkus.component.mdc.it;
-import io.quarkus.test.junit.QuarkusTest;
-import io.restassured.RestAssured;
-import org.junit.jupiter.api.Test;
+import java.util.Map;
-import static org.hamcrest.CoreMatchers.equalTo;
+import io.quarkus.test.junit.QuarkusTestProfile;
-@QuarkusTest
-class MdcTest {
+public class MdcInterceptBeanTestProfile implements QuarkusTestProfile {
- @Test
- public void test() {
- RestAssured.get("/mdc/trace")
- .then()
- .statusCode(200)
- .body(equalTo("HELO"));
+ @Override
+ public Map<String, String> getConfigOverrides() {
+ return Map.of("quarkus.camel.mdc.custom-exchange-headers",
"interceptHeader");
}
-
}
diff --git
a/integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcTest.java
b/integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcPropertiesIT.java
similarity index 70%
copy from
integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcTest.java
copy to
integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcPropertiesIT.java
index 017c50f6ed..8f8209ea7c 100644
---
a/integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcTest.java
+++
b/integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcPropertiesIT.java
@@ -16,21 +16,9 @@
*/
package org.apache.camel.quarkus.component.mdc.it;
-import io.quarkus.test.junit.QuarkusTest;
-import io.restassured.RestAssured;
-import org.junit.jupiter.api.Test;
+import io.quarkus.test.junit.QuarkusIntegrationTest;
-import static org.hamcrest.CoreMatchers.equalTo;
-
-@QuarkusTest
-class MdcTest {
-
- @Test
- public void test() {
- RestAssured.get("/mdc/trace")
- .then()
- .statusCode(200)
- .body(equalTo("HELO"));
- }
+@QuarkusIntegrationTest
+class MdcPropertiesIT extends MdcPropertiesTest {
}
diff --git
a/integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcTest.java
b/integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcPropertiesTest.java
similarity index 74%
copy from
integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcTest.java
copy to
integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcPropertiesTest.java
index 017c50f6ed..ee11ede4df 100644
---
a/integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcTest.java
+++
b/integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcPropertiesTest.java
@@ -17,20 +17,22 @@
package org.apache.camel.quarkus.component.mdc.it;
import io.quarkus.test.junit.QuarkusTest;
+import io.quarkus.test.junit.TestProfile;
import io.restassured.RestAssured;
import org.junit.jupiter.api.Test;
-import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.containsString;
@QuarkusTest
-class MdcTest {
+@TestProfile(MdcPropertiesTestProfile.class)
+class MdcPropertiesTest {
@Test
- public void test() {
- RestAssured.get("/mdc/trace")
+ void testSpecificProperties() {
+ RestAssured.get("/mdc/properties")
.then()
.statusCode(200)
- .body(equalTo("HELO"));
+ .body(containsString("prop1:property1"))
+ .body(containsString("prop2:property2"));
}
-
}
diff --git
a/integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcTest.java
b/integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcPropertiesTestProfile.java
similarity index 70%
copy from
integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcTest.java
copy to
integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcPropertiesTestProfile.java
index 017c50f6ed..53f23aeba8 100644
---
a/integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcTest.java
+++
b/integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcPropertiesTestProfile.java
@@ -16,21 +16,14 @@
*/
package org.apache.camel.quarkus.component.mdc.it;
-import io.quarkus.test.junit.QuarkusTest;
-import io.restassured.RestAssured;
-import org.junit.jupiter.api.Test;
+import java.util.Map;
-import static org.hamcrest.CoreMatchers.equalTo;
+import io.quarkus.test.junit.QuarkusTestProfile;
-@QuarkusTest
-class MdcTest {
+public class MdcPropertiesTestProfile implements QuarkusTestProfile {
- @Test
- public void test() {
- RestAssured.get("/mdc/trace")
- .then()
- .statusCode(200)
- .body(equalTo("HELO"));
+ @Override
+ public Map<String, String> getConfigOverrides() {
+ return Map.of("quarkus.camel.mdc.custom-exchange-properties",
"prop1,prop2");
}
-
}
diff --git
a/integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcTest.java
b/integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcTest.java
index 017c50f6ed..27ffe3c243 100644
---
a/integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcTest.java
+++
b/integration-tests/mdc/src/test/java/org/apache/camel/quarkus/component/mdc/it/MdcTest.java
@@ -20,17 +20,30 @@ import io.quarkus.test.junit.QuarkusTest;
import io.restassured.RestAssured;
import org.junit.jupiter.api.Test;
+import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.not;
@QuarkusTest
class MdcTest {
@Test
- public void test() {
- RestAssured.get("/mdc/trace")
+ void testCustomHeader() {
+ RestAssured.get("/mdc/customHeader")
.then()
.statusCode(200)
.body(equalTo("HELO"));
}
+ @Test
+ void testDefaultMdcFields() {
+ RestAssured.get("/mdc/defaultFields")
+ .then()
+ .statusCode(200)
+ .body(containsString("exchangeId:"),
not(containsString("exchangeId:null")))
+ .body(containsString("messageId:"),
not(containsString("messageId:null")))
+ .body(containsString("routeId:"),
not(containsString("routeId:null")))
+ .body(containsString("contextId:"),
not(containsString("contextId:null")))
+ .body(containsString("threadId:"),
not(containsString("threadId:null")));
+ }
}