Search in sources :

Example 1 with ReadableBuffer

use of org.apache.qpid.proton.codec.ReadableBuffer in project azure-iot-sdk-java by Azure.

the class AmqpSendHandlerTest method createProtonObjects.

private void createProtonObjects() {
    String exceptionMessage = "Not expected function called";
    message = Proton.message();
    messageWithException = new Message() {

        @Override
        public boolean isDurable() {
            return false;
        }

        @Override
        public long getDeliveryCount() {
            return 0;
        }

        @Override
        public short getPriority() {
            return 0;
        }

        @Override
        public boolean isFirstAcquirer() {
            return false;
        }

        @Override
        public long getTtl() {
            return 0;
        }

        @Override
        public void setDurable(boolean b) {
        }

        @Override
        public void setTtl(long l) {
        }

        @Override
        public void setDeliveryCount(long l) {
        }

        @Override
        public void setFirstAcquirer(boolean b) {
        }

        @Override
        public void setPriority(short i) {
        }

        @Override
        public Object getMessageId() {
            return null;
        }

        @Override
        public long getGroupSequence() {
            return 0;
        }

        @Override
        public String getReplyToGroupId() {
            return null;
        }

        @Override
        public long getCreationTime() {
            return 0;
        }

        @Override
        public String getAddress() {
            return null;
        }

        @Override
        public byte[] getUserId() {
            return new byte[0];
        }

        @Override
        public String getReplyTo() {
            return null;
        }

        @Override
        public String getGroupId() {
            return null;
        }

        @Override
        public String getContentType() {
            return null;
        }

        @Override
        public long getExpiryTime() {
            return 0;
        }

        @Override
        public Object getCorrelationId() {
            return null;
        }

        @Override
        public String getContentEncoding() {
            return null;
        }

        @Override
        public String getSubject() {
            return null;
        }

        @Override
        public void setGroupSequence(long l) {
        }

        @Override
        public void setUserId(byte[] bytes) {
        }

        @Override
        public void setCreationTime(long l) {
        }

        @Override
        public void setSubject(String s) {
        }

        @Override
        public void setGroupId(String s) {
        }

        @Override
        public void setAddress(String s) {
        }

        @Override
        public void setExpiryTime(long l) {
        }

        @Override
        public void setReplyToGroupId(String s) {
        }

        @Override
        public void setContentEncoding(String s) {
        }

        @Override
        public void setContentType(String s) {
        }

        @Override
        public void setReplyTo(String s) {
        }

        @Override
        public void setCorrelationId(Object o) {
        }

        @Override
        public void setMessageId(Object o) {
        }

        @Override
        public Header getHeader() {
            return null;
        }

        @Override
        public DeliveryAnnotations getDeliveryAnnotations() {
            return null;
        }

        @Override
        public MessageAnnotations getMessageAnnotations() {
            return null;
        }

        @Override
        public Properties getProperties() {
            return null;
        }

        @Override
        public ApplicationProperties getApplicationProperties() {
            return null;
        }

        @Override
        public Section getBody() {
            return null;
        }

        @Override
        public Footer getFooter() {
            return null;
        }

        @Override
        public void setHeader(Header header) {
        }

        @Override
        public void setDeliveryAnnotations(DeliveryAnnotations deliveryAnnotations) {
        }

        @Override
        public void setMessageAnnotations(MessageAnnotations messageAnnotations) {
        }

        @Override
        public void setProperties(Properties properties) {
        }

        @Override
        public void setApplicationProperties(ApplicationProperties applicationProperties) {
        }

        @Override
        public void setBody(Section section) {
        }

        @Override
        public void setFooter(Footer footer) {
        }

        @Override
        public int decode(byte[] bytes, int i, int i1) {
            return 0;
        }

        @Override
        public int encode(byte[] bytes, int i, int i1) {
            if (exceptionCount == 0) {
                exceptionCount++;
                throw new BufferOverflowException();
            } else {
                return 0;
            }
        }

        @Override
        public void clear() {
        }

        @Override
        public MessageError getError() {
            return null;
        }
    };
    sender = new Sender() {

        @Override
        public Record attachments() {
            return null;
        }

        @Override
        public EndpointState getLocalState() {
            return null;
        }

        @Override
        public EndpointState getRemoteState() {
            return null;
        }

        @Override
        public ErrorCondition getCondition() {
            return null;
        }

        @Override
        public void setCondition(ErrorCondition errorCondition) {
        }

        @Override
        public ErrorCondition getRemoteCondition() {
            return null;
        }

        @Override
        public void free() {
        }

        @Override
        public void open() {
        }

        @Override
        public void close() {
        }

        @Override
        public void setContext(Object o) {
        }

        @Override
        public Object getContext() {
            return null;
        }

        @Override
        public void offer(int i) {
        }

        @Override
        public int send(byte[] bytes, int i, int i1) {
            return 0;
        }

        @Override
        public int send(ReadableBuffer readableBuffer) {
            return 0;
        }

        @Override
        public void abort() {
        }

        @Override
        public String getName() {
            return null;
        }

        @Override
        public Delivery delivery(byte[] bytes) {
            return delivery;
        }

        @Override
        public Delivery delivery(byte[] bytes, int i, int i1) {
            return null;
        }

        @Override
        public Delivery head() {
            return null;
        }

        @Override
        public Delivery current() {
            return null;
        }

        @Override
        public boolean advance() {
            return false;
        }

        @Override
        public Source getSource() {
            return null;
        }

        @Override
        public org.apache.qpid.proton.amqp.transport.Target getTarget() {
            return null;
        }

        @Override
        public void setSource(Source source) {
        }

        @Override
        public void setTarget(org.apache.qpid.proton.amqp.transport.Target target) {
        }

        @Override
        public Source getRemoteSource() {
            return null;
        }

        @Override
        public org.apache.qpid.proton.amqp.transport.Target getRemoteTarget() {
            return null;
        }

        @Override
        public Link next(EnumSet<EndpointState> enumSet, EnumSet<EndpointState> enumSet1) {
            return null;
        }

        @Override
        public int getCredit() {
            return 1;
        }

        @Override
        public int getQueued() {
            return 0;
        }

        @Override
        public int getUnsettled() {
            return 0;
        }

        @Override
        public Session getSession() {
            return session;
        }

        @Override
        public SenderSettleMode getSenderSettleMode() {
            return null;
        }

        @Override
        public void setSenderSettleMode(SenderSettleMode senderSettleMode) {
        }

        @Override
        public SenderSettleMode getRemoteSenderSettleMode() {
            return null;
        }

        @Override
        public ReceiverSettleMode getReceiverSettleMode() {
            return null;
        }

        @Override
        public void setReceiverSettleMode(ReceiverSettleMode receiverSettleMode) {
        }

        @Override
        public ReceiverSettleMode getRemoteReceiverSettleMode() {
            return null;
        }

        @Override
        public void setRemoteSenderSettleMode(SenderSettleMode senderSettleMode) {
        }

        @Override
        public Map<Symbol, Object> getProperties() {
            return null;
        }

        @Override
        public void setProperties(Map<Symbol, Object> map) {
        }

        @Override
        public Map<Symbol, Object> getRemoteProperties() {
            return null;
        }

        @Override
        public int drained() {
            return 0;
        }

        @Override
        public int getRemoteCredit() {
            return 0;
        }

        @Override
        public boolean getDrain() {
            return false;
        }

        @Override
        public void detach() {
        }

        @Override
        public boolean detached() {
            return false;
        }

        @Override
        public void setOfferedCapabilities(Symbol[] symbols) {
        }

        @Override
        public Symbol[] getOfferedCapabilities() {
            return new Symbol[0];
        }

        @Override
        public Symbol[] getRemoteOfferedCapabilities() {
            return new Symbol[0];
        }

        @Override
        public void setDesiredCapabilities(Symbol[] symbols) {
        }

        @Override
        public Symbol[] getDesiredCapabilities() {
            return new Symbol[0];
        }

        @Override
        public Symbol[] getRemoteDesiredCapabilities() {
            return new Symbol[0];
        }
    };
    event = new Event() {

        @Override
        public EventType getEventType() {
            return null;
        }

        @Override
        public Event.Type getType() {
            throw new UnsupportedOperationException(exceptionMessage);
        }

        @Override
        public Object getContext() {
            throw new UnsupportedOperationException(exceptionMessage);
        }

        @Override
        public Handler getRootHandler() {
            return null;
        }

        @Override
        public void dispatch(Handler hndlr) throws HandlerException {
            throw new UnsupportedOperationException(exceptionMessage);
        }

        @Override
        public void redispatch(EventType eventType, Handler handler) throws HandlerException {
        }

        @Override
        public void delegate() throws HandlerException {
        }

        @Override
        public Connection getConnection() {
            return connection;
        }

        @Override
        public Session getSession() {
            throw new UnsupportedOperationException(exceptionMessage);
        }

        @Override
        public Link getLink() {
            return sender;
        }

        @Override
        public Sender getSender() {
            return null;
        }

        @Override
        public Receiver getReceiver() {
            return null;
        }

        @Override
        public Delivery getDelivery() {
            throw new UnsupportedOperationException(exceptionMessage);
        }

        @Override
        public Transport getTransport() {
            throw new UnsupportedOperationException(exceptionMessage);
        }

        @Override
        public Reactor getReactor() {
            throw new UnsupportedOperationException(exceptionMessage);
        }

        @Override
        public Selectable getSelectable() {
            throw new UnsupportedOperationException(exceptionMessage);
        }

        @Override
        public Task getTask() {
            throw new UnsupportedOperationException(exceptionMessage);
        }

        @Override
        public Event copy() {
            throw new UnsupportedOperationException(exceptionMessage);
        }

        @Override
        public Record attachments() {
            throw new UnsupportedOperationException(exceptionMessage);
        }
    };
}
Also used : Task(org.apache.qpid.proton.reactor.Task) ReadableBuffer(org.apache.qpid.proton.codec.ReadableBuffer) Reactor(org.apache.qpid.proton.reactor.Reactor) AmqpSendHandler(com.microsoft.azure.sdk.iot.service.transport.amqps.AmqpSendHandler) Message(org.apache.qpid.proton.message.Message) Symbol(org.apache.qpid.proton.amqp.Symbol) Properties(org.apache.qpid.proton.amqp.messaging.Properties) Source(org.apache.qpid.proton.amqp.transport.Source) Target(org.apache.qpid.proton.amqp.messaging.Target) MessageError(org.apache.qpid.proton.message.MessageError) Selectable(org.apache.qpid.proton.reactor.Selectable) BufferOverflowException(java.nio.BufferOverflowException) org.apache.qpid.proton.amqp.transport(org.apache.qpid.proton.amqp.transport)

