1
2
3
4
5
6
7 package org.mule.module.pgp;
8
9 import org.mule.tck.junit4.FunctionalTestCase;
10 import org.mule.tck.probe.PollingProber;
11 import org.mule.tck.probe.Prober;
12 import org.mule.tck.probe.file.FileDoesNotExists;
13 import org.mule.tck.probe.file.FileExists;
14 import org.mule.util.FileUtils;
15
16 import java.io.File;
17 import java.io.IOException;
18
19 import org.junit.Test;
20
21 public class FileEncryptionTestCase extends FunctionalTestCase
22 {
23
24 public static final String TEST_FOLDER = ".mule/testData";
25
26
27 private Prober prober = new PollingProber(30000, 100);
28
29 public FileEncryptionTestCase()
30 {
31 setStartContext(false);
32 }
33
34 @Override
35 protected String getConfigResources()
36 {
37 return "file-encryption-config.xml";
38 }
39
40 private File createTestFile(String folder) throws IOException
41 {
42 File testFolder = new File(folder);
43 testFolder.mkdirs();
44 prober.check(new FileExists(testFolder));
45
46 File target = File.createTempFile("mule-file-test-", ".txt", testFolder);
47 target.deleteOnExit();
48 FileUtils.writeStringToFile(target, "TEST");
49 prober.check(new FileExists(target));
50
51 return target;
52 }
53
54 @Test
55 public void testName() throws Exception
56 {
57 final File target = createTestFile(TEST_FOLDER);
58
59
60 muleContext.start();
61
62 prober.check(new FileDoesNotExists(target));
63 }
64 }