Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,23 @@ additionalTestConfigs:
mavenAdditionalArgs: "-Dtest=none -DfailIfNoTests=false -Dmssql -DminVersion=4.3.0 -DskipTita"
derby_jdk8:
mavenAdditionalArgs: "-Dtest=none -DfailIfNoTests=false -Dderby -DminVersion=4.3.0 -DskipTita"
# In all jdk11 configurations, the runtime is set to 4.8.x until W-17842670 is fixed
# Because of this, the discovery configuration is bypassed and we need to specify runtimeProduct as MULE_EE
oracle_jdk11:
testJdkTool: OPEN-JDK11
mavenAdditionalArgs: "-Dtest=none -DfailIfNoTests=false -DminVersion=4.3.0 -Doracle -DskipTita"
mavenAdditionalArgs: "-Dtest=none -DfailIfNoTests=false -Doracle -DskipTita -DruntimeVersion=4.8.5 -DruntimeProduct=MULE_EE"
postgresql_jdk11:
testJdkTool: OPEN-JDK11
mavenAdditionalArgs: "-Dtest=none -DfailIfNoTests=false -DminVersion=4.3.0 -Dpostgresql -DskipTita"
mavenAdditionalArgs: "-Dtest=none -DfailIfNoTests=false -Dpostgresql -DskipTita -DruntimeVersion=4.8.5"
mysql_jdk11:
testJdkTool: OPEN-JDK11
mavenAdditionalArgs: "-Dtest=none -DfailIfNoTests=false -DminVersion=4.3.0 -Dmysql -DskipTita"
mavenAdditionalArgs: "-Dtest=none -DfailIfNoTests=false -Dmysql -DskipTita -DruntimeVersion=4.8.5"
mssql_jdk11:
testJdkTool: OPEN-JDK11
mavenAdditionalArgs: "-Dtest=none -DfailIfNoTests=false -DminVersion=4.3.0 -Dmssql -DskipTita"
mavenAdditionalArgs: "-Dtest=none -DfailIfNoTests=false -Dmssql -DskipTita -DruntimeVersion=4.8.5"
derby_jdk11:
testJdkTool: OPEN-JDK11
mavenAdditionalArgs: "-Dtest=none -DfailIfNoTests=false -DminVersion=4.3.0 -Dderby -DskipTita"
mavenAdditionalArgs: "-Dtest=none -DfailIfNoTests=false -Dderby -DskipTita -DruntimeVersion=4.8.5"
oracle_jdk17:
testJdkTool: OPEN-JDK17
mavenAdditionalArgs: "-Dtest=none -DfailIfNoTests=false -DminVersion=4.6.0 -Doracle -DskipTita"
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@
<awaitility.version>3.1.6</awaitility.version>
<!-- JDK 17 Compatibility Props -->
<mule.sdk.api.version>0.8.0</mule.sdk.api.version>
<munit.version>3.3.2</munit.version>
<munit.version>3.4.0</munit.version>
<mtf.tools.version>1.2.0</mtf.tools.version>
<munit.extensions.maven.plugin.version>1.4.0</munit.extensions.maven.plugin.version>
<munit.extensions.maven.plugin.version>1.5.0</munit.extensions.maven.plugin.version>
<jacoco.version>0.8.10</jacoco.version>
<mtf.javaopts></mtf.javaopts>
<maven-dependency-plugin.version>3.8.1</maven-dependency-plugin.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,15 @@ public JdbcType getJdbcType() {

@ExcludeFromGeneratedCoverage
public void setJdbcType(JdbcType type) {
setType(type);
}

public JdbcType getType() {
return type;
}

@ExcludeFromGeneratedCoverage
public void setType(JdbcType type) {
this.type = type;
}
}
62 changes: 62 additions & 0 deletions src/test/munit/mssql/db-stored-procedure-output-param-test.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:db="http://www.mulesoft.org/schema/mule/db"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:munit="http://www.mulesoft.org/schema/mule/munit"
xmlns:munit-tools="http://www.mulesoft.org/schema/mule/munit-tools"
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/munit http://www.mulesoft.org/schema/mule/munit/current/mule-munit.xsd
http://www.mulesoft.org/schema/mule/munit-tools http://www.mulesoft.org/schema/mule/munit-tools/current/mule-munit-tools.xsd
http://www.mulesoft.org/schema/mule/db http://www.mulesoft.org/schema/mule/db/current/mule-db.xsd">

<munit:config name="db-stored-procedure-output-param-test" minMuleVersion="4.3.0"/>
<munit:before-test name="createStoreProcedureExpressions">
<db:execute-ddl config-ref="mssql-config">
<db:sql><![CDATA[IF EXISTS (SELECT * FROM sys.objects WHERE type = 'P' AND name = 'simple_proc')
DROP PROCEDURE simple_proc]]></db:sql>
</db:execute-ddl>
<db:execute-ddl config-ref="mssql-config">
<db:sql><![CDATA[CREATE PROCEDURE simple_proc
@p_input VARCHAR(255),
@p_output VARCHAR(255) OUTPUT
AS
BEGIN
SET @p_output = @p_input
END]]></db:sql>
</db:execute-ddl>
</munit:before-test>

