Skip to content

Commit

Permalink
Migrate transform test to EE (#602)
Browse files Browse the repository at this point in the history
  • Loading branch information
jesica-fera committed Mar 14, 2022
1 parent dc8fc9d commit e84a8fa
Show file tree
Hide file tree
Showing 6 changed files with 224 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ target/
*.ipr
*.iws
*.idea
out/

# Mac
.DS_Store
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright (c) 2020, Mulesoft, LLC. All rights reserved.
* Use of this source code is governed by a BSD 3-Clause License
* license that can be found in the LICENSE.txt file.
*/
package com.mulesoft.tools.migration.e2e;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;


@RunWith(Parameterized.class)
public class TransformMigrationTestCase extends AbstractEndToEndTestCase {

@Parameters(name = "{0}")
public static Object[] params() {
return new Object[] {
"ee_transform/ee_transform_01"
};
}

private final String appToMigrate;

public TransformMigrationTestCase(String appToMigrate) {
this.appToMigrate = appToMigrate;
}

@Test
public void test() throws Exception {
simpleCase(appToMigrate);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:dw="http://www.mulesoft.org/schema/mule/ee/dw"
xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/ee/dw http://www.mulesoft.org/schema/mule/ee/dw/current/dw.xsd">
<flow name="ee-transform-03Flow">
<dw:transform-message doc:name="Transform Message">
<dw:set-payload>
<![CDATA[%dw 1.0
%output application/json
---
{
order: {
type: "Book",
title: payload.title,
details: "By $(payload.author) ($(payload.year))"
}
}
]]>
</dw:set-payload>
<dw:set-variable variableName="testVar">
<![CDATA[%dw 1.0
%output application/java
---
{
orderStatus: "complete" when flowVars.purchaseOrderStatus == "C" otherwise "incomplete"
}
]]>
</dw:set-variable>
<dw:set-session-variable variableName="testSessionVar">
<![CDATA[%dw 1.0
%output application/java
---
{
value: "aValue"
}
]]>
</dw:set-session-variable>
</dw:transform-message>
<logger/>
</flow>
</mule>
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>org.mule.migrated</groupId>
<artifactId>ee_transform_01</artifactId>
<version>1.0.0-M4-SNAPSHOT</version>
<packaging>mule-application</packaging>
<description>Application migrated with MMA</description>
<dependencies>
<dependency>
<groupId>com.mulesoft.mule.modules</groupId>
<artifactId>mule-compatibility-module</artifactId>
<version>1.4.0</version>
<classifier>mule-plugin</classifier>
</dependency>
</dependencies>
<repositories>
<repository>
<id>mulesoft-releases</id>
<name>MuleSoft Releases Repository</name>
<url>https://repository.mulesoft.org/releases/</url>
</repository>
<repository>
<id>anypoint-exchange</id>
<name>Anypoint Exchange</name>
<url>https://maven.anypoint.mulesoft.com/api/v1/maven</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>mulesoft-releases</id>
<name>MuleSoft Releases Repository</name>
<url>https://repository.mulesoft.org/releases/</url>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
<groupId>org.mule.tools.maven</groupId>
<artifactId>mule-maven-plugin</artifactId>
<version>3.2.1</version>
<extensions>true</extensions>
<configuration />
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"projectType": "MULE_THREE_APPLICATION",
"projectName": "input",
"connectorsMigrated": [],
"numberOfMuleComponents": 4,
"numberOfMuleComponentsMigrated": 4,
"componentDetails": {
"mule": {
"success": 1,
"failure": 0
},
"logger": {
"success": 1,
"failure": 0
},
"flow": {
"success": 1,
"failure": 0
},
"ee:transform": {
"success": 1,
"failure": 0
}
},
"numberOfMELExpressions": 0,
"numberOfMELExpressionsMigrated": 0,
"numberOfMELExpressionLines": 0,
"numberOfMELExpressionLinesMigrated": 0,
"numberOfDWTransformations": 3,
"numberOfDWTransformationsMigrated": 3,
"numberOfDWTransformationLines": 22,
"numberOfDWTransformationLinesMigrated": 22,
"detailedMessages": [
{
"level": "WARN",
"key": "transform.sessionVars",
"component": "compatibility:set-session-variable",
"lineNumber": 38,
"columnNumber": 106,
"message": "Instead of setting session variables in the flow, you must set Mule 4 variables.",
"filePath": "src/main/mule/mule-config.xml",
"documentationLinks": []
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:compatibility="http://www.mulesoft.org/schema/mule/compatibility" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd http://www.mulesoft.org/schema/mule/compatibility http://www.mulesoft.org/schema/mule/compatibility/current/mule-compatibility.xsd http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd">

<flow name="ee-transform-03Flow">
<ee:transform doc:name="Transform Message">
<ee:message>
<ee:set-payload><![CDATA[%dw 2.0
output application/json
---
{
order: {
"type": "Book",
title: payload.title,
details: "By $(payload.author) ($(payload.year))"
}
}]]></ee:set-payload>
</ee:message>
<ee:variables>
<ee:set-variable variableName="testVar"><![CDATA[%dw 2.0
output application/java
---
{
orderStatus:
if (vars.purchaseOrderStatus == "C")
"complete"
else
"incomplete"
}]]></ee:set-variable>
<ee:set-variable variableName="testSessionVar"><![CDATA[%dw 2.0
output application/java
---
{
value: "aValue"
}]]></ee:set-variable>
</ee:variables>
</ee:transform>

<compatibility:set-session-variable variableName="testSessionVar" value="#[vars.testSessionVar]">
<!--Migration WARN: Instead of setting session variables in the flow, you must set Mule 4 variables.-->
<!-- For more information refer to:-->
<!-- * https://github.com/mulesoft/mule-migration-assistant/blob/master/docs/user-docs/migration-tool-post-mig.adoc#session_variables-->
</compatibility:set-session-variable>

<logger />

</flow>

</mule>

0 comments on commit e84a8fa

Please sign in to comment.