Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-8086

Override test fixture of super tests may lead to flaky test

    XMLWordPrintableJSON

Details

    • Test
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.3.2
    • 3.3.4
    • JAX-RS
    • None
    • Unknown

    Description

      Problem Description: super class JAXRSClientServerWebSocketTest invoke clearAllMaps() before launch server. But in JAXRSClientServerWebSocketSpringWebAppTest which extends the super class, test fixture override startServers() without clearAllMaps()

      Result: May lead to flaky test

      Suggestion: Maintain independent test fixture.

      // JAXRSClientServerWebSocketTest.java
      @BeforeClass 
      public static void startServers() throws Exception { 
          AbstractResourceInfo.clearAllMaps();
          assertTrue("server did not launch correctly", launchServer(new BookServerWebSocket())); 
          createStaticBus();
      }

       

      //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();
      	}

       

       

       

      Attachments

        Activity

          People

            coheigea Colm O hEigeartaigh
            zhouyapengzi zi peng
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: