Search in sources :

Example 36 with ServiceInfo

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

the class CloudFoundryConnectorMysqlServiceTest method mysqlServiceCreation.

@Test
public void mysqlServiceCreation() {
    String name1 = "database-1";
    String name2 = "database-2";
    when(mockEnvironment.getEnvValue("VCAP_SERVICES")).thenReturn(getServicesPayload(getMysqlServicePayload("mysql-1", hostname, port, username, password, name1), getMysqlServicePayload("mysql-2", hostname, port, username, password, name2)));
    List<ServiceInfo> serviceInfos = testCloudConnector.getServiceInfos();
    ServiceInfo info1 = getServiceInfo(serviceInfos, "mysql-1");
    ServiceInfo info2 = getServiceInfo(serviceInfos, "mysql-2");
    assertServiceFoundOfType(info1, MysqlServiceInfo.class);
    assertServiceFoundOfType(info2, MysqlServiceInfo.class);
    assertJdbcUrlEqual(info1, MYSQL_SCHEME, name1);
    assertJdbcUrlEqual(info2, MYSQL_SCHEME, name2);
}
Also used : ServiceInfo(org.springframework.cloud.service.ServiceInfo) MysqlServiceInfo(org.springframework.cloud.service.common.MysqlServiceInfo) Test(org.junit.Test)

Example 37 with ServiceInfo

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

the class CloudFoundryConnectorMysqlServiceTest method mysqlServiceCreationNoLabelNoTags.

@Test
public void mysqlServiceCreationNoLabelNoTags() {
    String name1 = "database-1";
    String name2 = "database-2";
    when(mockEnvironment.getEnvValue("VCAP_SERVICES")).thenReturn(getServicesPayload(getMysqlServicePayloadNoLabelNoTags("mysql-1", hostname, port, username, password, name1), getMysqlServicePayloadNoLabelNoTags("mysql-2", hostname, port, username, password, name2)));
    List<ServiceInfo> serviceInfos = testCloudConnector.getServiceInfos();
    ServiceInfo info1 = getServiceInfo(serviceInfos, "mysql-1");
    ServiceInfo info2 = getServiceInfo(serviceInfos, "mysql-2");
    assertServiceFoundOfType(info1, MysqlServiceInfo.class);
    assertServiceFoundOfType(info2, MysqlServiceInfo.class);
    assertJdbcUrlEqual(info1, MYSQL_SCHEME, name1);
    assertJdbcUrlEqual(info2, MYSQL_SCHEME, name2);
    assertUriBasedServiceInfoFields(info1, MYSQL_SCHEME, hostname, port, username, password, name1);
    assertUriBasedServiceInfoFields(info2, MYSQL_SCHEME, hostname, port, username, password, name2);
}
Also used : ServiceInfo(org.springframework.cloud.service.ServiceInfo) MysqlServiceInfo(org.springframework.cloud.service.common.MysqlServiceInfo) Test(org.junit.Test)

Example 38 with ServiceInfo

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

the class CloudFoundryConnectorMysqlServiceTest method mysqlServiceCreationWithLabelNoTags.

@Test
public void mysqlServiceCreationWithLabelNoTags() {
    String name1 = "database-1";
    String name2 = "database-2";
    when(mockEnvironment.getEnvValue("VCAP_SERVICES")).thenReturn(getServicesPayload(getMysqlServicePayloadWithLabelNoTags("mysql-1", hostname, port, username, password, name1), getMysqlServicePayloadWithLabelNoTags("mysql-2", hostname, port, username, password, name2)));
    List<ServiceInfo> serviceInfos = testCloudConnector.getServiceInfos();
    ServiceInfo info1 = getServiceInfo(serviceInfos, "mysql-1");
    ServiceInfo info2 = getServiceInfo(serviceInfos, "mysql-2");
    assertServiceFoundOfType(info1, MysqlServiceInfo.class);
    assertServiceFoundOfType(info2, MysqlServiceInfo.class);
    assertJdbcUrlEqual(info1, MYSQL_SCHEME, name1);
    assertJdbcUrlEqual(info2, MYSQL_SCHEME, name2);
    assertUriBasedServiceInfoFields(info1, MYSQL_SCHEME, hostname, port, username, password, name1);
    assertUriBasedServiceInfoFields(info2, MYSQL_SCHEME, hostname, port, username, password, name2);
}
Also used : ServiceInfo(org.springframework.cloud.service.ServiceInfo) MysqlServiceInfo(org.springframework.cloud.service.common.MysqlServiceInfo) Test(org.junit.Test)

Example 39 with ServiceInfo

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

the class CloudFoundryConnectorMysqlServiceTest method mysqlServiceCreationWithJdbcUrl.

