org.apache.cxf.transport.Destination Java Examples

The following examples show how to use org.apache.cxf.transport.Destination. 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: 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 #2
Source File: MAPAggregatorTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
private void setUpRebase(Message message, Exchange exchange, Endpoint endpoint)
    throws Exception {
    setUpMessageProperty(message,
                         "org.apache.cxf.ws.addressing.partial.response.sent",
                         Boolean.FALSE);
    Binding binding = control.createMock(Binding.class);
    endpoint.getBinding();
    EasyMock.expectLastCall().andReturn(binding).anyTimes();
    Message partialResponse = getMessage();
    binding.createMessage(EasyMock.isA(Message.class));
    EasyMock.expectLastCall().andReturn(partialResponse);

    Destination target = control.createMock(Destination.class);
    setUpMessageDestination(message, target);
    Conduit backChannel = control.createMock(Conduit.class);
    target.getBackChannel(EasyMock.eq(message));
    EasyMock.expectLastCall().andReturn(backChannel);
    // REVISIT test interceptor chain setup & send
}
 
Example #3
Source File: PolicyEngineTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Test
public void testEndpointPolicyWithEqualPolicies() throws Exception {
    engine = new PolicyEngineImpl();
    EndpointInfo ei = createMockEndpointInfo();
    ServiceInfo si = control.createMock(ServiceInfo.class);
    ei.setService(si);
    si.getExtensor(Policy.class);
    EasyMock.expectLastCall().andReturn(null).times(2);
    EndpointPolicyImpl epi = control.createMock(EndpointPolicyImpl.class);
    control.replay();
    engine.setServerEndpointPolicy(ei, epi);
    engine.setClientEndpointPolicy(ei, epi);

    assertSame(epi, engine.getClientEndpointPolicy(ei, (Conduit)null, msg));
    assertSame(epi, engine.getServerEndpointPolicy(ei, (Destination)null, msg));

    control.reset();
    ei.setService(si);
    Policy p = new Policy();
    si.getExtensor(Policy.class);
    EasyMock.expectLastCall().andReturn(p).times(2);
    epi.getPolicy();
    EasyMock.expectLastCall().andReturn(p).times(2);
    control.replay();
    assertSame(epi, engine.getServerEndpointPolicy(ei, (Destination)null, msg));
}
 
Example #4
Source File: WebSocketTransportFactory.java    From cxf with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
public Destination getDestination(EndpointInfo endpointInfo, Bus bus) throws IOException {
    if (endpointInfo == null) {
        throw new IllegalArgumentException("EndpointInfo cannot be null");
    }
    synchronized (registry) {
        AbstractHTTPDestination d = registry.getDestinationForPath(endpointInfo.getAddress());
        if (d == null) {
            d = factory.createDestination(endpointInfo, bus, registry);
            if (d == null) {
                String error = "No destination available. The CXF websocket transport needs either the "
                    + "Jetty WebSocket or Atmosphere dependencies to be available";
                throw new IOException(error);
            }
            registry.addDestination(d);
            configure(bus, d);
            d.finalizeConfig();
        }
        return d;
    }
}
 
Example #5
Source File: MAPAggregatorImpl.java    From cxf with Apache License 2.0 6 votes vote down vote up
/**
 * @param address the address
 * @return a Destination for the address
 */
private Destination getDestination(Bus bus, String address, Message message) throws IOException {
    Destination destination = null;
    DestinationFactoryManager factoryManager =
        bus.getExtension(DestinationFactoryManager.class);
    DestinationFactory factory =
        factoryManager.getDestinationFactoryForUri(address);
    if (factory != null) {
        Endpoint ep = message.getExchange().getEndpoint();

        EndpointInfo ei = new EndpointInfo();
        ei.setName(new QName(ep.getEndpointInfo().getName().getNamespaceURI(),
                             ep.getEndpointInfo().getName().getLocalPart() + ".decoupled"));
        ei.setAddress(address);
        destination = factory.getDestination(ei, bus);
        Conduit conduit = ContextUtils.getConduit(null, message);
        if (conduit != null) {
            MessageObserver ob = conduit.getMessageObserver();
            ob = new InterposedMessageObserver(bus, ob);
            destination.setMessageObserver(ob);
        }
    }
    return destination;
}
 
