@Test public void testNegativeStartup() throws ServletException { try { PDPRestInitializer init = new PDPRestInitializer(); ServletContext container = Mockito.mock(ServletContext.class); init.onStartup(container); fail("Expecting an exception."); } catch (Exception ex) { assertTrue(true); } }
@Override public void onStartup(ServletContext container) throws ServletException { PolicyLogger.info("PDP-REST Application Initialization Started... "); AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); ctx.register(PDPRestConfig.class); ctx.setServletContext(container); ctx.refresh(); ServletRegistration.Dynamic servlet = container.addServlet( "dispatcher", new DispatcherServlet(ctx)); servlet.setLoadOnStartup(1); servlet.addMapping("/api/*"); servlet.setMultipartConfig(ctx.getBean(MultipartConfigElement.class)); }
PDPRestInitializer implements WebApplicationInitializer { @Override public void onStartup(ServletContext container) throws ServletException { PolicyLogger.info("PDP-REST Application Initialization Started... "); AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); ctx.register(PDPRestConfig.class); ctx.setServletContext(container); ctx.refresh(); ServletRegistration.Dynamic servlet = container.addServlet( "dispatcher", new DispatcherServlet(ctx)); servlet.setLoadOnStartup(1); servlet.addMapping("/api/*"); servlet.setMultipartConfig(ctx.getBean(MultipartConfigElement.class)); } }
PDPRestInitializer implements WebApplicationInitializer { @Override public void onStartup(ServletContext container) throws ServletException { PolicyLogger.info("PDP-REST Application Initialization Started... "); AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); ctx.register(PDPRestConfig.class); ctx.setServletContext(container); ctx.refresh(); ServletRegistration.Dynamic servlet = container.addServlet( "dispatcher", new DispatcherServlet(ctx)); servlet.setLoadOnStartup(1); servlet.addMapping("/api/*"); servlet.setMultipartConfig(ctx.getBean(MultipartConfigElement.class)); }  }
PDPRestInitializer implements WebApplicationInitializer { @Override public void onStartup(ServletContext container) throws ServletException { PolicyLogger.info("PDP-REST Application Initialization Started... "); AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); ctx.register(PDPRestConfig.class); ctx.setServletContext(container); ctx.refresh(); ServletRegistration.Dynamic servlet = container.addServlet( "dispatcher", new DispatcherServlet(ctx)); servlet.setLoadOnStartup(1); servlet.addMapping("/api/*"); servlet.setMultipartConfig(ctx.getBean(MultipartConfigElement.class)); }  @Override void onStartup(ServletContext container); }
PDPRestInitializer implements WebApplicationInitializer { @Override public void onStartup(ServletContext container) throws ServletException { PolicyLogger.info("PDP-REST Application Initialization Started... "); AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); ctx.register(PDPRestConfig.class); ctx.setServletContext(container); ctx.refresh(); ServletRegistration.Dynamic servlet = container.addServlet( "dispatcher", new DispatcherServlet(ctx)); servlet.setLoadOnStartup(1); servlet.addMapping("/api/*"); servlet.setMultipartConfig(ctx.getBean(MultipartConfigElement.class)); }  @Override void onStartup(ServletContext container);  }