Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
2015781e
S
spring-framework
项目概览
爱吃血肠
/
spring-framework
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
spring-framework
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
2015781e
编写于
5月 06, 2015
作者:
S
Sam Brannen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rename duplicate EnvironmentIntegrationTests to EnvironmentSystemIntegrationTests
上级
8b545f47
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
40 addition
and
37 deletion
+40
-37
spring-context/src/test/java/org/springframework/context/support/EnvironmentIntegrationTests.java
...ramework/context/support/EnvironmentIntegrationTests.java
+7
-2
src/test/java/org/springframework/core/env/EnvironmentSystemIntegrationTests.java
...framework/core/env/EnvironmentSystemIntegrationTests.java
+24
-26
src/test/java/org/springframework/core/env/scan1/package-info.java
...java/org/springframework/core/env/scan1/package-info.java
+2
-2
src/test/java/org/springframework/core/env/scan2/package-info.java
...java/org/springframework/core/env/scan2/package-info.java
+4
-4
src/test/resources/org/springframework/core/env/EnvironmentSystemIntegrationTests-context-dev.xml
...ore/env/EnvironmentSystemIntegrationTests-context-dev.xml
+0
-0
src/test/resources/org/springframework/core/env/EnvironmentSystemIntegrationTests-context-prod.xml
...re/env/EnvironmentSystemIntegrationTests-context-prod.xml
+0
-0
src/test/resources/org/springframework/core/env/EnvironmentSystemIntegrationTests-context.xml
...rk/core/env/EnvironmentSystemIntegrationTests-context.xml
+3
-3
未找到文件。
spring-context/src/test/java/org/springframework/context/support/EnvironmentIntegrationTests.java
浏览文件 @
2015781e
/*
* Copyright 2002-201
2
the original author or authors.
* Copyright 2002-201
5
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (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
.*;
/**
* 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
* @see org.springframework.core.env.EnvironmentSystemIntegrationTests
*/
public
class
EnvironmentIntegrationTests
{
...
...
@@ -48,6 +50,9 @@ public class EnvironmentIntegrationTests {
sameInstance
(
parent
.
getEnvironment
()),
sameInstance
(
child
.
getEnvironment
())));
assertThat
(
"expected child ctx env"
,
env
,
sameInstance
(
child
.
getEnvironment
()));
child
.
close
();
parent
.
close
();
}
}
src/test/java/org/springframework/core/env/EnvironmentIntegrationTests.java
→
src/test/java/org/springframework/core/env/Environment
System
IntegrationTests.java
浏览文件 @
2015781e
/*
* Copyright 2002-201
4
the original author or authors.
* Copyright 2002-201
5
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -16,6 +16,7 @@
package
org.springframework.core.env
;
import
java.io.File
;
import
java.io.IOException
;
...
...
@@ -65,43 +66,40 @@ import static org.hamcrest.Matchers.*;
import
static
org
.
junit
.
Assert
.*;
import
static
org
.
springframework
.
beans
.
factory
.
support
.
BeanDefinitionBuilder
.*;
import
static
org
.
springframework
.
context
.
ConfigurableApplicationContext
.*;
import
static
org
.
springframework
.
core
.
env
.
EnvironmentIntegrationTests
.
Constants
.*;
import
static
org
.
springframework
.
core
.
env
.
Environment
System
IntegrationTests
.
Constants
.*;
/**
* Integration tests for container support of {@link Environment}
* interface.
* System integration tests for container support of the {@link Environment} API.
*
* Tests all existing BeanFactory and ApplicationContext implementations to
* ensure that:
* - a standard environment object is always present
* - a custom environment object can be set and retrieved against the factory/context
* - the {@link EnvironmentAware} interface is respected
* - the environment object is registered with the container as a singleton
* bean (if an ApplicationContext)
* - bean definition files (if any, and whether XML or @Configuration) are
* registered conditionally based on environment metadata
* <p>
* Tests all existing BeanFactory and ApplicationContext implementations to ensure that:
* <ul>
* <li>a standard environment object is always present
* <li>a custom environment object can be set and retrieved against the factory/context
* <li>the {@link EnvironmentAware} interface is respected
* <li>the environment object is registered with the container as a singleton bean (if an
* ApplicationContext)
* <li>bean definition files (if any, and whether XML or @Configuration) are registered
* conditionally based on environment metadata
* </ul>
*
* @author Chris Beams
* @author Sam Brannen
* @see org.springframework.context.support.EnvironmentIntegrationTests
*/
@SuppressWarnings
(
"resource"
)
public
class
EnvironmentIntegrationTests
{
private
ConfigurableEnvironment
prodEnv
;
public
class
EnvironmentSystemIntegrationTests
{
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
public
void
setUp
()
{
prodEnv
=
new
StandardEnvironment
();
prodEnv
.
setActiveProfiles
(
PROD_ENV_NAME
);
devEnv
=
new
StandardEnvironment
();
devEnv
.
setActiveProfiles
(
DEV_ENV_NAME
);
prodWebEnv
=
new
StandardServletEnvironment
();
prodWebEnv
.
setActiveProfiles
(
PROD_ENV_NAME
);
}
...
...
@@ -640,8 +638,8 @@ public class EnvironmentIntegrationTests {
/**
* Mirrors the structure of beans and environment-specific config files
*
in Environment
IntegrationTests-context.xml
* Mirrors the structure of beans and environment-specific config files
in
*
EnvironmentSystem
IntegrationTests-context.xml
*/
@Configuration
@Import
({
DevConfig
.
class
,
ProdConfig
.
class
})
...
...
@@ -694,7 +692,7 @@ public class EnvironmentIntegrationTests {
*/
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/Environment
System
IntegrationTests-context.xml"
;
public
static
final
String
ENVIRONMENT_AWARE_BEAN_NAME
=
"envAwareBean"
;
...
...
src/test/java/org/springframework/core/env/scan1/package-info.java
浏览文件 @
2015781e
...
...
@@ -20,8 +20,8 @@
*/
package
org.springframework.core.env.scan1
;
import
static
org
.
springframework
.
core
.
env
.
EnvironmentIntegrationTests
.
Constants
.
DEV_ENV_NAME
;
import
static
org
.
springframework
.
core
.
env
.
EnvironmentIntegrationTests
.
Constants
.
PROD_ENV_NAME
;
import
static
org
.
springframework
.
core
.
env
.
Environment
System
IntegrationTests
.
Constants
.
DEV_ENV_NAME
;
import
static
org
.
springframework
.
core
.
env
.
Environment
System
IntegrationTests
.
Constants
.
PROD_ENV_NAME
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
...
...
src/test/java/org/springframework/core/env/scan2/package-info.java
浏览文件 @
2015781e
...
...
@@ -20,10 +20,10 @@
*/
package
org.springframework.core.env.scan2
;
import
static
org
.
springframework
.
core
.
env
.
EnvironmentIntegrationTests
.
Constants
.
DEV_BEAN_NAME
;
import
static
org
.
springframework
.
core
.
env
.
EnvironmentIntegrationTests
.
Constants
.
DEV_ENV_NAME
;
import
static
org
.
springframework
.
core
.
env
.
EnvironmentIntegrationTests
.
Constants
.
PROD_BEAN_NAME
;
import
static
org
.
springframework
.
core
.
env
.
EnvironmentIntegrationTests
.
Constants
.
PROD_ENV_NAME
;
import
static
org
.
springframework
.
core
.
env
.
Environment
System
IntegrationTests
.
Constants
.
DEV_BEAN_NAME
;
import
static
org
.
springframework
.
core
.
env
.
Environment
System
IntegrationTests
.
Constants
.
DEV_ENV_NAME
;
import
static
org
.
springframework
.
core
.
env
.
Environment
System
IntegrationTests
.
Constants
.
PROD_BEAN_NAME
;
import
static
org
.
springframework
.
core
.
env
.
Environment
System
IntegrationTests
.
Constants
.
PROD_ENV_NAME
;
import
org.springframework.context.annotation.Profile
;
import
org.springframework.stereotype.Component
;
...
...
src/test/resources/org/springframework/core/env/EnvironmentIntegrationTests-context-dev.xml
→
src/test/resources/org/springframework/core/env/Environment
System
IntegrationTests-context-dev.xml
浏览文件 @
2015781e
文件已移动
src/test/resources/org/springframework/core/env/EnvironmentIntegrationTests-context-prod.xml
→
src/test/resources/org/springframework/core/env/Environment
System
IntegrationTests-context-prod.xml
浏览文件 @
2015781e
文件已移动
src/test/resources/org/springframework/core/env/EnvironmentIntegrationTests-context.xml
→
src/test/resources/org/springframework/core/env/Environment
System
IntegrationTests-context.xml
浏览文件 @
2015781e
...
...
@@ -3,9 +3,9 @@
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"
>
<bean
id=
"envAwareBean"
class=
"org.springframework.core.env.EnvironmentIntegrationTests$EnvironmentAwareBean"
/>
<bean
id=
"envAwareBean"
class=
"org.springframework.core.env.Environment
System
IntegrationTests$EnvironmentAwareBean"
/>
<import
resource=
"classpath:org/springframework/core/env/EnvironmentIntegrationTests-context-dev.xml"
/>
<import
resource=
"classpath:org/springframework/core/env/EnvironmentIntegrationTests-context-prod.xml"
/>
<import
resource=
"classpath:org/springframework/core/env/Environment
System
IntegrationTests-context-dev.xml"
/>
<import
resource=
"classpath:org/springframework/core/env/Environment
System
IntegrationTests-context-prod.xml"
/>
</beans>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录