diff --git a/pom.xml b/pom.xml
index 8a167bc..240b339 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,7 +28,7 @@
org.mybatis.scripting
mybatis-velocity
- 1.5-SNAPSHOT
+ 2.0-SNAPSHOT
jar
MyBatis Velocity
@@ -62,6 +62,17 @@
org.mybatis.scripting.velocity.*
Velocity
+
+
+ 1.7
+ 1.7
+ 1.7
+ 1.7
+
+
+ org.codehaus.mojo.signature
+ java17
+ 1.0
@@ -72,18 +83,13 @@
org.apache.velocity
- velocity
- 1.7
+ velocity-engine-core
+ 2.0
- commons-collections
- commons-collections
- 3.2.2
-
-
- commons-lang
- commons-lang
- 2.6
+ org.apache.commons
+ commons-lang3
+ 3.7
@@ -99,32 +105,20 @@
test
- log4j
- log4j
- 1.2.17
+ org.slf4j
+ slf4j-simple
+ 1.7.25
test
-
- org.apache.maven.plugins
- maven-surefire-plugin
-
-
-
- log4j.configuration
- file:src/test/resources/log4j.xml
-
-
-
-
org.apache.maven.plugins
maven-release-plugin
- -Prelease,bundle
+ release,bundle
diff --git a/src/main/java/org/mybatis/scripting/velocity/FastLinkedList.java b/src/main/java/org/mybatis/scripting/velocity/FastLinkedList.java
index b4ae005..01f6ede 100644
--- a/src/main/java/org/mybatis/scripting/velocity/FastLinkedList.java
+++ b/src/main/java/org/mybatis/scripting/velocity/FastLinkedList.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2012-2016 the original author or authors.
+ * Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,9 +24,9 @@ public final class FastLinkedList implements Serializabl
private static final long serialVersionUID = 1L;
- private Node first = null;
+ private Node first;
- private Node last = null;
+ private Node last;
public FastLinkedList() {
this.last = this.first;
diff --git a/src/main/java/org/mybatis/scripting/velocity/InDirective.java b/src/main/java/org/mybatis/scripting/velocity/InDirective.java
index c310086..ba2c91b 100644
--- a/src/main/java/org/mybatis/scripting/velocity/InDirective.java
+++ b/src/main/java/org/mybatis/scripting/velocity/InDirective.java
@@ -21,17 +21,14 @@
import java.util.Iterator;
import org.apache.velocity.context.InternalContextAdapter;
-import org.apache.velocity.exception.MethodInvocationException;
-import org.apache.velocity.exception.ParseErrorException;
-import org.apache.velocity.exception.ResourceNotFoundException;
import org.apache.velocity.exception.TemplateInitException;
import org.apache.velocity.exception.VelocityException;
import org.apache.velocity.runtime.RuntimeServices;
import org.apache.velocity.runtime.directive.StopCommand;
-import org.apache.velocity.runtime.parser.ParserTreeConstants;
import org.apache.velocity.runtime.parser.node.ASTReference;
import org.apache.velocity.runtime.parser.node.ASTStringLiteral;
import org.apache.velocity.runtime.parser.node.Node;
+import org.apache.velocity.runtime.parser.node.ParserTreeConstants;
import org.apache.velocity.util.introspection.Info;
/**
@@ -59,7 +56,7 @@ public String getName() {
}
@Override
- public void init(RuntimeServices rs, InternalContextAdapter context, Node node) throws TemplateInitException {
+ public void init(RuntimeServices rs, InternalContextAdapter context, Node node) {
super.init(rs, context, node);
final int n = node.jjtGetNumChildren() - 1;
for (int i = 1; i < n; i++) {
@@ -74,12 +71,8 @@ public void init(RuntimeServices rs, InternalContextAdapter context, Node node)
}
else if (child.getType() == ParserTreeConstants.JJTSTRINGLITERAL) {
String value = (String) ((ASTStringLiteral) child).value(context);
- switch (i) {
- case 2:
- this.column = value;
- break;
- default:
- break;
+ if (i == 2) {
+ this.column = value;
}
}
else {
@@ -90,8 +83,7 @@ else if (child.getType() == ParserTreeConstants.JJTSTRINGLITERAL) {
}
@Override
- public boolean render(InternalContextAdapter context, Writer writer, Node node) throws IOException, ResourceNotFoundException,
- ParseErrorException, MethodInvocationException {
+ public boolean render(InternalContextAdapter context, Writer writer, Node node) throws IOException {
Object listObject = node.jjtGetChild(0).value(context);
if (listObject == null) {
return false;
diff --git a/src/main/java/org/mybatis/scripting/velocity/ParameterMappingCollector.java b/src/main/java/org/mybatis/scripting/velocity/ParameterMappingCollector.java
index 2475ebb..c85e0ef 100644
--- a/src/main/java/org/mybatis/scripting/velocity/ParameterMappingCollector.java
+++ b/src/main/java/org/mybatis/scripting/velocity/ParameterMappingCollector.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2012-2016 the original author or authors.
+ * Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,7 +24,7 @@
public class ParameterMappingCollector {
private final ParameterMapping[] parameterMappingSources;
- private final List parameterMappings = new ArrayList();
+ private final List parameterMappings = new ArrayList<>();
private final Map context;
private final Configuration configuration;
diff --git a/src/main/java/org/mybatis/scripting/velocity/ParameterMappingSourceParser.java b/src/main/java/org/mybatis/scripting/velocity/ParameterMappingSourceParser.java
index 8701336..5b95130 100644
--- a/src/main/java/org/mybatis/scripting/velocity/ParameterMappingSourceParser.java
+++ b/src/main/java/org/mybatis/scripting/velocity/ParameterMappingSourceParser.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2012-2016 the original author or authors.
+ * Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -56,7 +56,7 @@ public String getSql() {
private static class ParameterMappingTokenHandler extends BaseBuilder implements TokenHandler {
- private final List parameterMappings = new ArrayList();
+ private final List parameterMappings = new ArrayList<>();
private final Class> parameterType;
public ParameterMappingTokenHandler(Configuration newConfiguration, Class> newParameterType) {
diff --git a/src/main/java/org/mybatis/scripting/velocity/RepeatDirective.java b/src/main/java/org/mybatis/scripting/velocity/RepeatDirective.java
index 3b9507d..9b952ee 100644
--- a/src/main/java/org/mybatis/scripting/velocity/RepeatDirective.java
+++ b/src/main/java/org/mybatis/scripting/velocity/RepeatDirective.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2012-2016 the original author or authors.
+ * Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,19 +21,16 @@
import java.util.Iterator;
import org.apache.velocity.context.ChainedInternalContextAdapter;
import org.apache.velocity.context.InternalContextAdapter;
-import org.apache.velocity.exception.MethodInvocationException;
-import org.apache.velocity.exception.ParseErrorException;
-import org.apache.velocity.exception.ResourceNotFoundException;
import org.apache.velocity.exception.TemplateInitException;
import org.apache.velocity.exception.VelocityException;
import org.apache.velocity.runtime.RuntimeServices;
import org.apache.velocity.runtime.directive.Directive;
import org.apache.velocity.runtime.directive.Scope;
import org.apache.velocity.runtime.directive.StopCommand;
-import org.apache.velocity.runtime.parser.ParserTreeConstants;
import org.apache.velocity.runtime.parser.node.ASTReference;
import org.apache.velocity.runtime.parser.node.ASTStringLiteral;
import org.apache.velocity.runtime.parser.node.Node;
+import org.apache.velocity.runtime.parser.node.ParserTreeConstants;
import org.apache.velocity.util.introspection.Info;
/**
@@ -56,7 +53,7 @@ public String getName() {
}
@Override
- public void init(RuntimeServices rs, InternalContextAdapter context, Node node) throws TemplateInitException {
+ public void init(RuntimeServices rs, InternalContextAdapter context, Node node) {
super.init(rs, context, node);
final int n = node.jjtGetNumChildren() - 1;
for (int i = 1; i < n; i++) {
@@ -91,7 +88,7 @@ public void init(RuntimeServices rs, InternalContextAdapter context, Node node)
@Override
public boolean render(InternalContextAdapter context, Writer writer, Node node)
- throws IOException, ResourceNotFoundException, ParseErrorException, MethodInvocationException {
+ throws IOException {
Object listObject = node.jjtGetChild(0).value(context);
@@ -254,7 +251,7 @@ protected NullHolderContext(String key, InternalContextAdapter context) {
}
@Override
- public Object get(String key) throws MethodInvocationException {
+ public Object get(String key) {
return (this.active && this.loopVariableKey.equals(key))
? null
: super.get(key);
@@ -270,12 +267,7 @@ public Object put(String key, Object value) {
}
@Override
- public Object localPut(final String key, final Object value) {
- return put(key, value);
- }
-
- @Override
- public Object remove(Object key) {
+ public Object remove(String key) {
if (this.loopVariableKey.equals(key)) {
this.active = false;
}
diff --git a/src/main/java/org/mybatis/scripting/velocity/SQLScriptSource.java b/src/main/java/org/mybatis/scripting/velocity/SQLScriptSource.java
index e5ccd88..4776f08 100644
--- a/src/main/java/org/mybatis/scripting/velocity/SQLScriptSource.java
+++ b/src/main/java/org/mybatis/scripting/velocity/SQLScriptSource.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2012-2016 the original author or authors.
+ * Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -45,7 +45,7 @@ public SQLScriptSource(Configuration newConfiguration, String script, Class> p
@Override
public BoundSql getBoundSql(Object parameterObject) {
- final Map context = new HashMap();
+ final Map context = new HashMap<>();
final ParameterMappingCollector pmc = new ParameterMappingCollector(this.parameterMappingSources, context, this.configuration);
context.put(DATABASE_ID_KEY, this.configuration.getDatabaseId());
diff --git a/src/main/java/org/mybatis/scripting/velocity/SetDirective.java b/src/main/java/org/mybatis/scripting/velocity/SetDirective.java
index 1c30bf8..8a304c4 100644
--- a/src/main/java/org/mybatis/scripting/velocity/SetDirective.java
+++ b/src/main/java/org/mybatis/scripting/velocity/SetDirective.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2012-2016 the original author or authors.
+ * Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,9 +18,6 @@
import java.io.IOException;
import java.io.StringWriter;
import org.apache.velocity.context.InternalContextAdapter;
-import org.apache.velocity.exception.MethodInvocationException;
-import org.apache.velocity.exception.ParseErrorException;
-import org.apache.velocity.exception.ResourceNotFoundException;
import org.apache.velocity.runtime.parser.node.ASTBlock;
import org.apache.velocity.runtime.parser.node.Node;
@@ -32,7 +29,7 @@ public String getName() {
}
@Override
- protected Params getParams(InternalContextAdapter context, Node node) throws IOException, ResourceNotFoundException, ParseErrorException, MethodInvocationException {
+ protected Params getParams(InternalContextAdapter context, Node node) throws IOException {
final Params params = new Params();
params.setPrefix("SET");
params.setSuffixOverrides(",");
diff --git a/src/main/java/org/mybatis/scripting/velocity/TrimDirective.java b/src/main/java/org/mybatis/scripting/velocity/TrimDirective.java
index 6ce71ab..103beb2 100644
--- a/src/main/java/org/mybatis/scripting/velocity/TrimDirective.java
+++ b/src/main/java/org/mybatis/scripting/velocity/TrimDirective.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2012-2016 the original author or authors.
+ * Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,9 +20,6 @@
import java.io.Writer;
import java.util.Locale;
import org.apache.velocity.context.InternalContextAdapter;
-import org.apache.velocity.exception.MethodInvocationException;
-import org.apache.velocity.exception.ParseErrorException;
-import org.apache.velocity.exception.ResourceNotFoundException;
import org.apache.velocity.runtime.directive.Directive;
import org.apache.velocity.runtime.parser.node.ASTBlock;
import org.apache.velocity.runtime.parser.node.Node;
@@ -40,7 +37,7 @@ public final int getType() {
}
@Override
- public final boolean render(InternalContextAdapter ica, Writer writer, Node node) throws IOException, ResourceNotFoundException, ParseErrorException, MethodInvocationException {
+ public final boolean render(InternalContextAdapter ica, Writer writer, Node node) throws IOException {
Params p = getParams(ica, node);
if (p == null) {
return false;
@@ -48,7 +45,7 @@ public final boolean render(InternalContextAdapter ica, Writer writer, Node node
return render(p, writer);
}
- public boolean render(final Params params, final Writer writer) throws IOException, ResourceNotFoundException, ParseErrorException, MethodInvocationException {
+ public boolean render(final Params params, final Writer writer) throws IOException {
int leftIndex = 0;
int rightIndex = params.maxBody;
if (rightIndex == 0) {
@@ -93,9 +90,9 @@ protected static final class Params {
String suffix = "";
- FastLinkedList prefixOverrides = new FastLinkedList();
+ FastLinkedList prefixOverrides = new FastLinkedList<>();
- FastLinkedList suffixOverrides = new FastLinkedList();
+ FastLinkedList suffixOverrides = new FastLinkedList<>();
String body = "";
@@ -153,7 +150,7 @@ public void setSuffix(String value) {
}
- protected Params getParams(final InternalContextAdapter context, final Node node) throws IOException, ResourceNotFoundException, ParseErrorException, MethodInvocationException {
+ protected Params getParams(final InternalContextAdapter context, final Node node) throws IOException {
final Params params = new Params();
final int nodes = node.jjtGetNumChildren();
for (int i = 0; i < nodes; i++) {
diff --git a/src/main/java/org/mybatis/scripting/velocity/VelocityFacade.java b/src/main/java/org/mybatis/scripting/velocity/VelocityFacade.java
index 37e7155..faf5efa 100644
--- a/src/main/java/org/mybatis/scripting/velocity/VelocityFacade.java
+++ b/src/main/java/org/mybatis/scripting/velocity/VelocityFacade.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2012-2016 the original author or authors.
+ * Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,12 +22,12 @@
import java.util.Map;
import java.util.Properties;
+import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.builder.BuilderException;
import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.runtime.RuntimeInstance;
import org.apache.velocity.runtime.parser.node.SimpleNode;
-import org.apache.velocity.util.StringUtils;
public class VelocityFacade {
@@ -53,13 +53,18 @@ public class VelocityFacade {
engine.init(settings);
}
+ private VelocityFacade() {
+ // Prevent instantiation
+ }
+
public static Object compile(String script, String name) {
try {
StringReader reader = new StringReader(script);
- SimpleNode node = engine.parse(reader, name);
Template template = new Template();
+ SimpleNode node = engine.parse(reader, template);
template.setRuntimeServices(engine);
template.setData(node);
+ template.setName(name);
template.initDocument();
return template;
} catch (Exception ex) {
@@ -89,7 +94,7 @@ private static Properties loadProperties() {
}
// Append the user defined directives if provided
- String userDirective = StringUtils.nullTrim(props.getProperty("userdirective"));
+ String userDirective = StringUtils.trim(props.getProperty("userdirective"));
if(userDirective == null) {
userDirective = DIRECTIVES;
} else {
@@ -100,7 +105,7 @@ private static Properties loadProperties() {
}
private static Map loadAdditionalCtxAttributes() {
- Map attributes = new HashMap();
+ Map attributes = new HashMap<>();
String additionalContextAttributes = settings.getProperty(ADDITIONAL_CTX_ATTRIBUTES_KEY);
if (additionalContextAttributes == null) {
return attributes;
diff --git a/src/main/java/org/mybatis/scripting/velocity/WhereDirective.java b/src/main/java/org/mybatis/scripting/velocity/WhereDirective.java
index 7dbf51c..666d6de 100644
--- a/src/main/java/org/mybatis/scripting/velocity/WhereDirective.java
+++ b/src/main/java/org/mybatis/scripting/velocity/WhereDirective.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2012-2016 the original author or authors.
+ * Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,9 +18,6 @@
import java.io.IOException;
import java.io.StringWriter;
import org.apache.velocity.context.InternalContextAdapter;
-import org.apache.velocity.exception.MethodInvocationException;
-import org.apache.velocity.exception.ParseErrorException;
-import org.apache.velocity.exception.ResourceNotFoundException;
import org.apache.velocity.runtime.parser.node.ASTBlock;
import org.apache.velocity.runtime.parser.node.Node;
@@ -32,7 +29,7 @@ public String getName() {
}
@Override
- protected Params getParams(InternalContextAdapter context, Node node) throws IOException, ResourceNotFoundException, ParseErrorException, MethodInvocationException {
+ protected Params getParams(InternalContextAdapter context, Node node) throws IOException {
final Params params = new Params();
params.setPrefix("WHERE");
params.setPrefixOverrides("AND |OR |AND\n|OR\n|AND\r|OR\r");
diff --git a/src/test/java/org/mybatis/scripting/velocity/InDirectiveTest.java b/src/test/java/org/mybatis/scripting/velocity/InDirectiveTest.java
index 26bce44..610dfc8 100644
--- a/src/test/java/org/mybatis/scripting/velocity/InDirectiveTest.java
+++ b/src/test/java/org/mybatis/scripting/velocity/InDirectiveTest.java
@@ -55,7 +55,7 @@ public void ensureInClauseHasEmpty() throws Exception {
ctxt.put("list", Collections.emptyList());
velocity.evaluate(ctxt, w, "TEST", "#in($list $id 'id')?#end");
String result = w.toString();
- assertEquals(result, "((id NOT IN ( NULL )))");
+ assertEquals("((id NOT IN ( NULL )))", result);
}
@Test
@@ -64,8 +64,8 @@ public void ensureInClauseHasOne() throws Exception {
ctxt.put("list", Collections.singletonList("?"));
velocity.evaluate(ctxt, w, "TEST", "#in($list $id 'id')?#end");
String result = w.toString();
- assertEquals(result.split("\\?").length -1, 1);
- assertEquals(result.split("IN").length -1, 1);
+ assertEquals(1, result.split("\\?").length -1);
+ assertEquals(1, result.split("IN").length -1);
}
@Test
@@ -74,7 +74,7 @@ public void ensureInClauseHasTwo() throws Exception {
ctxt.put("list", Arrays.asList("?", "?"));
velocity.evaluate(ctxt, w, "TEST", "#in($list $id 'id')?#end");
String result = w.toString();
- assertEquals(result.split("\\?").length -1, 2);
+ assertEquals(2, result.split("\\?").length -1);
}
@Test
@@ -85,8 +85,8 @@ public void ensureInClauseHasOneThousand() throws Exception {
ctxt.put("list", Arrays.asList(arr));
velocity.evaluate(ctxt, w, "TEST", "#in($list $id 'id')?#end");
String result = w.toString();
- assertEquals(result.split("\\?").length -1, 1000);
- assertEquals(result.split("OR").length -1, 0);
+ assertEquals(1000, result.split("\\?").length -1);
+ assertEquals(0, result.split("OR").length -1);
}
@Test
@@ -97,8 +97,8 @@ public void ensureInClauseHasOneThousandAndOne() throws Exception {
ctxt.put("list", Arrays.asList(arr));
velocity.evaluate(ctxt, w, "TEST", "#in($list $id 'id')?#end");
String result = w.toString();
- assertEquals(result.split("\\?").length -1, 1001);
- assertEquals(result.split("OR").length -1, 1);
+ assertEquals(1001, result.split("\\?").length -1);
+ assertEquals(1, result.split("OR").length -1);
}
@Test
@@ -109,8 +109,8 @@ public void ensureInClauseHasTwoThousand() throws Exception {
ctxt.put("list", Arrays.asList(arr));
velocity.evaluate(ctxt, w, "TEST", "#in($list $id 'id')?#end");
String result = w.toString();
- assertEquals(result.split("\\?").length -1, 2000);
- assertEquals(result.split("OR").length -1, 1);
+ assertEquals(2000, result.split("\\?").length -1);
+ assertEquals(1, result.split("OR").length -1);
}
@Test
@@ -121,8 +121,8 @@ public void ensureInClauseHasTwoThousandAndOne() throws Exception {
ctxt.put("list", Arrays.asList(arr));
velocity.evaluate(ctxt, w, "TEST", "#in($list $id 'id')?#end");
String result = w.toString();
- assertEquals(result.split("\\?").length -1, 2001);
- assertEquals(result.split("OR").length -1, 2);
+ assertEquals(2001, result.split("\\?").length -1);
+ assertEquals(2, result.split("OR").length -1);
}
@Test
@@ -133,8 +133,8 @@ public void ensureInClauseHasThreeThousandAndOne() throws Exception {
ctxt.put("list", Arrays.asList(arr));
velocity.evaluate(ctxt, w, "TEST", "#in($list $id 'id')?#end");
String result = w.toString();
- assertEquals(result.split("\\?").length -1, 3001);
- assertEquals(result.split("OR").length -1, 3);
+ assertEquals(3001, result.split("\\?").length -1);
+ assertEquals(3, result.split("OR").length -1);
}
}
diff --git a/src/test/java/org/mybatis/scripting/velocity/use/EnumBinder.java b/src/test/java/org/mybatis/scripting/velocity/use/EnumBinder.java
index 0d04f34..53674e9 100644
--- a/src/test/java/org/mybatis/scripting/velocity/use/EnumBinder.java
+++ b/src/test/java/org/mybatis/scripting/velocity/use/EnumBinder.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2012-2016 the original author or authors.
+ * Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,10 +15,6 @@
*/
package org.mybatis.scripting.velocity.use;
-/**
- *
- * @author mnesarco
- */
public class EnumBinder {
public EnumWrapper bind(String className) throws ClassNotFoundException {
diff --git a/src/test/java/org/mybatis/scripting/velocity/use/EnumWrapper.java b/src/test/java/org/mybatis/scripting/velocity/use/EnumWrapper.java
index 798d279..7bd61e8 100644
--- a/src/test/java/org/mybatis/scripting/velocity/use/EnumWrapper.java
+++ b/src/test/java/org/mybatis/scripting/velocity/use/EnumWrapper.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2012-2016 the original author or authors.
+ * Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,10 +17,6 @@
import java.util.HashMap;
-/**
- *
- * @author mnesarco
- */
public class EnumWrapper extends HashMap {
private static final long serialVersionUID = 1L;
diff --git a/src/test/java/org/mybatis/scripting/velocity/use/VelocityLanguageTest.java b/src/test/java/org/mybatis/scripting/velocity/use/VelocityLanguageTest.java
index 0d3aaee..ff6379d 100644
--- a/src/test/java/org/mybatis/scripting/velocity/use/VelocityLanguageTest.java
+++ b/src/test/java/org/mybatis/scripting/velocity/use/VelocityLanguageTest.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2012-2016 the original author or authors.
+ * Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -188,7 +188,7 @@ public void testDynamicSelectWithIteration() {
try {
int[] ids = {2,4,5};
- Map param = new HashMap();
+ Map param = new HashMap<>();
param.put("ids", ids);
List answer = sqlSession.selectList("org.mybatis.scripting.velocity.use.selectNamesWithIteration", param);
assertEquals(3, answer.size());
@@ -207,7 +207,7 @@ public void testEmptyWhere() {
try {
int[] ids = {};
- Map param = new HashMap();
+ Map param = new HashMap<>();
param.put("ids", ids);
List answer = sqlSession.selectList("org.mybatis.scripting.velocity.use.selectNamesWithIteration", param);
assertEquals(5, answer.size());
@@ -223,7 +223,7 @@ public void testTrim() {
try {
int[] ids = {};
- Map param = new HashMap();
+ Map param = new HashMap<>();
param.put("ids", ids);
List answer = sqlSession.selectList("org.mybatis.scripting.velocity.use.selectWithTrim", param);
assertEquals(5, answer.size());
@@ -238,11 +238,11 @@ public void testDynamicSelectWithIterationOverMap() {
SqlSession sqlSession = sqlSessionFactory.openSession();
try {
- Map ids = new HashMap();
+ Map ids = new HashMap<>();
ids.put(2, "Wilma");
ids.put(4, "Barney");
ids.put(5, "Betty");
- Map> param = new HashMap>();
+ Map> param = new HashMap<>();
param.put("ids", ids);
List answer = sqlSession.selectList("org.mybatis.scripting.velocity.use.selectNamesWithIterationOverMap", param);
assertEquals(3, answer.size());
@@ -261,7 +261,7 @@ public void testDynamicSelectWithIterationComplex() {
try {
Name[] names = {new Name(2), new Name(4), new Name(5)};
- Map param = new HashMap();
+ Map param = new HashMap<>();
param.put("names", names);
List answer = sqlSession.selectList("org.mybatis.scripting.velocity.use.selectNamesWithIterationComplex", param);
assertEquals(3, answer.size());
@@ -279,12 +279,12 @@ public void testDynamicSelectWithIterationBoundary() {
SqlSession sqlSession = sqlSessionFactory.openSession();
try {
- List names = new ArrayList();
+ List names = new ArrayList<>();
for (int i = 0; i < 1001; i++) {
names.add(new Name(i));
}
- Map> param = new HashMap>();
+ Map> param = new HashMap<>();
param.put("names", names);
List answer = sqlSession.selectList("org.mybatis.scripting.velocity.use.selectNamesWithIterationComplex", param);
assertEquals(5, answer.size());
@@ -313,7 +313,7 @@ public void testSelectKey() {
public void testSelectWithCustomUserDirective() {
SqlSession sqlSession = sqlSessionFactory.openSession();
try {
- Map> param = new HashMap>();
+ Map> param = new HashMap<>();
List answer = sqlSession.selectList("org.mybatis.scripting.velocity.use.selectWithCustomUserDirective", param);
assertEquals(5, answer.size());
} finally {
@@ -325,12 +325,12 @@ public void testSelectWithCustomUserDirective() {
public void testDynamicSelectWithInDirectiveForOneThousandPlusOne() {
SqlSession sqlSession = sqlSessionFactory.openSession();
try {
- List names = new ArrayList();
+ List names = new ArrayList<>();
for (int i = 0; i < 1001; i++) {
names.add(new Name(i + 1));
}
- Map> param = new HashMap>();
+ Map> param = new HashMap<>();
param.put("names", names);
List answer = sqlSession
.selectList(
@@ -346,12 +346,12 @@ public void testDynamicSelectWithInDirectiveForOneThousandPlusOne() {
public void testDynamicSelectWithInDirectiveForOneThousand() {
SqlSession sqlSession = sqlSessionFactory.openSession();
try {
- List names = new ArrayList();
+ List names = new ArrayList<>();
for (int i = 0; i < 1000; i++) {
names.add(new Name(i + 1));
}
- Map> param = new HashMap>();
+ Map> param = new HashMap<>();
param.put("names", names);
List answer = sqlSession
.selectList(
@@ -367,12 +367,12 @@ public void testDynamicSelectWithInDirectiveForOneThousand() {
public void testDynamicSelectWithInDirectiveForOneThousandMinusOne() {
SqlSession sqlSession = sqlSessionFactory.openSession();
try {
- List names = new ArrayList();
+ List names = new ArrayList<>();
for (int i = 0; i < 999; i++) {
names.add(new Name(i + 1));
}
- Map> param = new HashMap>();
+ Map> param = new HashMap<>();
param.put("names", names);
List answer = sqlSession
.selectList(
@@ -388,12 +388,12 @@ public void testDynamicSelectWithInDirectiveForOneThousandMinusOne() {
public void testDynamicSelectWithInDirectiveForOneItem() {
SqlSession sqlSession = sqlSessionFactory.openSession();
try {
- List names = new ArrayList();
+ List names = new ArrayList<>();
for (int i = 0; i < 1; i++) {
names.add(new Name(i + 1));
}
- Map> param = new HashMap>();
+ Map> param = new HashMap<>();
param.put("names", names);
List answer = sqlSession
.selectList(
diff --git a/src/test/resources/log4j.xml b/src/test/resources/log4j.xml
deleted file mode 100644
index e2ff75c..0000000
--- a/src/test/resources/log4j.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/test/resources/mybatis-velocity.properties b/src/test/resources/mybatis-velocity.properties
index 9588321..2f61a8b 100644
--- a/src/test/resources/mybatis-velocity.properties
+++ b/src/test/resources/mybatis-velocity.properties
@@ -1,5 +1,5 @@
#
-# Copyright 2012-2016 the original author or authors.
+# Copyright 2012-2017 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -16,4 +16,3 @@
additional.context.attributes=trailingWildCardFormatter:org.mybatis.scripting.velocity.use.TrailingWildCardFormatter,enumBinder:org.mybatis.scripting.velocity.use.EnumBinder
userdirective=org.mybatis.scripting.velocity.use.CustomUserDirective
-runtime.log=target/velocity.log
\ No newline at end of file