use of org.springframework.cloud.service.ServiceInfo in project spring-cloud-connectors by spring-cloud.
the class HerokuConnectorPostgresqlServiceTest method assertPostgresServiceCreated.
private void assertPostgresServiceCreated(String envVarName, String serviceInstanceName) {
Map<String, String> env = new HashMap<String, String>();
String postgresUrl = getRelationalServiceUrl("db");
env.put(envVarName, postgresUrl);
when(mockEnvironment.getEnv()).thenReturn(env);
List<ServiceInfo> serviceInfos = testCloudConnector.getServiceInfos();
ServiceInfo serviceInfo = getServiceInfo(serviceInfos, serviceInstanceName);
assertNotNull(serviceInfo);
assertTrue(serviceInfo instanceof PostgresqlServiceInfo);
assertReleationServiceInfo((PostgresqlServiceInfo) serviceInfo, "db");
}
use of org.springframework.cloud.service.ServiceInfo in project spring-cloud-connectors by spring-cloud.
the class LocalConfigConnectorAmqpServiceTest method serviceCreation.
@Test
public void serviceCreation() {
List<ServiceInfo> services = connector.getServiceInfos();
ServiceInfo service = getServiceInfo(services, "rabbit");
assertNotNull(service);
assertTrue(service instanceof AmqpServiceInfo);
assertUriParameters((AmqpServiceInfo) service);
}
use of org.springframework.cloud.service.ServiceInfo in project spring-cloud-connectors by spring-cloud.
the class CloudFoundryConnectorPostgresqlServiceTest method postgresqlServiceCreation.
@Test
public void postgresqlServiceCreation() {
String name1 = "database-1";
String name2 = "database-2";
when(mockEnvironment.getEnvValue("VCAP_SERVICES")).thenReturn(getServicesPayload(getPostgresqlServicePayload("postgresql-1", hostname, port, username, password, name1), getPostgresqlServicePayload("postgresql-2", hostname, port, username, password, name2)));
List<ServiceInfo> serviceInfos = testCloudConnector.getServiceInfos();
ServiceInfo info1 = getServiceInfo(serviceInfos, "postgresql-1");
ServiceInfo info2 = getServiceInfo(serviceInfos, "postgresql-2");
assertServiceFoundOfType(info1, PostgresqlServiceInfo.class);
assertServiceFoundOfType(info2, PostgresqlServiceInfo.class);
assertJdbcUrlEqual(info1, POSTGRES_SCHEME, name1);
assertJdbcUrlEqual(info2, POSTGRES_SCHEME, name2);
assertUriBasedServiceInfoFields(info1, POSTGRES_SCHEME, hostname, port, username, password, name1);
assertUriBasedServiceInfoFields(info2, POSTGRES_SCHEME, hostname, port, username, password, name2);
}
use of org.springframework.cloud.service.ServiceInfo in project spring-cloud-connectors by spring-cloud.
the class CloudFoundryConnectorSmtpServiceTest method smtpServiceCreationWithUri.
@Test
public void smtpServiceCreationWithUri() {
when(mockEnvironment.getEnvValue("VCAP_SERVICES")).thenReturn(getServicesPayload(getSmtpServicePayloadWithUri("smtp-1", hostname, port, username, password)));
List<ServiceInfo> serviceInfos = testCloudConnector.getServiceInfos();
SmtpServiceInfo smtpServiceInfo = (SmtpServiceInfo) getServiceInfo(serviceInfos, "smtp-1");
assertNotNull(smtpServiceInfo);
assertEquals(hostname, smtpServiceInfo.getHost());
assertEquals(port, smtpServiceInfo.getPort());
assertEquals(username, smtpServiceInfo.getUserName());
assertEquals(password, smtpServiceInfo.getPassword());
}
use of org.springframework.cloud.service.ServiceInfo in project spring-cloud-connectors by spring-cloud.
the class CloudFoundryConnectorSqlServerServiceTest method sqlServerServiceCreationWithNoUri.
@Test
public void sqlServerServiceCreationWithNoUri() {
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 SQL-Server
assertFalse(SqlServerServiceInfo.class.isAssignableFrom(info.getClass()));
}
Aggregations