Search in sources :

Example 6 with StubCloudConnector

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

the class StubServiceConnectorConfig method getServiceInfoByValidId.

@Test
public void getServiceInfoByValidId() {
    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);
    Cloud testCloud = new Cloud(stubCloudConnector, serviceConnectorCreators);
    assertEquals(testServiceInfo1, testCloud.getServiceInfo(testServiceInfo1.getId()));
    assertEquals(testServiceInfo2, testCloud.getServiceInfo(testServiceInfo2.getId()));
}
Also used : StubServiceInfo(org.springframework.cloud.CloudTestUtil.StubServiceInfo) StubCloudConnector(org.springframework.cloud.CloudTestUtil.StubCloudConnector) Test(org.junit.Test)

Example 7 with StubCloudConnector

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

the class StubServiceConnectorConfig method serviceConnectorCreationSpecifiedTypeAndConfig.

@Test
public void serviceConnectorCreationSpecifiedTypeAndConfig() {
    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);
    StubServiceConnectorConfig config = new StubServiceConnectorConfig("test-config");
    StubServiceConnector connector = testCloud.getServiceConnector(testServiceInfo.getId(), StubServiceConnector.class, config);
    assertStubService(testServiceInfo, connector, config);
}
Also used : StubServiceInfo(org.springframework.cloud.CloudTestUtil.StubServiceInfo) StubCloudConnector(org.springframework.cloud.CloudTestUtil.StubCloudConnector) Test(org.junit.Test)

Example 8 with StubCloudConnector

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

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

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

the class StubServiceConnectorConfig method getSingletonServiceConnectorNoService.

@Test(expected = CloudException.class)
public void getSingletonServiceConnectorNoService() {
    StubCloudConnector stubCloudConnector = CloudTestUtil.getTestCloudConnector();
    Cloud testCloud = new Cloud(stubCloudConnector, serviceConnectorCreators);
    testCloud.getSingletonServiceConnector(null, null);
}
Also used : StubCloudConnector(org.springframework.cloud.CloudTestUtil.StubCloudConnector) Test(org.junit.Test)

Aggregations

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