use of org.springframework.cloud.CloudTestUtil.StubServiceInfo in project spring-cloud-connectors by spring-cloud.
the class StubServiceConnectorConfig method serviceConnectorCreationDefaultTypeAndConfig.
@Test
public void serviceConnectorCreationDefaultTypeAndConfig() {
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.getServiceConnector(testServiceInfo.getId(), null, null);
assertStubService(testServiceInfo, connector, null);
}
use of org.springframework.cloud.CloudTestUtil.StubServiceInfo in project spring-cloud-connectors by spring-cloud.
the class StubServiceConnectorConfig method getSingletonServiceConnectorMultipleServices.
@Test(expected = CloudException.class)
public void getSingletonServiceConnectorMultipleServices() {
StubServiceInfo testServiceInfo1 = new StubServiceInfo("test-id", "test-host", 1000, "test-username", "test-password");
StubServiceInfo testServiceInfo2 = new StubServiceInfo("test-id", "test-host", 1000, "test-username", "test-password");
StubCloudConnector stubCloudConnector = CloudTestUtil.getTestCloudConnector(testServiceInfo1, testServiceInfo2);
serviceConnectorCreators.add(new StubServiceConnectorCreator());
Cloud testCloud = new Cloud(stubCloudConnector, serviceConnectorCreators);
testCloud.getSingletonServiceConnector(null, null);
}
use of org.springframework.cloud.CloudTestUtil.StubServiceInfo in project spring-cloud-connectors by spring-cloud.
the class StubServiceConnectorConfig method servicePropsTwoServicesOfTheSameLabel.
@Test
public void servicePropsTwoServicesOfTheSameLabel() {
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);
Properties cloudProperties = testCloud.getCloudProperties();
assertStubServiceProp("cloud.services.test-id1", testServiceInfo1, cloudProperties);
assertStubServiceProp("cloud.services.test-id2", testServiceInfo2, cloudProperties);
assertNull(cloudProperties.get("cloud.services.stub.connection.host"));
}
use of org.springframework.cloud.CloudTestUtil.StubServiceInfo 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()));
}
use of org.springframework.cloud.CloudTestUtil.StubServiceInfo 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);
}
Aggregations