You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kp...@apache.org on 2017/10/25 13:50:53 UTC
[1/5] qpid-interop-test git commit: QPIDIT-97: Further fixes and
updates for the release of 0.1.0
Repository: qpid-interop-test
Updated Branches:
refs/heads/master 84a22327e -> 4153bf172
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/4153bf17/utils/src/main/java/org/apache/qpid/qpid_interop_test/obj_util/JavaObjToBytes.java
----------------------------------------------------------------------
diff --git a/utils/src/main/java/org/apache/qpid/qpid_interop_test/obj_util/JavaObjToBytes.java b/utils/src/main/java/org/apache/qpid/qpid_interop_test/obj_util/JavaObjToBytes.java
deleted file mode 100644
index a16f0b1..0000000
--- a/utils/src/main/java/org/apache/qpid/qpid_interop_test/obj_util/JavaObjToBytes.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/**
- * 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.interop_test.obj_util;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectOutput;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-//import java.util.Arrays;
-
-public class JavaObjToBytes {
- String javaClassName = null;
- String ctorArgStr = null;
- Serializable obj = null;
-
- public JavaObjToBytes(String javaClassName, String ctorArgStr) {
- this.javaClassName = javaClassName;
- this.ctorArgStr = ctorArgStr;
- }
-
- public byte[] run() {
- createJavaObject();
- return serializeJavaOjbect();
- }
-
- protected void createJavaObject() {
- try {
- Class<?> c = Class.forName(this.javaClassName);
- if (this.javaClassName.compareTo("java.lang.Character") == 0) {
- Constructor ctor = c.getConstructor(char.class);
- if (this.ctorArgStr.length() == 1) {
- // Use first character of string
- obj = (Serializable)ctor.newInstance(this.ctorArgStr.charAt(0));
- } else if (this.ctorArgStr.length() == 4 || this.ctorArgStr.length() == 6) {
- // Format '\xNN' or '\xNNNN'
- obj = (Serializable)ctor.newInstance((char)Integer.parseInt(this.ctorArgStr.substring(2), 16));
- } else {
- throw new Exception("JavaObjToBytes.createJavaObject() Malformed char string: \"" + this.ctorArgStr + "\"");
- }
- } else {
- // Use string constructor
- Constructor ctor = c.getConstructor(String.class);
- obj = (Serializable)ctor.newInstance(this.ctorArgStr);
- }
- }
- catch (ClassNotFoundException e) {
- e.printStackTrace(System.out);
- }
- catch (NoSuchMethodException e) {
- e.printStackTrace(System.out);
- }
- catch (InstantiationException e) {
- e.printStackTrace(System.out);
- }
- catch (IllegalAccessException e) {
- e.printStackTrace(System.out);
- }
- catch (InvocationTargetException e) {
- e.printStackTrace(System.out);
- }
- catch (Exception e) {
- e.printStackTrace(System.out);
- }
- }
-
- protected byte[] serializeJavaOjbect() {
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- ObjectOutput out = null;
- try {
- out = new ObjectOutputStream(bos);
- out.writeObject(this.obj);
- return bos.toByteArray();
- } catch (IOException e) {
- e.printStackTrace(System.out);
- } finally {
- try {
- if (out != null) {
- out.close();
- }
- } catch (IOException e) {} // ignore
- try {
- bos.close();
- } catch (IOException e) {} // ignore
- }
- return null;
- }
-
- // ========= main ==========
-
- public static void main(String[] args) {
- if (args.length != 1) {
- System.out.println("JavaObjToBytes: Incorrect argument count");
- System.out.println("JavaObjToBytes: Expected argument: \"<java_class_name>:<ctor_arg_str>\"");
- System.exit(1);
- }
- int colonIndex = args[0].indexOf(":");
- if (colonIndex < 0) {
- System.out.println("Error: Incorect argument format: " + args[0]);
- System.exit(-1);
- }
- String javaClassName = args[0].substring(0, colonIndex);
- String ctorArgStr = args[0].substring(colonIndex+1);
- JavaObjToBytes jotb = new JavaObjToBytes(javaClassName, ctorArgStr);
- byte[] bytes = jotb.run();
- System.out.println(args[0]);
- for (byte b: bytes) {
- System.out.print(String.format("%02x", b));
- }
- System.out.println();
- }
-}
-
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[2/5] qpid-interop-test git commit: QPIDIT-97: Further fixes and
updates for the release of 0.1.0
Posted by kp...@apache.org.
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/4153bf17/shims/qpid-proton-cpp/src/not_yet_impl/jms_dtx_test/Sender.hpp
----------------------------------------------------------------------
diff --git a/shims/qpid-proton-cpp/src/not_yet_impl/jms_dtx_test/Sender.hpp b/shims/qpid-proton-cpp/src/not_yet_impl/jms_dtx_test/Sender.hpp
deleted file mode 100644
index 524ad63..0000000
--- a/shims/qpid-proton-cpp/src/not_yet_impl/jms_dtx_test/Sender.hpp
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *
- * 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.
- *
- */
-
-#ifndef SRC_QPIDIT_JMS_DTX_TEST_SENDER_HPP_
-#define SRC_QPIDIT_JMS_DTX_TEST_SENDER_HPP_
-
-#include <qpidit/JmsTestBase.hpp>
-
-namespace qpidit
-{
- namespace jms_dtx_test
- {
-
- class Sender : public qpidit::JmsTestBase
- {
- };
-
- } /* namespace jms_dtx_test */
-} /* namespace qpidit */
-
-#endif /* SRC_QPIDIT_JMS_DTX_TEST_SENDER_HPP_ */
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/4153bf17/shims/qpid-proton-cpp/src/not_yet_impl/jms_large_content_test/Receiver.cpp
----------------------------------------------------------------------
diff --git a/shims/qpid-proton-cpp/src/not_yet_impl/jms_large_content_test/Receiver.cpp b/shims/qpid-proton-cpp/src/not_yet_impl/jms_large_content_test/Receiver.cpp
deleted file mode 100644
index 2234564..0000000
--- a/shims/qpid-proton-cpp/src/not_yet_impl/jms_large_content_test/Receiver.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- *
- * 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.
- *
- */
-
-#include "qpidit/jms_large_content_test/Receiver.hpp"
-
-#include <stdlib.h> // exit()
-
-namespace qpidit
-{
- namespace jms_large_content_test
- {
- } /* namespace jms_large_content_test */
-} /* namespace qpidit */
-
-
-/*
- * --- main ---
- * Args: 1: Broker address (ip-addr:port)
- * 2: Queue name
- * ...
- */
-
-int main(int argc, char** argv) {
- exit(0);
-}
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/4153bf17/shims/qpid-proton-cpp/src/not_yet_impl/jms_large_content_test/Receiver.hpp
----------------------------------------------------------------------
diff --git a/shims/qpid-proton-cpp/src/not_yet_impl/jms_large_content_test/Receiver.hpp b/shims/qpid-proton-cpp/src/not_yet_impl/jms_large_content_test/Receiver.hpp
deleted file mode 100644
index 2b891f3..0000000
--- a/shims/qpid-proton-cpp/src/not_yet_impl/jms_large_content_test/Receiver.hpp
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *
- * 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.
- *
- */
-
-#ifndef SRC_QPIDIT_JMS_LARGE_CONTENT_TEST_RECEIVER_HPP_
-#define SRC_QPIDIT_JMS_LARGE_CONTENT_TEST_RECEIVER_HPP_
-
-#include <qpidit/JmsTestBase.hpp>
-
-namespace qpidit
-{
- namespace jms_large_content_test
- {
-
- class Receiver : public qpidit::JmsTestBase
- {
- };
-
- } /* namespace jms_large_content_test */
-} /* namespace qpidit */
-
-#endif /* SRC_QPIDIT_JMS_LARGE_CONTENT_TEST_RECEIVER_HPP_ */
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/4153bf17/shims/qpid-proton-cpp/src/not_yet_impl/jms_large_content_test/Sender.cpp
----------------------------------------------------------------------
diff --git a/shims/qpid-proton-cpp/src/not_yet_impl/jms_large_content_test/Sender.cpp b/shims/qpid-proton-cpp/src/not_yet_impl/jms_large_content_test/Sender.cpp
deleted file mode 100644
index c151006..0000000
--- a/shims/qpid-proton-cpp/src/not_yet_impl/jms_large_content_test/Sender.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- *
- * 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.
- *
- */
-
-#include "qpidit/jms_large_content_test/Sender.hpp"
-
-#include <stdlib.h> // exit()
-
-namespace qpidit
-{
- namespace jms_large_content_test
- {
- } /* namespace jms_large_content_test */
-} /* namespace qpidit */
-
-
-/*
- * --- main ---
- * Args: 1: Broker address (ip-addr:port)
- * 2: Queue name
- * ...
- */
-
-int main(int argc, char** argv) {
- exit(0);
-}
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/4153bf17/shims/qpid-proton-cpp/src/not_yet_impl/jms_large_content_test/Sender.hpp
----------------------------------------------------------------------
diff --git a/shims/qpid-proton-cpp/src/not_yet_impl/jms_large_content_test/Sender.hpp b/shims/qpid-proton-cpp/src/not_yet_impl/jms_large_content_test/Sender.hpp
deleted file mode 100644
index e45926b..0000000
--- a/shims/qpid-proton-cpp/src/not_yet_impl/jms_large_content_test/Sender.hpp
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *
- * 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.
- *
- */
-
-#ifndef SRC_QPIDIT_JMS_LARGE_CONTENT_TEST_SENDER_HPP_
-#define SRC_QPIDIT_JMS_LARGE_CONTENT_TEST_SENDER_HPP_
-
-#include <qpidit/JmsTestBase.hpp>
-
-namespace qpidit
-{
- namespace jms_large_content_test
- {
-
- class Sender : public qpidit::JmsTestBase
- {
- };
-
- } /* namespace jms_large_content_test */
-} /* namespace qpidit */
-
-#endif /* SRC_QPIDIT_JMS_LARGE_CONTENT_TEST_SENDER_HPP_ */
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/4153bf17/shims/qpid-proton-python/not_yet_impl/amqp_dtx_test/Receiver.py
----------------------------------------------------------------------
diff --git a/shims/qpid-proton-python/not_yet_impl/amqp_dtx_test/Receiver.py b/shims/qpid-proton-python/not_yet_impl/amqp_dtx_test/Receiver.py
deleted file mode 100755
index 76be21c..0000000
--- a/shims/qpid-proton-python/not_yet_impl/amqp_dtx_test/Receiver.py
+++ /dev/null
@@ -1,76 +0,0 @@
-#!/usr/bin/env python
-
-"""
-AMQP distributed transactions (DTX) test receiver shim for qpid-interop-test
-"""
-
-#
-# 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.
-#
-
-import os.path
-import sys
-from traceback import format_exc
-
-from proton.handlers import MessagingHandler
-from proton.reactor import Container
-
-class AmqpDtxTestReceiver(MessagingHandler):
- """
- Receiver shim for AMQP dtx test
- ...
- """
- def __init__(self, broker_url, queue_name):
- super(AmqpDtxTestReceiver, self).__init__()
- self.broker_url = broker_url
- self.queue_name = queue_name
- self.received_value_list = []
- self.expected = int('0')
- self.received = 0
-
- def get_received_value_list(self):
- """Return the received list of AMQP values"""
- return self.received_value_list
-
- def on_start(self, event):
- """Event callback for when the client starts"""
- connection = event.container.connect(url=self.broker_url, sasl_enabled=False)
- event.container.create_receiver(connection, source=self.queue_name)
-
- def on_message(self, event):
- """Event callback when a message is received by the client"""
- if event.message.id and event.message.id < self.received:
- return # ignore duplicate message
- if self.received < self.expected:
- pass # do something here
- if self.received >= self.expected:
- event.receiver.close()
- event.connection.close()
-
-# --- main ---
-# Args: 1: Broker address (ip-addr:port)
-# 2: Queue name
-# ...
-try:
- RECEIVER = AmqpDtxTestReceiver(sys.argv[1], sys.argv[2])
- Container(RECEIVER).run()
-except KeyboardInterrupt:
- pass
-except Exception as exc:
- print os.path.basename(sys.argv[0]), 'EXCEPTION', exc
- print format_exc()
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/4153bf17/shims/qpid-proton-python/not_yet_impl/amqp_dtx_test/Sender.py
----------------------------------------------------------------------
diff --git a/shims/qpid-proton-python/not_yet_impl/amqp_dtx_test/Sender.py b/shims/qpid-proton-python/not_yet_impl/amqp_dtx_test/Sender.py
deleted file mode 100755
index 24419b8..0000000
--- a/shims/qpid-proton-python/not_yet_impl/amqp_dtx_test/Sender.py
+++ /dev/null
@@ -1,95 +0,0 @@
-#!/usr/bin/env python
-
-"""
-AMQP distributed transactions (DTX) test sender shim for qpid-interop-test
-"""
-
-#
-# 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.
-#
-
-import os.path
-import sys
-from traceback import format_exc
-
-from proton.handlers import MessagingHandler
-from proton.reactor import Container
-
-class AmqpDtxTestSender(MessagingHandler):
- """
- Sender shim for AMQP dtx test
- ...
- """
- def __init__(self, broker_url, queue_name):
- super(AmqpDtxTestSender, self).__init__()
- self.broker_url = broker_url
- self.queue_name = queue_name
- self.test_value_list = []
- self.sent = 0
- self.confirmed = 0
- self.total = len(self.test_value_list)
-
- def on_start(self, event):
- """Event callback for when the client starts"""
- connection = event.container.connect(url=self.broker_url, sasl_enabled=False)
- event.container.create_sender(connection, target=self.queue_name)
-
- def on_sendable(self, event):
- """Event callback for when send credit is received, allowing the sending of messages"""
- if self.sent == 0:
- for test_value in self.test_value_list:
- if event.sender.credit:
- message = self.create_message(test_value)
- if message is not None:
- event.sender.send(message)
- self.sent += 1
- else:
- event.connection.close()
- return
-
- def create_message(self, test_value):
- """
- Creates a single message with the test value translated from its string representation to the appropriate
- AMQP value (set in self.amqp_type).
- """
- return None
-
- def on_accepted(self, event):
- """Event callback for when a sent message is accepted by the broker"""
- self.confirmed += 1
- if self.confirmed == self.total:
- event.connection.close()
-
- def on_disconnected(self, event):
- """Event callback for when the broker disconnects with the client"""
- self.sent = self.confirmed
-
-
-# --- main ---
-# Args: 1: Broker address (ip-addr:port)
-# 2: Queue name
-# ...
-try:
- SENDER = AmqpDtxTestSender(sys.argv[1], sys.argv[2])
- Container(SENDER).run()
-except KeyboardInterrupt:
- pass
-except Exception as exc:
- print os.path.basename(sys.argv[0]), 'EXCEPTION:', exc
- print format_exc()
-
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/4153bf17/shims/qpid-proton-python/not_yet_impl/amqp_features_test/Receiver.py
----------------------------------------------------------------------
diff --git a/shims/qpid-proton-python/not_yet_impl/amqp_features_test/Receiver.py b/shims/qpid-proton-python/not_yet_impl/amqp_features_test/Receiver.py
deleted file mode 100755
index 4ee96ba..0000000
--- a/shims/qpid-proton-python/not_yet_impl/amqp_features_test/Receiver.py
+++ /dev/null
@@ -1,96 +0,0 @@
-#!/usr/bin/env python
-
-"""
-AMQP features test receiver shim for qpid-interop-test
-"""
-
-#
-# 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.
-#
-
-from json import dumps
-import os.path
-import sys
-from traceback import format_exc
-
-from proton.handlers import MessagingHandler
-from proton.reactor import Container
-
-class AmqpFeaturesTestReceiver(MessagingHandler):
- """
- Reciver shim for AMQP dtx test
- ...
- """
- def __init__(self, broker_url, queue_name, test_type, num_expected_messages_str):
- super(AmqpFeaturesTestReceiver, self).__init__()
- self.broker_url = broker_url
- self.queue_name = queue_name
- self.test_type = test_type
- self.received_value_list = []
- self.expected = int(num_expected_messages_str)
- self.received = 0
- self.remote_properties = None
-
- def get_received_value_list(self):
- """Return the received list of AMQP values"""
- return self.received_value_list
-
- def get_remote_properties(self):
- """Return the remote (broker) properties"""
- return self.remote_properties
-
- def on_start(self, event):
- """Event callback for when the client starts"""
- connection = event.container.connect(url=self.broker_url, sasl_enabled=False)
- event.container.create_receiver(connection, source=self.queue_name)
-
- def on_connection_remote_open(self, event):
- """Callback for remote connection open"""
- self.remote_properties = event.connection.remote_properties
- if self.test_type == 'connection_property':
- event.connection.close()
-
- def on_message(self, event):
- """Event callback when a message is received by the client"""
- if event.message.id and event.message.id < self.received:
- return # ignore duplicate message
- if self.received < self.expected:
- pass # do something here
- if self.received >= self.expected:
- event.receiver.close()
- event.connection.close()
-
-# --- main ---
-# Args: 1: Broker address (ip-addr:port)
-# 2: Queue name
-# 3: Test type
-# 4: Number of expected messages
-try:
- RECEIVER = AmqpFeaturesTestReceiver(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4])
- Container(RECEIVER).run()
- print sys.argv[3]
- if (sys.argv[3] == 'connection_property'):
- print dumps(RECEIVER.get_remote_properties())
- else:
- print dumps(RECEIVER.get_received_value_list())
-
-except KeyboardInterrupt:
- pass
-except Exception as exc:
- print os.path.basename(sys.argv[0]), 'EXCEPTION', exc
- print format_exc()
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/4153bf17/shims/qpid-proton-python/not_yet_impl/amqp_features_test/Sender.py
----------------------------------------------------------------------
diff --git a/shims/qpid-proton-python/not_yet_impl/amqp_features_test/Sender.py b/shims/qpid-proton-python/not_yet_impl/amqp_features_test/Sender.py
deleted file mode 100755
index 7ac0114..0000000
--- a/shims/qpid-proton-python/not_yet_impl/amqp_features_test/Sender.py
+++ /dev/null
@@ -1,113 +0,0 @@
-#!/usr/bin/env python
-
-"""
-AMQP features test sender shim for qpid-interop-test
-"""
-
-#
-# 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.
-#
-
-from json import dumps, loads
-import os.path
-import sys
-from traceback import format_exc
-
-from proton.handlers import MessagingHandler
-from proton.reactor import Container
-
-class AmqpFeaturesTestSender(MessagingHandler):
- """
- Sender shim for AMQP dtx test
- ...
- """
- def __init__(self, broker_url, queue_name, test_type, test_args):
- super(AmqpFeaturesTestSender, self).__init__()
- self.broker_url = broker_url
- self.queue_name = queue_name
- self.test_type = test_type
- self.test_args = test_args
- self.test_value_list = []
- self.sent = 0
- self.confirmed = 0
- self.total = len(self.test_value_list)
- self.remote_properties = None
-
- def on_start(self, event):
- """Event callback for when the client starts"""
- connection = event.container.connect(url=self.broker_url, sasl_enabled=False)
- event.container.create_sender(connection, target=self.queue_name)
-
- def on_connection_remote_open(self, event):
- """Callback for remote connection open"""
- self.remote_properties = event.connection.remote_properties
- if self.test_type == 'connection_property':
- event.connection.close()
-
- def on_sendable(self, event):
- """Event callback for when send credit is received, allowing the sending of messages"""
- if self.sent == 0:
- for test_value in self.test_value_list:
- if event.sender.credit:
- message = self.create_message(test_value)
- if message is not None:
- event.sender.send(message)
- self.sent += 1
- else:
- event.connection.close()
- return
-
- def create_message(self, test_value):
- """
- Creates a single message with the test value translated from its string representation to the appropriate
- AMQP value (set in self.amqp_type).
- """
- return None
-
- def on_accepted(self, event):
- """Event callback for when a sent message is accepted by the broker"""
- self.confirmed += 1
- if self.confirmed == self.total:
- event.connection.close()
-
- def on_disconnected(self, event):
- """Event callback for when the broker disconnects with the client"""
- self.sent = self.confirmed
-
- def get_remote_properties(self):
- """Return the remote (broker) properties"""
- return self.remote_properties
-
-
-# --- main ---
-# Args: 1: Broker address (ip-addr:port)
-# 2: Queue name
-# 3: Test type
-# 4: Test args
-try:
- SENDER = AmqpFeaturesTestSender(sys.argv[1], sys.argv[2], sys.argv[3], loads(sys.argv[4]))
- Container(SENDER).run()
- print sys.argv[3]
- if sys.argv[3] == 'connection_property':
- print dumps(SENDER.get_remote_properties())
-except KeyboardInterrupt:
- pass
-except Exception as exc:
- print os.path.basename(sys.argv[0]), 'EXCEPTION:', exc
- print format_exc()
-
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/4153bf17/shims/qpid-proton-python/not_yet_impl/jms_dtx_test/Receiver.py
----------------------------------------------------------------------
diff --git a/shims/qpid-proton-python/not_yet_impl/jms_dtx_test/Receiver.py b/shims/qpid-proton-python/not_yet_impl/jms_dtx_test/Receiver.py
deleted file mode 100755
index e700106..0000000
--- a/shims/qpid-proton-python/not_yet_impl/jms_dtx_test/Receiver.py
+++ /dev/null
@@ -1,77 +0,0 @@
-#!/usr/bin/env python
-
-"""
-JMS distributed transactions (DTX) test receiver shim for qpid-interop-test
-"""
-
-#
-# 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.
-#
-
-import os.path
-import sys
-from traceback import format_exc
-
-from proton.handlers import MessagingHandler
-from proton.reactor import Container
-
-class JmsDtxTestReceiver(MessagingHandler):
- """
- Receiver shim for JMS dtx test
- ...
- """
- def __init__(self, broker_url, queue_name):
- super(JmsDtxTestReceiver, self).__init__()
- self.broker_url = broker_url
- self.queue_name = queue_name
- self.expected = int('0')
- self.received = 0
- self.received_value_list = []
-
- def get_received_value_list(self):
- """"Return the received list of values"""
- return self.received_value_list
-
- def on_start(self, event):
- """Event callback for when the client starts"""
- connection = event.container.connect(url=self.broker_url, sasl_enabled=False)
- event.container.create_receiver(connection, source=self.queue_name)
-
- def on_message(self, event):
- """Event callback when a message is received by the client"""
- if event.message.id and event.message.id < self.received:
- return # ignore duplicate message
- if self.received < self.expected:
- pass # do something here
- if self.received >= self.expected:
- event.receiver.close()
- event.connection.close()
-
-
-# --- main ---
-# Args: 1: Broker address (ip-addr:port)
-# 2: Queue name
-# ...
-try:
- RECEIVER = JmsDtxTestReceiver(sys.argv[1], sys.argv[2])
- Container(RECEIVER).run()
-except KeyboardInterrupt:
- pass
-except Exception as exc:
- print os.path.basename(sys.argv[0]), 'EXCEPTION', exc
- print format_exc()
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/4153bf17/shims/qpid-proton-python/not_yet_impl/jms_dtx_test/Sender.py
----------------------------------------------------------------------
diff --git a/shims/qpid-proton-python/not_yet_impl/jms_dtx_test/Sender.py b/shims/qpid-proton-python/not_yet_impl/jms_dtx_test/Sender.py
deleted file mode 100755
index 9e7aa0f..0000000
--- a/shims/qpid-proton-python/not_yet_impl/jms_dtx_test/Sender.py
+++ /dev/null
@@ -1,96 +0,0 @@
-#!/usr/bin/env python
-
-"""
-JMS distributed transactions (DTX) test sender shim for qpid-interop-test
-"""
-
-#
-# 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.
-#
-
-import os.path
-import sys
-from traceback import format_exc
-
-from proton.handlers import MessagingHandler
-from proton.reactor import Container
-
-class JmsDtxTestSender(MessagingHandler):
- """
- Sender shim for JMS dtx test
- ...
- """
- def __init__(self, broker_url, queue_name):
- super(JmsDtxTestSender, self).__init__()
- self.broker_url = broker_url
- self.queue_name = queue_name
- self.test_value_list = []
- self.sent = 0
- self.confirmed = 0
- self.total = 0
-
- def on_start(self, event):
- """Event callback for when the client starts"""
- connection = event.container.connect(url=self.broker_url, sasl_enabled=False)
- event.container.create_sender(connection, target=self.queue_name)
-
- def on_sendable(self, event):
- """Event callback for when send credit is received, allowing the sending of messages"""
- if self.sent == 0:
- for test_value in self.test_value_list:
- if event.sender.credit:
- message = self.create_message(test_value)
- if message is not None:
- event.sender.send(message)
- self.sent += 1
- else:
- event.connection.close()
- return
-
- def create_message(self, test_value):
- """
- Creates a single JMS message with the test value translated from its string representation to the appropriate
- value (set in self.amqp_type).
- """
- return None
-
- def on_accepted(self, event):
- """Event callback for when a sent message is accepted by the broker"""
- self.confirmed += 1
- if self.confirmed == self.total:
- event.connection.close()
-
- def on_disconnected(self, event):
- """Event callback for when the broker disconnects with the client"""
- self.sent = self.confirmed
-
-
-
-
-# --- main ---
-# Args: 1: Broker address (ip-addr:port)
-# 2: Queue name
-# ...
-try:
- SENDER = JmsDtxTestSender(sys.argv[1], sys.argv[2])
- Container(SENDER).run()
-except KeyboardInterrupt:
- pass
-except Exception as exc:
- print os.path.basename(sys.argv[0]), 'EXCEPTION:', exc
- print format_exc()
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/4153bf17/shims/qpid-proton-python/not_yet_impl/jms_large_content_test/Receiver.py
----------------------------------------------------------------------
diff --git a/shims/qpid-proton-python/not_yet_impl/jms_large_content_test/Receiver.py b/shims/qpid-proton-python/not_yet_impl/jms_large_content_test/Receiver.py
deleted file mode 100755
index e4942de..0000000
--- a/shims/qpid-proton-python/not_yet_impl/jms_large_content_test/Receiver.py
+++ /dev/null
@@ -1,77 +0,0 @@
-#!/usr/bin/env python
-
-"""
-JMS large content test receiver shim for qpid-interop-test
-"""
-
-#
-# 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.
-#
-
-import os.path
-import sys
-from traceback import format_exc
-
-from proton.handlers import MessagingHandler
-from proton.reactor import Container
-
-class JmsLargeContentTestReceiver(MessagingHandler):
- """
- Receiver shim for JMS large content test
- ...
- """
- def __init__(self, broker_url, queue_name):
- super(JmsLargeContentTestReceiver, self).__init__()
- self.broker_url = broker_url
- self.queue_name = queue_name
- self.expected = int('0')
- self.received = 0
- self.received_value_list = []
-
- def get_received_value_list(self):
- """"Return the received list of values"""
- return self.received_value_list
-
- def on_start(self, event):
- """Event callback for when the client starts"""
- connection = event.container.connect(url=self.broker_url, sasl_enabled=False)
- event.container.create_receiver(connection, source=self.queue_name)
-
- def on_message(self, event):
- """Event callback when a message is received by the client"""
- if event.message.id and event.message.id < self.received:
- return # ignore duplicate message
- if self.received < self.expected:
- pass # do something here
- if self.received >= self.expected:
- event.receiver.close()
- event.connection.close()
-
-
-# --- main ---
-# Args: 1: Broker address (ip-addr:port)
-# 2: Queue name
-# ...
-try:
- RECEIVER = JmsLargeContentTestReceiver(sys.argv[1], sys.argv[2])
- Container(RECEIVER).run()
-except KeyboardInterrupt:
- pass
-except Exception as exc:
- print os.path.basename(sys.argv[0]), 'EXCEPTION', exc
- print format_exc()
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/4153bf17/shims/qpid-proton-python/not_yet_impl/jms_large_content_test/Sender.py
----------------------------------------------------------------------
diff --git a/shims/qpid-proton-python/not_yet_impl/jms_large_content_test/Sender.py b/shims/qpid-proton-python/not_yet_impl/jms_large_content_test/Sender.py
deleted file mode 100755
index 076c55c..0000000
--- a/shims/qpid-proton-python/not_yet_impl/jms_large_content_test/Sender.py
+++ /dev/null
@@ -1,96 +0,0 @@
-#!/usr/bin/env python
-
-"""
-JMS large content test sender shim for qpid-interop-test
-"""
-
-#
-# 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.
-#
-
-import os.path
-import sys
-from traceback import format_exc
-
-from proton.handlers import MessagingHandler
-from proton.reactor import Container
-
-class JmsLargeContentTestSender(MessagingHandler):
- """
- Sender shim for JMS dtx test
- ...
- """
- def __init__(self, broker_url, queue_name):
- super(JmsLargeContentTestSender, self).__init__()
- self.broker_url = broker_url
- self.queue_name = queue_name
- self.test_value_list = []
- self.sent = 0
- self.confirmed = 0
- self.total = 0
-
- def on_start(self, event):
- """Event callback for when the client starts"""
- connection = event.container.connect(url=self.broker_url, sasl_enabled=False)
- event.container.create_sender(connection, target=self.queue_name)
-
- def on_sendable(self, event):
- """Event callback for when send credit is received, allowing the sending of messages"""
- if self.sent == 0:
- for test_value in self.test_value_list:
- if event.sender.credit:
- message = self.create_message(test_value)
- if message is not None:
- event.sender.send(message)
- self.sent += 1
- else:
- event.connection.close()
- return
-
- def create_message(self, test_value):
- """
- Creates a single JMS message with the test value translated from its string representation to the appropriate
- value (set in self.amqp_type).
- """
- return None
-
- def on_accepted(self, event):
- """Event callback for when a sent message is accepted by the broker"""
- self.confirmed += 1
- if self.confirmed == self.total:
- event.connection.close()
-
- def on_disconnected(self, event):
- """Event callback for when the broker disconnects with the client"""
- self.sent = self.confirmed
-
-
-
-
-# --- main ---
-# Args: 1: Broker address (ip-addr:port)
-# 2: Queue name
-# ...
-try:
- SENDER = JmsLargeContentTestSender(sys.argv[1], sys.argv[2])
- Container(SENDER).run()
-except KeyboardInterrupt:
- pass
-except Exception as exc:
- print os.path.basename(sys.argv[0]), 'EXCEPTION:', exc
- print format_exc()
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/4153bf17/src/python/not_yet_impl/amqp_dtx_test.py
----------------------------------------------------------------------
diff --git a/src/python/not_yet_impl/amqp_dtx_test.py b/src/python/not_yet_impl/amqp_dtx_test.py
deleted file mode 100644
index 7e4a644..0000000
--- a/src/python/not_yet_impl/amqp_dtx_test.py
+++ /dev/null
@@ -1,136 +0,0 @@
-#!/usr/bin/env python
-
-"""
-Module to test AMQP distributed transactions across different clients
-"""
-
-#
-# 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.
-#
-
-import argparse
-import sys
-import unittest
-
-#from itertools import product
-#from json import dumps
-from os import getenv, path
-#from time import mktime, time
-#from uuid import UUID, uuid4
-
-from proton import symbol
-#import qpid_interop_test.broker_properties
-import qpid_interop_test.shims
-#from qpid_interop_test.test_type_map import TestTypeMap
-
-# TODO: propose a sensible default when installation details are worked out
-QPID_INTEROP_TEST_HOME = getenv('QPID_INTEROP_TEST_HOME')
-if QPID_INTEROP_TEST_HOME is None:
- print 'ERROR: Environment variable QPID_INTEROP_TEST_HOME is not set'
- sys.exit(1)
-
-
-class AmqpDtxTestCase(unittest.TestCase):
- """
- Abstract base class for AMQP distributed transactions (DTX) test cases
- """
-
- def run_test(self):
- """
- Run this test by invoking the shim send method to send the test values, followed by the shim receive method
- to receive the values. Finally, compare the sent values with the received values.
- """
- pass
-
-
-# SHIM_MAP contains an instance of each client language shim that is to be tested as a part of this test. For
-# every shim in this list, a test is dynamically constructed which tests it against itself as well as every
-# other shim in the list.
-#
-# As new shims are added, add them into this map to have them included in the test cases.
-PROTON_CPP_RECEIVER_SHIM = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'qpid-proton-cpp', 'build', 'amqp_dtx_test',
- 'Receiver')
-PROTON_CPP_SENDER_SHIM = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'qpid-proton-cpp', 'build', 'amqp_dtx_test',
- 'Sender')
-PROTON_PYTHON_RECEIVER_SHIM = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'qpid-proton-python', 'src', 'amqp_dtx_test',
- 'Receiver.py')
-PROTON_PYTHON_SENDER_SHIM = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'qpid-proton-python', 'src', 'amqp_dtx_test',
- 'Sender.py')
-
-SHIM_MAP = {qpid_interop_test.shims.ProtonCppShim.NAME: \
- qpid_interop_test.shims.ProtonCppShim(PROTON_CPP_SENDER_SHIM, PROTON_CPP_RECEIVER_SHIM),
- qpid_interop_test.shims.ProtonPythonShim.NAME: \
- qpid_interop_test.shims.ProtonPythonShim(PROTON_PYTHON_SENDER_SHIM, PROTON_PYTHON_RECEIVER_SHIM),
- }
-
-
-class TestOptions(object):
- """
- Class controlling command-line arguments used to control the test.
- """
- def __init__(self):
- parser = argparse.ArgumentParser(description='Qpid-interop AMQP client interoparability test suite '
- 'for AMQP distrubuted (dtx) transactions')
- parser.add_argument('--broker', action='store', default='localhost:5672', metavar='BROKER:PORT',
- help='Broker against which to run test suite.')
- parser.add_argument('--exclude-shim', action='append', metavar='SHIM-NAME',
- help='Name of shim to exclude. Supported shims:\n%s' % sorted(SHIM_MAP.keys()))
- self.args = parser.parse_args()
-
-
-#--- Main program start ---
-
-if __name__ == '__main__':
-
- ARGS = TestOptions().args
- #print 'ARGS:', ARGS # debug
-
- # Connect to broker to find broker type
- CONNECTION_PROPS = qpid_interop_test.broker_properties.get_broker_properties(ARGS.sender)
- if CONNECTION_PROPS is None:
- print 'WARNING: Unable to get connection properties - unknown broker'
- BROKER = 'unknown'
- else:
- BROKER = CONNECTION_PROPS[symbol(u'product')] if symbol(u'product') in CONNECTION_PROPS \
- else '<product not found>'
- BROKER_VERSION = CONNECTION_PROPS[symbol(u'version')] if symbol(u'version') in CONNECTION_PROPS \
- else '<version not found>'
- BROKER_PLATFORM = CONNECTION_PROPS[symbol(u'platform')] if symbol(u'platform') in CONNECTION_PROPS \
- else '<platform not found>'
- print 'Test Broker: %s v.%s on %s' % (BROKER, BROKER_VERSION, BROKER_PLATFORM)
- print
- sys.stdout.flush()
-
- # TEST_CASE_CLASSES is a list that collects all the test classes that are constructed. One class is constructed
- # per AMQP type used as the key in map AmqpPrimitiveTypes.TYPE_MAP.
- TEST_CASE_CLASSES = []
-
- # TEST_SUITE is the final suite of tests that will be run and which contains all the dynamically created
- # type classes, each of which contains a test for the combinations of client shims
- TEST_SUITE = unittest.TestSuite()
-
- # Remove shims excluded from the command-line
- if ARGS.exclude_shim is not None:
- for shim in ARGS.exclude_shim:
- SHIM_MAP.pop(shim)
- # Create test classes dynamically
-
- # Finally, run all the dynamically created tests
- RES = unittest.TextTestRunner(verbosity=2).run(TEST_SUITE)
- if not RES.wasSuccessful():
- sys.exit(1) # Errors or failures present
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/4153bf17/src/python/not_yet_impl/amqp_features_test.py
----------------------------------------------------------------------
diff --git a/src/python/not_yet_impl/amqp_features_test.py b/src/python/not_yet_impl/amqp_features_test.py
deleted file mode 100644
index 83f140f..0000000
--- a/src/python/not_yet_impl/amqp_features_test.py
+++ /dev/null
@@ -1,195 +0,0 @@
-#!/usr/bin/env python
-
-"""
-Module to test AMQP features across different clients
-"""
-
-#
-# 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.
-#
-
-import argparse
-import sys
-import unittest
-
-from json import dumps
-from os import getenv, path
-
-from proton import symbol
-import qpid_interop_test.shims
-
-# TODO: propose a sensible default when installation details are worked out
-QPID_INTEROP_TEST_HOME = getenv('QPID_INTEROP_TEST_HOME')
-if QPID_INTEROP_TEST_HOME is None:
- print 'ERROR: Environment variable QPID_INTEROP_TEST_HOME is not set'
- sys.exit(1)
-
-
-class AmqpFeaturesTestCase(unittest.TestCase):
- """
- Abstract base class for AMQP message features test cases
- """
-
- def run_test(self, sender_addr, receiver_addr, test_type, send_shim, receive_shim):
- """
- Run this test by invoking the shim send method to send the test values, followed by the shim receive method
- to receive the values. Finally, compare the sent values with the received values.
- """
- send_queue_name = 'jms.queue.qpid-interop.amqp_features_test.%s' % send_shim.NAME
- receive_queue_name = 'jms.queue.qpid-interop.amqp_features_test.%s' % receive_shim.NAME
-
- # Start the receive shim first (for queueless brokers/dispatch)
- receiver = receive_shim.create_receiver(receiver_addr, receive_queue_name, test_type, '0')
- receiver.start()
-
- # Start the send shim
- sender = send_shim.create_sender(sender_addr, send_queue_name, test_type, dumps([None]))
- sender.start()
-
- # Wait for both shims to finish
- sender.join_or_kill(qpid_interop_test.shims.THREAD_TIMEOUT)
- receiver.join_or_kill(qpid_interop_test.shims.THREAD_TIMEOUT)
-
- if test_type == 'connection_property':
- self.check_connection_property_test_results(sender.get_return_object(), receiver.get_return_object())
-
- def check_connection_property_test_results(self, sender_return_obj, receiver_return_obj):
- """Check received connection property for pass/fail of test"""
- self.check_connection_properties(sender_return_obj[1], 'sender')
- self.check_connection_properties(receiver_return_obj[1], 'receiver')
-
- def check_connection_properties(self, connection_properties, source):
- """Check an individual connection property for pass/fail"""
- keys = connection_properties.keys()
- if 'product' not in keys:
- self.fail('Broker connection properties (from %s) missing "product" key' % source)
- if 'version' not in keys:
- self.fail('Broker connection properties (from %s) missing "version" key' % source)
- for key in keys:
- self.assertTrue(len(connection_properties[key]) > 0, msg='Property "%s" (from %s) is empty' % (key, source))
-
-
-def create_connection_property_test_class(send_shim, receive_shim):
- """
- Class factory function which creates new subclasses to AmqpFeaturesTestCase.
- """
-
- def __repr__(self):
- """Print the class name"""
- return self.__class__.__name__
-
- def add_test_method(cls, send_shim, receive_shim):
- """Function which creates a new test method in class cls"""
-
- def inner_test_method(self):
- self.run_test(self.sender_addr, self.receiver_addr, 'connection_property', send_shim, receive_shim)
-
- inner_test_method.__name__ = 'test_connection_properties_%s->%s' % (send_shim.NAME, receive_shim.NAME)
- setattr(cls, inner_test_method.__name__, inner_test_method)
-
- class_name = 'ConnectionPropertyTestCase'
- class_dict = {'__name__': class_name,
- '__repr__': __repr__,
- '__doc__': 'Test case for AMQP connection properties',
- 'sender_addr': ARGS.sender,
- 'receiver_addr': ARGS.receiver}
- new_class = type(class_name, (AmqpFeaturesTestCase,), class_dict)
- add_test_method(new_class, send_shim, receive_shim)
- return new_class
-
-# SHIM_MAP contains an instance of each client language shim that is to be tested as a part of this test. For
-# every shim in this list, a test is dynamically constructed which tests it against itself as well as every
-# other shim in the list.
-#
-# As new shims are added, add them into this map to have them included in the test cases.
-PROTON_CPP_RECEIVER_SHIM = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'qpid-proton-cpp', 'build', 'amqp_features_test',
- 'Receiver')
-PROTON_CPP_SENDER_SHIM = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'qpid-proton-cpp', 'build', 'amqp_features_test',
- 'Sender')
-PROTON_PYTHON_RECEIVER_SHIM = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'qpid-proton-python', 'src',
- 'amqp_features_test', 'Receiver.py')
-PROTON_PYTHON_SENDER_SHIM = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'qpid-proton-python', 'src',
- 'amqp_features_test', 'Sender.py')
-
-SHIM_MAP = {#qpid_interop_test.shims.ProtonCppShim.NAME: \
- # qpid_interop_test.shims.ProtonCppShim(PROTON_CPP_SENDER_SHIM, PROTON_CPP_RECEIVER_SHIM),
- qpid_interop_test.shims.ProtonPythonShim.NAME: \
- qpid_interop_test.shims.ProtonPythonShim(PROTON_PYTHON_SENDER_SHIM, PROTON_PYTHON_RECEIVER_SHIM),
- }
-
-
-class TestOptions(object):
- """
- Class controlling command-line arguments used to control the test.
- """
- def __init__(self):
- parser = argparse.ArgumentParser(description='Qpid-interop AMQP client interoparability test suite '
- 'for AMQP messaging features')
- parser.add_argument('--sender', action='store', default='localhost:5672', metavar='IP-ADDR:PORT',
- help='Node to which test suite will send messages.')
- parser.add_argument('--receiver', action='store', default='localhost:5672', metavar='IP-ADDR:PORT',
- help='Node from which test suite will receive messages.')
- parser.add_argument('--exclude-shim', action='append', metavar='SHIM-NAME',
- help='Name of shim to exclude. Supported shims:\n%s' % sorted(SHIM_MAP.keys()))
- self.args = parser.parse_args()
-
-
-#--- Main program start ---
-
-if __name__ == '__main__':
-
- ARGS = TestOptions().args
- #print 'ARGS:', ARGS # debug
-
- # Connect to broker to find broker type
- CONNECTION_PROPS = qpid_interop_test.broker_properties.get_broker_properties(ARGS.sender)
- if CONNECTION_PROPS is None:
- print 'WARNING: Unable to get connection properties - unknown broker'
- BROKER = 'unknown'
- else:
- BROKER = CONNECTION_PROPS[symbol(u'product')] if symbol(u'product') in CONNECTION_PROPS \
- else '<product not found>'
- BROKER_VERSION = CONNECTION_PROPS[symbol(u'version')] if symbol(u'version') in CONNECTION_PROPS \
- else '<version not found>'
- BROKER_PLATFORM = CONNECTION_PROPS[symbol(u'platform')] if symbol(u'platform') in CONNECTION_PROPS \
- else '<platform not found>'
- print 'Test Broker: %s v.%s on %s' % (BROKER, BROKER_VERSION, BROKER_PLATFORM)
- print
- sys.stdout.flush()
-
- # TEST_CASE_CLASSES is a list that collects all the test classes that are constructed. One class is constructed
- # per AMQP type used as the key in map AmqpPrimitiveTypes.TYPE_MAP.
- TEST_CASE_CLASSES = []
-
- # TEST_SUITE is the final suite of tests that will be run and which contains all the dynamically created
- # type classes, each of which contains a test for the combinations of client shims
- TEST_SUITE = unittest.TestSuite()
-
- # Remove shims excluded from the command-line
- if ARGS.exclude_shim is not None:
- for shim in ARGS.exclude_shim:
- SHIM_MAP.pop(shim)
- # Create test classes dynamically
- for shim_name in SHIM_MAP.keys():
- test_case_class = create_connection_property_test_class(SHIM_MAP[shim_name], SHIM_MAP[shim_name])
- TEST_SUITE.addTest(unittest.makeSuite(test_case_class))
-
- # Finally, run all the dynamically created tests
- RES = unittest.TextTestRunner(verbosity=2).run(TEST_SUITE)
- if not RES.wasSuccessful():
- sys.exit(1) # Errors or failures present
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/4153bf17/src/python/not_yet_impl/jms_dtx_test.py
----------------------------------------------------------------------
diff --git a/src/python/not_yet_impl/jms_dtx_test.py b/src/python/not_yet_impl/jms_dtx_test.py
deleted file mode 100644
index fd998a7..0000000
--- a/src/python/not_yet_impl/jms_dtx_test.py
+++ /dev/null
@@ -1,146 +0,0 @@
-#!/usr/bin/env python
-
-"""
-Module to test JMS distributed transactions (DTX) across different JMS clients
-"""
-
-#
-# 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.
-#
-
-import argparse
-import sys
-import unittest
-
-#from itertools import product
-#from json import dumps
-from os import getenv, path
-
-from proton import symbol
-#import qpid_interop_test.broker_properties
-import qpid_interop_test.shims
-#from qpid_interop_test.test_type_map import TestTypeMap
-
-
-# TODO: propose a sensible default when installation details are worked out
-QPID_INTEROP_TEST_HOME = getenv('QPID_INTEROP_TEST_HOME')
-if QPID_INTEROP_TEST_HOME is None:
- print 'ERROR: Environment variable QPID_INTEROP_TEST_HOME is not set'
- sys.exit(1)
-MAVEN_REPO_PATH = getenv('MAVEN_REPO_PATH', path.join(getenv('HOME'), '.m2', 'repository'))
-
-
-
-class JmsDtxTypeTestCase(unittest.TestCase):
- """
- Abstract base class for JMS DTX test cases
- """
-
- def run_test(self, broker_addr, jms_message_type, test_values, send_shim, receive_shim):
- """
- Run this test by invoking the shim send method to send the test values, followed by the shim receive method
- to receive the values. Finally, compare the sent values with the received values.
- """
- pass
-
-
-PROTON_CPP_RECEIVER_SHIM = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'qpid-proton-cpp', 'build',
- 'jms_dtx_test', 'Receiver')
-PROTON_CPP_SENDER_SHIM = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'qpid-proton-cpp', 'build',
- 'jms_dtx_test', 'Sender')
-PROTON_PYTHON_RECEIVER_SHIM = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'qpid-proton-python', 'src',
- 'jms_dtx_test', 'Receiver.py')
-PROTON_PYTHON_SENDER_SHIM = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'qpid-proton-python', 'src',
- 'jms_dtx_test', 'Sender.py')
-QIT_JMS_CLASSPATH_FILE = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'qpid-jms', 'cp.txt')
-with open(QIT_JMS_CLASSPATH_FILE, 'r') as classpath_file:
- QIT_JMS_CLASSPATH = classpath_file.read()
-QPID_JMS_RECEIVER_SHIM = 'org.apache.qpid.interop_test.jms_dtx_test.Receiver'
-QPID_JMS_SENDER_SHIM = 'org.apache.qpid.interop_test.jms_dtx_test.Sender'
-
-# SHIM_MAP contains an instance of each client language shim that is to be tested as a part of this test. For
-# every shim in this list, a test is dynamically constructed which tests it against itself as well as every
-# other shim in the list.
-#
-# As new shims are added, add them into this map to have them included in the test cases.
-SHIM_MAP = {qpid_interop_test.shims.ProtonCppShim.NAME: \
- qpid_interop_test.shims.ProtonCppShim(PROTON_CPP_SENDER_SHIM, PROTON_CPP_RECEIVER_SHIM),
- qpid_interop_test.shims.ProtonPythonShim.NAME: \
- qpid_interop_test.shims.ProtonPythonShim(PROTON_PYTHON_SENDER_SHIM, PROTON_PYTHON_RECEIVER_SHIM),
- qpid_interop_test.shims.QpidJmsShim.NAME: \
- qpid_interop_test.shims.QpidJmsShim(QIT_JMS_CLASSPATH, QPID_JMS_SENDER_SHIM, QPID_JMS_RECEIVER_SHIM),
- }
-
-# TODO: Complete the test options to give fine control over running tests
-class TestOptions(object):
- """
- Class controlling command-line arguments used to control the test.
- """
- def __init__(self,):
- parser = argparse.ArgumentParser(description='Qpid-interop AMQP client interoparability test suite '
- 'for JMS distrubuted (dtx) transactions')
- parser.add_argument('--sender', action='store', default='localhost:5672', metavar='IP-ADDR:PORT',
- help='Node to which test suite will send messages.')
- parser.add_argument('--receiver', action='store', default='localhost:5672', metavar='IP-ADDR:PORT',
- help='Node from which test suite will receive messages.')
- parser.add_argument('--exclude-shim', action='append', metavar='SHIM-NAME',
- help='Name of shim to exclude. Supported shims:\n%s' % sorted(SHIM_MAP.keys()))
- self.args = parser.parse_args()
-
-
-#--- Main program start ---
-
-if __name__ == '__main__':
-
- ARGS = TestOptions().args
- #print 'ARGS:', ARGS # debug
-
- # Connect to broker to find broker type
- CONNECTION_PROPS = qpid_interop_test.broker_properties.get_broker_properties(ARGS.sender)
- if CONNECTION_PROPS is None:
- print 'WARNING: Unable to get connection properties - unknown broker'
- BROKER = 'unknown'
- else:
- BROKER = CONNECTION_PROPS[symbol(u'product')] if symbol(u'product') in CONNECTION_PROPS \
- else '<product not found>'
- BROKER_VERSION = CONNECTION_PROPS[symbol(u'version')] if symbol(u'version') in CONNECTION_PROPS \
- else '<version not found>'
- BROKER_PLATFORM = CONNECTION_PROPS[symbol(u'platform')] if symbol(u'platform') in CONNECTION_PROPS \
- else '<platform not found>'
- print 'Test Broker: %s v.%s on %s' % (BROKER, BROKER_VERSION, BROKER_PLATFORM)
- print
- sys.stdout.flush()
-
- # TEST_CASE_CLASSES is a list that collects all the test classes that are constructed. One class is constructed
- # per AMQP type used as the key in map JmsMessageTypes.TYPE_MAP.
- TEST_CASE_CLASSES = []
-
- # TEST_SUITE is the final suite of tests that will be run and which contains all the dynamically created
- # type classes, each of which contains a test for the combinations of client shims
- TEST_SUITE = unittest.TestSuite()
-
- # Remove shims excluded from the command-line
- if ARGS.exclude_shim is not None:
- for shim in ARGS.exclude_shim:
- SHIM_MAP.pop(shim)
- # Create test classes dynamically
-
- # Finally, run all the dynamically created tests
- RES = unittest.TextTestRunner(verbosity=2).run(TEST_SUITE)
- if not RES.wasSuccessful():
- sys.exit(1)
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/4153bf17/src/python/not_yet_impl/jms_large_content_test.py
----------------------------------------------------------------------
diff --git a/src/python/not_yet_impl/jms_large_content_test.py b/src/python/not_yet_impl/jms_large_content_test.py
deleted file mode 100644
index 6387060..0000000
--- a/src/python/not_yet_impl/jms_large_content_test.py
+++ /dev/null
@@ -1,144 +0,0 @@
-#!/usr/bin/env python
-
-"""
-Module to test JMS messages containing large content (either message bodies or properties) across different JMS clients
-"""
-
-#
-# 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.
-#
-
-import argparse
-import sys
-import unittest
-
-#from itertools import product
-#from json import dumps
-from os import getenv, path
-
-from proton import symbol
-#import qpid_interop_test.broker_properties
-import qpid_interop_test.shims
-#from qpid_interop_test.test_type_map import TestTypeMap
-
-
-# TODO: propose a sensible default when installation details are worked out
-QPID_INTEROP_TEST_HOME = getenv('QPID_INTEROP_TEST_HOME')
-if QPID_INTEROP_TEST_HOME is None:
- print 'ERROR: Environment variable QPID_INTEROP_TEST_HOME is not set'
- sys.exit(1)
-MAVEN_REPO_PATH = getenv('MAVEN_REPO_PATH', path.join(getenv('HOME'), '.m2', 'repository'))
-
-
-
-class JmsLargeContentTypeTestCase(unittest.TestCase):
- """
- Abstract base class for JMS large content test cases
- """
-
- def run_test(self, broker_addr, jms_message_type, test_values, send_shim, receive_shim):
- """
- Run this test by invoking the shim send method to send the test values, followed by the shim receive method
- to receive the values. Finally, compare the sent values with the received values.
- """
- pass
-
-
-PROTON_CPP_RECEIVER_SHIM = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'qpid-proton-cpp', 'build',
- 'jms_large_content_test', 'Receiver')
-PROTON_CPP_SENDER_SHIM = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'qpid-proton-cpp', 'build',
- 'jms_large_content_test', 'Sender')
-PROTON_PYTHON_RECEIVER_SHIM = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'qpid-proton-python', 'src',
- 'jms_large_content_test', 'Receiver.py')
-PROTON_PYTHON_SENDER_SHIM = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'qpid-proton-python', 'src',
- 'jms_large_content_test', 'Sender.py')
-QIT_JMS_CLASSPATH_FILE = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'qpid-jms', 'cp.txt')
-with open(QIT_JMS_CLASSPATH_FILE, 'r') as classpath_file:
- QIT_JMS_CLASSPATH = classpath_file.read()
-QPID_JMS_RECEIVER_SHIM = 'org.apache.qpid.interop_test.jms_large_content_test.Receiver'
-QPID_JMS_SENDER_SHIM = 'org.apache.qpid.interop_test.jms_large_content_test.Sender'
-
-# SHIM_MAP contains an instance of each client language shim that is to be tested as a part of this test. For
-# every shim in this list, a test is dynamically constructed which tests it against itself as well as every
-# other shim in the list.
-#
-# As new shims are added, add them into this map to have them included in the test cases.
-SHIM_MAP = {qpid_interop_test.shims.ProtonCppShim.NAME: \
- qpid_interop_test.shims.ProtonCppShim(PROTON_CPP_SENDER_SHIM, PROTON_CPP_RECEIVER_SHIM),
- qpid_interop_test.shims.ProtonPythonShim.NAME: \
- qpid_interop_test.shims.ProtonPythonShim(PROTON_PYTHON_SENDER_SHIM, PROTON_PYTHON_RECEIVER_SHIM),
- qpid_interop_test.shims.QpidJmsShim.NAME: \
- qpid_interop_test.shims.QpidJmsShim(QIT_JMS_CLASSPATH, QPID_JMS_SENDER_SHIM, QPID_JMS_RECEIVER_SHIM),
- }
-
-# TODO: Complete the test options to give fine control over running tests
-class TestOptions(object):
- """
- Class controlling command-line arguments used to control the test.
- """
- def __init__(self,):
- parser = argparse.ArgumentParser(description='Qpid-interop AMQP client interoparability test suite '
- 'for JMS messages containing large content')
- parser.add_argument('--broker', action='store', default='localhost:5672', metavar='BROKER:PORT',
- help='Broker against which to run test suite.')
- parser.add_argument('--exclude-shim', action='append', metavar='SHIM-NAME',
- help='Name of shim to exclude. Supported shims:\n%s' % sorted(SHIM_MAP.keys()))
- self.args = parser.parse_args()
-
-
-#--- Main program start ---
-
-if __name__ == '__main__':
-
- ARGS = TestOptions().args
- #print 'ARGS:', ARGS # debug
-
- # Connect to broker to find broker type
- CONNECTION_PROPS = qpid_interop_test.broker_properties.get_broker_properties(ARGS.broker)
- if CONNECTION_PROPS is None:
- print 'WARNING: Unable to get connection properties - unknown broker'
- BROKER = 'unknown'
- else:
- BROKER = CONNECTION_PROPS[symbol(u'product')] if symbol(u'product') in CONNECTION_PROPS \
- else '<product not found>'
- BROKER_VERSION = CONNECTION_PROPS[symbol(u'version')] if symbol(u'version') in CONNECTION_PROPS \
- else '<version not found>'
- BROKER_PLATFORM = CONNECTION_PROPS[symbol(u'platform')] if symbol(u'platform') in CONNECTION_PROPS \
- else '<platform not found>'
- print 'Test Broker: %s v.%s on %s' % (BROKER, BROKER_VERSION, BROKER_PLATFORM)
- print
- sys.stdout.flush()
-
- # TEST_CASE_CLASSES is a list that collects all the test classes that are constructed. One class is constructed
- # per AMQP type used as the key in map JmsMessageTypes.TYPE_MAP.
- TEST_CASE_CLASSES = []
-
- # TEST_SUITE is the final suite of tests that will be run and which contains all the dynamically created
- # type classes, each of which contains a test for the combinations of client shims
- TEST_SUITE = unittest.TestSuite()
-
- # Remove shims excluded from the command-line
- if ARGS.exclude_shim is not None:
- for shim in ARGS.exclude_shim:
- SHIM_MAP.pop(shim)
- # Create test classes dynamically
-
- # Finally, run all the dynamically created tests
- RES = unittest.TextTestRunner(verbosity=2).run(TEST_SUITE)
- if not RES.wasSuccessful():
- sys.exit(1)
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/4153bf17/src/python/qpid_interop_test/amqp_types_test.py
----------------------------------------------------------------------
diff --git a/src/python/qpid_interop_test/amqp_types_test.py b/src/python/qpid_interop_test/amqp_types_test.py
index c54c977..9971c2c 100755
--- a/src/python/qpid_interop_test/amqp_types_test.py
+++ b/src/python/qpid_interop_test/amqp_types_test.py
@@ -259,9 +259,6 @@ class AmqpPrimitiveTypes(TestTypeMap):
# This section contains tests that should be skipped because of know issues that would cause the test to fail.
# As the issues are resolved, these should be removed.
BROKER_SKIP = {
- 'null': {'ActiveMQ': 'Null type not sent in Proton Python binding: PROTON-1091',
- 'qpid-cpp': 'Null type not sent in Proton Python binding: PROTON-1091',
- 'qpid-dispatch-router': 'router with qpid or activemq broker',},
'decimal32': {'ActiveMQ': 'decimal32 and decimal64 sent byte reversed: PROTON-1160',
'qpid-cpp': 'decimal32 not supported on qpid-cpp broker: QPIDIT-5, QPID-6328',
'apache-activemq-artemis': 'decimal32 and decimal64 sent byte reversed: PROTON-1160',
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/4153bf17/src/python/qpid_interop_test/jms_hdrs_props_test.py
----------------------------------------------------------------------
diff --git a/src/python/qpid_interop_test/jms_hdrs_props_test.py b/src/python/qpid_interop_test/jms_hdrs_props_test.py
index b436162..0f3b16d 100755
--- a/src/python/qpid_interop_test/jms_hdrs_props_test.py
+++ b/src/python/qpid_interop_test/jms_hdrs_props_test.py
@@ -637,8 +637,8 @@ if __name__ == '__main__':
else:
QIT_JMS_CLASSPATH = path.join(QIT_TEST_SHIM_HOME, 'qpid-jms',
'qpid-interop-test-jms-shim-%s-jar-with-dependencies.jar' % QPID_JMS_SHIM_VER)
- QPID_JMS_RECEIVER_SHIM = 'org.apache.qpid.qpid_interop_test.jms_hdrs_props_test.Receiver'
- QPID_JMS_SENDER_SHIM = 'org.apache.qpid.qpid_interop_test.jms_hdrs_props_test.Sender'
+ QPID_JMS_RECEIVER_SHIM = 'org.apache.qpid.interop_test.jms_hdrs_props_test.Receiver'
+ QPID_JMS_SENDER_SHIM = 'org.apache.qpid.interop_test.jms_hdrs_props_test.Sender'
# SHIM_MAP contains an instance of each client language shim that is to be tested as a part of this test. For
# every shim in this list, a test is dynamically constructed which tests it against itself as well as every
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/4153bf17/src/python/qpid_interop_test/jms_messages_test.py
----------------------------------------------------------------------
diff --git a/src/python/qpid_interop_test/jms_messages_test.py b/src/python/qpid_interop_test/jms_messages_test.py
index 6a6f630..8fd6b48 100755
--- a/src/python/qpid_interop_test/jms_messages_test.py
+++ b/src/python/qpid_interop_test/jms_messages_test.py
@@ -344,8 +344,8 @@ if __name__ == '__main__':
else:
QIT_JMS_CLASSPATH = path.join(QIT_TEST_SHIM_HOME, 'qpid-jms',
'qpid-interop-test-jms-shim-%s-jar-with-dependencies.jar' % QPID_JMS_SHIM_VER)
- QPID_JMS_RECEIVER_SHIM = 'org.apache.qpid.qpid_interop_test.jms_messages_test.Receiver'
- QPID_JMS_SENDER_SHIM = 'org.apache.qpid.qpid_interop_test.jms_messages_test.Sender'
+ QPID_JMS_RECEIVER_SHIM = 'org.apache.qpid.interop_test.jms_messages_test.Receiver'
+ QPID_JMS_SENDER_SHIM = 'org.apache.qpid.interop_test.jms_messages_test.Sender'
# SHIM_MAP contains an instance of each client language shim that is to be tested as a part of this test. For
# every shim in this list, a test is dynamically constructed which tests it against itself as well as every
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/4153bf17/utils/src/main/java/org/apache/qpid/interop_test/obj_util/BytesToJavaObj.java
----------------------------------------------------------------------
diff --git a/utils/src/main/java/org/apache/qpid/interop_test/obj_util/BytesToJavaObj.java b/utils/src/main/java/org/apache/qpid/interop_test/obj_util/BytesToJavaObj.java
new file mode 100644
index 0000000..0d97333
--- /dev/null
+++ b/utils/src/main/java/org/apache/qpid/interop_test/obj_util/BytesToJavaObj.java
@@ -0,0 +1,83 @@
+/**
+ * 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.interop_test.obj_util;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectInputStream;
+import java.io.Serializable;
+
+public class BytesToJavaObj {
+ String hexObjStr = null;
+ Serializable obj = null;
+
+ public BytesToJavaObj(String hexObjStr) {
+ this.hexObjStr = hexObjStr;
+ }
+
+ public String run() {
+ byte[] bytes = hexStrToByteArray(this.hexObjStr);
+ this.obj = byteArrayToObject(bytes);
+ if (this.obj != null) {
+ return this.obj.getClass().getName() + ":" + this.obj.toString();
+ }
+ return "<null>";
+ }
+
+ protected Serializable byteArrayToObject(byte[] bytes) {
+ ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
+ ObjectInput in = null;
+ try {
+ in = new ObjectInputStream(bis);
+ return (Serializable) in.readObject();
+ } catch (ClassNotFoundException e) {
+ e.printStackTrace(System.out);
+ } catch (IOException e) {
+ e.printStackTrace(System.out);
+ } finally {
+ try {
+ bis.close();
+ } catch (IOException e) {} // ignore
+ try {
+ in.close();
+ } catch (IOException e) {} // ignore
+ }
+ return null;
+ }
+
+ protected byte[] hexStrToByteArray(String hexStr) {
+ int len = hexStr.length();
+ byte[] data = new byte[len / 2];
+ for(int i=0; i<len; i+=2) {
+ data[i/2] = (byte)((Character.digit(hexStr.charAt(i), 16) << 4) + Character.digit(hexStr.charAt(i+1), 16));
+ }
+ return data;
+ }
+
+ // ========= main ==========
+
+ public static void main(String[] args) {
+ if (args.length != 1) {
+ System.out.println("BytesToJavaObj: Incorrect argument count");
+ System.out.println("BytesToJavaObj: Expected argument: \"<java_serialized_obj_str_hex>\"");
+ System.exit(1);
+ }
+ BytesToJavaObj btjo = new BytesToJavaObj(args[0]);
+ System.out.println(btjo.run());
+ }
+}
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/4153bf17/utils/src/main/java/org/apache/qpid/interop_test/obj_util/JavaObjToBytes.java
----------------------------------------------------------------------
diff --git a/utils/src/main/java/org/apache/qpid/interop_test/obj_util/JavaObjToBytes.java b/utils/src/main/java/org/apache/qpid/interop_test/obj_util/JavaObjToBytes.java
new file mode 100644
index 0000000..a16f0b1
--- /dev/null
+++ b/utils/src/main/java/org/apache/qpid/interop_test/obj_util/JavaObjToBytes.java
@@ -0,0 +1,129 @@
+/**
+ * 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.interop_test.obj_util;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectOutput;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+//import java.util.Arrays;
+
+public class JavaObjToBytes {
+ String javaClassName = null;
+ String ctorArgStr = null;
+ Serializable obj = null;
+
+ public JavaObjToBytes(String javaClassName, String ctorArgStr) {
+ this.javaClassName = javaClassName;
+ this.ctorArgStr = ctorArgStr;
+ }
+
+ public byte[] run() {
+ createJavaObject();
+ return serializeJavaOjbect();
+ }
+
+ protected void createJavaObject() {
+ try {
+ Class<?> c = Class.forName(this.javaClassName);
+ if (this.javaClassName.compareTo("java.lang.Character") == 0) {
+ Constructor ctor = c.getConstructor(char.class);
+ if (this.ctorArgStr.length() == 1) {
+ // Use first character of string
+ obj = (Serializable)ctor.newInstance(this.ctorArgStr.charAt(0));
+ } else if (this.ctorArgStr.length() == 4 || this.ctorArgStr.length() == 6) {
+ // Format '\xNN' or '\xNNNN'
+ obj = (Serializable)ctor.newInstance((char)Integer.parseInt(this.ctorArgStr.substring(2), 16));
+ } else {
+ throw new Exception("JavaObjToBytes.createJavaObject() Malformed char string: \"" + this.ctorArgStr + "\"");
+ }
+ } else {
+ // Use string constructor
+ Constructor ctor = c.getConstructor(String.class);
+ obj = (Serializable)ctor.newInstance(this.ctorArgStr);
+ }
+ }
+ catch (ClassNotFoundException e) {
+ e.printStackTrace(System.out);
+ }
+ catch (NoSuchMethodException e) {
+ e.printStackTrace(System.out);
+ }
+ catch (InstantiationException e) {
+ e.printStackTrace(System.out);
+ }
+ catch (IllegalAccessException e) {
+ e.printStackTrace(System.out);
+ }
+ catch (InvocationTargetException e) {
+ e.printStackTrace(System.out);
+ }
+ catch (Exception e) {
+ e.printStackTrace(System.out);
+ }
+ }
+
+ protected byte[] serializeJavaOjbect() {
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ ObjectOutput out = null;
+ try {
+ out = new ObjectOutputStream(bos);
+ out.writeObject(this.obj);
+ return bos.toByteArray();
+ } catch (IOException e) {
+ e.printStackTrace(System.out);
+ } finally {
+ try {
+ if (out != null) {
+ out.close();
+ }
+ } catch (IOException e) {} // ignore
+ try {
+ bos.close();
+ } catch (IOException e) {} // ignore
+ }
+ return null;
+ }
+
+ // ========= main ==========
+
+ public static void main(String[] args) {
+ if (args.length != 1) {
+ System.out.println("JavaObjToBytes: Incorrect argument count");
+ System.out.println("JavaObjToBytes: Expected argument: \"<java_class_name>:<ctor_arg_str>\"");
+ System.exit(1);
+ }
+ int colonIndex = args[0].indexOf(":");
+ if (colonIndex < 0) {
+ System.out.println("Error: Incorect argument format: " + args[0]);
+ System.exit(-1);
+ }
+ String javaClassName = args[0].substring(0, colonIndex);
+ String ctorArgStr = args[0].substring(colonIndex+1);
+ JavaObjToBytes jotb = new JavaObjToBytes(javaClassName, ctorArgStr);
+ byte[] bytes = jotb.run();
+ System.out.println(args[0]);
+ for (byte b: bytes) {
+ System.out.print(String.format("%02x", b));
+ }
+ System.out.println();
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/4153bf17/utils/src/main/java/org/apache/qpid/qpid_interop_test/obj_util/BytesToJavaObj.java
----------------------------------------------------------------------
diff --git a/utils/src/main/java/org/apache/qpid/qpid_interop_test/obj_util/BytesToJavaObj.java b/utils/src/main/java/org/apache/qpid/qpid_interop_test/obj_util/BytesToJavaObj.java
deleted file mode 100644
index 0d97333..0000000
--- a/utils/src/main/java/org/apache/qpid/qpid_interop_test/obj_util/BytesToJavaObj.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/**
- * 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.interop_test.obj_util;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectInputStream;
-import java.io.Serializable;
-
-public class BytesToJavaObj {
- String hexObjStr = null;
- Serializable obj = null;
-
- public BytesToJavaObj(String hexObjStr) {
- this.hexObjStr = hexObjStr;
- }
-
- public String run() {
- byte[] bytes = hexStrToByteArray(this.hexObjStr);
- this.obj = byteArrayToObject(bytes);
- if (this.obj != null) {
- return this.obj.getClass().getName() + ":" + this.obj.toString();
- }
- return "<null>";
- }
-
- protected Serializable byteArrayToObject(byte[] bytes) {
- ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
- ObjectInput in = null;
- try {
- in = new ObjectInputStream(bis);
- return (Serializable) in.readObject();
- } catch (ClassNotFoundException e) {
- e.printStackTrace(System.out);
- } catch (IOException e) {
- e.printStackTrace(System.out);
- } finally {
- try {
- bis.close();
- } catch (IOException e) {} // ignore
- try {
- in.close();
- } catch (IOException e) {} // ignore
- }
- return null;
- }
-
- protected byte[] hexStrToByteArray(String hexStr) {
- int len = hexStr.length();
- byte[] data = new byte[len / 2];
- for(int i=0; i<len; i+=2) {
- data[i/2] = (byte)((Character.digit(hexStr.charAt(i), 16) << 4) + Character.digit(hexStr.charAt(i+1), 16));
- }
- return data;
- }
-
- // ========= main ==========
-
- public static void main(String[] args) {
- if (args.length != 1) {
- System.out.println("BytesToJavaObj: Incorrect argument count");
- System.out.println("BytesToJavaObj: Expected argument: \"<java_serialized_obj_str_hex>\"");
- System.exit(1);
- }
- BytesToJavaObj btjo = new BytesToJavaObj(args[0]);
- System.out.println(btjo.run());
- }
-}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[5/5] qpid-interop-test git commit: QPIDIT-97: Further fixes and
updates for the release of 0.1.0
Posted by kp...@apache.org.
QPIDIT-97: Further fixes and updates for the release of 0.1.0
Project: http://git-wip-us.apache.org/repos/asf/qpid-interop-test/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-interop-test/commit/4153bf17
Tree: http://git-wip-us.apache.org/repos/asf/qpid-interop-test/tree/4153bf17
Diff: http://git-wip-us.apache.org/repos/asf/qpid-interop-test/diff/4153bf17
Branch: refs/heads/master
Commit: 4153bf1728dadf12572346c6197445606726422e
Parents: 84a2232
Author: Kim van der Riet <kp...@apache.org>
Authored: Wed Oct 25 09:50:13 2017 -0400
Committer: Kim van der Riet <kp...@apache.org>
Committed: Wed Oct 25 09:50:13 2017 -0400
----------------------------------------------------------------------
shims/qpid-jms/pom.xml | 3 +
.../jms_hdrs_props_test/Receiver.java | 567 +++++++++++++++++++
.../jms_hdrs_props_test/Sender.java | 508 +++++++++++++++++
.../jms_messages_test/Receiver.java | 409 +++++++++++++
.../interop_test/jms_messages_test/Sender.java | 407 +++++++++++++
.../jms_hdrs_props_test/Receiver.java | 567 -------------------
.../jms_hdrs_props_test/Sender.java | 508 -----------------
.../jms_messages_test/Receiver.java | 409 -------------
.../jms_messages_test/Sender.java | 407 -------------
.../jms_dtx_test/Receiver.java | 407 -------------
.../qpid_interop_test/jms_dtx_test/Sender.java | 113 ----
.../jms_large_content_test/Receiver.java | 407 -------------
.../jms_large_content_test/Sender.java | 113 ----
.../src/not_yet_impl/amqp_dtx_test/Receiver.cpp | 43 --
.../src/not_yet_impl/amqp_dtx_test/Receiver.hpp | 39 --
.../src/not_yet_impl/amqp_dtx_test/Sender.cpp | 43 --
.../src/not_yet_impl/amqp_dtx_test/Sender.hpp | 39 --
.../amqp_features_test/Receiver.cpp | 43 --
.../amqp_features_test/Receiver.hpp | 39 --
.../not_yet_impl/amqp_features_test/Sender.cpp | 138 -----
.../not_yet_impl/amqp_features_test/Sender.hpp | 67 ---
.../src/not_yet_impl/jms_dtx_test/Receiver.cpp | 43 --
.../src/not_yet_impl/jms_dtx_test/Receiver.hpp | 39 --
.../src/not_yet_impl/jms_dtx_test/Sender.cpp | 43 --
.../src/not_yet_impl/jms_dtx_test/Sender.hpp | 39 --
.../jms_large_content_test/Receiver.cpp | 43 --
.../jms_large_content_test/Receiver.hpp | 39 --
.../jms_large_content_test/Sender.cpp | 43 --
.../jms_large_content_test/Sender.hpp | 39 --
.../not_yet_impl/amqp_dtx_test/Receiver.py | 76 ---
.../not_yet_impl/amqp_dtx_test/Sender.py | 95 ----
.../not_yet_impl/amqp_features_test/Receiver.py | 96 ----
.../not_yet_impl/amqp_features_test/Sender.py | 113 ----
.../not_yet_impl/jms_dtx_test/Receiver.py | 77 ---
.../not_yet_impl/jms_dtx_test/Sender.py | 96 ----
.../jms_large_content_test/Receiver.py | 77 ---
.../jms_large_content_test/Sender.py | 96 ----
src/python/not_yet_impl/amqp_dtx_test.py | 136 -----
src/python/not_yet_impl/amqp_features_test.py | 195 -------
src/python/not_yet_impl/jms_dtx_test.py | 146 -----
.../not_yet_impl/jms_large_content_test.py | 144 -----
src/python/qpid_interop_test/amqp_types_test.py | 3 -
.../qpid_interop_test/jms_hdrs_props_test.py | 4 +-
.../qpid_interop_test/jms_messages_test.py | 4 +-
.../interop_test/obj_util/BytesToJavaObj.java | 83 +++
.../interop_test/obj_util/JavaObjToBytes.java | 129 +++++
.../obj_util/BytesToJavaObj.java | 83 ---
.../obj_util/JavaObjToBytes.java | 129 -----
48 files changed, 2110 insertions(+), 5276 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/4153bf17/shims/qpid-jms/pom.xml
----------------------------------------------------------------------
diff --git a/shims/qpid-jms/pom.xml b/shims/qpid-jms/pom.xml
index 33739d9..c42972f 100644
--- a/shims/qpid-jms/pom.xml
+++ b/shims/qpid-jms/pom.xml
@@ -31,7 +31,9 @@
<build>
<plugins>
+
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.0.0</version>
<configuration>
@@ -66,6 +68,7 @@
</execution>
</executions>
</plugin>
+
</plugins>
</build>
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/4153bf17/shims/qpid-jms/src/main/java/org/apache/qpid/interop_test/jms_hdrs_props_test/Receiver.java
----------------------------------------------------------------------
diff --git a/shims/qpid-jms/src/main/java/org/apache/qpid/interop_test/jms_hdrs_props_test/Receiver.java b/shims/qpid-jms/src/main/java/org/apache/qpid/interop_test/jms_hdrs_props_test/Receiver.java
new file mode 100644
index 0000000..00d2e4c
--- /dev/null
+++ b/shims/qpid-jms/src/main/java/org/apache/qpid/interop_test/jms_hdrs_props_test/Receiver.java
@@ -0,0 +1,567 @@
+/**
+ * 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.interop_test.jms_hdrs_props_test;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.List;
+import javax.jms.BytesMessage;
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.DeliveryMode;
+import javax.jms.Destination;
+import javax.jms.ExceptionListener;
+import javax.jms.JMSException;
+import javax.jms.MapMessage;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.ObjectMessage;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.StreamMessage;
+import javax.jms.TextMessage;
+import javax.jms.Topic;
+import javax.json.Json;
+import javax.json.JsonArray;
+import javax.json.JsonArrayBuilder;
+import javax.json.JsonObject;
+import javax.json.JsonObjectBuilder;
+import javax.json.JsonReader;
+import javax.json.JsonWriter;
+import org.apache.qpid.jms.JmsConnectionFactory;
+
+public class Receiver {
+ private static final String USER = "guest";
+ private static final String PASSWORD = "guest";
+ private static final int TIMEOUT = 10000;
+ private static final String[] SUPPORTED_JMS_MESSAGE_TYPES = {"JMS_MESSAGE_TYPE",
+ "JMS_BYTESMESSAGE_TYPE",
+ "JMS_MAPMESSAGE_TYPE",
+ "JMS_OBJECTMESSAGE_TYPE",
+ "JMS_STREAMMESSAGE_TYPE",
+ "JMS_TEXTMESSAGE_TYPE"};
+ private static enum JMS_DESTINATION_TYPE {JMS_QUEUE, JMS_TEMPORARY_QUEUE, JMS_TOPIC, JMS_TEMPORARY_TOPIC};
+
+ Connection _connection;
+ Session _session;
+ Queue _queue;
+ MessageConsumer _messageConsumer;
+ JsonObjectBuilder _jsonTestValueMapBuilder;
+ JsonObjectBuilder _jsonMessageHeaderMapBuilder;
+ JsonObjectBuilder _jsonMessagePropertiesMapBuilder;
+
+ // args[0]: Broker URL
+ // args[1]: Queue name
+ // args[2]: JMS message type
+ // args[3]: JSON Test parameters containing 2 maps: [testValuesMap, flagMap]
+ public static void main(String[] args) throws Exception {
+ if (args.length != 4) {
+ System.out.println("JmsReceiverShim: Incorrect number of arguments");
+ System.out.println("JmsReceiverShim: Expected arguments: broker_address, queue_name, JMS_msg_type, JSON_receive_params");
+ System.exit(1);
+ }
+ String brokerAddress = "amqp://" + args[0];
+ String queueName = args[1];
+ String jmsMessageType = args[2];
+ if (!isSupportedJmsMessageType(jmsMessageType)) {
+ System.out.println("ERROR: JmsReceiverShim: Unknown or unsupported JMS message type \"" + jmsMessageType + "\"");
+ System.exit(1);
+ }
+
+ JsonReader jsonReader = Json.createReader(new StringReader(args[3]));
+ JsonArray testParamsList = jsonReader.readArray();
+ jsonReader.close();
+
+ if (testParamsList.size() != 2) {
+ System.err.println("ERROR: Incorrect number of JSON parameters: Expected 2, got " + Integer.toString(testParamsList.size()));
+ System.exit(1);
+ }
+
+ JsonObject numTestValuesMap = testParamsList.getJsonObject(0);
+ JsonObject flagMap = testParamsList.getJsonObject(1);
+
+ Receiver shim = new Receiver(brokerAddress, queueName);
+ shim.run(jmsMessageType, numTestValuesMap, flagMap);
+ }
+
+ public Receiver(String brokerAddress, String queueName) {
+ try {
+ _connection = null;
+ ConnectionFactory factory = (ConnectionFactory)new JmsConnectionFactory(brokerAddress);
+ _connection = factory.createConnection(USER, PASSWORD);
+ _connection.setExceptionListener(new MyExceptionListener());
+ _connection.start();
+
+ _session = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ _queue = _session.createQueue(queueName);
+
+ _messageConsumer = _session.createConsumer(_queue);
+
+ _jsonTestValueMapBuilder = Json.createObjectBuilder();
+ _jsonMessageHeaderMapBuilder = Json.createObjectBuilder();
+ _jsonMessagePropertiesMapBuilder = Json.createObjectBuilder();
+ } catch (Exception exc) {
+ if (_connection != null)
+ try { _connection.close(); } catch (JMSException e) {}
+ System.out.println("Caught exception, exiting.");
+ exc.printStackTrace(System.out);
+ System.exit(1);
+ }
+ }
+
+ public void run(String jmsMessageType, JsonObject numTestValuesMap, JsonObject flagMap) {
+ try {
+ List<String> subTypeKeyList = new ArrayList<String>(numTestValuesMap.keySet());
+ Collections.sort(subTypeKeyList);
+
+ Message message = null;
+
+ for (String subType: subTypeKeyList) {
+ JsonArrayBuilder jasonTestValuesArrayBuilder = Json.createArrayBuilder();
+ for (int i=0; i<numTestValuesMap.getJsonNumber(subType).intValue(); ++i) {
+ message = _messageConsumer.receive(TIMEOUT);
+ if (message == null) {
+ throw new Exception("Receiver::run(): No message, timeout while waiting");
+ }
+ switch (jmsMessageType) {
+ case "JMS_MESSAGE_TYPE":
+ processJMSMessage(jasonTestValuesArrayBuilder);
+ break;
+ case "JMS_BYTESMESSAGE_TYPE":
+ processJMSBytesMessage(jmsMessageType, subType, message, jasonTestValuesArrayBuilder);
+ break;
+ case "JMS_STREAMMESSAGE_TYPE":
+ processJMSStreamMessage(jmsMessageType, subType, message, jasonTestValuesArrayBuilder);
+ break;
+ case "JMS_MAPMESSAGE_TYPE":
+ processJMSMapMessage(jmsMessageType, subType, i, message, jasonTestValuesArrayBuilder);
+ break;
+ case "JMS_OBJECTMESSAGE_TYPE":
+ processJMSObjectMessage(subType, message, jasonTestValuesArrayBuilder);
+ break;
+ case "JMS_TEXTMESSAGE_TYPE":
+ processJMSTextMessage(message, jasonTestValuesArrayBuilder);
+ break;
+ default:
+ _connection.close();
+ throw new Exception("JmsReceiverShim: Internal error: Unknown or unsupported JMS message type \"" + jmsMessageType + "\"");
+ }
+
+ processMessageHeaders(message, flagMap);
+ processMessageProperties(message);
+ }
+ _jsonTestValueMapBuilder.add(subType, jasonTestValuesArrayBuilder);
+ }
+ _connection.close();
+
+ System.out.println(jmsMessageType);
+ StringWriter out = new StringWriter();
+ JsonArrayBuilder returnList = Json.createArrayBuilder();
+ returnList.add(_jsonTestValueMapBuilder);
+ returnList.add(_jsonMessageHeaderMapBuilder);
+ returnList.add(_jsonMessagePropertiesMapBuilder);
+ writeJsonArray(returnList, out);
+ System.out.println(out.toString());
+ } catch (Exception exp) {
+ try { _connection.close(); } catch (JMSException e) {}
+ System.out.println("Caught exception, exiting.");
+ exp.printStackTrace(System.out);
+ System.exit(1);
+ }
+ }
+
+ protected void processJMSMessage(JsonArrayBuilder jasonTestValuesArrayBuilder) {
+ jasonTestValuesArrayBuilder.addNull();
+ }
+
+ protected void processJMSBytesMessage(String jmsMessageType, String subType, Message message, JsonArrayBuilder jasonTestValuesArrayBuilder) throws Exception, JMSException, IOException, ClassNotFoundException {
+ switch (subType) {
+ case "boolean":
+ jasonTestValuesArrayBuilder.add(((BytesMessage)message).readBoolean()?"True":"False");
+ break;
+ case "byte":
+ jasonTestValuesArrayBuilder.add(formatByte(((BytesMessage)message).readByte()));
+ break;
+ case "bytes":
+ {
+ byte[] bytesBuff = new byte[65536];
+ int numBytesRead = ((BytesMessage)message).readBytes(bytesBuff);
+ if (numBytesRead >= 0) {
+ jasonTestValuesArrayBuilder.add(new String(Arrays.copyOfRange(bytesBuff, 0, numBytesRead)));
+ } else {
+ // NOTE: For this case, an empty byte array has nothing to return
+ jasonTestValuesArrayBuilder.add(new String());
+ }
+ }
+ break;
+ case "char":
+ jasonTestValuesArrayBuilder.add(formatChar(((BytesMessage)message).readChar()));
+ break;
+ case "double":
+ long l = Double.doubleToRawLongBits(((BytesMessage)message).readDouble());
+ jasonTestValuesArrayBuilder.add(String.format("0x%16s", Long.toHexString(l)).replace(' ', '0'));
+ break;
+ case "float":
+ int i0 = Float.floatToRawIntBits(((BytesMessage)message).readFloat());
+ jasonTestValuesArrayBuilder.add(String.format("0x%8s", Integer.toHexString(i0)).replace(' ', '0'));
+ break;
+ case "int":
+ jasonTestValuesArrayBuilder.add(formatInt(((BytesMessage)message).readInt()));
+ break;
+ case "long":
+ jasonTestValuesArrayBuilder.add(formatLong(((BytesMessage)message).readLong()));
+ break;
+ case "object":
+ {
+ byte[] bytesBuff = new byte[65536];
+ int numBytesRead = ((BytesMessage)message).readBytes(bytesBuff);
+ if (numBytesRead >= 0) {
+ ByteArrayInputStream bais = new ByteArrayInputStream(Arrays.copyOfRange(bytesBuff, 0, numBytesRead));
+ ObjectInputStream ois = new ObjectInputStream(bais);
+ Object obj = ois.readObject();
+ jasonTestValuesArrayBuilder.add(obj.getClass().getName() + ":" + obj.toString());
+ } else {
+ jasonTestValuesArrayBuilder.add("<object error>");
+ }
+ }
+ break;
+ case "short":
+ jasonTestValuesArrayBuilder.add(formatShort(((BytesMessage)message).readShort()));
+ break;
+ case "string":
+ jasonTestValuesArrayBuilder.add(((BytesMessage)message).readUTF());
+ break;
+ default:
+ throw new Exception("JmsReceiverShim: Unknown subtype for " + jmsMessageType + ": \"" + subType + "\"");
+ }
+ }
+
+ protected void processJMSMapMessage(String jmsMessageType, String subType, int count, Message message, JsonArrayBuilder jasonTestValuesArrayBuilder) throws Exception, JMSException {
+ String name = String.format("%s%03d", subType, count);
+ switch (subType) {
+ case "boolean":
+ jasonTestValuesArrayBuilder.add(((MapMessage)message).getBoolean(name)?"True":"False");
+ break;
+ case "byte":
+ jasonTestValuesArrayBuilder.add(formatByte(((MapMessage)message).getByte(name)));
+ break;
+ case "bytes":
+ jasonTestValuesArrayBuilder.add(new String(((MapMessage)message).getBytes(name)));
+ break;
+ case "char":
+ jasonTestValuesArrayBuilder.add(formatChar(((MapMessage)message).getChar(name)));
+ break;
+ case "double":
+ long l = Double.doubleToRawLongBits(((MapMessage)message).getDouble(name));
+ jasonTestValuesArrayBuilder.add(String.format("0x%16s", Long.toHexString(l)).replace(' ', '0'));
+ break;
+ case "float":
+ int i0 = Float.floatToRawIntBits(((MapMessage)message).getFloat(name));
+ jasonTestValuesArrayBuilder.add(String.format("0x%8s", Integer.toHexString(i0)).replace(' ', '0'));
+ break;
+ case "int":
+ jasonTestValuesArrayBuilder.add(formatInt(((MapMessage)message).getInt(name)));
+ break;
+ case "long":
+ jasonTestValuesArrayBuilder.add(formatLong(((MapMessage)message).getLong(name)));
+ break;
+ case "object":
+ Object obj = ((MapMessage)message).getObject(name);
+ jasonTestValuesArrayBuilder.add(obj.getClass().getName() + ":" + obj.toString());
+ break;
+ case "short":
+ jasonTestValuesArrayBuilder.add(formatShort(((MapMessage)message).getShort(name)));
+ break;
+ case "string":
+ jasonTestValuesArrayBuilder.add(((MapMessage)message).getString(name));
+ break;
+ default:
+ throw new Exception("JmsReceiverShim: Unknown subtype for " + jmsMessageType + ": \"" + subType + "\"");
+ }
+ }
+
+ protected void processJMSObjectMessage(String subType, Message message, JsonArrayBuilder jasonTestValuesArrayBuilder) throws JMSException {
+ jasonTestValuesArrayBuilder.add(((ObjectMessage)message).getObject().toString());
+ }
+
+ protected void processJMSStreamMessage(String jmsMessageType, String subType, Message message, JsonArrayBuilder jasonTestValuesArrayBuilder) throws Exception, JMSException {
+ switch (subType) {
+ case "boolean":
+ jasonTestValuesArrayBuilder.add(((StreamMessage)message).readBoolean()?"True":"False");
+ break;
+ case "byte":
+ jasonTestValuesArrayBuilder.add(formatByte(((StreamMessage)message).readByte()));
+ break;
+ case "bytes":
+ byte[] bytesBuff = new byte[65536];
+ int numBytesRead = ((StreamMessage)message).readBytes(bytesBuff);
+ if (numBytesRead >= 0) {
+ jasonTestValuesArrayBuilder.add(new String(Arrays.copyOfRange(bytesBuff, 0, numBytesRead)));
+ } else {
+ System.out.println("StreamMessage.readBytes() returned " + numBytesRead);
+ jasonTestValuesArrayBuilder.add("<bytes error>");
+ }
+ break;
+ case "char":
+ jasonTestValuesArrayBuilder.add(formatChar(((StreamMessage)message).readChar()));
+ break;
+ case "double":
+ long l = Double.doubleToRawLongBits(((StreamMessage)message).readDouble());
+ jasonTestValuesArrayBuilder.add(String.format("0x%16s", Long.toHexString(l)).replace(' ', '0'));
+ break;
+ case "float":
+ int i0 = Float.floatToRawIntBits(((StreamMessage)message).readFloat());
+ jasonTestValuesArrayBuilder.add(String.format("0x%8s", Integer.toHexString(i0)).replace(' ', '0'));
+ break;
+ case "int":
+ jasonTestValuesArrayBuilder.add(formatInt(((StreamMessage)message).readInt()));
+ break;
+ case "long":
+ jasonTestValuesArrayBuilder.add(formatLong(((StreamMessage)message).readLong()));
+ break;
+ case "object":
+ Object obj = ((StreamMessage)message).readObject();
+ jasonTestValuesArrayBuilder.add(obj.getClass().getName() + ":" + obj.toString());
+ break;
+ case "short":
+ jasonTestValuesArrayBuilder.add(formatShort(((StreamMessage)message).readShort()));
+ break;
+ case "string":
+ jasonTestValuesArrayBuilder.add(((StreamMessage)message).readString());
+ break;
+ default:
+ throw new Exception("JmsReceiverShim: Unknown subtype for " + jmsMessageType + ": \"" + subType + "\"");
+ }
+ }
+
+ protected void processJMSTextMessage(Message message, JsonArrayBuilder jasonTestValuesArrayBuilder) throws JMSException {
+ jasonTestValuesArrayBuilder.add(((TextMessage)message).getText());
+ }
+
+ protected void processMessageHeaders(Message message, JsonObject flagMap) throws Exception, JMSException {
+ addMessageHeaderString("JMS_TYPE_HEADER", message.getJMSType());
+ if (flagMap.containsKey("JMS_CORRELATIONID_AS_BYTES") && flagMap.getBoolean("JMS_CORRELATIONID_AS_BYTES")) {
+ addMessageHeaderByteArray("JMS_CORRELATIONID_HEADER", message.getJMSCorrelationIDAsBytes());
+ } else {
+ addMessageHeaderString("JMS_CORRELATIONID_HEADER", message.getJMSCorrelationID());
+ }
+ if (flagMap.containsKey("JMS_REPLYTO_AS_TOPIC") && flagMap.getBoolean("JMS_REPLYTO_AS_TOPIC")) {
+ addMessageHeaderDestination("JMS_REPLYTO_HEADER", JMS_DESTINATION_TYPE.JMS_TOPIC, message.getJMSReplyTo());
+ } else {
+ addMessageHeaderDestination("JMS_REPLYTO_HEADER", JMS_DESTINATION_TYPE.JMS_QUEUE, message.getJMSReplyTo());
+ }
+ if (flagMap.containsKey("JMS_CLIENT_CHECKS") && flagMap.getBoolean("JMS_CLIENT_CHECKS")) {
+ // Get and check message headers which are set by a JMS-compient sender
+ // See: https://docs.oracle.com/cd/E19798-01/821-1841/bnces/index.html
+ // 1. Destination
+ Destination destination = message.getJMSDestination();
+ if (destination.toString().compareTo(_queue.toString()) != 0) {
+ throw new Exception("JMS_DESTINATION header invalid: found \"" + destination.toString() +
+ "\"; expected \"" + _queue.toString() + "\"");
+ }
+ // 2. Delivery Mode (persistence)
+ int deliveryMode = message.getJMSDeliveryMode();
+ if (deliveryMode != DeliveryMode.NON_PERSISTENT && deliveryMode != DeliveryMode.PERSISTENT) {
+ throw new Exception("JMS_DELIVERY_MODE header invalid: " + deliveryMode);
+ }
+ // 3. Expiration
+ long expiration = message.getJMSExpiration();
+ if (expiration != 0) {
+ throw new Exception("JMS_EXPIRATION header is non-zero");
+ }
+ // 4. Message ID
+ String message_id = message.getJMSMessageID();
+ // TODO: Find a check for this
+ // 5. Message priority
+ int message_priority = message.getJMSPriority();
+ if (message_priority != 4) { // Default JMS message priority
+ throw new Exception("JMS_PRIORITY header is not default (4): found " + message_priority);
+ }
+ // 6. Message timestamp
+ long timeStamp = message.getJMSTimestamp();
+ long currentTime = System.currentTimeMillis();
+ if (currentTime - timeStamp > 60 * 1000) { // More than 1 minute old
+ SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss.S z");
+ throw new Exception("JMS_TIMESTAMP header contains suspicious value: found " + timeStamp +
+ " (" + df.format(timeStamp) + ") is not within 1 minute of " + currentTime +
+ " (" + df.format(currentTime) + ")");
+ }
+ }
+ }
+
+ protected void addMessageHeaderString(String headerName, String value) {
+ if (value != null) {
+ JsonObjectBuilder valueMap = Json.createObjectBuilder();
+ valueMap.add("string", value);
+ _jsonMessageHeaderMapBuilder.add(headerName, valueMap);
+ }
+ }
+
+ protected void addMessageHeaderByteArray(String headerName, byte[] value) {
+ if (value != null) {
+ JsonObjectBuilder valueMap = Json.createObjectBuilder();
+ valueMap.add("bytes", new String(value));
+ _jsonMessageHeaderMapBuilder.add(headerName, valueMap);
+ }
+ }
+
+ protected void addMessageHeaderDestination(String headerName, JMS_DESTINATION_TYPE destinationType, Destination destination) throws Exception {
+ if (destination != null) {
+ JsonObjectBuilder valueMap = Json.createObjectBuilder();
+ switch (destinationType) {
+ case JMS_QUEUE:
+ valueMap.add("queue", ((Queue)destination).getQueueName());
+ break;
+ case JMS_TOPIC:
+ valueMap.add("topic", ((Topic)destination).getTopicName());
+ break;
+ default:
+ throw new Exception("Internal error: JMSDestination type not supported");
+ }
+ _jsonMessageHeaderMapBuilder.add(headerName, valueMap);
+ }
+ }
+
+ protected void processMessageProperties(Message message) throws Exception, JMSException {
+ Enumeration<String> propertyNames = message.getPropertyNames();
+ while (propertyNames.hasMoreElements()) {
+ JsonObjectBuilder valueMap = Json.createObjectBuilder();
+ String propertyName = propertyNames.nextElement();
+ int underscoreIndex1 = propertyName.indexOf('_');
+ int underscoreIndex2 = propertyName.indexOf('_', underscoreIndex1 + 1);
+ if (underscoreIndex1 == 4 && underscoreIndex2 > 5) {
+ String propType = propertyName.substring(underscoreIndex1 + 1, underscoreIndex2);
+ switch (propType) {
+ case "boolean":
+ valueMap.add(propType, message.getBooleanProperty(propertyName) ? "True" : "False");
+ _jsonMessagePropertiesMapBuilder.add(propertyName, valueMap);
+ break;
+ case "byte":
+ valueMap.add(propType, formatByte(message.getByteProperty(propertyName)));
+ _jsonMessagePropertiesMapBuilder.add(propertyName, valueMap);
+ break;
+ case "double":
+ long l = Double.doubleToRawLongBits(message.getDoubleProperty(propertyName));
+ valueMap.add(propType, String.format("0x%16s", Long.toHexString(l)).replace(' ', '0'));
+ _jsonMessagePropertiesMapBuilder.add(propertyName, valueMap);
+ break;
+ case "float":
+ int i = Float.floatToRawIntBits(message.getFloatProperty(propertyName));
+ valueMap.add(propType, String.format("0x%8s", Integer.toHexString(i)).replace(' ', '0'));
+ _jsonMessagePropertiesMapBuilder.add(propertyName, valueMap);
+ break;
+ case "int":
+ valueMap.add(propType, formatInt(message.getIntProperty(propertyName)));
+ _jsonMessagePropertiesMapBuilder.add(propertyName, valueMap);
+ break;
+ case "long":
+ valueMap.add(propType, formatLong(message.getLongProperty(propertyName)));
+ _jsonMessagePropertiesMapBuilder.add(propertyName, valueMap);
+ break;
+ case "short":
+ valueMap.add(propType, formatShort(message.getShortProperty(propertyName)));
+ _jsonMessagePropertiesMapBuilder.add(propertyName, valueMap);
+ break;
+ case "string":
+ valueMap.add(propType, message.getStringProperty(propertyName));
+ _jsonMessagePropertiesMapBuilder.add(propertyName, valueMap);
+ break;
+ default:
+ ; // Ignore any other property the broker may add
+ }
+ } else {
+ // TODO: handle other non-test properties that might exist here
+ }
+ }
+ }
+
+ protected static void writeJsonArray(JsonArrayBuilder builder, StringWriter out) {
+ JsonWriter jsonWriter = Json.createWriter(out);
+ jsonWriter.writeArray(builder.build());
+ jsonWriter.close();
+ }
+
+ protected static String formatByte(byte b) {
+ boolean neg = false;
+ if (b < 0) {
+ neg = true;
+ b = (byte)-b;
+ }
+ return String.format("%s0x%x", neg?"-":"", b);
+ }
+
+ protected static String formatChar(char c) {
+ if (Character.isLetterOrDigit(c)) {
+ return String.format("%c", c);
+ }
+ char[] ca = {c};
+ return new String(ca);
+ }
+
+ protected static String formatInt(int i) {
+ boolean neg = false;
+ if (i < 0) {
+ neg = true;
+ i = -i;
+ }
+ return String.format("%s0x%x", neg?"-":"", i);
+ }
+
+ protected static String formatLong(long l) {
+ boolean neg = false;
+ if (l < 0) {
+ neg = true;
+ l = -l;
+ }
+ return String.format("%s0x%x", neg?"-":"", l);
+ }
+
+ protected static String formatShort(int s) {
+ boolean neg = false;
+ if (s < 0) {
+ neg = true;
+ s = -s;
+ }
+ return String.format("%s0x%x", neg?"-":"", s);
+ }
+
+ protected static boolean isSupportedJmsMessageType(String jmsMessageType) {
+ for (String supportedJmsMessageType: SUPPORTED_JMS_MESSAGE_TYPES) {
+ if (jmsMessageType.equals(supportedJmsMessageType))
+ return true;
+ }
+ return false;
+ }
+
+ private static class MyExceptionListener implements ExceptionListener {
+ @Override
+ public void onException(JMSException exception) {
+ System.out.println("Connection ExceptionListener fired, exiting.");
+ exception.printStackTrace(System.out);
+ System.exit(1);
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/4153bf17/shims/qpid-jms/src/main/java/org/apache/qpid/interop_test/jms_hdrs_props_test/Sender.java
----------------------------------------------------------------------
diff --git a/shims/qpid-jms/src/main/java/org/apache/qpid/interop_test/jms_hdrs_props_test/Sender.java b/shims/qpid-jms/src/main/java/org/apache/qpid/interop_test/jms_hdrs_props_test/Sender.java
new file mode 100644
index 0000000..2f38991
--- /dev/null
+++ b/shims/qpid-jms/src/main/java/org/apache/qpid/interop_test/jms_hdrs_props_test/Sender.java
@@ -0,0 +1,508 @@
+/**
+ * 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.interop_test.jms_hdrs_props_test;
+
+import java.io.Serializable;
+import java.io.StringReader;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import javax.jms.BytesMessage;
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.DeliveryMode;
+import javax.jms.ExceptionListener;
+import javax.jms.JMSException;
+import javax.jms.MapMessage;
+import javax.jms.Message;
+import javax.jms.MessageProducer;
+import javax.jms.ObjectMessage;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.StreamMessage;
+import javax.jms.TextMessage;
+import javax.json.Json;
+import javax.json.JsonArray;
+import javax.json.JsonObject;
+import javax.json.JsonReader;
+import org.apache.qpid.jms.JmsConnectionFactory;
+
+public class Sender {
+ private static final String USER = "guest";
+ private static final String PASSWORD = "guest";
+ private static final String[] SUPPORTED_JMS_MESSAGE_TYPES = {"JMS_MESSAGE_TYPE",
+ "JMS_BYTESMESSAGE_TYPE",
+ "JMS_MAPMESSAGE_TYPE",
+ "JMS_OBJECTMESSAGE_TYPE",
+ "JMS_STREAMMESSAGE_TYPE",
+ "JMS_TEXTMESSAGE_TYPE"};
+ Connection _connection;
+ Session _session;
+ Queue _queue;
+ MessageProducer _messageProducer;
+ int _msgsSent;
+
+
+ // args[0]: Broker URL
+ // args[1]: Queue name
+ // args[2]: JMS message type
+ // args[3]: JSON Test parameters containing 3 maps: [testValueMap, testHeadersMap, testPropertiesMap]
+ public static void main(String[] args) throws Exception {
+ if (args.length != 4) {
+ System.out.println("JmsSenderShim: Incorrect number of arguments");
+ System.out.println("JmsSenderShim: Expected arguments: broker_address, queue_name, JMS_msg_type, JSON_send_params");
+ System.exit(1);
+ }
+ String brokerAddress = "amqp://" + args[0];
+ String queueName = args[1];
+ String jmsMessageType = args[2];
+ if (!isSupportedJmsMessageType(jmsMessageType)) {
+ System.err.println("ERROR: JmsSender: Unknown or unsupported JMS message type \"" + jmsMessageType + "\"");
+ System.exit(1);
+ }
+
+ JsonReader jsonReader = Json.createReader(new StringReader(args[3]));
+ JsonArray testParamsList = jsonReader.readArray();
+ jsonReader.close();
+
+ if (testParamsList.size() != 3) {
+ System.err.println("ERROR: Incorrect number of JSON parameters: Expected 3, got " + Integer.toString(testParamsList.size()));
+ System.err.println(" JSON parameters found: \"" + testParamsList + "\"");
+ System.exit(1);
+ }
+ JsonObject testValuesMap = testParamsList.getJsonObject(0);
+ JsonObject testHeadersMap = testParamsList.getJsonObject(1);
+ JsonObject testPropertiesMap = testParamsList.getJsonObject(2);
+
+ Sender shim = new Sender(brokerAddress, queueName);
+ shim.runTests(jmsMessageType, testValuesMap, testHeadersMap, testPropertiesMap);
+ }
+
+ public Sender(String brokerAddress, String queueName) {
+ try {
+ ConnectionFactory factory = (ConnectionFactory)new JmsConnectionFactory(brokerAddress);
+
+ _connection = factory.createConnection();
+ _connection.setExceptionListener(new MyExceptionListener());
+ _connection.start();
+
+ _session = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ _queue = _session.createQueue(queueName);
+
+ _messageProducer = _session.createProducer(_queue);
+
+ _msgsSent = 0;
+ } catch (Exception exp) {
+ System.out.println("Caught exception, exiting.");
+ exp.printStackTrace(System.out);
+ System.exit(1);
+ }
+ }
+
+ public void runTests(String jmsMessageType, JsonObject testValuesMap, JsonObject testHeadersMap, JsonObject testPropertiesMap) throws Exception {
+ List<String> testValuesKeyList = new ArrayList<String>(testValuesMap.keySet());
+ Collections.sort(testValuesKeyList);
+ for (String key: testValuesKeyList) {
+ JsonArray testValues = testValuesMap.getJsonArray(key);
+ for (int i=0; i<testValues.size(); ++i) {
+ String testValue = "";
+ if (!testValues.isNull(i)) {
+ testValue = testValues.getJsonString(i).getString();
+ }
+
+ // Send message
+ Message msg = createMessage(jmsMessageType, key, testValue, i);
+ addMessageHeaders(msg, testHeadersMap);
+ addMessageProperties(msg, testPropertiesMap);
+ _messageProducer.send(msg, DeliveryMode.NON_PERSISTENT, Message.DEFAULT_PRIORITY, Message.DEFAULT_TIME_TO_LIVE);
+ _msgsSent++;
+ }
+ }
+ _connection.close();
+ }
+
+ protected Message createMessage(String jmsMessageType, String key, String testValue, int i) throws Exception {
+ Message message = null;
+ switch (jmsMessageType) {
+ case "JMS_MESSAGE_TYPE":
+ message = createJMSMessage(key, testValue);
+ break;
+ case "JMS_BYTESMESSAGE_TYPE":
+ message = createJMSBytesMessage(key, testValue);
+ break;
+ case "JMS_MAPMESSAGE_TYPE":
+ message = createJMSMapMessage(key, testValue, i);
+ break;
+ case "JMS_OBJECTMESSAGE_TYPE":
+ message = createJMSObjectMessage(key, testValue);
+ break;
+ case "JMS_STREAMMESSAGE_TYPE":
+ message = createJMSStreamMessage(key, testValue);
+ break;
+ case "JMS_TEXTMESSAGE_TYPE":
+ message = createTextMessage(testValue);
+ break;
+ default:
+ throw new Exception("Internal exception: Unexpected JMS message type \"" + jmsMessageType + "\"");
+ }
+ return message;
+ }
+
+
+ protected void addMessageHeaders(Message msg, JsonObject testHeadersMap) throws Exception, JMSException {
+ List<String> testHeadersKeyList = new ArrayList<String>(testHeadersMap.keySet());
+ for (String key: testHeadersKeyList) {
+ JsonObject subMap = testHeadersMap.getJsonObject(key);
+ List<String> subMapKeyList = new ArrayList<String>(subMap.keySet());
+ String subMapKey = subMapKeyList.get(0); // There is always only one entry in map
+ String subMapVal = subMap.getString(subMapKey);
+ switch (key) {
+ case "JMS_TYPE_HEADER":
+ if (subMapKey.compareTo("string") == 0) {
+ msg.setJMSType(subMapVal);
+ } else {
+ throw new Exception("Internal exception: Invalid message header type \"" + subMapKey + "\" for message header \"" + key + "\"");
+ }
+ break;
+ case "JMS_CORRELATIONID_HEADER":
+ if (subMapKey.compareTo("string") == 0) {
+ msg.setJMSCorrelationID(subMapVal);
+ } else if (subMapKey.compareTo("bytes") == 0) {
+ msg.setJMSCorrelationIDAsBytes(subMapVal.getBytes());
+ } else {
+ throw new Exception("Internal exception: Invalid message header type \"" + subMapKey + "\" for message header \"" + key + "\"");
+ }
+ break;
+ case "JMS_REPLYTO_HEADER":
+ switch (subMapKey) {
+ case "queue":
+ msg.setJMSReplyTo(_session.createQueue(subMapVal));
+ break;
+ case "temp_queue":
+ msg.setJMSReplyTo(_session.createTemporaryQueue());
+ break;
+ case "topic":
+ msg.setJMSReplyTo(_session.createTopic(subMapVal));
+ break;
+ case "temp_topic":
+ msg.setJMSReplyTo(_session.createTemporaryTopic());
+ break;
+ default:
+ throw new Exception("Internal exception: Invalid message header type \"" + subMapKey + "\" for message header \"" + key + "\"");
+ }
+ break;
+ default:
+ throw new Exception("Internal exception: Unknown or unsupported message header \"" + key + "\"");
+ }
+ }
+ }
+
+ protected void addMessageProperties(Message msg, JsonObject testPropertiesMap) throws Exception, JMSException {
+ List<String> testPropertiesKeyList = new ArrayList<String>(testPropertiesMap.keySet());
+ for (String key: testPropertiesKeyList) {
+ JsonObject subMap = testPropertiesMap.getJsonObject(key);
+ List<String> subMapKeyList = new ArrayList<String>(subMap.keySet());
+ String subMapKey = subMapKeyList.get(0); // There is always only one entry in map
+ String subMapVal = subMap.getString(subMapKey);
+ switch (subMapKey) {
+ case "boolean":
+ msg.setBooleanProperty(key, Boolean.parseBoolean(subMapVal));
+ break;
+ case "byte":
+ msg.setByteProperty(key, Byte.decode(subMapVal));
+ break;
+ case "double":
+ Long l1 = Long.parseLong(subMapVal.substring(2, 3), 16) << 60;
+ Long l2 = Long.parseLong(subMapVal.substring(3), 16);
+ msg.setDoubleProperty(key, Double.longBitsToDouble(l1 | l2));
+ break;
+ case "float":
+ Long i = Long.parseLong(subMapVal.substring(2), 16);
+ msg.setFloatProperty(key, Float.intBitsToFloat(i.intValue()));
+ break;
+ case "int":
+ msg.setIntProperty(key, Integer.decode(subMapVal));
+ break;
+ case "long":
+ msg.setLongProperty(key, Long.decode(subMapVal));
+ break;
+ case "short":
+ msg.setShortProperty(key, Short.decode(subMapVal));
+ break;
+ case "string":
+ msg.setStringProperty(key, subMapVal);
+ break;
+ default:
+ throw new Exception("Internal exception: Unknown or unsupported message property type \"" + subMapKey + "\"");
+ }
+ }
+ }
+
+ protected Message createJMSMessage(String testValueType, String testValue) throws Exception, JMSException {
+ if (testValueType.compareTo("none") != 0) {
+ throw new Exception("Internal exception: Unexpected JMS message sub-type \"" + testValueType + "\"");
+ }
+ if (testValue.length() > 0) {
+ throw new Exception("Internal exception: Unexpected JMS message value \"" + testValue + "\" for sub-type \"" + testValueType + "\"");
+ }
+ return _session.createMessage();
+ }
+
+ protected BytesMessage createJMSBytesMessage(String testValueType, String testValue) throws Exception, JMSException {
+ BytesMessage message = _session.createBytesMessage();
+ switch (testValueType) {
+ case "boolean":
+ message.writeBoolean(Boolean.parseBoolean(testValue));
+ break;
+ case "byte":
+ message.writeByte(Byte.decode(testValue));
+ break;
+ case "bytes":
+ message.writeBytes(testValue.getBytes());
+ break;
+ case "char":
+ if (testValue.length() == 1) { // Char format: "X" or "\xNN"
+ message.writeChar(testValue.charAt(0));
+ } else {
+ throw new Exception("JmsSenderShim.createJMSBytesMessage() Malformed char string: \"" + testValue + "\" of length " + testValue.length());
+ }
+ break;
+ case "double":
+ Long l1 = Long.parseLong(testValue.substring(2, 3), 16) << 60;
+ Long l2 = Long.parseLong(testValue.substring(3), 16);
+ message.writeDouble(Double.longBitsToDouble(l1 | l2));
+ break;
+ case "float":
+ Long i = Long.parseLong(testValue.substring(2), 16);
+ message.writeFloat(Float.intBitsToFloat(i.intValue()));
+ break;
+ case "int":
+ message.writeInt(Integer.decode(testValue));
+ break;
+ case "long":
+ message.writeLong(Long.decode(testValue));
+ break;
+ case "object":
+ Object obj = (Object)createObject(testValue);
+ message.writeObject(obj);
+ break;
+ case "short":
+ message.writeShort(Short.decode(testValue));
+ break;
+ case "string":
+ message.writeUTF(testValue);
+ break;
+ default:
+ throw new Exception("Internal exception: Unexpected JMS message sub-type \"" + testValueType + "\"");
+ }
+ return message;
+ }
+
+ protected MapMessage createJMSMapMessage(String testValueType, String testValue, int testValueNum) throws Exception, JMSException {
+ MapMessage message = _session.createMapMessage();
+ String name = String.format("%s%03d", testValueType, testValueNum);
+ switch (testValueType) {
+ case "boolean":
+ message.setBoolean(name, Boolean.parseBoolean(testValue));
+ break;
+ case "byte":
+ message.setByte(name, Byte.decode(testValue));
+ break;
+ case "bytes":
+ message.setBytes(name, testValue.getBytes());
+ break;
+ case "char":
+ if (testValue.length() == 1) { // Char format: "X"
+ message.setChar(name, testValue.charAt(0));
+ } else if (testValue.length() == 6) { // Char format: "\xNNNN"
+ message.setChar(name, (char)Integer.parseInt(testValue.substring(2), 16));
+ } else {
+ throw new Exception("JmsSenderShim.createJMSMapMessage() Malformed char string: \"" + testValue + "\"");
+ }
+ break;
+ case "double":
+ Long l1 = Long.parseLong(testValue.substring(2, 3), 16) << 60;
+ Long l2 = Long.parseLong(testValue.substring(3), 16);
+ message.setDouble(name, Double.longBitsToDouble(l1 | l2));
+ break;
+ case "float":
+ Long i = Long.parseLong(testValue.substring(2), 16);
+ message.setFloat(name, Float.intBitsToFloat(i.intValue()));
+ break;
+ case "int":
+ message.setInt(name, Integer.decode(testValue));
+ break;
+ case "long":
+ message.setLong(name, Long.decode(testValue));
+ break;
+ case "object":
+ Object obj = (Object)createObject(testValue);
+ message.setObject(name, obj);
+ break;
+ case "short":
+ message.setShort(name, Short.decode(testValue));
+ break;
+ case "string":
+ message.setString(name, testValue);
+ break;
+ default:
+ throw new Exception("Internal exception: Unexpected JMS message sub-type \"" + testValueType + "\"");
+ }
+ return message;
+ }
+
+ protected ObjectMessage createJMSObjectMessage(String className, String testValue) throws Exception, JMSException {
+ Serializable obj = createJavaObject(className, testValue);
+ if (obj == null) {
+ // TODO: Handle error here
+ System.out.println("JmsSenderShim.createJMSObjectMessage: obj == null");
+ return null;
+ }
+ ObjectMessage message = _session.createObjectMessage();
+ message.setObject(obj);
+ return message;
+ }
+
+ protected StreamMessage createJMSStreamMessage(String testValueType, String testValue) throws Exception, JMSException {
+ StreamMessage message = _session.createStreamMessage();
+ switch (testValueType) {
+ case "boolean":
+ message.writeBoolean(Boolean.parseBoolean(testValue));
+ break;
+ case "byte":
+ message.writeByte(Byte.decode(testValue));
+ break;
+ case "bytes":
+ message.writeBytes(testValue.getBytes());
+ break;
+ case "char":
+ if (testValue.length() == 1) { // Char format: "X"
+ message.writeChar(testValue.charAt(0));
+ } else if (testValue.length() == 6) { // Char format: "\xNNNN"
+ message.writeChar((char)Integer.parseInt(testValue.substring(2), 16));
+ } else {
+ throw new Exception("JmsSenderShim.createJMSStreamMessage() Malformed char string: \"" + testValue + "\"");
+ }
+ break;
+ case "double":
+ Long l1 = Long.parseLong(testValue.substring(2, 3), 16) << 60;
+ Long l2 = Long.parseLong(testValue.substring(3), 16);
+ message.writeDouble(Double.longBitsToDouble(l1 | l2));
+ break;
+ case "float":
+ Long i = Long.parseLong(testValue.substring(2), 16);
+ message.writeFloat(Float.intBitsToFloat(i.intValue()));
+ break;
+ case "int":
+ message.writeInt(Integer.decode(testValue));
+ break;
+ case "long":
+ message.writeLong(Long.decode(testValue));
+ break;
+ case "object":
+ Object obj = (Object)createObject(testValue);
+ message.writeObject(obj);
+ break;
+ case "short":
+ message.writeShort(Short.decode(testValue));
+ break;
+ case "string":
+ message.writeString(testValue);
+ break;
+ default:
+ throw new Exception("JmsSenderShim.createJMSStreamMessage(): Unexpected JMS message sub-type \"" + testValueType + "\"");
+ }
+ return message;
+ }
+
+ protected static Serializable createJavaObject(String className, String testValue) throws Exception {
+ Serializable obj = null;
+ try {
+ Class<?> c = Class.forName(className);
+ if (className.compareTo("java.lang.Character") == 0) {
+ Constructor ctor = c.getConstructor(char.class);
+ if (testValue.length() == 1) {
+ // Use first character of string
+ obj = (Serializable)ctor.newInstance(testValue.charAt(0));
+ } else if (testValue.length() == 4 || testValue.length() == 6) {
+ // Format '\xNN' or '\xNNNN'
+ obj = (Serializable)ctor.newInstance((char)Integer.parseInt(testValue.substring(2), 16));
+ } else {
+ throw new Exception("JmsSenderShim.createJavaObject(): Malformed char string: \"" + testValue + "\"");
+ }
+ } else {
+ // Use string constructor
+ Constructor ctor = c.getConstructor(String.class);
+ obj = (Serializable)ctor.newInstance(testValue);
+ }
+ }
+ catch (ClassNotFoundException e) {
+ e.printStackTrace(System.out);
+ }
+ catch (NoSuchMethodException e) {
+ e.printStackTrace(System.out);
+ }
+ catch (InstantiationException e) {
+ e.printStackTrace(System.out);
+ }
+ catch (IllegalAccessException e) {
+ e.printStackTrace(System.out);
+ }
+ catch (InvocationTargetException e) {
+ e.printStackTrace(System.out);
+ }
+ return obj;
+ }
+
+ // value has format "classname:ctorstrvalue"
+ protected static Serializable createObject(String value) throws Exception {
+ Serializable obj = null;
+ int colonIndex = value.indexOf(":");
+ if (colonIndex >= 0) {
+ String className = value.substring(0, colonIndex);
+ String testValue = value.substring(colonIndex+1);
+ obj = createJavaObject(className, testValue);
+ } else {
+ throw new Exception("createObject(): Malformed value string");
+ }
+ return obj;
+ }
+
+ protected TextMessage createTextMessage(String valueStr) throws JMSException {
+ return _session.createTextMessage(valueStr);
+ }
+
+ protected static boolean isSupportedJmsMessageType(String jmsMessageType) {
+ for (String supportedJmsMessageType: SUPPORTED_JMS_MESSAGE_TYPES) {
+ if (jmsMessageType.equals(supportedJmsMessageType))
+ return true;
+ }
+ return false;
+ }
+
+ private static class MyExceptionListener implements ExceptionListener {
+ @Override
+ public void onException(JMSException exception) {
+ System.out.println("Connection ExceptionListener fired, exiting.");
+ exception.printStackTrace(System.out);
+ System.exit(1);
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/4153bf17/shims/qpid-jms/src/main/java/org/apache/qpid/interop_test/jms_messages_test/Receiver.java
----------------------------------------------------------------------
diff --git a/shims/qpid-jms/src/main/java/org/apache/qpid/interop_test/jms_messages_test/Receiver.java b/shims/qpid-jms/src/main/java/org/apache/qpid/interop_test/jms_messages_test/Receiver.java
new file mode 100644
index 0000000..07d1f06
--- /dev/null
+++ b/shims/qpid-jms/src/main/java/org/apache/qpid/interop_test/jms_messages_test/Receiver.java
@@ -0,0 +1,409 @@
+/**
+ * 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.interop_test.jms_messages_test;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.List;
+import javax.jms.BytesMessage;
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.Destination;
+import javax.jms.ExceptionListener;
+import javax.jms.JMSException;
+import javax.jms.MapMessage;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.ObjectMessage;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.StreamMessage;
+import javax.jms.TextMessage;
+import javax.jms.Topic;
+import javax.json.Json;
+import javax.json.JsonArray;
+import javax.json.JsonArrayBuilder;
+import javax.json.JsonObject;
+import javax.json.JsonObjectBuilder;
+import javax.json.JsonReader;
+import javax.json.JsonWriter;
+import org.apache.qpid.jms.JmsConnectionFactory;
+
+public class Receiver {
+ private static final String USER = "guest";
+ private static final String PASSWORD = "guest";
+ private static final int TIMEOUT = 10000;
+ private static final String[] SUPPORTED_JMS_MESSAGE_TYPES = {"JMS_MESSAGE_TYPE",
+ "JMS_BYTESMESSAGE_TYPE",
+ "JMS_MAPMESSAGE_TYPE",
+ "JMS_OBJECTMESSAGE_TYPE",
+ "JMS_STREAMMESSAGE_TYPE",
+ "JMS_TEXTMESSAGE_TYPE"};
+ private static enum JMS_DESTINATION_TYPE {JMS_QUEUE, JMS_TEMPORARY_QUEUE, JMS_TOPIC, JMS_TEMPORARY_TOPIC};
+
+ Connection _connection;
+ Session _session;
+ Queue _queue;
+ MessageConsumer _messageConsumer;
+ JsonObjectBuilder _jsonTestValueMapBuilder;
+
+ // args[0]: Broker URL
+ // args[1]: Queue name
+ // args[2]: JMS message type
+ // args[3]: JSON Test parameters containing testValuesMap
+ public static void main(String[] args) throws Exception {
+ if (args.length != 4) {
+ System.out.println("JmsReceiverShim: Incorrect number of arguments");
+ System.out.println("JmsReceiverShim: Expected arguments: broker_address, queue_name, JMS_msg_type, JSON_receive_params");
+ System.exit(1);
+ }
+ String brokerAddress = "amqp://" + args[0];
+ String queueName = args[1];
+ String jmsMessageType = args[2];
+ if (!isSupportedJmsMessageType(jmsMessageType)) {
+ System.out.println("ERROR: JmsReceiverShim: Unknown or unsupported JMS message type \"" + jmsMessageType + "\"");
+ System.exit(1);
+ }
+
+ JsonReader jsonReader = Json.createReader(new StringReader(args[3]));
+ JsonObject numTestValuesMap = jsonReader.readObject();
+ jsonReader.close();
+
+ Receiver shim = new Receiver(brokerAddress, queueName);
+ shim.run(jmsMessageType, numTestValuesMap);
+ }
+
+ public Receiver(String brokerAddress, String queueName) {
+ try {
+ _connection = null;
+ ConnectionFactory factory = (ConnectionFactory)new JmsConnectionFactory(brokerAddress);
+ _connection = factory.createConnection(USER, PASSWORD);
+ _connection.setExceptionListener(new MyExceptionListener());
+ _connection.start();
+
+ _session = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ _queue = _session.createQueue(queueName);
+
+ _messageConsumer = _session.createConsumer(_queue);
+
+ _jsonTestValueMapBuilder = Json.createObjectBuilder();
+ } catch (Exception exc) {
+ if (_connection != null)
+ try { _connection.close(); } catch (JMSException e) {}
+ System.out.println("Caught exception, exiting.");
+ exc.printStackTrace(System.out);
+ System.exit(1);
+ }
+ }
+
+ public void run(String jmsMessageType, JsonObject numTestValuesMap) {
+ try {
+ List<String> subTypeKeyList = new ArrayList<String>(numTestValuesMap.keySet());
+ Collections.sort(subTypeKeyList);
+
+ Message message = null;
+
+ for (String subType: subTypeKeyList) {
+ JsonArrayBuilder jasonTestValuesArrayBuilder = Json.createArrayBuilder();
+ for (int i=0; i<numTestValuesMap.getJsonNumber(subType).intValue(); ++i) {
+ message = _messageConsumer.receive(TIMEOUT);
+ if (message == null) {
+ throw new Exception("Receiver::run(): No message, timeout while waiting");
+ }
+ switch (jmsMessageType) {
+ case "JMS_MESSAGE_TYPE":
+ processJMSMessage(jasonTestValuesArrayBuilder);
+ break;
+ case "JMS_BYTESMESSAGE_TYPE":
+ processJMSBytesMessage(jmsMessageType, subType, message, jasonTestValuesArrayBuilder);
+ break;
+ case "JMS_STREAMMESSAGE_TYPE":
+ processJMSStreamMessage(jmsMessageType, subType, message, jasonTestValuesArrayBuilder);
+ break;
+ case "JMS_MAPMESSAGE_TYPE":
+ processJMSMapMessage(jmsMessageType, subType, i, message, jasonTestValuesArrayBuilder);
+ break;
+ case "JMS_OBJECTMESSAGE_TYPE":
+ processJMSObjectMessage(subType, message, jasonTestValuesArrayBuilder);
+ break;
+ case "JMS_TEXTMESSAGE_TYPE":
+ processJMSTextMessage(message, jasonTestValuesArrayBuilder);
+ break;
+ default:
+ _connection.close();
+ throw new Exception("JmsReceiverShim: Internal error: Unknown or unsupported JMS message type \"" + jmsMessageType + "\"");
+ }
+ }
+ _jsonTestValueMapBuilder.add(subType, jasonTestValuesArrayBuilder);
+ }
+ _connection.close();
+
+ System.out.println(jmsMessageType);
+ StringWriter out = new StringWriter();
+ writeJsonObject(_jsonTestValueMapBuilder, out);
+ System.out.println(out.toString());
+ } catch (Exception exp) {
+ try { _connection.close(); } catch (JMSException e) {}
+ System.out.println("Caught exception, exiting.");
+ exp.printStackTrace(System.out);
+ System.exit(1);
+ }
+ }
+
+ protected void processJMSMessage(JsonArrayBuilder jasonTestValuesArrayBuilder) {
+ jasonTestValuesArrayBuilder.addNull();
+ }
+
+ protected void processJMSBytesMessage(String jmsMessageType, String subType, Message message, JsonArrayBuilder jasonTestValuesArrayBuilder) throws Exception, JMSException, IOException, ClassNotFoundException {
+ switch (subType) {
+ case "boolean":
+ jasonTestValuesArrayBuilder.add(((BytesMessage)message).readBoolean()?"True":"False");
+ break;
+ case "byte":
+ jasonTestValuesArrayBuilder.add(formatByte(((BytesMessage)message).readByte()));
+ break;
+ case "bytes":
+ {
+ byte[] bytesBuff = new byte[65536];
+ int numBytesRead = ((BytesMessage)message).readBytes(bytesBuff);
+ if (numBytesRead >= 0) {
+ jasonTestValuesArrayBuilder.add(new String(Arrays.copyOfRange(bytesBuff, 0, numBytesRead)));
+ } else {
+ // NOTE: For this case, an empty byte array has nothing to return
+ jasonTestValuesArrayBuilder.add(new String());
+ }
+ }
+ break;
+ case "char":
+ jasonTestValuesArrayBuilder.add(formatChar(((BytesMessage)message).readChar()));
+ break;
+ case "double":
+ long l = Double.doubleToRawLongBits(((BytesMessage)message).readDouble());
+ jasonTestValuesArrayBuilder.add(String.format("0x%16s", Long.toHexString(l)).replace(' ', '0'));
+ break;
+ case "float":
+ int i0 = Float.floatToRawIntBits(((BytesMessage)message).readFloat());
+ jasonTestValuesArrayBuilder.add(String.format("0x%8s", Integer.toHexString(i0)).replace(' ', '0'));
+ break;
+ case "int":
+ jasonTestValuesArrayBuilder.add(formatInt(((BytesMessage)message).readInt()));
+ break;
+ case "long":
+ jasonTestValuesArrayBuilder.add(formatLong(((BytesMessage)message).readLong()));
+ break;
+ case "object":
+ {
+ byte[] bytesBuff = new byte[65536];
+ int numBytesRead = ((BytesMessage)message).readBytes(bytesBuff);
+ if (numBytesRead >= 0) {
+ ByteArrayInputStream bais = new ByteArrayInputStream(Arrays.copyOfRange(bytesBuff, 0, numBytesRead));
+ ObjectInputStream ois = new ObjectInputStream(bais);
+ Object obj = ois.readObject();
+ jasonTestValuesArrayBuilder.add(obj.getClass().getName() + ":" + obj.toString());
+ } else {
+ jasonTestValuesArrayBuilder.add("<object error>");
+ }
+ }
+ break;
+ case "short":
+ jasonTestValuesArrayBuilder.add(formatShort(((BytesMessage)message).readShort()));
+ break;
+ case "string":
+ jasonTestValuesArrayBuilder.add(((BytesMessage)message).readUTF());
+ break;
+ default:
+ throw new Exception("JmsReceiverShim: Unknown subtype for " + jmsMessageType + ": \"" + subType + "\"");
+ }
+ }
+
+ protected void processJMSMapMessage(String jmsMessageType, String subType, int count, Message message, JsonArrayBuilder jasonTestValuesArrayBuilder) throws Exception, JMSException {
+ String name = String.format("%s%03d", subType, count);
+ switch (subType) {
+ case "boolean":
+ jasonTestValuesArrayBuilder.add(((MapMessage)message).getBoolean(name)?"True":"False");
+ break;
+ case "byte":
+ jasonTestValuesArrayBuilder.add(formatByte(((MapMessage)message).getByte(name)));
+ break;
+ case "bytes":
+ jasonTestValuesArrayBuilder.add(new String(((MapMessage)message).getBytes(name)));
+ break;
+ case "char":
+ jasonTestValuesArrayBuilder.add(formatChar(((MapMessage)message).getChar(name)));
+ break;
+ case "double":
+ long l = Double.doubleToRawLongBits(((MapMessage)message).getDouble(name));
+ jasonTestValuesArrayBuilder.add(String.format("0x%16s", Long.toHexString(l)).replace(' ', '0'));
+ break;
+ case "float":
+ int i0 = Float.floatToRawIntBits(((MapMessage)message).getFloat(name));
+ jasonTestValuesArrayBuilder.add(String.format("0x%8s", Integer.toHexString(i0)).replace(' ', '0'));
+ break;
+ case "int":
+ jasonTestValuesArrayBuilder.add(formatInt(((MapMessage)message).getInt(name)));
+ break;
+ case "long":
+ jasonTestValuesArrayBuilder.add(formatLong(((MapMessage)message).getLong(name)));
+ break;
+ case "object":
+ Object obj = ((MapMessage)message).getObject(name);
+ jasonTestValuesArrayBuilder.add(obj.getClass().getName() + ":" + obj.toString());
+ break;
+ case "short":
+ jasonTestValuesArrayBuilder.add(formatShort(((MapMessage)message).getShort(name)));
+ break;
+ case "string":
+ jasonTestValuesArrayBuilder.add(((MapMessage)message).getString(name));
+ break;
+ default:
+ throw new Exception("JmsReceiverShim: Unknown subtype for " + jmsMessageType + ": \"" + subType + "\"");
+ }
+ }
+
+ protected void processJMSObjectMessage(String subType, Message message, JsonArrayBuilder jasonTestValuesArrayBuilder) throws JMSException {
+ jasonTestValuesArrayBuilder.add(((ObjectMessage)message).getObject().toString());
+ }
+
+ protected void processJMSStreamMessage(String jmsMessageType, String subType, Message message, JsonArrayBuilder jasonTestValuesArrayBuilder) throws Exception, JMSException {
+ switch (subType) {
+ case "boolean":
+ jasonTestValuesArrayBuilder.add(((StreamMessage)message).readBoolean()?"True":"False");
+ break;
+ case "byte":
+ jasonTestValuesArrayBuilder.add(formatByte(((StreamMessage)message).readByte()));
+ break;
+ case "bytes":
+ byte[] bytesBuff = new byte[65536];
+ int numBytesRead = ((StreamMessage)message).readBytes(bytesBuff);
+ if (numBytesRead >= 0) {
+ jasonTestValuesArrayBuilder.add(new String(Arrays.copyOfRange(bytesBuff, 0, numBytesRead)));
+ } else {
+ System.out.println("StreamMessage.readBytes() returned " + numBytesRead);
+ jasonTestValuesArrayBuilder.add("<bytes error>");
+ }
+ break;
+ case "char":
+ jasonTestValuesArrayBuilder.add(formatChar(((StreamMessage)message).readChar()));
+ break;
+ case "double":
+ long l = Double.doubleToRawLongBits(((StreamMessage)message).readDouble());
+ jasonTestValuesArrayBuilder.add(String.format("0x%16s", Long.toHexString(l)).replace(' ', '0'));
+ break;
+ case "float":
+ int i0 = Float.floatToRawIntBits(((StreamMessage)message).readFloat());
+ jasonTestValuesArrayBuilder.add(String.format("0x%8s", Integer.toHexString(i0)).replace(' ', '0'));
+ break;
+ case "int":
+ jasonTestValuesArrayBuilder.add(formatInt(((StreamMessage)message).readInt()));
+ break;
+ case "long":
+ jasonTestValuesArrayBuilder.add(formatLong(((StreamMessage)message).readLong()));
+ break;
+ case "object":
+ Object obj = ((StreamMessage)message).readObject();
+ jasonTestValuesArrayBuilder.add(obj.getClass().getName() + ":" + obj.toString());
+ break;
+ case "short":
+ jasonTestValuesArrayBuilder.add(formatShort(((StreamMessage)message).readShort()));
+ break;
+ case "string":
+ jasonTestValuesArrayBuilder.add(((StreamMessage)message).readString());
+ break;
+ default:
+ throw new Exception("JmsReceiverShim: Unknown subtype for " + jmsMessageType + ": \"" + subType + "\"");
+ }
+ }
+
+ protected void processJMSTextMessage(Message message, JsonArrayBuilder jasonTestValuesArrayBuilder) throws JMSException {
+ jasonTestValuesArrayBuilder.add(((TextMessage)message).getText());
+ }
+
+ protected static void writeJsonObject(JsonObjectBuilder builder, StringWriter out) {
+ JsonWriter jsonWriter = Json.createWriter(out);
+ jsonWriter.writeObject(builder.build());
+ jsonWriter.close();
+ }
+
+ protected static String formatByte(byte b) {
+ boolean neg = false;
+ if (b < 0) {
+ neg = true;
+ b = (byte)-b;
+ }
+ return String.format("%s0x%x", neg?"-":"", b);
+ }
+
+ protected static String formatChar(char c) {
+ if (Character.isLetterOrDigit(c)) {
+ return String.format("%c", c);
+ }
+ char[] ca = {c};
+ return new String(ca);
+ }
+
+ protected static String formatInt(int i) {
+ boolean neg = false;
+ if (i < 0) {
+ neg = true;
+ i = -i;
+ }
+ return String.format("%s0x%x", neg?"-":"", i);
+ }
+
+ protected static String formatLong(long l) {
+ boolean neg = false;
+ if (l < 0) {
+ neg = true;
+ l = -l;
+ }
+ return String.format("%s0x%x", neg?"-":"", l);
+ }
+
+ protected static String formatShort(int s) {
+ boolean neg = false;
+ if (s < 0) {
+ neg = true;
+ s = -s;
+ }
+ return String.format("%s0x%x", neg?"-":"", s);
+ }
+
+ protected static boolean isSupportedJmsMessageType(String jmsMessageType) {
+ for (String supportedJmsMessageType: SUPPORTED_JMS_MESSAGE_TYPES) {
+ if (jmsMessageType.equals(supportedJmsMessageType))
+ return true;
+ }
+ return false;
+ }
+
+ private static class MyExceptionListener implements ExceptionListener {
+ @Override
+ public void onException(JMSException exception) {
+ System.out.println("Connection ExceptionListener fired, exiting.");
+ exception.printStackTrace(System.out);
+ System.exit(1);
+ }
+ }
+}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[4/5] qpid-interop-test git commit: QPIDIT-97: Further fixes and
updates for the release of 0.1.0
Posted by kp...@apache.org.
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/4153bf17/shims/qpid-jms/src/main/java/org/apache/qpid/interop_test/jms_messages_test/Sender.java
----------------------------------------------------------------------
diff --git a/shims/qpid-jms/src/main/java/org/apache/qpid/interop_test/jms_messages_test/Sender.java b/shims/qpid-jms/src/main/java/org/apache/qpid/interop_test/jms_messages_test/Sender.java
new file mode 100644
index 0000000..0cccc97
--- /dev/null
+++ b/shims/qpid-jms/src/main/java/org/apache/qpid/interop_test/jms_messages_test/Sender.java
@@ -0,0 +1,407 @@
+/**
+ * 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.interop_test.jms_messages_test;
+
+import java.io.Serializable;
+import java.io.StringReader;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import javax.jms.BytesMessage;
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.DeliveryMode;
+import javax.jms.ExceptionListener;
+import javax.jms.JMSException;
+import javax.jms.MapMessage;
+import javax.jms.Message;
+import javax.jms.MessageProducer;
+import javax.jms.ObjectMessage;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.StreamMessage;
+import javax.jms.TextMessage;
+import javax.json.Json;
+import javax.json.JsonArray;
+import javax.json.JsonObject;
+import javax.json.JsonReader;
+import org.apache.qpid.jms.JmsConnectionFactory;
+
+public class Sender {
+ private static final String USER = "guest";
+ private static final String PASSWORD = "guest";
+ private static final String[] SUPPORTED_JMS_MESSAGE_TYPES = {"JMS_MESSAGE_TYPE",
+ "JMS_BYTESMESSAGE_TYPE",
+ "JMS_MAPMESSAGE_TYPE",
+ "JMS_OBJECTMESSAGE_TYPE",
+ "JMS_STREAMMESSAGE_TYPE",
+ "JMS_TEXTMESSAGE_TYPE"};
+ Connection _connection;
+ Session _session;
+ Queue _queue;
+ MessageProducer _messageProducer;
+ int _msgsSent;
+
+
+ // args[0]: Broker URL
+ // args[1]: Queue name
+ // args[2]: JMS message type
+ // args[3]: JSON Test parameters containing testValueMap
+ public static void main(String[] args) throws Exception {
+ if (args.length != 4) {
+ System.out.println("JmsSenderShim: Incorrect number of arguments");
+ System.out.println("JmsSenderShim: Expected arguments: broker_address, queue_name, JMS_msg_type, JSON_send_params");
+ System.exit(1);
+ }
+ String brokerAddress = "amqp://" + args[0];
+ String queueName = args[1];
+ String jmsMessageType = args[2];
+ if (!isSupportedJmsMessageType(jmsMessageType)) {
+ System.err.println("ERROR: JmsSender: Unknown or unsupported JMS message type \"" + jmsMessageType + "\"");
+ System.exit(1);
+ }
+
+ JsonReader jsonReader = Json.createReader(new StringReader(args[3]));
+ JsonObject testValuesMap = jsonReader.readObject();
+ jsonReader.close();
+
+ Sender shim = new Sender(brokerAddress, queueName);
+ shim.runTests(jmsMessageType, testValuesMap);
+ }
+
+ public Sender(String brokerAddress, String queueName) {
+ try {
+ ConnectionFactory factory = (ConnectionFactory)new JmsConnectionFactory(brokerAddress);
+
+ _connection = factory.createConnection();
+ _connection.setExceptionListener(new MyExceptionListener());
+ _connection.start();
+
+ _session = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ _queue = _session.createQueue(queueName);
+
+ _messageProducer = _session.createProducer(_queue);
+
+ _msgsSent = 0;
+ } catch (Exception exp) {
+ System.out.println("Caught exception, exiting.");
+ exp.printStackTrace(System.out);
+ System.exit(1);
+ }
+ }
+
+ public void runTests(String jmsMessageType, JsonObject testValuesMap) throws Exception {
+ List<String> testValuesKeyList = new ArrayList<String>(testValuesMap.keySet());
+ Collections.sort(testValuesKeyList);
+ for (String key: testValuesKeyList) {
+ JsonArray testValues = testValuesMap.getJsonArray(key);
+ for (int i=0; i<testValues.size(); ++i) {
+ String testValue = "";
+ if (!testValues.isNull(i)) {
+ testValue = testValues.getJsonString(i).getString();
+ }
+
+ // Send message
+ Message msg = createMessage(jmsMessageType, key, testValue, i);
+ _messageProducer.send(msg, DeliveryMode.NON_PERSISTENT, Message.DEFAULT_PRIORITY, Message.DEFAULT_TIME_TO_LIVE);
+ _msgsSent++;
+ }
+ }
+ _connection.close();
+ }
+
+ protected Message createMessage(String jmsMessageType, String key, String testValue, int i) throws Exception {
+ Message message = null;
+ switch (jmsMessageType) {
+ case "JMS_MESSAGE_TYPE":
+ message = createJMSMessage(key, testValue);
+ break;
+ case "JMS_BYTESMESSAGE_TYPE":
+ message = createJMSBytesMessage(key, testValue);
+ break;
+ case "JMS_MAPMESSAGE_TYPE":
+ message = createJMSMapMessage(key, testValue, i);
+ break;
+ case "JMS_OBJECTMESSAGE_TYPE":
+ message = createJMSObjectMessage(key, testValue);
+ break;
+ case "JMS_STREAMMESSAGE_TYPE":
+ message = createJMSStreamMessage(key, testValue);
+ break;
+ case "JMS_TEXTMESSAGE_TYPE":
+ message = createTextMessage(testValue);
+ break;
+ default:
+ throw new Exception("Internal exception: Unexpected JMS message type \"" + jmsMessageType + "\"");
+ }
+ return message;
+ }
+
+ protected Message createJMSMessage(String testValueType, String testValue) throws Exception, JMSException {
+ if (testValueType.compareTo("none") != 0) {
+ throw new Exception("Internal exception: Unexpected JMS message sub-type \"" + testValueType + "\"");
+ }
+ if (testValue.length() > 0) {
+ throw new Exception("Internal exception: Unexpected JMS message value \"" + testValue + "\" for sub-type \"" + testValueType + "\"");
+ }
+ return _session.createMessage();
+ }
+
+ protected BytesMessage createJMSBytesMessage(String testValueType, String testValue) throws Exception, JMSException {
+ BytesMessage message = _session.createBytesMessage();
+ switch (testValueType) {
+ case "boolean":
+ message.writeBoolean(Boolean.parseBoolean(testValue));
+ break;
+ case "byte":
+ message.writeByte(Byte.decode(testValue));
+ break;
+ case "bytes":
+ message.writeBytes(testValue.getBytes());
+ break;
+ case "char":
+ if (testValue.length() == 1) { // Char format: "X" or "\xNN"
+ message.writeChar(testValue.charAt(0));
+ } else {
+ throw new Exception("JmsSenderShim.createJMSBytesMessage() Malformed char string: \"" + testValue + "\" of length " + testValue.length());
+ }
+ break;
+ case "double":
+ Long l1 = Long.parseLong(testValue.substring(2, 3), 16) << 60;
+ Long l2 = Long.parseLong(testValue.substring(3), 16);
+ message.writeDouble(Double.longBitsToDouble(l1 | l2));
+ break;
+ case "float":
+ Long i = Long.parseLong(testValue.substring(2), 16);
+ message.writeFloat(Float.intBitsToFloat(i.intValue()));
+ break;
+ case "int":
+ message.writeInt(Integer.decode(testValue));
+ break;
+ case "long":
+ message.writeLong(Long.decode(testValue));
+ break;
+ case "object":
+ Object obj = (Object)createObject(testValue);
+ message.writeObject(obj);
+ break;
+ case "short":
+ message.writeShort(Short.decode(testValue));
+ break;
+ case "string":
+ message.writeUTF(testValue);
+ break;
+ default:
+ throw new Exception("Internal exception: Unexpected JMS message sub-type \"" + testValueType + "\"");
+ }
+ return message;
+ }
+
+ protected MapMessage createJMSMapMessage(String testValueType, String testValue, int testValueNum) throws Exception, JMSException {
+ MapMessage message = _session.createMapMessage();
+ String name = String.format("%s%03d", testValueType, testValueNum);
+ switch (testValueType) {
+ case "boolean":
+ message.setBoolean(name, Boolean.parseBoolean(testValue));
+ break;
+ case "byte":
+ message.setByte(name, Byte.decode(testValue));
+ break;
+ case "bytes":
+ message.setBytes(name, testValue.getBytes());
+ break;
+ case "char":
+ if (testValue.length() == 1) { // Char format: "X"
+ message.setChar(name, testValue.charAt(0));
+ } else if (testValue.length() == 6) { // Char format: "\xNNNN"
+ message.setChar(name, (char)Integer.parseInt(testValue.substring(2), 16));
+ } else {
+ throw new Exception("JmsSenderShim.createJMSMapMessage() Malformed char string: \"" + testValue + "\"");
+ }
+ break;
+ case "double":
+ Long l1 = Long.parseLong(testValue.substring(2, 3), 16) << 60;
+ Long l2 = Long.parseLong(testValue.substring(3), 16);
+ message.setDouble(name, Double.longBitsToDouble(l1 | l2));
+ break;
+ case "float":
+ Long i = Long.parseLong(testValue.substring(2), 16);
+ message.setFloat(name, Float.intBitsToFloat(i.intValue()));
+ break;
+ case "int":
+ message.setInt(name, Integer.decode(testValue));
+ break;
+ case "long":
+ message.setLong(name, Long.decode(testValue));
+ break;
+ case "object":
+ Object obj = (Object)createObject(testValue);
+ message.setObject(name, obj);
+ break;
+ case "short":
+ message.setShort(name, Short.decode(testValue));
+ break;
+ case "string":
+ message.setString(name, testValue);
+ break;
+ default:
+ throw new Exception("Internal exception: Unexpected JMS message sub-type \"" + testValueType + "\"");
+ }
+ return message;
+ }
+
+ protected ObjectMessage createJMSObjectMessage(String className, String testValue) throws Exception, JMSException {
+ Serializable obj = createJavaObject(className, testValue);
+ if (obj == null) {
+ // TODO: Handle error here
+ System.out.println("JmsSenderShim.createJMSObjectMessage: obj == null");
+ return null;
+ }
+ ObjectMessage message = _session.createObjectMessage();
+ message.setObject(obj);
+ return message;
+ }
+
+ protected StreamMessage createJMSStreamMessage(String testValueType, String testValue) throws Exception, JMSException {
+ StreamMessage message = _session.createStreamMessage();
+ switch (testValueType) {
+ case "boolean":
+ message.writeBoolean(Boolean.parseBoolean(testValue));
+ break;
+ case "byte":
+ message.writeByte(Byte.decode(testValue));
+ break;
+ case "bytes":
+ message.writeBytes(testValue.getBytes());
+ break;
+ case "char":
+ if (testValue.length() == 1) { // Char format: "X"
+ message.writeChar(testValue.charAt(0));
+ } else if (testValue.length() == 6) { // Char format: "\xNNNN"
+ message.writeChar((char)Integer.parseInt(testValue.substring(2), 16));
+ } else {
+ throw new Exception("JmsSenderShim.createJMSStreamMessage() Malformed char string: \"" + testValue + "\"");
+ }
+ break;
+ case "double":
+ Long l1 = Long.parseLong(testValue.substring(2, 3), 16) << 60;
+ Long l2 = Long.parseLong(testValue.substring(3), 16);
+ message.writeDouble(Double.longBitsToDouble(l1 | l2));
+ break;
+ case "float":
+ Long i = Long.parseLong(testValue.substring(2), 16);
+ message.writeFloat(Float.intBitsToFloat(i.intValue()));
+ break;
+ case "int":
+ message.writeInt(Integer.decode(testValue));
+ break;
+ case "long":
+ message.writeLong(Long.decode(testValue));
+ break;
+ case "object":
+ Object obj = (Object)createObject(testValue);
+ message.writeObject(obj);
+ break;
+ case "short":
+ message.writeShort(Short.decode(testValue));
+ break;
+ case "string":
+ message.writeString(testValue);
+ break;
+ default:
+ throw new Exception("JmsSenderShim.createJMSStreamMessage(): Unexpected JMS message sub-type \"" + testValueType + "\"");
+ }
+ return message;
+ }
+
+ protected static Serializable createJavaObject(String className, String testValue) throws Exception {
+ Serializable obj = null;
+ try {
+ Class<?> c = Class.forName(className);
+ if (className.compareTo("java.lang.Character") == 0) {
+ Constructor ctor = c.getConstructor(char.class);
+ if (testValue.length() == 1) {
+ // Use first character of string
+ obj = (Serializable)ctor.newInstance(testValue.charAt(0));
+ } else if (testValue.length() == 4 || testValue.length() == 6) {
+ // Format '\xNN' or '\xNNNN'
+ obj = (Serializable)ctor.newInstance((char)Integer.parseInt(testValue.substring(2), 16));
+ } else {
+ throw new Exception("JmsSenderShim.createJavaObject(): Malformed char string: \"" + testValue + "\"");
+ }
+ } else {
+ // Use string constructor
+ Constructor ctor = c.getConstructor(String.class);
+ obj = (Serializable)ctor.newInstance(testValue);
+ }
+ }
+ catch (ClassNotFoundException e) {
+ e.printStackTrace(System.out);
+ }
+ catch (NoSuchMethodException e) {
+ e.printStackTrace(System.out);
+ }
+ catch (InstantiationException e) {
+ e.printStackTrace(System.out);
+ }
+ catch (IllegalAccessException e) {
+ e.printStackTrace(System.out);
+ }
+ catch (InvocationTargetException e) {
+ e.printStackTrace(System.out);
+ }
+ return obj;
+ }
+
+ // value has format "classname:ctorstrvalue"
+ protected static Serializable createObject(String value) throws Exception {
+ Serializable obj = null;
+ int colonIndex = value.indexOf(":");
+ if (colonIndex >= 0) {
+ String className = value.substring(0, colonIndex);
+ String testValue = value.substring(colonIndex+1);
+ obj = createJavaObject(className, testValue);
+ } else {
+ throw new Exception("createObject(): Malformed value string");
+ }
+ return obj;
+ }
+
+ protected TextMessage createTextMessage(String valueStr) throws JMSException {
+ return _session.createTextMessage(valueStr);
+ }
+
+ protected static boolean isSupportedJmsMessageType(String jmsMessageType) {
+ for (String supportedJmsMessageType: SUPPORTED_JMS_MESSAGE_TYPES) {
+ if (jmsMessageType.equals(supportedJmsMessageType))
+ return true;
+ }
+ return false;
+ }
+
+ private static class MyExceptionListener implements ExceptionListener {
+ @Override
+ public void onException(JMSException exception) {
+ System.out.println("Connection ExceptionListener fired, exiting.");
+ exception.printStackTrace(System.out);
+ System.exit(1);
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/4153bf17/shims/qpid-jms/src/main/java/org/apache/qpid/qpid_interop_test/jms_hdrs_props_test/Receiver.java
----------------------------------------------------------------------
diff --git a/shims/qpid-jms/src/main/java/org/apache/qpid/qpid_interop_test/jms_hdrs_props_test/Receiver.java b/shims/qpid-jms/src/main/java/org/apache/qpid/qpid_interop_test/jms_hdrs_props_test/Receiver.java
deleted file mode 100644
index 13331ba..0000000
--- a/shims/qpid-jms/src/main/java/org/apache/qpid/qpid_interop_test/jms_hdrs_props_test/Receiver.java
+++ /dev/null
@@ -1,567 +0,0 @@
-/**
- * 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.qpid_interop_test.jms_hdrs_props_test;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.List;
-import javax.jms.BytesMessage;
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.DeliveryMode;
-import javax.jms.Destination;
-import javax.jms.ExceptionListener;
-import javax.jms.JMSException;
-import javax.jms.MapMessage;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.ObjectMessage;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.jms.StreamMessage;
-import javax.jms.TextMessage;
-import javax.jms.Topic;
-import javax.json.Json;
-import javax.json.JsonArray;
-import javax.json.JsonArrayBuilder;
-import javax.json.JsonObject;
-import javax.json.JsonObjectBuilder;
-import javax.json.JsonReader;
-import javax.json.JsonWriter;
-import org.apache.qpid.jms.JmsConnectionFactory;
-
-public class Receiver {
- private static final String USER = "guest";
- private static final String PASSWORD = "guest";
- private static final int TIMEOUT = 10000;
- private static final String[] SUPPORTED_JMS_MESSAGE_TYPES = {"JMS_MESSAGE_TYPE",
- "JMS_BYTESMESSAGE_TYPE",
- "JMS_MAPMESSAGE_TYPE",
- "JMS_OBJECTMESSAGE_TYPE",
- "JMS_STREAMMESSAGE_TYPE",
- "JMS_TEXTMESSAGE_TYPE"};
- private static enum JMS_DESTINATION_TYPE {JMS_QUEUE, JMS_TEMPORARY_QUEUE, JMS_TOPIC, JMS_TEMPORARY_TOPIC};
-
- Connection _connection;
- Session _session;
- Queue _queue;
- MessageConsumer _messageConsumer;
- JsonObjectBuilder _jsonTestValueMapBuilder;
- JsonObjectBuilder _jsonMessageHeaderMapBuilder;
- JsonObjectBuilder _jsonMessagePropertiesMapBuilder;
-
- // args[0]: Broker URL
- // args[1]: Queue name
- // args[2]: JMS message type
- // args[3]: JSON Test parameters containing 2 maps: [testValuesMap, flagMap]
- public static void main(String[] args) throws Exception {
- if (args.length != 4) {
- System.out.println("JmsReceiverShim: Incorrect number of arguments");
- System.out.println("JmsReceiverShim: Expected arguments: broker_address, queue_name, JMS_msg_type, JSON_receive_params");
- System.exit(1);
- }
- String brokerAddress = "amqp://" + args[0];
- String queueName = args[1];
- String jmsMessageType = args[2];
- if (!isSupportedJmsMessageType(jmsMessageType)) {
- System.out.println("ERROR: JmsReceiverShim: Unknown or unsupported JMS message type \"" + jmsMessageType + "\"");
- System.exit(1);
- }
-
- JsonReader jsonReader = Json.createReader(new StringReader(args[3]));
- JsonArray testParamsList = jsonReader.readArray();
- jsonReader.close();
-
- if (testParamsList.size() != 2) {
- System.err.println("ERROR: Incorrect number of JSON parameters: Expected 2, got " + Integer.toString(testParamsList.size()));
- System.exit(1);
- }
-
- JsonObject numTestValuesMap = testParamsList.getJsonObject(0);
- JsonObject flagMap = testParamsList.getJsonObject(1);
-
- Receiver shim = new Receiver(brokerAddress, queueName);
- shim.run(jmsMessageType, numTestValuesMap, flagMap);
- }
-
- public Receiver(String brokerAddress, String queueName) {
- try {
- _connection = null;
- ConnectionFactory factory = (ConnectionFactory)new JmsConnectionFactory(brokerAddress);
- _connection = factory.createConnection(USER, PASSWORD);
- _connection.setExceptionListener(new MyExceptionListener());
- _connection.start();
-
- _session = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- _queue = _session.createQueue(queueName);
-
- _messageConsumer = _session.createConsumer(_queue);
-
- _jsonTestValueMapBuilder = Json.createObjectBuilder();
- _jsonMessageHeaderMapBuilder = Json.createObjectBuilder();
- _jsonMessagePropertiesMapBuilder = Json.createObjectBuilder();
- } catch (Exception exc) {
- if (_connection != null)
- try { _connection.close(); } catch (JMSException e) {}
- System.out.println("Caught exception, exiting.");
- exc.printStackTrace(System.out);
- System.exit(1);
- }
- }
-
- public void run(String jmsMessageType, JsonObject numTestValuesMap, JsonObject flagMap) {
- try {
- List<String> subTypeKeyList = new ArrayList<String>(numTestValuesMap.keySet());
- Collections.sort(subTypeKeyList);
-
- Message message = null;
-
- for (String subType: subTypeKeyList) {
- JsonArrayBuilder jasonTestValuesArrayBuilder = Json.createArrayBuilder();
- for (int i=0; i<numTestValuesMap.getJsonNumber(subType).intValue(); ++i) {
- message = _messageConsumer.receive(TIMEOUT);
- if (message == null) {
- throw new Exception("Receiver::run(): No message, timeout while waiting");
- }
- switch (jmsMessageType) {
- case "JMS_MESSAGE_TYPE":
- processJMSMessage(jasonTestValuesArrayBuilder);
- break;
- case "JMS_BYTESMESSAGE_TYPE":
- processJMSBytesMessage(jmsMessageType, subType, message, jasonTestValuesArrayBuilder);
- break;
- case "JMS_STREAMMESSAGE_TYPE":
- processJMSStreamMessage(jmsMessageType, subType, message, jasonTestValuesArrayBuilder);
- break;
- case "JMS_MAPMESSAGE_TYPE":
- processJMSMapMessage(jmsMessageType, subType, i, message, jasonTestValuesArrayBuilder);
- break;
- case "JMS_OBJECTMESSAGE_TYPE":
- processJMSObjectMessage(subType, message, jasonTestValuesArrayBuilder);
- break;
- case "JMS_TEXTMESSAGE_TYPE":
- processJMSTextMessage(message, jasonTestValuesArrayBuilder);
- break;
- default:
- _connection.close();
- throw new Exception("JmsReceiverShim: Internal error: Unknown or unsupported JMS message type \"" + jmsMessageType + "\"");
- }
-
- processMessageHeaders(message, flagMap);
- processMessageProperties(message);
- }
- _jsonTestValueMapBuilder.add(subType, jasonTestValuesArrayBuilder);
- }
- _connection.close();
-
- System.out.println(jmsMessageType);
- StringWriter out = new StringWriter();
- JsonArrayBuilder returnList = Json.createArrayBuilder();
- returnList.add(_jsonTestValueMapBuilder);
- returnList.add(_jsonMessageHeaderMapBuilder);
- returnList.add(_jsonMessagePropertiesMapBuilder);
- writeJsonArray(returnList, out);
- System.out.println(out.toString());
- } catch (Exception exp) {
- try { _connection.close(); } catch (JMSException e) {}
- System.out.println("Caught exception, exiting.");
- exp.printStackTrace(System.out);
- System.exit(1);
- }
- }
-
- protected void processJMSMessage(JsonArrayBuilder jasonTestValuesArrayBuilder) {
- jasonTestValuesArrayBuilder.addNull();
- }
-
- protected void processJMSBytesMessage(String jmsMessageType, String subType, Message message, JsonArrayBuilder jasonTestValuesArrayBuilder) throws Exception, JMSException, IOException, ClassNotFoundException {
- switch (subType) {
- case "boolean":
- jasonTestValuesArrayBuilder.add(((BytesMessage)message).readBoolean()?"True":"False");
- break;
- case "byte":
- jasonTestValuesArrayBuilder.add(formatByte(((BytesMessage)message).readByte()));
- break;
- case "bytes":
- {
- byte[] bytesBuff = new byte[65536];
- int numBytesRead = ((BytesMessage)message).readBytes(bytesBuff);
- if (numBytesRead >= 0) {
- jasonTestValuesArrayBuilder.add(new String(Arrays.copyOfRange(bytesBuff, 0, numBytesRead)));
- } else {
- // NOTE: For this case, an empty byte array has nothing to return
- jasonTestValuesArrayBuilder.add(new String());
- }
- }
- break;
- case "char":
- jasonTestValuesArrayBuilder.add(formatChar(((BytesMessage)message).readChar()));
- break;
- case "double":
- long l = Double.doubleToRawLongBits(((BytesMessage)message).readDouble());
- jasonTestValuesArrayBuilder.add(String.format("0x%16s", Long.toHexString(l)).replace(' ', '0'));
- break;
- case "float":
- int i0 = Float.floatToRawIntBits(((BytesMessage)message).readFloat());
- jasonTestValuesArrayBuilder.add(String.format("0x%8s", Integer.toHexString(i0)).replace(' ', '0'));
- break;
- case "int":
- jasonTestValuesArrayBuilder.add(formatInt(((BytesMessage)message).readInt()));
- break;
- case "long":
- jasonTestValuesArrayBuilder.add(formatLong(((BytesMessage)message).readLong()));
- break;
- case "object":
- {
- byte[] bytesBuff = new byte[65536];
- int numBytesRead = ((BytesMessage)message).readBytes(bytesBuff);
- if (numBytesRead >= 0) {
- ByteArrayInputStream bais = new ByteArrayInputStream(Arrays.copyOfRange(bytesBuff, 0, numBytesRead));
- ObjectInputStream ois = new ObjectInputStream(bais);
- Object obj = ois.readObject();
- jasonTestValuesArrayBuilder.add(obj.getClass().getName() + ":" + obj.toString());
- } else {
- jasonTestValuesArrayBuilder.add("<object error>");
- }
- }
- break;
- case "short":
- jasonTestValuesArrayBuilder.add(formatShort(((BytesMessage)message).readShort()));
- break;
- case "string":
- jasonTestValuesArrayBuilder.add(((BytesMessage)message).readUTF());
- break;
- default:
- throw new Exception("JmsReceiverShim: Unknown subtype for " + jmsMessageType + ": \"" + subType + "\"");
- }
- }
-
- protected void processJMSMapMessage(String jmsMessageType, String subType, int count, Message message, JsonArrayBuilder jasonTestValuesArrayBuilder) throws Exception, JMSException {
- String name = String.format("%s%03d", subType, count);
- switch (subType) {
- case "boolean":
- jasonTestValuesArrayBuilder.add(((MapMessage)message).getBoolean(name)?"True":"False");
- break;
- case "byte":
- jasonTestValuesArrayBuilder.add(formatByte(((MapMessage)message).getByte(name)));
- break;
- case "bytes":
- jasonTestValuesArrayBuilder.add(new String(((MapMessage)message).getBytes(name)));
- break;
- case "char":
- jasonTestValuesArrayBuilder.add(formatChar(((MapMessage)message).getChar(name)));
- break;
- case "double":
- long l = Double.doubleToRawLongBits(((MapMessage)message).getDouble(name));
- jasonTestValuesArrayBuilder.add(String.format("0x%16s", Long.toHexString(l)).replace(' ', '0'));
- break;
- case "float":
- int i0 = Float.floatToRawIntBits(((MapMessage)message).getFloat(name));
- jasonTestValuesArrayBuilder.add(String.format("0x%8s", Integer.toHexString(i0)).replace(' ', '0'));
- break;
- case "int":
- jasonTestValuesArrayBuilder.add(formatInt(((MapMessage)message).getInt(name)));
- break;
- case "long":
- jasonTestValuesArrayBuilder.add(formatLong(((MapMessage)message).getLong(name)));
- break;
- case "object":
- Object obj = ((MapMessage)message).getObject(name);
- jasonTestValuesArrayBuilder.add(obj.getClass().getName() + ":" + obj.toString());
- break;
- case "short":
- jasonTestValuesArrayBuilder.add(formatShort(((MapMessage)message).getShort(name)));
- break;
- case "string":
- jasonTestValuesArrayBuilder.add(((MapMessage)message).getString(name));
- break;
- default:
- throw new Exception("JmsReceiverShim: Unknown subtype for " + jmsMessageType + ": \"" + subType + "\"");
- }
- }
-
- protected void processJMSObjectMessage(String subType, Message message, JsonArrayBuilder jasonTestValuesArrayBuilder) throws JMSException {
- jasonTestValuesArrayBuilder.add(((ObjectMessage)message).getObject().toString());
- }
-
- protected void processJMSStreamMessage(String jmsMessageType, String subType, Message message, JsonArrayBuilder jasonTestValuesArrayBuilder) throws Exception, JMSException {
- switch (subType) {
- case "boolean":
- jasonTestValuesArrayBuilder.add(((StreamMessage)message).readBoolean()?"True":"False");
- break;
- case "byte":
- jasonTestValuesArrayBuilder.add(formatByte(((StreamMessage)message).readByte()));
- break;
- case "bytes":
- byte[] bytesBuff = new byte[65536];
- int numBytesRead = ((StreamMessage)message).readBytes(bytesBuff);
- if (numBytesRead >= 0) {
- jasonTestValuesArrayBuilder.add(new String(Arrays.copyOfRange(bytesBuff, 0, numBytesRead)));
- } else {
- System.out.println("StreamMessage.readBytes() returned " + numBytesRead);
- jasonTestValuesArrayBuilder.add("<bytes error>");
- }
- break;
- case "char":
- jasonTestValuesArrayBuilder.add(formatChar(((StreamMessage)message).readChar()));
- break;
- case "double":
- long l = Double.doubleToRawLongBits(((StreamMessage)message).readDouble());
- jasonTestValuesArrayBuilder.add(String.format("0x%16s", Long.toHexString(l)).replace(' ', '0'));
- break;
- case "float":
- int i0 = Float.floatToRawIntBits(((StreamMessage)message).readFloat());
- jasonTestValuesArrayBuilder.add(String.format("0x%8s", Integer.toHexString(i0)).replace(' ', '0'));
- break;
- case "int":
- jasonTestValuesArrayBuilder.add(formatInt(((StreamMessage)message).readInt()));
- break;
- case "long":
- jasonTestValuesArrayBuilder.add(formatLong(((StreamMessage)message).readLong()));
- break;
- case "object":
- Object obj = ((StreamMessage)message).readObject();
- jasonTestValuesArrayBuilder.add(obj.getClass().getName() + ":" + obj.toString());
- break;
- case "short":
- jasonTestValuesArrayBuilder.add(formatShort(((StreamMessage)message).readShort()));
- break;
- case "string":
- jasonTestValuesArrayBuilder.add(((StreamMessage)message).readString());
- break;
- default:
- throw new Exception("JmsReceiverShim: Unknown subtype for " + jmsMessageType + ": \"" + subType + "\"");
- }
- }
-
- protected void processJMSTextMessage(Message message, JsonArrayBuilder jasonTestValuesArrayBuilder) throws JMSException {
- jasonTestValuesArrayBuilder.add(((TextMessage)message).getText());
- }
-
- protected void processMessageHeaders(Message message, JsonObject flagMap) throws Exception, JMSException {
- addMessageHeaderString("JMS_TYPE_HEADER", message.getJMSType());
- if (flagMap.containsKey("JMS_CORRELATIONID_AS_BYTES") && flagMap.getBoolean("JMS_CORRELATIONID_AS_BYTES")) {
- addMessageHeaderByteArray("JMS_CORRELATIONID_HEADER", message.getJMSCorrelationIDAsBytes());
- } else {
- addMessageHeaderString("JMS_CORRELATIONID_HEADER", message.getJMSCorrelationID());
- }
- if (flagMap.containsKey("JMS_REPLYTO_AS_TOPIC") && flagMap.getBoolean("JMS_REPLYTO_AS_TOPIC")) {
- addMessageHeaderDestination("JMS_REPLYTO_HEADER", JMS_DESTINATION_TYPE.JMS_TOPIC, message.getJMSReplyTo());
- } else {
- addMessageHeaderDestination("JMS_REPLYTO_HEADER", JMS_DESTINATION_TYPE.JMS_QUEUE, message.getJMSReplyTo());
- }
- if (flagMap.containsKey("JMS_CLIENT_CHECKS") && flagMap.getBoolean("JMS_CLIENT_CHECKS")) {
- // Get and check message headers which are set by a JMS-compient sender
- // See: https://docs.oracle.com/cd/E19798-01/821-1841/bnces/index.html
- // 1. Destination
- Destination destination = message.getJMSDestination();
- if (destination.toString().compareTo(_queue.toString()) != 0) {
- throw new Exception("JMS_DESTINATION header invalid: found \"" + destination.toString() +
- "\"; expected \"" + _queue.toString() + "\"");
- }
- // 2. Delivery Mode (persistence)
- int deliveryMode = message.getJMSDeliveryMode();
- if (deliveryMode != DeliveryMode.NON_PERSISTENT && deliveryMode != DeliveryMode.PERSISTENT) {
- throw new Exception("JMS_DELIVERY_MODE header invalid: " + deliveryMode);
- }
- // 3. Expiration
- long expiration = message.getJMSExpiration();
- if (expiration != 0) {
- throw new Exception("JMS_EXPIRATION header is non-zero");
- }
- // 4. Message ID
- String message_id = message.getJMSMessageID();
- // TODO: Find a check for this
- // 5. Message priority
- int message_priority = message.getJMSPriority();
- if (message_priority != 4) { // Default JMS message priority
- throw new Exception("JMS_PRIORITY header is not default (4): found " + message_priority);
- }
- // 6. Message timestamp
- long timeStamp = message.getJMSTimestamp();
- long currentTime = System.currentTimeMillis();
- if (currentTime - timeStamp > 60 * 1000) { // More than 1 minute old
- SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss.S z");
- throw new Exception("JMS_TIMESTAMP header contains suspicious value: found " + timeStamp +
- " (" + df.format(timeStamp) + ") is not within 1 minute of " + currentTime +
- " (" + df.format(currentTime) + ")");
- }
- }
- }
-
- protected void addMessageHeaderString(String headerName, String value) {
- if (value != null) {
- JsonObjectBuilder valueMap = Json.createObjectBuilder();
- valueMap.add("string", value);
- _jsonMessageHeaderMapBuilder.add(headerName, valueMap);
- }
- }
-
- protected void addMessageHeaderByteArray(String headerName, byte[] value) {
- if (value != null) {
- JsonObjectBuilder valueMap = Json.createObjectBuilder();
- valueMap.add("bytes", new String(value));
- _jsonMessageHeaderMapBuilder.add(headerName, valueMap);
- }
- }
-
- protected void addMessageHeaderDestination(String headerName, JMS_DESTINATION_TYPE destinationType, Destination destination) throws Exception {
- if (destination != null) {
- JsonObjectBuilder valueMap = Json.createObjectBuilder();
- switch (destinationType) {
- case JMS_QUEUE:
- valueMap.add("queue", ((Queue)destination).getQueueName());
- break;
- case JMS_TOPIC:
- valueMap.add("topic", ((Topic)destination).getTopicName());
- break;
- default:
- throw new Exception("Internal error: JMSDestination type not supported");
- }
- _jsonMessageHeaderMapBuilder.add(headerName, valueMap);
- }
- }
-
- protected void processMessageProperties(Message message) throws Exception, JMSException {
- Enumeration<String> propertyNames = message.getPropertyNames();
- while (propertyNames.hasMoreElements()) {
- JsonObjectBuilder valueMap = Json.createObjectBuilder();
- String propertyName = propertyNames.nextElement();
- int underscoreIndex1 = propertyName.indexOf('_');
- int underscoreIndex2 = propertyName.indexOf('_', underscoreIndex1 + 1);
- if (underscoreIndex1 == 4 && underscoreIndex2 > 5) {
- String propType = propertyName.substring(underscoreIndex1 + 1, underscoreIndex2);
- switch (propType) {
- case "boolean":
- valueMap.add(propType, message.getBooleanProperty(propertyName) ? "True" : "False");
- _jsonMessagePropertiesMapBuilder.add(propertyName, valueMap);
- break;
- case "byte":
- valueMap.add(propType, formatByte(message.getByteProperty(propertyName)));
- _jsonMessagePropertiesMapBuilder.add(propertyName, valueMap);
- break;
- case "double":
- long l = Double.doubleToRawLongBits(message.getDoubleProperty(propertyName));
- valueMap.add(propType, String.format("0x%16s", Long.toHexString(l)).replace(' ', '0'));
- _jsonMessagePropertiesMapBuilder.add(propertyName, valueMap);
- break;
- case "float":
- int i = Float.floatToRawIntBits(message.getFloatProperty(propertyName));
- valueMap.add(propType, String.format("0x%8s", Integer.toHexString(i)).replace(' ', '0'));
- _jsonMessagePropertiesMapBuilder.add(propertyName, valueMap);
- break;
- case "int":
- valueMap.add(propType, formatInt(message.getIntProperty(propertyName)));
- _jsonMessagePropertiesMapBuilder.add(propertyName, valueMap);
- break;
- case "long":
- valueMap.add(propType, formatLong(message.getLongProperty(propertyName)));
- _jsonMessagePropertiesMapBuilder.add(propertyName, valueMap);
- break;
- case "short":
- valueMap.add(propType, formatShort(message.getShortProperty(propertyName)));
- _jsonMessagePropertiesMapBuilder.add(propertyName, valueMap);
- break;
- case "string":
- valueMap.add(propType, message.getStringProperty(propertyName));
- _jsonMessagePropertiesMapBuilder.add(propertyName, valueMap);
- break;
- default:
- ; // Ignore any other property the broker may add
- }
- } else {
- // TODO: handle other non-test properties that might exist here
- }
- }
- }
-
- protected static void writeJsonArray(JsonArrayBuilder builder, StringWriter out) {
- JsonWriter jsonWriter = Json.createWriter(out);
- jsonWriter.writeArray(builder.build());
- jsonWriter.close();
- }
-
- protected static String formatByte(byte b) {
- boolean neg = false;
- if (b < 0) {
- neg = true;
- b = (byte)-b;
- }
- return String.format("%s0x%x", neg?"-":"", b);
- }
-
- protected static String formatChar(char c) {
- if (Character.isLetterOrDigit(c)) {
- return String.format("%c", c);
- }
- char[] ca = {c};
- return new String(ca);
- }
-
- protected static String formatInt(int i) {
- boolean neg = false;
- if (i < 0) {
- neg = true;
- i = -i;
- }
- return String.format("%s0x%x", neg?"-":"", i);
- }
-
- protected static String formatLong(long l) {
- boolean neg = false;
- if (l < 0) {
- neg = true;
- l = -l;
- }
- return String.format("%s0x%x", neg?"-":"", l);
- }
-
- protected static String formatShort(int s) {
- boolean neg = false;
- if (s < 0) {
- neg = true;
- s = -s;
- }
- return String.format("%s0x%x", neg?"-":"", s);
- }
-
- protected static boolean isSupportedJmsMessageType(String jmsMessageType) {
- for (String supportedJmsMessageType: SUPPORTED_JMS_MESSAGE_TYPES) {
- if (jmsMessageType.equals(supportedJmsMessageType))
- return true;
- }
- return false;
- }
-
- private static class MyExceptionListener implements ExceptionListener {
- @Override
- public void onException(JMSException exception) {
- System.out.println("Connection ExceptionListener fired, exiting.");
- exception.printStackTrace(System.out);
- System.exit(1);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/4153bf17/shims/qpid-jms/src/main/java/org/apache/qpid/qpid_interop_test/jms_hdrs_props_test/Sender.java
----------------------------------------------------------------------
diff --git a/shims/qpid-jms/src/main/java/org/apache/qpid/qpid_interop_test/jms_hdrs_props_test/Sender.java b/shims/qpid-jms/src/main/java/org/apache/qpid/qpid_interop_test/jms_hdrs_props_test/Sender.java
deleted file mode 100644
index efc3fb9..0000000
--- a/shims/qpid-jms/src/main/java/org/apache/qpid/qpid_interop_test/jms_hdrs_props_test/Sender.java
+++ /dev/null
@@ -1,508 +0,0 @@
-/**
- * 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.qpid_interop_test.jms_hdrs_props_test;
-
-import java.io.Serializable;
-import java.io.StringReader;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import javax.jms.BytesMessage;
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.DeliveryMode;
-import javax.jms.ExceptionListener;
-import javax.jms.JMSException;
-import javax.jms.MapMessage;
-import javax.jms.Message;
-import javax.jms.MessageProducer;
-import javax.jms.ObjectMessage;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.jms.StreamMessage;
-import javax.jms.TextMessage;
-import javax.json.Json;
-import javax.json.JsonArray;
-import javax.json.JsonObject;
-import javax.json.JsonReader;
-import org.apache.qpid.jms.JmsConnectionFactory;
-
-public class Sender {
- private static final String USER = "guest";
- private static final String PASSWORD = "guest";
- private static final String[] SUPPORTED_JMS_MESSAGE_TYPES = {"JMS_MESSAGE_TYPE",
- "JMS_BYTESMESSAGE_TYPE",
- "JMS_MAPMESSAGE_TYPE",
- "JMS_OBJECTMESSAGE_TYPE",
- "JMS_STREAMMESSAGE_TYPE",
- "JMS_TEXTMESSAGE_TYPE"};
- Connection _connection;
- Session _session;
- Queue _queue;
- MessageProducer _messageProducer;
- int _msgsSent;
-
-
- // args[0]: Broker URL
- // args[1]: Queue name
- // args[2]: JMS message type
- // args[3]: JSON Test parameters containing 3 maps: [testValueMap, testHeadersMap, testPropertiesMap]
- public static void main(String[] args) throws Exception {
- if (args.length != 4) {
- System.out.println("JmsSenderShim: Incorrect number of arguments");
- System.out.println("JmsSenderShim: Expected arguments: broker_address, queue_name, JMS_msg_type, JSON_send_params");
- System.exit(1);
- }
- String brokerAddress = "amqp://" + args[0];
- String queueName = args[1];
- String jmsMessageType = args[2];
- if (!isSupportedJmsMessageType(jmsMessageType)) {
- System.err.println("ERROR: JmsSender: Unknown or unsupported JMS message type \"" + jmsMessageType + "\"");
- System.exit(1);
- }
-
- JsonReader jsonReader = Json.createReader(new StringReader(args[3]));
- JsonArray testParamsList = jsonReader.readArray();
- jsonReader.close();
-
- if (testParamsList.size() != 3) {
- System.err.println("ERROR: Incorrect number of JSON parameters: Expected 3, got " + Integer.toString(testParamsList.size()));
- System.err.println(" JSON parameters found: \"" + testParamsList + "\"");
- System.exit(1);
- }
- JsonObject testValuesMap = testParamsList.getJsonObject(0);
- JsonObject testHeadersMap = testParamsList.getJsonObject(1);
- JsonObject testPropertiesMap = testParamsList.getJsonObject(2);
-
- Sender shim = new Sender(brokerAddress, queueName);
- shim.runTests(jmsMessageType, testValuesMap, testHeadersMap, testPropertiesMap);
- }
-
- public Sender(String brokerAddress, String queueName) {
- try {
- ConnectionFactory factory = (ConnectionFactory)new JmsConnectionFactory(brokerAddress);
-
- _connection = factory.createConnection();
- _connection.setExceptionListener(new MyExceptionListener());
- _connection.start();
-
- _session = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- _queue = _session.createQueue(queueName);
-
- _messageProducer = _session.createProducer(_queue);
-
- _msgsSent = 0;
- } catch (Exception exp) {
- System.out.println("Caught exception, exiting.");
- exp.printStackTrace(System.out);
- System.exit(1);
- }
- }
-
- public void runTests(String jmsMessageType, JsonObject testValuesMap, JsonObject testHeadersMap, JsonObject testPropertiesMap) throws Exception {
- List<String> testValuesKeyList = new ArrayList<String>(testValuesMap.keySet());
- Collections.sort(testValuesKeyList);
- for (String key: testValuesKeyList) {
- JsonArray testValues = testValuesMap.getJsonArray(key);
- for (int i=0; i<testValues.size(); ++i) {
- String testValue = "";
- if (!testValues.isNull(i)) {
- testValue = testValues.getJsonString(i).getString();
- }
-
- // Send message
- Message msg = createMessage(jmsMessageType, key, testValue, i);
- addMessageHeaders(msg, testHeadersMap);
- addMessageProperties(msg, testPropertiesMap);
- _messageProducer.send(msg, DeliveryMode.NON_PERSISTENT, Message.DEFAULT_PRIORITY, Message.DEFAULT_TIME_TO_LIVE);
- _msgsSent++;
- }
- }
- _connection.close();
- }
-
- protected Message createMessage(String jmsMessageType, String key, String testValue, int i) throws Exception {
- Message message = null;
- switch (jmsMessageType) {
- case "JMS_MESSAGE_TYPE":
- message = createJMSMessage(key, testValue);
- break;
- case "JMS_BYTESMESSAGE_TYPE":
- message = createJMSBytesMessage(key, testValue);
- break;
- case "JMS_MAPMESSAGE_TYPE":
- message = createJMSMapMessage(key, testValue, i);
- break;
- case "JMS_OBJECTMESSAGE_TYPE":
- message = createJMSObjectMessage(key, testValue);
- break;
- case "JMS_STREAMMESSAGE_TYPE":
- message = createJMSStreamMessage(key, testValue);
- break;
- case "JMS_TEXTMESSAGE_TYPE":
- message = createTextMessage(testValue);
- break;
- default:
- throw new Exception("Internal exception: Unexpected JMS message type \"" + jmsMessageType + "\"");
- }
- return message;
- }
-
-
- protected void addMessageHeaders(Message msg, JsonObject testHeadersMap) throws Exception, JMSException {
- List<String> testHeadersKeyList = new ArrayList<String>(testHeadersMap.keySet());
- for (String key: testHeadersKeyList) {
- JsonObject subMap = testHeadersMap.getJsonObject(key);
- List<String> subMapKeyList = new ArrayList<String>(subMap.keySet());
- String subMapKey = subMapKeyList.get(0); // There is always only one entry in map
- String subMapVal = subMap.getString(subMapKey);
- switch (key) {
- case "JMS_TYPE_HEADER":
- if (subMapKey.compareTo("string") == 0) {
- msg.setJMSType(subMapVal);
- } else {
- throw new Exception("Internal exception: Invalid message header type \"" + subMapKey + "\" for message header \"" + key + "\"");
- }
- break;
- case "JMS_CORRELATIONID_HEADER":
- if (subMapKey.compareTo("string") == 0) {
- msg.setJMSCorrelationID(subMapVal);
- } else if (subMapKey.compareTo("bytes") == 0) {
- msg.setJMSCorrelationIDAsBytes(subMapVal.getBytes());
- } else {
- throw new Exception("Internal exception: Invalid message header type \"" + subMapKey + "\" for message header \"" + key + "\"");
- }
- break;
- case "JMS_REPLYTO_HEADER":
- switch (subMapKey) {
- case "queue":
- msg.setJMSReplyTo(_session.createQueue(subMapVal));
- break;
- case "temp_queue":
- msg.setJMSReplyTo(_session.createTemporaryQueue());
- break;
- case "topic":
- msg.setJMSReplyTo(_session.createTopic(subMapVal));
- break;
- case "temp_topic":
- msg.setJMSReplyTo(_session.createTemporaryTopic());
- break;
- default:
- throw new Exception("Internal exception: Invalid message header type \"" + subMapKey + "\" for message header \"" + key + "\"");
- }
- break;
- default:
- throw new Exception("Internal exception: Unknown or unsupported message header \"" + key + "\"");
- }
- }
- }
-
- protected void addMessageProperties(Message msg, JsonObject testPropertiesMap) throws Exception, JMSException {
- List<String> testPropertiesKeyList = new ArrayList<String>(testPropertiesMap.keySet());
- for (String key: testPropertiesKeyList) {
- JsonObject subMap = testPropertiesMap.getJsonObject(key);
- List<String> subMapKeyList = new ArrayList<String>(subMap.keySet());
- String subMapKey = subMapKeyList.get(0); // There is always only one entry in map
- String subMapVal = subMap.getString(subMapKey);
- switch (subMapKey) {
- case "boolean":
- msg.setBooleanProperty(key, Boolean.parseBoolean(subMapVal));
- break;
- case "byte":
- msg.setByteProperty(key, Byte.decode(subMapVal));
- break;
- case "double":
- Long l1 = Long.parseLong(subMapVal.substring(2, 3), 16) << 60;
- Long l2 = Long.parseLong(subMapVal.substring(3), 16);
- msg.setDoubleProperty(key, Double.longBitsToDouble(l1 | l2));
- break;
- case "float":
- Long i = Long.parseLong(subMapVal.substring(2), 16);
- msg.setFloatProperty(key, Float.intBitsToFloat(i.intValue()));
- break;
- case "int":
- msg.setIntProperty(key, Integer.decode(subMapVal));
- break;
- case "long":
- msg.setLongProperty(key, Long.decode(subMapVal));
- break;
- case "short":
- msg.setShortProperty(key, Short.decode(subMapVal));
- break;
- case "string":
- msg.setStringProperty(key, subMapVal);
- break;
- default:
- throw new Exception("Internal exception: Unknown or unsupported message property type \"" + subMapKey + "\"");
- }
- }
- }
-
- protected Message createJMSMessage(String testValueType, String testValue) throws Exception, JMSException {
- if (testValueType.compareTo("none") != 0) {
- throw new Exception("Internal exception: Unexpected JMS message sub-type \"" + testValueType + "\"");
- }
- if (testValue.length() > 0) {
- throw new Exception("Internal exception: Unexpected JMS message value \"" + testValue + "\" for sub-type \"" + testValueType + "\"");
- }
- return _session.createMessage();
- }
-
- protected BytesMessage createJMSBytesMessage(String testValueType, String testValue) throws Exception, JMSException {
- BytesMessage message = _session.createBytesMessage();
- switch (testValueType) {
- case "boolean":
- message.writeBoolean(Boolean.parseBoolean(testValue));
- break;
- case "byte":
- message.writeByte(Byte.decode(testValue));
- break;
- case "bytes":
- message.writeBytes(testValue.getBytes());
- break;
- case "char":
- if (testValue.length() == 1) { // Char format: "X" or "\xNN"
- message.writeChar(testValue.charAt(0));
- } else {
- throw new Exception("JmsSenderShim.createJMSBytesMessage() Malformed char string: \"" + testValue + "\" of length " + testValue.length());
- }
- break;
- case "double":
- Long l1 = Long.parseLong(testValue.substring(2, 3), 16) << 60;
- Long l2 = Long.parseLong(testValue.substring(3), 16);
- message.writeDouble(Double.longBitsToDouble(l1 | l2));
- break;
- case "float":
- Long i = Long.parseLong(testValue.substring(2), 16);
- message.writeFloat(Float.intBitsToFloat(i.intValue()));
- break;
- case "int":
- message.writeInt(Integer.decode(testValue));
- break;
- case "long":
- message.writeLong(Long.decode(testValue));
- break;
- case "object":
- Object obj = (Object)createObject(testValue);
- message.writeObject(obj);
- break;
- case "short":
- message.writeShort(Short.decode(testValue));
- break;
- case "string":
- message.writeUTF(testValue);
- break;
- default:
- throw new Exception("Internal exception: Unexpected JMS message sub-type \"" + testValueType + "\"");
- }
- return message;
- }
-
- protected MapMessage createJMSMapMessage(String testValueType, String testValue, int testValueNum) throws Exception, JMSException {
- MapMessage message = _session.createMapMessage();
- String name = String.format("%s%03d", testValueType, testValueNum);
- switch (testValueType) {
- case "boolean":
- message.setBoolean(name, Boolean.parseBoolean(testValue));
- break;
- case "byte":
- message.setByte(name, Byte.decode(testValue));
- break;
- case "bytes":
- message.setBytes(name, testValue.getBytes());
- break;
- case "char":
- if (testValue.length() == 1) { // Char format: "X"
- message.setChar(name, testValue.charAt(0));
- } else if (testValue.length() == 6) { // Char format: "\xNNNN"
- message.setChar(name, (char)Integer.parseInt(testValue.substring(2), 16));
- } else {
- throw new Exception("JmsSenderShim.createJMSMapMessage() Malformed char string: \"" + testValue + "\"");
- }
- break;
- case "double":
- Long l1 = Long.parseLong(testValue.substring(2, 3), 16) << 60;
- Long l2 = Long.parseLong(testValue.substring(3), 16);
- message.setDouble(name, Double.longBitsToDouble(l1 | l2));
- break;
- case "float":
- Long i = Long.parseLong(testValue.substring(2), 16);
- message.setFloat(name, Float.intBitsToFloat(i.intValue()));
- break;
- case "int":
- message.setInt(name, Integer.decode(testValue));
- break;
- case "long":
- message.setLong(name, Long.decode(testValue));
- break;
- case "object":
- Object obj = (Object)createObject(testValue);
- message.setObject(name, obj);
- break;
- case "short":
- message.setShort(name, Short.decode(testValue));
- break;
- case "string":
- message.setString(name, testValue);
- break;
- default:
- throw new Exception("Internal exception: Unexpected JMS message sub-type \"" + testValueType + "\"");
- }
- return message;
- }
-
- protected ObjectMessage createJMSObjectMessage(String className, String testValue) throws Exception, JMSException {
- Serializable obj = createJavaObject(className, testValue);
- if (obj == null) {
- // TODO: Handle error here
- System.out.println("JmsSenderShim.createJMSObjectMessage: obj == null");
- return null;
- }
- ObjectMessage message = _session.createObjectMessage();
- message.setObject(obj);
- return message;
- }
-
- protected StreamMessage createJMSStreamMessage(String testValueType, String testValue) throws Exception, JMSException {
- StreamMessage message = _session.createStreamMessage();
- switch (testValueType) {
- case "boolean":
- message.writeBoolean(Boolean.parseBoolean(testValue));
- break;
- case "byte":
- message.writeByte(Byte.decode(testValue));
- break;
- case "bytes":
- message.writeBytes(testValue.getBytes());
- break;
- case "char":
- if (testValue.length() == 1) { // Char format: "X"
- message.writeChar(testValue.charAt(0));
- } else if (testValue.length() == 6) { // Char format: "\xNNNN"
- message.writeChar((char)Integer.parseInt(testValue.substring(2), 16));
- } else {
- throw new Exception("JmsSenderShim.createJMSStreamMessage() Malformed char string: \"" + testValue + "\"");
- }
- break;
- case "double":
- Long l1 = Long.parseLong(testValue.substring(2, 3), 16) << 60;
- Long l2 = Long.parseLong(testValue.substring(3), 16);
- message.writeDouble(Double.longBitsToDouble(l1 | l2));
- break;
- case "float":
- Long i = Long.parseLong(testValue.substring(2), 16);
- message.writeFloat(Float.intBitsToFloat(i.intValue()));
- break;
- case "int":
- message.writeInt(Integer.decode(testValue));
- break;
- case "long":
- message.writeLong(Long.decode(testValue));
- break;
- case "object":
- Object obj = (Object)createObject(testValue);
- message.writeObject(obj);
- break;
- case "short":
- message.writeShort(Short.decode(testValue));
- break;
- case "string":
- message.writeString(testValue);
- break;
- default:
- throw new Exception("JmsSenderShim.createJMSStreamMessage(): Unexpected JMS message sub-type \"" + testValueType + "\"");
- }
- return message;
- }
-
- protected static Serializable createJavaObject(String className, String testValue) throws Exception {
- Serializable obj = null;
- try {
- Class<?> c = Class.forName(className);
- if (className.compareTo("java.lang.Character") == 0) {
- Constructor ctor = c.getConstructor(char.class);
- if (testValue.length() == 1) {
- // Use first character of string
- obj = (Serializable)ctor.newInstance(testValue.charAt(0));
- } else if (testValue.length() == 4 || testValue.length() == 6) {
- // Format '\xNN' or '\xNNNN'
- obj = (Serializable)ctor.newInstance((char)Integer.parseInt(testValue.substring(2), 16));
- } else {
- throw new Exception("JmsSenderShim.createJavaObject(): Malformed char string: \"" + testValue + "\"");
- }
- } else {
- // Use string constructor
- Constructor ctor = c.getConstructor(String.class);
- obj = (Serializable)ctor.newInstance(testValue);
- }
- }
- catch (ClassNotFoundException e) {
- e.printStackTrace(System.out);
- }
- catch (NoSuchMethodException e) {
- e.printStackTrace(System.out);
- }
- catch (InstantiationException e) {
- e.printStackTrace(System.out);
- }
- catch (IllegalAccessException e) {
- e.printStackTrace(System.out);
- }
- catch (InvocationTargetException e) {
- e.printStackTrace(System.out);
- }
- return obj;
- }
-
- // value has format "classname:ctorstrvalue"
- protected static Serializable createObject(String value) throws Exception {
- Serializable obj = null;
- int colonIndex = value.indexOf(":");
- if (colonIndex >= 0) {
- String className = value.substring(0, colonIndex);
- String testValue = value.substring(colonIndex+1);
- obj = createJavaObject(className, testValue);
- } else {
- throw new Exception("createObject(): Malformed value string");
- }
- return obj;
- }
-
- protected TextMessage createTextMessage(String valueStr) throws JMSException {
- return _session.createTextMessage(valueStr);
- }
-
- protected static boolean isSupportedJmsMessageType(String jmsMessageType) {
- for (String supportedJmsMessageType: SUPPORTED_JMS_MESSAGE_TYPES) {
- if (jmsMessageType.equals(supportedJmsMessageType))
- return true;
- }
- return false;
- }
-
- private static class MyExceptionListener implements ExceptionListener {
- @Override
- public void onException(JMSException exception) {
- System.out.println("Connection ExceptionListener fired, exiting.");
- exception.printStackTrace(System.out);
- System.exit(1);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/4153bf17/shims/qpid-jms/src/main/java/org/apache/qpid/qpid_interop_test/jms_messages_test/Receiver.java
----------------------------------------------------------------------
diff --git a/shims/qpid-jms/src/main/java/org/apache/qpid/qpid_interop_test/jms_messages_test/Receiver.java b/shims/qpid-jms/src/main/java/org/apache/qpid/qpid_interop_test/jms_messages_test/Receiver.java
deleted file mode 100644
index a3acb66..0000000
--- a/shims/qpid-jms/src/main/java/org/apache/qpid/qpid_interop_test/jms_messages_test/Receiver.java
+++ /dev/null
@@ -1,409 +0,0 @@
-/**
- * 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.qpid_interop_test.jms_messages_test;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.List;
-import javax.jms.BytesMessage;
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.Destination;
-import javax.jms.ExceptionListener;
-import javax.jms.JMSException;
-import javax.jms.MapMessage;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.ObjectMessage;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.jms.StreamMessage;
-import javax.jms.TextMessage;
-import javax.jms.Topic;
-import javax.json.Json;
-import javax.json.JsonArray;
-import javax.json.JsonArrayBuilder;
-import javax.json.JsonObject;
-import javax.json.JsonObjectBuilder;
-import javax.json.JsonReader;
-import javax.json.JsonWriter;
-import org.apache.qpid.jms.JmsConnectionFactory;
-
-public class Receiver {
- private static final String USER = "guest";
- private static final String PASSWORD = "guest";
- private static final int TIMEOUT = 10000;
- private static final String[] SUPPORTED_JMS_MESSAGE_TYPES = {"JMS_MESSAGE_TYPE",
- "JMS_BYTESMESSAGE_TYPE",
- "JMS_MAPMESSAGE_TYPE",
- "JMS_OBJECTMESSAGE_TYPE",
- "JMS_STREAMMESSAGE_TYPE",
- "JMS_TEXTMESSAGE_TYPE"};
- private static enum JMS_DESTINATION_TYPE {JMS_QUEUE, JMS_TEMPORARY_QUEUE, JMS_TOPIC, JMS_TEMPORARY_TOPIC};
-
- Connection _connection;
- Session _session;
- Queue _queue;
- MessageConsumer _messageConsumer;
- JsonObjectBuilder _jsonTestValueMapBuilder;
-
- // args[0]: Broker URL
- // args[1]: Queue name
- // args[2]: JMS message type
- // args[3]: JSON Test parameters containing testValuesMap
- public static void main(String[] args) throws Exception {
- if (args.length != 4) {
- System.out.println("JmsReceiverShim: Incorrect number of arguments");
- System.out.println("JmsReceiverShim: Expected arguments: broker_address, queue_name, JMS_msg_type, JSON_receive_params");
- System.exit(1);
- }
- String brokerAddress = "amqp://" + args[0];
- String queueName = args[1];
- String jmsMessageType = args[2];
- if (!isSupportedJmsMessageType(jmsMessageType)) {
- System.out.println("ERROR: JmsReceiverShim: Unknown or unsupported JMS message type \"" + jmsMessageType + "\"");
- System.exit(1);
- }
-
- JsonReader jsonReader = Json.createReader(new StringReader(args[3]));
- JsonObject numTestValuesMap = jsonReader.readObject();
- jsonReader.close();
-
- Receiver shim = new Receiver(brokerAddress, queueName);
- shim.run(jmsMessageType, numTestValuesMap);
- }
-
- public Receiver(String brokerAddress, String queueName) {
- try {
- _connection = null;
- ConnectionFactory factory = (ConnectionFactory)new JmsConnectionFactory(brokerAddress);
- _connection = factory.createConnection(USER, PASSWORD);
- _connection.setExceptionListener(new MyExceptionListener());
- _connection.start();
-
- _session = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- _queue = _session.createQueue(queueName);
-
- _messageConsumer = _session.createConsumer(_queue);
-
- _jsonTestValueMapBuilder = Json.createObjectBuilder();
- } catch (Exception exc) {
- if (_connection != null)
- try { _connection.close(); } catch (JMSException e) {}
- System.out.println("Caught exception, exiting.");
- exc.printStackTrace(System.out);
- System.exit(1);
- }
- }
-
- public void run(String jmsMessageType, JsonObject numTestValuesMap) {
- try {
- List<String> subTypeKeyList = new ArrayList<String>(numTestValuesMap.keySet());
- Collections.sort(subTypeKeyList);
-
- Message message = null;
-
- for (String subType: subTypeKeyList) {
- JsonArrayBuilder jasonTestValuesArrayBuilder = Json.createArrayBuilder();
- for (int i=0; i<numTestValuesMap.getJsonNumber(subType).intValue(); ++i) {
- message = _messageConsumer.receive(TIMEOUT);
- if (message == null) {
- throw new Exception("Receiver::run(): No message, timeout while waiting");
- }
- switch (jmsMessageType) {
- case "JMS_MESSAGE_TYPE":
- processJMSMessage(jasonTestValuesArrayBuilder);
- break;
- case "JMS_BYTESMESSAGE_TYPE":
- processJMSBytesMessage(jmsMessageType, subType, message, jasonTestValuesArrayBuilder);
- break;
- case "JMS_STREAMMESSAGE_TYPE":
- processJMSStreamMessage(jmsMessageType, subType, message, jasonTestValuesArrayBuilder);
- break;
- case "JMS_MAPMESSAGE_TYPE":
- processJMSMapMessage(jmsMessageType, subType, i, message, jasonTestValuesArrayBuilder);
- break;
- case "JMS_OBJECTMESSAGE_TYPE":
- processJMSObjectMessage(subType, message, jasonTestValuesArrayBuilder);
- break;
- case "JMS_TEXTMESSAGE_TYPE":
- processJMSTextMessage(message, jasonTestValuesArrayBuilder);
- break;
- default:
- _connection.close();
- throw new Exception("JmsReceiverShim: Internal error: Unknown or unsupported JMS message type \"" + jmsMessageType + "\"");
- }
- }
- _jsonTestValueMapBuilder.add(subType, jasonTestValuesArrayBuilder);
- }
- _connection.close();
-
- System.out.println(jmsMessageType);
- StringWriter out = new StringWriter();
- writeJsonObject(_jsonTestValueMapBuilder, out);
- System.out.println(out.toString());
- } catch (Exception exp) {
- try { _connection.close(); } catch (JMSException e) {}
- System.out.println("Caught exception, exiting.");
- exp.printStackTrace(System.out);
- System.exit(1);
- }
- }
-
- protected void processJMSMessage(JsonArrayBuilder jasonTestValuesArrayBuilder) {
- jasonTestValuesArrayBuilder.addNull();
- }
-
- protected void processJMSBytesMessage(String jmsMessageType, String subType, Message message, JsonArrayBuilder jasonTestValuesArrayBuilder) throws Exception, JMSException, IOException, ClassNotFoundException {
- switch (subType) {
- case "boolean":
- jasonTestValuesArrayBuilder.add(((BytesMessage)message).readBoolean()?"True":"False");
- break;
- case "byte":
- jasonTestValuesArrayBuilder.add(formatByte(((BytesMessage)message).readByte()));
- break;
- case "bytes":
- {
- byte[] bytesBuff = new byte[65536];
- int numBytesRead = ((BytesMessage)message).readBytes(bytesBuff);
- if (numBytesRead >= 0) {
- jasonTestValuesArrayBuilder.add(new String(Arrays.copyOfRange(bytesBuff, 0, numBytesRead)));
- } else {
- // NOTE: For this case, an empty byte array has nothing to return
- jasonTestValuesArrayBuilder.add(new String());
- }
- }
- break;
- case "char":
- jasonTestValuesArrayBuilder.add(formatChar(((BytesMessage)message).readChar()));
- break;
- case "double":
- long l = Double.doubleToRawLongBits(((BytesMessage)message).readDouble());
- jasonTestValuesArrayBuilder.add(String.format("0x%16s", Long.toHexString(l)).replace(' ', '0'));
- break;
- case "float":
- int i0 = Float.floatToRawIntBits(((BytesMessage)message).readFloat());
- jasonTestValuesArrayBuilder.add(String.format("0x%8s", Integer.toHexString(i0)).replace(' ', '0'));
- break;
- case "int":
- jasonTestValuesArrayBuilder.add(formatInt(((BytesMessage)message).readInt()));
- break;
- case "long":
- jasonTestValuesArrayBuilder.add(formatLong(((BytesMessage)message).readLong()));
- break;
- case "object":
- {
- byte[] bytesBuff = new byte[65536];
- int numBytesRead = ((BytesMessage)message).readBytes(bytesBuff);
- if (numBytesRead >= 0) {
- ByteArrayInputStream bais = new ByteArrayInputStream(Arrays.copyOfRange(bytesBuff, 0, numBytesRead));
- ObjectInputStream ois = new ObjectInputStream(bais);
- Object obj = ois.readObject();
- jasonTestValuesArrayBuilder.add(obj.getClass().getName() + ":" + obj.toString());
- } else {
- jasonTestValuesArrayBuilder.add("<object error>");
- }
- }
- break;
- case "short":
- jasonTestValuesArrayBuilder.add(formatShort(((BytesMessage)message).readShort()));
- break;
- case "string":
- jasonTestValuesArrayBuilder.add(((BytesMessage)message).readUTF());
- break;
- default:
- throw new Exception("JmsReceiverShim: Unknown subtype for " + jmsMessageType + ": \"" + subType + "\"");
- }
- }
-
- protected void processJMSMapMessage(String jmsMessageType, String subType, int count, Message message, JsonArrayBuilder jasonTestValuesArrayBuilder) throws Exception, JMSException {
- String name = String.format("%s%03d", subType, count);
- switch (subType) {
- case "boolean":
- jasonTestValuesArrayBuilder.add(((MapMessage)message).getBoolean(name)?"True":"False");
- break;
- case "byte":
- jasonTestValuesArrayBuilder.add(formatByte(((MapMessage)message).getByte(name)));
- break;
- case "bytes":
- jasonTestValuesArrayBuilder.add(new String(((MapMessage)message).getBytes(name)));
- break;
- case "char":
- jasonTestValuesArrayBuilder.add(formatChar(((MapMessage)message).getChar(name)));
- break;
- case "double":
- long l = Double.doubleToRawLongBits(((MapMessage)message).getDouble(name));
- jasonTestValuesArrayBuilder.add(String.format("0x%16s", Long.toHexString(l)).replace(' ', '0'));
- break;
- case "float":
- int i0 = Float.floatToRawIntBits(((MapMessage)message).getFloat(name));
- jasonTestValuesArrayBuilder.add(String.format("0x%8s", Integer.toHexString(i0)).replace(' ', '0'));
- break;
- case "int":
- jasonTestValuesArrayBuilder.add(formatInt(((MapMessage)message).getInt(name)));
- break;
- case "long":
- jasonTestValuesArrayBuilder.add(formatLong(((MapMessage)message).getLong(name)));
- break;
- case "object":
- Object obj = ((MapMessage)message).getObject(name);
- jasonTestValuesArrayBuilder.add(obj.getClass().getName() + ":" + obj.toString());
- break;
- case "short":
- jasonTestValuesArrayBuilder.add(formatShort(((MapMessage)message).getShort(name)));
- break;
- case "string":
- jasonTestValuesArrayBuilder.add(((MapMessage)message).getString(name));
- break;
- default:
- throw new Exception("JmsReceiverShim: Unknown subtype for " + jmsMessageType + ": \"" + subType + "\"");
- }
- }
-
- protected void processJMSObjectMessage(String subType, Message message, JsonArrayBuilder jasonTestValuesArrayBuilder) throws JMSException {
- jasonTestValuesArrayBuilder.add(((ObjectMessage)message).getObject().toString());
- }
-
- protected void processJMSStreamMessage(String jmsMessageType, String subType, Message message, JsonArrayBuilder jasonTestValuesArrayBuilder) throws Exception, JMSException {
- switch (subType) {
- case "boolean":
- jasonTestValuesArrayBuilder.add(((StreamMessage)message).readBoolean()?"True":"False");
- break;
- case "byte":
- jasonTestValuesArrayBuilder.add(formatByte(((StreamMessage)message).readByte()));
- break;
- case "bytes":
- byte[] bytesBuff = new byte[65536];
- int numBytesRead = ((StreamMessage)message).readBytes(bytesBuff);
- if (numBytesRead >= 0) {
- jasonTestValuesArrayBuilder.add(new String(Arrays.copyOfRange(bytesBuff, 0, numBytesRead)));
- } else {
- System.out.println("StreamMessage.readBytes() returned " + numBytesRead);
- jasonTestValuesArrayBuilder.add("<bytes error>");
- }
- break;
- case "char":
- jasonTestValuesArrayBuilder.add(formatChar(((StreamMessage)message).readChar()));
- break;
- case "double":
- long l = Double.doubleToRawLongBits(((StreamMessage)message).readDouble());
- jasonTestValuesArrayBuilder.add(String.format("0x%16s", Long.toHexString(l)).replace(' ', '0'));
- break;
- case "float":
- int i0 = Float.floatToRawIntBits(((StreamMessage)message).readFloat());
- jasonTestValuesArrayBuilder.add(String.format("0x%8s", Integer.toHexString(i0)).replace(' ', '0'));
- break;
- case "int":
- jasonTestValuesArrayBuilder.add(formatInt(((StreamMessage)message).readInt()));
- break;
- case "long":
- jasonTestValuesArrayBuilder.add(formatLong(((StreamMessage)message).readLong()));
- break;
- case "object":
- Object obj = ((StreamMessage)message).readObject();
- jasonTestValuesArrayBuilder.add(obj.getClass().getName() + ":" + obj.toString());
- break;
- case "short":
- jasonTestValuesArrayBuilder.add(formatShort(((StreamMessage)message).readShort()));
- break;
- case "string":
- jasonTestValuesArrayBuilder.add(((StreamMessage)message).readString());
- break;
- default:
- throw new Exception("JmsReceiverShim: Unknown subtype for " + jmsMessageType + ": \"" + subType + "\"");
- }
- }
-
- protected void processJMSTextMessage(Message message, JsonArrayBuilder jasonTestValuesArrayBuilder) throws JMSException {
- jasonTestValuesArrayBuilder.add(((TextMessage)message).getText());
- }
-
- protected static void writeJsonObject(JsonObjectBuilder builder, StringWriter out) {
- JsonWriter jsonWriter = Json.createWriter(out);
- jsonWriter.writeObject(builder.build());
- jsonWriter.close();
- }
-
- protected static String formatByte(byte b) {
- boolean neg = false;
- if (b < 0) {
- neg = true;
- b = (byte)-b;
- }
- return String.format("%s0x%x", neg?"-":"", b);
- }
-
- protected static String formatChar(char c) {
- if (Character.isLetterOrDigit(c)) {
- return String.format("%c", c);
- }
- char[] ca = {c};
- return new String(ca);
- }
-
- protected static String formatInt(int i) {
- boolean neg = false;
- if (i < 0) {
- neg = true;
- i = -i;
- }
- return String.format("%s0x%x", neg?"-":"", i);
- }
-
- protected static String formatLong(long l) {
- boolean neg = false;
- if (l < 0) {
- neg = true;
- l = -l;
- }
- return String.format("%s0x%x", neg?"-":"", l);
- }
-
- protected static String formatShort(int s) {
- boolean neg = false;
- if (s < 0) {
- neg = true;
- s = -s;
- }
- return String.format("%s0x%x", neg?"-":"", s);
- }
-
- protected static boolean isSupportedJmsMessageType(String jmsMessageType) {
- for (String supportedJmsMessageType: SUPPORTED_JMS_MESSAGE_TYPES) {
- if (jmsMessageType.equals(supportedJmsMessageType))
- return true;
- }
- return false;
- }
-
- private static class MyExceptionListener implements ExceptionListener {
- @Override
- public void onException(JMSException exception) {
- System.out.println("Connection ExceptionListener fired, exiting.");
- exception.printStackTrace(System.out);
- System.exit(1);
- }
- }
-}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[3/5] qpid-interop-test git commit: QPIDIT-97: Further fixes and
updates for the release of 0.1.0
Posted by kp...@apache.org.
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/4153bf17/shims/qpid-jms/src/main/java/org/apache/qpid/qpid_interop_test/jms_messages_test/Sender.java
----------------------------------------------------------------------
diff --git a/shims/qpid-jms/src/main/java/org/apache/qpid/qpid_interop_test/jms_messages_test/Sender.java b/shims/qpid-jms/src/main/java/org/apache/qpid/qpid_interop_test/jms_messages_test/Sender.java
deleted file mode 100644
index 5348663..0000000
--- a/shims/qpid-jms/src/main/java/org/apache/qpid/qpid_interop_test/jms_messages_test/Sender.java
+++ /dev/null
@@ -1,407 +0,0 @@
-/**
- * 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.qpid_interop_test.jms_messages_test;
-
-import java.io.Serializable;
-import java.io.StringReader;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import javax.jms.BytesMessage;
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.DeliveryMode;
-import javax.jms.ExceptionListener;
-import javax.jms.JMSException;
-import javax.jms.MapMessage;
-import javax.jms.Message;
-import javax.jms.MessageProducer;
-import javax.jms.ObjectMessage;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.jms.StreamMessage;
-import javax.jms.TextMessage;
-import javax.json.Json;
-import javax.json.JsonArray;
-import javax.json.JsonObject;
-import javax.json.JsonReader;
-import org.apache.qpid.jms.JmsConnectionFactory;
-
-public class Sender {
- private static final String USER = "guest";
- private static final String PASSWORD = "guest";
- private static final String[] SUPPORTED_JMS_MESSAGE_TYPES = {"JMS_MESSAGE_TYPE",
- "JMS_BYTESMESSAGE_TYPE",
- "JMS_MAPMESSAGE_TYPE",
- "JMS_OBJECTMESSAGE_TYPE",
- "JMS_STREAMMESSAGE_TYPE",
- "JMS_TEXTMESSAGE_TYPE"};
- Connection _connection;
- Session _session;
- Queue _queue;
- MessageProducer _messageProducer;
- int _msgsSent;
-
-
- // args[0]: Broker URL
- // args[1]: Queue name
- // args[2]: JMS message type
- // args[3]: JSON Test parameters containing testValueMap
- public static void main(String[] args) throws Exception {
- if (args.length != 4) {
- System.out.println("JmsSenderShim: Incorrect number of arguments");
- System.out.println("JmsSenderShim: Expected arguments: broker_address, queue_name, JMS_msg_type, JSON_send_params");
- System.exit(1);
- }
- String brokerAddress = "amqp://" + args[0];
- String queueName = args[1];
- String jmsMessageType = args[2];
- if (!isSupportedJmsMessageType(jmsMessageType)) {
- System.err.println("ERROR: JmsSender: Unknown or unsupported JMS message type \"" + jmsMessageType + "\"");
- System.exit(1);
- }
-
- JsonReader jsonReader = Json.createReader(new StringReader(args[3]));
- JsonObject testValuesMap = jsonReader.readObject();
- jsonReader.close();
-
- Sender shim = new Sender(brokerAddress, queueName);
- shim.runTests(jmsMessageType, testValuesMap);
- }
-
- public Sender(String brokerAddress, String queueName) {
- try {
- ConnectionFactory factory = (ConnectionFactory)new JmsConnectionFactory(brokerAddress);
-
- _connection = factory.createConnection();
- _connection.setExceptionListener(new MyExceptionListener());
- _connection.start();
-
- _session = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- _queue = _session.createQueue(queueName);
-
- _messageProducer = _session.createProducer(_queue);
-
- _msgsSent = 0;
- } catch (Exception exp) {
- System.out.println("Caught exception, exiting.");
- exp.printStackTrace(System.out);
- System.exit(1);
- }
- }
-
- public void runTests(String jmsMessageType, JsonObject testValuesMap) throws Exception {
- List<String> testValuesKeyList = new ArrayList<String>(testValuesMap.keySet());
- Collections.sort(testValuesKeyList);
- for (String key: testValuesKeyList) {
- JsonArray testValues = testValuesMap.getJsonArray(key);
- for (int i=0; i<testValues.size(); ++i) {
- String testValue = "";
- if (!testValues.isNull(i)) {
- testValue = testValues.getJsonString(i).getString();
- }
-
- // Send message
- Message msg = createMessage(jmsMessageType, key, testValue, i);
- _messageProducer.send(msg, DeliveryMode.NON_PERSISTENT, Message.DEFAULT_PRIORITY, Message.DEFAULT_TIME_TO_LIVE);
- _msgsSent++;
- }
- }
- _connection.close();
- }
-
- protected Message createMessage(String jmsMessageType, String key, String testValue, int i) throws Exception {
- Message message = null;
- switch (jmsMessageType) {
- case "JMS_MESSAGE_TYPE":
- message = createJMSMessage(key, testValue);
- break;
- case "JMS_BYTESMESSAGE_TYPE":
- message = createJMSBytesMessage(key, testValue);
- break;
- case "JMS_MAPMESSAGE_TYPE":
- message = createJMSMapMessage(key, testValue, i);
- break;
- case "JMS_OBJECTMESSAGE_TYPE":
- message = createJMSObjectMessage(key, testValue);
- break;
- case "JMS_STREAMMESSAGE_TYPE":
- message = createJMSStreamMessage(key, testValue);
- break;
- case "JMS_TEXTMESSAGE_TYPE":
- message = createTextMessage(testValue);
- break;
- default:
- throw new Exception("Internal exception: Unexpected JMS message type \"" + jmsMessageType + "\"");
- }
- return message;
- }
-
- protected Message createJMSMessage(String testValueType, String testValue) throws Exception, JMSException {
- if (testValueType.compareTo("none") != 0) {
- throw new Exception("Internal exception: Unexpected JMS message sub-type \"" + testValueType + "\"");
- }
- if (testValue.length() > 0) {
- throw new Exception("Internal exception: Unexpected JMS message value \"" + testValue + "\" for sub-type \"" + testValueType + "\"");
- }
- return _session.createMessage();
- }
-
- protected BytesMessage createJMSBytesMessage(String testValueType, String testValue) throws Exception, JMSException {
- BytesMessage message = _session.createBytesMessage();
- switch (testValueType) {
- case "boolean":
- message.writeBoolean(Boolean.parseBoolean(testValue));
- break;
- case "byte":
- message.writeByte(Byte.decode(testValue));
- break;
- case "bytes":
- message.writeBytes(testValue.getBytes());
- break;
- case "char":
- if (testValue.length() == 1) { // Char format: "X" or "\xNN"
- message.writeChar(testValue.charAt(0));
- } else {
- throw new Exception("JmsSenderShim.createJMSBytesMessage() Malformed char string: \"" + testValue + "\" of length " + testValue.length());
- }
- break;
- case "double":
- Long l1 = Long.parseLong(testValue.substring(2, 3), 16) << 60;
- Long l2 = Long.parseLong(testValue.substring(3), 16);
- message.writeDouble(Double.longBitsToDouble(l1 | l2));
- break;
- case "float":
- Long i = Long.parseLong(testValue.substring(2), 16);
- message.writeFloat(Float.intBitsToFloat(i.intValue()));
- break;
- case "int":
- message.writeInt(Integer.decode(testValue));
- break;
- case "long":
- message.writeLong(Long.decode(testValue));
- break;
- case "object":
- Object obj = (Object)createObject(testValue);
- message.writeObject(obj);
- break;
- case "short":
- message.writeShort(Short.decode(testValue));
- break;
- case "string":
- message.writeUTF(testValue);
- break;
- default:
- throw new Exception("Internal exception: Unexpected JMS message sub-type \"" + testValueType + "\"");
- }
- return message;
- }
-
- protected MapMessage createJMSMapMessage(String testValueType, String testValue, int testValueNum) throws Exception, JMSException {
- MapMessage message = _session.createMapMessage();
- String name = String.format("%s%03d", testValueType, testValueNum);
- switch (testValueType) {
- case "boolean":
- message.setBoolean(name, Boolean.parseBoolean(testValue));
- break;
- case "byte":
- message.setByte(name, Byte.decode(testValue));
- break;
- case "bytes":
- message.setBytes(name, testValue.getBytes());
- break;
- case "char":
- if (testValue.length() == 1) { // Char format: "X"
- message.setChar(name, testValue.charAt(0));
- } else if (testValue.length() == 6) { // Char format: "\xNNNN"
- message.setChar(name, (char)Integer.parseInt(testValue.substring(2), 16));
- } else {
- throw new Exception("JmsSenderShim.createJMSMapMessage() Malformed char string: \"" + testValue + "\"");
- }
- break;
- case "double":
- Long l1 = Long.parseLong(testValue.substring(2, 3), 16) << 60;
- Long l2 = Long.parseLong(testValue.substring(3), 16);
- message.setDouble(name, Double.longBitsToDouble(l1 | l2));
- break;
- case "float":
- Long i = Long.parseLong(testValue.substring(2), 16);
- message.setFloat(name, Float.intBitsToFloat(i.intValue()));
- break;
- case "int":
- message.setInt(name, Integer.decode(testValue));
- break;
- case "long":
- message.setLong(name, Long.decode(testValue));
- break;
- case "object":
- Object obj = (Object)createObject(testValue);
- message.setObject(name, obj);
- break;
- case "short":
- message.setShort(name, Short.decode(testValue));
- break;
- case "string":
- message.setString(name, testValue);
- break;
- default:
- throw new Exception("Internal exception: Unexpected JMS message sub-type \"" + testValueType + "\"");
- }
- return message;
- }
-
- protected ObjectMessage createJMSObjectMessage(String className, String testValue) throws Exception, JMSException {
- Serializable obj = createJavaObject(className, testValue);
- if (obj == null) {
- // TODO: Handle error here
- System.out.println("JmsSenderShim.createJMSObjectMessage: obj == null");
- return null;
- }
- ObjectMessage message = _session.createObjectMessage();
- message.setObject(obj);
- return message;
- }
-
- protected StreamMessage createJMSStreamMessage(String testValueType, String testValue) throws Exception, JMSException {
- StreamMessage message = _session.createStreamMessage();
- switch (testValueType) {
- case "boolean":
- message.writeBoolean(Boolean.parseBoolean(testValue));
- break;
- case "byte":
- message.writeByte(Byte.decode(testValue));
- break;
- case "bytes":
- message.writeBytes(testValue.getBytes());
- break;
- case "char":
- if (testValue.length() == 1) { // Char format: "X"
- message.writeChar(testValue.charAt(0));
- } else if (testValue.length() == 6) { // Char format: "\xNNNN"
- message.writeChar((char)Integer.parseInt(testValue.substring(2), 16));
- } else {
- throw new Exception("JmsSenderShim.createJMSStreamMessage() Malformed char string: \"" + testValue + "\"");
- }
- break;
- case "double":
- Long l1 = Long.parseLong(testValue.substring(2, 3), 16) << 60;
- Long l2 = Long.parseLong(testValue.substring(3), 16);
- message.writeDouble(Double.longBitsToDouble(l1 | l2));
- break;
- case "float":
- Long i = Long.parseLong(testValue.substring(2), 16);
- message.writeFloat(Float.intBitsToFloat(i.intValue()));
- break;
- case "int":
- message.writeInt(Integer.decode(testValue));
- break;
- case "long":
- message.writeLong(Long.decode(testValue));
- break;
- case "object":
- Object obj = (Object)createObject(testValue);
- message.writeObject(obj);
- break;
- case "short":
- message.writeShort(Short.decode(testValue));
- break;
- case "string":
- message.writeString(testValue);
- break;
- default:
- throw new Exception("JmsSenderShim.createJMSStreamMessage(): Unexpected JMS message sub-type \"" + testValueType + "\"");
- }
- return message;
- }
-
- protected static Serializable createJavaObject(String className, String testValue) throws Exception {
- Serializable obj = null;
- try {
- Class<?> c = Class.forName(className);
- if (className.compareTo("java.lang.Character") == 0) {
- Constructor ctor = c.getConstructor(char.class);
- if (testValue.length() == 1) {
- // Use first character of string
- obj = (Serializable)ctor.newInstance(testValue.charAt(0));
- } else if (testValue.length() == 4 || testValue.length() == 6) {
- // Format '\xNN' or '\xNNNN'
- obj = (Serializable)ctor.newInstance((char)Integer.parseInt(testValue.substring(2), 16));
- } else {
- throw new Exception("JmsSenderShim.createJavaObject(): Malformed char string: \"" + testValue + "\"");
- }
- } else {
- // Use string constructor
- Constructor ctor = c.getConstructor(String.class);
- obj = (Serializable)ctor.newInstance(testValue);
- }
- }
- catch (ClassNotFoundException e) {
- e.printStackTrace(System.out);
- }
- catch (NoSuchMethodException e) {
- e.printStackTrace(System.out);
- }
- catch (InstantiationException e) {
- e.printStackTrace(System.out);
- }
- catch (IllegalAccessException e) {
- e.printStackTrace(System.out);
- }
- catch (InvocationTargetException e) {
- e.printStackTrace(System.out);
- }
- return obj;
- }
-
- // value has format "classname:ctorstrvalue"
- protected static Serializable createObject(String value) throws Exception {
- Serializable obj = null;
- int colonIndex = value.indexOf(":");
- if (colonIndex >= 0) {
- String className = value.substring(0, colonIndex);
- String testValue = value.substring(colonIndex+1);
- obj = createJavaObject(className, testValue);
- } else {
- throw new Exception("createObject(): Malformed value string");
- }
- return obj;
- }
-
- protected TextMessage createTextMessage(String valueStr) throws JMSException {
- return _session.createTextMessage(valueStr);
- }
-
- protected static boolean isSupportedJmsMessageType(String jmsMessageType) {
- for (String supportedJmsMessageType: SUPPORTED_JMS_MESSAGE_TYPES) {
- if (jmsMessageType.equals(supportedJmsMessageType))
- return true;
- }
- return false;
- }
-
- private static class MyExceptionListener implements ExceptionListener {
- @Override
- public void onException(JMSException exception) {
- System.out.println("Connection ExceptionListener fired, exiting.");
- exception.printStackTrace(System.out);
- System.exit(1);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/4153bf17/shims/qpid-jms/src_not_yet_impl/main/java/org/apache/qpid/qpid_interop_test/jms_dtx_test/Receiver.java
----------------------------------------------------------------------
diff --git a/shims/qpid-jms/src_not_yet_impl/main/java/org/apache/qpid/qpid_interop_test/jms_dtx_test/Receiver.java b/shims/qpid-jms/src_not_yet_impl/main/java/org/apache/qpid/qpid_interop_test/jms_dtx_test/Receiver.java
deleted file mode 100644
index 0614e15..0000000
--- a/shims/qpid-jms/src_not_yet_impl/main/java/org/apache/qpid/qpid_interop_test/jms_dtx_test/Receiver.java
+++ /dev/null
@@ -1,407 +0,0 @@
-/**
- * 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.qpid_interop_test.jms_dtx_test;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.List;
-import javax.jms.BytesMessage;
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.Destination;
-import javax.jms.ExceptionListener;
-import javax.jms.JMSException;
-import javax.jms.MapMessage;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.ObjectMessage;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.jms.StreamMessage;
-import javax.jms.TextMessage;
-import javax.jms.Topic;
-import javax.json.Json;
-import javax.json.JsonArray;
-import javax.json.JsonArrayBuilder;
-import javax.json.JsonObject;
-import javax.json.JsonObjectBuilder;
-import javax.json.JsonReader;
-import javax.json.JsonWriter;
-import org.apache.qpid.jms.JmsConnectionFactory;
-
-public class Receiver {
- private static final String USER = "guest";
- private static final String PASSWORD = "guest";
- private static final int TIMEOUT = 1000;
- private static final String[] SUPPORTED_JMS_MESSAGE_TYPES = {"JMS_MESSAGE_TYPE",
- "JMS_BYTESMESSAGE_TYPE",
- "JMS_MAPMESSAGE_TYPE",
- "JMS_OBJECTMESSAGE_TYPE",
- "JMS_STREAMMESSAGE_TYPE",
- "JMS_TEXTMESSAGE_TYPE"};
- private static enum JMS_DESTINATION_TYPE {JMS_QUEUE, JMS_TEMPORARY_QUEUE, JMS_TOPIC, JMS_TEMPORARY_TOPIC};
-
- Connection _connection;
- Session _session;
- Queue _queue;
- MessageConsumer _messageConsumer;
- JsonObjectBuilder _jsonTestValueMapBuilder;
-
- // args[0]: Broker URL
- // args[1]: Queue name
- // args[2]: JMS message type
- // args[3]: JSON Test parameters containing testValuesMap
- public static void main(String[] args) throws Exception {
- if (args.length != 4) {
- System.out.println("JmsReceiverShim: Incorrect number of arguments");
- System.out.println("JmsReceiverShim: Expected arguments: broker_address, queue_name, JMS_msg_type, JSON_receive_params");
- System.exit(1);
- }
- String brokerAddress = "amqp://" + args[0];
- String queueName = args[1];
- String jmsMessageType = args[2];
- if (!isSupportedJmsMessageType(jmsMessageType)) {
- System.out.println("ERROR: JmsReceiverShim: Unknown or unsupported JMS message type \"" + jmsMessageType + "\"");
- System.exit(1);
- }
-
- JsonReader jsonReader = Json.createReader(new StringReader(args[3]));
- JsonObject numTestValuesMap = jsonReader.readObject();
- jsonReader.close();
-
- Receiver shim = new Receiver(brokerAddress, queueName);
- shim.run(jmsMessageType, numTestValuesMap);
- }
-
- public Receiver(String brokerAddress, String queueName) {
- try {
- _connection = null;
- ConnectionFactory factory = (ConnectionFactory)new JmsConnectionFactory(brokerAddress);
- _connection = factory.createConnection(USER, PASSWORD);
- _connection.setExceptionListener(new MyExceptionListener());
- _connection.start();
-
- _session = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- _queue = _session.createQueue(queueName);
-
- _messageConsumer = _session.createConsumer(_queue);
-
- _jsonTestValueMapBuilder = Json.createObjectBuilder();
- } catch (Exception exc) {
- if (_connection != null)
- try { _connection.close(); } catch (JMSException e) {}
- System.out.println("Caught exception, exiting.");
- exc.printStackTrace(System.out);
- System.exit(1);
- }
- }
-
- public void run(String jmsMessageType, JsonObject numTestValuesMap) {
- try {
- List<String> subTypeKeyList = new ArrayList<String>(numTestValuesMap.keySet());
- Collections.sort(subTypeKeyList);
-
- Message message = null;
-
- for (String subType: subTypeKeyList) {
- JsonArrayBuilder jasonTestValuesArrayBuilder = Json.createArrayBuilder();
- for (int i=0; i<numTestValuesMap.getJsonNumber(subType).intValue(); ++i) {
- message = _messageConsumer.receive(TIMEOUT);
- if (message == null) break;
- switch (jmsMessageType) {
- case "JMS_MESSAGE_TYPE":
- processJMSMessage(jasonTestValuesArrayBuilder);
- break;
- case "JMS_BYTESMESSAGE_TYPE":
- processJMSBytesMessage(jmsMessageType, subType, message, jasonTestValuesArrayBuilder);
- break;
- case "JMS_STREAMMESSAGE_TYPE":
- processJMSStreamMessage(jmsMessageType, subType, message, jasonTestValuesArrayBuilder);
- break;
- case "JMS_MAPMESSAGE_TYPE":
- processJMSMapMessage(jmsMessageType, subType, i, message, jasonTestValuesArrayBuilder);
- break;
- case "JMS_OBJECTMESSAGE_TYPE":
- processJMSObjectMessage(subType, message, jasonTestValuesArrayBuilder);
- break;
- case "JMS_TEXTMESSAGE_TYPE":
- processJMSTextMessage(message, jasonTestValuesArrayBuilder);
- break;
- default:
- _connection.close();
- throw new Exception("JmsReceiverShim: Internal error: Unknown or unsupported JMS message type \"" + jmsMessageType + "\"");
- }
- }
- _jsonTestValueMapBuilder.add(subType, jasonTestValuesArrayBuilder);
- }
- _connection.close();
-
- System.out.println(jmsMessageType);
- StringWriter out = new StringWriter();
- writeJsonObject(_jsonTestValueMapBuilder, out);
- System.out.println(out.toString());
- } catch (Exception exp) {
- try { _connection.close(); } catch (JMSException e) {}
- System.out.println("Caught exception, exiting.");
- exp.printStackTrace(System.out);
- System.exit(1);
- }
- }
-
- protected void processJMSMessage(JsonArrayBuilder jasonTestValuesArrayBuilder) {
- jasonTestValuesArrayBuilder.addNull();
- }
-
- protected void processJMSBytesMessage(String jmsMessageType, String subType, Message message, JsonArrayBuilder jasonTestValuesArrayBuilder) throws Exception, JMSException, IOException, ClassNotFoundException {
- switch (subType) {
- case "boolean":
- jasonTestValuesArrayBuilder.add(((BytesMessage)message).readBoolean()?"True":"False");
- break;
- case "byte":
- jasonTestValuesArrayBuilder.add(formatByte(((BytesMessage)message).readByte()));
- break;
- case "bytes":
- {
- byte[] bytesBuff = new byte[65536];
- int numBytesRead = ((BytesMessage)message).readBytes(bytesBuff);
- if (numBytesRead >= 0) {
- jasonTestValuesArrayBuilder.add(new String(Arrays.copyOfRange(bytesBuff, 0, numBytesRead)));
- } else {
- // NOTE: For this case, an empty byte array has nothing to return
- jasonTestValuesArrayBuilder.add(new String());
- }
- }
- break;
- case "char":
- jasonTestValuesArrayBuilder.add(formatChar(((BytesMessage)message).readChar()));
- break;
- case "double":
- long l = Double.doubleToRawLongBits(((BytesMessage)message).readDouble());
- jasonTestValuesArrayBuilder.add(String.format("0x%16s", Long.toHexString(l)).replace(' ', '0'));
- break;
- case "float":
- int i0 = Float.floatToRawIntBits(((BytesMessage)message).readFloat());
- jasonTestValuesArrayBuilder.add(String.format("0x%8s", Integer.toHexString(i0)).replace(' ', '0'));
- break;
- case "int":
- jasonTestValuesArrayBuilder.add(formatInt(((BytesMessage)message).readInt()));
- break;
- case "long":
- jasonTestValuesArrayBuilder.add(formatLong(((BytesMessage)message).readLong()));
- break;
- case "object":
- {
- byte[] bytesBuff = new byte[65536];
- int numBytesRead = ((BytesMessage)message).readBytes(bytesBuff);
- if (numBytesRead >= 0) {
- ByteArrayInputStream bais = new ByteArrayInputStream(Arrays.copyOfRange(bytesBuff, 0, numBytesRead));
- ObjectInputStream ois = new ObjectInputStream(bais);
- Object obj = ois.readObject();
- jasonTestValuesArrayBuilder.add(obj.getClass().getName() + ":" + obj.toString());
- } else {
- jasonTestValuesArrayBuilder.add("<object error>");
- }
- }
- break;
- case "short":
- jasonTestValuesArrayBuilder.add(formatShort(((BytesMessage)message).readShort()));
- break;
- case "string":
- jasonTestValuesArrayBuilder.add(((BytesMessage)message).readUTF());
- break;
- default:
- throw new Exception("JmsReceiverShim: Unknown subtype for " + jmsMessageType + ": \"" + subType + "\"");
- }
- }
-
- protected void processJMSMapMessage(String jmsMessageType, String subType, int count, Message message, JsonArrayBuilder jasonTestValuesArrayBuilder) throws Exception, JMSException {
- String name = String.format("%s%03d", subType, count);
- switch (subType) {
- case "boolean":
- jasonTestValuesArrayBuilder.add(((MapMessage)message).getBoolean(name)?"True":"False");
- break;
- case "byte":
- jasonTestValuesArrayBuilder.add(formatByte(((MapMessage)message).getByte(name)));
- break;
- case "bytes":
- jasonTestValuesArrayBuilder.add(new String(((MapMessage)message).getBytes(name)));
- break;
- case "char":
- jasonTestValuesArrayBuilder.add(formatChar(((MapMessage)message).getChar(name)));
- break;
- case "double":
- long l = Double.doubleToRawLongBits(((MapMessage)message).getDouble(name));
- jasonTestValuesArrayBuilder.add(String.format("0x%16s", Long.toHexString(l)).replace(' ', '0'));
- break;
- case "float":
- int i0 = Float.floatToRawIntBits(((MapMessage)message).getFloat(name));
- jasonTestValuesArrayBuilder.add(String.format("0x%8s", Integer.toHexString(i0)).replace(' ', '0'));
- break;
- case "int":
- jasonTestValuesArrayBuilder.add(formatInt(((MapMessage)message).getInt(name)));
- break;
- case "long":
- jasonTestValuesArrayBuilder.add(formatLong(((MapMessage)message).getLong(name)));
- break;
- case "object":
- Object obj = ((MapMessage)message).getObject(name);
- jasonTestValuesArrayBuilder.add(obj.getClass().getName() + ":" + obj.toString());
- break;
- case "short":
- jasonTestValuesArrayBuilder.add(formatShort(((MapMessage)message).getShort(name)));
- break;
- case "string":
- jasonTestValuesArrayBuilder.add(((MapMessage)message).getString(name));
- break;
- default:
- throw new Exception("JmsReceiverShim: Unknown subtype for " + jmsMessageType + ": \"" + subType + "\"");
- }
- }
-
- protected void processJMSObjectMessage(String subType, Message message, JsonArrayBuilder jasonTestValuesArrayBuilder) throws JMSException {
- jasonTestValuesArrayBuilder.add(((ObjectMessage)message).getObject().toString());
- }
-
- protected void processJMSStreamMessage(String jmsMessageType, String subType, Message message, JsonArrayBuilder jasonTestValuesArrayBuilder) throws Exception, JMSException {
- switch (subType) {
- case "boolean":
- jasonTestValuesArrayBuilder.add(((StreamMessage)message).readBoolean()?"True":"False");
- break;
- case "byte":
- jasonTestValuesArrayBuilder.add(formatByte(((StreamMessage)message).readByte()));
- break;
- case "bytes":
- byte[] bytesBuff = new byte[65536];
- int numBytesRead = ((StreamMessage)message).readBytes(bytesBuff);
- if (numBytesRead >= 0) {
- jasonTestValuesArrayBuilder.add(new String(Arrays.copyOfRange(bytesBuff, 0, numBytesRead)));
- } else {
- System.out.println("StreamMessage.readBytes() returned " + numBytesRead);
- jasonTestValuesArrayBuilder.add("<bytes error>");
- }
- break;
- case "char":
- jasonTestValuesArrayBuilder.add(formatChar(((StreamMessage)message).readChar()));
- break;
- case "double":
- long l = Double.doubleToRawLongBits(((StreamMessage)message).readDouble());
- jasonTestValuesArrayBuilder.add(String.format("0x%16s", Long.toHexString(l)).replace(' ', '0'));
- break;
- case "float":
- int i0 = Float.floatToRawIntBits(((StreamMessage)message).readFloat());
- jasonTestValuesArrayBuilder.add(String.format("0x%8s", Integer.toHexString(i0)).replace(' ', '0'));
- break;
- case "int":
- jasonTestValuesArrayBuilder.add(formatInt(((StreamMessage)message).readInt()));
- break;
- case "long":
- jasonTestValuesArrayBuilder.add(formatLong(((StreamMessage)message).readLong()));
- break;
- case "object":
- Object obj = ((StreamMessage)message).readObject();
- jasonTestValuesArrayBuilder.add(obj.getClass().getName() + ":" + obj.toString());
- break;
- case "short":
- jasonTestValuesArrayBuilder.add(formatShort(((StreamMessage)message).readShort()));
- break;
- case "string":
- jasonTestValuesArrayBuilder.add(((StreamMessage)message).readString());
- break;
- default:
- throw new Exception("JmsReceiverShim: Unknown subtype for " + jmsMessageType + ": \"" + subType + "\"");
- }
- }
-
- protected void processJMSTextMessage(Message message, JsonArrayBuilder jasonTestValuesArrayBuilder) throws JMSException {
- jasonTestValuesArrayBuilder.add(((TextMessage)message).getText());
- }
-
- protected static void writeJsonObject(JsonObjectBuilder builder, StringWriter out) {
- JsonWriter jsonWriter = Json.createWriter(out);
- jsonWriter.writeObject(builder.build());
- jsonWriter.close();
- }
-
- protected static String formatByte(byte b) {
- boolean neg = false;
- if (b < 0) {
- neg = true;
- b = (byte)-b;
- }
- return String.format("%s0x%x", neg?"-":"", b);
- }
-
- protected static String formatChar(char c) {
- if (Character.isLetterOrDigit(c)) {
- return String.format("%c", c);
- }
- char[] ca = {c};
- return new String(ca);
- }
-
- protected static String formatInt(int i) {
- boolean neg = false;
- if (i < 0) {
- neg = true;
- i = -i;
- }
- return String.format("%s0x%x", neg?"-":"", i);
- }
-
- protected static String formatLong(long l) {
- boolean neg = false;
- if (l < 0) {
- neg = true;
- l = -l;
- }
- return String.format("%s0x%x", neg?"-":"", l);
- }
-
- protected static String formatShort(int s) {
- boolean neg = false;
- if (s < 0) {
- neg = true;
- s = -s;
- }
- return String.format("%s0x%x", neg?"-":"", s);
- }
-
- protected static boolean isSupportedJmsMessageType(String jmsMessageType) {
- for (String supportedJmsMessageType: SUPPORTED_JMS_MESSAGE_TYPES) {
- if (jmsMessageType.equals(supportedJmsMessageType))
- return true;
- }
- return false;
- }
-
- private static class MyExceptionListener implements ExceptionListener {
- @Override
- public void onException(JMSException exception) {
- System.out.println("Connection ExceptionListener fired, exiting.");
- exception.printStackTrace(System.out);
- System.exit(1);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/4153bf17/shims/qpid-jms/src_not_yet_impl/main/java/org/apache/qpid/qpid_interop_test/jms_dtx_test/Sender.java
----------------------------------------------------------------------
diff --git a/shims/qpid-jms/src_not_yet_impl/main/java/org/apache/qpid/qpid_interop_test/jms_dtx_test/Sender.java b/shims/qpid-jms/src_not_yet_impl/main/java/org/apache/qpid/qpid_interop_test/jms_dtx_test/Sender.java
deleted file mode 100644
index c5b3506..0000000
--- a/shims/qpid-jms/src_not_yet_impl/main/java/org/apache/qpid/qpid_interop_test/jms_dtx_test/Sender.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/**
- * 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.qpid_interop_test.jms_dtx_test;
-
-import java.io.Serializable;
-import java.io.StringReader;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import javax.jms.BytesMessage;
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.DeliveryMode;
-import javax.jms.ExceptionListener;
-import javax.jms.JMSException;
-import javax.jms.MapMessage;
-import javax.jms.Message;
-import javax.jms.MessageProducer;
-import javax.jms.ObjectMessage;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.jms.StreamMessage;
-import javax.jms.TextMessage;
-import javax.json.Json;
-import javax.json.JsonArray;
-import javax.json.JsonObject;
-import javax.json.JsonReader;
-import org.apache.qpid.jms.JmsConnectionFactory;
-
-public class Sender {
- private static final String USER = "guest";
- private static final String PASSWORD = "guest";
- private static final String[] SUPPORTED_JMS_MESSAGE_TYPES = {"JMS_MESSAGE_TYPE",
- "JMS_BYTESMESSAGE_TYPE",
- "JMS_MAPMESSAGE_TYPE",
- "JMS_OBJECTMESSAGE_TYPE",
- "JMS_STREAMMESSAGE_TYPE",
- "JMS_TEXTMESSAGE_TYPE"};
- Connection _connection;
- Session _session;
- Queue _queue;
- MessageProducer _messageProducer;
- int _msgsSent;
-
-
- // args[0]: Broker URL
- // args[1]: Queue name
- // ...
- public static void main(String[] args) throws Exception {
- if (args.length != 2) {
- System.out.println("JmsSenderShim: Incorrect number of arguments");
- System.out.println("JmsSenderShim: Expected arguments: broker_address, queue_name, ...");
- System.exit(1);
- }
- String brokerAddress = "amqp://" + args[0];
- String queueName = args[1];
-
- Sender shim = new Sender(brokerAddress, queueName);
- shim.runTests();
- }
-
- public Sender(String brokerAddress, String queueName) {
- try {
- ConnectionFactory factory = (ConnectionFactory)new JmsConnectionFactory(brokerAddress);
-
- _connection = factory.createConnection();
- _connection.setExceptionListener(new MyExceptionListener());
- _connection.start();
-
- _session = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- _queue = _session.createQueue(queueName);
-
- _messageProducer = _session.createProducer(_queue);
-
- _msgsSent = 0;
- } catch (Exception exp) {
- System.out.println("Caught exception, exiting.");
- exp.printStackTrace(System.out);
- System.exit(1);
- }
- }
-
- public void runTests() throws Exception {
- _connection.close();
- }
-
-
- private static class MyExceptionListener implements ExceptionListener {
- @Override
- public void onException(JMSException exception) {
- System.out.println("Connection ExceptionListener fired, exiting.");
- exception.printStackTrace(System.out);
- System.exit(1);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/4153bf17/shims/qpid-jms/src_not_yet_impl/main/java/org/apache/qpid/qpid_interop_test/jms_large_content_test/Receiver.java
----------------------------------------------------------------------
diff --git a/shims/qpid-jms/src_not_yet_impl/main/java/org/apache/qpid/qpid_interop_test/jms_large_content_test/Receiver.java b/shims/qpid-jms/src_not_yet_impl/main/java/org/apache/qpid/qpid_interop_test/jms_large_content_test/Receiver.java
deleted file mode 100644
index 2fb8ac7..0000000
--- a/shims/qpid-jms/src_not_yet_impl/main/java/org/apache/qpid/qpid_interop_test/jms_large_content_test/Receiver.java
+++ /dev/null
@@ -1,407 +0,0 @@
-/**
- * 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.qpid_interop_test.jms_large_content_test;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.List;
-import javax.jms.BytesMessage;
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.Destination;
-import javax.jms.ExceptionListener;
-import javax.jms.JMSException;
-import javax.jms.MapMessage;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.ObjectMessage;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.jms.StreamMessage;
-import javax.jms.TextMessage;
-import javax.jms.Topic;
-import javax.json.Json;
-import javax.json.JsonArray;
-import javax.json.JsonArrayBuilder;
-import javax.json.JsonObject;
-import javax.json.JsonObjectBuilder;
-import javax.json.JsonReader;
-import javax.json.JsonWriter;
-import org.apache.qpid.jms.JmsConnectionFactory;
-
-public class Receiver {
- private static final String USER = "guest";
- private static final String PASSWORD = "guest";
- private static final int TIMEOUT = 1000;
- private static final String[] SUPPORTED_JMS_MESSAGE_TYPES = {"JMS_MESSAGE_TYPE",
- "JMS_BYTESMESSAGE_TYPE",
- "JMS_MAPMESSAGE_TYPE",
- "JMS_OBJECTMESSAGE_TYPE",
- "JMS_STREAMMESSAGE_TYPE",
- "JMS_TEXTMESSAGE_TYPE"};
- private static enum JMS_DESTINATION_TYPE {JMS_QUEUE, JMS_TEMPORARY_QUEUE, JMS_TOPIC, JMS_TEMPORARY_TOPIC};
-
- Connection _connection;
- Session _session;
- Queue _queue;
- MessageConsumer _messageConsumer;
- JsonObjectBuilder _jsonTestValueMapBuilder;
-
- // args[0]: Broker URL
- // args[1]: Queue name
- // args[2]: JMS message type
- // args[3]: JSON Test parameters containing testValuesMap
- public static void main(String[] args) throws Exception {
- if (args.length != 4) {
- System.out.println("JmsReceiverShim: Incorrect number of arguments");
- System.out.println("JmsReceiverShim: Expected arguments: broker_address, queue_name, JMS_msg_type, JSON_receive_params");
- System.exit(1);
- }
- String brokerAddress = "amqp://" + args[0];
- String queueName = args[1];
- String jmsMessageType = args[2];
- if (!isSupportedJmsMessageType(jmsMessageType)) {
- System.out.println("ERROR: JmsReceiverShim: Unknown or unsupported JMS message type \"" + jmsMessageType + "\"");
- System.exit(1);
- }
-
- JsonReader jsonReader = Json.createReader(new StringReader(args[3]));
- JsonObject numTestValuesMap = jsonReader.readObject();
- jsonReader.close();
-
- Receiver shim = new Receiver(brokerAddress, queueName);
- shim.run(jmsMessageType, numTestValuesMap);
- }
-
- public Receiver(String brokerAddress, String queueName) {
- try {
- _connection = null;
- ConnectionFactory factory = (ConnectionFactory)new JmsConnectionFactory(brokerAddress);
- _connection = factory.createConnection(USER, PASSWORD);
- _connection.setExceptionListener(new MyExceptionListener());
- _connection.start();
-
- _session = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- _queue = _session.createQueue(queueName);
-
- _messageConsumer = _session.createConsumer(_queue);
-
- _jsonTestValueMapBuilder = Json.createObjectBuilder();
- } catch (Exception exc) {
- if (_connection != null)
- try { _connection.close(); } catch (JMSException e) {}
- System.out.println("Caught exception, exiting.");
- exc.printStackTrace(System.out);
- System.exit(1);
- }
- }
-
- public void run(String jmsMessageType, JsonObject numTestValuesMap) {
- try {
- List<String> subTypeKeyList = new ArrayList<String>(numTestValuesMap.keySet());
- Collections.sort(subTypeKeyList);
-
- Message message = null;
-
- for (String subType: subTypeKeyList) {
- JsonArrayBuilder jasonTestValuesArrayBuilder = Json.createArrayBuilder();
- for (int i=0; i<numTestValuesMap.getJsonNumber(subType).intValue(); ++i) {
- message = _messageConsumer.receive(TIMEOUT);
- if (message == null) break;
- switch (jmsMessageType) {
- case "JMS_MESSAGE_TYPE":
- processJMSMessage(jasonTestValuesArrayBuilder);
- break;
- case "JMS_BYTESMESSAGE_TYPE":
- processJMSBytesMessage(jmsMessageType, subType, message, jasonTestValuesArrayBuilder);
- break;
- case "JMS_STREAMMESSAGE_TYPE":
- processJMSStreamMessage(jmsMessageType, subType, message, jasonTestValuesArrayBuilder);
- break;
- case "JMS_MAPMESSAGE_TYPE":
- processJMSMapMessage(jmsMessageType, subType, i, message, jasonTestValuesArrayBuilder);
- break;
- case "JMS_OBJECTMESSAGE_TYPE":
- processJMSObjectMessage(subType, message, jasonTestValuesArrayBuilder);
- break;
- case "JMS_TEXTMESSAGE_TYPE":
- processJMSTextMessage(message, jasonTestValuesArrayBuilder);
- break;
- default:
- _connection.close();
- throw new Exception("JmsReceiverShim: Internal error: Unknown or unsupported JMS message type \"" + jmsMessageType + "\"");
- }
- }
- _jsonTestValueMapBuilder.add(subType, jasonTestValuesArrayBuilder);
- }
- _connection.close();
-
- System.out.println(jmsMessageType);
- StringWriter out = new StringWriter();
- writeJsonObject(_jsonTestValueMapBuilder, out);
- System.out.println(out.toString());
- } catch (Exception exp) {
- try { _connection.close(); } catch (JMSException e) {}
- System.out.println("Caught exception, exiting.");
- exp.printStackTrace(System.out);
- System.exit(1);
- }
- }
-
- protected void processJMSMessage(JsonArrayBuilder jasonTestValuesArrayBuilder) {
- jasonTestValuesArrayBuilder.addNull();
- }
-
- protected void processJMSBytesMessage(String jmsMessageType, String subType, Message message, JsonArrayBuilder jasonTestValuesArrayBuilder) throws Exception, JMSException, IOException, ClassNotFoundException {
- switch (subType) {
- case "boolean":
- jasonTestValuesArrayBuilder.add(((BytesMessage)message).readBoolean()?"True":"False");
- break;
- case "byte":
- jasonTestValuesArrayBuilder.add(formatByte(((BytesMessage)message).readByte()));
- break;
- case "bytes":
- {
- byte[] bytesBuff = new byte[65536];
- int numBytesRead = ((BytesMessage)message).readBytes(bytesBuff);
- if (numBytesRead >= 0) {
- jasonTestValuesArrayBuilder.add(new String(Arrays.copyOfRange(bytesBuff, 0, numBytesRead)));
- } else {
- // NOTE: For this case, an empty byte array has nothing to return
- jasonTestValuesArrayBuilder.add(new String());
- }
- }
- break;
- case "char":
- jasonTestValuesArrayBuilder.add(formatChar(((BytesMessage)message).readChar()));
- break;
- case "double":
- long l = Double.doubleToRawLongBits(((BytesMessage)message).readDouble());
- jasonTestValuesArrayBuilder.add(String.format("0x%16s", Long.toHexString(l)).replace(' ', '0'));
- break;
- case "float":
- int i0 = Float.floatToRawIntBits(((BytesMessage)message).readFloat());
- jasonTestValuesArrayBuilder.add(String.format("0x%8s", Integer.toHexString(i0)).replace(' ', '0'));
- break;
- case "int":
- jasonTestValuesArrayBuilder.add(formatInt(((BytesMessage)message).readInt()));
- break;
- case "long":
- jasonTestValuesArrayBuilder.add(formatLong(((BytesMessage)message).readLong()));
- break;
- case "object":
- {
- byte[] bytesBuff = new byte[65536];
- int numBytesRead = ((BytesMessage)message).readBytes(bytesBuff);
- if (numBytesRead >= 0) {
- ByteArrayInputStream bais = new ByteArrayInputStream(Arrays.copyOfRange(bytesBuff, 0, numBytesRead));
- ObjectInputStream ois = new ObjectInputStream(bais);
- Object obj = ois.readObject();
- jasonTestValuesArrayBuilder.add(obj.getClass().getName() + ":" + obj.toString());
- } else {
- jasonTestValuesArrayBuilder.add("<object error>");
- }
- }
- break;
- case "short":
- jasonTestValuesArrayBuilder.add(formatShort(((BytesMessage)message).readShort()));
- break;
- case "string":
- jasonTestValuesArrayBuilder.add(((BytesMessage)message).readUTF());
- break;
- default:
- throw new Exception("JmsReceiverShim: Unknown subtype for " + jmsMessageType + ": \"" + subType + "\"");
- }
- }
-
- protected void processJMSMapMessage(String jmsMessageType, String subType, int count, Message message, JsonArrayBuilder jasonTestValuesArrayBuilder) throws Exception, JMSException {
- String name = String.format("%s%03d", subType, count);
- switch (subType) {
- case "boolean":
- jasonTestValuesArrayBuilder.add(((MapMessage)message).getBoolean(name)?"True":"False");
- break;
- case "byte":
- jasonTestValuesArrayBuilder.add(formatByte(((MapMessage)message).getByte(name)));
- break;
- case "bytes":
- jasonTestValuesArrayBuilder.add(new String(((MapMessage)message).getBytes(name)));
- break;
- case "char":
- jasonTestValuesArrayBuilder.add(formatChar(((MapMessage)message).getChar(name)));
- break;
- case "double":
- long l = Double.doubleToRawLongBits(((MapMessage)message).getDouble(name));
- jasonTestValuesArrayBuilder.add(String.format("0x%16s", Long.toHexString(l)).replace(' ', '0'));
- break;
- case "float":
- int i0 = Float.floatToRawIntBits(((MapMessage)message).getFloat(name));
- jasonTestValuesArrayBuilder.add(String.format("0x%8s", Integer.toHexString(i0)).replace(' ', '0'));
- break;
- case "int":
- jasonTestValuesArrayBuilder.add(formatInt(((MapMessage)message).getInt(name)));
- break;
- case "long":
- jasonTestValuesArrayBuilder.add(formatLong(((MapMessage)message).getLong(name)));
- break;
- case "object":
- Object obj = ((MapMessage)message).getObject(name);
- jasonTestValuesArrayBuilder.add(obj.getClass().getName() + ":" + obj.toString());
- break;
- case "short":
- jasonTestValuesArrayBuilder.add(formatShort(((MapMessage)message).getShort(name)));
- break;
- case "string":
- jasonTestValuesArrayBuilder.add(((MapMessage)message).getString(name));
- break;
- default:
- throw new Exception("JmsReceiverShim: Unknown subtype for " + jmsMessageType + ": \"" + subType + "\"");
- }
- }
-
- protected void processJMSObjectMessage(String subType, Message message, JsonArrayBuilder jasonTestValuesArrayBuilder) throws JMSException {
- jasonTestValuesArrayBuilder.add(((ObjectMessage)message).getObject().toString());
- }
-
- protected void processJMSStreamMessage(String jmsMessageType, String subType, Message message, JsonArrayBuilder jasonTestValuesArrayBuilder) throws Exception, JMSException {
- switch (subType) {
- case "boolean":
- jasonTestValuesArrayBuilder.add(((StreamMessage)message).readBoolean()?"True":"False");
- break;
- case "byte":
- jasonTestValuesArrayBuilder.add(formatByte(((StreamMessage)message).readByte()));
- break;
- case "bytes":
- byte[] bytesBuff = new byte[65536];
- int numBytesRead = ((StreamMessage)message).readBytes(bytesBuff);
- if (numBytesRead >= 0) {
- jasonTestValuesArrayBuilder.add(new String(Arrays.copyOfRange(bytesBuff, 0, numBytesRead)));
- } else {
- System.out.println("StreamMessage.readBytes() returned " + numBytesRead);
- jasonTestValuesArrayBuilder.add("<bytes error>");
- }
- break;
- case "char":
- jasonTestValuesArrayBuilder.add(formatChar(((StreamMessage)message).readChar()));
- break;
- case "double":
- long l = Double.doubleToRawLongBits(((StreamMessage)message).readDouble());
- jasonTestValuesArrayBuilder.add(String.format("0x%16s", Long.toHexString(l)).replace(' ', '0'));
- break;
- case "float":
- int i0 = Float.floatToRawIntBits(((StreamMessage)message).readFloat());
- jasonTestValuesArrayBuilder.add(String.format("0x%8s", Integer.toHexString(i0)).replace(' ', '0'));
- break;
- case "int":
- jasonTestValuesArrayBuilder.add(formatInt(((StreamMessage)message).readInt()));
- break;
- case "long":
- jasonTestValuesArrayBuilder.add(formatLong(((StreamMessage)message).readLong()));
- break;
- case "object":
- Object obj = ((StreamMessage)message).readObject();
- jasonTestValuesArrayBuilder.add(obj.getClass().getName() + ":" + obj.toString());
- break;
- case "short":
- jasonTestValuesArrayBuilder.add(formatShort(((StreamMessage)message).readShort()));
- break;
- case "string":
- jasonTestValuesArrayBuilder.add(((StreamMessage)message).readString());
- break;
- default:
- throw new Exception("JmsReceiverShim: Unknown subtype for " + jmsMessageType + ": \"" + subType + "\"");
- }
- }
-
- protected void processJMSTextMessage(Message message, JsonArrayBuilder jasonTestValuesArrayBuilder) throws JMSException {
- jasonTestValuesArrayBuilder.add(((TextMessage)message).getText());
- }
-
- protected static void writeJsonObject(JsonObjectBuilder builder, StringWriter out) {
- JsonWriter jsonWriter = Json.createWriter(out);
- jsonWriter.writeObject(builder.build());
- jsonWriter.close();
- }
-
- protected static String formatByte(byte b) {
- boolean neg = false;
- if (b < 0) {
- neg = true;
- b = (byte)-b;
- }
- return String.format("%s0x%x", neg?"-":"", b);
- }
-
- protected static String formatChar(char c) {
- if (Character.isLetterOrDigit(c)) {
- return String.format("%c", c);
- }
- char[] ca = {c};
- return new String(ca);
- }
-
- protected static String formatInt(int i) {
- boolean neg = false;
- if (i < 0) {
- neg = true;
- i = -i;
- }
- return String.format("%s0x%x", neg?"-":"", i);
- }
-
- protected static String formatLong(long l) {
- boolean neg = false;
- if (l < 0) {
- neg = true;
- l = -l;
- }
- return String.format("%s0x%x", neg?"-":"", l);
- }
-
- protected static String formatShort(int s) {
- boolean neg = false;
- if (s < 0) {
- neg = true;
- s = -s;
- }
- return String.format("%s0x%x", neg?"-":"", s);
- }
-
- protected static boolean isSupportedJmsMessageType(String jmsMessageType) {
- for (String supportedJmsMessageType: SUPPORTED_JMS_MESSAGE_TYPES) {
- if (jmsMessageType.equals(supportedJmsMessageType))
- return true;
- }
- return false;
- }
-
- private static class MyExceptionListener implements ExceptionListener {
- @Override
- public void onException(JMSException exception) {
- System.out.println("Connection ExceptionListener fired, exiting.");
- exception.printStackTrace(System.out);
- System.exit(1);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/4153bf17/shims/qpid-jms/src_not_yet_impl/main/java/org/apache/qpid/qpid_interop_test/jms_large_content_test/Sender.java
----------------------------------------------------------------------
diff --git a/shims/qpid-jms/src_not_yet_impl/main/java/org/apache/qpid/qpid_interop_test/jms_large_content_test/Sender.java b/shims/qpid-jms/src_not_yet_impl/main/java/org/apache/qpid/qpid_interop_test/jms_large_content_test/Sender.java
deleted file mode 100644
index 0980e67..0000000
--- a/shims/qpid-jms/src_not_yet_impl/main/java/org/apache/qpid/qpid_interop_test/jms_large_content_test/Sender.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/**
- * 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.qpid_interop_test.jms_large_content_test;
-
-import java.io.Serializable;
-import java.io.StringReader;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import javax.jms.BytesMessage;
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.DeliveryMode;
-import javax.jms.ExceptionListener;
-import javax.jms.JMSException;
-import javax.jms.MapMessage;
-import javax.jms.Message;
-import javax.jms.MessageProducer;
-import javax.jms.ObjectMessage;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.jms.StreamMessage;
-import javax.jms.TextMessage;
-import javax.json.Json;
-import javax.json.JsonArray;
-import javax.json.JsonObject;
-import javax.json.JsonReader;
-import org.apache.qpid.jms.JmsConnectionFactory;
-
-public class Sender {
- private static final String USER = "guest";
- private static final String PASSWORD = "guest";
- private static final String[] SUPPORTED_JMS_MESSAGE_TYPES = {"JMS_MESSAGE_TYPE",
- "JMS_BYTESMESSAGE_TYPE",
- "JMS_MAPMESSAGE_TYPE",
- "JMS_OBJECTMESSAGE_TYPE",
- "JMS_STREAMMESSAGE_TYPE",
- "JMS_TEXTMESSAGE_TYPE"};
- Connection _connection;
- Session _session;
- Queue _queue;
- MessageProducer _messageProducer;
- int _msgsSent;
-
-
- // args[0]: Broker URL
- // args[1]: Queue name
- // ...
- public static void main(String[] args) throws Exception {
- if (args.length != 2) {
- System.out.println("JmsSenderShim: Incorrect number of arguments");
- System.out.println("JmsSenderShim: Expected arguments: broker_address, queue_name, ...");
- System.exit(1);
- }
- String brokerAddress = "amqp://" + args[0];
- String queueName = args[1];
-
- Sender shim = new Sender(brokerAddress, queueName);
- shim.runTests();
- }
-
- public Sender(String brokerAddress, String queueName) {
- try {
- ConnectionFactory factory = (ConnectionFactory)new JmsConnectionFactory(brokerAddress);
-
- _connection = factory.createConnection();
- _connection.setExceptionListener(new MyExceptionListener());
- _connection.start();
-
- _session = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- _queue = _session.createQueue(queueName);
-
- _messageProducer = _session.createProducer(_queue);
-
- _msgsSent = 0;
- } catch (Exception exp) {
- System.out.println("Caught exception, exiting.");
- exp.printStackTrace(System.out);
- System.exit(1);
- }
- }
-
- public void runTests() throws Exception {
- _connection.close();
- }
-
-
- private static class MyExceptionListener implements ExceptionListener {
- @Override
- public void onException(JMSException exception) {
- System.out.println("Connection ExceptionListener fired, exiting.");
- exception.printStackTrace(System.out);
- System.exit(1);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/4153bf17/shims/qpid-proton-cpp/src/not_yet_impl/amqp_dtx_test/Receiver.cpp
----------------------------------------------------------------------
diff --git a/shims/qpid-proton-cpp/src/not_yet_impl/amqp_dtx_test/Receiver.cpp b/shims/qpid-proton-cpp/src/not_yet_impl/amqp_dtx_test/Receiver.cpp
deleted file mode 100644
index eb5dbed..0000000
--- a/shims/qpid-proton-cpp/src/not_yet_impl/amqp_dtx_test/Receiver.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- *
- * 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.
- *
- */
-
-#include "qpidit/amqp_dtx_test/Receiver.hpp"
-
-#include <stdlib.h> // exit()
-
-namespace qpidit
-{
- namespace amqp_dtx_test
- {
- } /* namespace amqp_dtx_test */
-} /* namespace qpidit */
-
-
-/*
- * --- main ---
- * Args: 1: Broker address (ip-addr:port)
- * 2: Queue name
- * ...
- */
-
-int main(int argc, char** argv) {
- exit(0);
-}
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/4153bf17/shims/qpid-proton-cpp/src/not_yet_impl/amqp_dtx_test/Receiver.hpp
----------------------------------------------------------------------
diff --git a/shims/qpid-proton-cpp/src/not_yet_impl/amqp_dtx_test/Receiver.hpp b/shims/qpid-proton-cpp/src/not_yet_impl/amqp_dtx_test/Receiver.hpp
deleted file mode 100644
index 4b810f0..0000000
--- a/shims/qpid-proton-cpp/src/not_yet_impl/amqp_dtx_test/Receiver.hpp
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *
- * 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.
- *
- */
-
-#ifndef SRC_QPIDIT_AMQP_DTX_TEST_RECEIVER_HPP_
-#define SRC_QPIDIT_AMQP_DTX_TEST_RECEIVER_HPP_
-
-#include <proton/messaging_handler.hpp>
-
-namespace qpidit
-{
- namespace amqp_dtx_test
- {
-
- class Receiver : public proton::messaging_handler
- {
- };
-
- } /* namespace amqp_dtx_test */
-} /* namespace qpidit */
-
-#endif /* SRC_QPIDIT_AMQP_DTX_TEST_RECEIVER_HPP_ */
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/4153bf17/shims/qpid-proton-cpp/src/not_yet_impl/amqp_dtx_test/Sender.cpp
----------------------------------------------------------------------
diff --git a/shims/qpid-proton-cpp/src/not_yet_impl/amqp_dtx_test/Sender.cpp b/shims/qpid-proton-cpp/src/not_yet_impl/amqp_dtx_test/Sender.cpp
deleted file mode 100644
index 4463954..0000000
--- a/shims/qpid-proton-cpp/src/not_yet_impl/amqp_dtx_test/Sender.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- *
- * 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.
- *
- */
-
-#include "qpidit/amqp_dtx_test/Sender.hpp"
-
-#include <stdlib.h> // exit()
-
-namespace qpidit
-{
- namespace amqp_dtx_test
- {
- } /* namespace amqp_dtx_test */
-} /* namespace qpidit */
-
-
-/*
- * --- main ---
- * Args: 1: Broker address (ip-addr:port)
- * 2: Queue name
- * ...
- */
-
-int main(int argc, char** argv) {
- exit(0);
-}
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/4153bf17/shims/qpid-proton-cpp/src/not_yet_impl/amqp_dtx_test/Sender.hpp
----------------------------------------------------------------------
diff --git a/shims/qpid-proton-cpp/src/not_yet_impl/amqp_dtx_test/Sender.hpp b/shims/qpid-proton-cpp/src/not_yet_impl/amqp_dtx_test/Sender.hpp
deleted file mode 100644
index 90be683..0000000
--- a/shims/qpid-proton-cpp/src/not_yet_impl/amqp_dtx_test/Sender.hpp
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *
- * 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.
- *
- */
-
-#ifndef SRC_QPIDIT_AMQP_DTX_TEST_SENDER_HPP_
-#define SRC_QPIDIT_AMQP_DTX_TEST_SENDER_HPP_
-
-#include <proton/messaging_handler.hpp>
-
-namespace qpidit
-{
- namespace amqp_dtx_test
- {
-
- class Sender : public proton::messaging_handler
- {
- };
-
- } /* namespace amqp_dtx_test */
-} /* namespace qpidit */
-
-#endif /* SRC_QPIDIT_AMQP_DTX_TEST_SENDER_HPP_ */
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/4153bf17/shims/qpid-proton-cpp/src/not_yet_impl/amqp_features_test/Receiver.cpp
----------------------------------------------------------------------
diff --git a/shims/qpid-proton-cpp/src/not_yet_impl/amqp_features_test/Receiver.cpp b/shims/qpid-proton-cpp/src/not_yet_impl/amqp_features_test/Receiver.cpp
deleted file mode 100644
index 923b198..0000000
--- a/shims/qpid-proton-cpp/src/not_yet_impl/amqp_features_test/Receiver.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- *
- * 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.
- *
- */
-
-#include "qpidit/amqp_features_test/Receiver.hpp"
-
-#include <stdlib.h> // exit()
-
-namespace qpidit
-{
- namespace amqp_features_test
- {
- } /* namespace amqp_features_test */
-} /* namespace qpidit */
-
-
-/*
- * --- main ---
- * Args: 1: Broker address (ip-addr:port)
- * 2: Queue name
- * ...
- */
-
-int main(int argc, char** argv) {
- exit(0);
-}
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/4153bf17/shims/qpid-proton-cpp/src/not_yet_impl/amqp_features_test/Receiver.hpp
----------------------------------------------------------------------
diff --git a/shims/qpid-proton-cpp/src/not_yet_impl/amqp_features_test/Receiver.hpp b/shims/qpid-proton-cpp/src/not_yet_impl/amqp_features_test/Receiver.hpp
deleted file mode 100644
index 100cdd2..0000000
--- a/shims/qpid-proton-cpp/src/not_yet_impl/amqp_features_test/Receiver.hpp
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *
- * 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.
- *
- */
-
-#ifndef SRC_QPIDIT_AMQP_FEATURES_TEST_RECEIVER_HPP_
-#define SRC_QPIDIT_AMQP_FEATURES_TEST_RECEIVER_HPP_
-
-#include <proton/messaging_handler.hpp>
-
-namespace qpidit
-{
- namespace amqp_features_test
- {
-
- class Receiver : public proton::messaging_handler
- {
- };
-
- } /* namespace amqp_features_test */
-} /* namespace qpidit */
-
-#endif /* SRC_QPIDIT_AMQP_FEATURES_TEST_RECEIVER_HPP_ */
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/4153bf17/shims/qpid-proton-cpp/src/not_yet_impl/amqp_features_test/Sender.cpp
----------------------------------------------------------------------
diff --git a/shims/qpid-proton-cpp/src/not_yet_impl/amqp_features_test/Sender.cpp b/shims/qpid-proton-cpp/src/not_yet_impl/amqp_features_test/Sender.cpp
deleted file mode 100644
index 9e86ec4..0000000
--- a/shims/qpid-proton-cpp/src/not_yet_impl/amqp_features_test/Sender.cpp
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- *
- * 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.
- *
- */
-
-#include "qpidit/amqp_features_test/Sender.hpp"
-
-#include <iostream>
-#include <json/json.h>
-#include <proton/container.hpp>
-#include <proton/default_container.hpp>
-#include <proton/error_condition.hpp>
-#include <proton/thread_safe.hpp>
-#include <proton/tracker.hpp>
-#include <proton/transport.hpp>
-#include <qpidit/QpidItErrors.hpp>
-#include <stdlib.h> // exit()
-
-
-namespace qpidit
-{
- namespace amqp_features_test
- {
- Sender::Sender(const std::string& brokerUrl,
- const std::string& queueName,
- const std::string& testType,
- const Json::Value& testValues) :
- _brokerUrl(brokerUrl),
- _queueName(queueName),
- _testType(testType),
- _testValues(testValues)
- {}
-
- Sender::~Sender() {}
-
- void Sender::on_container_start(proton::container &c) {
- std::ostringstream oss;
- oss << _brokerUrl << "/" << _queueName;
- c.open_sender(oss.str());
- }
-
- void Sender::on_connection_open(proton::connection& c) {
- if (_testType.compare("connection_property") == 0) {
- // Python: self.remote_properties = event.connection.remote_properties
- }
- }
-
- void Sender::on_sendable(proton::sender &s) {
- if (_totalMsgs == 0) {
- s.connection().close();
- } else {
- if (_testType.compare("connection_property") == 0) {
- // Do nothing
- } else {
- // Unknown test
- }
- }
- }
-
- void Sender::on_tracker_accept(proton::tracker &t) {
- _msgsConfirmed++;
- if (_msgsConfirmed == _totalMsgs) {
- t.connection().close();
- }
- }
-
- void Sender::on_transport_close(proton::transport &t) {
- _msgsSent = _msgsConfirmed;
- }
-
- void Sender::on_connection_error(proton::connection &c) {
- std::cerr << "AmqpSender::on_connection_error(): " << c.error() << std::endl;
- }
-
- void Sender::on_sender_error(proton::sender &s) {
- std::cerr << "AmqpSender::on_sender_error(): " << s.error() << std::endl;
- }
-
- void Sender::on_session_error(proton::session &s) {
- std::cerr << "AmqpSender::on_session_error(): " << s.error() << std::endl;
- }
-
- void Sender::on_transport_error(proton::transport &t) {
- std::cerr << "AmqpSender::on_transport_error(): " << t.error() << std::endl;
- }
-
- void Sender::on_error(const proton::error_condition &ec) {
- std::cerr << "AmqpSender::on_error(): " << ec << std::endl;
- }
- } /* namespace amqp_features_test */
-} /* namespace qpidit */
-
-
-/*
- * --- main ---
- * Args: 1: Broker address (ip-addr:port)
- * 2: Queue name
- * 3: Test type
- * 4: JSON test values
- */
-
-int main(int argc, char** argv) {
- // TODO: improve arg management a little...
- if (argc != 5) {
- throw qpidit::ArgumentError("Incorrect number of arguments");
- }
-
- try {
- Json::Value testValues;
- Json::Reader jsonReader;
- if (not jsonReader.parse(argv[4], testValues, false)) {
- throw qpidit::JsonParserError(jsonReader);
- }
-
- qpidit::amqp_features_test::Sender sender(argv[1], argv[2], argv[3], testValues);
- proton::default_container(sender).run();
- } catch (const std::exception& e) {
- std::cerr << "amqp_features_test Sender error: " << e.what() << std::endl;
- exit(1);
- }
- exit(0);
-}
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/4153bf17/shims/qpid-proton-cpp/src/not_yet_impl/amqp_features_test/Sender.hpp
----------------------------------------------------------------------
diff --git a/shims/qpid-proton-cpp/src/not_yet_impl/amqp_features_test/Sender.hpp b/shims/qpid-proton-cpp/src/not_yet_impl/amqp_features_test/Sender.hpp
deleted file mode 100644
index 62b00f5..0000000
--- a/shims/qpid-proton-cpp/src/not_yet_impl/amqp_features_test/Sender.hpp
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- *
- * 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.
- *
- */
-
-#ifndef SRC_QPIDIT_AMQP_DTX_TEST_SENDER_HPP_
-#define SRC_QPIDIT_AMQP_DTX_TEST_SENDER_HPP_
-
-#include <stdint.h>
-#include <json/value.h>
-#include <proton/messaging_handler.hpp>
-#include <string>
-
-namespace qpidit
-{
- namespace amqp_features_test
- {
-
- class Sender : public proton::messaging_handler
- {
- const std::string _brokerUrl;
- const std::string _queueName;
- const std::string _testType;
- const Json::Value _testValues;
- uint32_t _msgsSent;
- uint32_t _msgsConfirmed;
- uint32_t _totalMsgs;
- public:
- Sender(const std::string& brokerUrl,
- const std::string& queueName,
- const std::string& testType,
- const Json::Value& testValues);
- virtual ~Sender();
-
- void on_container_start(proton::container& c);
- void on_connection_open(proton::connection &c);
- void on_sendable(proton::sender& s);
- void on_tracker_accept(proton::tracker& t);
- void on_transport_close(proton::transport& t);
-
- void on_connection_error(proton::connection& c);
- void on_session_error(proton::session& s);
- void on_sender_error(proton::sender& s);
- void on_transport_error(proton::transport& t);
- void on_error(const proton::error_condition& c);
- };
-
- } /* namespace amqp_features_test */
-} /* namespace qpidit */
-
-#endif /* SRC_QPIDIT_AMQP_DTX_TEST_SENDER_HPP_ */
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/4153bf17/shims/qpid-proton-cpp/src/not_yet_impl/jms_dtx_test/Receiver.cpp
----------------------------------------------------------------------
diff --git a/shims/qpid-proton-cpp/src/not_yet_impl/jms_dtx_test/Receiver.cpp b/shims/qpid-proton-cpp/src/not_yet_impl/jms_dtx_test/Receiver.cpp
deleted file mode 100644
index 027518c..0000000
--- a/shims/qpid-proton-cpp/src/not_yet_impl/jms_dtx_test/Receiver.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- *
- * 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.
- *
- */
-
-#include "qpidit/jms_dtx_test/Receiver.hpp"
-
-#include <stdlib.h> // exit()
-
-namespace qpidit
-{
- namespace jms_dtx_test
- {
- } /* namespace jms_dtx_test */
-} /* namespace qpidit */
-
-
-/*
- * --- main ---
- * Args: 1: Broker address (ip-addr:port)
- * 2: Queue name
- * ...
- */
-
-int main(int argc, char** argv) {
- exit(0);
-}
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/4153bf17/shims/qpid-proton-cpp/src/not_yet_impl/jms_dtx_test/Receiver.hpp
----------------------------------------------------------------------
diff --git a/shims/qpid-proton-cpp/src/not_yet_impl/jms_dtx_test/Receiver.hpp b/shims/qpid-proton-cpp/src/not_yet_impl/jms_dtx_test/Receiver.hpp
deleted file mode 100644
index 2509752..0000000
--- a/shims/qpid-proton-cpp/src/not_yet_impl/jms_dtx_test/Receiver.hpp
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *
- * 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.
- *
- */
-
-#ifndef SRC_QPIDIT_JMS_DTX_TEST_RECEIVER_HPP_
-#define SRC_QPIDIT_JMS_DTX_TEST_RECEIVER_HPP_
-
-#include <qpidit/JmsTestBase.hpp>
-
-namespace qpidit
-{
- namespace jms_dtx_test
- {
-
- class Receiver : public qpidit::JmsTestBase
- {
- };
-
- } /* namespace jms_dtx_test */
-} /* namespace qpidit */
-
-#endif /* SRC_QPIDIT_JMS_DTX_TEST_RECEIVER_HPP_ */
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/4153bf17/shims/qpid-proton-cpp/src/not_yet_impl/jms_dtx_test/Sender.cpp
----------------------------------------------------------------------
diff --git a/shims/qpid-proton-cpp/src/not_yet_impl/jms_dtx_test/Sender.cpp b/shims/qpid-proton-cpp/src/not_yet_impl/jms_dtx_test/Sender.cpp
deleted file mode 100644
index 501d0f9..0000000
--- a/shims/qpid-proton-cpp/src/not_yet_impl/jms_dtx_test/Sender.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- *
- * 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.
- *
- */
-
-#include "qpidit/jms_dtx_test/Sender.hpp"
-
-#include <stdlib.h> // exit()
-
-namespace qpidit
-{
- namespace jms_dtx_test
- {
- } /* namespace jms_dtx_test */
-} /* namespace qpidit */
-
-
-/*
- * --- main ---
- * Args: 1: Broker address (ip-addr:port)
- * 2: Queue name
- * ...
- */
-
-int main(int argc, char** argv) {
- exit(0);
-}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org