From fa98e455979cf9dd8cfd0dae615e5e7adf99bcd1 Mon Sep 17 00:00:00 2001 From: Prafull Kumar Sonii Date: Tue, 24 Apr 2018 19:16:29 -0500 Subject: [PATCH] Upgrade SMB to Spring Integration 5.0 code style fixes --- spring-integration-smb/build.gradle | 16 +++--- .../SmbInboundChannelAdapterParser.java | 10 +++- ...SmbPersistentAcceptOnceFileListFilter.java | 44 +++++++++++++++ .../SmbRegexPatternFileListFilter.java | 14 ++++- .../SmbSimplePatternFileListFilter.java | 16 +++++- ...SystemMarkerFilePresentFileListFilter.java | 53 +++++++++++++++++++ .../integration/smb/session/SmbConfig.java | 8 +-- .../integration/smb/session/SmbSession.java | 7 +-- .../smb/SmbMessageHistoryTests.java | 5 +- .../smb/SmbParserInboundTests.java | 7 +-- .../SmbInboundChannelAdapterParserTests.java | 25 ++++++--- .../SmbOutboundChannelAdapterParserTests.java | 5 +- .../SmbSendingMessageHandlerTests.java | 9 ++-- 13 files changed, 183 insertions(+), 36 deletions(-) create mode 100644 spring-integration-smb/src/main/java/org/springframework/integration/smb/filters/SmbPersistentAcceptOnceFileListFilter.java create mode 100644 spring-integration-smb/src/main/java/org/springframework/integration/smb/filters/SmbSystemMarkerFilePresentFileListFilter.java diff --git a/spring-integration-smb/build.gradle b/spring-integration-smb/build.gradle index 8585eae..5891fbb 100644 --- a/spring-integration-smb/build.gradle +++ b/spring-integration-smb/build.gradle @@ -3,8 +3,8 @@ buildscript { maven { url 'https://repo.spring.io/plugins-release' } } dependencies { - 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:dependency-management-plugin:1.0.5.RELEASE' + classpath 'io.spring.gradle:spring-io-plugin:0.0.8.RELEASE' classpath 'io.spring.gradle:docbook-reference-plugin:0.3.1' } } @@ -44,8 +44,8 @@ if (project.hasProperty('platformVersion')) { } compileJava { - sourceCompatibility = 1.7 - targetCompatibility = 1.7 + sourceCompatibility = 1.8 + targetCompatibility = 1.8 } compileTestJava { @@ -54,9 +54,9 @@ compileTestJava { } ext { - jcifsVersion = '1.3.18.2' + jcifsVersion = '1.3.18.3' log4jVersion = '1.2.17' - springIntegrationVersion = '4.3.6.RELEASE' + springIntegrationVersion = '5.0.4.RELEASE' idPrefix = 'smb' @@ -171,7 +171,7 @@ task schemaZip(type: Zip) { description = "Builds -${classifier} archive containing all " + "XSDs for deployment at static.springframework.org/schema." - def Properties schemas = new Properties(); + Properties schemas = new Properties() def shortName = idPrefix.replaceFirst("${idPrefix}-", '') project.sourceSets.main.resources.find { @@ -215,7 +215,7 @@ task distZip(type: Zip, dependsOn: [docsZip, schemaZip]) { description = "Builds -${classifier} archive, containing all jars and docs, " + "suitable for community download page." - ext.baseDir = "${project.name}-${project.version}"; + ext.baseDir = "${project.name}-${project.version}" from('src/dist') { include 'readme.txt' diff --git a/spring-integration-smb/src/main/java/org/springframework/integration/smb/config/SmbInboundChannelAdapterParser.java b/spring-integration-smb/src/main/java/org/springframework/integration/smb/config/SmbInboundChannelAdapterParser.java index ac1616c..26fb10d 100644 --- a/spring-integration-smb/src/main/java/org/springframework/integration/smb/config/SmbInboundChannelAdapterParser.java +++ b/spring-integration-smb/src/main/java/org/springframework/integration/smb/config/SmbInboundChannelAdapterParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,8 +17,10 @@ package org.springframework.integration.smb.config; import org.springframework.integration.file.config.AbstractRemoteFileInboundChannelAdapterParser; +import org.springframework.integration.file.filters.AbstractPersistentAcceptOnceFileListFilter; import org.springframework.integration.file.filters.FileListFilter; import org.springframework.integration.file.remote.synchronizer.InboundFileSynchronizer; +import org.springframework.integration.smb.filters.SmbPersistentAcceptOnceFileListFilter; import org.springframework.integration.smb.filters.SmbRegexPatternFileListFilter; import org.springframework.integration.smb.filters.SmbSimplePatternFileListFilter; import org.springframework.integration.smb.inbound.SmbInboundFileSynchronizer; @@ -29,6 +31,7 @@ import org.springframework.integration.smb.inbound.SmbInboundFileSynchronizingMe * * @author Markus Spann * @author Artem Bilan + * @author Prafull Kumar Soni */ public class SmbInboundChannelAdapterParser extends AbstractRemoteFileInboundChannelAdapterParser { @@ -52,4 +55,9 @@ public class SmbInboundChannelAdapterParser extends AbstractRemoteFileInboundCha return SmbRegexPatternFileListFilter.class; } + @Override + protected Class> getPersistentAcceptOnceFileListFilterClass() { + return SmbPersistentAcceptOnceFileListFilter.class; + } + } diff --git a/spring-integration-smb/src/main/java/org/springframework/integration/smb/filters/SmbPersistentAcceptOnceFileListFilter.java b/spring-integration-smb/src/main/java/org/springframework/integration/smb/filters/SmbPersistentAcceptOnceFileListFilter.java new file mode 100644 index 0000000..3463af3 --- /dev/null +++ b/spring-integration-smb/src/main/java/org/springframework/integration/smb/filters/SmbPersistentAcceptOnceFileListFilter.java @@ -0,0 +1,44 @@ +/* + * Copyright 2018 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * 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.filters; + +import jcifs.smb.SmbFile; +import org.springframework.integration.file.filters.AbstractPersistentAcceptOnceFileListFilter; +import org.springframework.integration.metadata.ConcurrentMetadataStore; + +/** + * Implementation of {@link AbstractPersistentAcceptOnceFileListFilter} for SMB. + * + * @author Prafull Kumar Soni + */ +public class SmbPersistentAcceptOnceFileListFilter extends AbstractPersistentAcceptOnceFileListFilter { + + + public SmbPersistentAcceptOnceFileListFilter(ConcurrentMetadataStore store, String prefix) { + super(store, prefix); + } + + @Override + protected long modified(SmbFile file) { + return file.getLastModified(); + } + + @Override + protected String fileName(SmbFile file) { + return file.getName(); + } +} diff --git a/spring-integration-smb/src/main/java/org/springframework/integration/smb/filters/SmbRegexPatternFileListFilter.java b/spring-integration-smb/src/main/java/org/springframework/integration/smb/filters/SmbRegexPatternFileListFilter.java index 539358a..cee05cb 100644 --- a/spring-integration-smb/src/main/java/org/springframework/integration/smb/filters/SmbRegexPatternFileListFilter.java +++ b/spring-integration-smb/src/main/java/org/springframework/integration/smb/filters/SmbRegexPatternFileListFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,8 +16,10 @@ package org.springframework.integration.smb.filters; +import java.io.UncheckedIOException; import java.util.regex.Pattern; +import jcifs.smb.SmbException; import org.springframework.integration.file.filters.AbstractRegexPatternFileListFilter; import jcifs.smb.SmbFile; @@ -26,6 +28,7 @@ import jcifs.smb.SmbFile; * Implementation of {@link AbstractRegexPatternFileListFilter} for SMB. * * @author Markus Spann + * @author Prafull Kumar Soni */ public class SmbRegexPatternFileListFilter extends AbstractRegexPatternFileListFilter { @@ -48,4 +51,13 @@ public class SmbRegexPatternFileListFilter extends AbstractRegexPatternFileListF return (file != null ? file.getName() : null); } + @Override + protected boolean isDirectory(SmbFile file) { + try { + return file.isDirectory(); + } + catch (SmbException e) { + throw new UncheckedIOException(e); + } + } } diff --git a/spring-integration-smb/src/main/java/org/springframework/integration/smb/filters/SmbSimplePatternFileListFilter.java b/spring-integration-smb/src/main/java/org/springframework/integration/smb/filters/SmbSimplePatternFileListFilter.java index 4ffaef2..7891149 100644 --- a/spring-integration-smb/src/main/java/org/springframework/integration/smb/filters/SmbSimplePatternFileListFilter.java +++ b/spring-integration-smb/src/main/java/org/springframework/integration/smb/filters/SmbSimplePatternFileListFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,14 +16,18 @@ package org.springframework.integration.smb.filters; +import jcifs.smb.SmbException; import org.springframework.integration.file.filters.AbstractSimplePatternFileListFilter; import jcifs.smb.SmbFile; +import java.io.UncheckedIOException; + /** * Implementation of {@link AbstractSimplePatternFileListFilter} for SMB. * * @author Markus Spann + * @author Prafull Kumar Soni * */ public class SmbSimplePatternFileListFilter extends AbstractSimplePatternFileListFilter { @@ -43,4 +47,14 @@ public class SmbSimplePatternFileListFilter extends AbstractSimplePatternFileLis return (file != null) ? file.getName() : null; } + + @Override + protected boolean isDirectory(SmbFile file) { + try { + return file.isDirectory(); + } + catch (SmbException e) { + throw new UncheckedIOException(e); + } + } } diff --git a/spring-integration-smb/src/main/java/org/springframework/integration/smb/filters/SmbSystemMarkerFilePresentFileListFilter.java b/spring-integration-smb/src/main/java/org/springframework/integration/smb/filters/SmbSystemMarkerFilePresentFileListFilter.java new file mode 100644 index 0000000..baf18be --- /dev/null +++ b/spring-integration-smb/src/main/java/org/springframework/integration/smb/filters/SmbSystemMarkerFilePresentFileListFilter.java @@ -0,0 +1,53 @@ +/* + * Copyright 2018 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * 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.filters; + +import jcifs.smb.SmbFile; +import org.springframework.integration.file.filters.AbstractMarkerFilePresentFileListFilter; +import org.springframework.integration.file.filters.FileListFilter; + +import java.util.Map; +import java.util.function.Function; + +/** + * Implementation of {@link AbstractMarkerFilePresentFileListFilter} for SMB. + * + * @author Prafull Kumar Soni + */ +public class SmbSystemMarkerFilePresentFileListFilter extends AbstractMarkerFilePresentFileListFilter { + + public SmbSystemMarkerFilePresentFileListFilter(FileListFilter filter) { + super(filter); + } + + public SmbSystemMarkerFilePresentFileListFilter(FileListFilter filter, String suffix) { + super(filter, suffix); + } + + public SmbSystemMarkerFilePresentFileListFilter(FileListFilter filter, Function function) { + super(filter, function); + } + + public SmbSystemMarkerFilePresentFileListFilter(Map, Function> filtersAndFunctions) { + super(filtersAndFunctions); + } + + @Override + protected String getFilename(SmbFile file) { + return file.getName(); + } +} diff --git a/spring-integration-smb/src/main/java/org/springframework/integration/smb/session/SmbConfig.java b/spring-integration-smb/src/main/java/org/springframework/integration/smb/session/SmbConfig.java index d183204..b6af92f 100644 --- a/spring-integration-smb/src/main/java/org/springframework/integration/smb/session/SmbConfig.java +++ b/spring-integration-smb/src/main/java/org/springframework/integration/smb/session/SmbConfig.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,6 +29,7 @@ import org.springframework.util.StringUtils; * smb://[[[domain;]username[:password]@]server[:port]/[[share/[dir/]file]]][?[param=value[param2=value2[...]]] * * @author Markus Spann + * @author Prafull Kumar Soni * @since 1.0 */ public class SmbConfig { @@ -52,8 +53,7 @@ public class SmbConfig { public SmbConfig() { } - public SmbConfig(String _host, int _port, String _domain, String _username, String _password, String _shareAndDir) - throws UnsupportedEncodingException { + public SmbConfig(String _host, int _port, String _domain, String _username, String _password, String _shareAndDir) { setHost(_host); setPort(_port); setDomain(_domain); @@ -81,7 +81,7 @@ public class SmbConfig { } public void setDomain(String _domain) { - Assert.notNull(_domain); + Assert.notNull(_domain, "_domain can't be null"); this.domain = _domain; } diff --git a/spring-integration-smb/src/main/java/org/springframework/integration/smb/session/SmbSession.java b/spring-integration-smb/src/main/java/org/springframework/integration/smb/session/SmbSession.java index 7ea9ce2..c4ce3f5 100644 --- a/spring-integration-smb/src/main/java/org/springframework/integration/smb/session/SmbSession.java +++ b/spring-integration-smb/src/main/java/org/springframework/integration/smb/session/SmbSession.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -52,6 +52,7 @@ import jcifs.smb.SmbFileOutputStream; * @author Mark Fisher * @author Oleg Zhurakousky * @author Artem Bilan + * @author Prafull Kumar Soni * */ public class SmbSession implements Session { @@ -395,7 +396,7 @@ public class SmbSession implements Session { } @Override - public boolean finalizeRaw() throws IOException { + public boolean finalizeRaw() { return true; } @@ -524,7 +525,7 @@ public class SmbSession implements Session { } @Override - public String[] listNames(String path) throws IOException { + public String[] listNames(String path) { throw new UnsupportedOperationException("Not implemented yet"); } diff --git a/spring-integration-smb/src/test/java/org/springframework/integration/smb/SmbMessageHistoryTests.java b/spring-integration-smb/src/test/java/org/springframework/integration/smb/SmbMessageHistoryTests.java index 570dc5e..eb0b635 100644 --- a/spring-integration-smb/src/test/java/org/springframework/integration/smb/SmbMessageHistoryTests.java +++ b/spring-integration-smb/src/test/java/org/springframework/integration/smb/SmbMessageHistoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,12 +24,13 @@ import org.springframework.integration.endpoint.SourcePollingChannelAdapter; /** * @author Markus Spann + * @author Prafull Kumar Soni * */ public class SmbMessageHistoryTests extends AbstractBaseTests { @Test - public void testMessageHistory() throws Exception { + public void testMessageHistory() { SourcePollingChannelAdapter adapter = getApplicationContext() .getBean("smbInboundChannelAdapter", SourcePollingChannelAdapter.class); assertEquals("smbInboundChannelAdapter", adapter.getComponentName()); diff --git a/spring-integration-smb/src/test/java/org/springframework/integration/smb/SmbParserInboundTests.java b/spring-integration-smb/src/test/java/org/springframework/integration/smb/SmbParserInboundTests.java index 9498ae5..e5c58e2 100644 --- a/spring-integration-smb/src/test/java/org/springframework/integration/smb/SmbParserInboundTests.java +++ b/spring-integration-smb/src/test/java/org/springframework/integration/smb/SmbParserInboundTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,6 +27,7 @@ import org.springframework.context.support.ClassPathXmlApplicationContext; /** * @author Markus Spann + * @author Prafull Kumar Soni * */ public class SmbParserInboundTests extends AbstractBaseTests { @@ -38,7 +39,7 @@ public class SmbParserInboundTests extends AbstractBaseTests { } @Test - public void testLocalFilesAutoCreationTrue() throws Exception { + public void testLocalFilesAutoCreationTrue() { assertFileNotExists(new File("test-temp/local-10")); new ClassPathXmlApplicationContext(getApplicationContextXmlFile(), this.getClass()); assertFileExists(new File("test-temp/local-10")); @@ -46,7 +47,7 @@ public class SmbParserInboundTests extends AbstractBaseTests { } @Test(expected = BeanCreationException.class) - public void testLocalFilesAutoCreationFalse() throws Exception { + public void testLocalFilesAutoCreationFalse() { assertFileNotExists(new File("test-temp/local-6")); new ClassPathXmlApplicationContext(getApplicationContextXmlFile("-fail"), this.getClass()) .close(); diff --git a/spring-integration-smb/src/test/java/org/springframework/integration/smb/config/SmbInboundChannelAdapterParserTests.java b/spring-integration-smb/src/test/java/org/springframework/integration/smb/config/SmbInboundChannelAdapterParserTests.java index eef2ea6..143c010 100644 --- a/spring-integration-smb/src/test/java/org/springframework/integration/smb/config/SmbInboundChannelAdapterParserTests.java +++ b/spring-integration-smb/src/test/java/org/springframework/integration/smb/config/SmbInboundChannelAdapterParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,7 +24,9 @@ import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; +import java.util.Iterator; import java.util.Map; +import java.util.Set; import java.util.concurrent.PriorityBlockingQueue; import org.junit.Test; @@ -34,6 +36,9 @@ 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.filters.CompositeFileListFilter; +import org.springframework.integration.file.filters.FileListFilter; +import org.springframework.integration.smb.filters.SmbPersistentAcceptOnceFileListFilter; import org.springframework.integration.smb.filters.SmbSimplePatternFileListFilter; import org.springframework.integration.smb.inbound.SmbInboundFileSynchronizer; import org.springframework.integration.smb.inbound.SmbInboundFileSynchronizingMessageSource; @@ -47,6 +52,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; * @author Markus Spann * @author Gunnar Hillert * @author Artem Bilan + * @author Prafull Kumar Soni */ @ContextConfiguration @RunWith(SpringJUnit4ClassRunner.class) @@ -56,11 +62,10 @@ public class SmbInboundChannelAdapterParserTests { ApplicationContext applicationContext; @Test(timeout = 100000) - public void testSmbInboundChannelAdapterComplete() throws Exception { + public void testSmbInboundChannelAdapterComplete() { final SourcePollingChannelAdapter adapter = this.applicationContext.getBean("smbInbound", SourcePollingChannelAdapter.class); final PriorityBlockingQueue queue = TestUtils.getPropertyValue(adapter, "source.fileSource.toBeReceived", PriorityBlockingQueue.class); - assertNotNull(queue.comparator()); assertEquals("smbInbound", adapter.getComponentName()); assertEquals("smb:inbound-channel-adapter", adapter.getComponentType()); @@ -75,14 +80,20 @@ public class SmbInboundChannelAdapterParserTests { String remoteFileSeparator = (String) TestUtils.getPropertyValue(fisync, "remoteFileSeparator"); assertNotNull(remoteFileSeparator); assertEquals("", remoteFileSeparator); - SmbSimplePatternFileListFilter filter = (SmbSimplePatternFileListFilter) TestUtils.getPropertyValue(fisync, "filter"); + FileListFilter filter = TestUtils.getPropertyValue(fisync, "filter", FileListFilter.class); assertNotNull(filter); + assertThat(filter, instanceOf(CompositeFileListFilter.class)); + Set fileFilters = TestUtils.getPropertyValue(filter, "fileFilters", Set.class); + + Iterator filtersIterator = fileFilters.iterator(); + assertThat(filtersIterator.next(), instanceOf(SmbSimplePatternFileListFilter.class)); + assertThat(filtersIterator.next(), instanceOf(SmbPersistentAcceptOnceFileListFilter.class)); Object sessionFactory = TestUtils.getPropertyValue(fisync, "remoteFileTemplate.sessionFactory"); assertTrue(SmbSessionFactory.class.isAssignableFrom(sessionFactory.getClass())); } @Test - public void testNoCachingSessionFactoryByDefault() throws Exception { + public void testNoCachingSessionFactoryByDefault() { SourcePollingChannelAdapter adapter = applicationContext.getBean("simpleAdapter", SourcePollingChannelAdapter.class); Object sessionFactory = TestUtils.getPropertyValue(adapter, "source.synchronizer.remoteFileTemplate.sessionFactory"); assertThat(sessionFactory, instanceOf(SmbSessionFactory.class)); @@ -94,7 +105,7 @@ public class SmbInboundChannelAdapterParserTests { } @Test(timeout = 10000) - public void testSmbInboundChannelAdapterCompleteNoId() throws Exception { + public void testSmbInboundChannelAdapterCompleteNoId() { Map spcas = applicationContext.getBeansOfType(SourcePollingChannelAdapter.class); SourcePollingChannelAdapter adapter = null; @@ -109,7 +120,7 @@ public class SmbInboundChannelAdapterParserTests { public static class TestSessionFactoryBean implements FactoryBean { - public SmbSessionFactory getObject() throws Exception { + public SmbSessionFactory getObject() { SmbSessionFactory smbFactory = mock(SmbSessionFactory.class); SmbSession session = mock(SmbSession.class); when(smbFactory.getSession()).thenReturn(session); diff --git a/spring-integration-smb/src/test/java/org/springframework/integration/smb/config/SmbOutboundChannelAdapterParserTests.java b/spring-integration-smb/src/test/java/org/springframework/integration/smb/config/SmbOutboundChannelAdapterParserTests.java index 9b73422..6e5504a 100644 --- a/spring-integration-smb/src/test/java/org/springframework/integration/smb/config/SmbOutboundChannelAdapterParserTests.java +++ b/spring-integration-smb/src/test/java/org/springframework/integration/smb/config/SmbOutboundChannelAdapterParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,11 +39,12 @@ import org.springframework.messaging.MessageHandler; * @author Markus Spann * @author Gunnar Hillert * @author Artem Bilan + * @author Prafull Kumar Soni */ public class SmbOutboundChannelAdapterParserTests extends AbstractBaseTests { @Test - public void testSmbOutboundChannelAdapterComplete() throws Exception { + public void testSmbOutboundChannelAdapterComplete() { ApplicationContext ac = getApplicationContext(); Object consumer = ac.getBean("smbOutboundChannelAdapter"); diff --git a/spring-integration-smb/src/test/java/org/springframework/integration/smb/outbound/SmbSendingMessageHandlerTests.java b/spring-integration-smb/src/test/java/org/springframework/integration/smb/outbound/SmbSendingMessageHandlerTests.java index d2b6007..bd3b9b9 100644 --- a/spring-integration-smb/src/test/java/org/springframework/integration/smb/outbound/SmbSendingMessageHandlerTests.java +++ b/spring-integration-smb/src/test/java/org/springframework/integration/smb/outbound/SmbSendingMessageHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,6 +44,7 @@ import jcifs.smb.SmbFile; /** * @author Markus Spann * @author Artem Bilan + * @author Prafull Kumar Soni */ public class SmbSendingMessageHandlerTests extends AbstractBaseTests { @@ -65,7 +66,7 @@ public class SmbSendingMessageHandlerTests extends AbstractBaseTests { } @Test - public void testHandleFileContentMessage() throws Exception { + public void testHandleFileContentMessage() { File file = createNewFile("remote-target-dir/handlerContent.test"); FileTransferringMessageHandler handler = new FileTransferringMessageHandler(smbSessionFactory); handler.setRemoteDirectoryExpression(new LiteralExpression("remote-target-dir")); @@ -78,7 +79,7 @@ public class SmbSendingMessageHandlerTests extends AbstractBaseTests { } @Test - public void testHandleFileAsByte() throws Exception { + public void testHandleFileAsByte() { File file = createNewFile("remote-target-dir/handlerContent.test"); FileTransferringMessageHandler handler = new FileTransferringMessageHandler(smbSessionFactory); handler.setRemoteDirectoryExpression(new LiteralExpression("remote-target-dir")); @@ -135,7 +136,7 @@ public class SmbSendingMessageHandlerTests extends AbstractBaseTests { doAnswer(new Answer() { - public Object answer(InvocationOnMock _invocation) throws Throwable { + public Object answer(InvocationOnMock _invocation) { String path = (String) _invocation.getArguments()[0]; new File(path).mkdirs(); return null;