org.apache.cxf.ws.addressing.EndpointReferenceType Java Examples

The following examples show how to use org.apache.cxf.ws.addressing.EndpointReferenceType. 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: NettyHttpConduitFactory.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Override
public HTTPConduit createConduit(HTTPTransportFactory f,
                                 Bus bus,
                                 EndpointInfo localInfo,
                                 EndpointReferenceType target)
    throws IOException {
    // need to check if the EventLoopGroup is created or not
    // if not create a new EventLoopGroup for it
    EventLoopGroup eventLoopGroup = bus.getExtension(EventLoopGroup.class);
    if (eventLoopGroup == null) {
        final EventLoopGroup group = new NioEventLoopGroup();
        // register a BusLifeCycleListener for it
        bus.setExtension(group, EventLoopGroup.class);
        registerBusLifeListener(bus, group);
    }
    return new NettyHttpConduit(bus, localInfo, target, this);
}
 
Example #2
Source File: JaxWsEndpointImpl.java    From cxf with Apache License 2.0 6 votes vote down vote up
private void extractWsdlEprs(EndpointInfo endpoint) {
    //parse the EPR in wsdl
    List<ExtensibilityElement> portExtensors = endpoint.getExtensors(ExtensibilityElement.class);
    if (portExtensors != null) {
        Iterator<ExtensibilityElement> extensionElements = portExtensors.iterator();
        QName wsaEpr = new QName(Names.WSA_NAMESPACE_NAME, "EndpointReference");
        while (extensionElements.hasNext()) {
            ExtensibilityElement ext = extensionElements.next();
            if (ext instanceof UnknownExtensibilityElement && wsaEpr.equals(ext.getElementType())) {
                DOMSource domSource = new DOMSource(((UnknownExtensibilityElement)ext).getElement());
                W3CEndpointReference w3cEPR = new W3CEndpointReference(domSource);
                EndpointReferenceType ref = ProviderImpl.convertToInternal(w3cEPR);
                endpoint.getTarget().setMetadata(ref.getMetadata());
                endpoint.getTarget().setReferenceParameters(ref.getReferenceParameters());
                endpoint.getTarget().getOtherAttributes().putAll(ref.getOtherAttributes());
            }

        }
    }
}
 
Example #3
Source File: STSClientTest.java    From steady with Apache License 2.0 6 votes vote down vote up
@Test
public void testConfigureViaEPR() throws Exception {

    final Set<Class<?>> addressingClasses = new HashSet<Class<?>>();
    addressingClasses.add(org.apache.cxf.ws.addressing.wsdl.ObjectFactory.class);
    addressingClasses.add(org.apache.cxf.ws.addressing.ObjectFactory.class);

    JAXBContext ctx = JAXBContextCache.getCachedContextAndSchemas(addressingClasses, null, null, null,
                                                                  true).getContext();
    Unmarshaller um = ctx.createUnmarshaller();
    InputStream inStream = getClass().getResourceAsStream("epr.xml");
    JAXBElement<?> el = (JAXBElement<?>)um.unmarshal(inStream);
    EndpointReferenceType ref = (EndpointReferenceType)el.getValue();

    Bus bus = BusFactory.getThreadDefaultBus();
    STSClient client = new STSClient(bus);
    client.configureViaEPR(ref, false);

    assertEquals("http://localhost:8080/jaxws-samples-wsse-policy-trust-sts/SecurityTokenService?wsdl",
                 client.getWsdlLocation());
    assertEquals(new QName("http://docs.oasis-open.org/ws-sx/ws-trust/200512/", "SecurityTokenService"),
                 client.getServiceQName());
    assertEquals(new QName("http://docs.oasis-open.org/ws-sx/ws-trust/200512/", "UT_Port"),
                 client.getEndpointQName());
}
 
Example #4
Source File: JettyHTTPDestinationTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Test
public void testMultiplexGetIdForAddress() throws Exception {
    destination = setUpDestination();
    destination.setMultiplexWithAddress(true);

    final String id = "ID3";
    EndpointReferenceType refWithId = destination.getAddressWithId(id);
    String pathInfo = EndpointReferenceUtils.getAddress(refWithId);

    Map<String, Object> context = new HashMap<>();
    assertNull("fails with no context", destination.getId(context));

    context.put(Message.PATH_INFO, pathInfo);
    String result = destination.getId(context);
    assertNotNull(result);
    assertEquals("match our id", result, id);
}
 
