DataServiceVisitorJsBuilder extends AbstractDataServiceVisitor { void createReturnOcelotPromiseFactory(String classname, String methodName, boolean ws, String args, String keys, Writer writer) throws IOException { String md5 = keyMaker.getMd5(classname + DOT + methodName); writer.append(TAB3).append("return promiseFactory.create").append(OPENPARENTHESIS).append("_ds").append(COMMA).append(SPACEOPTIONAL) .append(QUOTE).append(md5).append(UNDERSCORE).append(QUOTE) .append(" + JSON.stringify([").append(keys).append("]).md5()").append(COMMA).append(SPACEOPTIONAL) .append(QUOTE).append(methodName).append(QUOTE).append(COMMA).append(SPACEOPTIONAL).append(""+ws).append(COMMA) .append(SPACEOPTIONAL).append(OPENBRACKET).append(args).append(CLOSEBRACKET).append(CLOSEPARENTHESIS) .append(SEMICOLON).append(CR); } DataServiceVisitorJsBuilder(ProcessingEnvironment environment, FwkWriter fwk);   }
@Test public void testCreateReturnOcelotPromiseFactory() throws IOException { System.out.println("createReturnOcelotPromiseFactory"); String expresult = ProcessorConstants.TAB3+"return promiseFactory.create(_ds,"+ProcessorConstants.SPACEOPTIONAL+"\"c4746bbdace1d5712da7b6fabe58fb9c_\" + JSON.stringify([KEYS]).md5(),"+ProcessorConstants.SPACEOPTIONAL+"\"METHODNAME\","+ProcessorConstants.SPACEOPTIONAL+"true,"+ProcessorConstants.SPACEOPTIONAL+"[ARGS]);"+ProcessorConstants.CR; StringWriter writer = new StringWriter(); instance.createReturnOcelotPromiseFactory("CLSNAME", "METHODNAME", true, "ARGS", "KEYS", writer); String result = writer.toString(); System.out.println(result); assertThat(result).isEqualTo(expresult); }