Java 类org.springframework.boot.autoconfigure.data.cassandra.city.City 实例源码

项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:CassandraDataAutoConfigurationIntegrationTests.java   
@Test
public void hasRecreateSchemaActionSet() {
    createTestKeyspaceIfNotExists();
    this.context = new AnnotationConfigApplicationContext();
    String cityPackage = City.class.getPackage().getName();
    AutoConfigurationPackages.register(this.context, cityPackage);
    EnvironmentTestUtils.addEnvironment(this.context,
            "spring.data.cassandra.schemaAction:RECREATE_DROP_UNUSED",
            "spring.data.cassandra.keyspaceName:boot_test");
    this.context.register(CassandraAutoConfiguration.class,
            CassandraDataAutoConfiguration.class);
    this.context.refresh();
    CassandraSessionFactoryBean bean = this.context
            .getBean(CassandraSessionFactoryBean.class);
    assertThat(bean.getSchemaAction()).isEqualTo(SchemaAction.RECREATE_DROP_UNUSED);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:CassandraDataAutoConfigurationTests.java   
@Test
@SuppressWarnings("unchecked")
public void entityScanShouldSetInitialEntitySet() throws Exception {
    this.context = new AnnotationConfigApplicationContext();
    this.context.register(TestConfiguration.class, EntityScanConfig.class,
            PropertyPlaceholderAutoConfiguration.class,
            CassandraAutoConfiguration.class, CassandraDataAutoConfiguration.class);
    this.context.refresh();
    CassandraMappingContext mappingContext = this.context
            .getBean(CassandraMappingContext.class);
    Set<Class<?>> initialEntitySet = (Set<Class<?>>) ReflectionTestUtils
            .getField(mappingContext, "initialEntitySet");
    assertThat(initialEntitySet).containsOnly(City.class);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:CassandraDataAutoConfigurationIntegrationTests.java   
@Test
public void hasDefaultSchemaActionSet() {
    this.context = new AnnotationConfigApplicationContext();
    String cityPackage = City.class.getPackage().getName();
    AutoConfigurationPackages.register(this.context, cityPackage);
    this.context.register(CassandraAutoConfiguration.class,
            CassandraDataAutoConfiguration.class);
    this.context.refresh();

    CassandraSessionFactoryBean bean = this.context
            .getBean(CassandraSessionFactoryBean.class);
    assertThat(bean.getSchemaAction()).isEqualTo(SchemaAction.NONE);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:CassandraRepositoriesAutoConfigurationTests.java   
@Test
public void testNoRepositoryConfiguration() {
    addConfigurations(TestExcludeConfiguration.class, EmptyConfiguration.class);
    assertThat(this.context.getBean(Cluster.class)).isNotNull();
    assertThat(getInitialEntitySet()).hasSize(1).containsOnly(City.class);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:CassandraRepositoriesAutoConfigurationTests.java   
@Test
public void doesNotTriggerDefaultRepositoryDetectionIfCustomized() {
    addConfigurations(TestExcludeConfiguration.class, CustomizedConfiguration.class);
    assertThat(this.context.getBean(CityCassandraRepository.class)).isNotNull();
    assertThat(getInitialEntitySet()).hasSize(1).containsOnly(City.class);
}