Upgrade dependencies for SMB module

* Fix compatibility with SI 5.3
* Use new `maven-publish` plugin for Gradle
* Fix some Checkstyle violations
* Make XSD versionless
This commit is contained in:
Artem Bilan
2020-06-24 12:25:33 -04:00
parent 13f528205e
commit 44610d09ca
15 changed files with 293 additions and 417 deletions

View File

@@ -1,268 +1,238 @@
buildscript {
repositories {
maven { url 'https://repo.spring.io/plugins-release' }
}
dependencies {
classpath 'io.spring.gradle:docbook-reference-plugin:0.3.1'
}
repositories {
maven { url 'https://repo.spring.io/plugins-release' }
}
dependencies {
classpath 'io.spring.gradle:docbook-reference-plugin:0.3.1'
}
}
plugins {
id 'java'
id 'eclipse'
id 'idea'
id 'jacoco'
id 'checkstyle'
id 'org.sonarqube' version '2.8'
id 'java-library'
id 'eclipse'
id 'idea'
id 'jacoco'
id 'checkstyle'
id 'org.sonarqube' version '2.8'
id 'com.jfrog.artifactory' version '4.15.2'
}
description = 'Spring Integration SMB Support'
apply from: "${rootProject.projectDir}/publish-maven.gradle"
group = 'org.springframework.integration'
repositories {
if (version.endsWith('BUILD-SNAPSHOT')) {
maven { url 'https://repo.spring.io/libs-snapshot' }
}
maven { url 'https://repo.spring.io/libs-milestone' }
if (version.endsWith('BUILD-SNAPSHOT')) {
maven { url 'https://repo.spring.io/libs-snapshot' }
}
maven { url 'https://repo.spring.io/libs-milestone' }
}
compileJava {
sourceCompatibility = 1.8
targetCompatibility = 1.8
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
compileTestJava {
sourceCompatibility = 1.8
targetCompatibility = 1.8
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
ext {
idPrefix = 'smb'
idPrefix = 'smb'
jcifsVersion = '2.1.19'
log4jVersion = '2.12.1'
springIntegrationVersion = '5.2.1.RELEASE'
jcifsVersion = '2.1.19'
log4jVersion = '2.13.3'
springIntegrationVersion = '5.3.1.RELEASE'
linkHomepage = 'https://github.com/SpringSource/spring-integration-extensions'
linkCi = 'https://build.springsource.org/browse/INTEXT'
linkIssue = 'https://jira.springsource.org/browse/INTEXT'
linkScmUrl = 'https://github.com/SpringSource/spring-integration-extensions'
linkScmConnection = 'https://github.com/SpringSource/spring-integration-extensions.git'
linkScmDevConnection = 'git@github.com:SpringSource/spring-integration-extensions.git'
linkHomepage = 'https://github.com/SpringSource/spring-integration-extensions'
linkCi = 'https://build.springsource.org/browse/INTEXT'
linkIssue = 'https://github.com/spring-projects/spring-integration-extensions/issues'
linkScmUrl = 'https://github.com/SpringSource/spring-integration-extensions'
linkScmConnection = 'https://github.com/SpringSource/spring-integration-extensions.git'
linkScmDevConnection = 'git@github.com:SpringSource/spring-integration-extensions.git'
}
eclipse.project.natures += 'org.springframework.ide.eclipse.core.springnature'
java {
withJavadocJar()
withSourcesJar()
}
sourceSets {
test {
resources {
srcDirs = ['src/test/resources', 'src/test/java']
}
}
test {
resources {
srcDirs = ['src/test/resources', 'src/test/java']
}
}
}
jacoco {
toolVersion = '0.8.4'
toolVersion = '0.8.5'
}
checkstyle {
configFile = file("$rootDir/src/checkstyle/checkstyle.xml")
toolVersion = '8.25'
configDirectory.set(rootProject.file("src/checkstyle"))
toolVersion = '8.33'
}
dependencies {
compile "org.codelibs:jcifs:$jcifsVersion"
compile "org.springframework.integration:spring-integration-file:$springIntegrationVersion"
api "org.codelibs:jcifs:$jcifsVersion"
api "org.springframework.integration:spring-integration-file:$springIntegrationVersion"
testCompile "org.springframework.integration:spring-integration-test:$springIntegrationVersion"
testImplementation "org.springframework.integration:spring-integration-test:$springIntegrationVersion"
// testRuntime "org.apache.logging.log4j:log4j-slf4j-impl:$log4jVersion"
testRuntime "org.apache.logging.log4j:log4j-jcl:$log4jVersion"
testRuntimeOnly "org.apache.logging.log4j:log4j-core:$log4jVersion"
testRuntimeOnly "org.apache.logging.log4j:log4j-jcl:$log4jVersion"
}
// enable all compiler warnings; individual projects may customize further
[compileJava, compileTestJava]*.options*.compilerArgs = ['-Xlint:all,-options,-processing']
jacocoTestReport {
reports {
xml.enabled false
csv.enabled false
html.destination file("${buildDir}/reports/jacoco/html")
}
reports {
xml.enabled false
csv.enabled false
html.destination file("${buildDir}/reports/jacoco/html")
}
}
test {
// suppress all console output during testing unless running `gradle -i`
logging.captureStandardOutput(LogLevel.INFO)
maxHeapSize = '1024m'
jacoco {
append = false
destinationFile = file("$buildDir/jacoco.exec")
}
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allJava
}
task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}
artifacts {
archives sourcesJar
archives javadocJar
// suppress all console output during testing unless running `gradle -i`
logging.captureStandardOutput(LogLevel.INFO)
maxHeapSize = '1024m'
jacoco {
destinationFile = file("$buildDir/jacoco.exec")
}
}
apply plugin: 'docbook-reference'
reference {
sourceDir = file('src/reference/docbook')
sourceDir = file('src/reference/docbook')
}
sonarqube {
properties {
property "sonar.jacoco.reportPath", "${buildDir.name}/jacoco.exec"
property "sonar.links.homepage", linkHomepage
property "sonar.links.ci", linkCi
property "sonar.links.issue", linkIssue
property "sonar.links.scm", linkScmUrl
property "sonar.links.scm_dev", linkScmDevConnection
property "sonar.java.coveragePlugin", "jacoco"
}
}
task api(type: Javadoc) {
group = 'Documentation'
description = 'Generates the Javadoc API documentation.'
title = "${rootProject.description} ${version} API"
options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
options.author = true
options.header = rootProject.description
options.overview = 'src/api/overview.html'
source = sourceSets.main.allJava
classpath = project.sourceSets.main.compileClasspath
destinationDir = file("$buildDir/api")
properties {
property "sonar.jacoco.reportPath", "${buildDir.name}/jacoco.exec"
property "sonar.links.homepage", linkHomepage
property "sonar.links.ci", linkCi
property "sonar.links.issue", linkIssue
property "sonar.links.scm", linkScmUrl
property "sonar.links.scm_dev", linkScmDevConnection
property "sonar.java.coveragePlugin", "jacoco"
}
}
task schemaZip(type: Zip) {
group = 'Distribution'
classifier = 'schema'
description = "Builds -${classifier} archive containing all " +
"XSDs for deployment at static.springframework.org/schema."
group = 'Distribution'
archiveClassifier = 'schema'
description = "Builds -${archiveClassifier} archive containing all " +
"XSDs for deployment at static.springframework.org/schema."
Properties schemas = new Properties()
def shortName = idPrefix.replaceFirst("${idPrefix}-", '')
Properties schemas = new Properties()
def shortName = idPrefix.replaceFirst("${idPrefix}-", '')
project.sourceSets.main.resources.find {
it.path.endsWith("META-INF${File.separator}spring.schemas")
}?.withInputStream { schemas.load(it) }
project.sourceSets.main.resources.find {
it.path.endsWith("META-INF${File.separator}spring.schemas")
}?.withInputStream { schemas.load(it) }
for (def key : schemas.keySet()) {
File xsdFile = project.sourceSets.main.resources.find {
it.path.replaceAll('\\\\', '/').endsWith(schemas.get(key))
}
assert xsdFile != null
into("integration/${shortName}") {
from xsdFile.path
}
}
for (def key : schemas.keySet()) {
File xsdFile = project.sourceSets.main.resources.find {
it.path.replaceAll('\\\\', '/').endsWith(schemas.get(key))
}
assert xsdFile != null
into("integration/${shortName}") {
from xsdFile.path
}
}
}
task docsZip(type: Zip) {
group = 'Distribution'
classifier = 'docs'
description = "Builds -${classifier} archive containing api and reference " +
"for deployment at static.springframework.org/spring-integration/docs."
group = 'Distribution'
archiveClassifier = 'docs'
description = "Builds -${archiveClassifier} archive containing api and reference " +
"for deployment at static.springframework.org/spring-integration/docs."
from('src/dist') {
include 'changelog.txt'
}
from('src/dist') {
include 'changelog.txt'
}
from (api) {
into 'api'
}
from(javadoc) {
into 'api'
}
from (reference) {
into 'reference'
}
from(reference) {
into 'reference'
}
}
task distZip(type: Zip, dependsOn: [docsZip, schemaZip]) {
group = 'Distribution'
classifier = 'dist'
description = "Builds -${classifier} archive, containing all jars and docs, " +
"suitable for community download page."
group = 'Distribution'
archiveClassifier = 'dist'
description = "Builds -${archiveClassifier} archive, containing all jars and docs, " +
"suitable for community download page."
ext.baseDir = "${project.name}-${project.version}"
ext.baseDir = "${project.name}-${project.version}"
from('src/dist') {
include 'readme.txt'
include 'license.txt'
include 'notice.txt'
into "${baseDir}"
}
from('src/dist') {
include 'readme.txt'
include 'license.txt'
include 'notice.txt'
into "${baseDir}"
}
from(zipTree(docsZip.archivePath)) {
into "${baseDir}/docs"
}
from(zipTree(docsZip.archiveFile)) {
into "${baseDir}/docs"
}
from(zipTree(schemaZip.archivePath)) {
into "${baseDir}/schema"
}
from(zipTree(schemaZip.archiveFile)) {
into "${baseDir}/schema"
}
into ("${baseDir}/libs") {
from project.jar
from project.sourcesJar
from project.javadocJar
}
into("${baseDir}/libs") {
from project.jar
from project.sourcesJar
from project.javadocJar
}
}
// Create an optional "with dependencies" distribution.
// Not published by default; only for use when building from source.
task depsZip(type: Zip, dependsOn: distZip) { zipTask ->
group = 'Distribution'
classifier = 'dist-with-deps'
description = "Builds -${classifier} archive, containing everything " +
"in the -${distZip.classifier} archive plus all dependencies."
group = 'Distribution'
archiveClassifier = 'dist-with-deps'
description = "Builds -${archiveClassifier} archive, containing everything " +
"in the -${distZip.archiveClassifier} archive plus all dependencies."
from zipTree(distZip.archivePath)
from zipTree(distZip.archiveFile)
gradle.taskGraph.whenReady { taskGraph ->
if (taskGraph.hasTask(":${zipTask.name}")) {
def projectName = rootProject.name
def artifacts = new HashSet()
gradle.taskGraph.whenReady { taskGraph ->
if (taskGraph.hasTask(":${zipTask.name}")) {
def projectName = rootProject.name
def artifacts = new HashSet()
rootProject.configurations.runtime.resolvedConfiguration.resolvedArtifacts.each { artifact ->
def dependency = artifact.moduleVersion.id
if (!projectName.equals(dependency.name)) {
artifacts << artifact.file
}
}
rootProject.configurations.runtime.resolvedConfiguration.resolvedArtifacts.each { artifact ->
def dependency = artifact.moduleVersion.id
if (!projectName.equals(dependency.name)) {
artifacts << artifact.file
}
}
zipTask.from(artifacts) {
into "${distZip.baseDir}/deps"
}
}
}
}
artifacts {
archives distZip
archives docsZip
archives schemaZip
zipTask.from(artifacts) {
into "${distZip.baseDir}/deps"
}
}
}
}
task dist(dependsOn: assemble) {
group = 'Distribution'
description = 'Builds -dist, -docs and -schema distribution archives.'
group = 'Distribution'
description = 'Builds -dist, -docs and -schema distribution archives.'
}
apply from: "${rootProject.projectDir}/publish-maven.gradle"

View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@@ -82,6 +82,7 @@ esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
@@ -129,6 +130,7 @@ fi
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
@@ -154,19 +156,19 @@ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
i=`expr $i + 1`
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
@@ -175,14 +177,9 @@ save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"

View File

@@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@@ -81,6 +84,7 @@ set CMD_LINE_ARGS=%*
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%

View File

@@ -1,79 +1,60 @@
apply plugin: 'maven'
apply plugin: 'maven-publish'
ext.optionalDeps = []
ext.providedDeps = []
ext.optional = { optionalDeps << it }
ext.provided = { providedDeps << it }
install {
repositories.mavenInstaller {
customizePom(pom, project)
}
}
def customizePom(pom, gradleProject) {
pom.whenConfigured { generatedPom ->
// respect 'optional' and 'provided' dependencies
gradleProject.optionalDeps.each { dep ->
generatedPom.dependencies.find { it.artifactId == dep.name }?.optional = true
}
gradleProject.providedDeps.each { dep ->
generatedPom.dependencies.find { it.artifactId == dep.name }?.scope = 'provided'
}
// eliminate test-scoped dependencies (no need in maven central poms)
generatedPom.dependencies.removeAll { dep ->
dep.scope == 'test'
}
// add all items necessary for maven central publication
generatedPom.project {
name = gradleProject.description
description = gradleProject.description
url = linkHomepage
organization {
name = 'SpringIO'
url = 'https://spring.io'
}
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'https://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
publishing {
publications {
mavenJava(MavenPublication) {
suppressAllPomMetadataWarnings()
from components.java
artifact docsZip
artifact schemaZip
artifact distZip
pom {
afterEvaluate {
name = project.description
description = project.description
}
}
scm {
url = linkScmUrl
connection = 'scm:git:' + linkScmConnection
developerConnection = 'scm:git:' + linkScmDevConnection
}
issueManagement {
system = "Jira"
url = linkIssue
}
developers {
developer {
id = 'garyrussell'
name = 'Gary Russell'
email = 'grussell@pivotal.io'
roles = ["project lead"]
organization {
name = 'Spring IO'
url = 'https://spring.io/projects/spring-integration'
}
developer {
id = 'ghillert'
name = 'Gunnar Hillert'
email = 'ghillert@pivotal.io'
licenses {
license {
name = 'Apache License, Version 2.0'
url = 'https://www.apache.org/licenses/LICENSE-2.0'
distribution = 'repo'
}
}
developer {
id = 'abilan'
name = 'Artem Bilan'
email = 'abilan@pivotal.io'
scm {
url = linkScmUrl
connection = linkScmConnection
developerConnection = linkScmDevConnection
}
developers {
developer {
id = 'artembilan'
name = 'Artem Bilan'
email = 'abilan@pivotal.io'
roles = ['project lead']
}
}
issueManagement {
system = 'GitHub'
url = linkIssue
}
}
versionMapping {
usage('java-api') {
fromResolutionResult()
}
usage('java-runtime') {
fromResolutionResult()
}
}
}
}
}
artifactoryPublish {
publications(publishing.publications.mavenJava)
}

View File

@@ -2,36 +2,32 @@
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<module name="Checker">
<module name="SuppressionFilter">
<property name="file" value="src/checkstyle/checkstyle-suppressions.xml" />
<property name="file" value="${config_loc}/checkstyle-suppressions.xml"/>
</module>
<!-- Root Checks -->
<module name="RegexpHeader">
<property name="headerFile" value="src/checkstyle/checkstyle-header.txt" />
<property name="headerFile" value="${config_loc}/checkstyle-header.txt"/>
<property name="fileExtensions" value="java" />
</module>
<module name="NewlineAtEndOfFile">
<property name="lineSeparator" value="lf"/>
</module>
<module name="NewlineAtEndOfFile"/>
<!-- TreeWalker Checks -->
<module name="TreeWalker">
<!-- Annotations -->
<module name="AnnotationUseStyle">
<property name="elementStyle" value="compact" />
</module>
<module name="MissingOverride" />
<module name="PackageAnnotation" />
<module name="AnnotationLocation">
<property name="allowSamelineSingleParameterlessAnnotation"
value="false" />
</module>
<module name="AnnotationUseStyle">
<property name="elementStyle" value="compact" />
</module>
<module name="MissingOverride" />
<module name="PackageAnnotation" />
<module name="AnnotationLocation">
<property name="allowSamelineSingleParameterlessAnnotation"
value="false" />
</module>
<!-- Block Checks -->
<module name="EmptyBlock">
@@ -56,7 +52,7 @@
<module name="CovariantEquals" />
<module name="EmptyStatement" />
<module name="EqualsHashCode" />
<module name="InnerAssignment" />
<module name="InnerAssignment" />
<module name="SimplifyBooleanExpression" />
<module name="SimplifyBooleanReturn" />
<module name="StringLiteralEquality" />
@@ -71,6 +67,7 @@
</module>
<module name="MultipleVariableDeclarations" />
<module name="RequireThis">
<property name="validateOnlyOverlapping" value="false" />
<property name="checkMethods" value="false" />
</module>
<module name="OneStatementPerLine" />
@@ -79,18 +76,15 @@
<module name="AvoidStarImport" />
<module name="AvoidStaticImport">
<property name="excludes"
value="org.assertj.core.api.Assertions.*,
value="org.assertj.core.api.Assertions.*,
org.junit.Assert.*,
org.junit.Assume.*,
org.junit.internal.matchers.ThrowableMessageMatcher.*,
org.hamcrest.CoreMatchers.*,
org.hamcrest.Matchers.*,
org.mockito.Mockito.*,
org.mockito.BDDMockito.*,
org.mockito.ArgumentMatchers.*,
org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*,
org.springframework.test.web.servlet.result.MockMvcResultMatchers.*,
org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.*,
org.springframework.security.test.web.servlet.setup.SecurityMockMvcConfigurers.*" />
org.mockito.Matchers.*" />
</module>
<module name="IllegalImport" />
<module name="RedundantImport" />
@@ -106,31 +100,29 @@
</module>
<!-- Javadoc Comments -->
<!-- <module name="JavadocType"> -->
<!-- <property name="scope" value="package"/> -->
<!-- <property name="authorFormat" value=".+\s.+"/> -->
<!-- </module> -->
<!-- <module name="JavadocMethod"> -->
<!-- <property name="allowMissingJavadoc" value="true" /> -->
<!-- </module> -->
<!-- <module name="JavadocVariable"> -->
<!-- <property name="scope" value="public"/> -->
<!-- </module> -->
<!-- <module name="JavadocStyle"> -->
<!-- <property name="checkEmptyJavadoc" value="true"/> -->
<!-- </module> -->
<!-- <module name="NonEmptyAtclauseDescription" /> -->
<!-- <module name="JavadocTagContinuationIndentation"> -->
<!-- <property name="offset" value="0"/> -->
<!-- </module> -->
<!-- <module name="AtclauseOrder"> -->
<!-- <property name="target" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF"/> -->
<!-- <property name="tagOrder" value="@param, @author, @since, @see, @version, @serial, @deprecated"/> -->
<!-- </module> -->
<!-- <module name="AtclauseOrder"> -->
<!-- <property name="target" value="METHOD_DEF, CTOR_DEF, VARIABLE_DEF"/> -->
<!-- <property name="tagOrder" value="@param, @return, @throws, @since, @deprecated, @see"/> -->
<!-- </module> -->
<module name="JavadocType">
<property name="scope" value="package"/>
<property name="authorFormat" value=".+\s.+"/>
</module>
<module name="JavadocMethod"/>
<module name="JavadocVariable">
<property name="scope" value="public"/>
</module>
<module name="JavadocStyle">
<property name="checkEmptyJavadoc" value="true"/>
</module>
<module name="NonEmptyAtclauseDescription" />
<module name="JavadocTagContinuationIndentation">
<property name="offset" value="0"/>
</module>
<module name="AtclauseOrder">
<property name="target" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF"/>
<property name="tagOrder" value="@param, @author, @since, @see, @version, @serial, @deprecated"/>
</module>
<module name="AtclauseOrder">
<property name="target" value="METHOD_DEF, CTOR_DEF, VARIABLE_DEF"/>
<property name="tagOrder" value="@param, @return, @throws, @since, @deprecated, @see"/>
</module>
<!-- Miscellaneous -->
<module name="CommentsIndentation">
@@ -144,37 +136,36 @@
<module name="RedundantModifier" />
<!-- Regexp -->
<module name="RegexpSinglelineJava">
<property name="format" value="^\t* +\t*\S" />
<property name="message"
value="Line has leading space characters; indentation should be performed with tabs only." />
<property name="ignoreComments" value="true" />
</module>
<!-- <module name="RegexpSinglelineJava"> -->
<!-- <property name="maximum" value="0"/> -->
<!-- <property name="format" value="org\.mockito\.Mockito\.(when|doThrow|doAnswer)" /> -->
<!-- <property name="message" -->
<!-- value="Please use BDDMockto imports." /> -->
<!-- <property name="ignoreComments" value="true" /> -->
<!-- </module> -->
<!-- <module name="RegexpSinglelineJava"> -->
<!-- <property name="maximum" value="0"/> -->
<!-- <property name="format" value="org\.junit\.Assert\.assert" /> -->
<!-- <property name="message" -->
<!-- value="Please use AssertJ imports." /> -->
<!-- <property name="ignoreComments" value="true" /> -->
<!-- </module> -->
<module name="Regexp">
<property name="format" value="System.(out|err).print" />
<property name="illegalPattern" value="true" />
<property name="message" value="System.out or .err" />
<module name="RegexpSinglelineJava">
<property name="format" value="^\t* +\t*\S" />
<property name="message"
value="Line has leading space characters; indentation should be performed with tabs only." />
<property name="ignoreComments" value="true" />
</module>
<!--<module name="RegexpSinglelineJava">
<property name="maximum" value="0"/>
<property name="format" value="org\.mockito\..*Mockito\.(when|doThrow|doAnswer)" />
<property name="message"
value="Please use BDDMockito instead of Mockito.(when|doThrow|doAnswer)." />
<property name="ignoreComments" value="true" />
</module>-->
<!--<module name="RegexpSinglelineJava">
<property name="maximum" value="0"/>
<property name="format" value="org\.junit\.Assert\.assert" />
<property name="message"
value="Please use AssertJ imports." />
<property name="ignoreComments" value="true" />
</module>-->
<module name="Regexp">
<property name="format" value="[ \t]+$" />
<property name="illegalPattern" value="true" />
<property name="message" value="Trailing whitespace" />
</module>
<module name="Regexp">
<property name="format" value="System.(out|err).print" />
<property name="illegalPattern" value="true" />
<property name="message" value="System.out or .err" />
</module>
<!-- Whitespace -->
<module name="GenericWhitespace" />
<module name="MethodParamPad" />

View File

@@ -21,6 +21,8 @@ import org.springframework.integration.file.remote.RemoteFileOperations;
import org.springframework.integration.smb.session.SmbRemoteFileTemplate;
/**
* The parser for {@code <Int-smb:outbound-channel-adapter>}.
*
* @author Artem Bilan
*/
public class SmbOutboundChannelAdapterParser extends RemoteFileOutboundChannelAdapterParser {

View File

@@ -54,13 +54,13 @@ public class SmbConfig {
private boolean useTempFile = false;
/**
* Defaults to and follows the jCIFS library default of 'SMB1'
* Defaults to and follows the jCIFS library default of 'SMB1'.
* @since 1.2
*/
private DialectVersion smbMinVersion = DialectVersion.SMB1;
/**
* Defaults to and follows the jCIFS library default of 'SMB210'
* Defaults to and follows the jCIFS library default of 'SMB210'.
* @since 1.2
*/
private DialectVersion smbMaxVersion = DialectVersion.SMB210;

View File

@@ -22,6 +22,8 @@ import org.springframework.integration.file.remote.session.SessionFactory;
import jcifs.smb.SmbFile;
/**
* The SMP-specific {@link RemoteFileTemplate} implementation.
*
* @author Artem Bilan
*/
public class SmbRemoteFileTemplate extends RemoteFileTemplate<SmbFile> {

View File

@@ -37,6 +37,8 @@ import jcifs.smb.SmbException;
import jcifs.smb.SmbFile;
/**
* The {@link SmbFile} extension to represent an SMB share directory.
*
* @author Markus Spann
* @author Gregory Bragg
* @author Adam Jones
@@ -53,16 +55,6 @@ public class SmbShare extends SmbFile {
private final AtomicBoolean closeContext = new AtomicBoolean(false);
/**
* @deprecated as of release 1.1.0, use {@link #SmbShare(SmbConfig)} instead.
* @param url do not use
* @throws IOException do not use
*/
@Deprecated
public SmbShare(String url) throws IOException {
super(StringUtils.cleanPath(url));
}
/**
* Initializes the jCIFS library with default properties.
* @param _smbConfig the SMB share configuration
@@ -155,14 +147,6 @@ public class SmbShare extends SmbFile {
return this.open.get();
}
/**
* @deprecated use {@link #close()} instead.
*/
@Deprecated
void doClose() {
close();
}
@Override
public synchronized void close() {
this.open.set(false);

View File

@@ -1,56 +0,0 @@
/*
* 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.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.smb.session;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
/**
* @author Markus Spann
* @since 1.0
*/
public final class SmbUtils {
private SmbUtils() {
}
/**
* Read the specified file into a byte array.
* @param _file file
* @return byte array of file contents
* @throws IOException the IO exception
*/
public static byte[] readFile(File _file) throws IOException {
FileInputStream stream = new FileInputStream(_file);
try {
FileChannel fc = stream.getChannel();
MappedByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size());
return bb.array();
/* Instead of using default, pass in a decoder. */
// return Charset.defaultCharset().decode(bb).toString();
}
finally {
stream.close();
}
}
}

View File

@@ -1,4 +1,4 @@
http\://www.springframework.org/schema/integration/smb/spring-integration-smb-1.0.xsd=org/springframework/integration/smb/config/spring-integration-smb-1.0.xsd
http\://www.springframework.org/schema/integration/smb/spring-integration-smb.xsd=org/springframework/integration/smb/config/spring-integration-smb-1.0.xsd
https\://www.springframework.org/schema/integration/smb/spring-integration-smb-1.0.xsd=org/springframework/integration/smb/config/spring-integration-smb-1.0.xsd
https\://www.springframework.org/schema/integration/smb/spring-integration-smb.xsd=org/springframework/integration/smb/config/spring-integration-smb-1.0.xsd
http\://www.springframework.org/schema/integration/smb/spring-integration-smb-1.0.xsd=org/springframework/integration/smb/config/spring-integration-smb.xsd
http\://www.springframework.org/schema/integration/smb/spring-integration-smb.xsd=org/springframework/integration/smb/config/spring-integration-smb.xsd
https\://www.springframework.org/schema/integration/smb/spring-integration-smb-1.0.xsd=org/springframework/integration/smb/config/spring-integration-smb.xsd
https\://www.springframework.org/schema/integration/smb/spring-integration-smb.xsd=org/springframework/integration/smb/config/spring-integration-smb.xsd

View File

@@ -21,6 +21,7 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import java.nio.charset.Charset;
import java.util.Iterator;
import java.util.Set;
@@ -60,7 +61,7 @@ public class SmbOutboundChannelAdapterParserTests extends AbstractBaseTests {
assertEquals(".working.tmp", TestUtils.getPropertyValue(messageHandler, "remoteFileTemplate.temporaryFileSuffix", String.class));
assertEquals(".", remoteFileSeparator);
assertEquals(ac.getBean("fileNameGenerator"), TestUtils.getPropertyValue(messageHandler, "remoteFileTemplate.fileNameGenerator"));
assertEquals("UTF-8", TestUtils.getPropertyValue(messageHandler, "remoteFileTemplate.charset"));
assertEquals("UTF-8", TestUtils.getPropertyValue(messageHandler, "remoteFileTemplate.charset", Charset.class).name());
Object sessionFactoryProp = TestUtils.getPropertyValue(messageHandler, "remoteFileTemplate.sessionFactory");
assertEquals(SmbSessionFactory.class, sessionFactoryProp.getClass());