Search in sources :

Example 1 with MysqlServiceInfo

use of org.springframework.cloud.service.common.MysqlServiceInfo in project spring-cloud-connectors by spring-cloud.

the class CloudTest method servicePropsTwoServicesOfTheSameLabel.

@Test
public void servicePropsTwoServicesOfTheSameLabel() {
    MysqlServiceInfo mysqlServiceInfo1 = createMysqlService("my-mysql1");
    MysqlServiceInfo mysqlServiceInfo2 = createMysqlService("my-mysql2");
    CloudConnector stubCloudConnector = getTestCloudConnector(mysqlServiceInfo1, mysqlServiceInfo2);
    Cloud testCloud = new Cloud(stubCloudConnector, serviceCreators);
    Properties cloudProperties = testCloud.getCloudProperties();
    assertRelationalProps("cloud.services.my-mysql1", mysqlServiceInfo1, cloudProperties);
    assertRelationalProps("cloud.services.my-mysql2", mysqlServiceInfo2, cloudProperties);
    assertNull(cloudProperties.get("cloud.services.mysql.connection.host"));
}
Also used : MysqlServiceInfo(org.springframework.cloud.service.common.MysqlServiceInfo) CloudTestUtil.getTestCloudConnector(org.springframework.cloud.CloudTestUtil.getTestCloudConnector) Properties(java.util.Properties) Test(org.junit.Test)

Example 2 with MysqlServiceInfo

use of org.springframework.cloud.service.common.MysqlServiceInfo in project spring-cloud-connectors by spring-cloud.

the class CloudTest method servicePropsOneServiceOfTheSameLabel.

@Test
public void servicePropsOneServiceOfTheSameLabel() {
    MysqlServiceInfo mysqlServiceInfo = createMysqlService("my-mysql");
    MongoServiceInfo mongoServiceInfo = createMongoService("my-mongo");
    CloudConnector stubCloudConnector = getTestCloudConnector(mysqlServiceInfo, mongoServiceInfo);
    Cloud testCloud = new Cloud(stubCloudConnector, serviceCreators);
    Properties cloudProperties = testCloud.getCloudProperties();
    assertRelationalProps("cloud.services.my-mysql", mysqlServiceInfo, cloudProperties);
    assertMongoProps("cloud.services.my-mongo", mongoServiceInfo, cloudProperties);
    assertRelationalProps("cloud.services.mysql", mysqlServiceInfo, cloudProperties);
    assertMongoProps("cloud.services.mongo", mongoServiceInfo, cloudProperties);
}
Also used : MysqlServiceInfo(org.springframework.cloud.service.common.MysqlServiceInfo) CloudTestUtil.getTestCloudConnector(org.springframework.cloud.CloudTestUtil.getTestCloudConnector) Properties(java.util.Properties) MongoServiceInfo(org.springframework.cloud.service.common.MongoServiceInfo) Test(org.junit.Test)

Example 3 with MysqlServiceInfo

use of org.springframework.cloud.service.common.MysqlServiceInfo in project spring-cloud-connectors by spring-cloud.

the class LocalConfigConnectorMysqlServiceTest method serviceCreation.

@Test
public void serviceCreation() {
    List<ServiceInfo> services = connector.getServiceInfos();
    ServiceInfo service = getServiceInfo(services, "maria");
    assertNotNull(service);
    assertTrue(service instanceof MysqlServiceInfo);
    assertUriParameters((MysqlServiceInfo) service);
}
Also used : ServiceInfo(org.springframework.cloud.service.ServiceInfo) MysqlServiceInfo(org.springframework.cloud.service.common.MysqlServiceInfo) MysqlServiceInfo(org.springframework.cloud.service.common.MysqlServiceInfo) Test(org.junit.Test)

Example 4 with MysqlServiceInfo

use of org.springframework.cloud.service.common.MysqlServiceInfo in project spring-cloud-connectors by spring-cloud.

the class HerokuConnectorMysqlServiceTest method mysqlServiceCreation.

@Test
public void mysqlServiceCreation() {
    Map<String, String> env = new HashMap<String, String>();
    String mysqlUrl = getRelationalServiceUrl("db");
    env.put("CLEARDB_DATABASE_URL", mysqlUrl);
    when(mockEnvironment.getEnv()).thenReturn(env);
    List<ServiceInfo> serviceInfos = testCloudConnector.getServiceInfos();
    ServiceInfo serviceInfo = getServiceInfo(serviceInfos, "CLEARDB_DATABASE");
    assertNotNull(serviceInfo);
    assertTrue(serviceInfo instanceof MysqlServiceInfo);
    assertReleationServiceInfo((MysqlServiceInfo) serviceInfo, "db");
}
Also used : ServiceInfo(org.springframework.cloud.service.ServiceInfo) MysqlServiceInfo(org.springframework.cloud.service.common.MysqlServiceInfo) MysqlServiceInfo(org.springframework.cloud.service.common.MysqlServiceInfo) HashMap(java.util.HashMap) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)4 MysqlServiceInfo (org.springframework.cloud.service.common.MysqlServiceInfo)4 Properties (java.util.Properties)2 CloudTestUtil.getTestCloudConnector (org.springframework.cloud.CloudTestUtil.getTestCloudConnector)2 ServiceInfo (org.springframework.cloud.service.ServiceInfo)2 HashMap (java.util.HashMap)1 MongoServiceInfo (org.springframework.cloud.service.common.MongoServiceInfo)1