List of usage examples for org.springframework.context.support StaticApplicationContext StaticApplicationContext
public StaticApplicationContext() throws BeansException
From source file:org.wte4j.examples.showcase.server.hsql.ShowCaseDbInitializer.java
public static void main(String... args) { ShowCaseDbInitializer initializer = new ShowCaseDbInitializer(new StaticApplicationContext()); boolean overide = false; if (args.length == 2) { overide = Boolean.parseBoolean(args[1]); }//w w w.j a v a 2s . co m HsqlServerBean hsqlServerBean = initializer.createDatabase(Paths.get(args[0]), overide); hsqlServerBean.startDatabase(); }
From source file:gov.nih.nci.cabig.ctms.web.tabs.DefaultTabConfigurerTest.java
@Override protected void setUp() throws Exception { super.setUp(); applicationContext = new StaticApplicationContext(); applicationContext.registerBeanDefinition("beanZero", createTestBeanDef(0)); applicationContext.registerBeanDefinition("beanOne", createTestBeanDef(1)); // deliberately no beanTwo configurer = new DefaultTabConfigurer(); configurer.setApplicationContext(applicationContext); tab0 = new TabZero(); tab1 = new TabOne(); tabA = new TabAll(); flow = new Flow<Object>("test"); flow.addTab(tab0);/*from w w w. ja v a 2 s . c om*/ flow.addTab(tab1); flow.addTab(tabA); }
From source file:org.nuunframework.spring.UsingSpringAsDIPlugin.java
@Override public Object dependencyInjectionDef() { ClassPathXmlApplicationContext parentCtx = new ClassPathXmlApplicationContext("context.xml"); StaticApplicationContext dynCtx = new StaticApplicationContext(); GenericBeanDefinition beanDef = new GenericBeanDefinition(); beanDef.setBeanClass(Service3Internal.class); beanDef.setScope("prototype"); dynCtx.registerBeanDefinition("service3", beanDef); dynCtx.setParent(parentCtx);/*w ww . j a v a 2s . c o m*/ dynCtx.refresh(); return dynCtx; }
From source file:io.nuun.plugin.spring.UsingSpringAsDIPlugin.java
public Object nativeUnitModule() { ClassPathXmlApplicationContext parentCtx = new ClassPathXmlApplicationContext("context.xml"); StaticApplicationContext dynCtx = new StaticApplicationContext(); GenericBeanDefinition beanDef = new GenericBeanDefinition(); beanDef.setBeanClass(Service3Internal.class); beanDef.setScope("prototype"); dynCtx.registerBeanDefinition("service3", beanDef); dynCtx.setParent(parentCtx);/*from w ww .j av a 2 s. c o m*/ dynCtx.refresh(); return dynCtx; }
From source file:org.wte4j.examples.showcase.server.hsql.ShowCaseDbInitializerTest.java
@Test public void createDatabaseFiles() throws IOException { ApplicationContext context = new StaticApplicationContext(); Path directory = Files.createTempDirectory("database"); try {/*from w w w. j a v a2s .c om*/ ShowCaseDbInitializer showCaseDbInitializer = new ShowCaseDbInitializer(context); showCaseDbInitializer.createDateBaseFiles(directory, false); Set<String> fileNamesInDirectory = listFiles(directory); Set<String> expectedFileNames = new HashSet<String>(); expectedFileNames.add("wte4j-showcase.lobs"); expectedFileNames.add("wte4j-showcase.properties"); expectedFileNames.add("wte4j-showcase.script"); assertEquals(expectedFileNames, fileNamesInDirectory); } finally { deleteDirectory(directory); } }
From source file:org.bonitasoft.web.designer.utils.TestWebMvcConfigurationSupport.java
public TestWebMvcConfigurationSupport(DesignerConfig config) { this.config = config; StaticApplicationContext applicationContext = new StaticApplicationContext(); applicationContext.registerSingleton("resourceControllerAdvice", ResourceControllerAdvice.class); setApplicationContext(applicationContext); }
From source file:com.github.pjungermann.config.types.DefaultConfigFactorySelectorTest.java
@Test public void beanCreation_withSpringContextAndNoFactory_noErrorAndEmptyListAsDefault() { StaticApplicationContext context = new StaticApplicationContext(); context.registerSingleton(DefaultConfigFactorySelector.class.getName(), DefaultConfigFactorySelector.class); ConfigFactorySelector selector = context.getBean(ConfigFactorySelector.class); assertValidBean(selector);/*from ww w . ja v a2s.c o m*/ }
From source file:com.bbytes.zorba.jobworker.event.JobEventTest.java
@Test public void testEventPublishAndListener() { JobEvent jobEvent = new JobEvent("testid", JobStatusType.STARTED, null, "Test event"); StaticApplicationContext context = new StaticApplicationContext(); context.addApplicationListener(this); context.refresh();/* ww w . j a v a 2s .c om*/ context.publishEvent(jobEvent); }
From source file:at.ac.univie.isc.asio.nest.ContainerCleanUpTest.java
@Test public void should_ignore_close_events_of_other_contexts() throws Exception { subject.onApplicationEvent(new ContextClosedEvent(new StaticApplicationContext())); verifyZeroInteractions(action);//w w w . j a v a 2 s . co m }
From source file:org.jm.spring.controller.test.SpringMVCAPIReaderTest.java
@Before public void setUp() throws Exception { mapper = new ObjectMapper(); handler = new Handler(); StaticApplicationContext context = new StaticApplicationContext(); context.registerSingleton("handler", handler.getClass()); mapping = new RequestMappingHandlerMapping(); mapping.setApplicationContext(context); }