-
Notifications
You must be signed in to change notification settings - Fork 674
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2173 from FedeAmdan/mule-9066
MULE-9066: Adding validation when set-property and set-variable have …
- Loading branch information
Showing
6 changed files
with
84 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
tests/integration/src/test/java/org/mule/properties/InvalidSetVariableTestCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com | ||
* The software in this package is published under the terms of the CPAL v1.0 | ||
* license, a copy of which has been included with this distribution in the | ||
* LICENSE.txt file. | ||
*/ | ||
package org.mule.properties; | ||
|
||
import org.mule.api.MuleContext; | ||
import org.mule.api.config.ConfigurationException; | ||
import org.mule.config.spring.SpringXmlConfigurationBuilder; | ||
import org.mule.context.DefaultMuleContextFactory; | ||
import org.mule.tck.junit4.AbstractMuleTestCase; | ||
import java.util.Arrays; | ||
import java.util.Collection; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.junit.runners.Parameterized; | ||
|
||
@RunWith(Parameterized.class) | ||
public class InvalidSetVariableTestCase extends AbstractMuleTestCase | ||
{ | ||
private String muleConfigPath; | ||
|
||
@Parameterized.Parameters | ||
public static Collection<Object[]> data() { | ||
return Arrays.asList(new Object[][] {{"org/mule/properties/invalid-set-property.xml"}, {"org/mule/properties/invalid-set-variable.xml"}}); | ||
} | ||
|
||
public InvalidSetVariableTestCase(String muleConfigPath) | ||
{ | ||
this.muleConfigPath = muleConfigPath; | ||
} | ||
|
||
@Test(expected = ConfigurationException.class) | ||
public void emptyVariableNameValidatedBySchema() throws Exception | ||
{ | ||
MuleContext context = new DefaultMuleContextFactory().createMuleContext(); | ||
SpringXmlConfigurationBuilder builder = new SpringXmlConfigurationBuilder(muleConfigPath); | ||
builder.configure(context); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
tests/integration/src/test/resources/org/mule/properties/invalid-set-property.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<mule xmlns="http://www.mulesoft.org/schema/mule/core" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:vm="http://www.mulesoft.org/schema/mule/vm" | ||
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/vm http://www.mulesoft.org/schema/mule/vm/current/mule-vm.xsd"> | ||
|
||
<flow name="main"> | ||
<vm:inbound-endpoint path="testInput" exchange-pattern="request-response"/> | ||
<set-property propertyName="" value="test" /> | ||
</flow> | ||
</mule> |
13 changes: 13 additions & 0 deletions
13
tests/integration/src/test/resources/org/mule/properties/invalid-set-variable.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<mule xmlns="http://www.mulesoft.org/schema/mule/core" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:vm="http://www.mulesoft.org/schema/mule/vm" | ||
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/vm http://www.mulesoft.org/schema/mule/vm/current/mule-vm.xsd"> | ||
|
||
<flow name="main"> | ||
<vm:inbound-endpoint path="testInput" exchange-pattern="request-response"/> | ||
<set-variable variableName="" value="test" /> | ||
</flow> | ||
</mule> |