Example #6
Source File: HolderTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Test
public void testClient() throws Exception {
    EndpointInfo ei = new EndpointInfo(null, "http://schemas.xmlsoap.org/soap/http");
    ei.setAddress(ADDRESS);

    Destination d = localTransport.getDestination(ei, bus);
    d.setMessageObserver(new MessageReplayObserver("/org/apache/cxf/jaxws/holder/echoResponse.xml"));

    JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
    factory.getClientFactoryBean().setServiceClass(HolderService.class);
    factory.getClientFactoryBean().setBus(getBus());
    factory.getClientFactoryBean().setAddress(ADDRESS);

    HolderService h = (HolderService)factory.create();
    Holder<String> holder = new Holder<>();
    assertEquals("one", h.echo("one", "two", holder));
    assertEquals("two", holder.value);
}
 
Example #7
Source File: MAPAggregatorImpl.java    From cxf with Apache License 2.0 6 votes vote down vote up
/**
 * Set up the decoupled Destination if necessary.
 */
private Destination setUpDecoupledDestination(Bus bus, String replyToAddress, Message message) {
    EndpointReferenceType reference =
        EndpointReferenceUtils.getEndpointReference(replyToAddress);
    if (reference != null) {
        String decoupledAddress = reference.getAddress().getValue();
        LOG.info("creating decoupled endpoint: " + decoupledAddress);
        try {
            Destination dest = getDestination(bus, replyToAddress, message);
            bus.getExtension(ClientLifeCycleManager.class).registerListener(DECOUPLED_DEST_CLEANER);
            return dest;
        } catch (Exception e) {
            // REVISIT move message to localizable Messages.properties
            LOG.log(Level.WARNING,
                    "decoupled endpoint creation failed: ", e);
        }
    }
    return null;
}
 
Example #8
Source File: EndpointReferenceUtils.java    From cxf with Apache License 2.0 6 votes vote down vote up
private static MultiplexDestination getMatchingMultiplexDestination(QName serviceQName, String portName,
                                                                    Bus bus) {
    MultiplexDestination destination = null;
    ServerRegistry serverRegistry = bus.getExtension(ServerRegistry.class);
    if (null != serverRegistry) {
        List<Server> servers = serverRegistry.getServers();
        for (Server s : servers) {
            QName targetServiceQName = s.getEndpoint().getEndpointInfo().getService().getName();
            if (serviceQName.equals(targetServiceQName) && portNameMatches(s, portName)) {
                Destination dest = s.getDestination();
                if (dest instanceof MultiplexDestination) {
                    destination = (MultiplexDestination)dest;
                    break;
                }
            }
        }
    } else {
        LOG.log(Level.WARNING,
                "Failed to locate service matching " + serviceQName
                + ", because the bus ServerRegistry extension provider is null");
    }
    return destination;
}
 
Example #9
Source File: HttpUtils.java    From cxf with Apache License 2.0 6 votes vote down vote up
public static String getEndpointAddress(Message m) {
    String address = null;
    Destination d = m.getExchange().getDestination();
    if (d != null) {
        if (d instanceof AbstractHTTPDestination) {
            EndpointInfo ei = ((AbstractHTTPDestination)d).getEndpointInfo();
            HttpServletRequest request = (HttpServletRequest)m.get(AbstractHTTPDestination.HTTP_REQUEST);
            Object property = request != null
                ? request.getAttribute("org.apache.cxf.transport.endpoint.address") : null;
            address = property != null ? property.toString() : ei.getAddress();
        } else {
            address = m.containsKey(Message.BASE_PATH)
                ? (String)m.get(Message.BASE_PATH) : d.getAddress().getAddress().getValue();
        }
    } else {
        address = (String)m.get(Message.ENDPOINT_ADDRESS);
    }
    if (address.startsWith("http") && address.endsWith("//")) {
        address = address.substring(0, address.length() - 1);
    }
    return address;
}
 
