1 package org.apache.torque.generator.configuration.outlet;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import static org.junit.Assert.assertEquals;
23 import static org.junit.Assert.assertTrue;
24
25 import java.io.File;
26 import java.util.ArrayList;
27 import java.util.List;
28
29 import org.apache.commons.io.FileUtils;
30 import org.apache.torque.generator.configuration.UnitDescriptor;
31 import org.apache.torque.generator.configuration.paths.CustomProjectPaths;
32 import org.apache.torque.generator.configuration.paths.DefaultTorqueGeneratorPaths;
33 import org.apache.torque.generator.configuration.paths.Maven2DirectoryProjectPaths;
34 import org.apache.torque.generator.control.Controller;
35 import org.junit.Before;
36 import org.junit.Test;
37
38
39
40
41
42
43 public class OtherTemplateLanguageTest
44 {
45 private static final File TARGET_DIR
46 = new File("target/test/otherTemplateLanguages");
47
48 private static final File OUTPUT_FILE
49 = new File(TARGET_DIR, "output.txt");
50
51 @Before
52 public void setUp() throws Exception
53 {
54 FileUtils.deleteDirectory(TARGET_DIR);
55 }
56
57
58
59
60
61
62 @Test
63 public void testOtherTemplateLanguages() throws Exception
64 {
65 Controller controller = new Controller();
66 List<UnitDescriptor> unitDescriptors = new ArrayList<UnitDescriptor>();
67 CustomProjectPaths projectPaths = new CustomProjectPaths(
68 new Maven2DirectoryProjectPaths(
69 new File("src/test/otherTemplateLanguages")));
70 projectPaths.setOutputDirectory(null, TARGET_DIR);
71 unitDescriptors.add(new UnitDescriptor(
72 UnitDescriptor.Packaging.DIRECTORY,
73 projectPaths,
74 new DefaultTorqueGeneratorPaths()));
75 controller.run(unitDescriptors);
76
77 assertTrue(OUTPUT_FILE.exists());
78 assertEquals(
79 "groovy test output",
80 FileUtils.readFileToString(OUTPUT_FILE));
81 }
82 }