Java 类org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration 实例源码

项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:EmbeddedMongoAutoConfigurationTests.java   
private void assertVersionConfiguration(String configuredVersion,
        String expectedVersion) {
    this.context = new AnnotationConfigApplicationContext();
    int mongoPort = SocketUtils.findAvailableTcpPort();
    EnvironmentTestUtils.addEnvironment(this.context,
            "spring.data.mongodb.port=" + mongoPort);
    if (configuredVersion != null) {
        EnvironmentTestUtils.addEnvironment(this.context,
                "spring.mongodb.embedded.version=" + configuredVersion);
    }
    this.context.register(MongoAutoConfiguration.class,
            MongoDataAutoConfiguration.class, EmbeddedMongoAutoConfiguration.class);
    this.context.refresh();
    MongoTemplate mongo = this.context.getBean(MongoTemplate.class);
    CommandResult buildInfo = mongo.executeCommand("{ buildInfo: 1 }");

    assertThat(buildInfo.getString("version")).isEqualTo(expectedVersion);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:MongoDataAutoConfigurationTests.java   
public void testFieldNamingStrategy(String strategy,
        Class<? extends FieldNamingStrategy> expectedType) {
    this.context = new AnnotationConfigApplicationContext();
    if (strategy != null) {
        EnvironmentTestUtils.addEnvironment(this.context,
                "spring.data.mongodb.field-naming-strategy:" + strategy);
    }
    this.context.register(PropertyPlaceholderAutoConfiguration.class,
            MongoAutoConfiguration.class, MongoDataAutoConfiguration.class);
    this.context.refresh();
    MongoMappingContext mappingContext = this.context
            .getBean(MongoMappingContext.class);
    FieldNamingStrategy fieldNamingStrategy = (FieldNamingStrategy) ReflectionTestUtils
            .getField(mappingContext, "fieldNamingStrategy");
    assertThat(fieldNamingStrategy.getClass()).isEqualTo(expectedType);
}
项目:spring-boot-concourse    文件:EmbeddedMongoAutoConfigurationTests.java   
private void assertVersionConfiguration(String configuredVersion,
        String expectedVersion) {
    this.context = new AnnotationConfigApplicationContext();
    int mongoPort = SocketUtils.findAvailableTcpPort();
    EnvironmentTestUtils.addEnvironment(this.context,
            "spring.data.mongodb.port=" + mongoPort);
    if (configuredVersion != null) {
        EnvironmentTestUtils.addEnvironment(this.context,
                "spring.mongodb.embedded.version=" + configuredVersion);
    }
    this.context.register(MongoAutoConfiguration.class,
            MongoDataAutoConfiguration.class, EmbeddedMongoAutoConfiguration.class);
    this.context.refresh();
    MongoTemplate mongo = this.context.getBean(MongoTemplate.class);
    CommandResult buildInfo = mongo.executeCommand("{ buildInfo: 1 }");

    assertThat(buildInfo.getString("version")).isEqualTo(expectedVersion);
}
项目:spring-boot-concourse    文件:MongoDataAutoConfigurationTests.java   
public void testFieldNamingStrategy(String strategy,
        Class<? extends FieldNamingStrategy> expectedType) {
    this.context = new AnnotationConfigApplicationContext();
    if (strategy != null) {
        EnvironmentTestUtils.addEnvironment(this.context,
                "spring.data.mongodb.field-naming-strategy:" + strategy);
    }
    this.context.register(PropertyPlaceholderAutoConfiguration.class,
            MongoAutoConfiguration.class, MongoDataAutoConfiguration.class);
    this.context.refresh();
    MongoMappingContext mappingContext = this.context
            .getBean(MongoMappingContext.class);
    FieldNamingStrategy fieldNamingStrategy = (FieldNamingStrategy) ReflectionTestUtils
            .getField(mappingContext, "fieldNamingStrategy");
    assertThat(fieldNamingStrategy.getClass()).isEqualTo(expectedType);
}
项目:contestparser    文件:EmbeddedMongoAutoConfigurationTests.java   
private void assertVersionConfiguration(String configuredVersion,
        String expectedVersion) {
    this.context = new AnnotationConfigApplicationContext();
    int mongoPort = SocketUtils.findAvailableTcpPort();
    EnvironmentTestUtils.addEnvironment(this.context,
            "spring.data.mongodb.port=" + mongoPort);
    if (configuredVersion != null) {
        EnvironmentTestUtils.addEnvironment(this.context,
                "spring.mongodb.embedded.version=" + configuredVersion);
    }
    this.context.register(MongoAutoConfiguration.class,
            MongoDataAutoConfiguration.class, EmbeddedMongoAutoConfiguration.class);
    this.context.refresh();
    MongoTemplate mongo = this.context.getBean(MongoTemplate.class);
    CommandResult buildInfo = mongo.executeCommand("{ buildInfo: 1 }");

    assertThat(buildInfo.getString("version"), equalTo(expectedVersion));
}
项目:contestparser    文件:MongoDataAutoConfigurationTests.java   
public void testFieldNamingStrategy(String strategy,
        Class<? extends FieldNamingStrategy> expectedType) {
    this.context = new AnnotationConfigApplicationContext();
    if (strategy != null) {
        EnvironmentTestUtils.addEnvironment(this.context,
                "spring.data.mongodb.field-naming-strategy:" + strategy);
    }
    this.context.register(PropertyPlaceholderAutoConfiguration.class,
            MongoAutoConfiguration.class, MongoDataAutoConfiguration.class);
    this.context.refresh();
    MongoMappingContext mappingContext = this.context
            .getBean(MongoMappingContext.class);
    FieldNamingStrategy fieldNamingStrategy = (FieldNamingStrategy) ReflectionTestUtils
            .getField(mappingContext, "fieldNamingStrategy");
    assertEquals(expectedType, fieldNamingStrategy.getClass());
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:HealthIndicatorAutoConfigurationTests.java   
@Test
public void mongoHealthIndicator() {
    this.context.register(MongoAutoConfiguration.class,
            ManagementServerProperties.class, MongoDataAutoConfiguration.class,
            HealthIndicatorAutoConfiguration.class);
    EnvironmentTestUtils.addEnvironment(this.context,
            "management.health.diskspace.enabled:false");
    this.context.refresh();
    Map<String, HealthIndicator> beans = this.context
            .getBeansOfType(HealthIndicator.class);
    assertThat(beans).hasSize(1);
    assertThat(beans.values().iterator().next().getClass())
            .isEqualTo(MongoHealthIndicator.class);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:HealthIndicatorAutoConfigurationTests.java   
@Test
public void notMongoHealthIndicator() {
    this.context.register(MongoAutoConfiguration.class,
            ManagementServerProperties.class, MongoDataAutoConfiguration.class,
            HealthIndicatorAutoConfiguration.class);
    EnvironmentTestUtils.addEnvironment(this.context,
            "management.health.mongo.enabled:false",
            "management.health.diskspace.enabled:false");
    this.context.refresh();
    Map<String, HealthIndicator> beans = this.context
            .getBeansOfType(HealthIndicator.class);
    assertThat(beans).hasSize(1);
    assertThat(beans.values().iterator().next().getClass())
            .isEqualTo(ApplicationHealthIndicator.class);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:HealthIndicatorAutoConfigurationTests.java   
@Test
public void combinedHealthIndicator() {
    this.context.register(MongoAutoConfiguration.class, RedisAutoConfiguration.class,
            MongoDataAutoConfiguration.class, SolrAutoConfiguration.class,
            HealthIndicatorAutoConfiguration.class);
    this.context.refresh();
    Map<String, HealthIndicator> beans = this.context
            .getBeansOfType(HealthIndicator.class);
    assertThat(beans).hasSize(4);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:MongoHealthIndicatorTests.java   
@Test
public void indicatorExists() {
    this.context = new AnnotationConfigApplicationContext(
            PropertyPlaceholderAutoConfiguration.class, MongoAutoConfiguration.class,
            MongoDataAutoConfiguration.class, EndpointAutoConfiguration.class,
            HealthIndicatorAutoConfiguration.class);
    assertThat(this.context.getBeanNamesForType(MongoTemplate.class).length)
            .isEqualTo(1);
    MongoHealthIndicator healthIndicator = this.context
            .getBean(MongoHealthIndicator.class);
    assertThat(healthIndicator).isNotNull();
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:SessionAutoConfigurationTests.java   
@Test
public void mongoSessionStore() {
    load(Arrays.asList(EmbeddedMongoAutoConfiguration.class,
            MongoAutoConfiguration.class, MongoDataAutoConfiguration.class),
            "spring.session.store-type=mongo", "spring.data.mongodb.port=0");
    validateSessionRepository(MongoOperationsSessionRepository.class);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:SessionAutoConfigurationTests.java   
@Test
public void mongoSessionStoreWithCustomizations() {
    load(Arrays.asList(EmbeddedMongoAutoConfiguration.class,
            MongoAutoConfiguration.class, MongoDataAutoConfiguration.class),
            "spring.session.store-type=mongo", "spring.data.mongodb.port=0",
            "spring.session.mongo.collection-name=foobar");
    MongoOperationsSessionRepository repository = validateSessionRepository(
            MongoOperationsSessionRepository.class);
    assertThat(new DirectFieldAccessor(repository).getPropertyValue("collectionName"))
            .isEqualTo("foobar");
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:MixedMongoRepositoriesAutoConfigurationTests.java   
@Override
public String[] selectImports(AnnotationMetadata importingClassMetadata) {
    List<String> names = new ArrayList<String>();
    for (Class<?> type : new Class<?>[] { DataSourceAutoConfiguration.class,
            HibernateJpaAutoConfiguration.class,
            JpaRepositoriesAutoConfiguration.class, MongoAutoConfiguration.class,
            MongoDataAutoConfiguration.class,
            MongoRepositoriesAutoConfiguration.class }) {
        names.add(type.getName());
    }
    return names.toArray(new String[0]);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:MongoDataAutoConfigurationTests.java   
@Test
public void templateExists() {
    this.context = new AnnotationConfigApplicationContext(
            PropertyPlaceholderAutoConfiguration.class, MongoAutoConfiguration.class,
            MongoDataAutoConfiguration.class);
    assertThat(this.context.getBeanNamesForType(MongoTemplate.class).length)
            .isEqualTo(1);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:MongoDataAutoConfigurationTests.java   
@Test
public void gridFsTemplateExists() {
    this.context = new AnnotationConfigApplicationContext();
    EnvironmentTestUtils.addEnvironment(this.context,
            "spring.data.mongodb.gridFsDatabase:grid");
    this.context.register(PropertyPlaceholderAutoConfiguration.class,
            MongoAutoConfiguration.class, MongoDataAutoConfiguration.class);
    this.context.refresh();
    assertThat(this.context.getBeanNamesForType(GridFsTemplate.class).length)
            .isEqualTo(1);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:MongoDataAutoConfigurationTests.java   
@Test
public void customConversions() throws Exception {
    this.context = new AnnotationConfigApplicationContext();
    this.context.register(CustomConversionsConfig.class);
    this.context.register(PropertyPlaceholderAutoConfiguration.class,
            MongoAutoConfiguration.class, MongoDataAutoConfiguration.class);
    this.context.refresh();
    MongoTemplate template = this.context.getBean(MongoTemplate.class);
    assertThat(template.getConverter().getConversionService().canConvert(Mongo.class,
            Boolean.class)).isTrue();
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:MongoDataAutoConfigurationTests.java   
@Test
public void usesAutoConfigurationPackageToPickUpDocumentTypes() {
    this.context = new AnnotationConfigApplicationContext();
    String cityPackage = City.class.getPackage().getName();
    AutoConfigurationPackages.register(this.context, cityPackage);
    this.context.register(MongoAutoConfiguration.class,
            MongoDataAutoConfiguration.class);
    this.context.refresh();
    assertDomainTypesDiscovered(this.context.getBean(MongoMappingContext.class),
            City.class);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:MongoDataAutoConfigurationTests.java   
@Test
@SuppressWarnings("unchecked")
public void entityScanShouldSetInitialEntitySet() throws Exception {
    this.context = new AnnotationConfigApplicationContext();
    this.context.register(EntityScanConfig.class,
            PropertyPlaceholderAutoConfiguration.class, MongoAutoConfiguration.class,
            MongoDataAutoConfiguration.class);
    this.context.refresh();
    MongoMappingContext mappingContext = this.context
            .getBean(MongoMappingContext.class);
    Set<Class<?>> initialEntitySet = (Set<Class<?>>) ReflectionTestUtils
            .getField(mappingContext, "initialEntitySet");
    assertThat(initialEntitySet).containsOnly(City.class, Country.class);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:MongoRepositoriesAutoConfigurationTests.java   
private void prepareApplicationContext(Class<?>... configurationClasses) {
    this.context = new AnnotationConfigApplicationContext();
    this.context.register(configurationClasses);
    this.context.register(MongoAutoConfiguration.class,
            MongoDataAutoConfiguration.class,
            MongoRepositoriesAutoConfiguration.class,
            PropertyPlaceholderAutoConfiguration.class);
    this.context.refresh();
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:CloudAutoConfigurationTests.java   
@Test
public void testOrder() throws Exception {
    TestAutoConfigurationSorter sorter = new TestAutoConfigurationSorter(
            new CachingMetadataReaderFactory());
    Collection<String> classNames = new ArrayList<String>();
    classNames.add(MongoAutoConfiguration.class.getName());
    classNames.add(DataSourceAutoConfiguration.class.getName());
    classNames.add(MongoRepositoriesAutoConfiguration.class.getName());
    classNames.add(JpaRepositoriesAutoConfiguration.class.getName());
    classNames.add(CloudAutoConfiguration.class.getName());
    List<String> ordered = sorter.getInPriorityOrder(classNames);
    assertThat(ordered.get(0)).isEqualTo(CloudAutoConfiguration.class.getName());
}
项目:spring-boot-concourse    文件:HealthIndicatorAutoConfigurationTests.java   
@Test
public void mongoHealthIndicator() {
    this.context.register(MongoAutoConfiguration.class,
            ManagementServerProperties.class, MongoDataAutoConfiguration.class,
            HealthIndicatorAutoConfiguration.class);
    EnvironmentTestUtils.addEnvironment(this.context,
            "management.health.diskspace.enabled:false");
    this.context.refresh();
    Map<String, HealthIndicator> beans = this.context
            .getBeansOfType(HealthIndicator.class);
    assertThat(beans).hasSize(1);
    assertThat(beans.values().iterator().next().getClass())
            .isEqualTo(MongoHealthIndicator.class);
}
项目:spring-boot-concourse    文件:HealthIndicatorAutoConfigurationTests.java   
@Test
public void notMongoHealthIndicator() {
    this.context.register(MongoAutoConfiguration.class,
            ManagementServerProperties.class, MongoDataAutoConfiguration.class,
            HealthIndicatorAutoConfiguration.class);
    EnvironmentTestUtils.addEnvironment(this.context,
            "management.health.mongo.enabled:false",
            "management.health.diskspace.enabled:false");
    this.context.refresh();
    Map<String, HealthIndicator> beans = this.context
            .getBeansOfType(HealthIndicator.class);
    assertThat(beans).hasSize(1);
    assertThat(beans.values().iterator().next().getClass())
            .isEqualTo(ApplicationHealthIndicator.class);
}
项目:spring-boot-concourse    文件:HealthIndicatorAutoConfigurationTests.java   
@Test
public void combinedHealthIndicator() {
    this.context.register(MongoAutoConfiguration.class, RedisAutoConfiguration.class,
            MongoDataAutoConfiguration.class, SolrAutoConfiguration.class,
            HealthIndicatorAutoConfiguration.class);
    this.context.refresh();
    Map<String, HealthIndicator> beans = this.context
            .getBeansOfType(HealthIndicator.class);
    assertThat(beans).hasSize(4);
}
项目:spring-boot-concourse    文件:MongoHealthIndicatorTests.java   
@Test
public void indicatorExists() {
    this.context = new AnnotationConfigApplicationContext(
            PropertyPlaceholderAutoConfiguration.class, MongoAutoConfiguration.class,
            MongoDataAutoConfiguration.class, EndpointAutoConfiguration.class,
            HealthIndicatorAutoConfiguration.class);
    assertThat(this.context.getBeanNamesForType(MongoTemplate.class).length)
            .isEqualTo(1);
    MongoHealthIndicator healthIndicator = this.context
            .getBean(MongoHealthIndicator.class);
    assertThat(healthIndicator).isNotNull();
}
项目:spring-boot-concourse    文件:SessionAutoConfigurationTests.java   
@Test
public void mongoSessionStore() {
    load(Arrays.asList(EmbeddedMongoAutoConfiguration.class,
            MongoAutoConfiguration.class, MongoDataAutoConfiguration.class),
            "spring.session.store-type=mongo", "spring.data.mongodb.port=0");
    validateSessionRepository(MongoOperationsSessionRepository.class);
}
项目:spring-boot-concourse    文件:SessionAutoConfigurationTests.java   
@Test
public void mongoSessionStoreWithCustomizations() {
    load(Arrays.asList(EmbeddedMongoAutoConfiguration.class,
            MongoAutoConfiguration.class, MongoDataAutoConfiguration.class),
            "spring.session.store-type=mongo", "spring.data.mongodb.port=0",
            "spring.session.mongo.collection-name=foobar");
    MongoOperationsSessionRepository repository = validateSessionRepository(
            MongoOperationsSessionRepository.class);
    assertThat(new DirectFieldAccessor(repository).getPropertyValue("collectionName"))
            .isEqualTo("foobar");
}
项目:spring-boot-concourse    文件:MixedMongoRepositoriesAutoConfigurationTests.java   
@Override
public String[] selectImports(AnnotationMetadata importingClassMetadata) {
    List<String> names = new ArrayList<String>();
    for (Class<?> type : new Class<?>[] { DataSourceAutoConfiguration.class,
            HibernateJpaAutoConfiguration.class,
            JpaRepositoriesAutoConfiguration.class, MongoAutoConfiguration.class,
            MongoDataAutoConfiguration.class,
            MongoRepositoriesAutoConfiguration.class }) {
        names.add(type.getName());
    }
    return names.toArray(new String[0]);
}
项目:spring-boot-concourse    文件:MongoDataAutoConfigurationTests.java   
@Test
public void templateExists() {
    this.context = new AnnotationConfigApplicationContext(
            PropertyPlaceholderAutoConfiguration.class, MongoAutoConfiguration.class,
            MongoDataAutoConfiguration.class);
    assertThat(this.context.getBeanNamesForType(MongoTemplate.class).length)
            .isEqualTo(1);
}
项目:spring-boot-concourse    文件:MongoDataAutoConfigurationTests.java   
@Test
public void gridFsTemplateExists() {
    this.context = new AnnotationConfigApplicationContext();
    EnvironmentTestUtils.addEnvironment(this.context,
            "spring.data.mongodb.gridFsDatabase:grid");
    this.context.register(PropertyPlaceholderAutoConfiguration.class,
            MongoAutoConfiguration.class, MongoDataAutoConfiguration.class);
    this.context.refresh();
    assertThat(this.context.getBeanNamesForType(GridFsTemplate.class).length)
            .isEqualTo(1);
}
项目:spring-boot-concourse    文件:MongoDataAutoConfigurationTests.java   
@Test
public void customConversions() throws Exception {
    this.context = new AnnotationConfigApplicationContext();
    this.context.register(CustomConversionsConfig.class);
    this.context.register(PropertyPlaceholderAutoConfiguration.class,
            MongoAutoConfiguration.class, MongoDataAutoConfiguration.class);
    this.context.refresh();
    MongoTemplate template = this.context.getBean(MongoTemplate.class);
    assertThat(template.getConverter().getConversionService().canConvert(Mongo.class,
            Boolean.class)).isTrue();
}
项目:spring-boot-concourse    文件:MongoDataAutoConfigurationTests.java   
@Test
public void usesAutoConfigurationPackageToPickUpDocumentTypes() {
    this.context = new AnnotationConfigApplicationContext();
    String cityPackage = City.class.getPackage().getName();
    AutoConfigurationPackages.register(this.context, cityPackage);
    this.context.register(MongoAutoConfiguration.class,
            MongoDataAutoConfiguration.class);
    this.context.refresh();
    assertDomainTypesDiscovered(this.context.getBean(MongoMappingContext.class),
            City.class);
}
项目:spring-boot-concourse    文件:MongoRepositoriesAutoConfigurationTests.java   
private void prepareApplicationContext(Class<?>... configurationClasses) {
    this.context = new AnnotationConfigApplicationContext();
    this.context.register(configurationClasses);
    this.context.register(MongoAutoConfiguration.class,
            MongoDataAutoConfiguration.class,
            MongoRepositoriesAutoConfiguration.class,
            PropertyPlaceholderAutoConfiguration.class);
    this.context.refresh();
}
项目:spring-boot-concourse    文件:CloudAutoConfigurationTests.java   
@Test
public void testOrder() throws Exception {
    TestAutoConfigurationSorter sorter = new TestAutoConfigurationSorter(
            new CachingMetadataReaderFactory());
    Collection<String> classNames = new ArrayList<String>();
    classNames.add(MongoAutoConfiguration.class.getName());
    classNames.add(DataSourceAutoConfiguration.class.getName());
    classNames.add(MongoRepositoriesAutoConfiguration.class.getName());
    classNames.add(JpaRepositoriesAutoConfiguration.class.getName());
    classNames.add(CloudAutoConfiguration.class.getName());
    List<String> ordered = sorter.getInPriorityOrder(classNames);
    assertThat(ordered.get(0)).isEqualTo(CloudAutoConfiguration.class.getName());
}
项目:contestparser    文件:HealthIndicatorAutoConfigurationTests.java   
@Test
public void mongoHealthIndicator() {
    this.context.register(MongoAutoConfiguration.class,
            ManagementServerProperties.class, MongoDataAutoConfiguration.class,
            HealthIndicatorAutoConfiguration.class);
    EnvironmentTestUtils.addEnvironment(this.context,
            "management.health.diskspace.enabled:false");
    this.context.refresh();
    Map<String, HealthIndicator> beans = this.context
            .getBeansOfType(HealthIndicator.class);
    assertEquals(1, beans.size());
    assertEquals(MongoHealthIndicator.class,
            beans.values().iterator().next().getClass());
}
项目:contestparser    文件:HealthIndicatorAutoConfigurationTests.java   
@Test
public void notMongoHealthIndicator() {
    this.context.register(MongoAutoConfiguration.class,
            ManagementServerProperties.class, MongoDataAutoConfiguration.class,
            HealthIndicatorAutoConfiguration.class);
    EnvironmentTestUtils.addEnvironment(this.context,
            "management.health.mongo.enabled:false",
            "management.health.diskspace.enabled:false");
    this.context.refresh();
    Map<String, HealthIndicator> beans = this.context
            .getBeansOfType(HealthIndicator.class);
    assertEquals(1, beans.size());
    assertEquals(ApplicationHealthIndicator.class,
            beans.values().iterator().next().getClass());
}
项目:contestparser    文件:HealthIndicatorAutoConfigurationTests.java   
@Test
public void combinedHealthIndicator() {
    this.context.register(MongoAutoConfiguration.class, RedisAutoConfiguration.class,
            MongoDataAutoConfiguration.class, SolrAutoConfiguration.class,
            HealthIndicatorAutoConfiguration.class);
    this.context.refresh();
    Map<String, HealthIndicator> beans = this.context
            .getBeansOfType(HealthIndicator.class);
    assertEquals(4, beans.size());
}
项目:contestparser    文件:MongoHealthIndicatorTests.java   
@Test
public void indicatorExists() {
    this.context = new AnnotationConfigApplicationContext(
            PropertyPlaceholderAutoConfiguration.class, MongoAutoConfiguration.class,
            MongoDataAutoConfiguration.class, EndpointAutoConfiguration.class,
            HealthIndicatorAutoConfiguration.class);
    assertEquals(1, this.context.getBeanNamesForType(MongoTemplate.class).length);
    MongoHealthIndicator healthIndicator = this.context
            .getBean(MongoHealthIndicator.class);
    assertNotNull(healthIndicator);
}
项目:contestparser    文件:MixedMongoRepositoriesAutoConfigurationTests.java   
@Override
public String[] selectImports(AnnotationMetadata importingClassMetadata) {
    List<String> names = new ArrayList<String>();
    for (Class<?> type : new Class<?>[] { DataSourceAutoConfiguration.class,
            HibernateJpaAutoConfiguration.class,
            JpaRepositoriesAutoConfiguration.class, MongoAutoConfiguration.class,
            MongoDataAutoConfiguration.class,
            MongoRepositoriesAutoConfiguration.class }) {
        names.add(type.getName());
    }
    return names.toArray(new String[0]);
}
项目:contestparser    文件:MongoDataAutoConfigurationTests.java   
@Test
public void templateExists() {
    this.context = new AnnotationConfigApplicationContext(
            PropertyPlaceholderAutoConfiguration.class, MongoAutoConfiguration.class,
            MongoDataAutoConfiguration.class);
    assertEquals(1, this.context.getBeanNamesForType(MongoTemplate.class).length);
}
项目:contestparser    文件:MongoDataAutoConfigurationTests.java   
@Test
public void gridFsTemplateExists() {
    this.context = new AnnotationConfigApplicationContext();
    EnvironmentTestUtils.addEnvironment(this.context,
            "spring.data.mongodb.gridFsDatabase:grid");
    this.context.register(PropertyPlaceholderAutoConfiguration.class,
            MongoAutoConfiguration.class, MongoDataAutoConfiguration.class);
    this.context.refresh();
    assertEquals(1, this.context.getBeanNamesForType(GridFsTemplate.class).length);
}