Search in sources :

Example 1 with XmlWebApplicationContext

use of cn.taketoday.web.context.support.XmlWebApplicationContext in project today-framework by TAKETODAY.

the class EnvironmentSystemIntegrationTests method xmlWebApplicationContext.

@Test
void xmlWebApplicationContext() {
    AbstractRefreshableWebApplicationContext ctx = new XmlWebApplicationContext();
    ctx.setConfigLocation("classpath:" + Constants.XML_PATH);
    ctx.setEnvironment(prodWebEnv);
    ctx.refresh();
    assertHasEnvironment(ctx, prodWebEnv);
    assertEnvironmentBeanRegistered(ctx);
    assertEnvironmentAwareInvoked(ctx, prodWebEnv);
    assertThat(ctx.containsBean(Constants.DEV_BEAN_NAME)).isFalse();
    assertThat(ctx.containsBean(Constants.PROD_BEAN_NAME)).isTrue();
}
Also used : XmlWebApplicationContext(cn.taketoday.web.context.support.XmlWebApplicationContext) AbstractRefreshableWebApplicationContext(cn.taketoday.web.context.support.AbstractRefreshableWebApplicationContext) Test(org.junit.jupiter.api.Test)

Example 2 with XmlWebApplicationContext

use of cn.taketoday.web.context.support.XmlWebApplicationContext in project today-infrastructure by TAKETODAY.

the class EnvironmentSystemIntegrationTests method xmlWebApplicationContext.

@Test
void xmlWebApplicationContext() {
    AbstractRefreshableWebApplicationContext ctx = new XmlWebApplicationContext();
    ctx.setConfigLocation("classpath:" + Constants.XML_PATH);
    ctx.setEnvironment(prodWebEnv);
    ctx.refresh();
    assertHasEnvironment(ctx, prodWebEnv);
    assertEnvironmentBeanRegistered(ctx);
    assertEnvironmentAwareInvoked(ctx, prodWebEnv);
    assertThat(ctx.containsBean(Constants.DEV_BEAN_NAME)).isFalse();
    assertThat(ctx.containsBean(Constants.PROD_BEAN_NAME)).isTrue();
}
Also used : XmlWebApplicationContext(cn.taketoday.web.context.support.XmlWebApplicationContext) AbstractRefreshableWebApplicationContext(cn.taketoday.web.context.support.AbstractRefreshableWebApplicationContext) Test(org.junit.jupiter.api.Test)

Aggregations

AbstractRefreshableWebApplicationContext (cn.taketoday.web.context.support.AbstractRefreshableWebApplicationContext)2 XmlWebApplicationContext (cn.taketoday.web.context.support.XmlWebApplicationContext)2 Test (org.junit.jupiter.api.Test)2