1
2
3
4
5
6
7 package org.mule.test.integration.transport.file;
8
9 import org.mule.tck.junit4.FunctionalTestCase;
10 import org.mule.util.FileUtils;
11
12 import java.io.File;
13
14 import org.junit.Test;
15
16 import static org.junit.Assert.fail;
17
18 public class FileExceptionStrategyFunctionalTestCase extends FunctionalTestCase
19 {
20
21 @Override
22 protected String getConfigResources()
23 {
24 return "org/mule/test/integration/providers/file/file-exception-strategy.xml";
25 }
26
27 @Test
28 public void testExceptionInTransformer() throws Exception
29 {
30 File f = FileUtils.newFile("./.mule/in/test.txt");
31 f.createNewFile();
32
33
34 File errorFile = FileUtils.newFile("./.mule/errors/test-0.out");
35 boolean testSucceded = false;
36 int timesTried = 0;
37 while (timesTried <= 3)
38 {
39 Thread.sleep(500 * ++timesTried);
40 if (errorFile.exists())
41 {
42 testSucceded = true;
43 break;
44 }
45 }
46
47 if (!testSucceded)
48 {
49 fail("Exception strategy hasn't moved the file to the error folder.");
50 }
51 }
52
53 }