@Test public void serializeTest() { InvocationMessage invocationMessage = new InvocationMessage(111, 1, null, null, null); assertThat(invocationMessage.getCode()).isEqualTo(68); assertThat(invocationMessage.getRequestId()).isEqualTo(111); assertThat(invocationMessage.getRegistrationId()).isEqualTo(1); assertThat(invocationMessage.getCaller()).isNull(); assertThat(invocationMessage.getArguments()).isNull(); assertThat(invocationMessage.getArgumentsKw()).isNull(); String json = serializeToJson(invocationMessage); assertThat(json).isEqualTo("[68,111,1,{}]"); invocationMessage = new InvocationMessage(1, 111, null, Arrays.asList("Hello world"), null); assertThat(invocationMessage.getCode()).isEqualTo(68); assertThat(invocationMessage.getRequestId()).isEqualTo(1); assertThat(invocationMessage.getRegistrationId()).isEqualTo(111); assertThat(invocationMessage.getCaller()).isNull(); assertThat(invocationMessage.getArguments()).containsExactly("Hello world"); assertThat(invocationMessage.getArgumentsKw()).isNull(); json = serializeToJson(invocationMessage); assertThat(json).isEqualTo("[68,1,111,{},[\"Hello world\"]]"); Map<String, Object> argumentsKw = new HashMap<>(); argumentsKw.put("firstname", "John"); argumentsKw.put("surname", "Doe"); invocationMessage = new InvocationMessage(1, 111, null, Arrays.asList("johnny"), argumentsKw); assertThat(invocationMessage.getCode()).isEqualTo(68); assertThat(invocationMessage.getRequestId()).isEqualTo(1); assertThat(invocationMessage.getRegistrationId()).isEqualTo(111); assertThat(invocationMessage.getCaller()).isNull(); assertThat(invocationMessage.getArguments()).containsExactly("johnny"); assertThat(invocationMessage.getArgumentsKw()).containsExactly( MapEntry.entry("firstname", "John"), MapEntry.entry("surname", "Doe")); json = serializeToJson(invocationMessage); assertThat(json).isEqualTo( "[68,1,111,{},[\"johnny\"],{\"firstname\":\"John\",\"surname\":\"Doe\"}]"); invocationMessage = new InvocationMessage(1, 111, 17218L, Arrays.asList("Hello world"), null); assertThat(invocationMessage.getCode()).isEqualTo(68); assertThat(invocationMessage.getRequestId()).isEqualTo(1); assertThat(invocationMessage.getRegistrationId()).isEqualTo(111); assertThat(invocationMessage.getCaller()).isEqualTo(17218L); assertThat(invocationMessage.getArguments()).containsExactly("Hello world"); assertThat(invocationMessage.getArgumentsKw()).isNull(); json = serializeToJson(invocationMessage); assertThat(json).isEqualTo("[68,1,111,{\"caller\":17218},[\"Hello world\"]]"); }
@Override public void serialize(JsonGenerator generator) throws IOException { generator.writeNumber(getCode()); generator.writeNumber(this.requestId); generator.writeNumber(this.registrationId); generator.writeStartObject(); if (this.caller != null) { generator.writeNumberField("caller", this.caller.longValue()); } generator.writeEndObject(); if (this.argumentsKw != null) { if (this.arguments == null) { generator.writeStartArray(); generator.writeEndArray(); } else { generator.writeObject(this.arguments); } generator.writeObject(this.argumentsKw); } else if (this.arguments != null) { generator.writeObject(this.arguments); } }
InvocationMessage extends WampMessage { @Override public void serialize(JsonGenerator generator) throws IOException { generator.writeNumber(getCode()); generator.writeNumber(this.requestId); generator.writeNumber(this.registrationId); generator.writeStartObject(); if (this.caller != null) { generator.writeNumberField("caller", this.caller.longValue()); } generator.writeEndObject(); if (this.argumentsKw != null) { if (this.arguments == null) { generator.writeStartArray(); generator.writeEndArray(); } else { generator.writeObject(this.arguments); } generator.writeObject(this.argumentsKw); } else if (this.arguments != null) { generator.writeObject(this.arguments); } } }
InvocationMessage extends WampMessage { @Override public void serialize(JsonGenerator generator) throws IOException { generator.writeNumber(getCode()); generator.writeNumber(this.requestId); generator.writeNumber(this.registrationId); generator.writeStartObject(); if (this.caller != null) { generator.writeNumberField("caller", this.caller.longValue()); } generator.writeEndObject(); if (this.argumentsKw != null) { if (this.arguments == null) { generator.writeStartArray(); generator.writeEndArray(); } else { generator.writeObject(this.arguments); } generator.writeObject(this.argumentsKw); } else if (this.arguments != null) { generator.writeObject(this.arguments); } } InvocationMessage(long requestId, long registrationId, @Nullable Number caller,
			@Nullable List<Object> arguments, @Nullable Map<String, Object> argumentsKw);  InvocationMessage(Procedure procedure, CallMessage callMessage); }
InvocationMessage extends WampMessage { @Override public void serialize(JsonGenerator generator) throws IOException { generator.writeNumber(getCode()); generator.writeNumber(this.requestId); generator.writeNumber(this.registrationId); generator.writeStartObject(); if (this.caller != null) { generator.writeNumberField("caller", this.caller.longValue()); } generator.writeEndObject(); if (this.argumentsKw != null) { if (this.arguments == null) { generator.writeStartArray(); generator.writeEndArray(); } else { generator.writeObject(this.arguments); } generator.writeObject(this.argumentsKw); } else if (this.arguments != null) { generator.writeObject(this.arguments); } } InvocationMessage(long requestId, long registrationId, @Nullable Number caller,
			@Nullable List<Object> arguments, @Nullable Map<String, Object> argumentsKw);  InvocationMessage(Procedure procedure, CallMessage callMessage); static InvocationMessage deserialize(JsonParser jp); @Override void serialize(JsonGenerator generator); long getRequestId(); long getRegistrationId(); @Nullable List<Object> getArguments(); @Nullable Map<String, Object> getArgumentsKw(); @Nullable Number getCaller(); @Override String toString(); }
InvocationMessage extends WampMessage { @Override public void serialize(JsonGenerator generator) throws IOException { generator.writeNumber(getCode()); generator.writeNumber(this.requestId); generator.writeNumber(this.registrationId); generator.writeStartObject(); if (this.caller != null) { generator.writeNumberField("caller", this.caller.longValue()); } generator.writeEndObject(); if (this.argumentsKw != null) { if (this.arguments == null) { generator.writeStartArray(); generator.writeEndArray(); } else { generator.writeObject(this.arguments); } generator.writeObject(this.argumentsKw); } else if (this.arguments != null) { generator.writeObject(this.arguments); } } InvocationMessage(long requestId, long registrationId, @Nullable Number caller,
			@Nullable List<Object> arguments, @Nullable Map<String, Object> argumentsKw);  InvocationMessage(Procedure procedure, CallMessage callMessage); static InvocationMessage deserialize(JsonParser jp); @Override void serialize(JsonGenerator generator); long getRequestId(); long getRegistrationId(); @Nullable List<Object> getArguments(); @Nullable Map<String, Object> getArgumentsKw(); @Nullable Number getCaller(); @Override String toString(); static final int CODE; }