Search in sources :

Example 1 with End

use of org.apache.qpid.server.protocol.v1_0.type.transport.End in project qpid-broker-j by apache.

the class Interaction method copyEnd.

private End copyEnd(final End end) {
    final End endCopy = new End();
    endCopy.setError(end.getError());
    return endCopy;
}
Also used : End(org.apache.qpid.server.protocol.v1_0.type.transport.End)

Example 2 with End

use of org.apache.qpid.server.protocol.v1_0.type.transport.End in project qpid-broker-j by apache.

the class DecodeErrorTest method nodePropertiesSupportedDistributionModes.

@Test
@SpecificationTest(section = "3.5.9", description = "The value of this entry MUST be of a type which provides the lifetime-policy archetype.")
public void nodePropertiesSupportedDistributionModes() throws Exception {
    try (FrameTransport transport = new FrameTransport(_brokerAddress).connect()) {
        final Target target = new Target();
        target.setDynamic(Boolean.TRUE);
        target.setDynamicNodeProperties(Collections.singletonMap(Symbol.valueOf("supported-dist-modes"), UnsignedInteger.ZERO));
        final Response<?> latestResponse = transport.newInteraction().negotiateProtocol().consumeResponse().open().consumeResponse(Open.class).begin().consumeResponse(Begin.class).attachTarget(target).attachRole(Role.SENDER).attach().consumeResponse().getLatestResponse();
        assertThat(latestResponse, is(notNullValue()));
        final Object responseBody = latestResponse.getBody();
        final Error error;
        if (responseBody instanceof End) {
            error = ((End) responseBody).getError();
        } else if (responseBody instanceof Close) {
            error = ((Close) responseBody).getError();
        } else {
            fail(String.format("Expected response of either Detach, End, or Close. Got '%s'", responseBody));
            error = null;
        }
        assertThat(error, is(notNullValue()));
        assertThat(error.getCondition(), is(equalTo(DECODE_ERROR)));
    }
}
Also used : Target(org.apache.qpid.server.protocol.v1_0.type.messaging.Target) Begin(org.apache.qpid.server.protocol.v1_0.type.transport.Begin) Error(org.apache.qpid.server.protocol.v1_0.type.transport.Error) End(org.apache.qpid.server.protocol.v1_0.type.transport.End) Close(org.apache.qpid.server.protocol.v1_0.type.transport.Close) Open(org.apache.qpid.server.protocol.v1_0.type.transport.Open) Test(org.junit.Test) SpecificationTest(org.apache.qpid.tests.protocol.SpecificationTest) SpecificationTest(org.apache.qpid.tests.protocol.SpecificationTest)

Example 3 with End

use of org.apache.qpid.server.protocol.v1_0.type.transport.End in project qpid-broker-j by apache.

the class DecodeErrorTest method nodePropertiesLifetimePolicy.

@Test
@SpecificationTest(section = "3.5.9", description = "The value of this entry MUST be of a type which provides the lifetime-policy archetype.")
public void nodePropertiesLifetimePolicy() throws Exception {
    try (FrameTransport transport = new FrameTransport(_brokerAddress).connect()) {
        final Source source = new Source();
        source.setDynamic(Boolean.TRUE);
        source.setDynamicNodeProperties(Collections.singletonMap(Symbol.valueOf("lifetime-policy"), UnsignedInteger.MAX_VALUE));
        final Response<?> latestResponse = transport.newInteraction().negotiateProtocol().consumeResponse().open().consumeResponse(Open.class).begin().consumeResponse(Begin.class).attachSource(source).attachRole(Role.SENDER).attach().consumeResponse().getLatestResponse();
        assertThat(latestResponse, is(notNullValue()));
        final Object responseBody = latestResponse.getBody();
        final Error error;
        if (responseBody instanceof End) {
            error = ((End) responseBody).getError();
        } else if (responseBody instanceof Close) {
            error = ((Close) responseBody).getError();
        } else {
            fail(String.format("Expected response of either Detach, End, or Close. Got '%s'", responseBody));
            error = null;
        }
        assertThat(error, is(notNullValue()));
        assertThat(error.getCondition(), is(equalTo(DECODE_ERROR)));
    }
}
Also used : Begin(org.apache.qpid.server.protocol.v1_0.type.transport.Begin) Error(org.apache.qpid.server.protocol.v1_0.type.transport.Error) End(org.apache.qpid.server.protocol.v1_0.type.transport.End) Close(org.apache.qpid.server.protocol.v1_0.type.transport.Close) Source(org.apache.qpid.server.protocol.v1_0.type.messaging.Source) Open(org.apache.qpid.server.protocol.v1_0.type.transport.Open) Test(org.junit.Test) SpecificationTest(org.apache.qpid.tests.protocol.SpecificationTest) SpecificationTest(org.apache.qpid.tests.protocol.SpecificationTest)

Example 4 with End

use of org.apache.qpid.server.protocol.v1_0.type.transport.End in project qpid-broker-j by apache.

the class TransactionalTransferTest method assertUnknownTransactionIdError.

