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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations