You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by or...@apache.org on 2019/08/29 15:32:22 UTC
[qpid-broker-j] branch master updated: QPID-8349: [Tests][AMQP 1.0]
Throw exception for amqp decoding errors
This is an automated email from the ASF dual-hosted git repository.
orudyy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-broker-j.git
The following commit(s) were added to refs/heads/master by this push:
new 1080abb QPID-8349: [Tests][AMQP 1.0] Throw exception for amqp decoding errors
1080abb is described below
commit 1080abb6f0a4ef4124760862aa592428ba46b8b9
Author: Alex Rudyy <or...@apache.org>
AuthorDate: Thu Aug 29 15:10:05 2019 +0100
QPID-8349: [Tests][AMQP 1.0] Throw exception for amqp decoding errors
---
.../qpid/tests/protocol/v1_0/FrameDecoder.java | 12 +++++++---
.../tests/protocol/v1_0/FrameDecodingError.java | 26 ++++++++++++++++++++++
.../qpid/tests/protocol/v1_0/Interaction.java | 7 +++++-
3 files changed, 41 insertions(+), 4 deletions(-)
diff --git a/systests/protocol-tests-amqp-1-0/src/main/java/org/apache/qpid/tests/protocol/v1_0/FrameDecoder.java b/systests/protocol-tests-amqp-1-0/src/main/java/org/apache/qpid/tests/protocol/v1_0/FrameDecoder.java
index e04ed9f..a5c6814 100644
--- a/systests/protocol-tests-amqp-1-0/src/main/java/org/apache/qpid/tests/protocol/v1_0/FrameDecoder.java
+++ b/systests/protocol-tests-amqp-1-0/src/main/java/org/apache/qpid/tests/protocol/v1_0/FrameDecoder.java
@@ -210,7 +210,7 @@ public class FrameDecoder implements InputDecoder
public void handleError(final Error parsingError)
{
LOGGER.error("Unexpected error {}", parsingError);
- _responseQueue.add(new FrameDecodeError(parsingError));
+ _responseQueue.add(new FrameDecodingErrorResponse(parsingError));
}
@Override
@@ -291,11 +291,11 @@ public class FrameDecoder implements InputDecoder
}
}
- private static class FrameDecodeError implements Response<Error>
+ private static class FrameDecodingErrorResponse implements Response<Error>, FrameDecodingError
{
private final Error _error;
- FrameDecodeError(final Error error)
+ FrameDecodingErrorResponse(final Error error)
{
_error = error;
}
@@ -303,6 +303,12 @@ public class FrameDecoder implements InputDecoder
@Override
public Error getBody()
{
+ return null;
+ }
+
+ @Override
+ public Error getError()
+ {
return _error;
}
}
diff --git a/systests/protocol-tests-amqp-1-0/src/main/java/org/apache/qpid/tests/protocol/v1_0/FrameDecodingError.java b/systests/protocol-tests-amqp-1-0/src/main/java/org/apache/qpid/tests/protocol/v1_0/FrameDecodingError.java
new file mode 100644
index 0000000..a2c66be
--- /dev/null
+++ b/systests/protocol-tests-amqp-1-0/src/main/java/org/apache/qpid/tests/protocol/v1_0/FrameDecodingError.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.qpid.tests.protocol.v1_0;
+
+import org.apache.qpid.server.protocol.v1_0.type.transport.Error;
+
+public interface FrameDecodingError
+{
+ Error getError();
+}
diff --git a/systests/protocol-tests-amqp-1-0/src/main/java/org/apache/qpid/tests/protocol/v1_0/Interaction.java b/systests/protocol-tests-amqp-1-0/src/main/java/org/apache/qpid/tests/protocol/v1_0/Interaction.java
index e776d0c..c9614f6 100644
--- a/systests/protocol-tests-amqp-1-0/src/main/java/org/apache/qpid/tests/protocol/v1_0/Interaction.java
+++ b/systests/protocol-tests-amqp-1-0/src/main/java/org/apache/qpid/tests/protocol/v1_0/Interaction.java
@@ -1310,9 +1310,14 @@ public class Interaction extends AbstractInteraction<Interaction>
protected Response<?> getNextResponse() throws Exception
{
Response<?> response = super.getNextResponse();
+ if (response instanceof FrameDecodingError)
+ {
+ throw new IllegalStateException(String.format("Failed to decode response: %s",
+ ((FrameDecodingError) response).getError()));
+ }
if (response != null && response.getBody() instanceof FrameBody)
{
- _latestResponses.put(response.getBody().getClass(), (FrameBody)response.getBody());
+ _latestResponses.put(response.getBody().getClass(), (FrameBody) response.getBody());
}
return response;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org