Package org.jtester.module.spring

Examples of org.jtester.module.spring.JTesterBeanFactory


   */
  public static JTesterBeanFactory getSpringBeanFactory() {
    if (TestedObject.currTestedClazz() == null) {
      throw new RuntimeException("the tested object can't be null.");
    } else {
      JTesterBeanFactory beanFactory = springBeanFactories.get(currTestedClazz());
      return beanFactory;
    }
  }
View Full Code Here


   * @param testedObject
   */
  public void invalidateApplicationContext() {
    Class testClazz = TestedObject.currTestedClazz();
    TestedObject.removeSpringContext();
    JTesterBeanFactory beanFactory = SpringModuleHelper.initSpringContext(testClazz, this.contextFactory);
    TestedObject.setSpringContext(beanFactory);
  }
View Full Code Here

   * The {@link TestListener} for this module
   */
  protected class SpringTestListener extends TestListener {
    @Override
    public void setupClass(Class testClazz) {
      JTesterBeanFactory beanFactory = SpringModuleHelper.initSpringContext(testClazz, contextFactory);
      TestedObject.setSpringContext(beanFactory);
    }
View Full Code Here

     * 重新注入spring bean,避免字段的值受上个测试的影响<br>
     * <br> {@inheritDoc}
     */
    @Override
    public void setupMethod(Object testObject, Method testMethod) {
      JTesterBeanFactory beanFactory = (JTesterBeanFactory) TestedObject.getSpringBeanFactory();
      if (beanFactory != null) {
        SpringBeanInjector.injectSpringBeans(beanFactory, testObject);
      }
    }
View Full Code Here

   * @param contextFactory
   * @return does initial spring context successfully
   */
  @SuppressWarnings("rawtypes")
  public static JTesterBeanFactory initSpringContext(Class testClazz, ApplicationContextFactory contextFactory) {
    JTesterBeanFactory beanFactory = (JTesterBeanFactory) TestedObject.getSpringBeanFactory();
    if (beanFactory != null) {
      return beanFactory;
    }
    SpringApplicationContext annotation = AnnotationUtils.getClassLevelAnnotation(SpringApplicationContext.class,
        testClazz);
View Full Code Here

TOP

Related Classes of org.jtester.module.spring.JTesterBeanFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.