<munit:test name="use-expressions-to-set-output-parameter" description="Test to check if the output parameter is set correctly">
<munit:execution>
<db:stored-procedure config-ref="mssql-config" outputParameters='#[
%dw 2.0
output application/java
---
[{
key: "p_output",
typeClassifier: {
"type": "VARCHAR"
} as Object {class : "org.mule.extension.db.api.param.ParameterType"}
}]
]'>
<db:sql><![CDATA[{call simple_proc(:p_input, :p_output)}]]></db:sql>
<db:input-parameters><![CDATA[#[output application/java
---
{
'p_input': 'test'
}]]]></db:input-parameters>
</db:stored-procedure>
</munit:execution>
<munit:validation>
<munit-tools:assert-equals actual="#[payload.p_output]" expected="test"/>
</munit:validation>
</munit:test>

<munit:after-suite name="deleteStoreProcedureExpressions">
<db:execute-ddl config-ref="mssql-config">
<db:sql><![CDATA[IF EXISTS (SELECT * FROM sys.objects WHERE type = 'P' AND name = 'simple_proc')
DROP PROCEDURE simple_proc]]></db:sql>
</db:execute-ddl>
</munit:after-suite>

</mule>
57 changes: 57 additions & 0 deletions src/test/munit/mysql/db-stored-procedure-output-param-test.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:db="http://www.mulesoft.org/schema/mule/db"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:munit="http://www.mulesoft.org/schema/mule/munit"
xmlns:munit-tools="http://www.mulesoft.org/schema/mule/munit-tools"
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/munit http://www.mulesoft.org/schema/mule/munit/current/mule-munit.xsd
http://www.mulesoft.org/schema/mule/munit-tools http://www.mulesoft.org/schema/mule/munit-tools/current/mule-munit-tools.xsd
http://www.mulesoft.org/schema/mule/db http://www.mulesoft.org/schema/mule/db/current/mule-db.xsd">

<munit:config name="db-stored-procedure-output-param-test" minMuleVersion="4.3.0"/>
<munit:before-test name="createStoreProcedureExpressions">
<db:execute-ddl config-ref="dbConfigMySQL">
<db:sql><![CDATA[DROP PROCEDURE IF EXISTS simple_proc]]></db:sql>
</db:execute-ddl>
<db:execute-ddl config-ref="dbConfigMySQL">
<db:sql><![CDATA[CREATE PROCEDURE simple_proc(IN p_input VARCHAR(255), OUT p_output VARCHAR(255))
BEGIN
SET p_output = p_input;
END]]></db:sql>
</db:execute-ddl>
</munit:before-test>

<munit:test name="use-expressions-to-set-output-parameter" description="Test to check if the output parameter is set correctly">
<munit:execution>
<db:stored-procedure config-ref="dbConfigMySQL" outputParameters='#[
%dw 2.0
output application/java
---
[{
key: "p_output",
typeClassifier: {
"type": "VARCHAR"
} as Object {class : "org.mule.extension.db.api.param.ParameterType"}
}]
]'>
<db:sql><![CDATA[{call simple_proc(:p_input, :p_output)}]]></db:sql>
<db:input-parameters><![CDATA[#[output application/java
---
{
'p_input': 'test'
}]]]></db:input-parameters>
</db:stored-procedure>
</munit:execution>
<munit:validation>
<munit-tools:assert-equals actual="#[payload.p_output]" expected="test"/>
</munit:validation>
</munit:test>

<munit:after-suite name="deleteStoreProcedureExpressions">
<db:execute-ddl config-ref="dbConfigMySQL">
<db:sql><![CDATA[DROP PROCEDURE IF EXISTS simple_proc]]></db:sql>
</db:execute-ddl>
</munit:after-suite>

</mule>
96 changes: 96 additions & 0 deletions src/test/munit/oracle/db-stored-procedure-output-param-test.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:db="http://www.mulesoft.org/schema/mule/db"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:munit="http://www.mulesoft.org/schema/mule/munit"
xmlns:munit-tools="http://www.mulesoft.org/schema/mule/munit-tools"
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/munit http://www.mulesoft.org/schema/mule/munit/current/mule-munit.xsd
http://www.mulesoft.org/schema/mule/munit-tools http://www.mulesoft.org/schema/mule/munit-tools/current/mule-munit-tools.xsd
http://www.mulesoft.org/schema/mule/db http://www.mulesoft.org/schema/mule/db/current/mule-db.xsd">

