FileEntryService { public String loadTemplate(User user, ScriptHandler handler, String url, String name, String options) { Map<String, Object> map = newHashMap(); map.put("url", url); map.put("userName", user.getUserName()); map.put("name", name); map.put("options", options); return handler.getScriptTemplate(map); }  @PostConstruct void init(); void invalidateCache(String userId); @Async void prepare(User user); void createGitHubConfig(User user); boolean existGitHubConfig(User user); @Cacheable(value = CACHE_FILE_ENTRIES, key = "#user.userId") List<FileEntry> getAll(User user); List<FileEntry> getAll(User user, String path, Long revision); FileEntry getOne(User user, String path, Long revision); FileEntry getOne(User user, String path); boolean hasFileEntry(User user, String path); void addFolder(User user, String path, String folderName, String comment); void save(User user, FileEntry fileEntry); void delete(User user, List<String> fullPathFiles); void delete(User user, String path); FileEntry prepareNewEntry(User user, String path, String fileName, String name, String url,
	                                 ScriptHandler scriptHandler, boolean libAndResource, String options); FileEntry prepareNewEntryForQuickTest(User user, String url, ScriptHandler scriptHandler); String loadTemplate(User user, ScriptHandler handler, String url, String name,
		String options); void writeContentTo(User user, String fromPath, File toDir); ScriptHandler getScriptHandler(FileEntry scriptEntry); ScriptHandler getScriptHandler(String key);  }
@Test public void testFileTemplateWithoutOptions() { User user = new User(); user.setUserName("JunHo Yoon"); String content = fileEntryService.loadTemplate(user, new JythonScriptHandler(), "http: "hello", null); assertThat(content, containsString("JunHo Yoon")); assertThat(content, containsString("http: }
@Test public void testFileTemplateWithOptions() { String options = "{\"method\":\"POST_TEST\"," + "\"headers\":[{\"name\":\"header\",\"value\":\"123\"}," + "{\"name\":\"auth\",\"value\":\"no\"}]," + "\"params\":[{\"name\":\"pName\",\"value\":\"pValue\"}]," + "\"cookies\":[{\"name\":\"cook\",\"value\":\"good\",\"domain\":\"naver.com\",\"path\":\"/home\"}]}"; User user = new User(); user.setUserName("Gisoo Gwon"); String content = fileEntryService.loadTemplate(user, new JythonScriptHandler(), "http: "hello", options); System.out.println(content); assertThat(content, containsString("Gisoo Gwon")); assertThat(content, containsString("http: assertThat(content, containsString("request1.POST_TEST")); assertThat(content, containsString("headers.append(NVPair(\"header\", \"123\"))")); assertThat(content, containsString("params.append(NVPair(\"pName\", \"pValue\"))")); assertThat(content, containsString("Cookie(\"cook\", \"good\", \"naver.com\", \"/home\"")); }