Search in sources :

Example 41 with ServiceInfo

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

the class CloudFoundryConnectorMysqlServiceTest method mysqlServiceCreationWithJdbcUrlOnly.

@Test
public void mysqlServiceCreationWithJdbcUrlOnly() {
    String name1 = "database-1";
    String name2 = "database-2";
    when(mockEnvironment.getEnvValue("VCAP_SERVICES")).thenReturn(getServicesPayload(getMysqlServicePayloadWithJdbcUrlOnly("mysql-1", hostname, port, username, password, name1), getMysqlServicePayloadWithJdbcUrlOnly("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, "jdbc", null, -1, null, null, null);
    assertUriBasedServiceInfoFields(info2, "jdbc", null, -1, null, null, null);
    assertJdbcShemeSpecificPartEqual(info1, MYSQL_SCHEME, name1);
    assertJdbcShemeSpecificPartEqual(info2, MYSQL_SCHEME, name2);
}
Also used : ServiceInfo(org.springframework.cloud.service.ServiceInfo) MysqlServiceInfo(org.springframework.cloud.service.common.MysqlServiceInfo) Test(org.junit.Test)

Example 42 with ServiceInfo

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

the class CloudFoundryConnectorOracleServiceTest method oracleServiceCreationWithJdbcUrl.

@Test
public void oracleServiceCreationWithJdbcUrl() {
    when(mockEnvironment.getEnvValue("VCAP_SERVICES")).thenReturn(getServicesPayload(getOracleServicePayloadWithJdbcurl(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 43 with ServiceInfo

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

the class StubServiceConnectorConfig method compositeServiceInfoRecursive.

@Test
public void compositeServiceInfoRecursive() {
    StubServiceInfo testServiceInfo1a = new StubServiceInfo("test-id-1a", "test-host", 1000, "test-username", "test-password");
    StubServiceInfo testServiceInfo1b = new StubServiceInfo("test-id-1b", "test-host", 1000, "test-username", "test-password");
    ServiceInfo testCompositeServiceInfo1 = new StubCompositeServiceInfo("test-composite-1", testServiceInfo1a, testServiceInfo1b);
    StubServiceInfo testServiceInfo2a = new StubServiceInfo("test-id-2a", "test-host", 1000, "test-username", "test-password");
    StubServiceInfo testServiceInfo2b = new StubServiceInfo("test-id-2b", "test-host", 1000, "test-username", "test-password");
    ServiceInfo testCompositeServiceInfo2 = new StubCompositeServiceInfo("test-composite-2", testServiceInfo2a, testServiceInfo2b);
    ServiceInfo testCompositeServiceInfo = new StubCompositeServiceInfo("test-composite", testCompositeServiceInfo1, testCompositeServiceInfo2);
    StubCloudConnector stubCloudConnector = CloudTestUtil.getTestCloudConnector(testCompositeServiceInfo);
    Cloud testCloud = new Cloud(stubCloudConnector, serviceConnectorCreators);
    assertNotNull(testCloud.getServiceInfo("test-id-1a"));
    assertNotNull(testCloud.getServiceInfo("test-id-1b"));
    assertNotNull(testCloud.getServiceInfo("test-id-2a"));
    assertNotNull(testCloud.getServiceInfo("test-id-2b"));
}
Also used : ServiceInfo(org.springframework.cloud.service.ServiceInfo) BaseServiceInfo(org.springframework.cloud.service.BaseServiceInfo) StubServiceInfo(org.springframework.cloud.CloudTestUtil.StubServiceInfo) StubCompositeServiceInfo(org.springframework.cloud.CloudTestUtil.StubCompositeServiceInfo) StubCompositeServiceInfo(org.springframework.cloud.CloudTestUtil.StubCompositeServiceInfo) StubServiceInfo(org.springframework.cloud.CloudTestUtil.StubServiceInfo) StubCloudConnector(org.springframework.cloud.CloudTestUtil.StubCloudConnector) Test(org.junit.Test)

Example 44 with ServiceInfo

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

the class StubServiceConnectorConfig method compositeServiceInfo.

@Test
public void compositeServiceInfo() {
    StubServiceInfo testServiceInfo1 = new StubServiceInfo("test-id-1", "test-host", 1000, "test-username", "test-password");
    StubServiceInfo testServiceInfo2 = new StubServiceInfo("test-id-2", "test-host", 1000, "test-username", "test-password");
    ServiceInfo testCompositeServiceInfo = new StubCompositeServiceInfo("test-composite", testServiceInfo1, testServiceInfo2);
    StubCloudConnector stubCloudConnector = CloudTestUtil.getTestCloudConnector(testCompositeServiceInfo);
    Cloud testCloud = new Cloud(stubCloudConnector, serviceConnectorCreators);
    assertNotNull(testCloud.getServiceInfo("test-id-1"));
    assertNotNull(testCloud.getServiceInfo("test-id-2"));
}
Also used : ServiceInfo(org.springframework.cloud.service.ServiceInfo) BaseServiceInfo(org.springframework.cloud.service.BaseServiceInfo) StubServiceInfo(org.springframework.cloud.CloudTestUtil.StubServiceInfo) StubCompositeServiceInfo(org.springframework.cloud.CloudTestUtil.StubCompositeServiceInfo) StubCompositeServiceInfo(org.springframework.cloud.CloudTestUtil.StubCompositeServiceInfo) StubServiceInfo(org.springframework.cloud.CloudTestUtil.StubServiceInfo) StubCloudConnector(org.springframework.cloud.CloudTestUtil.StubCloudConnector) Test(org.junit.Test)

Example 45 with ServiceInfo

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

the class LocalConfigConnectorMongoServiceTest method serviceCreation.

@Test
public void serviceCreation() {
    List<ServiceInfo> services = connector.getServiceInfos();
    ServiceInfo service = getServiceInfo(services, "candygram");
    assertNotNull(service);
    assertTrue(service instanceof MongoServiceInfo);
    assertUriParameters((MongoServiceInfo) service);
}
Also used : ServiceInfo(org.springframework.cloud.service.ServiceInfo) MongoServiceInfo(org.springframework.cloud.service.common.MongoServiceInfo) MongoServiceInfo(org.springframework.cloud.service.common.MongoServiceInfo) 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