Skip to content

Commit 4cc302f

Browse files
committed
WORK IN PROGRESS
1 parent e3476c0 commit 4cc302f

File tree

4 files changed

+11
-121
lines changed

4 files changed

+11
-121
lines changed

smoke-tests/apps/SpringBoot/build.gradle.kts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,9 @@ plugins {
33
}
44

55
dependencies {
6-
implementation("com.microsoft.azure:applicationinsights-spring-boot-starter:2.6.4")
7-
8-
implementation("org.springframework.boot:spring-boot-starter-web:2.5.12") {
6+
implementation("org.springframework.boot:spring-boot-starter-web:2.7.18") {
97
exclude("org.springframework.boot", "spring-boot-starter-tomcat")
108
}
119

12-
// this dependency is needed to make wildfly happy
13-
implementation("org.reactivestreams:reactive-streams:1.0.3")
1410
implementation("org.apache.httpcomponents:httpclient:4.5.13")
1511
}

smoke-tests/apps/SpringBoot/src/main/java/com/microsoft/applicationinsights/smoketestapp/SpringBootApp.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ public static void main(String[] args) {
3535
SpringApplication.run(SpringBootApp.class, args);
3636
}
3737

38-
@Bean
39-
public Executor taskExecutor() {
40-
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
41-
executor.setCorePoolSize(2);
42-
executor.setMaxPoolSize(2);
43-
executor.setQueueCapacity(500);
44-
executor.setThreadNamePrefix("AsyncTaskExecutor-");
45-
executor.initialize();
46-
return executor;
47-
}
38+
// @Bean
39+
// public Executor taskExecutor() {
40+
// ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
41+
// executor.setCorePoolSize(2);
42+
// executor.setMaxPoolSize(2);
43+
// executor.setQueueCapacity(500);
44+
// executor.setThreadNamePrefix("AsyncTaskExecutor-");
45+
// executor.initialize();
46+
// return executor;
47+
// }
4848
}

smoke-tests/apps/SpringBoot/src/main/java/com/microsoft/applicationinsights/smoketestapp/TestController.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
package com.microsoft.applicationinsights.smoketestapp;
55

6-
import com.microsoft.applicationinsights.TelemetryClient;
76
import java.io.IOException;
87
import java.util.HashMap;
98
import java.util.Map;
@@ -16,8 +15,6 @@
1615
@RestController
1716
public class TestController {
1817

19-
private static final TelemetryClient client = new TelemetryClient();
20-
2118
@Autowired private TestBean testBean;
2219

2320
@GetMapping("/")
@@ -40,9 +37,6 @@ public String trackEventSpringBoot() {
4037
}
4138
};
4239

43-
// Event
44-
client.trackEvent("EventDataTest");
45-
client.trackEvent("EventDataPropertyTest", properties, metrics);
4640
return "hello";
4741
}
4842

smoke-tests/apps/SpringBoot/src/smokeTest/java/com/microsoft/applicationinsights/smoketest/SpringBootTest.java

