Search in sources :

Example 1 with ApplicationType

use of cn.taketoday.framework.ApplicationType in project today-infrastructure by TAKETODAY.

the class ApplicationTestContextBootstrapper method processMergedContextConfiguration.

@Override
protected MergedContextConfiguration processMergedContextConfiguration(MergedContextConfiguration mergedConfig) {
    Class<?>[] classes = getOrFindConfigurationClasses(mergedConfig);
    List<String> propertySourceProperties = getAndProcessPropertySourceProperties(mergedConfig);
    mergedConfig = createModifiedConfig(mergedConfig, classes, StringUtils.toStringArray(propertySourceProperties));
    WebEnvironment webEnvironment = getWebEnvironment(mergedConfig.getTestClass());
    if (webEnvironment != null && isWebEnvironmentSupported(mergedConfig)) {
        ApplicationType webApplicationType = getApplicationType(mergedConfig);
        if (webApplicationType == ApplicationType.SERVLET_WEB && (webEnvironment.isEmbedded() || webEnvironment == WebEnvironment.MOCK)) {
            mergedConfig = new WebMergedContextConfiguration(mergedConfig, determineResourceBasePath(mergedConfig));
        } else if (webApplicationType == ApplicationType.REACTIVE_WEB && (webEnvironment.isEmbedded() || webEnvironment == WebEnvironment.MOCK)) {
            return new ReactiveWebMergedContextConfiguration(mergedConfig);
        }
    }
    return mergedConfig;
}
Also used : WebMergedContextConfiguration(cn.taketoday.test.context.web.WebMergedContextConfiguration) ApplicationType(cn.taketoday.framework.ApplicationType) WebEnvironment(cn.taketoday.framework.test.context.ApplicationTest.WebEnvironment)

Example 2 with ApplicationType

use of cn.taketoday.framework.ApplicationType in project today-framework by TAKETODAY.

the class ApplicationTestContextBootstrapper method processMergedContextConfiguration.

@Override
protected MergedContextConfiguration processMergedContextConfiguration(MergedContextConfiguration mergedConfig) {
    Class<?>[] classes = getOrFindConfigurationClasses(mergedConfig);
    List<String> propertySourceProperties = getAndProcessPropertySourceProperties(mergedConfig);
    mergedConfig = createModifiedConfig(mergedConfig, classes, StringUtils.toStringArray(propertySourceProperties));
    WebEnvironment webEnvironment = getWebEnvironment(mergedConfig.getTestClass());
    if (webEnvironment != null && isWebEnvironmentSupported(mergedConfig)) {
        ApplicationType webApplicationType = getApplicationType(mergedConfig);
        if (webApplicationType == ApplicationType.SERVLET_WEB && (webEnvironment.isEmbedded() || webEnvironment == WebEnvironment.MOCK)) {
            mergedConfig = new WebMergedContextConfiguration(mergedConfig, determineResourceBasePath(mergedConfig));
        } else if (webApplicationType == ApplicationType.REACTIVE_WEB && (webEnvironment.isEmbedded() || webEnvironment == WebEnvironment.MOCK)) {
            return new ReactiveWebMergedContextConfiguration(mergedConfig);
        }
    }
    return mergedConfig;
}
Also used : WebMergedContextConfiguration(cn.taketoday.test.context.web.WebMergedContextConfiguration) ApplicationType(cn.taketoday.framework.ApplicationType) WebEnvironment(cn.taketoday.framework.test.context.ApplicationTest.WebEnvironment)

Aggregations

ApplicationType (cn.taketoday.framework.ApplicationType)2 WebEnvironment (cn.taketoday.framework.test.context.ApplicationTest.WebEnvironment)2 WebMergedContextConfiguration (cn.taketoday.test.context.web.WebMergedContextConfiguration)2