Example #5
Source File: WSDiscoveryServiceImpl.java    From cxf with Apache License 2.0 6 votes vote down vote up
private ResolveMatchesType handleResolve(ResolveType resolve) {
    ResolveMatchType rmt = new ResolveMatchType();
    EndpointReference ref = resolve.getEndpointReference();
    EndpointReferenceType iref = ProviderImpl.convertToInternal(ref);
    for (HelloType hello : registered) {
        W3CEndpointReference r = hello.getEndpointReference();
        if (matches(iref, r)) {
            rmt.setEndpointReference(r);
            rmt.setScopes(hello.getScopes());
            rmt.getTypes().addAll(hello.getTypes());
            rmt.getXAddrs().addAll(hello.getXAddrs());
            rmt.getOtherAttributes().putAll(hello.getOtherAttributes());
            rmt.setMetadataVersion(hello.getMetadataVersion());
            ResolveMatchesType rmts = new ResolveMatchesType();
            rmts.setResolveMatch(rmt);
            return rmts;
        }
    }
    return null;
}
 
Example #6
Source File: RMEndpointTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Test
public void testInitialise() throws NoSuchMethodException {
    Message m = new MessageImpl();
    Method m1 = RMEndpoint.class.getDeclaredMethod("createServices", new Class[] {});
    Method m2 = RMEndpoint.class
        .getDeclaredMethod("createEndpoints", new Class[] {org.apache.cxf.transport.Destination.class});
    Method m3 = RMEndpoint.class.getDeclaredMethod("setPolicies", new Class[] {Message.class});

    rme = EasyMock.createMockBuilder(RMEndpoint.class)
        .addMockedMethods(m1, m2, m3).createMock(control);
    rme.createServices();
    EasyMock.expectLastCall();
    rme.createEndpoints(null);
    EasyMock.expectLastCall();
    rme.setPolicies(m);
    EasyMock.expectLastCall();
    Conduit c = control.createMock(Conduit.class);
    EndpointReferenceType epr = control.createMock(EndpointReferenceType.class);
    control.replay();
    rme.initialise(new RMConfiguration(), c, epr, null, m);
    assertSame(c, rme.getConduit());
    assertSame(epr, rme.getReplyTo());
}
 
Example #7
Source File: STSClientTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Test
public void testConfigureViaEPR() throws Exception {

    final Set<Class<?>> addressingClasses = new HashSet<>();
    addressingClasses.add(org.apache.cxf.ws.addressing.wsdl.ObjectFactory.class);
    addressingClasses.add(org.apache.cxf.ws.addressing.ObjectFactory.class);

    JAXBContext ctx = JAXBContextCache.getCachedContextAndSchemas(addressingClasses, null, null, null,
                                                                  true).getContext();
    Unmarshaller um = ctx.createUnmarshaller();
    InputStream inStream = getClass().getResourceAsStream("epr.xml");
    JAXBElement<?> el = (JAXBElement<?>)um.unmarshal(inStream);
    EndpointReferenceType ref = (EndpointReferenceType)el.getValue();

    Bus bus = BusFactory.getThreadDefaultBus();
    STSClient client = new STSClient(bus);
    client.configureViaEPR(ref, false);

    assertEquals("http://localhost:8080/jaxws-samples-wsse-policy-trust-sts/SecurityTokenService?wsdl",
                 client.getWsdlLocation());
    assertEquals(new QName("http://docs.oasis-open.org/ws-sx/ws-trust/200512/", "SecurityTokenService"),
                 client.getServiceQName());
    assertEquals(new QName("http://docs.oasis-open.org/ws-sx/ws-trust/200512/", "UT_Port"),
                 client.getEndpointQName());
}
 
Example #8
Source File: URIConfiguredConduitTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
public void sendAndReceive(SyncType syncType, String address) throws Exception {
    // Register bean locator for cf lookup
    TestReceiver receiver = new TestReceiver(cf, SERVICE_QUEUE, false);
    receiver.runAsync();

    EndpointInfo ei = new EndpointInfo();
    ei.setAddress(address);
    Bus bus = BusFactory.getDefaultBus();
    JMSConfiguration jmsConfig = JMSConfigFactory.createFromEndpointInfo(bus, ei, null);
    jmsConfig.setConnectionFactory(cf);
    JMSConduit conduit = new JMSConduit(new EndpointReferenceType(), jmsConfig, bus);

    Exchange exchange = new ExchangeImpl();
    exchange.setSynchronous(syncType == SyncType.sync);
    Message message = new MessageImpl();
    exchange.setOutMessage(message);
    conduit.sendExchange(exchange, "Request");

    waitForAsyncReply(exchange);
    receiver.close();
    assertNotNull("No reply received within 2 seconds", exchange.getInMessage());
    JMSMessageHeadersType inHeaders = (JMSMessageHeadersType)exchange.getInMessage()
        .get(JMSConstants.JMS_CLIENT_RESPONSE_HEADERS);
    assertEquals(receiver.getRequestMessageId(), inHeaders.getJMSCorrelationID());
    conduit.close();
}
 
