Skip to content

Commit

Permalink
Fix JaCoCo Report and Checkstyle Report
Browse files Browse the repository at this point in the history
Also fix a few Checkstyle errors.
  • Loading branch information
jeffgbutler committed Jan 7, 2018
1 parent 0eb7954 commit d61abcb
Show file tree
Hide file tree
Showing 15 changed files with 57 additions and 57 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ protected void generateEquals(TopLevelClass topLevelClass,
topLevelClass.getImportedTypes());
} else {
context.getCommentGenerator().addGeneralMethodComment(method,
introspectedTable);
introspectedTable);
}

method.addBodyLine("if (this == that) {"); //$NON-NLS-1$
Expand Down Expand Up @@ -255,7 +255,7 @@ protected void generateHashCode(TopLevelClass topLevelClass,
topLevelClass.getImportedTypes());
} else {
context.getCommentGenerator().addGeneralMethodComment(method,
introspectedTable);
introspectedTable);
}

method.addBodyLine("final int prime = 31;"); //$NON-NLS-1$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ public boolean modelSetterMethodGenerated(Method method,
fluentMethod.setName("with" + method.getName().substring(3)); //$NON-NLS-1$
fluentMethod.getParameters().addAll(method.getParameters());

if(introspectedTable.getTargetRuntime() == TargetRuntime.MYBATIS3_DSQL) {
if (introspectedTable.getTargetRuntime() == TargetRuntime.MYBATIS3_DSQL) {
context.getCommentGenerator().addGeneralMethodAnnotation(fluentMethod,
introspectedTable, topLevelClass.getImportedTypes());
} else {
context.getCommentGenerator().addGeneralMethodComment(fluentMethod,
introspectedTable);
introspectedTable);
}