Example 2 with ReadableBuffer

use of org.apache.qpid.proton.codec.ReadableBuffer in project azure-iot-sdk-java by Azure.

the class AmqpSendHandlerTest method createProtonObjects.

private void createProtonObjects() {
    String exceptionMessage = "Not expected function called";
    message = Proton.message();
    messageWithException = new Message() {

        @Override
        public boolean isDurable() {
            return false;
        }

        @Override
        public long getDeliveryCount() {
            return 0;
        }

        @Override
        public short getPriority() {
            return 0;
        }

        @Override
        public boolean isFirstAcquirer() {
            return false;
        }

        @Override
        public long getTtl() {
            return 0;
        }

        @Override
        public void setDurable(boolean b) {
        }

        @Override
        public void setTtl(long l) {
        }

        @Override
        public void setDeliveryCount(long l) {
        }

        @Override
        public void setFirstAcquirer(boolean b) {
        }

        @Override
        public void setPriority(short i) {
        }

        @Override
        public Object getMessageId() {
            return null;
        }

        @Override
        public long getGroupSequence() {
            return 0;
        }

        @Override
        public String getReplyToGroupId() {
            return null;
        }

        @Override
        public long getCreationTime() {
            return 0;
        }

        @Override
        public String getAddress() {
            return null;
        }

        @Override
        public byte[] getUserId() {
            return new byte[0];
        }

        @Override
        public String getReplyTo() {
            return null;
        }

        @Override
        public String getGroupId() {
            return null;
        }

        @Override
        public String getContentType() {
            return null;
        }

        @Override
        public long getExpiryTime() {
            return 0;
        }

        @Override
        public Object getCorrelationId() {
            return null;
        }

        @Override
        public String getContentEncoding() {
            return null;
        }

        @Override
        public String getSubject() {
            return null;
        }

        @Override
        public void setGroupSequence(long l) {
        }

        @Override
        public void setUserId(byte[] bytes) {
        }

        @Override
        public void setCreationTime(long l) {
        }

        @Override
        public void setSubject(String s) {
        }

        @Override
        public void setGroupId(String s) {
        }

        @Override
        public void setAddress(String s) {
        }

        @Override
        public void setExpiryTime(long l) {
        }

        @Override
        public void setReplyToGroupId(String s) {
        }

        @Override
        public void setContentEncoding(String s) {
        }

        @Override
        public void setContentType(String s) {
        }

        @Override
        public void setReplyTo(String s) {
        }

        @Override
        public void setCorrelationId(Object o) {
        }

        @Override
        public void setMessageId(Object o) {
        }

        @Override
        public Header getHeader() {
            return null;
        }

        @Override
        public DeliveryAnnotations getDeliveryAnnotations() {
            return null;
        }

        @Override
        public MessageAnnotations getMessageAnnotations() {
            return null;
        }

        @Override
        public Properties getProperties() {
            return null;
        }

        @Override
        public ApplicationProperties getApplicationProperties() {
            return null;
        }

        @Override
        public Section getBody() {
            return null;
        }

        @Override
        public Footer getFooter() {
            return null;
        }

        @Override
        public void setHeader(Header header) {
        }

        @Override
        public void setDeliveryAnnotations(DeliveryAnnotations deliveryAnnotations) {
        }

        @Override
        public void setMessageAnnotations(MessageAnnotations messageAnnotations) {
        }

        @Override
        public void setProperties(Properties properties) {
        }

        @Override
        public void setApplicationProperties(ApplicationProperties applicationProperties) {
        }

        @Override
        public void setBody(Section section) {
        }

        @Override
        public void setFooter(Footer footer) {
        }

        @Override
        public int decode(byte[] bytes, int i, int i1) {
            return 0;
        }

        @Override
        public void decode(ReadableBuffer buf) {
        }

        @Override
        public int encode(byte[] bytes, int i, int i1) {
            if (exceptionCount == 0) {
                exceptionCount++;
                throw new BufferOverflowException();
            } else {
                return 0;
            }
        }

        @Override
        public int encode(WritableBuffer buf) {
            return 0;
        }

        @Override
        public void clear() {
        }

        @Override
        public MessageError getError() {
            return null;
        }
    };
    sender = new Sender() {

        @Override
        public Record attachments() {
            return null;
        }

        @Override
        public EndpointState getLocalState() {
            return null;
        }

        @Override
        public EndpointState getRemoteState() {
            return null;
        }

        @Override
        public ErrorCondition getCondition() {
            return null;
        }

        @Override
        public void setCondition(ErrorCondition errorCondition) {
        }

        @Override
        public ErrorCondition getRemoteCondition() {
            return null;
        }

        @Override
        public void free() {
        }

        @Override
        public void open() {
        }

        @Override
        public void close() {
        }

        @Override
        public void setContext(Object o) {
        }

        @Override
        public Object getContext() {
            return null;
        }

        @Override
        public void offer(int i) {
        }

        @Override
        public int send(byte[] bytes, int i, int i1) {
            return 0;
        }

        @Override
        public int send(ReadableBuffer readableBuffer) {
            return 0;
        }

        @Override
        public int sendNoCopy(ReadableBuffer readableBuffer) {
            return 0;
        }

        @Override
        public void abort() {
        }

        @Override
        public String getName() {
            return null;
        }

        @Override
        public Delivery delivery(byte[] bytes) {
            return delivery;
        }

        @Override
        public Delivery delivery(byte[] bytes, int i, int i1) {
            return null;
        }

        @Override
        public Delivery head() {
            return null;
        }

        @Override
        public Delivery current() {
            return null;
        }

        @Override
        public boolean advance() {
            return false;
        }

        @Override
        public Source getSource() {
            return null;
        }

        @Override
        public org.apache.qpid.proton.amqp.transport.Target getTarget() {
            return null;
        }

        @Override
        public void setSource(Source source) {
        }

        @Override
        public void setTarget(org.apache.qpid.proton.amqp.transport.Target target) {
        }

        @Override
        public Source getRemoteSource() {
            return null;
        }

        @Override
        public org.apache.qpid.proton.amqp.transport.Target getRemoteTarget() {
            return null;
        }

        @Override
        public Link next(EnumSet<EndpointState> enumSet, EnumSet<EndpointState> enumSet1) {
            return null;
        }

        @Override
        public int getCredit() {
            return 1;
        }

        @Override
        public int getQueued() {
            return 0;
        }

        @Override
        public int getUnsettled() {
            return 0;
        }

        @Override
        public Session getSession() {
            return session;
        }

        @Override
        public SenderSettleMode getSenderSettleMode() {
            return null;
        }

        @Override
        public void setSenderSettleMode(SenderSettleMode senderSettleMode) {
        }

        @Override
        public SenderSettleMode getRemoteSenderSettleMode() {
            return null;
        }

        @Override
        public ReceiverSettleMode getReceiverSettleMode() {
            return null;
        }

        @Override
        public void setReceiverSettleMode(ReceiverSettleMode receiverSettleMode) {
        }

        @Override
        public ReceiverSettleMode getRemoteReceiverSettleMode() {
            return null;
        }

        @Override
        public void setRemoteSenderSettleMode(SenderSettleMode senderSettleMode) {
        }

        @Override
        public Map<Symbol, Object> getProperties() {
            return null;
        }

        @Override
        public void setProperties(Map<Symbol, Object> map) {
        }

        @Override
        public Map<Symbol, Object> getRemoteProperties() {
            return null;
        }

        @Override
        public int drained() {
            return 0;
        }

        @Override
        public int getRemoteCredit() {
            return 0;
        }

        @Override
        public boolean getDrain() {
            return false;
        }

        @Override
        public void detach() {
        }

        @Override
        public boolean detached() {
            return false;
        }

        @Override
        public void setOfferedCapabilities(Symbol[] symbols) {
        }

        @Override
        public Symbol[] getOfferedCapabilities() {
            return new Symbol[0];
        }

        @Override
        public Symbol[] getRemoteOfferedCapabilities() {
            return new Symbol[0];
        }

        @Override
        public void setDesiredCapabilities(Symbol[] symbols) {
        }

        @Override
        public Symbol[] getDesiredCapabilities() {
            return new Symbol[0];
        }

        @Override
        public Symbol[] getRemoteDesiredCapabilities() {
            return new Symbol[0];
        }

        @Override
        public void setMaxMessageSize(UnsignedLong unsignedLong) {
        }

        @Override
        public UnsignedLong getMaxMessageSize() {
            return null;
        }

        @Override
        public UnsignedLong getRemoteMaxMessageSize() {
            return null;
        }
    };
    event = new Event() {

        @Override
        public EventType getEventType() {
            return null;
        }

        @Override
        public Event.Type getType() {
            throw new UnsupportedOperationException(exceptionMessage);
        }

        @Override
        public Object getContext() {
            throw new UnsupportedOperationException(exceptionMessage);
        }

        @Override
        public Handler getRootHandler() {
            return null;
        }

        @Override
        public void dispatch(Handler hndlr) throws HandlerException {
            throw new UnsupportedOperationException(exceptionMessage);
        }

        @Override
        public void redispatch(EventType eventType, Handler handler) throws HandlerException {
        }

        @Override
        public void delegate() throws HandlerException {
        }

        @Override
        public Connection getConnection() {
            return connection;
        }

        @Override
        public Session getSession() {
            throw new UnsupportedOperationException(exceptionMessage);
        }

        @Override
        public Link getLink() {
            return sender;
        }

        @Override
        public Sender getSender() {
            return null;
        }

        @Override
        public Receiver getReceiver() {
            return null;
        }

        @Override
        public Delivery getDelivery() {
            throw new UnsupportedOperationException(exceptionMessage);
        }

        @Override
        public Transport getTransport() {
            throw new UnsupportedOperationException(exceptionMessage);
        }

        @Override
        public Reactor getReactor() {
            throw new UnsupportedOperationException(exceptionMessage);
        }

        @Override
        public Selectable getSelectable() {
            throw new UnsupportedOperationException(exceptionMessage);
        }

        @Override
        public Task getTask() {
            throw new UnsupportedOperationException(exceptionMessage);
        }

        @Override
        public Event copy() {
            throw new UnsupportedOperationException(exceptionMessage);
        }

        @Override
        public Record attachments() {
            throw new UnsupportedOperationException(exceptionMessage);
        }
    };
}
Also used : Task(org.apache.qpid.proton.reactor.Task) ReadableBuffer(org.apache.qpid.proton.codec.ReadableBuffer) Reactor(org.apache.qpid.proton.reactor.Reactor) AmqpSendHandler(com.microsoft.azure.sdk.iot.service.transport.amqps.AmqpSendHandler) Message(org.apache.qpid.proton.message.Message) Symbol(org.apache.qpid.proton.amqp.Symbol) Properties(org.apache.qpid.proton.amqp.messaging.Properties) Source(org.apache.qpid.proton.amqp.transport.Source) Target(org.apache.qpid.proton.amqp.messaging.Target) MessageError(org.apache.qpid.proton.message.MessageError) Selectable(org.apache.qpid.proton.reactor.Selectable) BufferOverflowException(java.nio.BufferOverflowException) UnsignedLong(org.apache.qpid.proton.amqp.UnsignedLong) org.apache.qpid.proton.amqp.transport(org.apache.qpid.proton.amqp.transport) WritableBuffer(org.apache.qpid.proton.codec.WritableBuffer)