@Test
public void mysqlServiceCreationWithJdbcUrl() {
    String name1 = "database-1";
    String name2 = "database-2";
    when(mockEnvironment.getEnvValue("VCAP_SERVICES")).thenReturn(getServicesPayload(getMysqlServicePayloadWithJdbcUrl("mysql-1", hostname, port, username, password, name1), getMysqlServicePayloadWithJdbcUrl("mysql-2", hostname, port, username, password, name2)));
    List<ServiceInfo> serviceInfos = testCloudConnector.getServiceInfos();
    ServiceInfo info1 = getServiceInfo(serviceInfos, "mysql-1");
    ServiceInfo info2 = getServiceInfo(serviceInfos, "mysql-2");
    assertServiceFoundOfType(info1, MysqlServiceInfo.class);
    assertServiceFoundOfType(info2, MysqlServiceInfo.class);
    assertJdbcUrlEqual(info1, MYSQL_SCHEME, name1);
    assertJdbcUrlEqual(info2, MYSQL_SCHEME, name2);
    assertUriBasedServiceInfoFields(info1, MYSQL_SCHEME, hostname, port, username, password, name1);
    assertUriBasedServiceInfoFields(info2, MYSQL_SCHEME, hostname, port, username, password, name2);
}
Also used : ServiceInfo(org.springframework.cloud.service.ServiceInfo) MysqlServiceInfo(org.springframework.cloud.service.common.MysqlServiceInfo) Test(org.junit.Test)

Example 40 with ServiceInfo

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

the class CloudFoundryConnectorMysqlServiceTest method mysqlServiceCreationWithLabelNoUri.

@Test
public void mysqlServiceCreationWithLabelNoUri() {
    String name1 = "database-1";
    String name2 = "database-2";
    when(mockEnvironment.getEnvValue("VCAP_SERVICES")).thenReturn(getServicesPayload(getMysqlServicePayloadWithLabelNoUri("mysql-1", hostname, port, username, password, name1), getMysqlServicePayloadWithLabelNoUri("mysql-2", hostname, port, username, password, name2)));
    List<ServiceInfo> serviceInfos = testCloudConnector.getServiceInfos();
    ServiceInfo info1 = getServiceInfo(serviceInfos, "mysql-1");
    ServiceInfo info2 = getServiceInfo(serviceInfos, "mysql-2");
    assertServiceFoundOfType(info1, MysqlServiceInfo.class);
    assertServiceFoundOfType(info2, MysqlServiceInfo.class);
    assertJdbcUrlEqual(info1, MYSQL_SCHEME, name1);
    assertJdbcUrlEqual(info2, MYSQL_SCHEME, name2);
    assertUriBasedServiceInfoFields(info1, MYSQL_SCHEME, hostname, port, username, password, name1);
    assertUriBasedServiceInfoFields(info2, MYSQL_SCHEME, hostname, port, username, password, name2);
}
Also used : ServiceInfo(org.springframework.cloud.service.ServiceInfo) MysqlServiceInfo(org.springframework.cloud.service.common.MysqlServiceInfo) Test(org.junit.Test)

Aggregations

ServiceInfo (org.springframework.cloud.service.ServiceInfo)47 Test (org.junit.Test)37 MysqlServiceInfo (org.springframework.cloud.service.common.MysqlServiceInfo)16 AmqpServiceInfo (org.springframework.cloud.service.common.AmqpServiceInfo)8 HashMap (java.util.HashMap)6 CompositeServiceInfo (org.springframework.cloud.service.CompositeServiceInfo)5 MongoServiceInfo (org.springframework.cloud.service.common.MongoServiceInfo)5 PostgresqlServiceInfo (org.springframework.cloud.service.common.PostgresqlServiceInfo)5 RedisServiceInfo (org.springframework.cloud.service.common.RedisServiceInfo)4 ArrayList (java.util.ArrayList)3 UriBasedServiceInfo (org.springframework.cloud.service.UriBasedServiceInfo)3 DB2ServiceInfo (org.springframework.cloud.service.common.DB2ServiceInfo)3 OracleServiceInfo (org.springframework.cloud.service.common.OracleServiceInfo)3 SqlServerServiceInfo (org.springframework.cloud.service.common.SqlServerServiceInfo)3 StubCloudConnector (org.springframework.cloud.CloudTestUtil.StubCloudConnector)2 StubCompositeServiceInfo (org.springframework.cloud.CloudTestUtil.StubCompositeServiceInfo)2 StubServiceInfo (org.springframework.cloud.CloudTestUtil.StubServiceInfo)2 BaseServiceInfo (org.springframework.cloud.service.BaseServiceInfo)2 RelationalServiceInfo (org.springframework.cloud.service.common.RelationalServiceInfo)2 SmtpServiceInfo (org.springframework.cloud.service.common.SmtpServiceInfo)2