Skip to content

Commit 6bf8a19

Browse files
committed
solve springboot trace fat test
1 parent cd2b3ae commit 6bf8a19

File tree

4 files changed

+24
-117
lines changed

4 files changed

+24
-117
lines changed

dev/io.openliberty.springboot.fat30_fat/fat/src/com/ibm/ws/springboot/support/fat/EnableSpringBootTraceTests30.java

Lines changed: 5 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@
1414

1515
import static componenttest.custom.junit.runner.Mode.TestMode.FULL;
1616

17-
import java.util.Collections;
17+
import java.util.Arrays;
1818
import java.util.HashMap;
19+
import java.util.HashSet;
1920
import java.util.Map;
2021
import java.util.Set;
2122

@@ -27,99 +28,14 @@
2728
import componenttest.custom.junit.runner.FATRunner;
2829
import componenttest.custom.junit.runner.Mode;
2930

30-
// Disabled: Failing to start web server.
31-
32-
// org.springframework.context.ApplicationContextException: Unable to start web serve
33-
// at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:164) ~[spring-boot-3.0.4.jar:3.0.4
34-
// at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:578) ~[spring-context-6.0.6.jar:6.0.6
35-
// at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.0.4.jar:3.0.4
36-
// at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:732) ~[spring-boot-3.0.4.jar:3.0.4
37-
// at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434) ~[spring-boot-3.0.4.jar:3.0.4
38-
// at org.springframework.boot.SpringApplication.run(SpringApplication.java:310) ~[spring-boot-3.0.4.jar:3.0.4
39-
// at org.springframework.boot.SpringApplication.run(SpringApplication.java:1304) ~[spring-boot-3.0.4.jar:3.0.4
40-
// at org.springframework.boot.SpringApplication.run(SpringApplication.java:1293) ~[spring-boot-3.0.4.jar:3.0.4
41-
// at com.ibm.ws.springboot.fat30.test.app.TestApplication.main(TestApplication.java:36) ~[com.ibm.ws.springboot.fat30.app-0.0.1-SNAPSHOT.spring:na
42-
// at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na
43-
// at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na
44-
// at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na
45-
// at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na
46-
// at com.ibm.ws.app.manager.springboot.internal.SpringBootRuntimeContainer.lambda$invokeSpringMain$6(SpringBootRuntimeContainer.java:139) ~[na:na
47-
// at com.ibm.ws.threading.internal.ExecutorServiceImpl$RunnableWrapper.run(ExecutorServiceImpl.java:247) ~[na:na
48-
// at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[na:na
49-
// at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[na:na
50-
// at java.base/java.lang.Thread.run(Thread.java:857) ~[na:na
51-
// Caused by: org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomca
52-
// at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:142) ~[spring-boot-3.0.4.jar:3.0.4
53-
// at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.<init>(TomcatWebServer.java:104) ~[spring-boot-3.0.4.jar:3.0.4
54-
// at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getTomcatWebServer(TomcatServletWebServerFactory.java:488) ~[spring-boot-3.0.4.jar:3.0.4
55-
// at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:210) ~[spring-boot-3.0.4.jar:3.0.4
56-
// at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:183) ~[spring-boot-3.0.4.jar:3.0.4
57-
// at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:161) ~[spring-boot-3.0.4.jar:3.0.4
58-
// ... 17 common frames omitte
59-
// Caused by: org.apache.catalina.LifecycleException: A child container failed during star
60-
// at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:890) ~[tomcat-embed-core-10.1.8.jar:10.1.8
61-
// at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:241) ~[tomcat-embed-core-10.1.8.jar:10.1.8
62-
// at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-10.1.8.jar:10.1.8
63-
// at org.apache.catalina.core.StandardService.startInternal(StandardService.java:428) ~[tomcat-embed-core-10.1.8.jar:10.1.8
64-
// at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-10.1.8.jar:10.1.8
65-
// at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:913) ~[tomcat-embed-core-10.1.8.jar:10.1.8
66-
// at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-10.1.8.jar:10.1.8
67-
// at org.apache.catalina.startup.Tomcat.start(Tomcat.java:485) ~[tomcat-embed-core-10.1.8.jar:10.1.8
68-
// at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:123) ~[spring-boot-3.0.4.jar:3.0.4
69-
// ... 22 common frames omitte
70-
// Caused by: java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: A child container failed during star
71-
// at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[na:na
72-
// at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191) ~[na:na
73-
// at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:878) ~[tomcat-embed-core-10.1.8.jar:10.1.8
74-
// ... 30 common frames omitte
75-
// Caused by: org.apache.catalina.LifecycleException: A child container failed during star
76-
// at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:890) ~[tomcat-embed-core-10.1.8.jar:10.1.8
77-
// at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:846) ~[tomcat-embed-core-10.1.8.jar:10.1.8
78-
// at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-10.1.8.jar:10.1.8
79-
// at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1332) ~[tomcat-embed-core-10.1.8.jar:10.1.8
80-
// at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1322) ~[tomcat-embed-core-10.1.8.jar:10.1.8
81-
// at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[na:na
82-
// at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) ~[tomcat-embed-core-10.1.8.jar:10.1.8
83-
// at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145) ~[na:na
84-
// at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:871) ~[tomcat-embed-core-10.1.8.jar:10.1.8
85-
// ... 30 common frames omitte
86-
// Caused by: java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to initialize component [org.apache.catalina.webresources.StandardRoot@f618ee6e
87-
// at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[na:na
88-
// at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191) ~[na:na
89-
// at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:878) ~[tomcat-embed-core-10.1.8.jar:10.1.8
90-
// ... 38 common frames omitte
91-
// Caused by: org.apache.catalina.LifecycleException: Failed to initialize component [org.apache.catalina.webresources.StandardRoot@f618ee6e
92-
// at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440) ~[tomcat-embed-core-10.1.8.jar:10.1.8
93-
// at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:139) ~[tomcat-embed-core-10.1.8.jar:10.1.8
94-
// at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:173) ~[tomcat-embed-core-10.1.8.jar:10.1.8
95-
// at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4567) ~[tomcat-embed-core-10.1.8.jar:10.1.8
96-
// at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4700) ~[tomcat-embed-core-10.1.8.jar:10.1.8
97-
// at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-10.1.8.jar:10.1.8
98-
// at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1332) ~[tomcat-embed-core-10.1.8.jar:10.1.8
99-
// at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1322) ~[tomcat-embed-core-10.1.8.jar:10.1.8
100-
// at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[na:na
101-
// at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) ~[tomcat-embed-core-10.1.8.jar:10.1.8
102-
// at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145) ~[na:na
103-
// at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:871) ~[tomcat-embed-core-10.1.8.jar:10.1.8
104-
// ... 38 common frames omitte
105-
// Caused by: java.lang.Error: factory already define
106-
// at java.base/java.net.URL.setURLStreamHandlerFactory(URL.java:1228) ~[na:na
107-
// at org.apache.catalina.webresources.TomcatURLStreamHandlerFactory.<init>(TomcatURLStreamHandlerFactory.java:121) ~[tomcat-embed-core-10.1.8.jar:10.1.8
108-
// at org.apache.catalina.webresources.TomcatURLStreamHandlerFactory.getInstanceInternal(TomcatURLStreamHandlerFactory.java:52) ~[tomcat-embed-core-10.1.8.jar:10.1.8
109-
// at org.apache.catalina.webresources.TomcatURLStreamHandlerFactory.register(TomcatURLStreamHandlerFactory.java:73) ~[tomcat-embed-core-10.1.8.jar:10.1.8
110-
// at org.apache.catalina.webresources.StandardRoot.registerURLStreamHandlerFactory(StandardRoot.java:699) ~[tomcat-embed-core-10.1.8.jar:10.1.8
111-
// at org.apache.catalina.webresources.StandardRoot.initInternal(StandardRoot.java:686) ~[tomcat-embed-core-10.1.8.jar:10.1.8
112-
// at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136) ~[tomcat-embed-core-10.1.8.jar:10.1.8
113-
// ... 48 common frames omitted
114-
11531
@RunWith(FATRunner.class)
116-
@Mode(FULL)
32+
//@Mode(FULL)
11733
@MinimumJavaLevel(javaLevel = 17)
11834
public class EnableSpringBootTraceTests30 extends CommonWebServerTests {
11935

12036
@Override
12137
public Set<String> getFeatures() {
122-
return Collections.singleton("springBoot-3.0");
38+
return new HashSet<>(Arrays.asList("springBoot-3.0", "servlet-6.0"));
12339
}
12440

12541
@Override
@@ -143,4 +59,4 @@ public void stopTestServer() throws Exception {
14359
public void testEnableSpringBootTraceFor30() throws Exception {
14460
testBasicSpringBootApplication();
14561
}
146-
}
62+
}

