Package org.springframework.test.context

Examples of org.springframework.test.context.ContextConfiguration


        mailSender.setPort(getSmtpPort());
        mailSender.setHost("localhost");
    }

    private String[] extractLocationFromAnnotation(Class<?> clazz) {
        ContextConfiguration contextConfiguration = InternalUtils.findAnnotation(clazz.getAnnotations(),
                ContextConfiguration.class);
        String[] locations = null;
        if (contextConfiguration != null) {
            locations = contextConfiguration.locations();
        }

        return locations;
    }
View Full Code Here


    super.runBare();
  }

  @Override
  protected void initializeProcessEngine() {
    ContextConfiguration contextConfiguration = getClass().getAnnotation(ContextConfiguration.class);
    String processEngineKey = createProcessEngineKey(contextConfiguration);

    processEngine = cachedProcessEngines.get(processEngineKey);
    if (processEngine==null) {
      processEngine = applicationContext.getBean(ProcessEngine.class);
View Full Code Here

    return DEFAULT_PORT;
  }
 
  protected String getSpringContextLocation() {
    if (this.getClass().isAnnotationPresent(ContextConfiguration.class)) {
      ContextConfiguration config = this.getClass().getAnnotation(ContextConfiguration.class);
      String[] locations = config.locations();
      return StringUtil.unsplit(",", locations);
    } else {
      return DEFAULT_SPRING_CONTEXT_LOCATION;
    }
  }
View Full Code Here

    return DEFAULT_PORT;
  }
 
  protected String getSpringContextLocation() {
    if (this.getClass().isAnnotationPresent(ContextConfiguration.class)) {
      ContextConfiguration config = this.getClass().getAnnotation(ContextConfiguration.class);
      String[] locations = config.locations();
      return StringUtil.unsplit(",", locations);
    } else {
      return DEFAULT_SPRING_CONTEXT_LOCATION;
    }
  }
View Full Code Here

        return DEFAULT_PORT;
    }

    protected String getSpringContextLocation() {
        if (this.getClass().isAnnotationPresent(ContextConfiguration.class)) {
            ContextConfiguration config = this.getClass().getAnnotation(ContextConfiguration.class);
            String[] locations = config.locations();
            return StringUtil.unsplit(",", locations);
        } else {
            return DEFAULT_SPRING_CONTEXT_LOCATION;
        }
    }
View Full Code Here

        return DEFAULT_PORT;
    }

    protected String getSpringContextLocation() {
        if (this.getClass().isAnnotationPresent(ContextConfiguration.class)) {
            ContextConfiguration config = this.getClass().getAnnotation(ContextConfiguration.class);
            String[] locations = config.locations();
            return StringUtil.unsplit(",", locations);
        } else {
            return DEFAULT_SPRING_CONTEXT_LOCATION;
        }
    }
View Full Code Here

  @Test
  @SuppressWarnings("unchecked")
  public void assertContextConfigurationLocations() throws Exception {

    final ContextConfiguration contextConfig = this.testClass.getAnnotation(ContextConfiguration.class);
    final ContextLoader contextLoader = new GenericXmlContextLoader();
    final String[] configuredLocations = (String[]) AnnotationUtils.getValue(contextConfig, "locations");
    final String[] processedLocations = contextLoader.processLocations(this.testClass, configuredLocations);

    if (logger.isDebugEnabled()) {
View Full Code Here

  }

  @Test
  public void assertContextConfigurationLocations() throws Exception {

    final ContextConfiguration contextConfig = this.testClass.getAnnotation(ContextConfiguration.class);
    final ContextLoader contextLoader = new GenericXmlContextLoader();
    final String[] configuredLocations = (String[]) AnnotationUtils.getValue(contextConfig);
    final String[] processedLocations = contextLoader.processLocations(this.testClass, configuredLocations);

    if (logger.isDebugEnabled()) {
View Full Code Here

        super.runBare();
    }

    @Override
    protected void initializeProcessEngine() {
        ContextConfiguration contextConfiguration = getClass().getAnnotation(ContextConfiguration.class);
        String[] value = contextConfiguration.value();
        boolean hasOneArg = value != null && value.length == 1;
        String key = hasOneArg ? value[0] : ProcessEngine.class.getName();
        ProcessEngine engine = this.cachedProcessEngines.containsKey(key) ?
                this.cachedProcessEngines.get(key) : this.applicationContext.getBean(ProcessEngine.class);
View Full Code Here

    super.runBare();
  }

  @Override
  protected void initializeProcessEngine() {
    ContextConfiguration contextConfiguration = getClass().getAnnotation(ContextConfiguration.class);
    String[] value = contextConfiguration.value();
    if (value==null) {
      throw new ActivitiException("value is mandatory in ContextConfiguration");
    }
    if (value.length!=1) {
      throw new ActivitiException("SpringActivitiTestCase requires exactly one value in annotation ContextConfiguration");
View Full Code Here

TOP

Related Classes of org.springframework.test.context.ContextConfiguration

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.