forked from genjosanzo/mule
-
Notifications
You must be signed in to change notification settings - Fork 0
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 mulesoft#1510 from mulesoft/MULE-8420
MULE-8420: FileMessageDispatcher return subfolders when no files found
- Loading branch information
Showing
3 changed files
with
74 additions
and
1 deletion.
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
43 changes: 43 additions & 0 deletions
43
transports/file/src/test/java/org/mule/transport/file/RecursiveWorkDirectoryTestCase.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,43 @@ | ||
/* | ||
* 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.transport.file; | ||
|
||
import static org.hamcrest.Matchers.is; | ||
import static org.hamcrest.Matchers.nullValue; | ||
import static org.junit.Assert.assertThat; | ||
import org.mule.api.MuleMessage; | ||
import org.mule.api.client.MuleClient; | ||
import org.mule.tck.junit4.FunctionalTestCase; | ||
import org.mule.tck.junit4.rule.SystemPropertyTemporaryFolder; | ||
|
||
import org.junit.Rule; | ||
import org.junit.Test; | ||
|
||
public class RecursiveWorkDirectoryTestCase extends FunctionalTestCase | ||
{ | ||
|
||
@Rule | ||
public SystemPropertyTemporaryFolder temporaryFolder = new SystemPropertyTemporaryFolder("temp"); | ||
|
||
|
||
@Override | ||
protected String getConfigFile() | ||
{ | ||
return "recursive-work-directory-config.xml"; | ||
} | ||
|
||
@Test | ||
public void ignoresWorkDirectoryOnRequest() throws Exception | ||
{ | ||
MuleClient client = muleContext.getClient(); | ||
|
||
MuleMessage response = client.request("file://" + temporaryFolder.getRoot(), RECEIVE_TIMEOUT); | ||
|
||
assertThat(response, is(nullValue())); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
transports/file/src/test/resources/recursive-work-directory-config.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,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<mule | ||
xmlns:file="http://www.mulesoft.org/schema/mule/file" | ||
xmlns="http://www.mulesoft.org/schema/mule/core" | ||
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/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd"> | ||
|
||
<file:connector name="fileConnector" autoDelete="true" streaming="true" validateConnections="true" workDirectory="${temp}/work" recursive="true"/> | ||
|
||
<flow name="main" > | ||
<file:inbound-endpoint path="${temp}" pollingFrequency="1000"/> | ||
|
||
<echo-component/> | ||
</flow> | ||
</mule> |