Skip to content

Commit

Permalink
Remove base commands from pubsub messages
Browse files Browse the repository at this point in the history
  • Loading branch information
muzzammilshahid committed Jul 3, 2024
1 parent 621cc02 commit 181f23c
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 32 deletions.
8 changes: 4 additions & 4 deletions test/interoptests/messages/event_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand All @@ -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);

Expand All @@ -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());
Expand All @@ -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());
Expand Down
7 changes: 3 additions & 4 deletions test/interoptests/messages/publish_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand All @@ -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);

Expand All @@ -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());
Expand All @@ -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());
Expand Down
8 changes: 3 additions & 5 deletions test/interoptests/messages/published_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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());
Expand All @@ -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());
Expand Down
7 changes: 3 additions & 4 deletions test/interoptests/messages/subscribe_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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());
Expand All @@ -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());
Expand Down
8 changes: 3 additions & 5 deletions test/interoptests/messages/subscribed_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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());
Expand All @@ -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());
Expand Down
8 changes: 3 additions & 5 deletions test/interoptests/messages/unsubscribed_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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());
Expand All @@ -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());
Expand Down
8 changes: 3 additions & 5 deletions test/interoptests/messages/unsusbcribe_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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());
Expand All @@ -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());
Expand Down

0 comments on commit 181f23c

Please sign in to comment.