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