ApplicationContextResolverImpl implements ApplicationContextResolver, InitializingBean,
                   DisposableBean { @Override public ApplicationContext resolveApplicationContext() { return new ClassPathXmlApplicationContext( concatBeanDefinitionFilePath(BEAN_DEFINITION_ADMIN_CLASSPATH, BEAN_DEFINITION_DEFAULT), concatBeanDefinitionFilePath(BEAN_DEFINITION_ADMIN_CLASSPATH, BEAN_DEFINITION_DATASOURCE)); }  @Override ApplicationContext resolveApplicationContext(); @Override ApplicationContext resolveApplicationContext(
            BatchJobData batchJobData); @Override void closeApplicationContext(ApplicationContext applicationContext); @Override void afterPropertiesSet(); void setCommonContextClassPath(String[] commonContextClassPath); @Override void destroy();  }
@Test public void testResolveAdminContext01() throws Exception { ApplicationContextResolver resolver = new ApplicationContextResolverImpl(); ApplicationContext context = resolver.resolveApplicationContext(); assertTrue(context.containsBean("syncJobOperator")); assertTrue(context.containsBean("systemDao")); assertNull(context.getParent()); }
@Test public void testResolveAdminContext02() throws Exception { TreeMap<String, String> props = new TreeMap<>(); propsField.set(null, props); ApplicationContextResolver resolver = new ApplicationContextResolverImpl(); try { resolver.resolveApplicationContext(); } catch (BeansException e) { assertThat(e.getMessage(), is(endsWith( "[EAL025003] Bean definition default file name is not set. please confirm batch.properties."))); } }
@Test public void testResolveApplicationContextBatchJobData01() throws Exception { BatchJobData batchJobData = new BatchJobData(); batchJobData.setJobAppCd("B000001"); target.parent = this.parent; target.classpath = "beansDef/"; ApplicationContext ctx = target.resolveApplicationContext(batchJobData); B000001BLogic blogic = ctx .getBean("B000001BLogic", B000001BLogic.class); assertNotNull(blogic); MessageAccessor msg = ctx.getBean("msgAcc", MessageAccessor.class); assertNotNull(msg); }
@Test public void testResolveApplicationContextBatchJobData02() throws Exception { BatchJobData batchJobData = new BatchJobData(); batchJobData.setJobAppCd("not-defined"); target.parent = this.parent; target.classpath = "beansDef/"; try { target.resolveApplicationContext(batchJobData); fail(); } catch (BeansException e) { assertTrue(e.getMessage().contains( "IOException parsing XML document from class path resource [beansDef/not-defined.xml]")); } }
@Test public void testResolveApplicationContextBatchJobData03() throws Exception { BatchJobData batchJobData = new BatchJobData(); batchJobData.setJobAppCd("B000001"); target.parent = this.parent; target.classpath = "beansDef/"; ApplicationContext ctx = target.resolveApplicationContext(batchJobData); assertSame(parent, ctx.getParent()); }
@Test public void testResolveApplicationContextBatchJobData04() throws Exception { BatchJobData batchJobData = new BatchJobData(); batchJobData.setJobAppCd("B000001"); target.classpath = "beansDef/"; ApplicationContext ctx = target.resolveApplicationContext(batchJobData); assertNull(ctx.getParent()); }