1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package edu.samplu.common;
17
18 import org.junit.Assert;
19 import org.junit.Test;
20 import org.kuali.rice.testtools.common.PropertiesUtils;
21
22 import java.io.File;
23 import java.util.Properties;
24
25
26
27
28
29 public class NeustarJSTemplate extends FreemarkerSTBase {
30
31 @Override
32 public void fail(String message) {
33 Assert.fail(message);
34 }
35
36
37
38
39
40
41 @Override
42 public String getTestUrl() {
43 return null;
44 }
45
46
47 private String PROPS_LOCATION = System.getProperty("neustarJS.props.location", null);
48 private String DEFAULT_PROPS_LOCATION = "NeustarJSTemplate/neustarJS.properties";
49
50
51 private static final String DIR_TMPL = "/NeustarJSTemplate/";
52 private static final String TMPL_CONTENT = "CreateNewTmpl.ftl";
53
54 private void buildFileList(Properties props) throws Exception {
55 Integer pageCount= Integer.parseInt(props.getProperty("pageCount"));
56
57 for(int count=1; count<= pageCount;count++ ){
58 try {
59 String subTitle= props.getProperty("page"+count);
60 props.setProperty("pageId",""+ props.get("page")+count);
61
62
63 props.setProperty("viewId",""+ props.get("view"));
64 File f1= new File("Temp" + File.separatorChar + "Env11 Kitchen Sink "+subTitle +" KRAD WebDriver.txt");
65 writeTemplateToFile(f1, cfg.getTemplate(TMPL_CONTENT), props);
66
67
68 props.setProperty("viewId",""+ props.get("view"));
69 File f2= new File("Temp" + File.separatorChar + "Env11 Kitchen Sink "+subTitle +" KNS WebDriver.txt");
70 writeTemplateToFile(f2, cfg.getTemplate(TMPL_CONTENT), props);
71
72 } catch( Exception e) {
73 throw new Exception("Unable to generate files for upload", e);
74 }
75 }
76 }
77
78
79
80
81
82
83 @Override
84 protected String getTemplateDir() {
85 return DIR_TMPL;
86 }
87
88 @Test
89 public void testNeustarTemplating() throws Exception {
90
91 Properties props = loadProperties(PROPS_LOCATION, DEFAULT_PROPS_LOCATION);
92 PropertiesUtils.systemPropertiesOverride(props, "NeustarJS");
93
94 buildFileList(props);
95
96 }
97 }