Search in sources :

Example 31 with ApplicationContext

use of org.springframework.context.ApplicationContext in project spring-cloud-connectors by spring-cloud.

the class DataSourceXmlConfigTest method cloudDataSourceWithoutServiceNameSpecified_TwoMixedServiceExist_byType.

// Mixed relational services test (mysql+postgresql)
@Test(expected = BeanCreationException.class)
public void cloudDataSourceWithoutServiceNameSpecified_TwoMixedServiceExist_byType() {
    ApplicationContext testContext = getTestApplicationContext(getWithoutServiceIdContextFileName(), createMysqlService("my-service"), createPostgresqlService("my-service-2"));
    testContext.getBean("my-service", getConnectorType());
}
Also used : ApplicationContext(org.springframework.context.ApplicationContext) Test(org.junit.Test)

Example 32 with ApplicationContext

use of org.springframework.context.ApplicationContext in project spring-cloud-connectors by spring-cloud.

the class DataSourceXmlConfigTest method cloudDataSourceWithMinMaxPool.

@Test
public void cloudDataSourceWithMinMaxPool() {
    ApplicationContext testContext = getTestApplicationContext("cloud-datasource-with-config.xml", createService("my-service"));
    DataSource ds = testContext.getBean("pool-config", getConnectorType());
    DataSourceCloudConfigTestHelper.assertPoolProperties(ds, 30, 5, 3000);
}
Also used : ApplicationContext(org.springframework.context.ApplicationContext) DataSource(javax.sql.DataSource) SimpleDriverDataSource(org.springframework.jdbc.datasource.SimpleDriverDataSource) Test(org.junit.Test)

Example 33 with ApplicationContext

use of org.springframework.context.ApplicationContext in project spring-cloud-connectors by spring-cloud.

the class GenericServiceXmlConfigTest method cloudGenericServiceWithConnectorType.

@Test
public void cloudGenericServiceWithConnectorType() {
    ApplicationContext testContext = getTestApplicationContext("cloud-generic-with-connector-type.xml", createService("my-service"));
    assertNotNull("Getting service with connector type (specific service)", testContext.getBean("my-service-with-type-with-service-name", DataSource.class));
    assertNotNull("Getting service with connector type (unique service)", testContext.getBean("my-service-with-type-without-service-name", DataSource.class));
}
Also used : ApplicationContext(org.springframework.context.ApplicationContext) DataSource(javax.sql.DataSource) Test(org.junit.Test)

Example 34 with ApplicationContext

use of org.springframework.context.ApplicationContext in project spring-cloud-connectors by spring-cloud.

the class MongoDbFactoryXmlConfigTest method withConfigAllOptionsSpecifiedWriteConcernUnspecified.

@Test
public void withConfigAllOptionsSpecifiedWriteConcernUnspecified() {
    ApplicationContext testContext = getTestApplicationContext("cloud-mongo-with-config.xml", createService("my-service"));
    MongoDbFactory connector = testContext.getBean("service-maxWait200-connectionPerHost50-WriteConcernUnspecified", getConnectorType());
    MongoDbFactoryCloudConfigTestHelper.assertConfigProperties(connector, null, 50, 200);
}
Also used : ApplicationContext(org.springframework.context.ApplicationContext) MongoDbFactory(org.springframework.data.mongodb.MongoDbFactory) Test(org.junit.Test)

Example 35 with ApplicationContext

use of org.springframework.context.ApplicationContext in project spring-cloud-connectors by spring-cloud.

the class MongoDbFactoryXmlConfigTest method withConfigOnlyConnectionPerHostSpecified.

@Test
public void withConfigOnlyConnectionPerHostSpecified() {
    ApplicationContext testContext = getTestApplicationContext("cloud-mongo-with-config.xml", createService("my-service"));
    MongoDbFactory connector = testContext.getBean("service-maxWaitUnspecified-connectionPerHost50-WriteConcernUnspecified", getConnectorType());
    MongoDbFactoryCloudConfigTestHelper.assertConfigProperties(connector, null, 50, null);
}
Also used : ApplicationContext(org.springframework.context.ApplicationContext) MongoDbFactory(org.springframework.data.mongodb.MongoDbFactory) Test(org.junit.Test)

Aggregations

ApplicationContext (org.springframework.context.ApplicationContext)578 Test (org.junit.Test)262 ClassPathXmlApplicationContext (org.springframework.context.support.ClassPathXmlApplicationContext)179 AnnotationConfigApplicationContext (org.springframework.context.annotation.AnnotationConfigApplicationContext)44 ConfigurableApplicationContext (org.springframework.context.ConfigurableApplicationContext)37 ConfigurableMessenger (org.springframework.scripting.ConfigurableMessenger)28 File (java.io.File)25 DataSource (javax.sql.DataSource)24 Messenger (org.springframework.scripting.Messenger)24 GenericWebApplicationContext (org.springframework.web.context.support.GenericWebApplicationContext)21 Refreshable (org.springframework.aop.target.dynamic.Refreshable)20 StubCloudConnectorTest (org.springframework.cloud.StubCloudConnectorTest)17 HashMap (java.util.HashMap)16 SchedulerException (org.quartz.SchedulerException)16 ArrayList (java.util.ArrayList)14 GenericApplicationContext (org.springframework.context.support.GenericApplicationContext)14 WebApplicationContext (org.springframework.web.context.WebApplicationContext)14 MovieMapper (com.mapper.MovieMapper)13 Map (java.util.Map)13 AnnotationConfigWebApplicationContext (org.springframework.web.context.support.AnnotationConfigWebApplicationContext)13