Start version 2.0

* Upgrade to SI-5.0, SC-AWS-2.0, Gradle-4.4.1 and some Gradle plugins
* Add `Jackson` dependency for compatibility with SF
* Implement new API of super classes
* Fix deprecations
* Fix tests for new state of classes under test
* Rename XSD to version 2.0
This commit is contained in:
Artem Bilan
2017-12-20 17:14:08 -05:00
parent 2da3d99314
commit 42a4a45de8
22 changed files with 85 additions and 49 deletions

View File

@@ -3,7 +3,7 @@ buildscript {
maven { url 'http://repo.spring.io/plugins-release' }
}
dependencies {
classpath 'io.spring.gradle:dependency-management-plugin:1.0.3.RELEASE'
classpath 'io.spring.gradle:dependency-management-plugin:1.0.4.RELEASE'
classpath 'io.spring.gradle:spring-io-plugin:0.0.8.RELEASE'
}
}
@@ -13,7 +13,7 @@ plugins {
id 'eclipse'
id 'idea'
id 'jacoco'
id 'org.sonarqube' version '2.5'
id 'org.sonarqube' version '2.6.1'
id 'checkstyle'
}
description = 'Spring Integration AWS Support'
@@ -32,10 +32,11 @@ repositories {
ext {
assertjVersion = '3.8.0'
jacksonVersion = '2.9.3'
servletApiVersion = '3.1.0'
slf4jVersion = '1.7.25'
springCloudAwsVersion = '1.2.2.RELEASE'
springIntegrationVersion = '4.3.12.RELEASE'
springCloudAwsVersion = '2.0.0.BUILD-SNAPSHOT'
springIntegrationVersion = '5.0.1.BUILD-SNAPSHOT'
idPrefix = 'aws'
@@ -52,11 +53,6 @@ ext.javadocLinks = [
] as String[]
compileJava {
sourceCompatibility = 1.7
targetCompatibility = 1.7
}
compileTestJava {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
@@ -96,13 +92,14 @@ jacoco {
checkstyle {
configFile = file("${rootDir}/src/checkstyle/checkstyle.xml")
toolVersion = "8.3"
toolVersion = "8.5"
}
dependencies {
compile 'org.springframework.integration:spring-integration-core'
compile 'org.springframework.cloud:spring-cloud-aws-core'
compile("com.fasterxml.jackson.core:jackson-databind:$jacksonVersion", optional)
compile('org.springframework.cloud:spring-cloud-aws-messaging', optional)
compile('org.springframework.integration:spring-integration-file', optional)
compile('org.springframework.integration:spring-integration-http', optional)

View File

@@ -1,2 +1 @@
version=1.1.1.BUILD-SNAPSHOT
org.gradle.daemon=true
version=2.0.0.BUILD-SNAPSHOT

View File

@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.2.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-bin.zip

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-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.
@@ -18,9 +18,11 @@ package org.springframework.integration.aws.config.xml;
import org.springframework.integration.aws.inbound.S3InboundFileSynchronizer;
import org.springframework.integration.aws.inbound.S3InboundFileSynchronizingMessageSource;
import org.springframework.integration.aws.support.filters.S3PersistentAcceptOnceFileListFilter;
import org.springframework.integration.aws.support.filters.S3RegexPatternFileListFilter;
import org.springframework.integration.aws.support.filters.S3SimplePatternFileListFilter;
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;
@@ -51,4 +53,9 @@ public class S3InboundChannelAdapterParser extends AbstractRemoteFileInboundChan
return S3InboundFileSynchronizer.class;
}
@Override
protected Class<? extends AbstractPersistentAcceptOnceFileListFilter<?>> getPersistentAcceptOnceFileListFilterClass() {
return S3PersistentAcceptOnceFileListFilter.class;
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-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.
@@ -18,10 +18,12 @@ package org.springframework.integration.aws.config.xml;
import org.springframework.integration.aws.inbound.S3StreamingMessageSource;
import org.springframework.integration.aws.support.S3RemoteFileTemplate;
import org.springframework.integration.aws.support.filters.S3PersistentAcceptOnceFileListFilter;
import org.springframework.integration.aws.support.filters.S3RegexPatternFileListFilter;
import org.springframework.integration.aws.support.filters.S3SimplePatternFileListFilter;
import org.springframework.integration.core.MessageSource;
import org.springframework.integration.file.config.AbstractRemoteFileStreamingInboundChannelAdapterParser;
import org.springframework.integration.file.filters.AbstractPersistentAcceptOnceFileListFilter;
import org.springframework.integration.file.filters.FileListFilter;
import org.springframework.integration.file.remote.RemoteFileOperations;
@@ -29,6 +31,8 @@ import org.springframework.integration.file.remote.RemoteFileOperations;
* Parser for the AWS 's3-inbound-streaming-channel-adapter' element.
*
* @author Christian Tzolov
* @author Artem Bilan
*
* @since 1.1
*/
public class S3StreamingInboundChannelAdapterParser extends AbstractRemoteFileStreamingInboundChannelAdapterParser {
@@ -53,4 +57,9 @@ public class S3StreamingInboundChannelAdapterParser extends AbstractRemoteFileSt
return S3RegexPatternFileListFilter.class;
}
@Override
protected Class<? extends AbstractPersistentAcceptOnceFileListFilter<?>> getPersistentAcceptOnceFileListFilterClass() {
return S3PersistentAcceptOnceFileListFilter.class;
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-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.
@@ -97,9 +97,8 @@ public class SnsInboundChannelAdapter extends HttpRequestHandlingMessagingGatewa
Arrays.asList(MediaType.APPLICATION_JSON_UTF8, MediaType.TEXT_PLAIN));
super.setRequestMapping(requestMapping);
super.setStatusCodeExpression(new ValueExpression<>(HttpStatus.NO_CONTENT));
super.setMessageConverters(
Collections.<HttpMessageConverter<?>>singletonList(this.jackson2HttpMessageConverter));
super.setRequestPayloadType(HashMap.class);
super.setMessageConverters(Collections.singletonList(this.jackson2HttpMessageConverter));
super.setRequestPayloadTypeClass(HashMap.class);
}
public void setHandleNotificationStatus(boolean handleNotificationStatus) {
@@ -184,7 +183,7 @@ public class SnsInboundChannelAdapter extends HttpRequestHandlingMessagingGatewa
}
@Override
public void setRequestPayloadType(Class<?> requestPayloadType) {
public void setRequestPayloadTypeClass(Class<?> requestPayloadType) {
throw new UnsupportedOperationException();
}
@@ -203,6 +202,7 @@ public class SnsInboundChannelAdapter extends HttpRequestHandlingMessagingGatewa
throw new UnsupportedOperationException();
}
private static class NotificationStatusResolver extends NotificationStatusHandlerMethodArgumentResolver {
NotificationStatusResolver(AmazonSNS amazonSns) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-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.
@@ -42,4 +42,9 @@ public class S3RegexPatternFileListFilter extends AbstractRegexPatternFileListFi
return (file != null) ? file.getKey() : null;
}
@Override
protected boolean isDirectory(S3ObjectSummary file) {
return false;
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-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.
@@ -36,4 +36,9 @@ public class S3SimplePatternFileListFilter extends AbstractSimplePatternFileList
return (file != null) ? file.getKey() : null;
}
@Override
protected boolean isDirectory(S3ObjectSummary file) {
return false;
}
}

View File

@@ -1,2 +1,2 @@
http\://www.springframework.org/schema/integration/aws/spring-integration-aws-1.1.xsd=org/springframework/integration/aws/config/spring-integration-aws-1.1.xsd
http\://www.springframework.org/schema/integration/aws/spring-integration-aws.xsd=org/springframework/integration/aws/config/spring-integration-aws-1.1.xsd
http\://www.springframework.org/schema/integration/aws/spring-integration-aws-2.0.xsd=org/springframework/integration/aws/config/spring-integration-aws-2.0.xsd
http\://www.springframework.org/schema/integration/aws/spring-integration-aws.xsd=org/springframework/integration/aws/config/spring-integration-aws-2.0.xsd

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-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.
@@ -19,8 +19,11 @@ package org.springframework.integration.aws.config.xml;
import static org.assertj.core.api.Assertions.assertThat;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
import java.util.List;
import java.util.Set;
import java.util.concurrent.PriorityBlockingQueue;
import java.util.concurrent.atomic.AtomicReference;
@@ -31,9 +34,12 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.expression.Expression;
import org.springframework.integration.aws.inbound.S3InboundFileSynchronizer;
import org.springframework.integration.aws.inbound.S3InboundFileSynchronizingMessageSource;
import org.springframework.integration.aws.support.filters.S3PersistentAcceptOnceFileListFilter;
import org.springframework.integration.aws.support.filters.S3SimplePatternFileListFilter;
import org.springframework.integration.endpoint.SourcePollingChannelAdapter;
import org.springframework.integration.file.filters.AcceptAllFileListFilter;
import org.springframework.integration.file.filters.CompositeFileListFilter;
import org.springframework.integration.file.filters.FileListFilter;
import org.springframework.integration.file.remote.session.SessionFactory;
import org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizer;
import org.springframework.integration.test.util.TestUtils;
@@ -67,6 +73,7 @@ public class S3InboundChannelAdapterParserTests {
private SessionFactory<?> s3SessionFactory;
@Test
@SuppressWarnings("unchecked")
public void testS3InboundChannelAdapterComplete() throws Exception {
assertThat(TestUtils.getPropertyValue(this.s3Inbound, "autoStartup", Boolean.class)).isFalse();
PriorityBlockingQueue<?> blockingQueue = TestUtils.getPropertyValue(this.s3Inbound,
@@ -90,9 +97,17 @@ public class S3InboundChannelAdapterParserTests {
assertThat(TestUtils.getPropertyValue(fisync, "temporaryFileSuffix", String.class)).isEqualTo(".foo");
String remoteFileSeparator = (String) TestUtils.getPropertyValue(fisync, "remoteFileSeparator");
assertThat(remoteFileSeparator).isEqualTo("\\");
S3SimplePatternFileListFilter filter = TestUtils.getPropertyValue(fisync, "filter",
S3SimplePatternFileListFilter.class);
CompositeFileListFilter<?> filter = TestUtils.getPropertyValue(fisync, "filter", CompositeFileListFilter.class);
assertThat(filter).isNotNull();
Set<FileListFilter<?>> fileFilters = TestUtils.getPropertyValue(filter, "fileFilters", Set.class);
assertThat(fileFilters).size().isEqualTo(2);
List<FileListFilter<?>> filters = new ArrayList<>(fileFilters);
assertThat(filters.get(0)).isInstanceOf(S3SimplePatternFileListFilter.class);
assertThat(filters.get(1)).isInstanceOf(S3PersistentAcceptOnceFileListFilter.class);
assertThat(TestUtils.getPropertyValue(fisync, "remoteFileTemplate.sessionFactory"))
.isSameAs(this.s3SessionFactory);
assertThat(TestUtils.getPropertyValue(inbound, "fileSource.scanner.filter.fileFilters", Collection.class)

View File

@@ -17,8 +17,8 @@
package org.springframework.integration.aws.config.xml;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.BDDMockito.willThrow;
import static org.mockito.Matchers.anyString;
import org.junit.Test;
import org.junit.runner.RunWith;

View File

@@ -17,8 +17,8 @@
package org.springframework.integration.aws.inbound;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.given;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.atLeast;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;

View File

@@ -17,8 +17,8 @@
package org.springframework.integration.aws.inbound;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.willAnswer;
import static org.mockito.Matchers.any;
import java.io.File;
import java.io.FileInputStream;
@@ -178,7 +178,8 @@ public class S3InboundChannelAdapterTests {
synchronizer.setPreserveTimestamp(true);
synchronizer.setRemoteDirectory(S3_BUCKET);
synchronizer.setFilter(new S3RegexPatternFileListFilter(".*\\.test$"));
Expression expression = PARSER.parseExpression("(#this.contains('/') ? #this.substring(#this.lastIndexOf('/') + 1) : #this).toUpperCase() + '.a'");
Expression expression =
PARSER.parseExpression("(#this.contains('/') ? #this.substring(#this.lastIndexOf('/') + 1) : #this).toUpperCase() + '.a'");
synchronizer.setLocalFilenameGeneratorExpression(expression);
return synchronizer;
}

View File

@@ -17,8 +17,8 @@
package org.springframework.integration.aws.inbound;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.willAnswer;
import static org.mockito.Matchers.any;
import java.io.File;
import java.io.FileInputStream;

View File

@@ -18,9 +18,9 @@ package org.springframework.integration.aws.inbound;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.given;
import static org.mockito.BDDMockito.mock;
import static org.mockito.Matchers.any;
import org.junit.Test;
import org.junit.runner.RunWith;

View File

@@ -17,9 +17,9 @@
package org.springframework.integration.aws.outbound;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.BDDMockito.given;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;

View File

@@ -17,8 +17,8 @@
package org.springframework.integration.aws.outbound;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.given;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
import java.nio.ByteBuffer;
@@ -171,9 +171,8 @@ public class KinesisProducingMessageHandlerTests {
given(mock.putRecordAsync(any(PutRecordRequest.class), any(AsyncHandler.class)))
.willAnswer(invocation -> {
PutRecordRequest request = invocation.getArgumentAt(0, PutRecordRequest.class);
AsyncHandler<PutRecordRequest, PutRecordResult> handler =
invocation.getArgumentAt(1, AsyncHandler.class);
PutRecordRequest request = invocation.getArgument(0);
AsyncHandler<PutRecordRequest, PutRecordResult> handler = invocation.getArgument(1);
PutRecordResult result = new PutRecordResult()
.withSequenceNumber(request.getSequenceNumberForOrdering())
.withShardId("shardId-1");
@@ -181,7 +180,7 @@ public class KinesisProducingMessageHandlerTests {
return mock(Future.class);
})
.willAnswer(invocation -> {
AsyncHandler<?, ?> handler = invocation.getArgumentAt(1, AsyncHandler.class);
AsyncHandler<?, ?> handler = invocation.getArgument(1);
handler.onError(new RuntimeException("putRecordRequestEx"));
return mock(Future.class);
});
@@ -189,13 +188,12 @@ public class KinesisProducingMessageHandlerTests {
given(mock.putRecordsAsync(any(PutRecordsRequest.class), any(AsyncHandler.class)))
.willAnswer(invocation -> {
AsyncHandler<PutRecordsRequest, PutRecordsResult> handler =
invocation.getArgumentAt(1, AsyncHandler.class);
AsyncHandler<PutRecordsRequest, PutRecordsResult> handler = invocation.getArgument(1);
handler.onSuccess(new PutRecordsRequest(), new PutRecordsResult());
return mock(Future.class);
})
.willAnswer(invocation -> {
AsyncHandler<?, ?> handler = invocation.getArgumentAt(1, AsyncHandler.class);
AsyncHandler<?, ?> handler = invocation.getArgument(1);
handler.onError(new RuntimeException("putRecordsRequestEx"));
return mock(Future.class);
});

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-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.
@@ -19,9 +19,9 @@ package org.springframework.integration.aws.outbound;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.assertj.core.api.Fail.fail;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.given;
import static org.mockito.BDDMockito.willAnswer;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.atLeastOnce;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-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.
@@ -17,8 +17,8 @@
package org.springframework.integration.aws.outbound;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.willAnswer;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;

View File

@@ -16,8 +16,8 @@
package org.springframework.integration.aws.outbound;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.willAnswer;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
import org.junit.runner.RunWith;

View File

@@ -16,8 +16,8 @@
package org.springframework.integration.aws.outbound;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.willAnswer;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
import org.junit.runner.RunWith;