List of usage examples for org.springframework.context ApplicationContext getClass
@HotSpotIntrinsicCandidate public final native Class<?> getClass();
From source file:com.mitre.fulfilmentprocess.test.PaymentIntegrationTest.java
@BeforeClass public static void prepare() throws Exception //NOPMD { Registry.activateStandaloneMode(); Utilities.setJUnitTenant();/*from www .ja v a 2s. co m*/ LOG.debug("Preparing..."); final ApplicationContext appCtx = Registry.getGlobalApplicationContext(); assertTrue("Application context of type " + appCtx.getClass() + " is not a subclass of " + ConfigurableApplicationContext.class, appCtx instanceof ConfigurableApplicationContext); final ConfigurableApplicationContext applicationContext = (ConfigurableApplicationContext) appCtx; final ConfigurableListableBeanFactory beanFactory = applicationContext.getBeanFactory(); assertTrue("Bean Factory of type " + beanFactory.getClass() + " is not of type " + BeanDefinitionRegistry.class, beanFactory instanceof BeanDefinitionRegistry); final XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader((BeanDefinitionRegistry) beanFactory); xmlReader.setDocumentReaderClass(ScopeTenantIgnoreDocReader.class); xmlReader.loadBeanDefinitions( new ClassPathResource("/mitrefulfilmentprocess/test/mitrefulfilmentprocess-spring-test.xml")); xmlReader.loadBeanDefinitions(new ClassPathResource( "/mitrefulfilmentprocess/test/mitrefulfilmentprocess-spring-test-fraudcheck.xml")); xmlReader.loadBeanDefinitions( new ClassPathResource("/mitrefulfilmentprocess/test/process/order-process-spring.xml")); modelService = (ModelService) getBean("modelService"); processService = (DefaultBusinessProcessService) getBean("businessProcessService"); definitonFactory = processService.getProcessDefinitionFactory(); LOG.warn("Prepare Process Definition factory..."); definitonFactory.add("classpath:/mitrefulfilmentprocess/test/process/payment-process.xml"); //setup command factory to mock final DefaultCommandFactoryRegistryImpl commandFactoryReg = appCtx .getBean(DefaultCommandFactoryRegistryImpl.class); commandFactoryReg .setCommandFactoryList(Arrays.asList((CommandFactory) appCtx.getBean("mockupCommandFactory"))); taskServiceStub = appCtx.getBean(TaskServiceStub.class); productService = appCtx.getBean("defaultProductService", DefaultProductService.class); cartService = appCtx.getBean("defaultCartService", DefaultCartService.class); userService = appCtx.getBean("defaultUserService", DefaultUserService.class); }
From source file:com.acc.fulfilmentprocess.test.ProcessFlowTest.java
@AfterClass public static void removeProcessDefinitions() { LOG.debug("cleanup..."); final ApplicationContext appCtx = Registry.getApplicationContext(); assertTrue("Application context of type " + appCtx.getClass() + " is not a subclass of " + ConfigurableApplicationContext.class, appCtx instanceof ConfigurableApplicationContext); final ConfigurableApplicationContext applicationContext = (ConfigurableApplicationContext) appCtx; final ConfigurableListableBeanFactory beanFactory = applicationContext.getBeanFactory(); assertTrue("Bean Factory of type " + beanFactory.getClass() + " is not of type " + BeanDefinitionRegistry.class, beanFactory instanceof BeanDefinitionRegistry); final XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader((BeanDefinitionRegistry) beanFactory); xmlReader.loadBeanDefinitions(//from w ww. j a v a 2 s . co m new ClassPathResource("/bncfulfilmentprocess/test/bncfulfilmentprocess-spring-testcleanup.xml")); //cleanup command factory final Map<String, CommandFactory> commandFactoryList = applicationContext .getBeansOfType(CommandFactory.class); commandFactoryList.remove("mockupCommandFactory"); final DefaultCommandFactoryRegistryImpl commandFactoryReg = appCtx .getBean(DefaultCommandFactoryRegistryImpl.class); commandFactoryReg.setCommandFactoryList(commandFactoryList.values()); processService.setTaskService(appCtx.getBean(DefaultTaskService.class)); definitonFactory = null; processService = null; }
From source file:com.exxonmobile.ace.hybris.fulfilmentprocess.test.ProcessFlowTest.java
@AfterClass public static void removeProcessDefinitions() { LOG.debug("cleanup..."); final ApplicationContext appCtx = Registry.getApplicationContext(); assertTrue("Application context of type " + appCtx.getClass() + " is not a subclass of " + ConfigurableApplicationContext.class, appCtx instanceof ConfigurableApplicationContext); final ConfigurableApplicationContext applicationContext = (ConfigurableApplicationContext) appCtx; final ConfigurableListableBeanFactory beanFactory = applicationContext.getBeanFactory(); assertTrue("Bean Factory of type " + beanFactory.getClass() + " is not of type " + BeanDefinitionRegistry.class, beanFactory instanceof BeanDefinitionRegistry); final XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader((BeanDefinitionRegistry) beanFactory); xmlReader.loadBeanDefinitions(new ClassPathResource( "/exxonmobilfulfilmentprocess/test/exxonmobilfulfilmentprocess-spring-testcleanup.xml")); //cleanup command factory final Map<String, CommandFactory> commandFactoryList = applicationContext .getBeansOfType(CommandFactory.class); commandFactoryList.remove("mockupCommandFactory"); final DefaultCommandFactoryRegistryImpl commandFactoryReg = appCtx .getBean(DefaultCommandFactoryRegistryImpl.class); commandFactoryReg.setCommandFactoryList(commandFactoryList.values()); processService.setTaskService(appCtx.getBean(DefaultTaskService.class)); definitonFactory = null;/*ww w.ja va 2 s.c o m*/ processService = null; }
From source file:com.mitre.fulfilmentprocess.test.ProcessFlowTest.java
@AfterClass public static void removeProcessDefinitions() { LOG.debug("cleanup..."); final ApplicationContext appCtx = Registry.getApplicationContext(); assertTrue("Application context of type " + appCtx.getClass() + " is not a subclass of " + ConfigurableApplicationContext.class, appCtx instanceof ConfigurableApplicationContext); final ConfigurableApplicationContext applicationContext = (ConfigurableApplicationContext) appCtx; final ConfigurableListableBeanFactory beanFactory = applicationContext.getBeanFactory(); assertTrue("Bean Factory of type " + beanFactory.getClass() + " is not of type " + BeanDefinitionRegistry.class, beanFactory instanceof BeanDefinitionRegistry); final XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader((BeanDefinitionRegistry) beanFactory); xmlReader.loadBeanDefinitions(new ClassPathResource( "/mitrefulfilmentprocess/test/mitrefulfilmentprocess-spring-testcleanup.xml")); //cleanup command factory final Map<String, CommandFactory> commandFactoryList = applicationContext .getBeansOfType(CommandFactory.class); commandFactoryList.remove("mockupCommandFactory"); final DefaultCommandFactoryRegistryImpl commandFactoryReg = appCtx .getBean(DefaultCommandFactoryRegistryImpl.class); commandFactoryReg.setCommandFactoryList(commandFactoryList.values()); processService.setTaskService(appCtx.getBean(DefaultTaskService.class)); definitonFactory = null;/* w w w . j a v a2 s. c o m*/ processService = null; }
From source file:org.vinmonopolet.fulfilmentprocess.test.ProcessFlowTest.java
@AfterClass public static void removeProcessDefinitions() { LOG.debug("cleanup..."); final ApplicationContext appCtx = Registry.getApplicationContext(); assertTrue("Application context of type " + appCtx.getClass() + " is not a subclass of " + ConfigurableApplicationContext.class, appCtx instanceof ConfigurableApplicationContext); final ConfigurableApplicationContext applicationContext = (ConfigurableApplicationContext) appCtx; final ConfigurableListableBeanFactory beanFactory = applicationContext.getBeanFactory(); assertTrue("Bean Factory of type " + beanFactory.getClass() + " is not of type " + BeanDefinitionRegistry.class, beanFactory instanceof BeanDefinitionRegistry); final XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader((BeanDefinitionRegistry) beanFactory); xmlReader.loadBeanDefinitions(new ClassPathResource( "/vinmonopoletfulfilmentprocess/test/vinmonopoletfulfilmentprocess-spring-testcleanup.xml")); //cleanup command factory final Map<String, CommandFactory> commandFactoryList = applicationContext .getBeansOfType(CommandFactory.class); commandFactoryList.remove("mockupCommandFactory"); final DefaultCommandFactoryRegistryImpl commandFactoryReg = appCtx .getBean(DefaultCommandFactoryRegistryImpl.class); commandFactoryReg.setCommandFactoryList(commandFactoryList.values()); processService.setTaskService(appCtx.getBean(DefaultTaskService.class)); definitonFactory = null;/*from ww w . j a v a2 s . c om*/ processService = null; }
From source file:org.training.fulfilmentprocess.test.ProcessFlowTest.java
@AfterClass public static void removeProcessDefinitions() { LOG.debug("cleanup..."); final ApplicationContext appCtx = Registry.getApplicationContext(); assertTrue("Application context of type " + appCtx.getClass() + " is not a subclass of " + ConfigurableApplicationContext.class, appCtx instanceof ConfigurableApplicationContext); final ConfigurableApplicationContext applicationContext = (ConfigurableApplicationContext) appCtx; final ConfigurableListableBeanFactory beanFactory = applicationContext.getBeanFactory(); assertTrue("Bean Factory of type " + beanFactory.getClass() + " is not of type " + BeanDefinitionRegistry.class, beanFactory instanceof BeanDefinitionRegistry); final XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader((BeanDefinitionRegistry) beanFactory); xmlReader.loadBeanDefinitions(new ClassPathResource( "/trainingfulfilmentprocess/test/trainingfulfilmentprocess-spring-testcleanup.xml")); //cleanup command factory final Map<String, CommandFactory> commandFactoryList = applicationContext .getBeansOfType(CommandFactory.class); commandFactoryList.remove("mockupCommandFactory"); final DefaultCommandFactoryRegistryImpl commandFactoryReg = appCtx .getBean(DefaultCommandFactoryRegistryImpl.class); commandFactoryReg.setCommandFactoryList(commandFactoryList.values()); processService.setTaskService(appCtx.getBean(DefaultTaskService.class)); definitonFactory = null;/*from www. jav a 2 s . c o m*/ processService = null; }
From source file:com.acc.fulfilmentprocess.test.ProcessFlowTest.java
@BeforeClass public static void prepare() throws Exception //NOPMD { Registry.activateStandaloneMode(); Utilities.setJUnitTenant();//from www.ja v a2s. c o m LOG.debug("Preparing..."); final ApplicationContext appCtx = Registry.getApplicationContext(); // final ConfigurationService configurationService = (ConfigurationService) appCtx.getBean("configurationService"); // configurationService.getConfiguration().setProperty("processengine.event.lockProcess", "true"); assertTrue("Application context of type " + appCtx.getClass() + " is not a subclass of " + ConfigurableApplicationContext.class, appCtx instanceof ConfigurableApplicationContext); final ConfigurableApplicationContext applicationContext = (ConfigurableApplicationContext) appCtx; final ConfigurableListableBeanFactory beanFactory = applicationContext.getBeanFactory(); assertTrue("Bean Factory of type " + beanFactory.getClass() + " is not of type " + BeanDefinitionRegistry.class, beanFactory instanceof BeanDefinitionRegistry); final XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader((BeanDefinitionRegistry) beanFactory); xmlReader.setDocumentReaderClass(ScopeTenantIgnoreDocReader.class); xmlReader.loadBeanDefinitions( new ClassPathResource("/bncfulfilmentprocess/test/bncfulfilmentprocess-spring-test.xml")); xmlReader.loadBeanDefinitions( new ClassPathResource("/bncfulfilmentprocess/test/process/order-process-spring.xml")); xmlReader.loadBeanDefinitions( new ClassPathResource("/bncfulfilmentprocess/test/process/consignment-process-spring.xml")); modelService = (ModelService) getBean("modelService"); processService = (DefaultBusinessProcessService) getBean("businessProcessService"); definitonFactory = processService.getProcessDefinitionFactory(); LOG.warn("Prepare Process Definition factory..."); definitonFactory.add("classpath:/bncfulfilmentprocess/test/process/order-process.xml"); definitonFactory.add("classpath:/bncfulfilmentprocess/test/process/consignment-process.xml"); LOG.warn("loaded 'order-process-test':" + definitonFactory.getProcessDefinition("order-process-test") + " in factory " + definitonFactory); //setup command factory to mock taskServiceStub = appCtx.getBean(TaskServiceStub.class); processService.setTaskService(taskServiceStub); final DefaultCommandFactoryRegistryImpl commandFactoryReg = appCtx .getBean(DefaultCommandFactoryRegistryImpl.class); commandFactoryReg .setCommandFactoryList(Arrays.asList((CommandFactory) appCtx.getBean("mockupCommandFactory"))); }
From source file:com.exxonmobile.ace.hybris.fulfilmentprocess.test.ProcessFlowTest.java
@BeforeClass public static void prepare() throws Exception //NOPMD { Registry.activateStandaloneMode(); Utilities.setJUnitTenant();/* w w w . jav a 2 s .co m*/ LOG.debug("Preparing..."); final ApplicationContext appCtx = Registry.getApplicationContext(); // final ConfigurationService configurationService = (ConfigurationService) appCtx.getBean("configurationService"); // configurationService.getConfiguration().setProperty("processengine.event.lockProcess", "true"); assertTrue("Application context of type " + appCtx.getClass() + " is not a subclass of " + ConfigurableApplicationContext.class, appCtx instanceof ConfigurableApplicationContext); final ConfigurableApplicationContext applicationContext = (ConfigurableApplicationContext) appCtx; final ConfigurableListableBeanFactory beanFactory = applicationContext.getBeanFactory(); assertTrue("Bean Factory of type " + beanFactory.getClass() + " is not of type " + BeanDefinitionRegistry.class, beanFactory instanceof BeanDefinitionRegistry); final XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader((BeanDefinitionRegistry) beanFactory); xmlReader.setDocumentReaderClass(ScopeTenantIgnoreDocReader.class); xmlReader.loadBeanDefinitions(new ClassPathResource( "/exxonmobilfulfilmentprocess/test/exxonmobilfulfilmentprocess-spring-test.xml")); xmlReader.loadBeanDefinitions( new ClassPathResource("/exxonmobilfulfilmentprocess/test/process/order-process-spring.xml")); xmlReader.loadBeanDefinitions( new ClassPathResource("/exxonmobilfulfilmentprocess/test/process/consignment-process-spring.xml")); modelService = (ModelService) getBean("modelService"); processService = (DefaultBusinessProcessService) getBean("businessProcessService"); definitonFactory = processService.getProcessDefinitionFactory(); LOG.warn("Prepare Process Definition factory..."); definitonFactory.add("classpath:/exxonmobilfulfilmentprocess/test/process/order-process.xml"); definitonFactory.add("classpath:/exxonmobilfulfilmentprocess/test/process/consignment-process.xml"); LOG.warn("loaded 'order-process-test':" + definitonFactory.getProcessDefinition("order-process-test") + " in factory " + definitonFactory); //setup command factory to mock taskServiceStub = appCtx.getBean(TaskServiceStub.class); processService.setTaskService(taskServiceStub); final DefaultCommandFactoryRegistryImpl commandFactoryReg = appCtx .getBean(DefaultCommandFactoryRegistryImpl.class); commandFactoryReg .setCommandFactoryList(Arrays.asList((CommandFactory) appCtx.getBean("mockupCommandFactory"))); }
From source file:com.mitre.fulfilmentprocess.test.ProcessFlowTest.java
@BeforeClass public static void prepare() throws Exception //NOPMD { Registry.activateStandaloneMode(); Utilities.setJUnitTenant();// w ww .j av a2s . c om LOG.debug("Preparing..."); final ApplicationContext appCtx = Registry.getApplicationContext(); // final ConfigurationService configurationService = (ConfigurationService) appCtx.getBean("configurationService"); // configurationService.getConfiguration().setProperty("processengine.event.lockProcess", "true"); assertTrue("Application context of type " + appCtx.getClass() + " is not a subclass of " + ConfigurableApplicationContext.class, appCtx instanceof ConfigurableApplicationContext); final ConfigurableApplicationContext applicationContext = (ConfigurableApplicationContext) appCtx; final ConfigurableListableBeanFactory beanFactory = applicationContext.getBeanFactory(); assertTrue("Bean Factory of type " + beanFactory.getClass() + " is not of type " + BeanDefinitionRegistry.class, beanFactory instanceof BeanDefinitionRegistry); final XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader((BeanDefinitionRegistry) beanFactory); xmlReader.setDocumentReaderClass(ScopeTenantIgnoreDocReader.class); xmlReader.loadBeanDefinitions( new ClassPathResource("/mitrefulfilmentprocess/test/mitrefulfilmentprocess-spring-test.xml")); xmlReader.loadBeanDefinitions( new ClassPathResource("/mitrefulfilmentprocess/test/process/order-process-spring.xml")); xmlReader.loadBeanDefinitions( new ClassPathResource("/mitrefulfilmentprocess/test/process/consignment-process-spring.xml")); modelService = (ModelService) getBean("modelService"); processService = (DefaultBusinessProcessService) getBean("businessProcessService"); definitonFactory = processService.getProcessDefinitionFactory(); LOG.warn("Prepare Process Definition factory..."); definitonFactory.add("classpath:/mitrefulfilmentprocess/test/process/order-process.xml"); definitonFactory.add("classpath:/mitrefulfilmentprocess/test/process/consignment-process.xml"); LOG.warn("loaded 'order-process-test':" + definitonFactory.getProcessDefinition("order-process-test") + " in factory " + definitonFactory); //setup command factory to mock taskServiceStub = appCtx.getBean(TaskServiceStub.class); processService.setTaskService(taskServiceStub); final DefaultCommandFactoryRegistryImpl commandFactoryReg = appCtx .getBean(DefaultCommandFactoryRegistryImpl.class); commandFactoryReg .setCommandFactoryList(Arrays.asList((CommandFactory) appCtx.getBean("mockupCommandFactory"))); }
From source file:org.vinmonopolet.fulfilmentprocess.test.ProcessFlowTest.java
@BeforeClass public static void prepare() throws Exception //NOPMD { Registry.activateStandaloneMode(); Utilities.setJUnitTenant();/*from w w w .j av a 2s . c o m*/ LOG.debug("Preparing..."); final ApplicationContext appCtx = Registry.getApplicationContext(); // final ConfigurationService configurationService = (ConfigurationService) appCtx.getBean("configurationService"); // configurationService.getConfiguration().setProperty("processengine.event.lockProcess", "true"); assertTrue("Application context of type " + appCtx.getClass() + " is not a subclass of " + ConfigurableApplicationContext.class, appCtx instanceof ConfigurableApplicationContext); final ConfigurableApplicationContext applicationContext = (ConfigurableApplicationContext) appCtx; final ConfigurableListableBeanFactory beanFactory = applicationContext.getBeanFactory(); assertTrue("Bean Factory of type " + beanFactory.getClass() + " is not of type " + BeanDefinitionRegistry.class, beanFactory instanceof BeanDefinitionRegistry); final XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader((BeanDefinitionRegistry) beanFactory); xmlReader.setDocumentReaderClass(ScopeTenantIgnoreDocReader.class); xmlReader.loadBeanDefinitions(new ClassPathResource( "/vinmonopoletfulfilmentprocess/test/vinmonopoletfulfilmentprocess-spring-test.xml")); xmlReader.loadBeanDefinitions( new ClassPathResource("/vinmonopoletfulfilmentprocess/test/process/order-process-spring.xml")); xmlReader.loadBeanDefinitions(new ClassPathResource( "/vinmonopoletfulfilmentprocess/test/process/consignment-process-spring.xml")); modelService = (ModelService) getBean("modelService"); processService = (DefaultBusinessProcessService) getBean("businessProcessService"); definitonFactory = processService.getProcessDefinitionFactory(); LOG.warn("Prepare Process Definition factory..."); definitonFactory.add("classpath:/vinmonopoletfulfilmentprocess/test/process/order-process.xml"); definitonFactory.add("classpath:/vinmonopoletfulfilmentprocess/test/process/consignment-process.xml"); LOG.warn("loaded 'order-process-test':" + definitonFactory.getProcessDefinition("order-process-test") + " in factory " + definitonFactory); //setup command factory to mock taskServiceStub = appCtx.getBean(TaskServiceStub.class); processService.setTaskService(taskServiceStub); final DefaultCommandFactoryRegistryImpl commandFactoryReg = appCtx .getBean(DefaultCommandFactoryRegistryImpl.class); commandFactoryReg .setCommandFactoryList(Arrays.asList((CommandFactory) appCtx.getBean("mockupCommandFactory"))); }