Search in sources :

Example 16 with ServiceInfo

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);
}
Also used : ServiceInfo(org.springframework.cloud.service.ServiceInfo) AmqpServiceInfo(org.springframework.cloud.service.common.AmqpServiceInfo) AmqpServiceInfo(org.springframework.cloud.service.common.AmqpServiceInfo) Test(org.junit.Test)

Example 17 with ServiceInfo

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);
}
Also used : ServiceInfo(org.springframework.cloud.service.ServiceInfo) MysqlServiceInfo(org.springframework.cloud.service.common.MysqlServiceInfo) DB2ServiceInfo(org.springframework.cloud.service.common.DB2ServiceInfo) Test(org.junit.Test)

Example 18 with ServiceInfo

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);
}
Also used : ServiceInfo(org.springframework.cloud.service.ServiceInfo) MysqlServiceInfo(org.springframework.cloud.service.common.MysqlServiceInfo) DB2ServiceInfo(org.springframework.cloud.service.common.DB2ServiceInfo) Test(org.junit.Test)

Example 19 with ServiceInfo

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);
}
Also used : ServiceInfo(org.springframework.cloud.service.ServiceInfo) MysqlServiceInfo(org.springframework.cloud.service.common.MysqlServiceInfo) OracleServiceInfo(org.springframework.cloud.service.common.OracleServiceInfo) Test(org.junit.Test)

Example 20 with ServiceInfo

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);
}
Also used : ServiceInfo(org.springframework.cloud.service.ServiceInfo) MysqlServiceInfo(org.springframework.cloud.service.common.MysqlServiceInfo) OracleServiceInfo(org.springframework.cloud.service.common.OracleServiceInfo) 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