How to specify context path for jersey test with external provider

后端 未结 2 1979
梦毁少年i
梦毁少年i 2021-01-26 01:52

I want my jersey tests to run on one instance of tomcat which has the rest services running at

 http://myhost:port/contexpath/service1/ 
 http://myhost:port/con         


        
2条回答
  •  无人及你
    2021-01-26 02:43

    Finally I figured out a solution

     @Override
      public TestContainerFactory getTestContainerFactory() {
        return new ExternalTestContainerFactory(){
    
          @Override
          public TestContainer create(URI baseUri, DeploymentContext context)
              throws IllegalArgumentException {
            try {
              baseUri = new URI("http://localhost:8000/contextpath");
            } catch (URISyntaxException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
            }
            return super.create(baseUri, context);
          }
          };
      }
    

提交回复
热议问题