Search in sources :

Example 11 with AmqpServiceInfo

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

the class RabbitServiceInfoTest method amqpsSchemeAccepted.

@Test
public void amqpsSchemeAccepted() {
    AmqpServiceInfo serviceInfo = new AmqpServiceInfo("id", "amqps://myuser:mypass@myhost:12345/myvhost");
    assertEquals("amqps", serviceInfo.getScheme());
}
Also used : AmqpServiceInfo(org.springframework.cloud.service.common.AmqpServiceInfo) Test(org.junit.Test)

Example 12 with AmqpServiceInfo

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

the class LocalConfigConnectorAmqpServiceTest method serviceCreation.

@Test
public void serviceCreation() {
    List<ServiceInfo> services = connector.getServiceInfos();
    ServiceInfo service = getServiceInfo(services, "rabbit");
    assertNotNull(service);
    assertTrue(service instanceof AmqpServiceInfo);
    assertUriParameters((AmqpServiceInfo) service);
}
Also used : ServiceInfo(org.springframework.cloud.service.ServiceInfo) AmqpServiceInfo(org.springframework.cloud.service.common.AmqpServiceInfo) AmqpServiceInfo(org.springframework.cloud.service.common.AmqpServiceInfo) Test(org.junit.Test)

Example 13 with AmqpServiceInfo

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

the class CloudFoundryConnectorAmqpServiceTest method qpidServiceCreationNoLabelNoTags.

@Test
public void qpidServiceCreationNoLabelNoTags() throws Exception {
    when(mockEnvironment.getEnvValue("VCAP_SERVICES")).thenReturn(getServicesPayload(getQpidServicePayloadNoLabelNoTags("qpid-1", hostname, port, username, password, "q-1", "vhost1"), getQpidServicePayloadNoLabelNoTags("qpid-2", hostname, port, username, password, "q-2", "vhost2")));
    List<ServiceInfo> serviceInfos = testCloudConnector.getServiceInfos();
    assertServiceFoundOfType(serviceInfos, "qpid-1", AmqpServiceInfo.class);
    assertServiceFoundOfType(serviceInfos, "qpid-2", AmqpServiceInfo.class);
    AmqpServiceInfo serviceInfo = (AmqpServiceInfo) getServiceInfo(serviceInfos, "qpid-1");
    assertNotNull(serviceInfo);
    assertEquals(username, serviceInfo.getUserName());
    assertEquals(password, serviceInfo.getPassword());
    assertEquals("vhost1", serviceInfo.getVirtualHost());
    URI uri = new URI(serviceInfo.getUri());
    assertTrue(uri.getQuery().contains("tcp://" + hostname + ":" + port));
}
Also used : ServiceInfo(org.springframework.cloud.service.ServiceInfo) AmqpServiceInfo(org.springframework.cloud.service.common.AmqpServiceInfo) URI(java.net.URI) AmqpServiceInfo(org.springframework.cloud.service.common.AmqpServiceInfo) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)13 AmqpServiceInfo (org.springframework.cloud.service.common.AmqpServiceInfo)13 ServiceInfo (org.springframework.cloud.service.ServiceInfo)6 URI (java.net.URI)3 ConnectionFactory (org.springframework.amqp.rabbit.connection.ConnectionFactory)3 HashMap (java.util.HashMap)1 Properties (java.util.Properties)1 CloudTestUtil.getTestCloudConnector (org.springframework.cloud.CloudTestUtil.getTestCloudConnector)1