@Test public void testInit() throws IOException { MockServletContext servletContext = new MockServletContext(); tavern.addPlugin(new SpringTavernPlugin()); servletContext.addInitParameter("contextConfigLocation","classpath*:spring/appcontext-*.xml"); tavern.setServletContext(servletContext); tavern.init(); tavern.resolve(); Application currentApplication = Tavern.getCurrentApplication(getClass()); TestBean bean = currentApplication.getBean("testBean"); assertNotNull(bean); bean = currentApplication.getBean(TestBean.class); assertNotNull(bean); }
public void init() throws IOException { Enumeration<URL> resources = getClass().getClassLoader().getResources("app.xml"); while (resources.hasMoreElements()) { URL url = resources.nextElement(); URLConnection urlConnection = url.openConnection(); urlConnection.connect(); ApplicationConfig config = parser.parse(urlConnection.getInputStream()); Assert.notNull(config.getName(), "Name of application must not be null!"); Application application = new Application(config, ResourceUtils.extractJarFileURL(url).toString()); tavernApplicationContainer.register(application); applicationList.add(application); } ApplicationConfig globalConfig = new ApplicationConfig(); globalConfig.setName(GLOBAL_APPLICATION); Application globalApplication = new Application(globalConfig, null); globalApplication.setRoot(true); tavernApplicationContainer.register(globalApplication); applicationList.add(globalApplication); for (Application application : applicationList) { PluginContext pluginContext = new PluginContext(application, tavernApplicationContainer, servletContext); for (TavernPlugin plugin : plugins) { plugin.init(pluginContext); } } }
Tavern { public void init() throws IOException { Enumeration<URL> resources = getClass().getClassLoader().getResources("app.xml"); while (resources.hasMoreElements()) { URL url = resources.nextElement(); URLConnection urlConnection = url.openConnection(); urlConnection.connect(); ApplicationConfig config = parser.parse(urlConnection.getInputStream()); Assert.notNull(config.getName(), "Name of application must not be null!"); Application application = new Application(config, ResourceUtils.extractJarFileURL(url).toString()); tavernApplicationContainer.register(application); applicationList.add(application); } ApplicationConfig globalConfig = new ApplicationConfig(); globalConfig.setName(GLOBAL_APPLICATION); Application globalApplication = new Application(globalConfig, null); globalApplication.setRoot(true); tavernApplicationContainer.register(globalApplication); applicationList.add(globalApplication); for (Application application : applicationList) { PluginContext pluginContext = new PluginContext(application, tavernApplicationContainer, servletContext); for (TavernPlugin plugin : plugins) { plugin.init(pluginContext); } } } }
Tavern { public void init() throws IOException { Enumeration<URL> resources = getClass().getClassLoader().getResources("app.xml"); while (resources.hasMoreElements()) { URL url = resources.nextElement(); URLConnection urlConnection = url.openConnection(); urlConnection.connect(); ApplicationConfig config = parser.parse(urlConnection.getInputStream()); Assert.notNull(config.getName(), "Name of application must not be null!"); Application application = new Application(config, ResourceUtils.extractJarFileURL(url).toString()); tavernApplicationContainer.register(application); applicationList.add(application); } ApplicationConfig globalConfig = new ApplicationConfig(); globalConfig.setName(GLOBAL_APPLICATION); Application globalApplication = new Application(globalConfig, null); globalApplication.setRoot(true); tavernApplicationContainer.register(globalApplication); applicationList.add(globalApplication); for (Application application : applicationList) { PluginContext pluginContext = new PluginContext(application, tavernApplicationContainer, servletContext); for (TavernPlugin plugin : plugins) { plugin.init(pluginContext); } } }  }
Tavern { public void init() throws IOException { Enumeration<URL> resources = getClass().getClassLoader().getResources("app.xml"); while (resources.hasMoreElements()) { URL url = resources.nextElement(); URLConnection urlConnection = url.openConnection(); urlConnection.connect(); ApplicationConfig config = parser.parse(urlConnection.getInputStream()); Assert.notNull(config.getName(), "Name of application must not be null!"); Application application = new Application(config, ResourceUtils.extractJarFileURL(url).toString()); tavernApplicationContainer.register(application); applicationList.add(application); } ApplicationConfig globalConfig = new ApplicationConfig(); globalConfig.setName(GLOBAL_APPLICATION); Application globalApplication = new Application(globalConfig, null); globalApplication.setRoot(true); tavernApplicationContainer.register(globalApplication); applicationList.add(globalApplication); for (Application application : applicationList) { PluginContext pluginContext = new PluginContext(application, tavernApplicationContainer, servletContext); for (TavernPlugin plugin : plugins) { plugin.init(pluginContext); } } }  static TavernApplicationContainer contexts(); static Application getCurrentApplication(Class<?> clazz); static Application getCurrentApplication(String clazzName); static Application getRoottApplication(); void init(); void run(); void resolve(); void destroy(); static void addPlugin(TavernPlugin plugin); void setServletContext(ServletContext servletContext); }
Tavern { public void init() throws IOException { Enumeration<URL> resources = getClass().getClassLoader().getResources("app.xml"); while (resources.hasMoreElements()) { URL url = resources.nextElement(); URLConnection urlConnection = url.openConnection(); urlConnection.connect(); ApplicationConfig config = parser.parse(urlConnection.getInputStream()); Assert.notNull(config.getName(), "Name of application must not be null!"); Application application = new Application(config, ResourceUtils.extractJarFileURL(url).toString()); tavernApplicationContainer.register(application); applicationList.add(application); } ApplicationConfig globalConfig = new ApplicationConfig(); globalConfig.setName(GLOBAL_APPLICATION); Application globalApplication = new Application(globalConfig, null); globalApplication.setRoot(true); tavernApplicationContainer.register(globalApplication); applicationList.add(globalApplication); for (Application application : applicationList) { PluginContext pluginContext = new PluginContext(application, tavernApplicationContainer, servletContext); for (TavernPlugin plugin : plugins) { plugin.init(pluginContext); } } }  static TavernApplicationContainer contexts(); static Application getCurrentApplication(Class<?> clazz); static Application getCurrentApplication(String clazzName); static Application getRoottApplication(); void init(); void run(); void resolve(); void destroy(); static void addPlugin(TavernPlugin plugin); void setServletContext(ServletContext servletContext); static final String GLOBAL_APPLICATION; }