use of org.springframework.cloud.service.common.AmqpServiceInfo in project spring-cloud-connectors by spring-cloud.
the class RabbitConnectionFactoryCreatorTest method cloudRabbitCreationWithUri.
@Test
public void cloudRabbitCreationWithUri() throws Exception {
String userinfo = String.format("%s:%s", TEST_USERNAME, TEST_PASSWORD);
URI uri = new URI("amqp", userinfo, TEST_HOST, TEST_PORT, "/" + TEST_VH, null, null);
AmqpServiceInfo serviceInfo = new AmqpServiceInfo("id", uri.toString());
ConnectionFactory connector = testCreator.create(serviceInfo, null);
assertConnectorPropertiesMatchUri(connector, serviceInfo.getUri());
}
use of org.springframework.cloud.service.common.AmqpServiceInfo in project spring-cloud-connectors by spring-cloud.
the class RabbitConnectionFactoryCreatorTest method cloudRabbitCreationWithUris.
@Test
public void cloudRabbitCreationWithUris() throws Exception {
String userinfo = String.format("%s:%s", TEST_USERNAME, TEST_PASSWORD);
URI uri = new URI("amqp", userinfo, "0.0.0.0", 0, "/" + TEST_VH, null, null);
URI uri1 = new URI("amqp", userinfo, TEST_HOST, TEST_PORT, "/" + TEST_VH, null, null);
URI uri2 = new URI("amqp", userinfo, TEST_HOST2, TEST_PORT2, "/" + TEST_VH, null, null);
List<String> uris = Arrays.asList(uri1.toString(), uri2.toString());
AmqpServiceInfo serviceInfo = new AmqpServiceInfo("id", uri.toString(), null, uris, null);
ConnectionFactory connector = testCreator.create(serviceInfo, null);
assertConnectorPropertiesMatchUri(connector, uri1.toString());
assertConnectorPropertiesMatchHosts(connector, uris);
}
use of org.springframework.cloud.service.common.AmqpServiceInfo in project spring-cloud-connectors by spring-cloud.
the class CloudTest method servicePropsRabbit.
@Test
public void servicePropsRabbit() {
String serviceId = "my-rabbit";
AmqpServiceInfo rabbitServiceInfo = createRabbitService(serviceId);
CloudConnector stubCloudConnector = getTestCloudConnector(rabbitServiceInfo);
Cloud testCloud = new Cloud(stubCloudConnector, serviceCreators);
Properties cloudProperties = testCloud.getCloudProperties();
assertRabbitProps("cloud.services.my-rabbit", rabbitServiceInfo, cloudProperties);
assertRabbitProps("cloud.services.rabbitmq", rabbitServiceInfo, cloudProperties);
}
use of org.springframework.cloud.service.common.AmqpServiceInfo in project spring-cloud-connectors by spring-cloud.
the class HerokuConnectorAmqpServiceTest method amqpServiceCreation.
@Test
public void amqpServiceCreation() {
Map<String, String> env = new HashMap<String, String>();
String amqpUrl = getAmqpServiceUrl("db");
env.put("CLOUDAMQP_URL", amqpUrl);
when(mockEnvironment.getEnv()).thenReturn(env);
List<ServiceInfo> serviceInfos = testCloudConnector.getServiceInfos();
ServiceInfo serviceInfo = getServiceInfo(serviceInfos, "CLOUDAMQP");
assertNotNull(serviceInfo);
assertTrue(serviceInfo instanceof AmqpServiceInfo);
assertAmqpServiceInfo((AmqpServiceInfo) serviceInfo, "db");
}
use of org.springframework.cloud.service.common.AmqpServiceInfo in project spring-cloud-connectors by spring-cloud.
the class CloudFoundryConnectorAmqpServiceTest method rabbitServiceCreationWithoutManagementUri.
@Test
public void rabbitServiceCreationWithoutManagementUri() {
when(mockEnvironment.getEnvValue("VCAP_SERVICES")).thenReturn(getServicesPayload(getRabbitServicePayloadNoLabelNoTags("rabbit-1", hostname, port, username, password, "q-1", "vhost1")));
List<ServiceInfo> serviceInfos = testCloudConnector.getServiceInfos();
assertServiceFoundOfType(serviceInfos, "rabbit-1", AmqpServiceInfo.class);
AmqpServiceInfo amqpServiceInfo = (AmqpServiceInfo) serviceInfos.get(0);
assertNull(amqpServiceInfo.getManagementUri());
}
Aggregations