use of org.springframework.context.ApplicationContext in project spring-cloud-connectors by spring-cloud.
the class AbstractCloudConfigPropertiesTest method cloudScanWithOneService.
@Test
public void cloudScanWithOneService() {
ApplicationContext testContext = getPropertiesTestApplicationContext(createMysqlService("db"));
Properties cloudProperties = testContext.getBean("cloudProperties", Properties.class);
assertNotNull(cloudProperties);
assertEquals("db", cloudProperties.get("cloud.services.db.id"));
assertEquals("db", cloudProperties.get("cloud.services.mysql.id"));
}
use of org.springframework.context.ApplicationContext in project spring-cloud-connectors by spring-cloud.
the class AbstractCloudConfigServiceScanTest method skipUnknowServices.
@Test
public void skipUnknowServices() {
ApplicationContext testContext = getTestApplicationContext(createMysqlService("mysqlDb"), new BaseServiceInfo("newrelic-service"));
assertNotNull("Getting service by id", testContext.getBean("mysqlDb"));
assertNotNull("Getting service by id and type", testContext.getBean("mysqlDb", DataSource.class));
}
use of org.springframework.context.ApplicationContext in project spring-cloud-connectors by spring-cloud.
the class AbstractCloudConfigServiceScanTest method cloudScanWithAllTypesOfServices.
@Test
public void cloudScanWithAllTypesOfServices() {
ApplicationContext testContext = getTestApplicationContext(createMysqlService("mysqlDb"), createPostgresqlService("postDb"), createMongoService("mongoDb"), createRedisService("redisDb"), createRabbitService("rabbit"));
assertNotNull("Getting service by id", testContext.getBean("mysqlDb"));
assertNotNull("Getting service by id and type", testContext.getBean("mysqlDb", DataSource.class));
assertNotNull("Getting service by id", testContext.getBean("postDb"));
assertNotNull("Getting service by id and type", testContext.getBean("postDb", DataSource.class));
assertNotNull("Getting service by id", testContext.getBean("mongoDb"));
assertNotNull("Getting service by id and type", testContext.getBean("mongoDb", MongoDbFactory.class));
assertNotNull("Getting service by id", testContext.getBean("redisDb"));
assertNotNull("Getting service by id and type", testContext.getBean("redisDb", RedisConnectionFactory.class));
assertNotNull("Getting service by id", testContext.getBean("rabbit"));
assertNotNull("Getting service by id and type", testContext.getBean("rabbit", ConnectionFactory.class));
}
use of org.springframework.context.ApplicationContext in project spring-cloud-connectors by spring-cloud.
the class DatasourceConfigWithServiceConfig method cloudDataSourceWithoutServiceNameSpecified_TwoMixedServiceExist_byId.
@Test(expected = BeanCreationException.class)
public void cloudDataSourceWithoutServiceNameSpecified_TwoMixedServiceExist_byId() {
ApplicationContext testContext = getTestApplicationContextWithoutServiceId(createMysqlService("my-service"), createPostgresqlService("my-service-2"));
testContext.getBean(getConnectorType());
}
use of org.springframework.context.ApplicationContext in project spring-cloud-connectors by spring-cloud.
the class DatasourceConfigWithServiceConfig method cloudDataSourceWithNoConfig.
@Test
public void cloudDataSourceWithNoConfig() {
ApplicationContext testContext = getTestApplicationContext(DatasourceConfigWithServiceConfig.class, createService("my-service"));
DataSource ds = testContext.getBean("dataSourceWithNoConfig", getConnectorType());
assertConnectionProperties(ds, null);
assertConnectionProperty(ds, "driverClassName", getDriverClassName());
assertConnectionProperty(ds, "validationQuery", getValidationQuery());
}
Aggregations