Example 3 with ReadableBuffer

use of org.apache.qpid.proton.codec.ReadableBuffer in project azure-iot-sdk-java by Azure.

the class AmqpFileUploadNotificationReceivedHandlerTest method createProtonObjects.

private void createProtonObjects() {
    final String exceptionMessage = "Not expected function called";
    message = Proton.message();
    receiver = new Receiver() {

        @Override
        public void flow(int i) {
        }

        @Override
        public ReadableBuffer recv() {
            return readBuf;
        }

        @Override
        public int recv(byte[] bytes, int i, int i1) {
            return 0;
        }

        @Override
        public int recv(WritableBuffer writableBuffer) {
            return 0;
        }

        @Override
        public void drain(int i) {
        }

        @Override
        public boolean advance() {
            return false;
        }

        @Override
        public boolean draining() {
            return false;
        }

        @Override
        public void setDrain(boolean b) {
        }

        @Override
        public String getName() {
            return "filenotificationreceiver";
        }

        @Override
        public Delivery delivery(byte[] bytes) {
            return null;
        }

        @Override
        public Delivery delivery(byte[] bytes, int i, int i1) {
            return null;
        }

        @Override
        public Delivery head() {
            return null;
        }

        @Override
        public Delivery current() {
            return delivery;
        }

        @Override
        public org.apache.qpid.proton.amqp.transport.Source getSource() {
            return null;
        }

        @Override
        public org.apache.qpid.proton.amqp.transport.Target getTarget() {
            return null;
        }

        @Override
        public void setSource(org.apache.qpid.proton.amqp.transport.Source source) {
        }

        @Override
        public void setTarget(org.apache.qpid.proton.amqp.transport.Target target) {
        }

        @Override
        public org.apache.qpid.proton.amqp.transport.Source getRemoteSource() {
            return null;
        }

        @Override
        public org.apache.qpid.proton.amqp.transport.Target getRemoteTarget() {
            return null;
        }

        @Override
        public Link next(EnumSet<EndpointState> enumSet, EnumSet<EndpointState> enumSet1) {
            return null;
        }

        @Override
        public int getCredit() {
            return 0;
        }

        @Override
        public int getQueued() {
            return 0;
        }

        @Override
        public int getUnsettled() {
            return 0;
        }

        @Override
        public Session getSession() {
            return session;
        }

        @Override
        public SenderSettleMode getSenderSettleMode() {
            return null;
        }

        @Override
        public void setSenderSettleMode(SenderSettleMode senderSettleMode) {
        }

        @Override
        public SenderSettleMode getRemoteSenderSettleMode() {
            return null;
        }

        @Override
        public ReceiverSettleMode getReceiverSettleMode() {
            return null;
        }

        @Override
        public void setReceiverSettleMode(ReceiverSettleMode receiverSettleMode) {
        }

        @Override
        public ReceiverSettleMode getRemoteReceiverSettleMode() {
            return null;
        }

        @Override
        public void setRemoteSenderSettleMode(SenderSettleMode senderSettleMode) {
        }

        @Override
        public Map<Symbol, Object> getProperties() {
            return null;
        }

        @Override
        public void setProperties(Map<Symbol, Object> map) {
        }

        @Override
        public Map<Symbol, Object> getRemoteProperties() {
            return null;
        }

        @Override
        public int drained() {
            return 0;
        }

        @Override
        public int getRemoteCredit() {
            return 0;
        }

        @Override
        public boolean getDrain() {
            return false;
        }

        @Override
        public void detach() {
        }

        @Override
        public boolean detached() {
            return false;
        }

        @Override
        public void setOfferedCapabilities(Symbol[] symbols) {
        }

        @Override
        public Symbol[] getOfferedCapabilities() {
            return new Symbol[0];
        }

        @Override
        public Symbol[] getRemoteOfferedCapabilities() {
            return new Symbol[0];
        }

        @Override
        public void setDesiredCapabilities(Symbol[] symbols) {
        }

        @Override
        public Symbol[] getDesiredCapabilities() {
            return new Symbol[0];
        }

        @Override
        public Symbol[] getRemoteDesiredCapabilities() {
            return new Symbol[0];
        }

        @Override
        public void setMaxMessageSize(UnsignedLong unsignedLong) {
        }

        @Override
        public UnsignedLong getMaxMessageSize() {
            return null;
        }

        @Override
        public UnsignedLong getRemoteMaxMessageSize() {
            return null;
        }

        @Override
        public EndpointState getLocalState() {
            return null;
        }

        @Override
        public EndpointState getRemoteState() {
            return null;
        }

        @Override
        public ErrorCondition getCondition() {
            return null;
        }

        @Override
        public void setCondition(ErrorCondition errorCondition) {
        }

        @Override
        public ErrorCondition getRemoteCondition() {
            return null;
        }

        @Override
        public void free() {
        }

        @Override
        public void open() {
        }

        @Override
        public void close() {
        }

        @Override
        public void setContext(Object o) {
        }

        @Override
        public Object getContext() {
            return null;
        }

        @Override
        public Record attachments() {
            return null;
        }
    };
    event = new Event() {

        @Override
        public EventType getEventType() {
            return null;
        }

        @Override
        public Type getType() {
            throw new UnsupportedOperationException(exceptionMessage);
        }

        @Override
        public Object getContext() {
            throw new UnsupportedOperationException(exceptionMessage);
        }

        @Override
        public Handler getRootHandler() {
            return null;
        }

        @Override
        public void dispatch(Handler hndlr) throws HandlerException {
            throw new UnsupportedOperationException(exceptionMessage);
        }

        @Override
        public void redispatch(EventType eventType, Handler handler) throws HandlerException {
        }

        @Override
        public void delegate() throws HandlerException {
        }

        @Override
        public Connection getConnection() {
            return connection;
        }

        @Override
        public Session getSession() {
            throw new UnsupportedOperationException(exceptionMessage);
        }

        @Override
        public Link getLink() {
            return receiver;
        }

        @Override
        public Sender getSender() {
            return null;
        }

        @Override
        public Receiver getReceiver() {
            return null;
        }

        @Override
        public Delivery getDelivery() {
            return delivery;
        }

        @Override
        public Transport getTransport() {
            throw new UnsupportedOperationException(exceptionMessage);
        }

        @Override
        public Reactor getReactor() {
            throw new UnsupportedOperationException(exceptionMessage);
        }

        @Override
        public Selectable getSelectable() {
            throw new UnsupportedOperationException(exceptionMessage);
        }

        @Override
        public Task getTask() {
            throw new UnsupportedOperationException(exceptionMessage);
        }

        @Override
        public Event copy() {
            throw new UnsupportedOperationException(exceptionMessage);
        }

        @Override
        public Record attachments() {
            throw new UnsupportedOperationException(exceptionMessage);
        }
    };
    delivery = new Delivery() {

        @Override
        public byte[] getTag() {
            return new byte[0];
        }

        @Override
        public Link getLink() {
            return receiver;
        }

        @Override
        public DeliveryState getLocalState() {
            return null;
        }

        @Override
        public DeliveryState getRemoteState() {
            return null;
        }

        @Override
        public int getMessageFormat() {
            return 0;
        }

        @Override
        public int available() {
            return 0;
        }

        @Override
        public void disposition(DeliveryState deliveryState) {
        }

        @Override
        public void settle() {
        }

        @Override
        public boolean isSettled() {
            return false;
        }

        @Override
        public boolean isAborted() {
            return false;
        }

        @Override
        public boolean remotelySettled() {
            return false;
        }

        @Override
        public void free() {
        }

        @Override
        public Delivery getWorkNext() {
            return null;
        }

        @Override
        public Delivery next() {
            return null;
        }

        @Override
        public boolean isWritable() {
            return false;
        }

        @Override
        public boolean isReadable() {
            return true;
        }

        @Override
        public void setContext(Object o) {
        }

        @Override
        public Object getContext() {
            return null;
        }

        @Override
        public boolean isUpdated() {
            return false;
        }

        @Override
        public void clear() {
        }

        @Override
        public boolean isPartial() {
            return false;
        }

        @Override
        public int pending() {
            return 0;
        }

        @Override
        public boolean isBuffered() {
            return false;
        }

        @Override
        public void setDefaultDeliveryState(DeliveryState deliveryState) {
        }

        @Override
        public DeliveryState getDefaultDeliveryState() {
            return null;
        }

        @Override
        public void setMessageFormat(int i) {
        }

        @Override
        public Record attachments() {
            return null;
        }
    };
}
Also used : Symbol(org.apache.qpid.proton.amqp.Symbol) ReadableBuffer(org.apache.qpid.proton.codec.ReadableBuffer) Source(org.apache.qpid.proton.amqp.messaging.Source) ReceiverSettleMode(org.apache.qpid.proton.amqp.transport.ReceiverSettleMode) Target(org.apache.qpid.proton.amqp.messaging.Target) UnsignedLong(org.apache.qpid.proton.amqp.UnsignedLong) ErrorCondition(org.apache.qpid.proton.amqp.transport.ErrorCondition) AmqpFileUploadNotificationReceivedHandler(com.microsoft.azure.sdk.iot.service.transport.amqps.AmqpFileUploadNotificationReceivedHandler) SenderSettleMode(org.apache.qpid.proton.amqp.transport.SenderSettleMode) WritableBuffer(org.apache.qpid.proton.codec.WritableBuffer) DeliveryState(org.apache.qpid.proton.amqp.transport.DeliveryState) AmqpFeedbackReceivedEvent(com.microsoft.azure.sdk.iot.service.transport.amqps.AmqpFeedbackReceivedEvent) Map(java.util.Map)

