Search in sources :

Example 6 with StubServiceInfo

use of org.springframework.cloud.CloudTestUtil.StubServiceInfo in project spring-cloud-connectors by spring-cloud.

the class StubServiceConnectorConfig method serviceInfoMultipleServicesOfTheSameType.

@Test
public void serviceInfoMultipleServicesOfTheSameType() {
    StubServiceInfo testServiceInfo1 = new StubServiceInfo("test-id1", "test-host", 1000, "test-username", "test-password");
    StubServiceInfo testServiceInfo2 = new StubServiceInfo("test-id2", "test-host", 1000, "test-username", "test-password");
    StubCloudConnector stubCloudConnector = CloudTestUtil.getTestCloudConnector(testServiceInfo1, testServiceInfo2);
    serviceConnectorCreators.add(new StubServiceConnectorCreator());
    Cloud testCloud = new Cloud(stubCloudConnector, serviceConnectorCreators);
    assertEquals(2, testCloud.getServiceInfos().size());
    assertEquals(2, testCloud.getServiceInfos(StubServiceConnector.class).size());
}
Also used : StubServiceInfo(org.springframework.cloud.CloudTestUtil.StubServiceInfo) StubCloudConnector(org.springframework.cloud.CloudTestUtil.StubCloudConnector) Test(org.junit.Test)

Example 7 with StubServiceInfo

use of org.springframework.cloud.CloudTestUtil.StubServiceInfo in project spring-cloud-connectors by spring-cloud.

the class StubServiceConnectorConfig method getSingletonServiceConnectorSingleService.

@Test
public void getSingletonServiceConnectorSingleService() {
    StubServiceInfo testServiceInfo = new StubServiceInfo("test-id", "test-host", 1000, "test-username", "test-password");
    StubCloudConnector stubCloudConnector = CloudTestUtil.getTestCloudConnector(testServiceInfo);
    serviceConnectorCreators.add(new StubServiceConnectorCreator());
    Cloud testCloud = new Cloud(stubCloudConnector, serviceConnectorCreators);
    StubServiceConnector connector = testCloud.getSingletonServiceConnector(null, null);
    assertStubService(testServiceInfo, connector, null);
}
Also used : StubServiceInfo(org.springframework.cloud.CloudTestUtil.StubServiceInfo) StubCloudConnector(org.springframework.cloud.CloudTestUtil.StubCloudConnector) Test(org.junit.Test)

Example 8 with StubServiceInfo

use of org.springframework.cloud.CloudTestUtil.StubServiceInfo in project spring-cloud-connectors by spring-cloud.

the class StubServiceConnectorConfig method servicePropsOneServiceOfTheSameLabel.

@Test
public void servicePropsOneServiceOfTheSameLabel() {
    StubServiceInfo testServiceInfo = new StubServiceInfo("test-id", "test-host", 1000, "test-username", "test-password");
    StubCloudConnector stubCloudConnector = CloudTestUtil.getTestCloudConnector(testServiceInfo);
    Cloud testCloud = new Cloud(stubCloudConnector, serviceConnectorCreators);
    Properties cloudProperties = testCloud.getCloudProperties();
    assertStubServiceProp("cloud.services.test-id", testServiceInfo, cloudProperties);
    assertStubServiceProp("cloud.services.stub", testServiceInfo, cloudProperties);
}
Also used : StubServiceInfo(org.springframework.cloud.CloudTestUtil.StubServiceInfo) Properties(java.util.Properties) StubCloudConnector(org.springframework.cloud.CloudTestUtil.StubCloudConnector) Test(org.junit.Test)

Example 9 with StubServiceInfo

use of org.springframework.cloud.CloudTestUtil.StubServiceInfo 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 10 with StubServiceInfo

use of org.springframework.cloud.CloudTestUtil.StubServiceInfo 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)

Aggregations

Test (org.junit.Test)10 StubCloudConnector (org.springframework.cloud.CloudTestUtil.StubCloudConnector)10 StubServiceInfo (org.springframework.cloud.CloudTestUtil.StubServiceInfo)10 Properties (java.util.Properties)2 StubCompositeServiceInfo (org.springframework.cloud.CloudTestUtil.StubCompositeServiceInfo)2 BaseServiceInfo (org.springframework.cloud.service.BaseServiceInfo)2 ServiceInfo (org.springframework.cloud.service.ServiceInfo)2