Java Code Examples for org.apache.cxf.transport.http.HTTPTransportFactory#getDestination()

The following examples show how to use org.apache.cxf.transport.http.HTTPTransportFactory#getDestination() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JettyHTTPDestinationTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Test
public void testGetMultiple() throws Exception {
    bus = BusFactory.getDefaultBus(true);
    transportFactory = new HTTPTransportFactory();

    ServiceInfo serviceInfo = new ServiceInfo();
    serviceInfo.setName(new QName("bla", "Service"));
    EndpointInfo ei = new EndpointInfo(serviceInfo, "");
    ei.setName(new QName("bla", "Port"));
    ei.setAddress("http://foo");
    Destination d1 = transportFactory.getDestination(ei, bus);

    Destination d2 = transportFactory.getDestination(ei, bus);

    // Second get should not generate a new destination. It should just retrieve the existing one
    assertEquals(d1, d2);

    d2.shutdown();

    Destination d3 = transportFactory.getDestination(ei, bus);
    // Now a new destination should have been created
    assertNotSame(d1, d3);
}
 
Example 2
Source File: UndertowHTTPDestinationTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Test
public void testGetMultiple() throws Exception {
    bus = BusFactory.getDefaultBus(true);
    transportFactory = new HTTPTransportFactory();

    ServiceInfo serviceInfo = new ServiceInfo();
    serviceInfo.setName(new QName("bla", "Service"));
    EndpointInfo ei = new EndpointInfo(serviceInfo, "");
    ei.setName(new QName("bla", "Port"));
    ei.setAddress("http://foo");
    Destination d1 = transportFactory.getDestination(ei, bus);

    Destination d2 = transportFactory.getDestination(ei, bus);

    // Second get should not generate a new destination. It should just retrieve the existing one
    assertEquals(d1, d2);

    d2.shutdown();

    Destination d3 = transportFactory.getDestination(ei, bus);
    // Now a new destination should have been created
    assertNotSame(d1, d3);
}
 
Example 3
Source File: NettyHttpDestinationTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Test
public void testGetMultiple() throws Exception {
    transportFactory = new HTTPTransportFactory();
    bus = BusFactory.getDefaultBus();

    ServiceInfo serviceInfo = new ServiceInfo();
    serviceInfo.setName(new QName("bla", "Service"));
    EndpointInfo ei = new EndpointInfo(serviceInfo, "");
    ei.setName(new QName("bla", "Port"));
    ei.setAddress("http://foo");
    Destination d1 = transportFactory.getDestination(ei, bus);

    Destination d2 = transportFactory.getDestination(ei, bus);

    // Second get should not generate a new destination. It should just retrieve the existing one
    assertEquals(d1, d2);

    d2.shutdown();

    Destination d3 = transportFactory.getDestination(ei, bus);
    // Now a new destination should have been created
    assertNotSame(d1, d3);
}
 
Example 4
Source File: JettyHTTPDestinationTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Test
public void testRandomPortAllocation() throws Exception {
    bus = BusFactory.getDefaultBus(true);
    transportFactory = new HTTPTransportFactory();
    ServiceInfo serviceInfo = new ServiceInfo();
    serviceInfo.setName(new QName("bla", "Service"));
    EndpointInfo ei = new EndpointInfo(serviceInfo, "");
    ei.setName(new QName("bla", "Port"));

    Destination d1 = transportFactory.getDestination(ei, bus);
    URL url = new URL(d1.getAddress().getAddress().getValue());
    assertTrue("No random port has been allocated",
               url.getPort() > 0);

}
 
Example 5
Source File: UndertowHTTPDestinationTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Test
public void testRandomPortAllocation() throws Exception {
    bus = BusFactory.getDefaultBus(true);
    transportFactory = new HTTPTransportFactory();
    ServiceInfo serviceInfo = new ServiceInfo();
    serviceInfo.setName(new QName("bla", "Service"));
    EndpointInfo ei = new EndpointInfo(serviceInfo, "");
    ei.setName(new QName("bla", "Port"));

    Destination d1 = transportFactory.getDestination(ei, bus);
    URL url = new URL(d1.getAddress().getAddress().getValue());
    assertTrue("No random port has been allocated",
               url.getPort() > 0);

}
 
Example 6
Source File: NettyHttpDestinationTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Test
public void testRandomPortAllocation() throws Exception {
    bus = BusFactory.getDefaultBus();
    transportFactory = new HTTPTransportFactory();
    ServiceInfo serviceInfo = new ServiceInfo();
    serviceInfo.setName(new QName("bla", "Service"));
    EndpointInfo ei = new EndpointInfo(serviceInfo, "");
    ei.setName(new QName("bla", "Port"));

    Destination d1 = transportFactory.getDestination(ei, bus);
    URL url = new URL(d1.getAddress().getAddress().getValue());
    assertTrue("No random port has been allocated",
               url.getPort() > 0);

}