Example #10
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 #11
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 #12
Source File: EffectivePolicyImplTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Test
public void testInitialiseServerFaultPolicy() {
    Message m = new MessageImpl();
    EndpointInfo ei = control.createMock(EndpointInfo.class);
    BindingFaultInfo bfi = control.createMock(BindingFaultInfo.class);
    PolicyEngineImpl engine = control.createMock(PolicyEngineImpl.class);

    BindingOperationInfo boi = control.createMock(BindingOperationInfo.class);
    EasyMock.expect(bfi.getBindingOperation()).andReturn(boi).anyTimes();
    EndpointPolicy endpointPolicy = control.createMock(EndpointPolicy.class);
    EasyMock.expect(engine.getServerEndpointPolicy(ei, (Destination)null, m)).andReturn(endpointPolicy);
    Policy ep = control.createMock(Policy.class);
    EasyMock.expect(endpointPolicy.getPolicy()).andReturn(ep);
    Policy op = control.createMock(Policy.class);
    EasyMock.expect(engine.getAggregatedOperationPolicy(boi, m)).andReturn(op);
    Policy merged = control.createMock(Policy.class);
    EasyMock.expect(ep.merge(op)).andReturn(merged);
    Policy fp = control.createMock(Policy.class);
    EasyMock.expect(engine.getAggregatedFaultPolicy(bfi, m)).andReturn(fp);
    EasyMock.expect(merged.merge(fp)).andReturn(merged);
    EasyMock.expect(merged.normalize(null, true)).andReturn(merged);

    control.replay();
    EffectivePolicyImpl epi = new EffectivePolicyImpl();
    epi.initialisePolicy(ei, boi, bfi, engine, m);
    assertSame(merged, epi.getPolicy());
    control.verify();
}
 
Example #13
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);

}
 
Example #14
Source File: EffectivePolicyImplTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
private void doTestInitialisePolicy(boolean requestor) {
    EndpointInfo ei = control.createMock(EndpointInfo.class);
    BindingOperationInfo boi = control.createMock(BindingOperationInfo.class);
    PolicyEngineImpl engine = control.createMock(PolicyEngineImpl.class);
    BindingMessageInfo bmi = control.createMock(BindingMessageInfo.class);
    if (requestor) {
        EasyMock.expect(boi.getInput()).andReturn(bmi);
    } else {
        EasyMock.expect(boi.getOutput()).andReturn(bmi);
    }

    EndpointPolicy effectivePolicy = control.createMock(EndpointPolicy.class);
    if (requestor) {
        EasyMock.expect(engine.getClientEndpointPolicy(ei, (Conduit)null, null)).andReturn(effectivePolicy);
    } else {
        EasyMock.expect(engine.getServerEndpointPolicy(ei, (Destination)null, null)).andReturn(effectivePolicy);
    }
    Policy ep = control.createMock(Policy.class);
    EasyMock.expect(effectivePolicy.getPolicy()).andReturn(ep);
    Policy op = control.createMock(Policy.class);
    EasyMock.expect(engine.getAggregatedOperationPolicy(boi, null)).andReturn(op);
    Policy merged = control.createMock(Policy.class);
    EasyMock.expect(ep.merge(op)).andReturn(merged);
    Policy mp = control.createMock(Policy.class);
    EasyMock.expect(engine.getAggregatedMessagePolicy(bmi, null)).andReturn(mp);
    EasyMock.expect(merged.merge(mp)).andReturn(merged);
    EasyMock.expect(merged.normalize(null, true)).andReturn(merged);

    control.replay();
    EffectivePolicyImpl epi = new EffectivePolicyImpl();
    epi.initialisePolicy(ei, boi, engine, requestor, requestor, null, null);
    assertSame(merged, epi.getPolicy());
    control.verify();
}
 
