From 28b4f0645b8d7c82480e3573292185849f69e120 Mon Sep 17 00:00:00 2001 From: svacas Date: Wed, 25 May 2022 15:49:43 -0300 Subject: [PATCH] Support properties for vm consumers (#644) --- .../mule/steps/vm/VmInboundEndpoint.java | 10 +++---- .../library/mule/steps/vm/VmInboundTest.java | 4 ++- .../mule/apps/vm/vm-inbound-17-original.xml | 18 +++++++++++++ .../resources/mule/apps/vm/vm-inbound-17.xml | 27 +++++++++++++++++++ .../mule/apps/vm/vm-inbound-18-original.xml | 22 +++++++++++++++ .../resources/mule/apps/vm/vm-inbound-18.xml | 27 +++++++++++++++++++ 6 files changed, 102 insertions(+), 6 deletions(-) create mode 100644 mule-migration-tool-library/src/test/resources/mule/apps/vm/vm-inbound-17-original.xml create mode 100644 mule-migration-tool-library/src/test/resources/mule/apps/vm/vm-inbound-17.xml create mode 100644 mule-migration-tool-library/src/test/resources/mule/apps/vm/vm-inbound-18-original.xml create mode 100644 mule-migration-tool-library/src/test/resources/mule/apps/vm/vm-inbound-18.xml diff --git a/mule-migration-tool-library/src/main/java/com/mulesoft/tools/migration/library/mule/steps/vm/VmInboundEndpoint.java b/mule-migration-tool-library/src/main/java/com/mulesoft/tools/migration/library/mule/steps/vm/VmInboundEndpoint.java index e6026bc99..42cdec5c3 100644 --- a/mule-migration-tool-library/src/main/java/com/mulesoft/tools/migration/library/mule/steps/vm/VmInboundEndpoint.java +++ b/mule-migration-tool-library/src/main/java/com/mulesoft/tools/migration/library/mule/steps/vm/VmInboundEndpoint.java @@ -125,17 +125,17 @@ public void execute(Element object, MigrationReport report) throws RuntimeExcept connector.ifPresent(conn -> { handleServiceOverrides(conn, report); - Integer consumers = null; + String consumers = null; if (conn.getAttribute("numberOfConcurrentTransactedReceivers") != null) { - consumers = parseInt(conn.getAttributeValue("numberOfConcurrentTransactedReceivers")); + consumers = conn.getAttributeValue("numberOfConcurrentTransactedReceivers"); } else if (conn.getChild("receiver-threading-profile", CORE_NAMESPACE) != null && conn.getChild("receiver-threading-profile", CORE_NAMESPACE).getAttribute("maxThreadsActive") != null) { - consumers = parseInt(conn.getChild("receiver-threading-profile", CORE_NAMESPACE).getAttributeValue("maxThreadsActive")); + consumers = conn.getChild("receiver-threading-profile", CORE_NAMESPACE).getAttributeValue("maxThreadsActive"); } if (consumers != null) { - getContainerElement(object).setAttribute("maxConcurrency", "" + consumers); - object.setAttribute("numberOfConsumers", "" + consumers); + getContainerElement(object).setAttribute("maxConcurrency", consumers); + object.setAttribute("numberOfConsumers", consumers); } handleConnectorChildElements(conn, vmConfig, new Element("connection", CORE_NAMESPACE), report); diff --git a/mule-migration-tool-library/src/test/java/com/mulesoft/tools/migration/library/mule/steps/vm/VmInboundTest.java b/mule-migration-tool-library/src/test/java/com/mulesoft/tools/migration/library/mule/steps/vm/VmInboundTest.java index afc45145e..981175376 100644 --- a/mule-migration-tool-library/src/test/java/com/mulesoft/tools/migration/library/mule/steps/vm/VmInboundTest.java +++ b/mule-migration-tool-library/src/test/java/com/mulesoft/tools/migration/library/mule/steps/vm/VmInboundTest.java @@ -65,7 +65,9 @@ public static Object[] params() { "vm-inbound-13", "vm-inbound-14", "vm-inbound-15", - "vm-inbound-16" + "vm-inbound-16", + "vm-inbound-17", + "vm-inbound-18" }; } diff --git a/mule-migration-tool-library/src/test/resources/mule/apps/vm/vm-inbound-17-original.xml b/mule-migration-tool-library/src/test/resources/mule/apps/vm/vm-inbound-17-original.xml new file mode 100644 index 000000000..e381d15a4 --- /dev/null +++ b/mule-migration-tool-library/src/test/resources/mule/apps/vm/vm-inbound-17-original.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + diff --git a/mule-migration-tool-library/src/test/resources/mule/apps/vm/vm-inbound-17.xml b/mule-migration-tool-library/src/test/resources/mule/apps/vm/vm-inbound-17.xml new file mode 100644 index 000000000..185e274c3 --- /dev/null +++ b/mule-migration-tool-library/src/test/resources/mule/apps/vm/vm-inbound-17.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + #[output application/java --- {'_vmTransportMode': true, 'payload': payload.^raw, 'mimeType': payload.^mimeType, 'session': vars.compatibility_outboundProperties['MULE_SESSION']}] + + + + + + + + diff --git a/mule-migration-tool-library/src/test/resources/mule/apps/vm/vm-inbound-18-original.xml b/mule-migration-tool-library/src/test/resources/mule/apps/vm/vm-inbound-18-original.xml new file mode 100644 index 000000000..fb340affe --- /dev/null +++ b/mule-migration-tool-library/src/test/resources/mule/apps/vm/vm-inbound-18-original.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + diff --git a/mule-migration-tool-library/src/test/resources/mule/apps/vm/vm-inbound-18.xml b/mule-migration-tool-library/src/test/resources/mule/apps/vm/vm-inbound-18.xml new file mode 100644 index 000000000..2e12bc2e8 --- /dev/null +++ b/mule-migration-tool-library/src/test/resources/mule/apps/vm/vm-inbound-18.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + #[output application/java --- {'_vmTransportMode': true, 'payload': payload.^raw, 'mimeType': payload.^mimeType, 'session': vars.compatibility_outboundProperties['MULE_SESSION']}] + + + + + + + +