Package org.apache.tuscany.sca.binding.notification.encoding

Examples of org.apache.tuscany.sca.binding.notification.encoding.NewConsumerResponse


        eaed.start();
       
        XMLInputFactory xif = XMLInputFactory.newInstance();
        XMLStreamReader reader = xif.createXMLStreamReader(new StringReader(testNewConsumerResponse));
        reader.next();
        NewConsumerResponse newConsumerResponse = (NewConsumerResponse)der.decode(reader);
        Assert.assertEquals(newConsumerResponse.getSequenceType(), "EndProducers");
        Assert.assertEquals(newConsumerResponse.getReferenceSequence().iterator().next().getEndpointAddress().getAddress().toString(),
                            testUrl);
       
        XMLOutputFactory xof = XMLOutputFactory.newInstance();
        StringWriter testWriter = new StringWriter();
        XMLStreamWriter writer = xof.createXMLStreamWriter(testWriter);
View Full Code Here


        eaed.start();
       
        XMLInputFactory xif = XMLInputFactory.newInstance();
        XMLStreamReader reader = xif.createXMLStreamReader(new StringReader(testNoProducersResponse));
        reader.next();
        NewConsumerResponse newConsumerResponse = (NewConsumerResponse)der.decode(reader);
        Assert.assertEquals(newConsumerResponse.getSequenceType(), "NoProducers");
       
        XMLOutputFactory xof = XMLOutputFactory.newInstance();
        StringWriter testWriter = new StringWriter();
        XMLStreamWriter writer = xof.createXMLStreamWriter(testWriter);
        der.encode(newConsumerResponse, writer);
View Full Code Here

                URL consumerUrl = nc.getReference().getEndpointAddress().getAddress();
                if (brokerList == null) {
                    addConsumer(consumerUrl);
                }
   
                NewConsumerResponse ncr = new NewConsumerResponse();
                if (producerList != null) {
                    ncr.setSequenceType(Constants.EndProducers);
                    for (URL producerUrl : producerList) {
                        ncr.addReferenceToSequence(EncodingUtils.createEndpointReference(producerUrl, null));
                    }
                } else if(brokerList != null) {
                    ncr.setSequenceType(Constants.BrokerProducers);
                    for (BrokerStruct broker : brokerList) {
                        ncr.addReferenceToSequence(EncodingUtils.createEndpointReference(broker.producerUrl, null));
                    }
                } else {
                    ncr.setSequenceType(Constants.NoProducers);
                }
                try {
                    EncodingUtils.encodeToStream(encodingRegistry, ncr, ostream);
                } catch(IOUtilsException e) {
                    throw new RuntimeException(e);
View Full Code Here

    public String newConsumer(URI notificationType, URL consumerUrl, URL remoteNtmUrl, List<URL> producerListResult) {
        if (ntmUrlIsRemote(consumerUrl, remoteNtmUrl)) {
            try {
                WriteableEPW wEPW = new WriteableEPW(new NewConsumer(), consumerUrl);
                InputStreamDecoder isd = new InputStreamDecoder();
                NewConsumerResponse ncr =
                    (NewConsumerResponse)IOUtils.sendHttpRequest(remoteNtmUrl, Constants.NEW_CONSUMER_OP, wEPW, isd);
                String sequenceType = ncr.getSequenceType();
                if (Constants.EndProducers.equals(sequenceType) || Constants.BrokerProducers.equals(sequenceType)) {
                    for (EndpointReference epr : ncr.getReferenceSequence()) {
                        producerListResult.add(epr.getEndpointAddress().getAddress());
                    }
                }
                return sequenceType;
            } catch(Exception e) {
View Full Code Here

                URL consumerUrl = nc.getReference().getEndpointAddress().getAddress();
                if (brokerList == null) {
                    addConsumer(consumerUrl);
                }
   
                NewConsumerResponse ncr = new NewConsumerResponse();
                if (producerList != null) {
                    ncr.setSequenceType(Constants.EndProducers);
                    for (URL producerUrl : producerList) {
                        ncr.addReferenceToSequence(EncodingUtils.createEndpointReference(producerUrl, null));
                    }
                }
                else if(brokerList != null) {
                    ncr.setSequenceType(Constants.BrokerProducers);
                    for (BrokerStruct broker : brokerList) {
                        ncr.addReferenceToSequence(EncodingUtils.createEndpointReference(broker.producerUrl, null));
                    }
                }
                else {
                    ncr.setSequenceType(Constants.NoProducers);
                }
                try {
                    EncodingUtils.encodeToStream(encodingRegistry, ncr, ostream);
                }
                catch(IOUtilsException e) {
View Full Code Here

    public String newConsumer(URI notificationType, URL consumerUrl, URL remoteNtmUrl, List<URL> producerListResult) {
        if (ntmUrlIsRemote(consumerUrl, remoteNtmUrl)) {
            try {
                WriteableEPW wEPW = new WriteableEPW(new NewConsumer(), consumerUrl);
                InputStreamDecoder isd = new InputStreamDecoder();
                NewConsumerResponse ncr =
                    (NewConsumerResponse)IOUtils.sendHttpRequest(remoteNtmUrl, Constants.NEW_CONSUMER_OP, wEPW, isd);
                String sequenceType = ncr.getSequenceType();
                if (Constants.EndProducers.equals(sequenceType) || Constants.BrokerProducers.equals(sequenceType)) {
                    for (EndpointReference epr : ncr.getReferenceSequence()) {
                        producerListResult.add(epr.getEndpointAddress().getAddress());
                    }
                }
                return sequenceType;
            } catch(Exception e) {
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.binding.notification.encoding.NewConsumerResponse

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.