Example 4 with ReadableBuffer

use of org.apache.qpid.proton.codec.ReadableBuffer in project vertx-proton by vert-x3.

the class ProtonSenderImpl method send.

@Override
public ProtonDelivery send(byte[] tag, Message message, Handler<ProtonDelivery> onUpdated) {
    if (anonymousSender && message.getAddress() == null) {
        throw new IllegalArgumentException("Message must have an address when using anonymous sender.");
    }
    // TODO: prevent odd combination of onRecieved callback + SenderSettleMode.SETTLED, or just allow it?
    // start a new delivery..
    Delivery delivery = sender().delivery(tag);
    ProtonWritableBufferImpl buffer = new ProtonWritableBufferImpl();
    MessageImpl msg = (MessageImpl) message;
    msg.encode(buffer);
    ReadableBuffer encoded = new ProtonReadableBufferImpl(buffer.getBuffer());
    sender().sendNoCopy(encoded);
    if (link.getSenderSettleMode() == SenderSettleMode.SETTLED) {
        delivery.settle();
    }
    // ends the delivery.
    sender().advance();
    ProtonDeliveryImpl protonDeliveryImpl = new ProtonDeliveryImpl(delivery);
    if (onUpdated != null) {
        protonDeliveryImpl.setAutoSettle(autoSettle);
        protonDeliveryImpl.handler(onUpdated);
    } else {
        protonDeliveryImpl.setAutoSettle(true);
    }
    getSession().getConnectionImpl().flush();
    return protonDeliveryImpl;
}
Also used : Delivery(org.apache.qpid.proton.engine.Delivery) ProtonDelivery(io.vertx.proton.ProtonDelivery) ReadableBuffer(org.apache.qpid.proton.codec.ReadableBuffer) MessageImpl(org.apache.qpid.proton.message.impl.MessageImpl)