dev/io.openliberty.springboot.fat30_fat/fat/src/com/ibm/ws/springboot/support/fat/FATSuite.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@
5353
WebSocketTests30.class,
5454
MimeMapping30.class,
5555
ErrorPage30Test.class,
56-
//EnableSpringBootTraceTests30.class,
57-
// Disabled: Failing to start web server. See the test class for details.
56+
EnableSpringBootTraceTests30.class,
5857
ExceptionOccuredAfterAppIsAvailableTest30.class,
5958
JakartaFeatureTests30.class,
6059
TemplateTests30.class,

dev/io.openliberty.springboot.fat30_fat/fat/src/com/ibm/ws/springboot/support/fat/MissingServletTests30.java

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,25 +34,14 @@ public boolean expectApplicationSuccess() {
3434
return false;
3535
}
3636

37-
// Disabled: The jakarta servlet class is being provisioned even without the servlet feature!
38-
//
39-
// FeatureAuditor: Found [ true ] class [ org.springframework.web.WebApplicationInitializer ] as [ org/springframework/web/WebApplicationInitializer.class ]
40-
// FeatureAuditor: Found [ false ] class [ org.springframework.web.socket.WebSocketHandler ] as [ org/springframework/web/socket/WebSocketHandler.class ]
41-
// FeatureAuditor: Found [ false ] class [ com.ibm.ws.springboot.support.web.server.version15.container.LibertyConfiguration ] as [ com/ibm/ws/springboot/support/web/server/version15/container/LibertyConfiguration.class ]
42-
// FeatureAuditor: Found [ false ] class [ com.ibm.ws.springboot.support.web.server.version20.container.LibertyConfiguration ] as [ com/ibm/ws/springboot/support/web/server/version20/container/LibertyConfiguration.class ]
43-
// FeatureAuditor: Found [ false ] class [ io.openliberty.springboot.support.web.server.version30.container.LibertyConfiguration ] as [ io/openliberty/springboot/support/web/server/version30/container/LibertyConfiguration.class ]
44-
// FeatureAuditor: Found [ false ] class [ javax.servlet.Servlet ] as [ javax/servlet/Servlet.class ]
45-
// FeatureAuditor: Found [ true ] class [ jakarta.servlet.Servlet ] as [ jakarta/servlet/Servlet.class ]
46-
// FeatureAuditor: Found [ false ] class [ javax.websocket.WebSocketContainer ] as [ javax/websocket/WebSocketContainer.class ]
47-
// FeatureAuditor: Found [ true ] class [ jakarta.websocket.WebSocketContainer ] as [ jakarta/websocket/WebSocketContainer.class ]
48-
4937
@Test
5038
public void testMissingServletFor30() throws Exception {
5139
assertNotNull("No error message CWWKC0274E was found for missing servlet feature",
5240
server.waitForStringInLog("CWWKC0274E"));
5341
stopServer(true, "CWWKC0274E", "CWWKZ0002E");
5442
}
5543