<munit:config name="db-stored-procedure-output-param-test" minMuleVersion="4.3.0"/>
<munit:before-test name="createStoreProcedureExpressions">
<db:execute-ddl config-ref="oracleDbConfig">
<db:sql><![CDATA[BEGIN
EXECUTE IMMEDIATE 'DROP PROCEDURE simple_proc';
EXCEPTION
WHEN OTHERS THEN
NULL;
END;]]></db:sql>
</db:execute-ddl>
<db:execute-ddl config-ref="oracleDbConfig">
<db:sql><![CDATA[CREATE OR REPLACE PROCEDURE simple_proc (
p_input IN VARCHAR,
p_output OUT VARCHAR
) AS
BEGIN
p_output := p_input;
END;]]></db:sql>
</db:execute-ddl>
</munit:before-test>

<munit:test name="use-expressions-to-set-output-parameter" description="Test to check if the output parameter is set correctly">
<munit:execution>
<db:stored-procedure config-ref="oracleDbConfig" outputParameters='#[
%dw 2.0
output application/java
---
[{
key: "p_output",
typeClassifier: {
"type": "VARCHAR"
} as Object {class : "org.mule.extension.db.api.param.ParameterType"}
}]
]'>
<db:sql><![CDATA[{call simple_proc(:p_input, :p_output)}]]></db:sql>
<db:input-parameters><![CDATA[#[output application/java
---
{
'p_input': 'test'
}]]]></db:input-parameters>
</db:stored-procedure>
</munit:execution>
<munit:validation>
<munit-tools:assert-equals actual="#[payload.p_output]" expected="test"/>
</munit:validation>
</munit:test>

<munit:test name="use-expressions-to-set-output-parameter-without-class" description="Test to check if the output parameter is set correctly">
<munit:execution>
<db:stored-procedure config-ref="oracleDbConfig" outputParameters='#[
%dw 2.0
output application/java
---
[{
key: "p_output",
typeClassifier: {
"type": "VARCHAR"
}
}]
]'>
<db:sql><![CDATA[{call simple_proc(:p_input, :p_output)}]]></db:sql>
<db:input-parameters><![CDATA[#[output application/java
---
{
'p_input': 'test'
}]]]></db:input-parameters>
</db:stored-procedure>
</munit:execution>
<munit:validation>
<munit-tools:assert-equals actual="#[payload.p_output]" expected="test"/>
</munit:validation>
</munit:test>

<munit:after-suite name="deleteStoreProcedureExpressions">
<db:execute-ddl config-ref="oracleDbConfig">
<db:sql><![CDATA[BEGIN
EXECUTE IMMEDIATE 'DROP PROCEDURE simple_proc';
EXCEPTION
WHEN OTHERS THEN
NULL;
END;]]></db:sql>
</db:execute-ddl>
</munit:after-suite>

</mule>
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:db="http://www.mulesoft.org/schema/mule/db"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:munit="http://www.mulesoft.org/schema/mule/munit"
xmlns:munit-tools="http://www.mulesoft.org/schema/mule/munit-tools"
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/munit http://www.mulesoft.org/schema/mule/munit/current/mule-munit.xsd
http://www.mulesoft.org/schema/mule/munit-tools http://www.mulesoft.org/schema/mule/munit-tools/current/mule-munit-tools.xsd
http://www.mulesoft.org/schema/mule/db http://www.mulesoft.org/schema/mule/db/current/mule-db.xsd">

<munit:config name="db-stored-procedure-output-param-test" minMuleVersion="4.3.0"/>
<munit:before-test name="createStoreProcedureExpressions">
<db:execute-ddl config-ref="postgres-config">
<db:sql><![CDATA[DROP FUNCTION IF EXISTS simple_proc(VARCHAR, OUT VARCHAR)]]></db:sql>
</db:execute-ddl>
<db:execute-ddl config-ref="postgres-config">
<db:sql><![CDATA[CREATE OR REPLACE FUNCTION simple_proc(p_input VARCHAR, OUT p_output VARCHAR)
AS $$
BEGIN
p_output := p_input;
END;
$$ LANGUAGE plpgsql]]></db:sql>
</db:execute-ddl>
</munit:before-test>

<munit:test name="use-expressions-to-set-output-parameter" description="Test to check if the output parameter is set correctly">
<munit:execution>
<db:stored-procedure config-ref="postgres-config" outputParameters='#[
%dw 2.0
output application/java
---
[{
key: "p_output",
typeClassifier: {
"type": "VARCHAR"
} as Object {class : "org.mule.extension.db.api.param.ParameterType"}
}]
]'>
<db:sql><![CDATA[{call simple_proc(:p_input, :p_output)}]]></db:sql>
<db:input-parameters><![CDATA[#[output application/java
---
{
'p_input': 'test'
}]]]></db:input-parameters>
</db:stored-procedure>
</munit:execution>
<munit:validation>
<munit-tools:assert-equals actual="#[payload.p_output]" expected="test"/>
</munit:validation>
</munit:test>

<munit:after-suite name="deleteStoreProcedureExpressions">
<db:execute-ddl config-ref="postgres-config">
<db:sql><![CDATA[DROP FUNCTION IF EXISTS simple_proc(VARCHAR, OUT VARCHAR)]]></db:sql>
</db:execute-ddl>
</munit:after-suite>

</mule>