Example 5 with ReadableBuffer

use of org.apache.qpid.proton.codec.ReadableBuffer in project vertx-proton by vert-x3.

the class ProtonReceiverImpl method completePartial.

private ReadableBuffer completePartial(final ReadableBuffer finalContent) {
    int pending = finalContent.remaining();
    if (pending > 0) {
        byte[] chunk = new byte[pending];
        finalContent.get(chunk);
        splitContent.append(chunk);
    }
    ReadableBuffer data = splitContent;
    splitContent = null;
    return data;
}
Also used : CompositeReadableBuffer(org.apache.qpid.proton.codec.CompositeReadableBuffer) ReadableBuffer(org.apache.qpid.proton.codec.ReadableBuffer)

Aggregations

ReadableBuffer (org.apache.qpid.proton.codec.ReadableBuffer)14 UnsignedLong (org.apache.qpid.proton.amqp.UnsignedLong)7 Delivery (org.apache.qpid.proton.engine.Delivery)5 Message (org.apache.qpid.proton.message.Message)5 Test (org.junit.Test)5 ProtonDelivery (io.vertx.proton.ProtonDelivery)4 ProtonReceiver (io.vertx.proton.ProtonReceiver)4 Symbol (org.apache.qpid.proton.amqp.Symbol)4 Target (org.apache.qpid.proton.amqp.messaging.Target)4 Receiver (org.apache.qpid.proton.engine.Receiver)4 ByteBuf (io.netty.buffer.ByteBuf)3 Vertx (io.vertx.core.Vertx)3 ContextInternal (io.vertx.core.impl.ContextInternal)3 ProtonMessageHandler (io.vertx.proton.ProtonMessageHandler)3 ErrorCondition (org.apache.qpid.proton.amqp.transport.ErrorCondition)3 CompositeReadableBuffer (org.apache.qpid.proton.codec.CompositeReadableBuffer)3 WritableBuffer (org.apache.qpid.proton.codec.WritableBuffer)3 Connection (org.apache.qpid.proton.engine.Connection)3 Session (org.apache.qpid.proton.engine.Session)3 Transport (org.apache.qpid.proton.engine.Transport)3