From 4ddd81057ac3831c212d2d54f40aa6688102b7dd Mon Sep 17 00:00:00 2001 From: Muzzammil Shahid Date: Tue, 2 Jul 2024 18:39:38 +0500 Subject: [PATCH 1/8] Add interoperabilty tests for Subscribe message --- .../interoptests/messages/subscribe_test.dart | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 test/interoptests/messages/subscribe_test.dart diff --git a/test/interoptests/messages/subscribe_test.dart b/test/interoptests/messages/subscribe_test.dart new file mode 100644 index 0000000..e53cf2c --- /dev/null +++ b/test/interoptests/messages/subscribe_test.dart @@ -0,0 +1,54 @@ +import "package:collection/collection.dart"; +import "package:pinenacl/encoding.dart"; +import "package:test/test.dart"; + +import "package:wampproto/messages.dart"; +import "package:wampproto/serializers.dart"; + +import "../helper.dart"; + +void main() { + group("Subscribe", () { + const equality = DeepCollectionEquality(); + const topic = "io.xconn.test"; + const baseSubCommand = "message subscribe 1 $topic"; + + bool isEqual(Subscribe msg1, Subscribe msg2) => + msg1.requestID == msg2.requestID && msg1.topic == msg2.topic && equality.equals(msg1.options, msg2.options); + + test("JSONSerializer", () async { + var msg = Subscribe(1, topic); + var command = "$baseSubCommand --serializer json"; + + var output = await runCommand(command); + + var jsonSerializer = JSONSerializer(); + var message = jsonSerializer.deserialize(output) as Subscribe; + expect(isEqual(message, msg), true); + }); + + test("CBORSerializer", () async { + var msg = Subscribe(1, topic); + var command = "$baseSubCommand --serializer cbor --output hex"; + + var output = await runCommand(command); + var outputBytes = Base16Encoder.instance.decode(output.trim()); + + var cborSerializer = CBORSerializer(); + var message = cborSerializer.deserialize(outputBytes) as Subscribe; + expect(isEqual(message, msg), true); + }); + + test("MsgPackSerializer", () async { + var msg = Subscribe(1, topic, options: {"a": 1}); + var command = "$baseSubCommand -o a=1 --serializer msgpack --output hex"; + + var output = await runCommand(command); + var outputBytes = Base16Encoder.instance.decode(output.trim()); + + var msgPackSerializer = MsgPackSerializer(); + var message = msgPackSerializer.deserialize(outputBytes) as Subscribe; + expect(isEqual(message, msg), true); + }); + }); +} \ No newline at end of file From 30d95ff6990d24cec9990c1c53eb097fd7181bfb Mon Sep 17 00:00:00 2001 From: Muzzammil Shahid Date: Tue, 2 Jul 2024 18:43:02 +0500 Subject: [PATCH 2/8] Add interoperabilty tests for Subscribed message --- .../messages/subscribed_test.dart | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 test/interoptests/messages/subscribed_test.dart diff --git a/test/interoptests/messages/subscribed_test.dart b/test/interoptests/messages/subscribed_test.dart new file mode 100644 index 0000000..b8e45ea --- /dev/null +++ b/test/interoptests/messages/subscribed_test.dart @@ -0,0 +1,51 @@ +import "package:pinenacl/encoding.dart"; +import "package:test/test.dart"; + +import "package:wampproto/messages.dart"; +import "package:wampproto/serializers.dart"; + +import "../helper.dart"; + +void main() { + group("Subscribed", () { + const baseSubCommand = "message subscribed 1 1"; + + bool isEqual(Subscribed msg1, Subscribed msg2) => + msg1.requestID == msg2.requestID && msg1.subscriptionID == msg2.subscriptionID; + + test("JSONSerializer", () async { + var msg = Subscribed(1, 1); + var command = "$baseSubCommand --serializer json"; + + var output = await runCommand(command); + + var jsonSerializer = JSONSerializer(); + var message = jsonSerializer.deserialize(output) as Subscribed; + expect(isEqual(message, msg), true); + }); + + test("CBORSerializer", () async { + var msg = Subscribed(1, 1); + var command = "$baseSubCommand --serializer cbor --output hex"; + + var output = await runCommand(command); + var outputBytes = Base16Encoder.instance.decode(output.trim()); + + var cborSerializer = CBORSerializer(); + var message = cborSerializer.deserialize(outputBytes) as Subscribed; + expect(isEqual(message, msg), true); + }); + + test("MsgPackSerializer", () async { + var msg = Subscribed(1, 1); + var command = "$baseSubCommand --serializer msgpack --output hex"; + + var output = await runCommand(command); + var outputBytes = Base16Encoder.instance.decode(output.trim()); + + var msgPackSerializer = MsgPackSerializer(); + var message = msgPackSerializer.deserialize(outputBytes) as Subscribed; + expect(isEqual(message, msg), true); + }); + }); +} \ No newline at end of file From 7eeeabcda41788d2049be9bca3e50d046185f0f0 Mon Sep 17 00:00:00 2001 From: Muzzammil Shahid Date: Tue, 2 Jul 2024 18:49:41 +0500 Subject: [PATCH 3/8] Add interoperabilty tests for Publish message --- test/interoptests/messages/publish_test.dart | 57 ++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 test/interoptests/messages/publish_test.dart diff --git a/test/interoptests/messages/publish_test.dart b/test/interoptests/messages/publish_test.dart new file mode 100644 index 0000000..814857d --- /dev/null +++ b/test/interoptests/messages/publish_test.dart @@ -0,0 +1,57 @@ +import "package:collection/collection.dart"; +import "package:pinenacl/encoding.dart"; +import "package:test/test.dart"; + +import "package:wampproto/messages.dart"; +import "package:wampproto/serializers.dart"; + +import "../helper.dart"; + +void main() { + group("Publish", () { + const equality = DeepCollectionEquality(); + const basePubCommand = "message publish 1 io.xconn.topic"; + + bool isEqual(Publish msg1, Publish msg2) => + msg1.requestID == msg2.requestID && + msg1.uri == msg2.uri && + equality.equals(msg1.options, msg2.options) && + equality.equals(msg1.args, msg2.args) && + equality.equals(msg1.kwargs, msg2.kwargs); + + test("JSONSerializer", () async { + var msg = Publish(1, "io.xconn.topic"); + var command = "$basePubCommand --serializer json"; + + var output = await runCommand(command); + + var jsonSerializer = JSONSerializer(); + var message = jsonSerializer.deserialize(output) as Publish; + expect(isEqual(message, msg), true); + }); + + test("CBORSerializer", () async { + var msg = Publish(1, "io.xconn.topic", args: ["abc"]); + var command = "$basePubCommand abc --serializer cbor --output hex"; + + var output = await runCommand(command); + var outputBytes = Base16Encoder.instance.decode(output.trim()); + + var cborSerializer = CBORSerializer(); + var message = cborSerializer.deserialize(outputBytes) as Publish; + expect(isEqual(message, msg), true); + }); + + test("MsgPackSerializer", () async { + var msg = Publish(1, "io.xconn.topic", options: {"abc": 1}, args: ["abc"], kwargs: {"a": 1}); + var command = "$basePubCommand abc -o abc=1 -k a=1 --serializer msgpack --output hex"; + + var output = await runCommand(command); + var outputBytes = Base16Encoder.instance.decode(output.trim()); + + var msgPackSerializer = MsgPackSerializer(); + var message = msgPackSerializer.deserialize(outputBytes) as Publish; + expect(isEqual(message, msg), true); + }); + }); +} From e281ddb0134f89814be29bcb7905a00134f54bb2 Mon Sep 17 00:00:00 2001 From: Muzzammil Shahid Date: Tue, 2 Jul 2024 18:52:57 +0500 Subject: [PATCH 4/8] Add interoperabilty tests for Published message --- .../interoptests/messages/published_test.dart | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 test/interoptests/messages/published_test.dart diff --git a/test/interoptests/messages/published_test.dart b/test/interoptests/messages/published_test.dart new file mode 100644 index 0000000..1a73e2e --- /dev/null +++ b/test/interoptests/messages/published_test.dart @@ -0,0 +1,51 @@ +import "package:pinenacl/encoding.dart"; +import "package:test/test.dart"; + +import "package:wampproto/messages.dart"; +import "package:wampproto/serializers.dart"; + +import "../helper.dart"; + +void main() { + group("Published", () { + const basePubCmd = "message published 1 1"; + + bool isEqual(Published msg1, Published msg2) => + msg1.requestID == msg2.requestID && msg1.publicationID == msg2.publicationID; + + test("JSONSerializer", () async { + var msg = Published(1, 1); + var command = "$basePubCmd --serializer json"; + + var output = await runCommand(command); + + var jsonSerializer = JSONSerializer(); + var message = jsonSerializer.deserialize(output) as Published; + expect(isEqual(message, msg), true); + }); + + test("CBORSerializer", () async { + var msg = Published(1, 1); + var command = "$basePubCmd --serializer cbor --output hex"; + + var output = await runCommand(command); + var outputBytes = Base16Encoder.instance.decode(output.trim()); + + var cborSerializer = CBORSerializer(); + var message = cborSerializer.deserialize(outputBytes) as Published; + expect(isEqual(message, msg), true); + }); + + test("MsgPackSerializer", () async { + var msg = Published(1, 1); + var command = "$basePubCmd --serializer msgpack --output hex"; + + var output = await runCommand(command); + var outputBytes = Base16Encoder.instance.decode(output.trim()); + + var msgPackSerializer = MsgPackSerializer(); + var message = msgPackSerializer.deserialize(outputBytes) as Published; + expect(isEqual(message, msg), true); + }); + }); +} From e8e91c06f00e25231fe18365bc9e339665df2670 Mon Sep 17 00:00:00 2001 From: Muzzammil Shahid Date: Tue, 2 Jul 2024 18:55:31 +0500 Subject: [PATCH 5/8] Add interoperabilty tests for Event message --- test/interoptests/messages/event_test.dart | 57 ++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 test/interoptests/messages/event_test.dart diff --git a/test/interoptests/messages/event_test.dart b/test/interoptests/messages/event_test.dart new file mode 100644 index 0000000..67df4e1 --- /dev/null +++ b/test/interoptests/messages/event_test.dart @@ -0,0 +1,57 @@ +import "package:collection/collection.dart"; +import "package:pinenacl/encoding.dart"; +import "package:test/test.dart"; + +import "package:wampproto/messages.dart"; +import "package:wampproto/serializers.dart"; + +import "../helper.dart"; + +void main() { + group("Event", () { + const equality = DeepCollectionEquality(); + const baseEventCommand = "message event 1 1"; + + bool isEqual(Event msg1, Event msg2) => + msg1.subscriptionID == msg2.subscriptionID && + msg1.publicationID == msg2.publicationID && + equality.equals(msg1.details, msg2.details) && + equality.equals(msg1.args, msg2.args) && + equality.equals(msg1.kwargs, msg2.kwargs); + + test("JSONSerializer", () async { + var msg = Event(1, 1); + var command = "$baseEventCommand --serializer json"; + + var output = await runCommand(command); + + var jsonSerializer = JSONSerializer(); + var message = jsonSerializer.deserialize(output) as Event; + expect(isEqual(message, msg), true); + }); + + test("CBORSerializer", () async { + var msg = Event(1, 1, args: ["abc"]); + var command = "$baseEventCommand abc --serializer cbor --output hex"; + + var output = await runCommand(command); + var outputBytes = Base16Encoder.instance.decode(output.trim()); + + var cborSerializer = CBORSerializer(); + var message = cborSerializer.deserialize(outputBytes) as Event; + expect(isEqual(message, msg), true); + }); + + test("MsgPackSerializer", () async { + var msg = Event(1, 1, details: {"abc": 1}, args: ["abc"], kwargs: {"a": 1}); + var command = "$baseEventCommand abc -d abc=1 -k a=1 --serializer msgpack --output hex"; + + var output = await runCommand(command); + var outputBytes = Base16Encoder.instance.decode(output.trim()); + + var msgPackSerializer = MsgPackSerializer(); + var message = msgPackSerializer.deserialize(outputBytes) as Event; + expect(isEqual(message, msg), true); + }); + }); +} From bfd9fcab738a664145cedea0843aeb1fc1a29ab2 Mon Sep 17 00:00:00 2001 From: Muzzammil Shahid Date: Tue, 2 Jul 2024 18:59:21 +0500 Subject: [PATCH 6/8] Add interoperabilty tests for Unsubscribe message --- .../messages/unsusbcribe_test.dart | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 test/interoptests/messages/unsusbcribe_test.dart diff --git a/test/interoptests/messages/unsusbcribe_test.dart b/test/interoptests/messages/unsusbcribe_test.dart new file mode 100644 index 0000000..dbf1c2a --- /dev/null +++ b/test/interoptests/messages/unsusbcribe_test.dart @@ -0,0 +1,51 @@ +import "package:pinenacl/encoding.dart"; +import "package:test/test.dart"; + +import "package:wampproto/messages.dart"; +import "package:wampproto/serializers.dart"; + +import "../helper.dart"; + +void main() { + group("Unsubscribe", () { + const baseSubCommand = "message unsubscribe 1 1"; + + bool isEqual(UnSubscribe msg1, UnSubscribe msg2) => + msg1.requestID == msg2.requestID && msg1.subscriptionID == msg2.subscriptionID; + + test("JSONSerializer", () async { + var msg = UnSubscribe(1, 1); + var command = "$baseSubCommand --serializer json"; + + var output = await runCommand(command); + + var jsonSerializer = JSONSerializer(); + var message = jsonSerializer.deserialize(output) as UnSubscribe; + expect(isEqual(message, msg), true); + }); + + test("CBORSerializer", () async { + var msg = UnSubscribe(1, 1); + var command = "$baseSubCommand --serializer cbor --output hex"; + + var output = await runCommand(command); + var outputBytes = Base16Encoder.instance.decode(output.trim()); + + var cborSerializer = CBORSerializer(); + var message = cborSerializer.deserialize(outputBytes) as UnSubscribe; + expect(isEqual(message, msg), true); + }); + + test("MsgPackSerializer", () async { + var msg = UnSubscribe(1, 1); + var command = "$baseSubCommand --serializer msgpack --output hex"; + + var output = await runCommand(command); + var outputBytes = Base16Encoder.instance.decode(output.trim()); + + var msgPackSerializer = MsgPackSerializer(); + var message = msgPackSerializer.deserialize(outputBytes) as UnSubscribe; + expect(isEqual(message, msg), true); + }); + }); +} From 621cc02f73ad225d411e772bf5cf1316fc7be871 Mon Sep 17 00:00:00 2001 From: Muzzammil Shahid Date: Tue, 2 Jul 2024 19:02:48 +0500 Subject: [PATCH 7/8] Add interoperabilty tests for Unsubscribed message --- test/interoptests/messages/event_test.dart | 8 +-- .../interoptests/messages/subscribe_test.dart | 2 +- .../messages/subscribed_test.dart | 2 +- .../messages/unsubscribed_test.dart | 50 +++++++++++++++++++ 4 files changed, 56 insertions(+), 6 deletions(-) create mode 100644 test/interoptests/messages/unsubscribed_test.dart diff --git a/test/interoptests/messages/event_test.dart b/test/interoptests/messages/event_test.dart index 67df4e1..42bb0cb 100644 --- a/test/interoptests/messages/event_test.dart +++ b/test/interoptests/messages/event_test.dart @@ -14,10 +14,10 @@ void main() { bool isEqual(Event msg1, Event msg2) => msg1.subscriptionID == msg2.subscriptionID && - msg1.publicationID == msg2.publicationID && - equality.equals(msg1.details, msg2.details) && - equality.equals(msg1.args, msg2.args) && - equality.equals(msg1.kwargs, msg2.kwargs); + msg1.publicationID == msg2.publicationID && + equality.equals(msg1.details, msg2.details) && + equality.equals(msg1.args, msg2.args) && + equality.equals(msg1.kwargs, msg2.kwargs); test("JSONSerializer", () async { var msg = Event(1, 1); diff --git a/test/interoptests/messages/subscribe_test.dart b/test/interoptests/messages/subscribe_test.dart index e53cf2c..8be6ef2 100644 --- a/test/interoptests/messages/subscribe_test.dart +++ b/test/interoptests/messages/subscribe_test.dart @@ -51,4 +51,4 @@ void main() { expect(isEqual(message, msg), true); }); }); -} \ No newline at end of file +} diff --git a/test/interoptests/messages/subscribed_test.dart b/test/interoptests/messages/subscribed_test.dart index b8e45ea..8d7f92c 100644 --- a/test/interoptests/messages/subscribed_test.dart +++ b/test/interoptests/messages/subscribed_test.dart @@ -48,4 +48,4 @@ void main() { expect(isEqual(message, msg), true); }); }); -} \ No newline at end of file +} diff --git a/test/interoptests/messages/unsubscribed_test.dart b/test/interoptests/messages/unsubscribed_test.dart new file mode 100644 index 0000000..5c057c6 --- /dev/null +++ b/test/interoptests/messages/unsubscribed_test.dart @@ -0,0 +1,50 @@ +import "package:pinenacl/encoding.dart"; +import "package:test/test.dart"; + +import "package:wampproto/messages.dart"; +import "package:wampproto/serializers.dart"; + +import "../helper.dart"; + +void main() { + group("Unsubscribed", () { + const baseSubCommand = "message unsubscribed 1"; + + bool isEqual(UnSubscribed msg1, UnSubscribed msg2) => msg1.requestID == msg2.requestID; + + test("JSONSerializer", () async { + var msg = UnSubscribed(1); + var command = "$baseSubCommand --serializer json"; + + var output = await runCommand(command); + + var jsonSerializer = JSONSerializer(); + var message = jsonSerializer.deserialize(output) as UnSubscribed; + expect(isEqual(message, msg), true); + }); + + test("CBORSerializer", () async { + var msg = UnSubscribed(1); + var command = "$baseSubCommand --serializer cbor --output hex"; + + var output = await runCommand(command); + var outputBytes = Base16Encoder.instance.decode(output.trim()); + + var cborSerializer = CBORSerializer(); + var message = cborSerializer.deserialize(outputBytes) as UnSubscribed; + expect(isEqual(message, msg), true); + }); + + test("MsgPackSerializer", () async { + var msg = UnSubscribed(1); + var command = "$baseSubCommand --serializer msgpack --output hex"; + + var output = await runCommand(command); + var outputBytes = Base16Encoder.instance.decode(output.trim()); + + var msgPackSerializer = MsgPackSerializer(); + var message = msgPackSerializer.deserialize(outputBytes) as UnSubscribed; + expect(isEqual(message, msg), true); + }); + }); +} From 181f23ccca5ec6f481a8033151eaa8a13d8b7a7e Mon Sep 17 00:00:00 2001 From: Muzzammil Shahid Date: Wed, 3 Jul 2024 19:44:49 +0500 Subject: [PATCH 8/8] Remove base commands from pubsub messages --- test/interoptests/messages/event_test.dart | 8 ++++---- test/interoptests/messages/publish_test.dart | 7 +++---- test/interoptests/messages/published_test.dart | 8 +++----- test/interoptests/messages/subscribe_test.dart | 7 +++---- test/interoptests/messages/subscribed_test.dart | 8 +++----- test/interoptests/messages/unsubscribed_test.dart | 8 +++----- test/interoptests/messages/unsusbcribe_test.dart | 8 +++----- 7 files changed, 22 insertions(+), 32 deletions(-) diff --git a/test/interoptests/messages/event_test.dart b/test/interoptests/messages/event_test.dart index 42bb0cb..bda4b61 100644 --- a/test/interoptests/messages/event_test.dart +++ b/test/interoptests/messages/event_test.dart @@ -10,7 +10,6 @@ import "../helper.dart"; void main() { group("Event", () { const equality = DeepCollectionEquality(); - const baseEventCommand = "message event 1 1"; bool isEqual(Event msg1, Event msg2) => msg1.subscriptionID == msg2.subscriptionID && @@ -21,7 +20,7 @@ void main() { test("JSONSerializer", () async { var msg = Event(1, 1); - var command = "$baseEventCommand --serializer json"; + var command = "message event ${msg.subscriptionID} ${msg.publicationID} --serializer json"; var output = await runCommand(command); @@ -32,7 +31,7 @@ void main() { test("CBORSerializer", () async { var msg = Event(1, 1, args: ["abc"]); - var command = "$baseEventCommand abc --serializer cbor --output hex"; + var command = "message event ${msg.subscriptionID} ${msg.publicationID} abc --serializer cbor --output hex"; var output = await runCommand(command); var outputBytes = Base16Encoder.instance.decode(output.trim()); @@ -44,7 +43,8 @@ void main() { test("MsgPackSerializer", () async { var msg = Event(1, 1, details: {"abc": 1}, args: ["abc"], kwargs: {"a": 1}); - var command = "$baseEventCommand abc -d abc=1 -k a=1 --serializer msgpack --output hex"; + var command = + "message event ${msg.subscriptionID} ${msg.publicationID} abc -d abc=1 -k a=1 --serializer msgpack --output hex"; var output = await runCommand(command); var outputBytes = Base16Encoder.instance.decode(output.trim()); diff --git a/test/interoptests/messages/publish_test.dart b/test/interoptests/messages/publish_test.dart index 814857d..6148f8a 100644 --- a/test/interoptests/messages/publish_test.dart +++ b/test/interoptests/messages/publish_test.dart @@ -10,7 +10,6 @@ import "../helper.dart"; void main() { group("Publish", () { const equality = DeepCollectionEquality(); - const basePubCommand = "message publish 1 io.xconn.topic"; bool isEqual(Publish msg1, Publish msg2) => msg1.requestID == msg2.requestID && @@ -21,7 +20,7 @@ void main() { test("JSONSerializer", () async { var msg = Publish(1, "io.xconn.topic"); - var command = "$basePubCommand --serializer json"; + var command = "message publish ${msg.requestID} ${msg.uri} --serializer json"; var output = await runCommand(command); @@ -32,7 +31,7 @@ void main() { test("CBORSerializer", () async { var msg = Publish(1, "io.xconn.topic", args: ["abc"]); - var command = "$basePubCommand abc --serializer cbor --output hex"; + var command = "message publish ${msg.requestID} ${msg.uri} abc --serializer cbor --output hex"; var output = await runCommand(command); var outputBytes = Base16Encoder.instance.decode(output.trim()); @@ -44,7 +43,7 @@ void main() { test("MsgPackSerializer", () async { var msg = Publish(1, "io.xconn.topic", options: {"abc": 1}, args: ["abc"], kwargs: {"a": 1}); - var command = "$basePubCommand abc -o abc=1 -k a=1 --serializer msgpack --output hex"; + var command = "message publish ${msg.requestID} ${msg.uri} abc -o abc=1 -k a=1 --serializer msgpack --output hex"; var output = await runCommand(command); var outputBytes = Base16Encoder.instance.decode(output.trim()); diff --git a/test/interoptests/messages/published_test.dart b/test/interoptests/messages/published_test.dart index 1a73e2e..9ff33c5 100644 --- a/test/interoptests/messages/published_test.dart +++ b/test/interoptests/messages/published_test.dart @@ -8,14 +8,12 @@ import "../helper.dart"; void main() { group("Published", () { - const basePubCmd = "message published 1 1"; - bool isEqual(Published msg1, Published msg2) => msg1.requestID == msg2.requestID && msg1.publicationID == msg2.publicationID; test("JSONSerializer", () async { var msg = Published(1, 1); - var command = "$basePubCmd --serializer json"; + var command = "message published ${msg.requestID} ${msg.publicationID} --serializer json"; var output = await runCommand(command); @@ -26,7 +24,7 @@ void main() { test("CBORSerializer", () async { var msg = Published(1, 1); - var command = "$basePubCmd --serializer cbor --output hex"; + var command = "message published ${msg.requestID} ${msg.publicationID} --serializer cbor --output hex"; var output = await runCommand(command); var outputBytes = Base16Encoder.instance.decode(output.trim()); @@ -38,7 +36,7 @@ void main() { test("MsgPackSerializer", () async { var msg = Published(1, 1); - var command = "$basePubCmd --serializer msgpack --output hex"; + var command = "message published ${msg.requestID} ${msg.publicationID} --serializer msgpack --output hex"; var output = await runCommand(command); var outputBytes = Base16Encoder.instance.decode(output.trim()); diff --git a/test/interoptests/messages/subscribe_test.dart b/test/interoptests/messages/subscribe_test.dart index 8be6ef2..b9b594a 100644 --- a/test/interoptests/messages/subscribe_test.dart +++ b/test/interoptests/messages/subscribe_test.dart @@ -11,14 +11,13 @@ void main() { group("Subscribe", () { const equality = DeepCollectionEquality(); const topic = "io.xconn.test"; - const baseSubCommand = "message subscribe 1 $topic"; bool isEqual(Subscribe msg1, Subscribe msg2) => msg1.requestID == msg2.requestID && msg1.topic == msg2.topic && equality.equals(msg1.options, msg2.options); test("JSONSerializer", () async { var msg = Subscribe(1, topic); - var command = "$baseSubCommand --serializer json"; + var command = "message subscribe ${msg.requestID} ${msg.topic} --serializer json"; var output = await runCommand(command); @@ -29,7 +28,7 @@ void main() { test("CBORSerializer", () async { var msg = Subscribe(1, topic); - var command = "$baseSubCommand --serializer cbor --output hex"; + var command = "message subscribe ${msg.requestID} ${msg.topic} --serializer cbor --output hex"; var output = await runCommand(command); var outputBytes = Base16Encoder.instance.decode(output.trim()); @@ -41,7 +40,7 @@ void main() { test("MsgPackSerializer", () async { var msg = Subscribe(1, topic, options: {"a": 1}); - var command = "$baseSubCommand -o a=1 --serializer msgpack --output hex"; + var command = "message subscribe ${msg.requestID} ${msg.topic} -o a=1 --serializer msgpack --output hex"; var output = await runCommand(command); var outputBytes = Base16Encoder.instance.decode(output.trim()); diff --git a/test/interoptests/messages/subscribed_test.dart b/test/interoptests/messages/subscribed_test.dart index 8d7f92c..c819d8d 100644 --- a/test/interoptests/messages/subscribed_test.dart +++ b/test/interoptests/messages/subscribed_test.dart @@ -8,14 +8,12 @@ import "../helper.dart"; void main() { group("Subscribed", () { - const baseSubCommand = "message subscribed 1 1"; - bool isEqual(Subscribed msg1, Subscribed msg2) => msg1.requestID == msg2.requestID && msg1.subscriptionID == msg2.subscriptionID; test("JSONSerializer", () async { var msg = Subscribed(1, 1); - var command = "$baseSubCommand --serializer json"; + var command = "message subscribed ${msg.requestID} ${msg.subscriptionID} --serializer json"; var output = await runCommand(command); @@ -26,7 +24,7 @@ void main() { test("CBORSerializer", () async { var msg = Subscribed(1, 1); - var command = "$baseSubCommand --serializer cbor --output hex"; + var command = "message subscribed ${msg.requestID} ${msg.subscriptionID} --serializer cbor --output hex"; var output = await runCommand(command); var outputBytes = Base16Encoder.instance.decode(output.trim()); @@ -38,7 +36,7 @@ void main() { test("MsgPackSerializer", () async { var msg = Subscribed(1, 1); - var command = "$baseSubCommand --serializer msgpack --output hex"; + var command = "message subscribed ${msg.requestID} ${msg.subscriptionID} --serializer msgpack --output hex"; var output = await runCommand(command); var outputBytes = Base16Encoder.instance.decode(output.trim()); diff --git a/test/interoptests/messages/unsubscribed_test.dart b/test/interoptests/messages/unsubscribed_test.dart index 5c057c6..4f08756 100644 --- a/test/interoptests/messages/unsubscribed_test.dart +++ b/test/interoptests/messages/unsubscribed_test.dart @@ -8,13 +8,11 @@ import "../helper.dart"; void main() { group("Unsubscribed", () { - const baseSubCommand = "message unsubscribed 1"; - bool isEqual(UnSubscribed msg1, UnSubscribed msg2) => msg1.requestID == msg2.requestID; test("JSONSerializer", () async { var msg = UnSubscribed(1); - var command = "$baseSubCommand --serializer json"; + var command = "message unsubscribed ${msg.requestID} --serializer json"; var output = await runCommand(command); @@ -25,7 +23,7 @@ void main() { test("CBORSerializer", () async { var msg = UnSubscribed(1); - var command = "$baseSubCommand --serializer cbor --output hex"; + var command = "message unsubscribed ${msg.requestID} --serializer cbor --output hex"; var output = await runCommand(command); var outputBytes = Base16Encoder.instance.decode(output.trim()); @@ -37,7 +35,7 @@ void main() { test("MsgPackSerializer", () async { var msg = UnSubscribed(1); - var command = "$baseSubCommand --serializer msgpack --output hex"; + var command = "message unsubscribed ${msg.requestID} --serializer msgpack --output hex"; var output = await runCommand(command); var outputBytes = Base16Encoder.instance.decode(output.trim()); diff --git a/test/interoptests/messages/unsusbcribe_test.dart b/test/interoptests/messages/unsusbcribe_test.dart index dbf1c2a..779c357 100644 --- a/test/interoptests/messages/unsusbcribe_test.dart +++ b/test/interoptests/messages/unsusbcribe_test.dart @@ -8,14 +8,12 @@ import "../helper.dart"; void main() { group("Unsubscribe", () { - const baseSubCommand = "message unsubscribe 1 1"; - bool isEqual(UnSubscribe msg1, UnSubscribe msg2) => msg1.requestID == msg2.requestID && msg1.subscriptionID == msg2.subscriptionID; test("JSONSerializer", () async { var msg = UnSubscribe(1, 1); - var command = "$baseSubCommand --serializer json"; + var command = "message unsubscribe ${msg.requestID} ${msg.subscriptionID} --serializer json"; var output = await runCommand(command); @@ -26,7 +24,7 @@ void main() { test("CBORSerializer", () async { var msg = UnSubscribe(1, 1); - var command = "$baseSubCommand --serializer cbor --output hex"; + var command = "message unsubscribe ${msg.requestID} ${msg.subscriptionID} --serializer cbor --output hex"; var output = await runCommand(command); var outputBytes = Base16Encoder.instance.decode(output.trim()); @@ -38,7 +36,7 @@ void main() { test("MsgPackSerializer", () async { var msg = UnSubscribe(1, 1); - var command = "$baseSubCommand --serializer msgpack --output hex"; + var command = "message unsubscribe ${msg.requestID} ${msg.subscriptionID} --serializer msgpack --output hex"; var output = await runCommand(command); var outputBytes = Base16Encoder.instance.decode(output.trim());