Loading plugins/org.etsi.mts.tdl.execution.java.runtime/src/org/etsi/mts/tdl/execution/java/adapters/http/HttpSystemAdapter.java +14 −6 Original line number Diff line number Diff line Loading @@ -309,7 +309,7 @@ public class HttpSystemAdapter implements SystemAdapter { reporter.comment("SystemAdapter | " + source.getName(), "Outgoing (headers): " + httpData.method.toString() + " | " + uri); byte[] body = encodeBody(httpData.body); reporter.comment("SystemAdapter | " + source.getName(), "Outgoing (body): " + mapper.writeValueAsString(httpData.body)); reporter.comment("SystemAdapter | " + source.getName(), "Outgoing (body): " + toDefault(mapper.writeValueAsString(httpData.body), "<empty body>")); requestBuilder.method(httpData.method.toString(), HttpRequest.BodyPublishers.ofByteArray(body)); if (httpData.headers != null) Loading Loading @@ -364,7 +364,7 @@ public class HttpSystemAdapter implements SystemAdapter { // TODO logging reporter.comment("SystemAdapter | " + source.getName(), "Outgoing (headers): " + httpData.status + " | length=" + length); reporter.comment("SystemAdapter | " + source.getName(), "Outgoing (body): " + mapper.writeValueAsString(httpData.body)); reporter.comment("SystemAdapter | " + source.getName(), "Outgoing (body): " + toDefault(mapper.writeValueAsString(httpData.body), "<empty body>")); unhandledExchange.sendResponseHeaders(httpData.status, length); Loading Loading @@ -433,8 +433,8 @@ public class HttpSystemAdapter implements SystemAdapter { // For logging only expectedBody = StandardCharsets.UTF_8.decode(ByteBuffer.wrap(encodeBody(expectedHttpData.body))).toString(); } reporter.comment("SystemAdapter | " + target.getName(), "Matching: " + response.statusCode() + " | " + body); reporter.comment("SystemAdapter | " + target.getName(), "\t vs " + expectedHttpData.status + " | " + expectedBody); reporter.comment("SystemAdapter | " + target.getName(), "Matching: " + response.statusCode() + " | " + toDefault(body, "<empty body>")); reporter.comment("SystemAdapter | " + target.getName(), "\t vs " + toAny(expectedHttpData.status) + " | " + toAny(expectedBody)); if (this.validator.matches(expected, received)) { reporter.comment("SystemAdapter | " + target.getName(), "\t MATCHED"); unhandledInputs.remove(input); Loading Loading @@ -494,8 +494,8 @@ public class HttpSystemAdapter implements SystemAdapter { // For logging only expectedBody = StandardCharsets.UTF_8.decode(ByteBuffer.wrap(encodeBody(expectedHttpData.body))).toString(); } reporter.comment("SystemAdapter | " + target.getName(), "Matching: " + exchange.getRequestMethod() + " | " + input.body); reporter.comment("SystemAdapter | " + target.getName(), "\t vs " + expectedHttpData.method + " | " + expectedBody); reporter.comment("SystemAdapter | " + target.getName(), "Matching: " + exchange.getRequestMethod() + " | " + toDefault(input.body, "<empty body>")); reporter.comment("SystemAdapter | " + target.getName(), "\t vs " + toAny(expectedHttpData.method) + " | " + toAny(expectedBody)); if (this.validator.matches(expected, received)) { reporter.comment("SystemAdapter | " + target.getName(), "\t MATCHED"); isReceived = true; Loading Loading @@ -527,6 +527,14 @@ public class HttpSystemAdapter implements SystemAdapter { return null; } private String toAny(Object value) { return toDefault(value, "*"); } private String toDefault(Object value, String def) { return value != null && !value.equals("null") ? value.toString() : def; } @Override public void logUnexpected(Data received, Data expected, Connection connection, NamedElement target) { reporter.comment("SystemAdapter | " + target.getName(), "UNEXPECTED: " + describe(received)); Loading plugins/org.etsi.mts.tdl.execution.java.runtime/src/org/etsi/mts/tdl/execution/java/rt/core/PojoData.java +1 −1 Original line number Diff line number Diff line Loading @@ -3,7 +3,7 @@ package org.etsi.mts.tdl.execution.java.rt.core; public class PojoData<V> extends DataImpl<Class<V>, V> { public PojoData(V value) { super((Class<V>) value.getClass(), value); super(value != null ? (Class<V>) value.getClass() : null, value); } } Loading
plugins/org.etsi.mts.tdl.execution.java.runtime/src/org/etsi/mts/tdl/execution/java/adapters/http/HttpSystemAdapter.java +14 −6 Original line number Diff line number Diff line Loading @@ -309,7 +309,7 @@ public class HttpSystemAdapter implements SystemAdapter { reporter.comment("SystemAdapter | " + source.getName(), "Outgoing (headers): " + httpData.method.toString() + " | " + uri); byte[] body = encodeBody(httpData.body); reporter.comment("SystemAdapter | " + source.getName(), "Outgoing (body): " + mapper.writeValueAsString(httpData.body)); reporter.comment("SystemAdapter | " + source.getName(), "Outgoing (body): " + toDefault(mapper.writeValueAsString(httpData.body), "<empty body>")); requestBuilder.method(httpData.method.toString(), HttpRequest.BodyPublishers.ofByteArray(body)); if (httpData.headers != null) Loading Loading @@ -364,7 +364,7 @@ public class HttpSystemAdapter implements SystemAdapter { // TODO logging reporter.comment("SystemAdapter | " + source.getName(), "Outgoing (headers): " + httpData.status + " | length=" + length); reporter.comment("SystemAdapter | " + source.getName(), "Outgoing (body): " + mapper.writeValueAsString(httpData.body)); reporter.comment("SystemAdapter | " + source.getName(), "Outgoing (body): " + toDefault(mapper.writeValueAsString(httpData.body), "<empty body>")); unhandledExchange.sendResponseHeaders(httpData.status, length); Loading Loading @@ -433,8 +433,8 @@ public class HttpSystemAdapter implements SystemAdapter { // For logging only expectedBody = StandardCharsets.UTF_8.decode(ByteBuffer.wrap(encodeBody(expectedHttpData.body))).toString(); } reporter.comment("SystemAdapter | " + target.getName(), "Matching: " + response.statusCode() + " | " + body); reporter.comment("SystemAdapter | " + target.getName(), "\t vs " + expectedHttpData.status + " | " + expectedBody); reporter.comment("SystemAdapter | " + target.getName(), "Matching: " + response.statusCode() + " | " + toDefault(body, "<empty body>")); reporter.comment("SystemAdapter | " + target.getName(), "\t vs " + toAny(expectedHttpData.status) + " | " + toAny(expectedBody)); if (this.validator.matches(expected, received)) { reporter.comment("SystemAdapter | " + target.getName(), "\t MATCHED"); unhandledInputs.remove(input); Loading Loading @@ -494,8 +494,8 @@ public class HttpSystemAdapter implements SystemAdapter { // For logging only expectedBody = StandardCharsets.UTF_8.decode(ByteBuffer.wrap(encodeBody(expectedHttpData.body))).toString(); } reporter.comment("SystemAdapter | " + target.getName(), "Matching: " + exchange.getRequestMethod() + " | " + input.body); reporter.comment("SystemAdapter | " + target.getName(), "\t vs " + expectedHttpData.method + " | " + expectedBody); reporter.comment("SystemAdapter | " + target.getName(), "Matching: " + exchange.getRequestMethod() + " | " + toDefault(input.body, "<empty body>")); reporter.comment("SystemAdapter | " + target.getName(), "\t vs " + toAny(expectedHttpData.method) + " | " + toAny(expectedBody)); if (this.validator.matches(expected, received)) { reporter.comment("SystemAdapter | " + target.getName(), "\t MATCHED"); isReceived = true; Loading Loading @@ -527,6 +527,14 @@ public class HttpSystemAdapter implements SystemAdapter { return null; } private String toAny(Object value) { return toDefault(value, "*"); } private String toDefault(Object value, String def) { return value != null && !value.equals("null") ? value.toString() : def; } @Override public void logUnexpected(Data received, Data expected, Connection connection, NamedElement target) { reporter.comment("SystemAdapter | " + target.getName(), "UNEXPECTED: " + describe(received)); Loading
plugins/org.etsi.mts.tdl.execution.java.runtime/src/org/etsi/mts/tdl/execution/java/rt/core/PojoData.java +1 −1 Original line number Diff line number Diff line Loading @@ -3,7 +3,7 @@ package org.etsi.mts.tdl.execution.java.rt.core; public class PojoData<V> extends DataImpl<Class<V>, V> { public PojoData(V value) { super((Class<V>) value.getClass(), value); super(value != null ? (Class<V>) value.getClass() : null, value); } }