Skip to content

Commit

Permalink
Disable verification of logback code attributes for Wildfly
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanbisutti committed Sep 15, 2022
1 parent 98530c3 commit 27e4cff
Showing 1 changed file with 43 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ abstract class TraceLogBackTest {

@RegisterExtension static final SmokeTestExtension testing = SmokeTestExtension.create();

boolean checkLogBackCodeAttributes() {
return true;
}

@Test
@TargetUri("/traceLogBack")
void testTraceLogBack() throws Exception {
Expand Down Expand Up @@ -61,15 +65,20 @@ void testTraceLogBack() throws Exception {
assertThat(md1.getProperties()).containsKey("ThreadName");
assertThat(md1.getProperties()).containsEntry("MDC key", "MDC value");

assertThat(md1.getProperties()).containsEntry("FileName", "SimpleTestTraceLogBackServlet.java");
assertThat(md1.getProperties())
.containsEntry(
"ClassName",
"com.microsoft.applicationinsights.smoketestapp.SimpleTestTraceLogBackServlet");
assertThat(md1.getProperties()).containsEntry("MethodName", "doGet");
assertThat(md1.getProperties()).containsEntry("LineNumber", "24");

assertThat(md1.getProperties()).hasSize(8);
if (checkLogBackCodeAttributes()) {
assertThat(md1.getProperties())
.containsEntry("FileName", "SimpleTestTraceLogBackServlet.java");
assertThat(md1.getProperties())
.containsEntry(
"ClassName",
"com.microsoft.applicationinsights.smoketestapp.SimpleTestTraceLogBackServlet");
assertThat(md1.getProperties()).containsEntry("MethodName", "doGet");
assertThat(md1.getProperties()).containsEntry("LineNumber", "24");

assertThat(md1.getProperties()).hasSize(8);
} else {
assertThat(md1.getProperties()).hasSize(4);
}

assertThat(md2.getMessage()).isEqualTo("This is logback error.");
assertThat(md2.getSeverityLevel()).isEqualTo(SeverityLevel.ERROR);
Expand Down Expand Up @@ -120,15 +129,19 @@ void testTraceLogBackWithException() throws Exception {
assertThat(ed.getProperties()).containsKey("ThreadName");
assertThat(ed.getProperties()).containsEntry("MDC key", "MDC value");

assertThat(ed.getProperties())
.containsEntry("FileName", "SimpleTestTraceLogBackWithExceptionServlet.java");
assertThat(ed.getProperties())
.containsEntry(
"ClassName",
"com.microsoft.applicationinsights.smoketestapp.SimpleTestTraceLogBackWithExceptionServlet");
assertThat(ed.getProperties()).containsEntry("MethodName", "doGet");
assertThat(ed.getProperties()).containsEntry("LineNumber", "21");
assertThat(ed.getProperties()).hasSize(9);
if (checkLogBackCodeAttributes()) {
assertThat(ed.getProperties())
.containsEntry("FileName", "SimpleTestTraceLogBackWithExceptionServlet.java");
assertThat(ed.getProperties())
.containsEntry(
"ClassName",
"com.microsoft.applicationinsights.smoketestapp.SimpleTestTraceLogBackWithExceptionServlet");
assertThat(ed.getProperties()).containsEntry("MethodName", "doGet");
assertThat(ed.getProperties()).containsEntry("LineNumber", "21");
assertThat(ed.getProperties()).hasSize(9);
} else {
assertThat(ed.getProperties()).hasSize(5);
}

SmokeTestExtension.assertParentChild(
rd, rdEnvelope, edEnvelope, "GET /TraceLogBackUsingAgent/traceLogBackWithException");
Expand Down Expand Up @@ -156,8 +169,18 @@ static class Tomcat8Java18Test extends TraceLogBackTest {}
static class Tomcat8Java19Test extends TraceLogBackTest {}

@Environment(WILDFLY_13_JAVA_8)
static class Wildfly13Java8Test extends TraceLogBackTest {}
static class Wildfly13Java8Test extends TraceLogBackTest {
@Override
boolean checkLogBackCodeAttributes() {
return false;
}
}

@Environment(WILDFLY_13_JAVA_8_OPENJ9)
static class Wildfly13Java8OpenJ9Test extends TraceLogBackTest {}
static class Wildfly13Java8OpenJ9Test extends TraceLogBackTest {
@Override
boolean checkLogBackCodeAttributes() {
return false;
}
}
}

0 comments on commit 27e4cff

Please sign in to comment.