From 468985f7ada20e0a083f5a852ec4ecd0b44fba26 Mon Sep 17 00:00:00 2001 From: Chunyi Lyu Date: Thu, 22 Jun 2023 14:36:53 +0100 Subject: [PATCH] Remove unused test helpers - testQueuePropertiesWithCleanSessionSet() was not used - testQueuePropertiesWithCleanSessionUnset() and testQueuePropertiesWithCleanSession() was called only once so removing the extra layer here to simply structure --- .../java/com/rabbitmq/mqtt/test/MqttTest.java | 28 ++++--------------- .../com/rabbitmq/mqtt/test/MqttV5Test.java | 23 ++++----------- 2 files changed, 12 insertions(+), 39 deletions(-) diff --git a/deps/rabbitmq_mqtt/test/java_SUITE_data/src/test/java/com/rabbitmq/mqtt/test/MqttTest.java b/deps/rabbitmq_mqtt/test/java_SUITE_data/src/test/java/com/rabbitmq/mqtt/test/MqttTest.java index e677664c45..219acf4c27 100644 --- a/deps/rabbitmq_mqtt/test/java_SUITE_data/src/test/java/com/rabbitmq/mqtt/test/MqttTest.java +++ b/deps/rabbitmq_mqtt/test/java_SUITE_data/src/test/java/com/rabbitmq/mqtt/test/MqttTest.java @@ -226,35 +226,19 @@ public class MqttTest implements MqttCallback { } // rabbitmq/rabbitmq-mqtt#37: QoS 1, clean session = false - @Test public void qos1AndCleanSessionUnset() - throws MqttException, IOException, TimeoutException, InterruptedException { - testQueuePropertiesWithCleanSessionUnset("qos1-no-clean-session", 1, true, false); - } - - protected void testQueuePropertiesWithCleanSessionSet(String cid, int qos, boolean durable, boolean autoDelete) - throws IOException, MqttException, TimeoutException, InterruptedException { - testQueuePropertiesWithCleanSession(true, cid, qos, durable, autoDelete); - } - - protected void testQueuePropertiesWithCleanSessionUnset(String cid, int qos, boolean durable, boolean autoDelete) - throws IOException, MqttException, TimeoutException, InterruptedException { - testQueuePropertiesWithCleanSession(false, cid, qos, durable, autoDelete); - } - - protected void testQueuePropertiesWithCleanSession(boolean cleanSession, String cid, int qos, - boolean durable, boolean autoDelete) + @Test public void qos1AndCleanSessionUnset(TestInfo info) throws MqttException, IOException, TimeoutException { - MqttClient c = newClient(brokerUrl, cid); + MqttClient c = newClient(info); MqttConnectOptions opts = new TestMqttConnectOptions(); - opts.setCleanSession(cleanSession); + opts.setCleanSession(false); c.connect(opts); setUpAmqp(); Channel tmpCh = conn.createChannel(); - String q = "mqtt-subscription-" + cid + "qos" + qos; + String q = "mqtt-subscription-" + "test-qos1AndCleanSessionUnset" + "qos1"; - c.subscribe(topic, qos); + c.subscribe(topic, 1); // there is no server-sent notification about subscription // success so we inject a delay waitForTestDelay(); @@ -267,7 +251,7 @@ public class MqttTest implements MqttCallback { // then assert on properties Map args = new HashMap<>(); args.put("x-expires", 86400000); - tmpCh.queueDeclare(q, durable, autoDelete, false, args); + tmpCh.queueDeclare(q, true, false, false, args); } finally { if (c.isConnected()) { c.disconnect(3000); diff --git a/deps/rabbitmq_mqtt/test/java_SUITE_data/src/test/java/com/rabbitmq/mqtt/test/MqttV5Test.java b/deps/rabbitmq_mqtt/test/java_SUITE_data/src/test/java/com/rabbitmq/mqtt/test/MqttV5Test.java index e08a0c0b79..1e26e3e5e3 100644 --- a/deps/rabbitmq_mqtt/test/java_SUITE_data/src/test/java/com/rabbitmq/mqtt/test/MqttV5Test.java +++ b/deps/rabbitmq_mqtt/test/java_SUITE_data/src/test/java/com/rabbitmq/mqtt/test/MqttV5Test.java @@ -479,31 +479,20 @@ public class MqttV5Test implements MqttCallback { cleanupClient2.disconnect(); } - @Test public void qos1AndCleanStartFalse() - throws MqttException, IOException, TimeoutException, InterruptedException { - testQueuePropertiesWithCleanStartFalse("qos1-no-clean-session-v5", 1, true, false); - } - - protected void testQueuePropertiesWithCleanStartFalse(String cid, int qos, boolean durable, boolean autoDelete) - throws IOException, MqttException, TimeoutException, InterruptedException { - testQueuePropertiesWithCleanStart(false, cid, qos, durable, autoDelete); - } - - protected void testQueuePropertiesWithCleanStart(boolean cleanStart, String cid, int qos, - boolean durable, boolean autoDelete) + @Test public void qos1AndCleanSessionUnset(TestInfo info) throws MqttException, IOException, TimeoutException { - MqttClient c = newClient(brokerUrl, cid); + MqttClient c = newClient(info); MqttConnectionOptions opts = new TestMqttConnectOptions(); - opts.setCleanStart(cleanStart); + opts.setCleanStart(false); opts.setSessionExpiryInterval(10L); c.connect(opts); setUpAmqp(); Channel tmpCh = conn.createChannel(); - String q = "mqtt-subscription-" + cid + "qos" + qos; + String q = "mqtt-subscription-" + "test-qos1AndCleanSessionUnset" + "qos1"; - c.subscribe(topic, qos); + c.subscribe(topic, 1); // there is no server-sent notification about subscription // success so we inject a delay waitForTestDelay(); @@ -516,7 +505,7 @@ public class MqttV5Test implements MqttCallback { // then assert on properties Map args = new HashMap<>(); args.put("x-expires", 10000); - tmpCh.queueDeclare(q, durable, false, autoDelete, args); + tmpCh.queueDeclare(q, true, false, false, args); } finally { if (c.isConnected()) { c.disconnect(3000);