44+
// appsecurity-5.0 cannot be added for a seperate test as it contains the servlet-6.0 feature
5645
@Override
5746
public Set<String> getFeatures() {
5847
return Collections.singleton("springBoot-3.0");

dev/io.openliberty.springboot.fat30_fat/fat/src/com/ibm/ws/springboot/support/fat/MissingWebsocketFeatureTests30.java

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import static componenttest.custom.junit.runner.Mode.TestMode.FULL;
1616
import static org.junit.Assert.assertNotNull;
1717

18-
import java.util.Arrays;
1918
import java.util.HashSet;
2019
import java.util.Set;
2120

@@ -35,28 +34,32 @@ public boolean expectApplicationSuccess() {
3534
return false;
3635
}
3736

38-
// Disabled: The jakarta web socket class is being provisioned even without the web socket feature!
39-
//
40-
// FeatureAuditor: Found [ true ] class [ org.springframework.web.WebApplicationInitializer ] as [ org/springframework/web/WebApplicationInitializer.class ]
41-
// FeatureAuditor: Found [ true ] class [ org.springframework.web.socket.WebSocketHandler ] as [ org/springframework/web/socket/WebSocketHandler.class ]
42-
// FeatureAuditor: Found [ false ] class [ com.ibm.ws.springboot.support.web.server.version15.container.LibertyConfiguration ] as [ com/ibm/ws/springboot/support/web/server/version15/container/LibertyConfiguration.class ]
43-
// FeatureAuditor: Found [ false ] class [ com.ibm.ws.springboot.support.web.server.version20.container.LibertyConfiguration ] as [ com/ibm/ws/springboot/support/web/server/version20/container/LibertyConfiguration.class ]
44-
// FeatureAuditor: Found [ true ] class [ io.openliberty.springboot.support.web.server.version30.container.LibertyConfiguration ] as [ io/openliberty/springboot/support/web/server/version30/container/LibertyConfiguration.class ]
45-
// FeatureAuditor: Found [ false ] class [ javax.servlet.Servlet ] as [ javax/servlet/Servlet.class ]
46-
// FeatureAuditor: Found [ true ] class [ jakarta.servlet.Servlet ] as [ jakarta/servlet/Servlet.class ]
47-
// FeatureAuditor: Found [ false ] class [ javax.websocket.WebSocketContainer ] as [ javax/websocket/WebSocketContainer.class ]
48-
// FeatureAuditor: Found [ true ] class [ jakarta.websocket.WebSocketContainer ] as [ jakarta/websocket/WebSocketContainer.class ]
49-
5037
@Test
5138
public void testMissingWebsocketFor30() throws Exception {
5239
assertNotNull("No error message CWWKC0275E was found for missing websocket feature",
5340
server.waitForStringInLog("CWWKC0275E"));
5441
stopServer(true, "CWWKC0275E", "CWWKZ0002E");
5542
}
5643

44+
@Test
45+
public void testMissingWebsocketWithSecurity() throws Exception {
46+
assertNotNull("No error message CWWKC0275E was found for missing websocket feature",
47+
server.waitForStringInLog("CWWKC0275E"));
48+
stopServer(true, "CWWKC0275E", "CWWKZ0002E");
49+
}
50+
5751
@Override
5852
public Set<String> getFeatures() {
59-
return new HashSet<>(Arrays.asList("springBoot-3.0", "servlet-6.0"));
53+
HashSet<String> features = new HashSet<>(3);
54+
features.add("springBoot-3.0");
55+
features.add("servlet-6.0");
56+
57+
String methodName = testName.getMethodName();
58+
if ((methodName != null) && methodName.equals("testMissingWebsocketWithSecurity")) {
59+
features.add("appSecurity-5.0");
60+
}
61+
62+
return features;
6063
}
6164

6265
@Override

0 commit comments

Comments
 (0)