@Override @Before public void setUp() throws Exception { destroyed.clear(); destroyed.put("application", false); destroyed.put("singleton-resource", false); destroyed.put("filter", false); destroyed.put("writer", false); destroyed.put("singleton-factory", false); super.setUp(); }
@Override @Before public void setUp() throws Exception { super.setUp(); clientUtil = new ClientUtil(target()); wiser = new Wiser(); wiser.setPort(2500); wiser.start(); // Force shutdown DBIF.reset(); String httpRoot = URLDecoder.decode( new File(getClass().getResource("/").getFile()).getAbsolutePath(), "utf-8"); httpServer = HttpServer.createSimpleServer(httpRoot, "localhost", getPort()); WebappContext context = new WebappContext("GrizzlyContext", "/music"); context .addFilter("requestContextFilter", RequestContextFilter.class) .addMappingForUrlPatterns(null, "/*"); context .addFilter("tokenBasedSecurityFilter", TokenBasedSecurityFilter.class) .addMappingForUrlPatterns(null, "/*"); ServletRegistration reg = context.addServlet("jerseyServlet", ServletContainer.class); reg.setInitParameter( "jersey.config.server.provider.packages", "com.sismics.music.rest.resource"); reg.setInitParameter( "jersey.config.server.provider.classnames", "org.glassfish.jersey.media.multipart.MultiPartFeature"); reg.setInitParameter("jersey.config.server.response.setStatusOverSendError", "true"); reg.setLoadOnStartup(1); reg.addMapping("/*"); reg.setAsyncSupported(true); context.deploy(httpServer); httpServer.start(); }