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;
}
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)));
}
}
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)));
}
}
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));
}
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)));
}
}
Aggregations