Example #9
Source File: CorbaServerConduitTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Test
public void testGetTargetReference() throws Exception {
    setupServiceInfo("http://cxf.apache.org/bindings/corba/simple",
                     "/wsdl_corbabinding/simpleIdl.wsdl", "SimpleCORBAService",
                     "SimpleCORBAPort");

    CorbaDestination destination = new CorbaDestination(endpointInfo, orbConfig);
    CorbaServerConduit conduit = new CorbaServerConduit(endpointInfo,
                                                        destination.getAddress(),
                                                        targetObject,
                                                        null,
                                                        orbConfig,
                                                        corbaTypeMap);

    EndpointReferenceType t = null;
    EndpointReferenceType ref = conduit.getTargetReference(t);
    assertNotNull("ref should not be null", ref);
    destination.shutdown();
}
 
Example #10
Source File: MAPAggregatorImpl.java    From cxf with Apache License 2.0 6 votes vote down vote up
private void checkAddressingResponses(EndpointReferenceType replyTo, EndpointReferenceType faultTo) {
    if (this.addressingResponses == WSAddressingFeature.AddressingResponses.ALL) {
        return;
    }
    boolean passed = false;
    boolean anonReply = ContextUtils.isGenericAddress(replyTo);
    boolean anonFault = ContextUtils.isGenericAddress(faultTo);
    boolean isAnonymous = anonReply && anonFault;
    if (WSAddressingFeature.AddressingResponses.ANONYMOUS == addressingResponses
        && isAnonymous) {
        passed = true;
    } else if (WSAddressingFeature.AddressingResponses.NON_ANONYMOUS == addressingResponses
               && (!anonReply && (!anonFault && faultTo.getAddress() != null)
                   || !anonReply && faultTo == null)) {
        passed = true;
    }
    if (!passed) {
        String reason = BUNDLE.getString("INVALID_ADDRESSING_PROPERTY_MESSAGE");
        QName detail = WSAddressingFeature.AddressingResponses.ANONYMOUS == addressingResponses
            ? Names.ONLY_ANONYMOUS_ADDRESS_SUPPORTED_QNAME
            : Names.ONLY_NONANONYMOUS_ADDRESS_SUPPORTED_QNAME;
        throw new SoapFault(reason, detail);
    }
}
 
Example #11
Source File: AbstractMultiplexDestination.java    From cxf with Apache License 2.0 6 votes vote down vote up
/**
 * Builds an new endpoint reference using the current target reference as a template.
 * The supplied id is endcoded using a reference parameter.
 * This requires the ws-a interceptors to propagate the reference parameters
 * on subsequent invokes using the returned reference.
 * @param id the id to encode in the new reference
 * @return the new reference with the id encoded as a reference parameter
 * @see org.apache.cxf.transport.MultiplexDestination#getAddressWithId(java.lang.String)

 */
public EndpointReferenceType getAddressWithId(String id) {
    EndpointReferenceType epr = EndpointReferenceUtils.duplicate(
        EndpointReferenceUtils.mint(reference, bus));
    ReferenceParametersType newParams = new org.apache.cxf.ws.addressing.ObjectFactory()
        .createReferenceParametersType();

    ReferenceParametersType existingParams = epr.getReferenceParameters();
    if (null != existingParams) {
        newParams.getAny().addAll(existingParams.getAny());
    }

    newParams.getAny().add(new JAXBElement<String>(MULTIPLEX_ID_QNAME, String.class, id));
    epr.setReferenceParameters(newParams);
    return epr;
}
 
