public void test_processSimpleFunction_thirdArg() throws Exception { // ## Arrange ## DerivedReferrerOption option = new DerivedReferrerOption(); option.acceptParameterKey("key", "path"); // ## Act ## String actual = option.processSimpleFunction("max(foo.COL)", "func", "third", false, "param0"); // ## Assert ## log(actual); assertTrue(Srl.startsWith(actual, "func(max(foo.COL), ")); assertTrue(Srl.endsWith(actual, "/*pmb.path.key.bindMap.param0*/null, third)")); }
public void test_processSimpleFunction_nested_nested() throws Exception { // ## Arrange ## DerivedReferrerOption option = new DerivedReferrerOption(); option.acceptParameterKey("key", "path"); String sqbegin = SubQueryIndentProcessor.BEGIN_MARK_PREFIX; String sqend = SubQueryIndentProcessor.END_MARK_PREFIX; String identity = "identity"; StringBuilder sb = new StringBuilder(); sb.append("max(").append(sqbegin).append(identity); sb.append(ln()).append("select max(").append(sqbegin).append(identity); sb.append(ln()).append("select max(foo.COL)"); sb.append(ln()).append(" from FOO foo"); sb.append(ln()).append(")").append(sqend).append(identity); sb.append(ln()).append(" from FOO foo"); sb.append(ln()).append(")").append(sqend).append(identity); // ## Act ## String actual = option.processSimpleFunction(sb.toString(), "func", null, false, "param0"); // ## Assert ## log(ln() + actual); assertTrue(Srl.startsWith(actual, "func(max(" + sqbegin + identity)); assertTrue(Srl.contains(actual, "select max(foo.COL)")); assertTrue(Srl.contains(actual, " from FOO foo")); assertEquals(2, Srl.count(actual, "max(" + sqbegin + identity)); assertEquals(1, Srl.count(actual, "func(max(" + sqbegin + identity)); assertEquals(2, Srl.count(actual, ")" + sqend + identity)); assertEquals(1, Srl.count(actual, "/*pmb.path.key.bindMap.param0*/null)" + sqend + identity)); assertTrue(Srl.endsWith(actual, ", /*pmb.path.key.bindMap.param0*/null)" + sqend + identity)); }
// =================================================================================== // Accessor // ======== public void setGenTarget(String genTarget) { if (Srl.is_Null_or_TrimmedEmpty(genTarget)) { return; } if (genTarget.equals("${gentgt}")) { return; } _genTarget = genTarget; }
// =================================================================================== // Prepare Generation // ================== @Override public Context initControlContext() throws Exception { _log.info(""); _log.info("...Preparing generation of free generate"); final StringBuilder sb = new StringBuilder(); for (DfFreeGenRequest request : _freeGenRequestList) { sb.append(ln()).append("[").append(request.getRequestName()).append("]"); sb.append(ln()).append(" resource : ").append(request.getResource()); sb.append(ln()).append(" output : ").append(request.getOutput()); final String tableMapExp = Srl.cut(request.getTableMap().toString(), 3000, "..."); sb.append(ln()).append(" tableMap : ").append(tableMapExp); // possible too big } _log.info(sb.toString()); return createVelocityContext(); }
public List<String> getPropertyOptionClassificationFixedElementList() { // returns [Bar. Baz] if "Foo.Bar, Baz" final String fixedElement = getPropertyOptionClassificationFixedElement(); return Srl.splitListTrimmed(fixedElement, ","); }
public String getPropertyOptionClassificationFixedElement() { // returns Bar if "Foo.Bar" final String classificationName = extractClassificationNameFromOption(true); return Srl.substringFirstRear(classificationName, "."); }
public String getPropertyOptionClassificationName() { final String classificationName = extractClassificationNameFromOption(true); return Srl.substringFirstFront(classificationName, "."); }