Skip to content

Commit 317737c

Browse files
authored
Merge pull request #37 from hazendaz/master
Bring to jdk8, add jdk11 builds, update dependencies, junit5
2 parents 3b844f7 + 57f77e1 commit 317737c

File tree

12 files changed

+130
-132
lines changed

12 files changed

+130
-132
lines changed

.travis.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@ language: java
22
sudo: false
33

44
jdk:
5-
- oraclejdk9
5+
- oraclejdk11
66
- oraclejdk8
7-
- openjdk8
8-
- openjdk7
97

108
after_success:
119
- chmod -R 777 ./travis/after_success.sh

pom.xml

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
4-
Copyright 2015-2017 the original author or authors.
4+
Copyright 2015-2018 the original author or authors.
55
66
Licensed under the Apache License, Version 2.0 (the "License");
77
you may not use this file except in compliance with the License.
@@ -22,7 +22,7 @@
2222
<parent>
2323
<groupId>org.mybatis</groupId>
2424
<artifactId>mybatis-parent</artifactId>
25-
<version>30</version>
25+
<version>31-SNAPSHOT</version>
2626
<relativePath />
2727
</parent>
2828

@@ -75,40 +75,32 @@
7575
</distributionManagement>
7676

7777
<properties>
78-
<maven.compiler.source>1.7</maven.compiler.source>
79-
<maven.compiler.target>1.7</maven.compiler.target>
80-
<maven.compiler.testTarget>1.7</maven.compiler.testTarget>
81-
<maven.compiler.testSource>1.7</maven.compiler.testSource>
82-
83-
<signature.artifact>java17</signature.artifact>
84-
<signature.version>1.0</signature.version>
85-
8678
<clirr.comparisonVersion>1.1.2</clirr.comparisonVersion>
8779
</properties>
8880

8981
<dependencies>
9082
<dependency>
9183
<groupId>org.mybatis</groupId>
9284
<artifactId>mybatis</artifactId>
93-
<version>3.4.5</version>
85+
<version>3.4.6</version>
9486
</dependency>
9587
<dependency>
9688
<groupId>org.freemarker</groupId>
9789
<artifactId>freemarker</artifactId>
98-
<version>2.3.27-incubating</version>
90+
<version>2.3.28</version>
9991
</dependency>
10092

10193
<!-- TEST -->
10294
<dependency>
103-
<groupId>org.junit.vintage</groupId>
104-
<artifactId>junit-vintage-engine</artifactId>
105-
<version>4.12.2</version>
95+
<groupId>org.junit.jupiter</groupId>
96+
<artifactId>junit-jupiter-engine</artifactId>
97+
<version>5.3.1</version>
10698
<scope>test</scope>
10799
</dependency>
108100
<dependency>
109101
<groupId>org.hsqldb</groupId>
110102
<artifactId>hsqldb</artifactId>
111-
<version>2.3.5</version> <!-- Version 2.4.0 required jdk8 -->
103+
<version>2.4.1</version>
112104
<scope>test</scope>
113105
</dependency>
114106
<dependency>

src/main/java/org/mybatis/scripting/freemarker/FreeMarkerLanguageDriver.java

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2015-2017 the original author or authors.
2+
* Copyright 2015-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -35,9 +35,8 @@
3535
import org.apache.ibatis.session.Configuration;
3636

3737
/**
38-
* Adds FreeMarker templates support to scripting in MyBatis.
39-
* If you want to change or extend template loader configuration, use can
40-
* inherit from this class and override {@link #createFreeMarkerConfiguration()} method.
38+
* Adds FreeMarker templates support to scripting in MyBatis. If you want to change or extend template loader
39+
* configuration, use can inherit from this class and override {@link #createFreeMarkerConfiguration()} method.
4140
*
4241
* @author elwood
4342
*/
@@ -73,10 +72,8 @@ public FreeMarkerLanguageDriver() {
7372
}
7473