Example #12
Source File: MAPTestBase.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
    //super.setUp();

    if (staticBus == null) {
        SpringBusFactory bf = new SpringBusFactory();
        staticBus = bf.createBus(getConfigFileName());
        BusFactory.setDefaultBus(staticBus);
    }

    messageIDs.clear();
    mapVerifier = new MAPVerifier();
    headerVerifier = new HeaderVerifier();
    Interceptor<?>[] interceptors = {mapVerifier, headerVerifier};
    addInterceptors(staticBus.getInInterceptors(), interceptors);
    addInterceptors(staticBus.getOutInterceptors(), interceptors);
    addInterceptors(staticBus.getOutFaultInterceptors(), interceptors);
    addInterceptors(staticBus.getInFaultInterceptors(), interceptors);

    EndpointReferenceType target =
        EndpointReferenceUtils.getEndpointReference(getAddress());
    ReferenceParametersType params =
        ContextUtils.WSA_OBJECT_FACTORY.createReferenceParametersType();
    JAXBElement<String> param =
         new JAXBElement<>(CUSTOMER_NAME, String.class, CUSTOMER_KEY);
    params.getAny().add(param);
    target.setReferenceParameters(params);
    greeter = createGreeter(target);
    mapVerifier.verificationCache = this;
    headerVerifier.verificationCache = this;
}
 
Example #13
Source File: MAPTestBase.java    From cxf with Apache License 2.0 5 votes vote down vote up
public Greeter createGreeter(EndpointReferenceType target) throws Exception {
    ServiceImpl serviceImpl =
        ServiceDelegateAccessor.get(new SOAPService(getWSDLURL(), SERVICE_NAME));
    Greeter g = serviceImpl.getPort(target, Greeter.class);
    updateAddressPort(g, getPort());
    return g;
}
 
Example #14
Source File: JMSConduit.java    From cxf with Apache License 2.0 5 votes vote down vote up
public JMSConduit(EndpointReferenceType target,
                  JMSConfiguration jmsConfig,
                  Bus b) {
    super(target);
    bus = b;
    this.jmsConfig = jmsConfig;
    conduitId = UUID.randomUUID().toString().replaceAll("-", "");
}
 
Example #15
Source File: UDPTransportFactory.java    From cxf with Apache License 2.0 5 votes vote down vote up
static EndpointReferenceType createReference(EndpointInfo ei) {
    EndpointReferenceType epr = new EndpointReferenceType();
    AttributedURIType address = new AttributedURIType();
    address.setValue(ei.getAddress());
    epr.setAddress(address);
    return epr;
}
 
Example #16
Source File: ManagedRMManagerTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
private DestinationSequence createTestDestinationSequence(Destination destination, String sid,
                                                          EndpointReferenceType to,
                                                          ProtocolVariation protocol, long[] acked) {
    Identifier identifier = RMUtils.getWSRMFactory().createIdentifier();
    identifier.setValue(sid);
    DestinationSequence ds = new DestinationSequence(identifier, to, null, protocol);
    ds.setDestination(destination);

    List<SequenceAcknowledgement.AcknowledgementRange> ranges =
        ds.getAcknowledgment().getAcknowledgementRange();
    for (int i = 0; i < acked.length; i += 2) {
        ranges.add(createAcknowledgementRange(acked[i], acked[i + 1]));
    }
    return ds;
}
 
Example #17
Source File: TokenProviderUtils.java    From cxf with Apache License 2.0 5 votes vote down vote up
/**
 * Extract an address from a Participants EPR DOM element
 */
public static String extractAddressFromParticipantsEPR(Object participants) {
    if (participants instanceof Element) {
        String localName = ((Element)participants).getLocalName();
        String namespace = ((Element)participants).getNamespaceURI();

        if (STSConstants.WSA_NS_05.equals(namespace) && "EndpointReference".equals(localName)) {
            LOG.fine("Found EndpointReference element");
            Element address =
                DOMUtils.getFirstChildWithName((Element)participants,
                        STSConstants.WSA_NS_05, "Address");
            if (address != null) {
                LOG.fine("Found address element");
                return address.getTextContent();
            }
        } else if ((STSConstants.WSP_NS.equals(namespace) || STSConstants.WSP_NS_04.equals(namespace)
            || STSConstants.WSP_NS_06.equals(namespace))
            && "URI".equals(localName)) {
            return ((Element)participants).getTextContent();
        }
        LOG.fine("Participants element does not exist or could not be parsed");
        return null;
    } else if (participants instanceof JAXBElement<?>) {
        JAXBElement<?> jaxbElement = (JAXBElement<?>) participants;
        QName participantsName = jaxbElement.getName();
        if (STSConstants.WSA_NS_05.equals(participantsName.getNamespaceURI())
            && "EndpointReference".equals(participantsName.getLocalPart())) {
            LOG.fine("Found EndpointReference element");
            EndpointReferenceType endpointReference = (EndpointReferenceType)jaxbElement.getValue();
            if (endpointReference.getAddress() != null) {
                LOG.fine("Found address element");
                return endpointReference.getAddress().getValue();
            }
        }
        LOG.fine("Participants element does not exist or could not be parsed");
    }

    return null;
}
 
