You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "zi peng (JIRA)" <ji...@apache.org> on 2019/08/07 16:43:00 UTC
[jira] [Created] (CXF-8086) Override test fixture of super tests
may lead to flaky test
zi peng created CXF-8086:
----------------------------
Summary: Override test fixture of super tests may lead to flaky test
Key: CXF-8086
URL: https://issues.apache.org/jira/browse/CXF-8086
Project: CXF
Issue Type: Improvement
Components: JAX-RS
Affects Versions: 3.3.2
Reporter: zi peng
h2. Problem Description: super class _JAXRSClientServerWebSocketTest_ invoke clearAllMaps({color:#ff0000}*)*{color} before launch server. But in _JAXRSClientServerWebSocketSpringWebAppTest_ which extends the super class, test fixture override startServers() without clearAllMaps()
h2. Result: May lead to flaky test
h2. Suggestion: Maintain independent test fixture.
{code:java}
// JAXRSClientServerWebSocketTest.java
@BeforeClass
public static void startServers() throws Exception {
AbstractResourceInfo.clearAllMaps();
assertTrue("server did not launch correctly", launchServer(new BookServerWebSocket()));
createStaticBus();
}{code}
{code:java}
//JAXRSClientServerWebSocketSpringWebAppTest.java
@BeforeClass
public static void startServers() throws Exception {
startServers(PORT);
}
protected static void startServers(String port) throws Exception {
server = new org.eclipse.jetty.server.Server(Integer.parseInt(port));
WebAppContext webappcontext = new WebAppContext();
String contextPath = null;
try {
contextPath = JAXRSClientServerWebSocketSpringWebAppTest.class
.getResource("/jaxrs_websocket").toURI().getPath();
} catch (URISyntaxException e1) {
e1.printStackTrace();
}
webappcontext.setContextPath("/webapp");
webappcontext.setWar(contextPath);
HandlerCollection handlers = new HandlerCollection();
handlers.setHandlers(new Handler[] {webappcontext, new DefaultHandler()});
server.setHandler(handlers);
server.start();
}{code}
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)