7574
/**
76-
* Creates the {@link freemarker.template.Configuration} instance
77-
* and sets it up. If you want to change it (set another props, for
78-
* example), you can override it in inherited class and use your own
79-
* class in @Lang directive.
75+
* Creates the {@link freemarker.template.Configuration} instance and sets it up. If you want to change it (set
76+
* another props, for example), you can override it in inherited class and use your own class in @Lang directive.
8077
*/
8178
protected freemarker.template.Configuration createFreeMarkerConfiguration() {
8279
freemarker.template.Configuration cfg = new freemarker.template.Configuration(
@@ -95,13 +92,15 @@ protected freemarker.template.Configuration createFreeMarkerConfiguration() {
9592
}
9693

9794
/**
98-
* Creates a {@link ParameterHandler} that passes the actual parameters
99-
* to the the JDBC statement.
95+
* Creates a {@link ParameterHandler} that passes the actual parameters to the the JDBC statement.
10096
*
10197
* @see DefaultParameterHandler
102-
* @param mappedStatement The mapped statement that is being executed
103-
* @param parameterObject The input parameter object (can be null)
104-
* @param boundSql The resulting SQL once the dynamic language has been executed.
98+
* @param mappedStatement
99+
* The mapped statement that is being executed
100+
* @param parameterObject
101+
* The input parameter object (can be null)
102+
* @param boundSql
103+
* The resulting SQL once the dynamic language has been executed.
105104
*/
106105
@Override
107106
public ParameterHandler createParameterHandler(MappedStatement mappedStatement, Object parameterObject,
@@ -111,29 +110,33 @@ public ParameterHandler createParameterHandler(MappedStatement mappedStatement,
111110
}
112111

113112
/**
114-
* Creates an {@link SqlSource} that will hold the statement read
115-
* from a mapper xml file. It is called during startup, when the
116-
* mapped statement is read from a class or an xml file.
113+
* Creates an {@link SqlSource} that will hold the statement read from a mapper xml file. It is called during startup,
114+
* when the mapped statement is read from a class or an xml file.
117115
*
118-
* @param configuration The MyBatis configuration
119-
* @param script XNode parsed from a XML file
120-
* @param parameterType input parameter type got from a mapper method
121-
* or specified in the parameterType xml attribute. Can be null.
116+
* @param configuration
117+
* The MyBatis configuration
118+
* @param script
119+
* XNode parsed from a XML file
120+
* @param parameterType
121+
* input parameter type got from a mapper method or specified in the parameterType xml attribute. Can be
122+
* null.
122123
*/
123124
@Override
124125
public SqlSource createSqlSource(Configuration configuration, XNode script, Class<?> parameterType) {
125126
return createSqlSource(configuration, script.getNode().getTextContent());
126127
}
127128

128129
/**
129-
* Creates an {@link SqlSource} that will hold the statement read
130-
* from an annotation. It is called during startup, when the mapped
131-
* statement is read from a class or an xml file.
130+
* Creates an {@link SqlSource} that will hold the statement read from an annotation. It is called during startup,
131+
* when the mapped statement is read from a class or an xml file.
132132
*
133-
* @param configuration The MyBatis configuration
134-
* @param script The content of the annotation
135-
* @param parameterType input parameter type got from a mapper method
136-
* or specified in the parameterType xml attribute. Can be null.
133+
* @param configuration
134+
* The MyBatis configuration
135+
* @param script
136+
* The content of the annotation
137+
* @param parameterType
138+
* input parameter type got from a mapper method or specified in the parameterType xml attribute. Can be
139+
* null.
137140
*/
138141
@Override
139142
public SqlSource createSqlSource(Configuration configuration, String script, Class<?> parameterType) {

src/main/java/org/mybatis/scripting/freemarker/FreeMarkerSqlSource.java

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2015-2017 the original author or authors.
2+
* Copyright 2015-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -30,10 +30,8 @@
3030
import org.apache.ibatis.session.Configuration;
3131

3232
/**
33-
* Applies provided parameter(s) to FreeMarker template.
34-
* Then passes the result into default MyBatis engine
35-
* (and it finally replaces #{}-params to '?'-params).
36-
* So, FreeMarker is used as preprocessor for MyBatis engine.
33+
* Applies provided parameter(s) to FreeMarker template. Then passes the result into default MyBatis engine (and it
34+
* finally replaces #{}-params to '?'-params). So, FreeMarker is used as preprocessor for MyBatis engine.
3735
*
3836
* @author elwood
3937
*/
@@ -49,10 +47,8 @@ public FreeMarkerSqlSource(Template template, Configuration configuration) {
4947
}
5048

5149
/**
52-
* Populates additional parameters to data context.
53-
* Data context can be {@link java.util.Map}
54-
* or {@link org.mybatis.scripting.freemarker.ParamObjectAdapter}
55-
* instance.
50+
* Populates additional parameters to data context. Data context can be {@link java.util.Map} or
51+
* {@link org.mybatis.scripting.freemarker.ParamObjectAdapter} instance.
5652
*/
5753
protected Object preProcessDataContext(Object dataContext, boolean isMap) {
5854
if (isMap) {

src/main/java/org/mybatis/scripting/freemarker/MyBatisParamDirective.java

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2015-2017 the original author or authors.
2+
* Copyright 2015-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -33,34 +33,45 @@
3333
import java.util.Map;
3434

3535
/**
36-
* Custom FreeMarker directive for generating "#{paramName}" declarations in convenient way.
37-
* Problem is FreeMarker supports this syntax natively and there are no chance to disable this
38-
* (although it is deprecated). And to get "#{paramName}" we should write ${r"#{paramName}"}.
39-
* With this directive you can write more simple:
36+
* Custom FreeMarker directive for generating "#{paramName}" declarations in convenient way. Problem is FreeMarker
37+
* supports this syntax natively and there are no chance to disable this (although it is deprecated). And to get
38+
* "#{paramName}" we should write ${r"#{paramName}"}. With this directive you can write more simple:
4039
*
41-
* <blockquote><pre>
40+
* <blockquote>
41+
*
42+
* <pre>
4243
* &lt;@p name="paramName"/&gt;
43-
* </pre></blockquote>
44+
* </pre>
45+
*
46+
* </blockquote>
4447
*
4548
* <p>
46-
* Also directive supports `value` attribute. If it is specified, param will take passed value
47-
* and create the corresponding #{}-parameter. This is useful in loops:
49+
* Also directive supports `value` attribute. If it is specified, param will take passed value and create the
50+
* corresponding #{}-parameter. This is useful in loops:
4851
* </p>
4952
*
50-
* <blockquote><pre>
53+
* <blockquote>
54+
*
55+
* <pre>
5156
* &lt;#list ids as id&gt;
5257
* &lt;@p value=id/&gt;
5358
* &lt;#if id_has_next&gt;,&lt;/#if&gt;
5459
* &lt;/#list&gt;
55-
* </pre></blockquote>
60+
* </pre>
61+
*
62+
* </blockquote>
5663
*
5764
* <p>
5865
* will be translated into
5966
* </p>
6067
*
61-
* <blockquote><pre>
68+
* <blockquote>
69+
*
70+
* <pre>
6271
* #{_p0},#{_p1},#{_p2}
63-
* </pre></blockquote>
72+
* </pre>
73+
*
74+
* </blockquote>
6475
*
6576
* <p>
6677
* And MyBatis engine will convert it to `?`-params finally.

src/main/java/org/mybatis/scripting/freemarker/ParamObjectAdapter.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2015-2017 the original author or authors.
2+
* Copyright 2015-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -26,8 +26,8 @@
2626
import java.util.HashMap;
2727

2828
/**
29-
* Important: if you are using some object that already has property "p", then
30-
* MyBatisParamDirective will be unavailable from script.
29+
* Important: if you are using some object that already has property "p", then MyBatisParamDirective will be unavailable
30+
* from script.
3131
*
3232
* @author elwood
3333
*/
@@ -42,9 +42,8 @@ public ParamObjectAdapter(Object paramObject, ArrayList generatedParams) {
4242
}
4343

4444
/**
45-
* Puts the additional parameter into adapter, it will be available if no
46-
* existing property with same key exists. For example, it is suitable to add
47-
* custom objects and directives into dataContext.
45+
* Puts the additional parameter into adapter, it will be available if no existing property with same key exists. For
46+
* example, it is suitable to add custom objects and directives into dataContext.
4847
*/
4948
public void putAdditionalParam(String key, TemplateModel value) {
5049
if (additionalParams == null) {

src/test/java/org/mybatis/scripting/freemarker/CustomizedDataContextTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2015-2017 the original author or authors.
2+
* Copyright 2015-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -28,9 +28,9 @@
2828
import org.apache.ibatis.transaction.TransactionFactory;
2929
import org.apache.ibatis.transaction.jdbc.JdbcTransactionFactory;
3030
import org.hsqldb.jdbc.JDBCDataSource;
31-
import org.junit.Assert;
32-
import org.junit.BeforeClass;
33-
import org.junit.Test;
31+
import org.junit.jupiter.api.Assertions;
32+
import org.junit.jupiter.api.BeforeAll;
33+
import org.junit.jupiter.api.Test;
3434

3535
import java.io.Reader;
3636
import java.sql.Connection;
@@ -43,7 +43,7 @@
4343
public class CustomizedDataContextTest {
4444
protected static SqlSessionFactory sqlSessionFactory;
4545

46-
@BeforeClass
46+
@BeforeAll
4747
public static void setUp() throws Exception {
4848
Class.forName("org.hsqldb.jdbcDriver");
4949

@@ -102,7 +102,7 @@ public void test() {
102102
try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
103103
CustomizedDataContextMapper mapper = sqlSession.getMapper(CustomizedDataContextMapper.class);
104104
List<Name> names = mapper.find();
105-
Assert.assertTrue(names.size() == 1);
105+
Assertions.assertTrue(names.size() == 1);
106106
}
107107
}
108108
}

0 commit comments

Comments
 (0)