private void assertUnknownTransactionIdError(final Response<?> response) {
    assertThat(response, is(notNullValue()));
    final Object body = response.getBody();
    assertThat(body, is(notNullValue()));
    Error error = null;
    if (body instanceof Close) {
        error = ((Close) body).getError();
    } else if (body instanceof End) {
        error = ((End) body).getError();
    } else if (body instanceof Detach) {
        error = ((Detach) body).getError();
    } else {
        fail(String.format("Unexpected response %s", body.getClass().getSimpleName()));
    }
    assertThat(error, is(notNullValue()));
    assertThat(error.getCondition(), equalTo(TransactionError.UNKNOWN_ID));
}
Also used : Error(org.apache.qpid.server.protocol.v1_0.type.transport.Error) TransactionError(org.apache.qpid.server.protocol.v1_0.type.transaction.TransactionError) Close(org.apache.qpid.server.protocol.v1_0.type.transport.Close) End(org.apache.qpid.server.protocol.v1_0.type.transport.End) Detach(org.apache.qpid.server.protocol.v1_0.type.transport.Detach)

Example 5 with End

use of org.apache.qpid.server.protocol.v1_0.type.transport.End in project qpid-broker-j by apache.

the class AttachTest method attachSenderWithNullSource.

@Test
@SpecificationTest(section = "2.6.3", description = "Note that if the application chooses not to create a terminus, the session endpoint will" + " still create a link endpoint and issue an attach indicating that the link endpoint has" + " no associated local terminus. In this case, the session endpoint MUST immediately" + " detach the newly created link endpoint.")
public void attachSenderWithNullSource() throws Exception {
    String queueName = "testQueue";
    getBrokerAdmin().createQueue(queueName);
    final InetSocketAddress addr = getBrokerAdmin().getBrokerAddress(BrokerAdmin.PortType.ANONYMOUS_AMQP);
    try (FrameTransport transport = new FrameTransport(addr).connect()) {
        Interaction interaction = transport.newInteraction();
        final Attach responseAttach = interaction.negotiateProtocol().consumeResponse().open().consumeResponse(Open.class).begin().consumeResponse(Begin.class).attachRole(Role.SENDER).attachSource(null).attachTargetAddress(queueName).attachInitialDeliveryCount(UnsignedInteger.ZERO).attach().consumeResponse().getLatestResponse(Attach.class);
        assertThat(responseAttach.getName(), is(notNullValue()));
        assertThat(responseAttach.getHandle().longValue(), is(both(greaterThanOrEqualTo(0L)).and(lessThan(UnsignedInteger.MAX_VALUE.longValue()))));
        assertThat(responseAttach.getRole(), is(Role.RECEIVER));
        assertThat(responseAttach.getSource(), is(nullValue()));
        assertThat(responseAttach.getTarget(), is(nullValue()));
        final Detach responseDetach = interaction.consumeResponse().getLatestResponse(Detach.class);
        assertThat(responseDetach.getClosed(), is(true));
        assertThat(responseDetach.getError(), is(notNullValue()));
        assertThat(responseDetach.getError().getCondition(), is(equalTo(AmqpError.INVALID_FIELD)));
        final End endResponse = interaction.flowHandleFromLinkHandle().flowEcho(true).flow().consumeResponse().getLatestResponse(End.class);
        assertThat(endResponse.getError(), is(notNullValue()));
    // QPID-7954
    // assertThat(endResponse.getError().getCondition(), is(equalTo(SessionError.ERRANT_LINK)));
    }
}
Also used : FrameTransport(org.apache.qpid.tests.protocol.v1_0.FrameTransport) InetSocketAddress(java.net.InetSocketAddress) Interaction(org.apache.qpid.tests.protocol.v1_0.Interaction) Attach(org.apache.qpid.server.protocol.v1_0.type.transport.Attach) Begin(org.apache.qpid.server.protocol.v1_0.type.transport.Begin) End(org.apache.qpid.server.protocol.v1_0.type.transport.End) Detach(org.apache.qpid.server.protocol.v1_0.type.transport.Detach) Open(org.apache.qpid.server.protocol.v1_0.type.transport.Open) Test(org.junit.Test) SpecificationTest(org.apache.qpid.tests.protocol.SpecificationTest) SpecificationTest(org.apache.qpid.tests.protocol.SpecificationTest)

Aggregations

End (org.apache.qpid.server.protocol.v1_0.type.transport.End)15 Error (org.apache.qpid.server.protocol.v1_0.type.transport.Error)11 SpecificationTest (org.apache.qpid.tests.protocol.SpecificationTest)8 Test (org.junit.Test)8 AmqpError (org.apache.qpid.server.protocol.v1_0.type.transport.AmqpError)7 Open (org.apache.qpid.server.protocol.v1_0.type.transport.Open)6 FrameTransport (org.apache.qpid.tests.protocol.v1_0.FrameTransport)6 Attach (org.apache.qpid.server.protocol.v1_0.type.transport.Attach)5 Begin (org.apache.qpid.server.protocol.v1_0.type.transport.Begin)5 Detach (org.apache.qpid.server.protocol.v1_0.type.transport.Detach)5 LinkError (org.apache.qpid.server.protocol.v1_0.type.transport.LinkError)5 SessionError (org.apache.qpid.server.protocol.v1_0.type.transport.SessionError)5 Close (org.apache.qpid.server.protocol.v1_0.type.transport.Close)4 Interaction (org.apache.qpid.tests.protocol.v1_0.Interaction)4 InetSocketAddress (java.net.InetSocketAddress)3 Binary (org.apache.qpid.server.protocol.v1_0.type.Binary)3 UnsignedInteger (org.apache.qpid.server.protocol.v1_0.type.UnsignedInteger)3 HashMap (java.util.HashMap)2 Map (java.util.Map)2 DeliveryRegistry (org.apache.qpid.server.protocol.v1_0.delivery.DeliveryRegistry)2