Example #15
Source File: MtomServerTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
private void unregisterServStatic(String add) throws Exception {
    Bus bus = getStaticBus();
    DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class);
    DestinationFactory df = dfm
        .getDestinationFactory("http://cxf.apache.org/transports/http/configuration");

    EndpointInfo ei = new EndpointInfo();
    ei.setAddress(add);

    Destination d = df.getDestination(ei, bus);
    d.setMessageObserver(null);

}
 
Example #16
Source File: JAXRSBindingFactory.java    From cxf with Apache License 2.0 5 votes vote down vote up
public void addListener(Destination d, Endpoint e) {
    synchronized (d) {
        if (d.getMessageObserver() != null) {
            throw new ServiceConstructionException(new Message("ALREADY_RUNNING", LOG,
                                                               e.getEndpointInfo().getAddress()));
        }
        super.addListener(d, e);
    }
}
 
Example #17
Source File: EndpointReferenceUtils.java    From cxf with Apache License 2.0 5 votes vote down vote up
/**
 * Obtain the id String from the endpoint reference of the current dispatch.
 * @param messageContext the current message context
 * @return the id embedded in the current endpoint reference or null if not found
 */
public static String getEndpointReferenceId(Map<String, Object> messageContext) {
    String id = null;
    Destination destination = (Destination) messageContext.get(Destination.class.getName());
    if (destination instanceof MultiplexDestination) {
        id = ((MultiplexDestination) destination).getId(messageContext);
    }
    return id;
}
 
Example #18
Source File: JAXWSHttpSpiTransportFactoryTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
public void getDestination(String endpointAddress) throws Exception {
    context.setHandler(EasyMock.isA(HttpHandler.class));
    control.replay();

    EndpointInfo endpoint = new EndpointInfo();
    endpoint.setAddress(endpointAddress);

    Destination destination = factory.getDestination(endpoint, bus);
    assertNotNull(destination);
    assertNotNull(destination.getAddress());
    assertNotNull(destination.getAddress().getAddress());
    assertEquals(endpointAddress, destination.getAddress().getAddress().getValue());
    assertEquals(endpointAddress, endpoint.getAddress());
    control.verify();
}
 
Example #19
Source File: JAXWSHttpSpiTransportFactory.java    From cxf with Apache License 2.0 5 votes vote down vote up
public Destination getDestination(EndpointInfo endpointInfo, Bus bus) throws IOException {
    if (destination == null) {
        destination = new JAXWSHttpSpiDestination(bus, new DestinationRegistryImpl(), endpointInfo);
        // set handler into the provided HttpContext, our Destination hook into the server container
        HttpHandlerImpl handler = new HttpHandlerImpl(destination);
        context.setHandler(handler);
    }
    return destination;
}
 
Example #20
Source File: WebSocketTransportFactoryTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetDestination() throws Exception {
    Bus bus = BusFactory.getDefaultBus();
    EndpointInfo ei = new EndpointInfo();
    ei.setAddress("ws://localhost:8888/bar/foo");
    WebSocketTransportFactory factory = bus.getExtension(WebSocketTransportFactory.class);
    assertNotNull(factory);
    Destination dest = factory.getDestination(ei, bus);
    assertNotNull(dest);
}
 
Example #21
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 #22
Source File: PolicyEngineTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Test
public void testSetEffectiveServerResponsePolicy() throws Exception {
    engine = new PolicyEngineImpl();
    EndpointInfo ei = createMockEndpointInfo();
    BindingOperationInfo boi = createMockBindingOperationInfo();
    EffectivePolicy effectivePolicy = control.createMock(EffectivePolicy.class);
    control.replay();
    engine.setEffectiveServerResponsePolicy(ei, boi, effectivePolicy);
    assertSame(effectivePolicy,
               engine.getEffectiveServerResponsePolicy(ei, boi, (Destination)null, null, msg));
    control.verify();
}
 