StringBuilder sb = new StringBuilder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ protected void makeSerializable(TopLevelClass topLevelClass,
field.setType(new FullyQualifiedJavaType("long")); //$NON-NLS-1$
field.setVisibility(JavaVisibility.PRIVATE);

if(introspectedTable.getTargetRuntime() == TargetRuntime.MYBATIS3_DSQL) {
if (introspectedTable.getTargetRuntime() == TargetRuntime.MYBATIS3_DSQL) {
context.getCommentGenerator().addFieldAnnotation(field, introspectedTable,
topLevelClass.getImportedTypes());
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ private void generateToString(IntrospectedTable introspectedTable,
introspectedTable, topLevelClass.getImportedTypes());
} else {
context.getCommentGenerator().addGeneralMethodComment(method,
introspectedTable);
introspectedTable);
}

method.addBodyLine("StringBuilder sb = new StringBuilder();"); //$NON-NLS-1$
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2006-2017 the original author or authors.
* Copyright 2006-2018 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.
Expand Down Expand Up @@ -64,6 +64,7 @@ private String calculateClassName() {
return mapperType.getPackageName() + "." + recordType.getShortNameWithoutTypeArguments() + "DynamicSqlSupport"; //$NON-NLS-1$ //$NON-NLS-2$

}

private TopLevelClass buildBasicClass() {
TopLevelClass topLevelClass = new TopLevelClass(calculateClassName());
topLevelClass.setVisibility(JavaVisibility.PUBLIC);
Expand Down Expand Up @@ -149,7 +150,7 @@ private String calculateInnerInitializationString(IntrospectedColumn column) {

initializationString.append(String.format("column(\"%s\", JDBCType.%s", //$NON-NLS-1$ //$NON-NLS-2$
escapeStringForJava(getEscapedColumnName(column)),
column.getJdbcTypeName()));
column.getJdbcTypeName()));

if (StringUtility.stringHasValue(column.getTypeHandler())) {
initializationString.append(String.format(", \"%s\")", column.getTypeHandler())); //$NON-NLS-1$
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2006-2017 the original author or authors.
* Copyright 2006-2018 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.
Expand Down Expand Up @@ -44,9 +44,10 @@ protected void acceptParts(MethodAndImports.Builder builder, Method method, Meth
}

public abstract MethodAndImports generateMethodAndImports();

public abstract boolean callPlugins(Method method, Interface interfaze);

public static abstract class BaseBuilder<T extends BaseBuilder<T, R>, R> {
public abstract static class BaseBuilder<T extends BaseBuilder<T, R>, R> {
private Context context;
private IntrospectedTable introspectedTable;

Expand All @@ -61,6 +62,7 @@ public T withIntrospectedTable(IntrospectedTable introspectedTable) {
}

public abstract T getThis();

public abstract R build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import org.mybatis.generator.api.dom.java.Method;
import org.mybatis.generator.api.dom.java.Parameter;

public class BasicCountMethodGenerator extends AbstractMethodGenerator{
public class BasicCountMethodGenerator extends AbstractMethodGenerator {

private BasicCountMethodGenerator(Builder builder) {
super(builder);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ public MethodAndImports generateMethodAndImports() {
context.getCommentGenerator().addGeneralMethodAnnotation(method, introspectedTable, imports);
method.addAnnotation("@InsertProvider(type=SqlProviderAdapter.class, method=\"insert\")"); //$NON-NLS-1$

MethodAndImports.Builder builder = MethodAndImports.withMethod(method)
.withImports(imports);
MethodAndImports.Builder builder = MethodAndImports.withMethod(method)
.withImports(imports);

GeneratedKey gk = introspectedTable.getGeneratedKey();
if (gk != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,12 @@ public MethodAndImports generateMethodAndImports() {
imports.add(adapter);
imports.add(annotation);

Method method = new Method("selectMany"); //$NON-NLS-1$

imports.add(FullyQualifiedJavaType.getNewListInstance());

imports.add(recordType);
FullyQualifiedJavaType returnType = FullyQualifiedJavaType.getNewListInstance();
returnType.addTypeArgument(recordType);
Method method = new Method("selectMany"); //$NON-NLS-1$
method.setReturnType(returnType);
method.addParameter(new Parameter(parameterType, "selectStatement")); //$NON-NLS-1$
context.getCommentGenerator().addGeneralMethodAnnotation(method, introspectedTable, imports);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2006-2017 the original author or authors.
* Copyright 2006-2018 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.
Expand Down Expand Up @@ -66,13 +66,13 @@ public MethodParts getPrimaryKeyWhereClauseAndParameters() {
builder.withParameter(new Parameter(column.getFullyQualifiedJavaType(), column.getJavaProperty() + "_")); //$NON-NLS-1$
if (first) {
builder.withBodyLine(" .where(" + column.getJavaProperty() //$NON-NLS-1$
+ ", isEqualTo(" + column.getJavaProperty() //$NON-NLS-1$
+ "_))"); //$NON-NLS-1$
+ ", isEqualTo(" + column.getJavaProperty() //$NON-NLS-1$
+ "_))"); //$NON-NLS-1$
first = false;
} else {
builder.withBodyLine(" .and(" + column.getJavaProperty() //$NON-NLS-1$
+ ", isEqualTo(" + column.getJavaProperty() //$NON-NLS-1$
+ "_))"); //$NON-NLS-1$
+ ", isEqualTo(" + column.getJavaProperty() //$NON-NLS-1$
+ "_))"); //$NON-NLS-1$
}
}

Expand All @@ -87,13 +87,13 @@ public List<String> getPrimaryKeyWhereClauseForUpdate() {
String methodName = JavaBeansUtil.getGetterMethodName(column.getJavaProperty(), column.getFullyQualifiedJavaType());
if (first) {
lines.add(" .where(" + column.getJavaProperty() //$NON-NLS-1$
+ ", isEqualTo(record::" + methodName //$NON-NLS-1$
+ "))"); //$NON-NLS-1$
+ ", isEqualTo(record::" + methodName //$NON-NLS-1$
+ "))"); //$NON-NLS-1$
first = false;
} else {
lines.add(" .and(" + column.getJavaProperty() //$NON-NLS-1$
+ ", isEqualTo(record::" + methodName //$NON-NLS-1$
+ "))"); //$NON-NLS-1$
+ ", isEqualTo(record::" + methodName //$NON-NLS-1$
+ "))"); //$NON-NLS-1$
}
}

Expand Down Expand Up @@ -287,8 +287,8 @@ public List<String> getSetEqualLines(List<IntrospectedColumn> columnList, boolea
IntrospectedColumn column = iter.next();
String methodName = JavaBeansUtil.getGetterMethodName(column.getJavaProperty(), column.getFullyQualifiedJavaType());
String line = " .set(" + column.getJavaProperty() //$NON-NLS-1$
+ ").equalTo(record::" + methodName //$NON-NLS-1$
+ ")"; //$NON-NLS-1$
+ ").equalTo(record::" + methodName //$NON-NLS-1$
+ ")"; //$NON-NLS-1$
if (terminate && !iter.hasNext()) {
line += ";"; //$NON-NLS-1$
}
Expand All @@ -306,8 +306,8 @@ public List<String> getSetEqualWhenPresentLines(List<IntrospectedColumn> columnL
IntrospectedColumn column = iter.next();
String methodName = JavaBeansUtil.getGetterMethodName(column.getJavaProperty(), column.getFullyQualifiedJavaType());
String line = " .set(" + column.getJavaProperty() //$NON-NLS-1$
+ ").equalToWhenPresent(record::" //$NON-NLS-1$
+ methodName + ")"; //$NON-NLS-1$
+ ").equalToWhenPresent(record::" //$NON-NLS-1$
+ methodName + ")"; //$NON-NLS-1$
if (terminate && !iter.hasNext()) {
line += ";"; //$NON-NLS-1$
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2006-2017 the original author or authors.
* Copyright 2006-2018 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.
Expand Down Expand Up @@ -60,8 +60,8 @@ public MethodAndImports generateMethodAndImports() {
List<IntrospectedColumn> columns = ListUtilities.removeIdentityAndGeneratedAlwaysColumns(introspectedTable.getAllColumns());
for (IntrospectedColumn column : columns) {
method.addBodyLine(" .map(" + column.getJavaProperty() //$NON-NLS-1$
+ ").toProperty(\"" + column.getJavaProperty() //$NON-NLS-1$
+ "\")"); //$NON-NLS-1$
+ ").toProperty(\"" + column.getJavaProperty() //$NON-NLS-1$
+ "\")"); //$NON-NLS-1$
}

method.addBodyLine(" .build()"); //$NON-NLS-1$
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2006-2017 the original author or authors.
* Copyright 2006-2018 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.
Expand Down Expand Up @@ -62,14 +62,14 @@ public MethodAndImports generateMethodAndImports() {
for (IntrospectedColumn column : columns) {
if (column.isSequenceColumn()) {
method.addBodyLine(" .map(" + column.getJavaProperty() //$NON-NLS-1$
+ ").toProperty(\"" + column.getJavaProperty() //$NON-NLS-1$
+ "\")"); //$NON-NLS-1$
+ ").toProperty(\"" + column.getJavaProperty() //$NON-NLS-1$
+ "\")"); //$NON-NLS-1$
} else {
String methodName = JavaBeansUtil.getGetterMethodName(column.getJavaProperty(), column.getFullyQualifiedJavaType());
method.addBodyLine(" .map(" + column.getJavaProperty() //$NON-NLS-1$
+ ").toPropertyWhenPresent(\"" + column.getJavaProperty() //$NON-NLS-1$
+ "\", record::" + methodName //$NON-NLS-1$
+ ")"); //$NON-NLS-1$
+ ").toPropertyWhenPresent(\"" + column.getJavaProperty() //$NON-NLS-1$
+ "\", record::" + methodName //$NON-NLS-1$
+ ")"); //$NON-NLS-1$
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2006-2017 the original author or authors.
* Copyright 2006-2018 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.
Expand Down Expand Up @@ -63,6 +63,7 @@ public Builder withAnnotation(String annotation) {
annotations.add(annotation);
return this;
}

public Builder withBodyLine(String bodyLine) {
this.bodyLines.add(bodyLine);
return this;
Expand Down
35 changes: 16 additions & 19 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@
<findbugs.onlyAnalyze>org.mybatis.generator.*</findbugs.onlyAnalyze>
<clirr.comparisonVersion>1.3.2</clirr.comparisonVersion>
<hsqldb.version>2.3.5</hsqldb.version> <!-- Version 2.4.0 requires jdk8 -->
<jacoco.version>0.7.9</jacoco.version>
<jacoco.itReportPath>${project.basedir}/../mybatis-generator-core/target/jacoco-it.exec</jacoco.itReportPath>
<checkstyle.config>${project.basedir}/../checkstyle-override.xml</checkstyle.config>
</properties>

<build>
Expand Down Expand Up @@ -91,18 +91,6 @@
<artifactId>maven-plugin-plugin</artifactId>
<version>3.5</version>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<configLocation>checkstyle.xml</configLocation>
</configuration>
</plugin>
</plugins>
</pluginManagement>

Expand Down Expand Up @@ -190,6 +178,20 @@

<reporting>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<reportSets>
<reportSet>
<reports>
<report>report-integration</report>
</reports>
<configuration>
<dataFile>${jacoco.itReportPath}</dataFile>
</configuration>
</reportSet>
</reportSets>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
Expand All @@ -206,16 +208,11 @@
</tags>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<configLocation>checkstyle.xml</configLocation>
<configLocation>${checkstyle.config}</configLocation>
</configuration>
</plugin>
</plugins>
Expand Down

0 comments on commit d61abcb

Please sign in to comment.