Lines changed: 0 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -35,73 +35,6 @@ abstract class SpringBootTest {
3535

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

38-
@Test
39-
@TargetUri("/basic/trackEvent")
40-
void trackEvent() throws Exception {
41-
List<Envelope> rdList = testing.mockedIngestion.waitForItems("RequestData", 1);
42-
Envelope rdEnvelope = rdList.get(0);
43-
String operationId = rdEnvelope.getTags().get("ai.operation.id");
44-
45-
testing.mockedIngestion.waitForItemsInOperation("EventData", 2, operationId);
46-
47-
// TODO get event data envelope and verify value
48-
List<EventData> data = testing.mockedIngestion.getTelemetryDataByTypeInRequest("EventData");
49-
50-
assertThat(data).anySatisfy(ed -> assertThat(ed.getName()).isEqualTo("EventDataTest"));
51-
52-
assertThat(data)
53-
.anySatisfy(
54-
ed -> {
55-
assertThat(ed.getName()).isEqualTo("EventDataPropertyTest");
56-
assertThat(ed.getProperties()).containsEntry("key", "value");
57-
assertThat(ed.getMeasurements()).containsEntry("key", 1.0);
58-
});
59-
}
60-
61-
@Test
62-
@TargetUri("/throwsException")
63-
void testResultCodeWhenRestControllerThrows() throws Exception {
64-
List<Envelope> rdList = testing.mockedIngestion.waitForItems("RequestData", 1);
65-
66-
Envelope rdEnvelope = rdList.get(0);
67-
List<Envelope> exceptions = testing.mockedIngestion.waitForItems("ExceptionData", 1);
68-
assertThat(exceptions).hasSize(1);
69-
assertThat(testing.mockedIngestion.getCountForType("EventData")).isZero();
70-
71-
Envelope edEnvelope1 = exceptions.get(0);
72-
73-
// assert on edEnvelope1
74-
75-
assertThat(rdEnvelope.getSampleRate()).isNull();
76-
assertThat(edEnvelope1.getSampleRate()).isNull();
77-
78-
RequestData rd = testing.getTelemetryDataForType(0, "RequestData");
79-
ExceptionData ed = (ExceptionData) ((Data<?>) edEnvelope1.getData()).getBaseData();
80-
81-
List<ExceptionDetails> details = ed.getExceptions();
82-
ExceptionDetails ex = details.get(0);
83-
84-
assertThat(rd.getName()).isEqualTo("GET /SpringBoot/throwsException");
85-
assertThat(rd.getResponseCode()).isEqualTo("500");
86-
assertThat(rd.getProperties())
87-
.containsExactly(entry("_MS.ProcessedByMetricExtractors", "True"));
88-
assertThat(rd.getSuccess()).isFalse();
89-
90-
assertThat(ex.getTypeName()).isEqualTo("javax.servlet.ServletException");
91-
assertThat(ex.getMessage()).isEqualTo("This is an exception");
92-
assertThat(ed.getSeverityLevel()).isEqualTo(SeverityLevel.ERROR);
93-
assertThat(ed.getProperties())
94-
.containsKey("Logger Message"); // specific message varies by app server
95-
assertThat(ed.getProperties()).containsEntry("SourceType", "Logger");
96-
assertThat(ed.getProperties())
97-
.containsKey("LoggerName"); // specific logger varies by app server
98-
assertThat(ed.getProperties()).containsKey("ThreadName");
99-
assertThat(ed.getProperties()).hasSize(4);
100-
101-
SmokeTestExtension.assertParentChild(
102-
rd, rdEnvelope, edEnvelope1, "GET /SpringBoot/throwsException");
103-
}
104-
10538
@Test
10639
@TargetUri("/asyncDependencyCall")
10740
void testAsyncDependencyCall() throws Exception {
@@ -141,37 +74,4 @@ void testAsyncDependencyCall() throws Exception {
14174

14275
@Environment(TOMCAT_8_JAVA_8)
14376
static class Tomcat8Java8Test extends SpringBootTest {}
144-
145-
@Environment(TOMCAT_8_JAVA_8_OPENJ9)
146-
static class Tomcat8Java8OpenJ9Test extends SpringBootTest {}
147-
148-
@Environment(TOMCAT_8_JAVA_11)
149-
static class Tomcat8Java11Test extends SpringBootTest {}
150-
151-
@Environment(TOMCAT_8_JAVA_11_OPENJ9)
152-
static class Tomcat8Java11OpenJ9Test extends SpringBootTest {}
153-
154-
@Environment(TOMCAT_8_JAVA_17)
155-
static class Tomcat8Java17Test extends SpringBootTest {}
156-
157-
@Environment(TOMCAT_8_JAVA_17_OPENJ9)
158-
static class Tomcat8Java17OpenJ9Test extends SpringBootTest {}
159-
160-
@Environment(TOMCAT_8_JAVA_21)
161-
static class Tomcat8Java21Test extends SpringBootTest {}
162-
163-
@Environment(TOMCAT_8_JAVA_21_OPENJ9)
164-
static class Tomcat8Java21OpenJ9Test extends SpringBootTest {}
165-
166-
@Environment(TOMCAT_8_JAVA_25)
167-
static class Tomcat8Java23Test extends SpringBootTest {}
168-
169-
@Environment(TOMCAT_8_JAVA_25_OPENJ9)
170-
static class Tomcat8Java23OpenJ9Test extends SpringBootTest {}
171-
172-
@Environment(WILDFLY_13_JAVA_8)
173-
static class Wildfly13Java8Test extends SpringBootTest {}
174-
175-
@Environment(WILDFLY_13_JAVA_8_OPENJ9)
176-
static class Wildfly13Java8OpenJ9Test extends SpringBootTest {}
17777
}

0 commit comments

Comments
 (0)