You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Colm O hEigeartaigh (Jira)" <ji...@apache.org> on 2019/08/22 08:20:00 UTC

[jira] [Assigned] (CXF-8086) Override test fixture of super tests may lead to flaky test

     [ https://issues.apache.org/jira/browse/CXF-8086?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Colm O hEigeartaigh reassigned CXF-8086:
----------------------------------------

    Assignee: Colm O hEigeartaigh

> 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: Test
>          Components: JAX-RS
>    Affects Versions: 3.3.2
>            Reporter: zi peng
>            Assignee: Colm O hEigeartaigh
>            Priority: Major
>
> 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
(v8.3.2#803003)