Browse Source

Rename duplicate EnvironmentIntegrationTests to EnvironmentSystemIntegrationTests

pull/788/merge
Sam Brannen 10 years ago
parent
commit
2015781ea1
  1. 9
      spring-context/src/test/java/org/springframework/context/support/EnvironmentIntegrationTests.java
  2. 50
      src/test/java/org/springframework/core/env/EnvironmentSystemIntegrationTests.java
  3. 4
      src/test/java/org/springframework/core/env/scan1/package-info.java
  4. 8
      src/test/java/org/springframework/core/env/scan2/package-info.java
  5. 0
      src/test/resources/org/springframework/core/env/EnvironmentSystemIntegrationTests-context-dev.xml
  6. 0
      src/test/resources/org/springframework/core/env/EnvironmentSystemIntegrationTests-context-prod.xml
  7. 6
      src/test/resources/org/springframework/core/env/EnvironmentSystemIntegrationTests-context.xml

9
spring-context/src/test/java/org/springframework/context/support/EnvironmentIntegrationTests.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2012 the original author or authors. * Copyright 2002-2015 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -28,9 +28,11 @@ import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*; import static org.junit.Assert.*;
/** /**
* Tests covering the integration of {@link Environment} into {@link ApplicationContext} hierarchies. * Tests covering the integration of the {@link Environment} into
* {@link ApplicationContext} hierarchies.
* *
* @author Chris Beams * @author Chris Beams
* @see org.springframework.core.env.EnvironmentSystemIntegrationTests
*/ */
public class EnvironmentIntegrationTests { public class EnvironmentIntegrationTests {
@ -48,6 +50,9 @@ public class EnvironmentIntegrationTests {
sameInstance(parent.getEnvironment()), sameInstance(parent.getEnvironment()),
sameInstance(child.getEnvironment()))); sameInstance(child.getEnvironment())));
assertThat("expected child ctx env", env, sameInstance(child.getEnvironment())); assertThat("expected child ctx env", env, sameInstance(child.getEnvironment()));
child.close();
parent.close();
} }
} }

