use of org.springframework.cloud.service.ServiceInfo in project spring-cloud-connectors by spring-cloud.
the class CloudFoundryConnectorAmqpServiceTest method rabbitServiceCreationWithManagementUri.
@Test
public void rabbitServiceCreationWithManagementUri() {
when(mockEnvironment.getEnvValue("VCAP_SERVICES")).thenReturn(getServicesPayload(getRabbitServicePayloadWithTags("rabbit-1", hostname, port, username, password, "q-1", "vhost1")));
String expectedManagementUri = "http://" + username + ":" + password + "@" + hostname + "/api";
List<ServiceInfo> serviceInfos = testCloudConnector.getServiceInfos();
assertServiceFoundOfType(serviceInfos, "rabbit-1", AmqpServiceInfo.class);
AmqpServiceInfo amqpServiceInfo = (AmqpServiceInfo) serviceInfos.get(0);
assertEquals(amqpServiceInfo.getManagementUri(), expectedManagementUri);
}
use of org.springframework.cloud.service.ServiceInfo in project spring-cloud-connectors by spring-cloud.
the class CloudFoundryConnectorDB2ServiceTest method db2ServiceCreation.
@Test
public void db2ServiceCreation() {
when(mockEnvironment.getEnvValue("VCAP_SERVICES")).thenReturn(getServicesPayload(getUserProvidedServicePayload(SERVICE_NAME, hostname, port, username, password, INSTANCE_NAME, DB2_SCHEME + ":")));
List<ServiceInfo> serviceInfos = testCloudConnector.getServiceInfos();
ServiceInfo info = getServiceInfo(serviceInfos, SERVICE_NAME);
assertServiceFoundOfType(info, DB2ServiceInfo.class);
assertJdbcUrlEqual(info, DB2_SCHEME, INSTANCE_NAME);
assertUriBasedServiceInfoFields(info, DB2_SCHEME, hostname, port, username, password, INSTANCE_NAME);
}
use of org.springframework.cloud.service.ServiceInfo in project spring-cloud-connectors by spring-cloud.
the class CloudFoundryConnectorDB2ServiceTest method dServiceCreationWithJdbcUrl.
@Test
public void dServiceCreationWithJdbcUrl() {
when(mockEnvironment.getEnvValue("VCAP_SERVICES")).thenReturn(getServicesPayload(getDB2ServicePayloadWithJdbcurl(SERVICE_NAME, hostname, port, username, password, INSTANCE_NAME, DB2_SCHEME + ":")));
List<ServiceInfo> serviceInfos = testCloudConnector.getServiceInfos();
ServiceInfo info = getServiceInfo(serviceInfos, SERVICE_NAME);
assertServiceFoundOfType(info, DB2ServiceInfo.class);
assertJdbcUrlEqual(info, DB2_SCHEME, INSTANCE_NAME);
assertUriBasedServiceInfoFields(info, DB2_SCHEME, hostname, port, username, password, INSTANCE_NAME);
}
use of org.springframework.cloud.service.ServiceInfo in project spring-cloud-connectors by spring-cloud.
the class CloudFoundryConnectorOracleServiceTest method oracleServiceCreation.
@Test
public void oracleServiceCreation() {
when(mockEnvironment.getEnvValue("VCAP_SERVICES")).thenReturn(getServicesPayload(getUserProvidedServicePayload(SERVICE_NAME, hostname, port, username, password, INSTANCE_NAME, ORACLE_SCHEME + ":")));
List<ServiceInfo> serviceInfos = testCloudConnector.getServiceInfos();
ServiceInfo info = getServiceInfo(serviceInfos, SERVICE_NAME);
assertServiceFoundOfType(info, OracleServiceInfo.class);
assertJdbcUrlEqual(info, ORACLE_SCHEME, INSTANCE_NAME);
assertUriBasedServiceInfoFields(info, ORACLE_SCHEME, hostname, port, username, password, INSTANCE_NAME);
}
use of org.springframework.cloud.service.ServiceInfo in project spring-cloud-connectors by spring-cloud.
the class CloudFoundryConnectorOracleServiceTest method oracleServiceCreationWithNoUri.
@Test
public void oracleServiceCreationWithNoUri() {
when(mockEnvironment.getEnvValue("VCAP_SERVICES")).thenReturn(getServicesPayload(getUserProvidedServicePayloadWithNoUri(SERVICE_NAME, hostname, port, username, password, INSTANCE_NAME)));
List<ServiceInfo> serviceInfos = testCloudConnector.getServiceInfos();
ServiceInfo info = getServiceInfo(serviceInfos, SERVICE_NAME);
assertNotNull(info);
// service was not detected as MySQL
assertFalse(MysqlServiceInfo.class.isAssignableFrom(info.getClass()));
assertNotNull(info);
}
Aggregations