Applied patch 0001-Moved-spec-tests-to-different-package.-Added-spec-te.patch from Prashant for Will behaviour
This commit is contained in:
+21
-5
@@ -13,21 +13,20 @@
|
|||||||
*
|
*
|
||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
package org.dna.mqtt.moquette.server;
|
package org.dna.mqtt.moquette.spec.v3_1_1.connection;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import org.dna.mqtt.moquette.server.Server;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
|
import org.junit.Ignore;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.kaazing.robot.junit.annotation.Robotic;
|
import org.kaazing.robot.junit.annotation.Robotic;
|
||||||
import org.kaazing.robot.junit.rules.RobotRule;
|
import org.kaazing.robot.junit.rules.RobotRule;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class runs the robot test scripts to run the TCK for Moquette broker, before remember to run
|
|
||||||
* mvn -Dmaven.robot.daemon=false robot:start from broker submodule folder
|
|
||||||
*
|
|
||||||
*
|
*
|
||||||
* @author pkhanal
|
* @author pkhanal
|
||||||
*
|
*
|
||||||
@@ -57,9 +56,26 @@ public class ConnectionIT {
|
|||||||
// The test starts the server during setUp
|
// The test starts the server during setUp
|
||||||
// The network communication is driven by the script.
|
// The network communication is driven by the script.
|
||||||
@Robotic(script = "connect.then.close")
|
@Robotic(script = "connect.then.close")
|
||||||
@Test(timeout = 1000)
|
@Test(timeout = 2000)
|
||||||
public void shouldConnectThenClose() throws Exception {
|
public void shouldConnectThenClose() throws Exception {
|
||||||
robot.join();
|
robot.join();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: server is not closing the connection immediately.
|
||||||
|
// The connection is closed 10 seconds after the CorruptedFrameException is
|
||||||
|
// thrown from ConnectDecoder
|
||||||
|
@Robotic(script = "connect.with.invalid.WillQoS")
|
||||||
|
@Test(timeout = 15000)
|
||||||
|
public void connectWithInvalidWillQoS() throws Exception {
|
||||||
|
robot.join();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Ignore("Need to validate the test case.")
|
||||||
|
@Robotic(script = "connect.with.WillFlag.set.to.zero.but.WillQoS.set.to.nonzero")
|
||||||
|
@Test(timeout = 15000)
|
||||||
|
public void connectWithWillFlagSetToZeroButWillQoSFlagSetToNonZero() throws Exception {
|
||||||
|
robot.join();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -19,9 +19,9 @@ log4j.logger.org.dna.mqtt.moquette.parser.netty=WARN
|
|||||||
|
|
||||||
# stdout appender is set to be a ConsoleAppender.
|
# stdout appender is set to be a ConsoleAppender.
|
||||||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
||||||
log4j.appender.stdout.Threshold=WARN
|
#log4j.appender.stdout.Threshold=WARN
|
||||||
#log4j.appender.stdout.Threshold=INFO
|
#log4j.appender.stdout.Threshold=INFO
|
||||||
#log4j.appender.stdout.Threshold=DEBUG
|
log4j.appender.stdout.Threshold=DEBUG
|
||||||
# for debug trace
|
# for debug trace
|
||||||
#log4j.appender.stdout.Threshold=TRACE
|
#log4j.appender.stdout.Threshold=TRACE
|
||||||
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
||||||
|
|||||||
@@ -1,62 +0,0 @@
|
|||||||
# Copyright (c) 2012-2014 The original author or authors
|
|
||||||
# ------------------------------------------------------
|
|
||||||
# All rights reserved. This program and the accompanying materials
|
|
||||||
# are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
# and Apache License v2.0 which accompanies this distribution.
|
|
||||||
#
|
|
||||||
# The Eclipse Public License is available at
|
|
||||||
# http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
#
|
|
||||||
# The Apache License v2.0 is available at
|
|
||||||
# http://www.opensource.org/licenses/apache2.0.php
|
|
||||||
#
|
|
||||||
# You may elect to redistribute this code under either of these licenses.
|
|
||||||
|
|
||||||
# MQTT 3.1.1
|
|
||||||
|
|
||||||
# Script that sends the CONNECT control packet to broker and expects
|
|
||||||
# CONNACK control packet from the broker followed by sending the DISCONNECT
|
|
||||||
# control packet to the broker and expects server to close the network connection
|
|
||||||
|
|
||||||
connect tcp://127.0.0.1:1883
|
|
||||||
connected
|
|
||||||
|
|
||||||
# CONNECT
|
|
||||||
write [0x10] # MQTT Control Packet type(1)
|
|
||||||
write [0x12] # Remaining Length
|
|
||||||
write [0x00 0x04] # Protocol Name Length
|
|
||||||
write "MQTT" # Protocol Name
|
|
||||||
write [0x04] # The value of the Protocol Level field for the version 3.1.1 of the protocol is 4 (0x04)
|
|
||||||
|
|
||||||
# Connect Flags
|
|
||||||
# User Name Flag(0)
|
|
||||||
# Password Flag(0)
|
|
||||||
write [0x02] # Will Retain(0)
|
|
||||||
# Will QoS(00)
|
|
||||||
# Will Flag(0)
|
|
||||||
# Clean Session(1)
|
|
||||||
# Reserved(0)
|
|
||||||
|
|
||||||
write [0x00 0x00] # Keep Alive
|
|
||||||
|
|
||||||
# Payload
|
|
||||||
write [0x00 0x07] # Client Identifier Length
|
|
||||||
write "client1" # Client Identifier
|
|
||||||
|
|
||||||
# CONNACK
|
|
||||||
read [0x20] # MQTT Control Packet type(2)
|
|
||||||
read [0x02] # Remaining Length
|
|
||||||
|
|
||||||
# Connect Acknowledge Flags
|
|
||||||
read [0x00] # Session Present Flag(0)
|
|
||||||
|
|
||||||
# Connect Return code
|
|
||||||
read [0x00] # Connection Accepted
|
|
||||||
|
|
||||||
|
|
||||||
# DISCONNECT
|
|
||||||
write [0xE0] # MQTT Control Packet type(14)
|
|
||||||
write [0x00] # Remaining Length
|
|
||||||
|
|
||||||
# Server MUST close the Network Connection
|
|
||||||
closed
|
|
||||||
+63
@@ -0,0 +1,63 @@
|
|||||||
|
|
||||||
|
# Copyright (c) 2012-2014 The original author or authors
|
||||||
|
# ------------------------------------------------------
|
||||||
|
# All rights reserved. This program and the accompanying materials
|
||||||
|
# are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
# and Apache License v2.0 which accompanies this distribution.
|
||||||
|
#
|
||||||
|
# The Eclipse Public License is available at
|
||||||
|
# http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
#
|
||||||
|
# The Apache License v2.0 is available at
|
||||||
|
# http://www.opensource.org/licenses/apache2.0.php
|
||||||
|
#
|
||||||
|
# You may elect to redistribute this code under either of these licenses.
|
||||||
|
|
||||||
|
# MQTT 3.1.1
|
||||||
|
|
||||||
|
# Script that sends the CONNECT control packet to broker and expects
|
||||||
|
# CONNACK control packet from the broker followed by sending the DISCONNECT
|
||||||
|
# control packet to the broker and expects server to close the network connection
|
||||||
|
|
||||||
|
connect tcp://127.0.0.1:1883
|
||||||
|
connected
|
||||||
|
|
||||||
|
# CONNECT
|
||||||
|
write [0x10] # MQTT Control Packet type(1)
|
||||||
|
write [0x12] # Remaining Length
|
||||||
|
write [0x00 0x04] # Protocol Name Length
|
||||||
|
write "MQTT" # Protocol Name
|
||||||
|
write [0x04] # The value of the Protocol Level field for the version 3.1.1 of the protocol is 4 (0x04)
|
||||||
|
|
||||||
|
# Connect Flags
|
||||||
|
# User Name Flag(0)
|
||||||
|
# Password Flag(0)
|
||||||
|
# Will Retain(0)
|
||||||
|
# Will QoS(00)
|
||||||
|
# Will Flag(0)
|
||||||
|
# Clean Session(1)
|
||||||
|
write [0x02] # Reserved(0)
|
||||||
|
|
||||||
|
write [0x00 0x00] # Keep Alive
|
||||||
|
|
||||||
|
# Payload
|
||||||
|
write [0x00 0x07] # Client Identifier Length
|
||||||
|
write "client1" # Client Identifier
|
||||||
|
|
||||||
|
# CONNACK
|
||||||
|
read [0x20] # MQTT Control Packet type(2)
|
||||||
|
read [0x02] # Remaining Length
|
||||||
|
|
||||||
|
# Connect Acknowledge Flags
|
||||||
|
read [0x00] # Session Present Flag(0)
|
||||||
|
|
||||||
|
# Connect Return code
|
||||||
|
read [0x00] # Connection Accepted
|
||||||
|
|
||||||
|
|
||||||
|
# DISCONNECT
|
||||||
|
write [0xE0] # MQTT Control Packet type(14)
|
||||||
|
write [0x00] # Remaining Length
|
||||||
|
|
||||||
|
# Server MUST close the Network Connection
|
||||||
|
closed
|
||||||
+47
@@ -0,0 +1,47 @@
|
|||||||
|
# Copyright (c) 2012-2014 The original author or authors
|
||||||
|
# ------------------------------------------------------
|
||||||
|
# All rights reserved. This program and the accompanying materials
|
||||||
|
# are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
# and Apache License v2.0 which accompanies this distribution.
|
||||||
|
#
|
||||||
|
# The Eclipse Public License is available at
|
||||||
|
# http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
#
|
||||||
|
# The Apache License v2.0 is available at
|
||||||
|
# http://www.opensource.org/licenses/apache2.0.php
|
||||||
|
#
|
||||||
|
# You may elect to redistribute this code under either of these licenses.
|
||||||
|
|
||||||
|
# MQTT 3.1.1
|
||||||
|
|
||||||
|
# Script that sends the CONNECT control packet to broker with Will Flag is set to 0 but
|
||||||
|
# Will QoS flag set to non-zero(1). As per the spec, If the Will Flag is set to 0, then
|
||||||
|
# the Will QoS MUST be set to 0. Serve should close the network connection in this case.
|
||||||
|
|
||||||
|
connect tcp://127.0.0.1:1883
|
||||||
|
connected
|
||||||
|
|
||||||
|
# CONNECT
|
||||||
|
write [0x10] # MQTT Control Packet type(1)
|
||||||
|
write [0x12] # Remaining Length
|
||||||
|
write [0x00 0x04] # Protocol Name Length
|
||||||
|
write "MQTT" # Protocol Name
|
||||||
|
write [0x04] # The value of the Protocol Level field for the version 3.1.1 of the protocol is 4 (0x04)
|
||||||
|
|
||||||
|
# Connect Flags
|
||||||
|
# User Name Flag(0)
|
||||||
|
# Password Flag(0)
|
||||||
|
# Will Retain(0)
|
||||||
|
# Will QoS(01) - If the Will Flag is set to 0, then the Will QoS MUST be set to 0
|
||||||
|
# Will Flag(0)
|
||||||
|
# Clean Session(1)
|
||||||
|
write [0x0A] # Reserved(0)
|
||||||
|
|
||||||
|
write [0x00 0x00] # Keep Alive
|
||||||
|
|
||||||
|
# Payload
|
||||||
|
write [0x00 0x07] # Client Identifier Length
|
||||||
|
write "client1" # Client Identifier
|
||||||
|
|
||||||
|
# Server MUST close the Network Connection due to invalid Will QoS flag
|
||||||
|
closed
|
||||||
+46
@@ -0,0 +1,46 @@
|
|||||||
|
# Copyright (c) 2012-2014 The original author or authors
|
||||||
|
# ------------------------------------------------------
|
||||||
|
# All rights reserved. This program and the accompanying materials
|
||||||
|
# are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
# and Apache License v2.0 which accompanies this distribution.
|
||||||
|
#
|
||||||
|
# The Eclipse Public License is available at
|
||||||
|
# http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
#
|
||||||
|
# The Apache License v2.0 is available at
|
||||||
|
# http://www.opensource.org/licenses/apache2.0.php
|
||||||
|
#
|
||||||
|
# You may elect to redistribute this code under either of these licenses.
|
||||||
|
|
||||||
|
# MQTT 3.1.1
|
||||||
|
|
||||||
|
# Script that sends the CONNECT control packet to broker with invalid Will QoS - 3
|
||||||
|
# and expects the broker to close the network connection.
|
||||||
|
|
||||||
|
connect tcp://127.0.0.1:1883
|
||||||
|
connected
|
||||||
|
|
||||||
|
# CONNECT
|
||||||
|
write [0x10] # MQTT Control Packet type(1)
|
||||||
|
write [0x12] # Remaining Length
|
||||||
|
write [0x00 0x04] # Protocol Name Length
|
||||||
|
write "MQTT" # Protocol Name
|
||||||
|
write [0x04] # The value of the Protocol Level field for the version 3.1.1 of the protocol is 4 (0x04)
|
||||||
|
|
||||||
|
# Connect Flags
|
||||||
|
# User Name Flag(0)
|
||||||
|
# Password Flag(0)
|
||||||
|
# Will Retain(0)
|
||||||
|
# Will QoS(11) - It MUST NOT be 3 (0x03). Serve should close the connection.
|
||||||
|
# Will Flag(1)
|
||||||
|
# Clean Session(1)
|
||||||
|
write [0x1E] # Reserved(0)
|
||||||
|
|
||||||
|
write [0x00 0x00] # Keep Alive
|
||||||
|
|
||||||
|
# Payload
|
||||||
|
write [0x00 0x07] # Client Identifier Length
|
||||||
|
write "client1" # Client Identifier
|
||||||
|
|
||||||
|
# Server MUST close the Network Connection due to invalid Will QoS flag
|
||||||
|
closed
|
||||||
Reference in New Issue
Block a user