Example #23
Source File: PolicyEngineTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Test
public void testSetEffectiveServerFaultPolicy() throws Exception {
    engine = new PolicyEngineImpl();
    EndpointInfo ei = createMockEndpointInfo();
    BindingFaultInfo bfi = new BindingFaultInfo(null, null);
    EffectivePolicy epi = control.createMock(EffectivePolicy.class);
    engine.setEffectiveServerFaultPolicy(ei, bfi, epi);
    assertSame(epi, engine.getEffectiveServerFaultPolicy(ei, null, bfi, (Destination)null, msg));
}
 
Example #24
Source File: CorbaBindingFactoryTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetDestination() throws Exception {
    setupServiceInfo("http://cxf.apache.org/bindings/corba/simple",
                     "/wsdl_corbabinding/simpleIdl.wsdl",
                     "SimpleCORBAService",
                     "SimpleCORBAPort");

    Destination destination = factory.getDestination(endpointInfo, bus);
    assertNotNull(destination);
    target = destination.getAddress();
    assertNotNull(target);
}
 
Example #25
Source File: MAPAggregatorImpl.java    From cxf with Apache License 2.0 5 votes vote down vote up
public void clientDestroyed(Client client) {
    Destination dest = client.getEndpoint().getEndpointInfo()
        .getProperty(DECOUPLED_DESTINATION, Destination.class);
    if (dest != null) {
        dest.setMessageObserver(null);
        dest.shutdown();
    }
}
 
Example #26
Source File: MAPAggregatorImpl.java    From cxf with Apache License 2.0 5 votes vote down vote up
private EndpointReferenceType getReplyTo(Message message,
                                         EndpointReferenceType originalReplyTo) {
    Exchange exchange = message.getExchange();
    Endpoint info = exchange.getEndpoint();
    if (info == null) {
        return originalReplyTo;
    }
    synchronized (info) {
        EndpointInfo ei = info.getEndpointInfo();
        Destination dest = ei.getProperty(DECOUPLED_DESTINATION, Destination.class);
        if (dest == null) {
            dest = createDecoupledDestination(message);
            if (dest != null) {
                info.getEndpointInfo().setProperty(DECOUPLED_DESTINATION, dest);
            }
        }
        if (dest != null) {
            // if the decoupled endpoint context prop is set and the address is relative, return the absolute url.
            final String replyTo = dest.getAddress().getAddress().getValue();
            if (replyTo.startsWith("/")) {
                String debase =
                    (String)message.getContextualProperty(WSAContextUtils.DECOUPLED_ENDPOINT_BASE_PROPERTY);
                if (debase != null) {
                    return EndpointReferenceUtils.getEndpointReference(debase + replyTo);
                }
            }
            return dest.getAddress();
        }
    }
    return originalReplyTo;
}
 
Example #27
Source File: MAPAggregatorImpl.java    From cxf with Apache License 2.0 5 votes vote down vote up
private Destination createDecoupledDestination(Message message) {
    String replyToAddress = (String)message.getContextualProperty(WSAContextUtils.REPLYTO_PROPERTY);
    if (replyToAddress != null) {
        return setUpDecoupledDestination(message.getExchange().getBus(),
                                         replyToAddress,
                                         message);
    }
    return null;
}
 
Example #28
Source File: NettyHttpTransportFactory.java    From cxf with Apache License 2.0 5 votes vote down vote up
public Destination getDestination(EndpointInfo endpointInfo, Bus bus) throws IOException {
    if (endpointInfo == null) {
        throw new IllegalArgumentException("EndpointInfo cannot be null");
    }
    synchronized (registry) {
        AbstractHTTPDestination d = registry.getDestinationForPath(endpointInfo.getAddress());
        if (d == null) {
            d = factory.createDestination(endpointInfo, bus, registry);
            registry.addDestination(d);
            configure(bus, d);
            d.finalizeConfig();
        }
        return d;
    }
}
 
Example #29
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 #30
Source File: ConnectionFactoryFeature.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Override
public void initialize(Server server, Bus bus) {
    Destination destination = server.getDestination();
    if (destination instanceof JMSDestination) {
        JMSDestination jmsDestination = (JMSDestination)destination;
        jmsDestination.getJmsConfig().setConnectionFactory(connectionFactory);
    }
}