Example #18
Source File: HttpNumberFactoryImpl.java    From cxf with Apache License 2.0 5 votes vote down vote up
public W3CEndpointReference create(String id) {
    String portName = null;
    EndpointReferenceType epr = EndpointReferenceUtils.getEndpointReferenceWithId(NUMBER_SERVICE_QNAME,
                                                             portName,
                                                             id,
                                                             bus);

    Source source = EndpointReferenceUtils.convertToXML(epr);
    return new W3CEndpointReference(source);

}
 
Example #19
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 #20
Source File: NettyHttpConduit.java    From cxf with Apache License 2.0 5 votes vote down vote up
public NettyHttpConduit(Bus b, EndpointInfo ei, EndpointReferenceType t, NettyHttpConduitFactory conduitFactory)
    throws IOException {
    super(b, ei, t);
    factory = conduitFactory;
    bootstrap = new Bootstrap();
    EventLoopGroup eventLoopGroup = bus.getExtension(EventLoopGroup.class);
    bootstrap.group(eventLoopGroup);
    bootstrap.channel(NioSocketChannel.class);
}
 
Example #21
Source File: Proxy.java    From cxf with Apache License 2.0 5 votes vote down vote up
void ackRequested(SourceSequence s) throws RMException {
    final ProtocolVariation protocol = s.getProtocol();
    EndpointReferenceType target = s.getTarget();
    AttributedURIType uri = null;
    if (null != target) {
        uri = target.getAddress();
    }
    String addr = null;
    if (null != uri) {
        addr = uri.getValue();
    }

    if (addr == null) {
        LOG.log(Level.WARNING, "STANDALONE_ACK_REQUESTED_NO_TARGET_MSG");
        return;
    }

    if (RMUtils.getAddressingConstants().getAnonymousURI().equals(addr)) {
        LOG.log(Level.WARNING, "STANDALONE_ACK_REQUESTED_ANON_TARGET_MSG");
        return;
    }

    RMConstants constants = protocol.getConstants();
    OperationInfo oi = reliableEndpoint.getEndpoint(protocol).getEndpointInfo().getService()
        .getInterface().getOperation(constants.getAckRequestedOperationName());
    invoke(oi, protocol, new Object[] {});
}
 
Example #22
Source File: STSUtils.java    From cxf with Apache License 2.0 5 votes vote down vote up
public static String findMEXLocation(EndpointReferenceType ref) {
    if (ref.getMetadata() != null && ref.getMetadata().getAny() != null) {
        for (Object any : ref.getMetadata().getAny()) {
            if (any instanceof Element) {
                String addr = findMEXLocation((Element)any);
                if (addr != null) {
                    return addr;
                }
            }
        }
    }
    return null;
}
 
Example #23
Source File: CorbaStreamInInterceptor.java    From cxf with Apache License 2.0 5 votes vote down vote up
protected NVList prepareArguments(CorbaMessage corbaMsg,
                                  InterfaceInfo info,
                                  OperationType opType,
                                  QName opQName,
                                  CorbaTypeMap typeMap,
                                  CorbaDestination destination,
                                  ServiceInfo service) {
    BindingInfo bInfo = destination.getBindingInfo();
    EndpointInfo eptInfo = destination.getEndPointInfo();
    BindingOperationInfo bOpInfo = bInfo.getOperation(opQName);
    OperationInfo opInfo = bOpInfo.getOperationInfo();
    Exchange exg = corbaMsg.getExchange();
    exg.put(BindingInfo.class, bInfo);
    exg.put(InterfaceInfo.class, info);
    exg.put(EndpointInfo.class, eptInfo);
    exg.put(EndpointReferenceType.class, destination.getAddress());
    exg.put(ServiceInfo.class, service);
    exg.put(BindingOperationInfo.class, bOpInfo);
    exg.put(OperationInfo.class, opInfo);
    exg.put(MessageInfo.class, opInfo.getInput());
    exg.put(String.class, opQName.getLocalPart());
    exg.setInMessage(corbaMsg);

    corbaMsg.put(MessageInfo.class, opInfo.getInput());

    List<ParamType> paramTypes = opType.getParam();
    CorbaStreamable[] arguments = new CorbaStreamable[paramTypes.size()];
    return prepareDIIArgsList(corbaMsg, bOpInfo,
                              arguments, paramTypes,
                              typeMap,
                              exg.get(ORB.class), service);
}
 
