GH-168: Upgrade to SI-4.3.6 and others

Fixes GH-168 (https://github.com/spring-projects/spring-integration-extensions/issues/168)
This commit is contained in:
Artem Bilan
2017-01-16 13:04:55 -05:00
parent f4990eebd8
commit 0c7063588c
44 changed files with 908 additions and 525 deletions

View File

@@ -0,0 +1,12 @@
language: java
jdk: oraclejdk8
sudo: false
before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
cache:
directories:
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/
install: true
script:
- ./gradlew check --no-daemon

View File

@@ -3,7 +3,7 @@ Spring Integration Smb Support
## Introduction
This module add Spring Integration* support for [Server Message Block][] (SMB).
This module add Spring Integration support for [Server Message Block][] (SMB).
[Server Message Block]: http://en.wikipedia.org/wiki/Server_Message_Block

View File

@@ -1,43 +1,62 @@
description = 'Spring Integration SMB Support'
buildscript {
repositories {
maven { url 'https://repo.springsource.org/plugins-snapshot' }
maven { url 'https://repo.spring.io/plugins-release' }
}
dependencies {
classpath 'org.springframework.build.gradle:docbook-reference-plugin:0.1.5'
classpath 'io.spring.gradle:dependency-management-plugin:1.0.0.RC2'
classpath 'io.spring.gradle:spring-io-plugin:0.0.6.RELEASE'
classpath 'io.spring.gradle:docbook-reference-plugin:0.3.1'
}
}
apply plugin: 'java'
plugins {
id 'java'
id 'eclipse'
id 'idea'
id 'jacoco'
id 'checkstyle'
id 'org.sonarqube' version '2.1'
}
description = 'Spring Integration SMB Support'
apply from: "${rootProject.projectDir}/publish-maven.gradle"
apply plugin: 'eclipse'
apply plugin: 'idea'
group = 'org.springframework.integration'
repositories {
maven { url 'http://repo.springsource.org/libs-milestone' }
maven { url 'http://repo.springsource.org/plugins-release' } // for bundlor
if (version.endsWith('BUILD-SNAPSHOT') || project.hasProperty('platformVersion')) {
maven { url 'http://repo.spring.io/libs-snapshot' }
}
maven { url 'http://repo.spring.io/libs-milestone' }
}
// ensure JDK 5 compatibility (GRADLE-18; INT-1578)
sourceCompatibility=1.6
targetCompatibility=1.6
if (project.hasProperty('platformVersion')) {
apply plugin: 'spring-io'
dependencyManagement {
springIoTestRuntime {
imports {
mavenBom "io.spring.platform:platform-bom:${platformVersion}"
}
}
}
}
compileJava {
sourceCompatibility = 1.7
targetCompatibility = 1.7
}
compileTestJava {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
ext {
aspectjVersion = '1.6.8'
cglibVersion = '2.2'
commonsNetVersion = '3.0.1'
groovyVersion = '1.8.5'
jacksonVersion = '1.9.2'
javaxActivationVersion = '1.1.1'
junitVersion = '4.11'
log4jVersion = '1.2.12'
mockitoVersion = '1.9.0'
springVersion = '3.1.3.RELEASE'
springIntegrationVersion = '2.2.1.RELEASE'
jcifsVersion = '1.3.18.2'
log4jVersion = '1.2.17'
springIntegrationVersion = '4.3.6.RELEASE'
idPrefix = 'smb'
@@ -50,24 +69,7 @@ ext {
}
dependencies {
compile "org.springframework.integration:spring-integration-core:$springIntegrationVersion"
compile "org.springframework.integration:spring-integration-file:$springIntegrationVersion"
compile "org.springframework.integration:spring-integration-stream:$springIntegrationVersion"
compile "jcifs:jcifs:1.3.17"
compile "org.springframework:spring-context-support:$springVersion"
compile("javax.activation:activation:$javaxActivationVersion", optional)
testCompile "org.springframework.integration:spring-integration-test:$springIntegrationVersion"
}
eclipse {
project {
natures += 'org.springframework.ide.eclipse.core.springnature'
}
}
eclipse.project.natures += 'org.springframework.ide.eclipse.core.springnature'
sourceSets {
test {
@@ -77,31 +79,43 @@ sourceSets {
}
}
// See http://www.gradle.org/docs/current/userguide/dependency_management.html#sub:configurations
// and http://www.gradle.org/docs/current/dsl/org.gradle.api.artifacts.ConfigurationContainer.html
configurations {
jacoco //Configuration Group used by Sonar to provide Code Coverage using JaCoCo
jacoco {
toolVersion = "0.7.8"
}
checkstyle {
configFile = file("$rootDir/src/checkstyle/checkstyle.xml")
toolVersion = "6.16.1"
}
// dependencies that are common across all java projects
dependencies {
testCompile "cglib:cglib-nodep:$cglibVersion"
testCompile "junit:junit-dep:$junitVersion"
testCompile "log4j:log4j:$log4jVersion"
testCompile "org.hamcrest:hamcrest-all:1.1"
testCompile "org.mockito:mockito-all:$mockitoVersion"
testCompile "org.springframework:spring-test:$springVersion"
jacoco group: "org.jacoco", name: "org.jacoco.agent", version: "0.5.6.201201232323", classifier: "runtime"
compile "org.codelibs:jcifs:$jcifsVersion"
compile "org.springframework.integration:spring-integration-file:$springIntegrationVersion"
compile "org.springframework.integration:spring-integration-stream:$springIntegrationVersion"
testCompile "org.springframework.integration:spring-integration-test:$springIntegrationVersion"
testRuntime "log4j:log4j:$log4jVersion"
}
// enable all compiler warnings; individual projects may customize further
ext.xLintArg = '-Xlint:all'
[compileJava, compileTestJava]*.options*.compilerArgs = [xLintArg]
[compileJava, compileTestJava]*.options*.compilerArgs = ['-Xlint:all,-options,-processing']
jacocoTestReport {
reports {
xml.enabled false
csv.enabled false
html.destination "${buildDir}/reports/jacoco/html"
}
}
test {
// suppress all console output during testing unless running `gradle -i`
logging.captureStandardOutput(LogLevel.INFO)
jvmArgs "-javaagent:${configurations.jacoco.asPath}=destfile=${buildDir}/jacoco.exec,includes=*"
maxHeapSize = "1024m"
jacoco {
append = false
destinationFile = file("$buildDir/jacoco.exec")
}
}
task sourcesJar(type: Jar) {
@@ -125,10 +139,8 @@ reference {
sourceDir = file('src/reference/docbook')
}
apply plugin: 'sonar-runner'
sonarRunner {
sonarProperties {
sonarqube {
properties {
property "sonar.jacoco.reportPath", "${buildDir.name}/jacoco.exec"
property "sonar.links.homepage", linkHomepage
property "sonar.links.ci", linkCi
@@ -150,7 +162,7 @@ task api(type: Javadoc) {
source = sourceSets.main.allJava
classpath = project.sourceSets.main.compileClasspath
destinationDir = new File(buildDir, "api")
destinationDir = file("$buildDir/api")
}
task schemaZip(type: Zip) {
@@ -163,15 +175,15 @@ task schemaZip(type: Zip) {
def shortName = idPrefix.replaceFirst("${idPrefix}-", '')
project.sourceSets.main.resources.find {
it.path.endsWith('META-INF/spring.schemas')
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.endsWith(schemas.get(key))
it.path.replaceAll('\\\\', '/').endsWith(schemas.get(key))
}
assert xsdFile != null
into ("integration/${shortName}") {
into("integration/${shortName}") {
from xsdFile.path
}
}
@@ -266,8 +278,3 @@ task dist(dependsOn: assemble) {
group = 'Distribution'
description = 'Builds -dist, -docs and -schema distribution archives.'
}
task wrapper(type: Wrapper) {
description = 'Generates gradlew[.bat] scripts'
gradleVersion = '1.6'
}

View File

@@ -1 +1 @@
version=1.0.0.BUILD-SNAPSHOT
version=0.5.0.BUILD-SNAPSHOT

View File

@@ -1,6 +1,6 @@
#Wed May 15 22:13:48 EDT 2013
#Mon Jan 16 10:37:27 EST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-1.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-bin.zip

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/usr/bin/env sh
##############################################################################
##
@@ -6,12 +6,30 @@
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
@@ -30,6 +48,7 @@ die ( ) {
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
@@ -40,31 +59,11 @@ case "`uname`" in
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >&-
APP_HOME="`pwd -P`"
cd "$SAVED" >&-
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
@@ -90,7 +89,7 @@ location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
@@ -114,6 +113,7 @@ fi
if $cygwin ; 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
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
@@ -154,11 +154,19 @@ if $cygwin ; then
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
# Escape application args
save ( ) {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
APP_ARGS=$(save "$@")
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
# 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

@@ -8,14 +8,14 @@
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@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=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@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=
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
@@ -46,10 +46,9 @@ echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
@@ -60,11 +59,6 @@ set _SKIP=2
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line

View File

@@ -31,10 +31,10 @@ def customizePom(pom, gradleProject) {
generatedPom.project {
name = gradleProject.description
description = gradleProject.description
url = 'https://github.com/SpringSource/spring-integration-extensions'
url = linkHomepage
organization {
name = 'SpringSource'
url = 'http://springsource.org'
name = 'SpringIO'
url = 'http://spring.io'
}
licenses {
license {
@@ -43,19 +43,37 @@ def customizePom(pom, gradleProject) {
distribution 'repo'
}
}
scm {
url = 'https://github.com/SpringSource/spring-integration-extensions'
connection = 'scm:git:git://github.com/SpringSource/spring-integration-extensions'
developerConnection = 'scm:git:git://github.com/SpringSource/spring-integration-extensions'
url = linkScmUrl
connection = 'scm:git:' + linkScmConnection
developerConnection = 'scm:git:' + linkScmDevConnection
}
issueManagement {
system = "Jira"
url = linkIssue
}
developers {
developer {
id = 'not specified'
name = 'Markus Spann'
email = 'not specified'
id = 'garyrussell'
name = 'Gary Russell'
email = 'grussell@pivotal.io'
roles = ["project lead"]
}
developer {
id = 'ghillert'
name = 'Gunnar Hillert'
email = 'ghillert@pivotal.io'
}
developer {
id = 'abilan'
name = 'Artem Bilan'
email = 'abilan@pivotal.io'
}
}
}
}
}

View File

@@ -0,0 +1 @@
rootProject.name = 'spring-integration-smb'

View File

@@ -5,7 +5,7 @@ This document is the API specification for Spring Integration
<div id="overviewBody">
<p>
For further API reference and developer documentation, see the
<a href="http://static.springsource.org/spring-integration/reference" target="_top">Spring
<a href="http://docs.spring.io/spring-integration/reference/html" target="_top">Spring
Integration reference documentation</a>.
That documentation contains more detailed, developer-targeted
descriptions, with conceptual overviews, definitions of terms,
@@ -14,8 +14,8 @@ This document is the API specification for Spring Integration
<p>
If you are interested in commercial training, consultancy, and
support for Spring Integration, please visit <a href="http://www.springsource.com" target="_top">
http://www.springsource.com</a>
support for Spring Integration, please visit <a href="https://spring.io" target="_top">
https://spring.io</a>
</p>
</div>
</body>

View File

@@ -0,0 +1,17 @@
^\Q/*\E$
^\Q * Copyright \E20\d\d(\-20\d\d)?\Q the original author or authors.\E$
^\Q *\E$
^\Q * Licensed under the Apache License, Version 2.0 (the "License");\E$
^\Q * you may not use this file except in compliance with the License.\E$
^\Q * You may obtain a copy of the License at\E$
^\Q *\E$
^\Q * http://www.apache.org/licenses/LICENSE-2.0\E$
^\Q *\E$
^\Q * Unless required by applicable law or agreed to in writing, software\E$
^\Q * distributed under the License is distributed on an "AS IS" BASIS,\E$
^\Q * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\E$
^\Q * See the License for the specific language governing permissions and\E$
^\Q * limitations under the License.\E$
^\Q */\E$
^$
^.*$

View File

@@ -0,0 +1,13 @@
<?xml version="1.0"?>
<!DOCTYPE suppressions PUBLIC
"-//Puppy Crawl//DTD Suppressions 1.1//EN"
"http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
<suppressions>
<suppress files="package-info\.java" checks=".*" />
<suppress files="[\\/]test[\\/]" checks="RequireThis" />
<suppress files="[\\/]test[\\/]" checks="FinalClass" />
<suppress files="[\\/]test[\\/]" checks="AvoidStaticImport" />
<suppress files="[\\/]test[\\/]" checks="InnerTypeLast" />
<suppress files="CachingSessionFactory" checks="FinalClass" /> <!-- Tests spy -->
<suppress files="[\\/]test[\\/]" checks="Javadoc*" />
</suppressions>

View File

@@ -0,0 +1,188 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.2//EN" "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
<module name="Checker">
<module name="SuppressionFilter">
<property name="file" value="src/checkstyle/checkstyle-suppressions.xml" />
</module>
<!-- Root Checks -->
<module name="RegexpHeader">
<property name="headerFile" value="src/checkstyle/checkstyle-header.txt" />
<property name="fileExtensions" value="java" />
</module>
<module name="NewlineAtEndOfFile">
<property name="lineSeparator" value="lf"/>
</module>
<!-- 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> -->
<!-- Block Checks -->
<module name="EmptyBlock">
<property name="option" value="text" />
</module>
<module name="LeftCurly" />
<module name="RightCurly">
<property name="option" value="alone" />
</module>
<module name="NeedBraces" />
<module name="AvoidNestedBlocks" />
<!-- Class Design -->
<module name="FinalClass" />
<module name="InterfaceIsType" />
<module name="HideUtilityClassConstructor" />
<module name="MutableException" />
<module name="InnerTypeLast" />
<module name="OneTopLevelClass" />
<!-- Coding -->
<module name="CovariantEquals" />
<module name="EmptyStatement" />
<module name="EqualsHashCode" />
<!-- <module name="InnerAssignment" /> -->
<module name="SimplifyBooleanExpression" />
<module name="SimplifyBooleanReturn" />
<module name="StringLiteralEquality" />
<module name="NestedForDepth">
<property name="max" value="3" />
</module>
<module name="NestedIfDepth">
<property name="max" value="4" />
</module>
<module name="NestedTryDepth">
<property name="max" value="3" />
</module>
<module name="MultipleVariableDeclarations" />
<module name="RequireThis">
<property name="checkMethods" value="false" />
</module>
<module name="OneStatementPerLine" />
<!-- Imports -->
<module name="AvoidStarImport" />
<module name="AvoidStaticImport">
<property name="excludes"
value="org.assertj.core.api.Assertions.*,
org.junit.Assert.*,
org.junit.Assume.*,
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.*" />
</module>
<module name="IllegalImport" />
<module name="RedundantImport" />
<module name="UnusedImports">
<property name="processJavadoc" value="true" />
</module>
<!-- <module name="ImportOrder"> -->
<!-- <property name="groups" value="java,/^javax?\./,*,org.springframework" /> -->
<!-- <property name="ordered" value="true" /> -->
<!-- <property name="separated" value="true" /> -->
<!-- <property name="option" value="bottom" /> -->
<!-- <property name="sortStaticImportsAlphabetically" value="true" /> -->
<!-- </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> -->
<!-- Miscellaneous -->
<module name="CommentsIndentation">
<property name="tokens" value="BLOCK_COMMENT_BEGIN" />
</module>
<module name="UpperEll" />
<module name="ArrayTypeStyle" />
<module name="OuterTypeFilename" />
<!-- Modifiers -->
<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>
<module name="Regexp">
<property name="format" value="[ \t]+$" />
<property name="illegalPattern" value="true" />
<property name="message" value="Trailing whitespace" />
</module>
<!-- Whitespace -->
<module name="GenericWhitespace" />
<module name="MethodParamPad" />
<module name="NoWhitespaceAfter" >
<property name="tokens" value="BNOT, DEC, DOT, INC, LNOT, UNARY_MINUS, UNARY_PLUS, ARRAY_DECLARATOR"/>
</module>
<module name="NoWhitespaceBefore" />
<module name="ParenPad" />
<module name="TypecastParenPad" />
<module name="WhitespaceAfter" />
<module name="WhitespaceAround" />
</module>
</module>

View File

@@ -1,13 +1,13 @@
Spring Integration Smb Adapter
Spring Integration Smb Adapters
-----------------------------------
To find out what has changed since any earlier releases, see 'changelog.txt'.
Please consult the documentation located within the 'docs/reference' directory
of this release and also visit the official Spring Integration home at
http://www.springsource.org/spring-integration
http://spring.io/spring-integration
There you will find links to the forum, issue tracker, and several other resources.
See https://github.com/SpringSource/spring-integration#readme for additional
See https://github.com/spring-projects/spring-integration#readme for additional
information including instructions on building from source.

View File

@@ -1,5 +1,5 @@
/**
* Copyright 2002-2012 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.
@@ -13,39 +13,43 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.smb.config;
import org.springframework.integration.file.config.AbstractRemoteFileInboundChannelAdapterParser;
import org.springframework.integration.file.filters.FileListFilter;
import org.springframework.integration.file.remote.synchronizer.InboundFileSynchronizer;
import org.springframework.integration.smb.filters.SmbRegexPatternFileListFilter;
import org.springframework.integration.smb.filters.SmbSimplePatternFileListFilter;
import org.springframework.integration.smb.inbound.SmbInboundFileSynchronizer;
import org.springframework.integration.smb.inbound.SmbInboundFileSynchronizingMessageSource;
/**
* Parser for the SMB 'inbound-channel-adapter' element.
*
* @author Markus Spann
* @since 1.0
* @author Artem Bilan
*/
public class SmbInboundChannelAdapterParser extends AbstractRemoteFileInboundChannelAdapterParser {
private static final String BASE_PACKAGE = "org.springframework.integration.smb";
@Override
protected String getMessageSourceClassname() {
return BASE_PACKAGE + ".inbound.SmbInboundFileSynchronizingMessageSource";
return SmbInboundFileSynchronizingMessageSource.class.getName();
}
@Override
protected String getInboundFileSynchronizerClassname() {
return BASE_PACKAGE + ".inbound.SmbInboundFileSynchronizer";
protected Class<? extends InboundFileSynchronizer> getInboundFileSynchronizerClass() {
return SmbInboundFileSynchronizer.class;
}
@Override
protected String getSimplePatternFileListFilterClassname() {
return BASE_PACKAGE + ".filters.SmbSimplePatternFileListFilter";
protected Class<? extends FileListFilter<?>> getSimplePatternFileListFilterClass() {
return SmbSimplePatternFileListFilter.class;
}
@Override
protected String getRegexPatternFileListFilterClassname() {
return BASE_PACKAGE + ".filters.SmbRegexPatternFileListFilter";
protected Class<? extends FileListFilter<?>> getRegexPatternFileListFilterClass() {
return SmbRegexPatternFileListFilter.class;
}
}

View File

@@ -1,5 +1,5 @@
/**
* Copyright 2002-2012 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.
@@ -13,22 +13,22 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.smb.config;
import org.springframework.integration.config.xml.AbstractIntegrationNamespaceHandler;
import org.springframework.integration.file.config.RemoteFileOutboundChannelAdapterParser;
/**
* Provides namespace support for using SMB.
*
* @author Markus Spann
* @since 1.0
* @author Artem Bilan
*/
public class SmbNamespaceHandler extends AbstractIntegrationNamespaceHandler {
public void init() {
registerBeanDefinitionParser("inbound-channel-adapter", new SmbInboundChannelAdapterParser());
registerBeanDefinitionParser("outbound-channel-adapter", new RemoteFileOutboundChannelAdapterParser()); // TODO need implementation for SMB?
registerBeanDefinitionParser("inbound-channel-adapter", new SmbInboundChannelAdapterParser());
registerBeanDefinitionParser("outbound-channel-adapter", new SmbOutboundChannelAdapterParser());
}
}

View File

@@ -0,0 +1,33 @@
/*
* Copyright 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
*
* http://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.config;
import org.springframework.integration.file.config.RemoteFileOutboundChannelAdapterParser;
import org.springframework.integration.file.remote.RemoteFileOperations;
import org.springframework.integration.smb.session.SmbRemoteFileTemplate;
/**
* @author Artem Bilan
*/
public class SmbOutboundChannelAdapterParser extends RemoteFileOutboundChannelAdapterParser {
@Override
protected Class<? extends RemoteFileOperations<?>> getTemplateClass() {
return SmbRemoteFileTemplate.class;
}
}

View File

@@ -1,5 +1,5 @@
/**
* Copyright 2002-2012 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.
@@ -13,47 +13,39 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.smb.filters;
import java.util.regex.Pattern;
import jcifs.smb.SmbFile;
import org.springframework.integration.file.filters.AbstractRegexPatternFileListFilter;
import jcifs.smb.SmbFile;
/**
* Implementation of {@link AbstractRegexPatternFileListFilter} for SMB.
*
* @author Markus Spann
* @since 1.0
*/
public class SmbRegexPatternFileListFilter extends AbstractRegexPatternFileListFilter<SmbFile> {
private final String toString;
public SmbRegexPatternFileListFilter(String _pattern) {
this(Pattern.compile(_pattern));
public SmbRegexPatternFileListFilter(String pattern) {
this(Pattern.compile(pattern));
}
public SmbRegexPatternFileListFilter(Pattern _pattern) {
super(_pattern);
toString = getClass().getName() + "[pattern='" + _pattern + "']";
public SmbRegexPatternFileListFilter(Pattern pattern) {
super(pattern);
}
/**
* Gets the specified SMB file's name.
* @param _file SMB file object
* @param file SMB file object
* @return file name
* @see org.springframework.integration.file.filters.AbstractRegexPatternFileListFilter#getFilename(java.lang.Object)
* @see AbstractRegexPatternFileListFilter#getFilename(java.lang.Object)
*/
@Override
protected String getFilename(SmbFile _file) {
return (_file != null) ? _file.getName() : null;
}
@Override
public String toString() {
return toString;
protected String getFilename(SmbFile file) {
return (file != null ? file.getName() : null);
}
}

View File

@@ -1,5 +1,5 @@
/**
* Copyright 2002-2012 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.
@@ -13,42 +13,34 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.smb.filters;
import jcifs.smb.SmbFile;
import org.springframework.integration.file.filters.AbstractSimplePatternFileListFilter;
import jcifs.smb.SmbFile;
/**
* Implementation of {@link AbstractSimplePatternFileListFilter} for SMB.
*
* @author Markus Spann
* @since 1.0
*
*/
public class SmbSimplePatternFileListFilter extends AbstractSimplePatternFileListFilter<SmbFile> {
private final String toString;
public SmbSimplePatternFileListFilter(String _pathPattern) {
super(_pathPattern);
toString = getClass().getName() + "[pattern='" + _pathPattern + "']";
public SmbSimplePatternFileListFilter(String pathPattern) {
super(pathPattern);
}
/**
* Gets the specified SMB file's name.
* @param _file SMB file object
* @param file SMB file object
* @return file name
* @see org.springframework.integration.file.filters.AbstractSimplePatternFileListFilter#getFilename(java.lang.Object)
* @see AbstractSimplePatternFileListFilter#getFilename(java.lang.Object)
*/
@Override
protected String getFilename(SmbFile _file) {
return (_file != null) ? _file.getName() : null;
}
@Override
public String toString() {
return toString;
protected String getFilename(SmbFile file) {
return (file != null) ? file.getName() : null;
}
}

View File

@@ -1,5 +1,5 @@
/**
* Copyright 2002-2012 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.
@@ -13,41 +13,37 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.smb.inbound;
import jcifs.smb.SmbFile;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.integration.file.remote.session.SessionFactory;
import org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizer;
import jcifs.smb.SmbFile;
/**
* An implementation of {@link AbstractInboundFileSynchronizer} for SMB.
*
* @author Markus Spann
* @since 1.0
* @author Artem Bilan
*/
public class SmbInboundFileSynchronizer extends AbstractInboundFileSynchronizer<SmbFile> {
private final Log logger = LogFactory.getLog(SmbInboundFileSynchronizer.class);
private final String toString;
/**
* Create a synchronizer with the {@link SessionFactory} used to acquire
* {@link org.springframework.integration.file.remote.session.Session} instances.
* @param sessionFactory the {@link SessionFactory} to use.
*/
public SmbInboundFileSynchronizer(SessionFactory<SmbFile> _sessionFactory) {
super(_sessionFactory);
toString = getClass().getName() + "[sessionFactory=" + _sessionFactory + "]";
public SmbInboundFileSynchronizer(SessionFactory<SmbFile> sessionFactory) {
super(sessionFactory);
}
@Override
protected boolean isFile(SmbFile _file) {
try {
return _file != null && _file.isFile();
} catch (Exception _ex) {
}
catch (Exception _ex) {
logger.warn("Unable to get resource status [" + _file + "].", _ex);
}
return false;
@@ -59,8 +55,8 @@ public class SmbInboundFileSynchronizer extends AbstractInboundFileSynchronizer<
}
@Override
public String toString() {
return toString;
protected long getModified(SmbFile file) {
return file.getLastModified();
}
}

View File

@@ -1,5 +1,5 @@
/**
* Copyright 2002-2012 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.
@@ -13,16 +13,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.smb.inbound;
import java.io.File;
import java.util.Comparator;
import jcifs.smb.SmbFile;
import org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizer;
import org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizingMessageSource;
import jcifs.smb.SmbFile;
/**
* A {@link org.springframework.integration.core.MessageSource} implementation for SMB.
*
@@ -31,26 +32,18 @@ import org.springframework.integration.file.remote.synchronizer.AbstractInboundF
*/
public class SmbInboundFileSynchronizingMessageSource extends AbstractInboundFileSynchronizingMessageSource<SmbFile> {
private final static String componentType = "smb:inbound-channel-adapter";
private final String toString;
public SmbInboundFileSynchronizingMessageSource(AbstractInboundFileSynchronizer<SmbFile> _synchronizer) {
this(_synchronizer, null);
}
public SmbInboundFileSynchronizingMessageSource(AbstractInboundFileSynchronizer<SmbFile> _synchronizer, Comparator<File> _comparator) {
public SmbInboundFileSynchronizingMessageSource(AbstractInboundFileSynchronizer<SmbFile> _synchronizer,
Comparator<File> _comparator) {
super(_synchronizer, _comparator);
toString = getClass().getName() + "[componentType=" + componentType + ", synchronizer=" + _synchronizer + ", comparator=" + _comparator + "]";
}
@Override
public String getComponentType() {
return componentType;
}
@Override
public String toString() {
return toString;
return "smb:inbound-channel-adapter";
}
}

View File

@@ -1,5 +1,5 @@
/**
* Copyright 2002-2012 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.
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.smb.session;
import java.io.UnsupportedEncodingException;
@@ -32,22 +33,27 @@ import org.springframework.util.StringUtils;
*/
public class SmbConfig {
private String host;
private int port;
private String domain;
private String username;
private String password;
private String shareAndDir;
private String host;
private int port;
private String domain;
private String username;
private String password;
private String shareAndDir;
private boolean replaceFile = false;
private boolean useTempFile = false;
public SmbConfig() {
}
public SmbConfig(String _host, int _port, String _domain, String _username, String _password, String _shareAndDir) throws UnsupportedEncodingException {
this();
public SmbConfig(String _host, int _port, String _domain, String _username, String _password, String _shareAndDir)
throws UnsupportedEncodingException {
setHost(_host);
setPort(_port);
setDomain(_domain);
@@ -62,7 +68,7 @@ public class SmbConfig {
}
public String getHost() {
return host;
return this.host;
}
public void setPort(int _port) {
@@ -71,7 +77,7 @@ public class SmbConfig {
}
public int getPort() {
return port;
return this.port;
}
public void setDomain(String _domain) {
@@ -80,7 +86,7 @@ public class SmbConfig {
}
public String getDomain() {
return domain;
return this.domain;
}
public void setUsername(String _username) {
@@ -89,7 +95,7 @@ public class SmbConfig {
}
public String getUsername() {
return username;
return this.username;
}
public void setPassword(String _password) {
@@ -98,7 +104,7 @@ public class SmbConfig {
}
public String getPassword() {
return password;
return this.password;
}
public void setShareAndDir(String _shareAndDir) {
@@ -107,7 +113,7 @@ public class SmbConfig {
}
public String getShareAndDir() {
return shareAndDir;
return this.shareAndDir;
}
public void setReplaceFile(boolean _replaceFile) {
@@ -115,7 +121,7 @@ public class SmbConfig {
}
public boolean isReplaceFile() {
return replaceFile;
return this.replaceFile;
}
void setUseTempFile(boolean _useTempFile) {
@@ -123,7 +129,7 @@ public class SmbConfig {
}
public boolean isUseTempFile() {
return useTempFile;
return this.useTempFile;
}
String getDomainUserPass(boolean _includePassword) {
@@ -131,7 +137,8 @@ public class SmbConfig {
String user = _includePassword ? this.username : "********";
if (StringUtils.hasText(this.domain)) {
domainUserPass = String.format("%s;%s", this.domain, user);
} else {
}
else {
domainUserPass = user;
}
if (StringUtils.hasText(this.password)) {
@@ -176,7 +183,7 @@ public class SmbConfig {
public String toString() {
return getClass().getSimpleName()
+ "[url=" + getUrl(false)
+ ", replaceFile=" + replaceFile
+ ", replaceFile=" + this.replaceFile
+ "]";
}

View File

@@ -0,0 +1,37 @@
/*
* Copyright 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
*
* http://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 org.springframework.integration.file.remote.RemoteFileTemplate;
import org.springframework.integration.file.remote.session.SessionFactory;
import jcifs.smb.SmbFile;
/**
* @author Artem Bilan
*/
public class SmbRemoteFileTemplate extends RemoteFileTemplate<SmbFile> {
/**
* Construct a {@link SmbRemoteFileTemplate} with the supplied session factory.
* @param sessionFactory the session factory.
*/
public SmbRemoteFileTemplate(SessionFactory<SmbFile> sessionFactory) {
super(sessionFactory);
}
}

View File

@@ -1,5 +1,5 @@
/**
* Copyright 2002-2012 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.
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.smb.session;
import java.io.ByteArrayInputStream;
@@ -23,17 +24,19 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.util.Arrays;
import jcifs.smb.SmbException;
import jcifs.smb.SmbFile;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.core.NestedIOException;
import org.springframework.integration.file.remote.session.Session;
import org.springframework.util.Assert;
import org.springframework.util.FileCopyUtils;
import org.springframework.util.StringUtils;
import jcifs.smb.SmbException;
import jcifs.smb.SmbFile;
import jcifs.smb.SmbFileOutputStream;
/**
* Implementation of the {@link Session} interface for Server Message Block (SMB)
* also known as Common Internet File System (CIFS). The Samba project set out to
@@ -45,19 +48,18 @@ import org.springframework.util.StringUtils;
* See <a href="http://en.wikipedia.org/wiki/Server_Message_Block">Server Message Block</a>
* for more details.
*
* Inspired by the spring-integration-ftp implementation done by Mark Fisher
* and Oleg Zhurakousky.
*
* @author Markus Spann
* @author Mark Fisher
* @author Oleg Zhurakousky
* @author Artem Bilan
*
* @since 1.0
*/
public class SmbSession implements Session<SmbFile> {
private final Log logger = LogFactory.getLog(SmbSession.class);
private static final Log logger = LogFactory.getLog(SmbSession.class);
private static final String FILE_SEPARATOR = System.getProperty("file.separator");
private static final String SMB_FILE_SEPARATOR = "/";
static {
@@ -78,11 +80,12 @@ public class SmbSession implements Session<SmbFile> {
* @param _useTempFile make use temporary files when writing
* @throws IOException in case of I/O errors
*/
SmbSession(String _host, int _port, String _domain, String _user, String _password, String _shareAndDir, boolean _replaceFile, boolean _useTempFile) throws IOException {
SmbSession(String _host, int _port, String _domain, String _user, String _password, String _shareAndDir,
boolean _replaceFile, boolean _useTempFile) throws IOException {
this(new SmbShare(new SmbConfig(_host, _port, _domain, _user, _password, _shareAndDir)));
smbShare.setReplaceFile(_replaceFile);
smbShare.setUseTempFile(_useTempFile);
this.smbShare.setReplaceFile(_replaceFile);
this.smbShare.setUseTempFile(_useTempFile);
}
/**
@@ -91,8 +94,10 @@ public class SmbSession implements Session<SmbFile> {
*/
public SmbSession(SmbShare _smbShare) {
Assert.notNull(_smbShare, "smbShare must not be null");
smbShare = _smbShare;
logger.debug("New " + getClass().getName() + " created.");
this.smbShare = _smbShare;
if (logger.isDebugEnabled()) {
logger.debug("New " + getClass().getName() + " created.");
}
}
/**
@@ -100,8 +105,8 @@ public class SmbSession implements Session<SmbFile> {
* @param _path path to a remote file or directory
* @return true if delete successful, false if resource is non-existent
* @throws IOException on error conditions returned by a CIFS server
* @see org.springframework.integration.file.remote.session.Session#remove(java.lang.String)
*/
@Override
public boolean remove(String _path) throws IOException {
Assert.hasText(_path, "path must not be empty");
@@ -112,9 +117,10 @@ public class SmbSession implements Session<SmbFile> {
removeFile.delete();
removed = true;
}
if (!removed) {
if (!removed && logger.isInfoEnabled()) {
logger.info("Could not remove non-existing resource [" + _path + "].");
} else if (logger.isInfoEnabled()) {
}
else if (logger.isInfoEnabled()) {
logger.info("Successfully removed resource [" + _path + "].");
}
return removed;
@@ -126,29 +132,34 @@ public class SmbSession implements Session<SmbFile> {
* @param _path path to a remote directory
* @return array of SmbFile objects
* @throws IOException on error conditions returned by a CIFS server or if the remote resource is not a directory.
* @see org.springframework.integration.file.remote.session.Session#list(java.lang.String)
*/
@Override
public SmbFile[] list(String _path) throws IOException {
SmbFile[] files = new SmbFile[0];
try {
SmbFile smbDir = createSmbDirectoryObject(_path);
if (!smbDir.exists()) {
logger.warn("Remote directory [" + _path + "] does not exist. Cannot list resources.");
if (logger.isWarnEnabled()) {
logger.warn("Remote directory [" + _path + "] does not exist. Cannot list resources.");
}
return files;
} else if (!smbDir.isDirectory()) {
}
else if (!smbDir.isDirectory()) {
throw new NestedIOException("Resource [" + _path + "] is not a directory. Cannot list resources.");
}
files = smbDir.listFiles();
} catch (SmbException _ex) {
}
catch (SmbException _ex) {
throw new NestedIOException("Failed to list resources in [" + _path + "].", _ex);
}
String msg = "Successfully listed " + files.length + " resource(s) in [" + _path + "]";
if (logger.isDebugEnabled()) {
logger.debug(msg + ": " + Arrays.toString(files));
} else {
logger.info(msg + ".");
logger.debug("Successfully listed " + files.length + " resource(s) in [" + _path + "]"
+ ": " + Arrays.toString(files));
}
else if (logger.isInfoEnabled()) {
logger.info("Successfully listed " + files.length + " resource(s) in [" + _path + "]" + ".");
}
return files;
@@ -160,34 +171,36 @@ public class SmbSession implements Session<SmbFile> {
* @param _path path to a remote file
* @param _outputStream output stream
* @throws IOException on error conditions returned by a CIFS server or if the remote resource is not a file.
* @see org.springframework.integration.file.remote.session.Session#read(java.lang.String, java.io.OutputStream)
*/
@Override
public void read(String _path, OutputStream _outputStream) throws IOException {
Assert.hasText(_path, "path must not be empty");
Assert.notNull(_outputStream, "outputStream must not be null");
try {
SmbFile remoteFile = createSmbFileObject(_path);
if (!remoteFile.isFile()) {
throw new NestedIOException("Resource [" + _path + "] is not a file.");
}
FileCopyUtils.copy(remoteFile.getInputStream(), _outputStream);
} catch (SmbException _ex) {
}
catch (SmbException _ex) {
throw new NestedIOException("Failed to read resource [" + _path + "].", _ex);
}
logger.info("Successfully read resource [" + _path + "].");
if (logger.isInfoEnabled()) {
logger.info("Successfully read resource [" + _path + "].");
}
}
/**
* Writes contents of the specified {@link InputStream} to the remote resource
* specified by path. Remote directories are created implicitely as required.
* specified by path. Remote directories are created implicitly as required.
* @param _inputStream input stream
* @param _path remote path (of a file) to write to
* @throws IOException on error conditions returned by a CIFS server
* @see org.springframework.integration.file.remote.session.Session#write(java.io.InputStream, java.lang.String)
*/
@Override
public void write(InputStream _inputStream, String _path) throws IOException {
Assert.notNull(_inputStream, "inputStream must not be empty");
Assert.hasText(_path, "path must not be null");
@@ -198,35 +211,39 @@ public class SmbSession implements Session<SmbFile> {
SmbFile targetFile = createSmbFileObject(_path);
if (smbShare.isUseTempFile()) {
if (this.smbShare.isUseTempFile()) {
String tempFileName = _path + smbShare.newTempFileSuffix();
String tempFileName = _path + this.smbShare.newTempFileSuffix();
SmbFile tempFile = createSmbFileObject(tempFileName);
tempFile.createNewFile();
Assert.isTrue(tempFile.canWrite(), "Temporary file [" + tempFileName + "] is not writable.");
FileCopyUtils.copy(_inputStream, tempFile.getOutputStream());
if (targetFile.exists() && smbShare.isReplaceFile()) {
if (targetFile.exists() && this.smbShare.isReplaceFile()) {
targetFile.delete();
}
tempFile.renameTo(targetFile);
} else {
}
else {
FileCopyUtils.copy(_inputStream, targetFile.getOutputStream());
}
} catch (SmbException _ex) {
}
catch (SmbException _ex) {
throw new NestedIOException("Failed to write resource [" + _path + "].", _ex);
}
logger.info("Successfully wrote remote file [" + _path + "].");
if (logger.isInfoEnabled()) {
logger.info("Successfully wrote remote file [" + _path + "].");
}
}
/**
* Convenience method to write a local file object to a remote location.
* @see org.springframework.integration.smb.session.SmbSession#write(InputStream, String)
* @param _file the local file
* @param _path the remote path to write to
* @return the {@link SmbFile} for remote file
* @throws IOException the IO exception
*/
public SmbFile write(File _file, String _path) throws IOException {
return writeAndClose(new FileInputStream(_file), _path);
@@ -234,7 +251,10 @@ public class SmbSession implements Session<SmbFile> {
/**
* Convenience method to write a byte array to a remote location.
* @see org.springframework.integration.smb.session.SmbSession#write(InputStream, String)
* @param _contents the {@code byte[]} to write
* @param _path the remote file to write to
* @return the {@link SmbFile} for remote file
* @throws IOException the IO exception
*/
public SmbFile write(byte[] _contents, String _path) throws IOException {
return writeAndClose(new ByteArrayInputStream(_contents), _path);
@@ -247,19 +267,25 @@ public class SmbSession implements Session<SmbFile> {
* @param _path remote path to create
* @return always true (error states are express by exceptions)
* @throws IOException on error conditions returned by a CIFS server
* @see org.springframework.integration.file.remote.session.Session#mkdir(java.lang.String)
*/
@Override
public boolean mkdir(String _path) throws IOException {
try {
SmbFile dir = createSmbDirectoryObject(_path);
if (!dir.exists()) {
dir.mkdirs();
logger.info("Successfully created remote directory [" + _path + "] in share [" + smbShare + "].");
} else {
logger.info("Remote directory [" + _path + "] exists in share [" + smbShare + "].");
if (logger.isInfoEnabled()) {
logger.info("Successfully created remote directory [" + _path + "] in share [" + this.smbShare + "].");
}
}
else {
if (logger.isInfoEnabled()) {
logger.info("Remote directory [" + _path + "] exists in share [" + this.smbShare + "].");
}
}
return true;
} catch (SmbException _ex) {
}
catch (SmbException _ex) {
throw new NestedIOException("Failed to create directory [" + _path + "].", _ex);
}
}
@@ -269,8 +295,8 @@ public class SmbSession implements Session<SmbFile> {
* @param _path remote path
* @return true if exists, false otherwise
* @throws IOException on error conditions returned by a CIFS server
* @see org.springframework.integration.file.remote.session.Session#exists(java.lang.String)
*/
@Override
public boolean exists(String _path) throws IOException {
return createSmbFileObject(_path).exists();
}
@@ -313,54 +339,93 @@ public class SmbSession implements Session<SmbFile> {
return null;
}
/**
* Renames a remote resource.
* @param _pathFrom remote source path
* @param _pathTo remote target path
* @throws IOException on error conditions returned by a CIFS server
* @see org.springframework.integration.file.remote.session.Session#rename(java.lang.String, java.lang.String)
*/
@Override
public void rename(String _pathFrom, String _pathTo) throws IOException {
try {
SmbFile smbFileFrom = createSmbFileObject(_pathFrom);
SmbFile smbFileTo = createSmbFileObject(_pathTo);
if (smbShare.isReplaceFile() && smbFileTo.exists()) {
if (this.smbShare.isReplaceFile() && smbFileTo.exists()) {
smbFileTo.delete();
}
smbFileFrom.renameTo(smbFileTo);
} catch (SmbException _ex) {
}
catch (SmbException _ex) {
throw new NestedIOException("Failed to rename [" + _pathFrom + "] to [" + _pathTo + "].", _ex);
}
logger.info("Successfully renamed remote resource [" + _pathFrom + "] to [" + _pathTo + "].");
if (logger.isInfoEnabled()) {
logger.info("Successfully renamed remote resource [" + _pathFrom + "] to [" + _pathTo + "].");
}
}
/**
* Closes this SMB session.
* @see org.springframework.integration.file.remote.session.Session#close()
*/
@Override
public void append(InputStream inputStream, String destination) throws IOException {
SmbFile smbFile = createSmbFileObject(destination);
OutputStream fileOutputStream = new SmbFileOutputStream(smbFile, true);
FileCopyUtils.copy(inputStream, fileOutputStream);
}
@Override
public boolean rmdir(String directory) throws IOException {
SmbFile dir = createSmbDirectoryObject(directory);
try {
dir.delete();
}
catch (SmbException e) {
if (logger.isWarnEnabled()) {
logger.info("Failed to remove remote directory [" + directory + "]: " + e);
}
return false;
}
if (logger.isInfoEnabled()) {
logger.info("Successfully removed remote directory [" + directory + "].");
}
return true;
}
@Override
public InputStream readRaw(String source) throws IOException {
SmbFile remoteFile = createSmbFileObject(source);
if (!remoteFile.isFile()) {
throw new NestedIOException("Resource [" + source + "] is not a file.");
}
return remoteFile.getInputStream();
}
@Override
public boolean finalizeRaw() throws IOException {
return true;
}
@Override
public Object getClientInstance() {
return this.smbShare;
}
@Override
public void close() {
smbShare.doClose();
this.smbShare.doClose();
}
/**
* Checks with this SMB session is open and ready for work by attempting
* to list remote files and checking for error conditions..
* @return true if the session is open, false otherwise
* @see org.springframework.integration.file.remote.session.Session#isOpen()
*/
@Override
public boolean isOpen() {
if (!smbShare.isOpened()) {
if (!this.smbShare.isOpened()) {
return false;
}
try {
smbShare.listFiles();
} catch (Exception _ex) {
this.smbShare.listFiles();
}
catch (Exception _ex) {
close();
}
return smbShare.isOpened();
return this.smbShare.isOpened();
}
/**
@@ -389,17 +454,18 @@ public class SmbSession implements Session<SmbFile> {
final String cleanedPath = StringUtils.cleanPath(path);
if (!StringUtils.hasText(cleanedPath)) {
return smbShare;
return this.smbShare;
}
SmbFile smbFile = new SmbFile(smbShare, cleanedPath);
SmbFile smbFile = new SmbFile(this.smbShare, cleanedPath);
boolean appendFileSeparator = !cleanedPath.endsWith(SMB_FILE_SEPARATOR);
if (appendFileSeparator) {
try {
appendFileSeparator = smbFile.isDirectory() || (isDirectory != null && isDirectory);
} catch (SmbException ex) {
appendFileSeparator = false;
appendFileSeparator = smbFile.isDirectory() || (isDirectory != null && isDirectory);
}
catch (SmbException ex) {
appendFileSeparator = false;
}
}
if (appendFileSeparator) {
@@ -413,6 +479,9 @@ public class SmbSession implements Session<SmbFile> {
/**
* Creates an SMB file object pointing to a remote file.
* @param _path the remote file path
* @return the {@link SmbFile} for remote path
* @throws IOException the IO exception
*/
public SmbFile createSmbFileObject(String _path) throws IOException {
return createSmbFileObject(_path, null);
@@ -420,6 +489,9 @@ public class SmbSession implements Session<SmbFile> {
/**
* Creates an SMB file object pointing to a remote directory.
* @param _path the remote directory path
* @return the {@link SmbFile} for remote path
* @throws IOException the IO exception
*/
public SmbFile createSmbDirectoryObject(String _path) throws IOException {
return createSmbFileObject(_path, true);
@@ -441,9 +513,11 @@ public class SmbSession implements Session<SmbFile> {
Log log = LogFactory.getLog(SmbSession.class);
if (log.isTraceEnabled()) {
jcifs.Config.setProperty(sysPropLogLevel, "N");
} else if (log.isDebugEnabled()) {
}
else if (log.isDebugEnabled()) {
jcifs.Config.setProperty(sysPropLogLevel, "3");
} else {
}
else {
jcifs.Config.setProperty(sysPropLogLevel, "1");
}
}

View File

@@ -1,5 +1,5 @@
/**
* Copyright 2002-2012 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.
@@ -13,16 +13,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.smb.session;
import java.io.IOException;
import jcifs.smb.SmbFile;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.integration.file.remote.session.SessionFactory;
import jcifs.smb.SmbFile;
/**
* The SMB session factory.
*
@@ -31,7 +33,7 @@ import org.springframework.integration.file.remote.session.SessionFactory;
*/
public class SmbSessionFactory extends SmbConfig implements SessionFactory<SmbFile> {
private final Log logger = LogFactory.getLog(this.getClass());
private static Log logger = LogFactory.getLog(SmbSessionFactory.class);
public SmbSessionFactory() {
logger.debug("New " + getClass().getName() + " created.");
@@ -40,17 +42,20 @@ public class SmbSessionFactory extends SmbConfig implements SessionFactory<SmbFi
public final SmbSession getSession() {
try {
return createSession();
} catch (Exception _ex) {
}
catch (Exception _ex) {
throw new IllegalStateException("Failed to create session.", _ex);
}
}
protected SmbSession createSession() throws IOException {
SmbShare smbShare = new SmbShare((SmbConfig) this);
smbShare.setReplaceFile(this.isReplaceFile());
smbShare.setUseTempFile(this.isUseTempFile());
SmbShare smbShare = new SmbShare(this);
smbShare.setReplaceFile(isReplaceFile());
smbShare.setUseTempFile(isUseTempFile());
logger.info(String.format("SMB share init: %s/%s", getHostPort(), getShareAndDir()));
if (logger.isInfoEnabled()) {
logger.info(String.format("SMB share init: %s/%s", getHostPort(), getShareAndDir()));
}
smbShare.init();
logger.debug("SMB share initialized.");
@@ -58,9 +63,4 @@ public class SmbSessionFactory extends SmbConfig implements SessionFactory<SmbFi
return new SmbSession(smbShare);
}
@Override
public String toString() {
return super.toString();
}
}

View File

@@ -1,5 +1,5 @@
/**
* Copyright 2002-2012 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.
@@ -13,29 +13,31 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.smb.session;
import java.io.IOException;
import java.util.concurrent.atomic.AtomicBoolean;
import jcifs.smb.SmbException;
import jcifs.smb.SmbFile;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.core.NestedIOException;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import jcifs.smb.SmbException;
import jcifs.smb.SmbFile;
/**
* @author Markus Spann
* @since 1.0
*/
public class SmbShare extends SmbFile {
private final Log logger = LogFactory.getLog(SmbShare.class);
private static final Log logger = LogFactory.getLog(SmbShare.class);
private final AtomicBoolean open = new AtomicBoolean(false);
private final AtomicBoolean open = new AtomicBoolean(false);
private final AtomicBoolean replaceFile = new AtomicBoolean(false);
@@ -57,15 +59,16 @@ public class SmbShare extends SmbFile {
mkdirs();
}
canRead = canRead();
} catch (SmbException _ex) {
}
catch (SmbException _ex) {
throw new NestedIOException("Unable to initialize share: " + this, _ex);
}
Assert.isTrue(canRead, "Share is not accessible " + this);
open.set(true);
this.open.set(true);
}
public boolean isReplaceFile() {
return replaceFile.get();
return this.replaceFile.get();
}
public void setReplaceFile(boolean _replace) {
@@ -73,7 +76,7 @@ public class SmbShare extends SmbFile {
}
public boolean isUseTempFile() {
return useTempFile.get();
return this.useTempFile.get();
}
public void setUseTempFile(boolean _useTempFile) {
@@ -86,7 +89,7 @@ public class SmbShare extends SmbFile {
* @return true if open
*/
boolean isOpened() {
return open.get();
return this.open.get();
}
/**
@@ -94,16 +97,11 @@ public class SmbShare extends SmbFile {
* Note: jcifs.smb.SmbFile defines a package-protected method close().
*/
void doClose() {
open.set(false);
this.open.set(false);
}
public String newTempFileSuffix() {
return "-" + Long.toHexString(Double.doubleToLongBits(Math.random())) + ".tmp";
}
@Override
public String toString() {
return super.toString();
}
}

View File

@@ -1,5 +1,5 @@
/**
* Copyright 2002-2012 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.
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.smb.session;
import java.io.File;
@@ -25,7 +26,7 @@ import java.nio.channels.FileChannel;
* @author Markus Spann
* @since 1.0
*/
public abstract class SmbUtils {
public final class SmbUtils {
private SmbUtils() {
}
@@ -34,7 +35,7 @@ public abstract class SmbUtils {
* Read the specified file into a byte array.
* @param _file file
* @return byte array of file contents
* @throws IOException
* @throws IOException the IO exception
*/
public static byte[] readFile(File _file) throws IOException {
FileInputStream stream = new FileInputStream(_file);
@@ -46,7 +47,8 @@ public abstract class SmbUtils {
/* Instead of using default, pass in a decoder. */
// return Charset.defaultCharset().decode(bb).toString();
} finally {
}
finally {
stream.close();
}
}

View File

@@ -1,2 +1,2 @@
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
http\://www.springframework.org/schema/integration/smb/spring-integration-smb-0.5.xsd=org/springframework/integration/smb/config/spring-integration-smb-0.5.xsd
http\://www.springframework.org/schema/integration/smb/spring-integration-smb.xsd=org/springframework/integration/smb/config/spring-integration-smb-0.5.xsd

View File

@@ -1,4 +1,4 @@
# Tooling related information for the integration smb namespace
http\://www.springframework.org/schema/integration/smb@name=integration smb Namespace
http\://www.springframework.org/schema/integration/smb@name=Integration SMB Namespace
http\://www.springframework.org/schema/integration/smb@prefix=int-smb
http\://www.springframework.org/schema/integration/smb@icon=org/springframework/integration/smb/config/spring-integration-smb.gif

View File

@@ -1,13 +0,0 @@
Copyright 2002-2012 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
http://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.

View File

@@ -19,8 +19,8 @@
<section id="jpa-java-implementation">
<title>Java Implementation</title>
<para>Each of the provided components will use the
<classname>org.springframework.smb.core.SmbExecutor</classname>
<para>Each of the provided components use the
<classname>org.springframework.integration.smb.session.SmbSession</classname>
class...
</para>
</section>

View File

@@ -23,7 +23,7 @@
<author><firstname>Markus Spann</firstname></author>
</authorgroup>
<legalnotice>
<para>© SpringSource Inc., 2012</para>
<para>Pivotal Software, Inc. All Rights Reserved., 2012-2017</para>
</legalnotice>
</bookinfo>
@@ -35,7 +35,7 @@
<para>
For those who are already familiar with Spring Integration, this
chapter
provides a brief overview of the new features of version 2.2. If you are
provides a brief overview of the new features of version 0.5. If you are
interested in the changes and features, that were introduced in
earlier
versions, please take a look at chapter:

View File

@@ -1,5 +1,5 @@
/**
* Copyright 2002-2013 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.
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.smb;
import static org.junit.Assert.assertNotNull;
@@ -31,6 +32,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.rules.TestName;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.util.FileCopyUtils;
import org.springframework.util.StringUtils;
@@ -39,16 +41,16 @@ import org.springframework.util.StringUtils;
* Assorted test utils for the library.
* @author Markus Spann
*/
public abstract class AbstractBaseTest {
public abstract class AbstractBaseTests {
/** Instance logger. */
private final Log logger = LogFactory.getLog(this.getClass());
private final Log logger = LogFactory.getLog(this.getClass());
protected final Log getLogger() {
return logger;
}
@Rule // requires JUnit 4.7 or later
@Rule
public final TestName testMethodName = new TestName();
private String getTestMethodName() {
@@ -102,7 +104,8 @@ public abstract class AbstractBaseTest {
FileOutputStream fos = new FileOutputStream(_path);
try {
FileCopyUtils.copy(_inputStream, fos);
} finally {
}
finally {
fos.close();
}
}
@@ -230,7 +233,8 @@ public abstract class AbstractBaseTest {
assertNotNull("File object is null.", _file);
if (_exists) {
assertTrue("File [" + _file.getAbsolutePath() + "] does not exist.", _file.exists());
} else {
}
else {
assertTrue("File [" + _file.getAbsolutePath() + "] exists.", !_file.exists());
}
return _file;
@@ -246,34 +250,23 @@ public abstract class AbstractBaseTest {
* @param _testClass test class object
* @param _methodNames String method names to invoke in order, no parameters expected
*/
protected static void runTests(Class<? extends AbstractBaseTest> _testClass, String... _methodNames) {
AbstractBaseTest test;
protected static void runTests(Class<? extends AbstractBaseTests> _testClass, String... _methodNames)
throws Exception {
AbstractBaseTests test;
Method[] methods = new Method[_methodNames.length];
String methodName = null;
try {
test = _testClass.newInstance();
for (int i = 0; i < _methodNames.length; i++) {
methodName = _methodNames[i];
methods[i] = _testClass.getMethod(methodName, (Class<?>[]) null);
}
} catch (Exception _ex) {
System.err.println("Test setup failed for " + _testClass + "." + methodName + "().");
_ex.printStackTrace();
return;
test = _testClass.newInstance();
for (int i = 0; i < _methodNames.length; i++) {
methodName = _methodNames[i];
methods[i] = _testClass.getMethod(methodName, (Class<?>[]) null);
}
Method method = null;
try {
for (int i = 0; i < methods.length; i++) {
method = methods[i];
method.invoke(test, (Object[]) null);
}
} catch (Exception _ex) {
System.err.println("Test execution failed for " + _testClass + "." + method.getName() + ".");
_ex.printStackTrace();
for (int i = 0; i < methods.length; i++) {
method = methods[i];
method.invoke(test, (Object[]) null);
}
}

View File

@@ -1,5 +1,5 @@
/**
* Copyright 2002-2013 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.
@@ -13,21 +13,25 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.smb;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.springframework.integration.endpoint.SourcePollingChannelAdapter;
/**
* @author Markus Spann
*
*/
public class SmbMessageHistoryTests extends AbstractBaseTest {
public class SmbMessageHistoryTests extends AbstractBaseTests {
@Test
public void testMessageHistory() throws Exception {
SourcePollingChannelAdapter adapter = getApplicationContext().getBean("smbInboundChannelAdapter", SourcePollingChannelAdapter.class);
SourcePollingChannelAdapter adapter = getApplicationContext()
.getBean("smbInboundChannelAdapter", SourcePollingChannelAdapter.class);
assertEquals("smbInboundChannelAdapter", adapter.getComponentName());
assertEquals("smb:inbound-channel-adapter", adapter.getComponentType());
}

View File

@@ -1,5 +1,5 @@
/**
* Copyright 2002-2012 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.
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.smb;
import java.io.File;
@@ -20,6 +21,7 @@ import java.io.File;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.context.support.ClassPathXmlApplicationContext;
@@ -27,7 +29,7 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
* @author Markus Spann
*
*/
public class SmbParserInboundTests extends AbstractBaseTest {
public class SmbParserInboundTests extends AbstractBaseTests {
@Before
public void prepare() {
@@ -46,7 +48,8 @@ public class SmbParserInboundTests extends AbstractBaseTest {
@Test(expected = BeanCreationException.class)
public void testLocalFilesAutoCreationFalse() throws Exception {
assertFileNotExists(new File("test-temp/local-6"));
new ClassPathXmlApplicationContext(getApplicationContextXmlFile("-fail"), this.getClass());
new ClassPathXmlApplicationContext(getApplicationContextXmlFile("-fail"), this.getClass())
.close();
}
@After
@@ -54,7 +57,7 @@ public class SmbParserInboundTests extends AbstractBaseTest {
delete("test-temp/local-10", "test-temp/local-6");
}
public static void main(String[] _args) {
public static void main(String[] _args) throws Exception {
new SmbParserInboundTests().cleanUp();
runTests(SmbParserInboundTests.class, "testLocalFilesAutoCreationTrue", "testLocalFilesAutoCreationFalse");
}

View File

@@ -1,5 +1,5 @@
/**
* Copyright 2002-2013 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.
@@ -13,10 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.smb.config;
import static org.hamcrest.Matchers.instanceOf;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -26,11 +29,11 @@ import java.util.concurrent.PriorityBlockingQueue;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.integration.endpoint.SourcePollingChannelAdapter;
import org.springframework.integration.file.remote.session.CachingSessionFactory;
import org.springframework.integration.smb.filters.SmbSimplePatternFileListFilter;
import org.springframework.integration.smb.inbound.SmbInboundFileSynchronizer;
import org.springframework.integration.smb.inbound.SmbInboundFileSynchronizingMessageSource;
@@ -43,6 +46,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
* @author Markus Spann
* @author Gunnar Hillert
* @author Artem Bilan
*/
@ContextConfiguration
@RunWith(SpringJUnit4ClassRunner.class)
@@ -52,7 +56,7 @@ public class SmbInboundChannelAdapterParserTests {
ApplicationContext applicationContext;
@Test(timeout = 100000)
public void testSmbInboundChannelAdapterComplete() throws Exception{
public void testSmbInboundChannelAdapterComplete() throws Exception {
final SourcePollingChannelAdapter adapter = this.applicationContext.getBean("smbInbound", SourcePollingChannelAdapter.class);
final PriorityBlockingQueue<?> queue = TestUtils.getPropertyValue(adapter, "source.fileSource.toBeReceived", PriorityBlockingQueue.class);
@@ -63,39 +67,39 @@ public class SmbInboundChannelAdapterParserTests {
assertNotNull(TestUtils.getPropertyValue(adapter, "poller"));
assertEquals(applicationContext.getBean("smbChannel"), TestUtils.getPropertyValue(adapter, "outputChannel"));
SmbInboundFileSynchronizingMessageSource inbound =
(SmbInboundFileSynchronizingMessageSource) TestUtils.getPropertyValue(adapter, "source");
(SmbInboundFileSynchronizingMessageSource) TestUtils.getPropertyValue(adapter, "source");
SmbInboundFileSynchronizer fisync =
(SmbInboundFileSynchronizer) TestUtils.getPropertyValue(inbound, "synchronizer");
(SmbInboundFileSynchronizer) TestUtils.getPropertyValue(inbound, "synchronizer");
assertEquals(".working.tmp", TestUtils.getPropertyValue(fisync, "temporaryFileSuffix", String.class));
String remoteFileSeparator = (String) TestUtils.getPropertyValue(fisync, "remoteFileSeparator");
assertNotNull(remoteFileSeparator);
assertEquals("", remoteFileSeparator);
SmbSimplePatternFileListFilter filter = (SmbSimplePatternFileListFilter) TestUtils.getPropertyValue(fisync, "filter");
assertNotNull(filter);
Object sessionFactory = TestUtils.getPropertyValue(fisync, "sessionFactory");
Object sessionFactory = TestUtils.getPropertyValue(fisync, "remoteFileTemplate.sessionFactory");
assertTrue(SmbSessionFactory.class.isAssignableFrom(sessionFactory.getClass()));
}
@Test(timeout = 10000)
public void cachingSessionFactoryByDefault() throws Exception{
@Test
public void testNoCachingSessionFactoryByDefault() throws Exception {
SourcePollingChannelAdapter adapter = applicationContext.getBean("simpleAdapter", SourcePollingChannelAdapter.class);
Object sessionFactory = TestUtils.getPropertyValue(adapter, "source.synchronizer.sessionFactory");
assertEquals(CachingSessionFactory.class, sessionFactory.getClass());
Object sessionFactory = TestUtils.getPropertyValue(adapter, "source.synchronizer.remoteFileTemplate.sessionFactory");
assertThat(sessionFactory, instanceOf(SmbSessionFactory.class));
SmbInboundFileSynchronizer fisync =
TestUtils.getPropertyValue(adapter, "source.synchronizer", SmbInboundFileSynchronizer.class);
TestUtils.getPropertyValue(adapter, "source.synchronizer", SmbInboundFileSynchronizer.class);
String remoteFileSeparator = (String) TestUtils.getPropertyValue(fisync, "remoteFileSeparator");
assertNotNull(remoteFileSeparator);
assertEquals("/", remoteFileSeparator);
}
@Test(timeout = 10000)
public void testSmbInboundChannelAdapterCompleteNoId() throws Exception{
public void testSmbInboundChannelAdapterCompleteNoId() throws Exception {
Map<String, SourcePollingChannelAdapter> spcas = applicationContext.getBeansOfType(SourcePollingChannelAdapter.class);
SourcePollingChannelAdapter adapter = null;
for (String key : spcas.keySet()) {
if (!key.equals("smbInbound") && !key.equals("simpleAdapter")){
if (!key.equals("smbInbound") && !key.equals("simpleAdapter")) {
adapter = spcas.get(key);
}
}

View File

@@ -1,5 +1,5 @@
/**
* Copyright 2002-2013 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.
@@ -13,25 +13,28 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.smb.config;
import static org.junit.Assert.assertTrue;
import java.io.File;
import org.junit.Ignore;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.integration.MessageChannel;
import org.springframework.integration.endpoint.EventDrivenConsumer;
import org.springframework.integration.endpoint.SourcePollingChannelAdapter;
import org.springframework.integration.file.remote.handler.FileTransferringMessageHandler;
import org.springframework.integration.message.GenericMessage;
import org.springframework.integration.smb.AbstractBaseTest;
import org.springframework.integration.smb.AbstractBaseTests;
import org.springframework.integration.smb.inbound.SmbInboundFileSynchronizingMessageSource;
import org.springframework.integration.smb.session.SmbSession;
import org.springframework.integration.smb.session.SmbSessionFactory;
import org.springframework.integration.test.util.TestUtils;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.support.GenericMessage;
/**
* System tests that perform SMB access without any mocking.
@@ -43,12 +46,12 @@ import org.springframework.integration.test.util.TestUtils;
* @author Markus Spann
* @author Gunnar Hillert
*/
public class SmbInboundOutboundSample extends AbstractBaseTest {
public class SmbInboundOutboundSample extends AbstractBaseTests {
private static final String INBOUND_APPLICATION_CONTEXT_XML = "SmbInboundChannelAdapterSample-context.xml";
private static final String OUTBOUND_APPLICATION_CONTEXT_XML = "SmbOutboundChannelAdapterSample-context.xml";
@org.junit.Ignore("Actual SMB share must be configured in file [" + INBOUND_APPLICATION_CONTEXT_XML + "].")
@Ignore("Actual SMB share must be configured in file [" + INBOUND_APPLICATION_CONTEXT_XML + "].")
@Test
public void testSmbInboundChannelAdapter() throws Exception {
String testLocalDir = "test-temp/local-4/";
@@ -71,7 +74,8 @@ public class SmbInboundOutboundSample extends AbstractBaseTest {
String[] fileNames = createTestFileNames(5);
for (int i = 0; i < fileNames.length; i++) {
smbSession.write(("File [" + fileNames[i] + "] written by test case [" + getMethodName() + "].").getBytes(), testRemoteDir + fileNames[i]);
smbSession.write(("File [" + fileNames[i] + "] written by test case [" + getMethodName() + "].").getBytes(),
testRemoteDir + fileNames[i]);
}
// allow time for the files to arrive locally
@@ -84,7 +88,7 @@ public class SmbInboundOutboundSample extends AbstractBaseTest {
}
@org.junit.Ignore("Actual SMB share must be configured in file [" + OUTBOUND_APPLICATION_CONTEXT_XML + "].")
@Ignore("Actual SMB share must be configured in file [" + OUTBOUND_APPLICATION_CONTEXT_XML + "].")
@Test
public void testSmbOutboundChannelAdapter() throws Exception {
String testRemoteDir = "test-temp/remote-8/";
@@ -93,7 +97,8 @@ public class SmbInboundOutboundSample extends AbstractBaseTest {
String[] fileNames = createTestFileNames(5);
for (int i = 0; i < fileNames.length; i++) {
writeToFile(("File [" + fileNames[i] + "] written by test case [" + getMethodName() + "].").getBytes(), testLocalDir + fileNames[i]);
writeToFile(("File [" + fileNames[i] + "] written by test case [" + getMethodName() + "].").getBytes(),
testLocalDir + fileNames[i]);
}
ApplicationContext ac = new ClassPathXmlApplicationContext(OUTBOUND_APPLICATION_CONTEXT_XML, this.getClass());
@@ -131,7 +136,7 @@ public class SmbInboundOutboundSample extends AbstractBaseTest {
return fileNames;
}
public static void main(String[] _args) {
public static void main(String[] _args) throws Exception {
runTests(SmbInboundOutboundSample.class, "testSmbOutboundChannelAdapter", "testSmbInboundChannelAdapter");
}

View File

@@ -1,5 +1,5 @@
/**
* Copyright 2002-2013 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.
@@ -13,33 +13,34 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.smb.config;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import java.util.Iterator;
import java.util.Set;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.integration.channel.PublishSubscribeChannel;
import org.springframework.integration.core.MessageHandler;
import org.springframework.integration.endpoint.EventDrivenConsumer;
import org.springframework.integration.file.remote.session.CachingSessionFactory;
import org.springframework.integration.smb.AbstractBaseTest;
import org.springframework.integration.smb.AbstractBaseTests;
import org.springframework.integration.smb.session.SmbSessionFactory;
import org.springframework.integration.test.util.TestUtils;
import org.springframework.messaging.MessageHandler;
/**
* @author Markus Spann
* @author Gunnar Hillert
* @since 1.0
* @author Artem Bilan
*/
public class SmbOutboundChannelAdapterParserTests extends AbstractBaseTest {
public class SmbOutboundChannelAdapterParserTests extends AbstractBaseTests {
@Test
public void testSmbOutboundChannelAdapterComplete() throws Exception {
@@ -53,15 +54,14 @@ public class SmbOutboundChannelAdapterParserTests extends AbstractBaseTest {
assertEquals("smbOutboundChannelAdapter", ((EventDrivenConsumer) consumer).getComponentName());
Object messageHandler = TestUtils.getPropertyValue(consumer, "handler");
String remoteFileSeparator = (String) TestUtils.getPropertyValue(messageHandler, "remoteFileSeparator");
String remoteFileSeparator = (String) TestUtils.getPropertyValue(messageHandler, "remoteFileTemplate.remoteFileSeparator");
assertNotNull(remoteFileSeparator);
assertEquals(".working.tmp", TestUtils.getPropertyValue(messageHandler, "temporaryFileSuffix", String.class));
assertEquals(".working.tmp", TestUtils.getPropertyValue(messageHandler, "remoteFileTemplate.temporaryFileSuffix", String.class));
assertEquals(".", remoteFileSeparator);
assertEquals(ac.getBean("fileNameGenerator"), TestUtils.getPropertyValue(messageHandler, "fileNameGenerator"));
assertEquals("UTF-8", TestUtils.getPropertyValue(messageHandler, "charset"));
assertNotNull(TestUtils.getPropertyValue(messageHandler, "temporaryDirectory"));
assertEquals(ac.getBean("fileNameGenerator"), TestUtils.getPropertyValue(messageHandler, "remoteFileTemplate.fileNameGenerator"));
assertEquals("UTF-8", TestUtils.getPropertyValue(messageHandler, "remoteFileTemplate.charset"));
Object sessionFactoryProp = TestUtils.getPropertyValue(messageHandler, "sessionFactory");
Object sessionFactoryProp = TestUtils.getPropertyValue(messageHandler, "remoteFileTemplate.sessionFactory");
assertEquals(SmbSessionFactory.class, sessionFactoryProp.getClass());
SmbSessionFactory smbSessionFactory = (SmbSessionFactory) sessionFactoryProp;
@@ -71,20 +71,20 @@ public class SmbOutboundChannelAdapterParserTests extends AbstractBaseTest {
// verify subscription order
@SuppressWarnings("unchecked")
Set<MessageHandler> handlers = (Set<MessageHandler>) TestUtils.getPropertyValue(TestUtils.getPropertyValue(channel, "dispatcher"), "handlers");
Set<MessageHandler> handlers = (Set<MessageHandler>) TestUtils.getPropertyValue(
TestUtils.getPropertyValue(channel, "dispatcher"), "handlers");
Iterator<MessageHandler> iterator = handlers.iterator();
assertSame(TestUtils.getPropertyValue(ac.getBean("smbOutboundChannelAdapter2"), "handler"), iterator.next());
assertSame(TestUtils.getPropertyValue(ac.getBean("smbOutboundChannelAdapter2"), "handler"),
iterator.next());
assertSame(messageHandler, iterator.next());
}
@Test
public void cachingByDefault() {
public void noCachingByDefault() {
ApplicationContext ac = new ClassPathXmlApplicationContext(getApplicationContextXmlFile(), this.getClass());
Object adapter = ac.getBean("simpleAdapter");
Object sfProperty = TestUtils.getPropertyValue(adapter, "handler.sessionFactory");
assertEquals(CachingSessionFactory.class, sfProperty.getClass());
Object innerSfProperty = TestUtils.getPropertyValue(sfProperty, "sessionFactory");
assertEquals(SmbSessionFactory.class, innerSfProperty.getClass());
Object sfProperty = TestUtils.getPropertyValue(adapter, "handler.remoteFileTemplate.sessionFactory");
assertEquals(SmbSessionFactory.class, sfProperty.getClass());
}
}

View File

@@ -1,5 +1,5 @@
/**
* Copyright 2002-2013 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.
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.smb.inbound;
import static org.mockito.Mockito.doAnswer;
@@ -24,27 +25,31 @@ import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
import jcifs.smb.SmbFile;
import org.junit.Before;
import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.springframework.integration.smb.AbstractBaseTest;
import org.springframework.integration.smb.AbstractBaseTests;
import org.springframework.integration.smb.session.SmbSession;
import org.springframework.integration.smb.session.SmbSessionFactory;
import jcifs.smb.SmbFile;
/**
* @author Markus Spann
* @author Gunnar Hillert
* @since 1.0
*/
public class SmbInboundRemoteFileSystemSynchronizerTest extends AbstractBaseTest {
public class SmbInboundRemoteFileSystemSynchronizerTests extends AbstractBaseTests {
private SmbSession smbSession;
private SmbSession smbSession;
private SmbSessionFactory smbSessionFactory;
private String testLocalDir = "test-temp/local-9/";
private String testRemoteDir = "test-temp/remote-9/";
private String testLocalDir = "test-temp/local-9/";
private String testRemoteDir = "test-temp/remote-9/";
@Before
public void prepare() {
@@ -105,6 +110,7 @@ public class SmbInboundRemoteFileSystemSynchronizerTest extends AbstractBaseTest
smbFiles.add(file);
doAnswer(new Answer<Object>() {
public Object answer(InvocationOnMock _invocation) throws Throwable {
String path = (String) _invocation.getArguments()[0];
OutputStream os = (OutputStream) _invocation.getArguments()[1];
@@ -114,11 +120,12 @@ public class SmbInboundRemoteFileSystemSynchronizerTest extends AbstractBaseTest
}).when(smbSession).read(Mockito.eq(testRemoteDir + "/" + fileName), Mockito.any(OutputStream.class));
}
when(smbSession.list(testRemoteDir)).thenReturn(smbFiles.toArray(new SmbFile[] {}));
when(smbSession.list(testRemoteDir)).thenReturn(smbFiles.toArray(new SmbFile[] { }));
when(smbSession.remove(Mockito.anyString())).thenReturn(true);
return smbSession;
} catch (Exception _ex) {
}
catch (Exception _ex) {
throw new RuntimeException("Failed to create mock session.", _ex);
}
}

View File

@@ -1,5 +1,5 @@
/**
* Copyright 2002-2012 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.
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.smb.outbound;
import static org.mockito.Mockito.doAnswer;
@@ -24,28 +25,30 @@ import java.io.File;
import java.io.InputStream;
import java.io.OutputStream;
import jcifs.smb.SmbFile;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.expression.common.LiteralExpression;
import org.springframework.integration.Message;
import org.springframework.integration.file.FileNameGenerator;
import org.springframework.integration.file.remote.handler.FileTransferringMessageHandler;
import org.springframework.integration.message.GenericMessage;
import org.springframework.integration.smb.AbstractBaseTest;
import org.springframework.integration.smb.AbstractBaseTests;
import org.springframework.integration.smb.session.SmbSession;
import org.springframework.integration.smb.session.SmbSessionFactory;
import org.springframework.messaging.support.GenericMessage;
import jcifs.smb.SmbFile;
/**
* @author Markus Spann
* @author Artem Bilan
*/
public class SmbSendingMessageHandlerTest extends AbstractBaseTest {
public class SmbSendingMessageHandlerTests extends AbstractBaseTests {
private SmbSession smbSession;
private SmbSession smbSession;
private SmbSessionFactory smbSessionFactory;
@Before
@@ -66,12 +69,9 @@ public class SmbSendingMessageHandlerTest extends AbstractBaseTest {
File file = createNewFile("remote-target-dir/handlerContent.test");
FileTransferringMessageHandler<?> handler = new FileTransferringMessageHandler<SmbFile>(smbSessionFactory);
handler.setRemoteDirectoryExpression(new LiteralExpression("remote-target-dir"));
handler.setFileNameGenerator(new FileNameGenerator() {
public String generateFileName(Message<?> message) {
return "handlerContent.test";
}
});
handler.setFileNameGenerator(message -> "handlerContent.test");
handler.setAutoCreateDirectory(true);
handler.setBeanFactory(mock(BeanFactory.class));
handler.afterPropertiesSet();
handler.handleMessage(new GenericMessage<String>("hello"));
assertFileExists(file);
@@ -82,11 +82,8 @@ public class SmbSendingMessageHandlerTest extends AbstractBaseTest {
File file = createNewFile("remote-target-dir/handlerContent.test");
FileTransferringMessageHandler<?> handler = new FileTransferringMessageHandler<SmbFile>(smbSessionFactory);
handler.setRemoteDirectoryExpression(new LiteralExpression("remote-target-dir"));
handler.setFileNameGenerator(new FileNameGenerator() {
public String generateFileName(Message<?> message) {
return "handlerContent.test";
}
});
handler.setFileNameGenerator(message -> "handlerContent.test");
handler.setBeanFactory(mock(BeanFactory.class));
handler.afterPropertiesSet();
handler.handleMessage(new GenericMessage<byte[]>("hello".getBytes()));
assertFileExists(file);
@@ -116,6 +113,7 @@ public class SmbSendingMessageHandlerTest extends AbstractBaseTest {
when(smbSession.list(Mockito.anyString())).thenReturn(new SmbFile[0]);
doAnswer(new Answer<Object>() {
public Object answer(InvocationOnMock _invocation) throws Throwable {
String path = (String) _invocation.getArguments()[0];
OutputStream os = (OutputStream) _invocation.getArguments()[1];
@@ -124,20 +122,19 @@ public class SmbSendingMessageHandlerTest extends AbstractBaseTest {
}
}).when(smbSession).read(Mockito.anyString(), Mockito.any(OutputStream.class));
doAnswer(new Answer<Object>() {
public Object answer(InvocationOnMock _invocation) throws Throwable {
InputStream inputStream = (InputStream) _invocation.getArguments()[0];
String path = (String) _invocation.getArguments()[1];
writeToFile(inputStream, path);
return null;
}
}).when(smbSession).write(Mockito.any(InputStream.class), Mockito.anyString());
doAnswer(_invocation -> {
InputStream inputStream = (InputStream) _invocation.getArguments()[0];
String path = (String) _invocation.getArguments()[1];
writeToFile(inputStream, path);
return null;
}).when(smbSession)
.write(Mockito.any(InputStream.class), Mockito.anyString());
// when(smbSession.write(Mockito.any(byte[].class), Mockito.anyString())).thenReturn(null);
// when(smbSession.write(Mockito.any(File.class), Mockito.anyString())).thenReturn(null);
doAnswer(new Answer<Object>() {
public Object answer(InvocationOnMock _invocation) throws Throwable {
String path = (String) _invocation.getArguments()[0];
new File(path).mkdirs();
@@ -145,20 +142,20 @@ public class SmbSendingMessageHandlerTest extends AbstractBaseTest {
}
}).when(smbSession).mkdir(Mockito.anyString());
doAnswer(new Answer<Object>() {
public Object answer(InvocationOnMock _invocation) throws Throwable {
String pathFrom = (String) _invocation.getArguments()[0];
String pathTo = (String) _invocation.getArguments()[1];
new File(pathFrom).renameTo(new File(pathTo));
return null;
}
}).when(smbSession).rename(Mockito.anyString(), Mockito.anyString());
doAnswer(_invocation -> {
String pathFrom = (String) _invocation.getArguments()[0];
String pathTo = (String) _invocation.getArguments()[1];
new File(pathFrom).renameTo(new File(pathTo));
return null;
}).when(smbSession)
.rename(Mockito.anyString(), Mockito.anyString());
doNothing().when(smbSession).close();
when(smbSession.isOpen()).thenReturn(true);
return smbSession;
} catch (Exception _ex) {
}
catch (Exception _ex) {
throw new RuntimeException("Failed to create mock session.", _ex);
}
}

View File

@@ -1,5 +1,5 @@
/**
* Copyright 2002-2013 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.
@@ -13,26 +13,24 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.smb.session;
import static org.junit.Assert.assertEquals;
import java.io.IOException;
import jcifs.smb.SmbFile;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import jcifs.smb.SmbFile;
/**
*
* @author Gunnar Hillert
*
*/
public class SmbSessionTest {
public class SmbSessionTests {
/**
* Test Case reproduces INTEXT-37 (https://jira.springsource.org/browse/INTEXT-37)
* @throws IOException
*/
@Test
public void testCreateSmbFileObjectWithBackSlash1() throws IOException {

View File

@@ -4,6 +4,5 @@ log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %t %c{2}:%L - %m%n
log4j.category.org.springframework=WARN
log4j.category.org.springframework.integration=DEBUG
log4j.category.org.springframework.integration.smb=DEBUG
log4j.category.org.springframework.integration=WARN
log4j.category.org.springframework.integration.smb=WARN