50
src/test/java/org/springframework/core/env/EnvironmentIntegrationTests.java → src/test/java/org/springframework/core/env/EnvironmentSystemIntegrationTests.java vendored

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2014 the original author or authors. * Copyright 2002-2015 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -16,6 +16,7 @@
package org.springframework.core.env; package org.springframework.core.env;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -65,43 +66,40 @@ import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*; import static org.junit.Assert.*;
import static org.springframework.beans.factory.support.BeanDefinitionBuilder.*; import static org.springframework.beans.factory.support.BeanDefinitionBuilder.*;
import static org.springframework.context.ConfigurableApplicationContext.*; import static org.springframework.context.ConfigurableApplicationContext.*;
import static org.springframework.core.env.EnvironmentIntegrationTests.Constants.*; import static org.springframework.core.env.EnvironmentSystemIntegrationTests.Constants.*;
/** /**
* Integration tests for container support of {@link Environment} * System integration tests for container support of the {@link Environment} API.
* interface.
* *
* Tests all existing BeanFactory and ApplicationContext implementations to * <p>
* ensure that: * Tests all existing BeanFactory and ApplicationContext implementations to ensure that:
* - a standard environment object is always present * <ul>
* - a custom environment object can be set and retrieved against the factory/context * <li>a standard environment object is always present
* - the {@link EnvironmentAware} interface is respected * <li>a custom environment object can be set and retrieved against the factory/context
* - the environment object is registered with the container as a singleton * <li>the {@link EnvironmentAware} interface is respected
* bean (if an ApplicationContext) * <li>the environment object is registered with the container as a singleton bean (if an
* - bean definition files (if any, and whether XML or @Configuration) are * ApplicationContext)
* registered conditionally based on environment metadata * <li>bean definition files (if any, and whether XML or @Configuration) are registered
* conditionally based on environment metadata
* </ul>
* *
* @author Chris Beams * @author Chris Beams
* @author Sam Brannen
* @see org.springframework.context.support.EnvironmentIntegrationTests
*/ */
@SuppressWarnings("resource") @SuppressWarnings("resource")
public class EnvironmentIntegrationTests { public class EnvironmentSystemIntegrationTests {
private ConfigurableEnvironment prodEnv;
private ConfigurableEnvironment devEnv; private final ConfigurableEnvironment prodEnv = new StandardEnvironment();
private ConfigurableEnvironment prodWebEnv; private final ConfigurableEnvironment devEnv = new StandardEnvironment();
private final ConfigurableEnvironment prodWebEnv = new StandardServletEnvironment();
@Before @Before
public void setUp() { public void setUp() {
prodEnv = new StandardEnvironment();
prodEnv.setActiveProfiles(PROD_ENV_NAME); prodEnv.setActiveProfiles(PROD_ENV_NAME);
devEnv = new StandardEnvironment();
devEnv.setActiveProfiles(DEV_ENV_NAME); devEnv.setActiveProfiles(DEV_ENV_NAME);
prodWebEnv = new StandardServletEnvironment();
prodWebEnv.setActiveProfiles(PROD_ENV_NAME); prodWebEnv.setActiveProfiles(PROD_ENV_NAME);
} }
@ -640,8 +638,8 @@ public class EnvironmentIntegrationTests {
/** /**
* Mirrors the structure of beans and environment-specific config files * Mirrors the structure of beans and environment-specific config files in
* in EnvironmentIntegrationTests-context.xml * EnvironmentSystemIntegrationTests-context.xml
*/ */
@Configuration @Configuration
@Import({DevConfig.class, ProdConfig.class}) @Import({DevConfig.class, ProdConfig.class})
@ -694,7 +692,7 @@ public class EnvironmentIntegrationTests {
*/ */
public static class Constants { public static class Constants {
public static final String XML_PATH = "org/springframework/core/env/EnvironmentIntegrationTests-context.xml"; public static final String XML_PATH = "org/springframework/core/env/EnvironmentSystemIntegrationTests-context.xml";
public static final String ENVIRONMENT_AWARE_BEAN_NAME = "envAwareBean"; public static final String ENVIRONMENT_AWARE_BEAN_NAME = "envAwareBean";

4
src/test/java/org/springframework/core/env/scan1/package-info.java vendored

@ -20,8 +20,8 @@
*/ */
package org.springframework.core.env.scan1; package org.springframework.core.env.scan1;
import static org.springframework.core.env.EnvironmentIntegrationTests.Constants.DEV_ENV_NAME; import static org.springframework.core.env.EnvironmentSystemIntegrationTests.Constants.DEV_ENV_NAME;
import static org.springframework.core.env.EnvironmentIntegrationTests.Constants.PROD_ENV_NAME; import static org.springframework.core.env.EnvironmentSystemIntegrationTests.Constants.PROD_ENV_NAME;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;

8
src/test/java/org/springframework/core/env/scan2/package-info.java vendored

@ -20,10 +20,10 @@
*/ */
package org.springframework.core.env.scan2; package org.springframework.core.env.scan2;
import static org.springframework.core.env.EnvironmentIntegrationTests.Constants.DEV_BEAN_NAME; import static org.springframework.core.env.EnvironmentSystemIntegrationTests.Constants.DEV_BEAN_NAME;
import static org.springframework.core.env.EnvironmentIntegrationTests.Constants.DEV_ENV_NAME; import static org.springframework.core.env.EnvironmentSystemIntegrationTests.Constants.DEV_ENV_NAME;
import static org.springframework.core.env.EnvironmentIntegrationTests.Constants.PROD_BEAN_NAME; import static org.springframework.core.env.EnvironmentSystemIntegrationTests.Constants.PROD_BEAN_NAME;
import static org.springframework.core.env.EnvironmentIntegrationTests.Constants.PROD_ENV_NAME; import static org.springframework.core.env.EnvironmentSystemIntegrationTests.Constants.PROD_ENV_NAME;
import org.springframework.context.annotation.Profile; import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;

0
src/test/resources/org/springframework/core/env/EnvironmentIntegrationTests-context-dev.xml → src/test/resources/org/springframework/core/env/EnvironmentSystemIntegrationTests-context-dev.xml vendored

0
src/test/resources/org/springframework/core/env/EnvironmentIntegrationTests-context-prod.xml → src/test/resources/org/springframework/core/env/EnvironmentSystemIntegrationTests-context-prod.xml vendored

6
src/test/resources/org/springframework/core/env/EnvironmentIntegrationTests-context.xml → src/test/resources/org/springframework/core/env/EnvironmentSystemIntegrationTests-context.xml vendored

@ -3,9 +3,9 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="envAwareBean" class="org.springframework.core.env.EnvironmentIntegrationTests$EnvironmentAwareBean"/> <bean id="envAwareBean" class="org.springframework.core.env.EnvironmentSystemIntegrationTests$EnvironmentAwareBean"/>
<import resource="classpath:org/springframework/core/env/EnvironmentIntegrationTests-context-dev.xml"/> <import resource="classpath:org/springframework/core/env/EnvironmentSystemIntegrationTests-context-dev.xml"/>
<import resource="classpath:org/springframework/core/env/EnvironmentIntegrationTests-context-prod.xml"/> <import resource="classpath:org/springframework/core/env/EnvironmentSystemIntegrationTests-context-prod.xml"/>
</beans> </beans>
Loading…
Cancel
Save