Example #24
Source File: AsyncHTTPConduitFactory.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Override
public HTTPConduit createConduit(HTTPTransportFactory f,
                                 Bus bus,
                                 EndpointInfo localInfo,
                                 EndpointReferenceType target) throws IOException {

    return createConduit(bus, localInfo, target);
}
 
Example #25
Source File: NettyHttpDestinationTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Test
public void testMultiplexGetAddressWithId() throws Exception {
    destination = setUpDestination();
    final String id = "ID2";
    EndpointReferenceType refWithId = destination.getAddressWithId(id);
    assertNotNull(refWithId);
    assertNotNull(refWithId.getReferenceParameters());
    assertNotNull(refWithId.getReferenceParameters().getAny());
    assertTrue("it is an element",
               refWithId.getReferenceParameters().getAny().get(0) instanceof JAXBElement);
    JAXBElement<?> el = (JAXBElement<?>) refWithId.getReferenceParameters().getAny().get(0);
    assertEquals("match our id", el.getValue(), id);
}
 
Example #26
Source File: ManagedRMManagerTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
private List<DestinationSequence> createTestDestinationSequences(Destination destination,
                                                                 EndpointReferenceType to) {
    List<DestinationSequence> dss = new ArrayList<>();
    dss.add(createTestDestinationSequence(destination, "seq3", to,
                                          ProtocolVariation.RM10WSA200408, new long[]{1L, 1L, 3L, 3L}));
    dss.add(createTestDestinationSequence(destination, "seq4", to,
                                          ProtocolVariation.RM11WSA200508, new long[]{1L, 1L, 3L, 3L}));

    return dss;
}
 
Example #27
Source File: EndpointResolverRegistryImplTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Test
public void testRenew() {
    registry.register(resolver1);
    registry.register(resolver2);
    resolver1.renew(logical, physical);
    EasyMock.expectLastCall().andReturn(fresh);
    control.replay();

    EndpointReferenceType renewed = registry.renew(logical, physical);

    control.verify();
    assertSame("unexpected physical EPR", fresh, renewed);

    control.reset();
    resolver1.renew(logical, physical);
    EasyMock.expectLastCall().andReturn(null);
    resolver2.renew(logical, physical);
    EasyMock.expectLastCall().andReturn(physical);
    control.replay();

    renewed = registry.renew(logical, physical);

    control.verify();
    assertSame("unexpected physical EPR", physical, renewed);

    control.reset();
    resolver1.renew(logical, physical);
    EasyMock.expectLastCall().andReturn(null);
    resolver2.renew(logical, physical);
    EasyMock.expectLastCall().andReturn(null);
    control.replay();

    renewed = registry.renew(logical, physical);

    control.verify();
    assertNull("unexpected physical EPR", renewed);
}
 
Example #28
Source File: DestinationSequenceTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() {
    control = EasyMock.createNiceControl();
    control.makeThreadSafe(true);
    factory = new ObjectFactory();
    ref = control.createMock(EndpointReferenceType.class);
    id = factory.createIdentifier();
    id.setValue("seq");
}
 
Example #29
Source File: WSAEndpointReferenceUtils.java    From cxf with Apache License 2.0 5 votes vote down vote up
/**
 * Create an endpoint reference for the provided address.
 * @param address - address URI
 * @return EndpointReferenceType - the endpoint reference
 */
public static EndpointReferenceType getEndpointReference(String address) {

    EndpointReferenceType reference = WSA_OBJECT_FACTORY.createEndpointReferenceType();
    setAddress(reference, address);
    return reference;
}
 
Example #30
Source File: AbstractSTSClient.java    From steady with Apache License 2.0 5 votes vote down vote up
protected String findMEXLocation(EndpointReferenceType ref, boolean useEPRWSAAddrAsMEXLocation) {
    if (ref.getMetadata() != null && ref.getMetadata().getAny() != null) {
        for (Object any : ref.getMetadata().getAny()) {
            if (any instanceof Element) {
                String addr = findMEXLocation((Element)any);
                if (addr != null) {
                    return addr;
                }
            }
        }
    }
    return useEPRWSAAddrAsMEXLocation ? EndpointReferenceUtils.getAddress(ref) : null;
}