Search in sources :

Example 1 with Delivery

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

the class AmqpsMessageTest method acknowledgeSetsRejectedDispositionForReject.

// Tests_SRS_AMQPSMESSAGE_14_003: [If the ACK_TYPE is REJECT, the function shall set a Rejected disposition on the private Delivery object.]
@Test
public void acknowledgeSetsRejectedDispositionForReject(@Mocked final Rejected mockRejected) {
    new NonStrictExpectations() {

        {
            new Rejected();
            result = mockRejected;
        }
    };
    AmqpsMessage message = new AmqpsMessage();
    message.setDelivery(mockDelivery);
    message.acknowledge(AmqpsMessage.ACK_TYPE.REJECT);
    final Delivery expectedDelivery = mockDelivery;
    new Verifications() {

        {
            expectedDelivery.disposition(mockRejected);
        }
    };
}
Also used : Rejected(org.apache.qpid.proton.amqp.messaging.Rejected) Delivery(org.apache.qpid.proton.engine.Delivery) Verifications(mockit.Verifications) NonStrictExpectations(mockit.NonStrictExpectations) AmqpsMessage(com.microsoft.azure.sdk.iot.device.transport.amqps.AmqpsMessage) Test(org.junit.Test)

Example 2 with Delivery

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

the class AmqpsMessageTest method acknowledgeSettlesDelivery.

// Tests_SRS_AMQPSMESSAGE_14_005: [The function shall settle the delivery after setting the proper disposition.]
@Test
public void acknowledgeSettlesDelivery() {
    AmqpsMessage message = new AmqpsMessage();
    message.setDelivery(mockDelivery);
    message.acknowledge(AmqpsMessage.ACK_TYPE.COMPLETE);
    message.acknowledge(AmqpsMessage.ACK_TYPE.ABANDON);
    message.acknowledge(AmqpsMessage.ACK_TYPE.REJECT);
    final Delivery expectedDelivery = mockDelivery;
    new Verifications() {

        {
            expectedDelivery.settle();
            times = 3;
        }
    };
}
Also used : Delivery(org.apache.qpid.proton.engine.Delivery) Verifications(mockit.Verifications) AmqpsMessage(com.microsoft.azure.sdk.iot.device.transport.amqps.AmqpsMessage) Test(org.junit.Test)

Example 3 with Delivery

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

the class AmqpsMessageTest method acknowledgeSetsReleasedDispositionForAbandon.

// Tests_SRS_AMQPSMESSAGE_14_002: [If the ACK_TYPE is ABANDON, the function shall set a Released disposition on the private Delivery object.]
@Test
public void acknowledgeSetsReleasedDispositionForAbandon() {
    AmqpsMessage message = new AmqpsMessage();
    message.setDelivery(mockDelivery);
    message.acknowledge(AmqpsMessage.ACK_TYPE.ABANDON);
    final Delivery expectedDelivery = mockDelivery;
    new Verifications() {

        {
            expectedDelivery.disposition(Released.getInstance());
        }
    };
}
Also used : Delivery(org.apache.qpid.proton.engine.Delivery) Verifications(mockit.Verifications) AmqpsMessage(com.microsoft.azure.sdk.iot.device.transport.amqps.AmqpsMessage) Test(org.junit.Test)

Example 4 with Delivery

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

the class AmqpsMessageTest method acknowledgeSetsAcceptedDispositionForComlete.

// Tests_SRS_AMQPSMESSAGE_14_001: [If the ACK_TYPE is COMPLETE, the function shall set an Accepted disposition on the private Delivery object.]
@Test
public void acknowledgeSetsAcceptedDispositionForComlete() {
    AmqpsMessage message = new AmqpsMessage();
    message.setDelivery(mockDelivery);
    message.acknowledge(AmqpsMessage.ACK_TYPE.COMPLETE);
    final Delivery expectedDelivery = mockDelivery;
    new Verifications() {

        {
            expectedDelivery.disposition(Accepted.getInstance());
        }
    };
}
Also used : Delivery(org.apache.qpid.proton.engine.Delivery) Verifications(mockit.Verifications) AmqpsMessage(com.microsoft.azure.sdk.iot.device.transport.amqps.AmqpsMessage) Test(org.junit.Test)

Aggregations

AmqpsMessage (com.microsoft.azure.sdk.iot.device.transport.amqps.AmqpsMessage)4 Verifications (mockit.Verifications)4 Delivery (org.apache.qpid.proton.engine.Delivery)4 Test (org.junit.Test)4 NonStrictExpectations (mockit.NonStrictExpectations)1 Rejected (org.apache.qpid.proton.amqp.messaging.Rejected)1