Search in sources :

Example 1 with S3StreamingMessageSource

use of org.springframework.integration.aws.inbound.S3StreamingMessageSource in project spring-integration-aws by spring-projects.

the class S3StreamingInboundChannelAdapterParserTests method testS3StreamingInboundChannelAdapterComplete.

@Test
public void testS3StreamingInboundChannelAdapterComplete() throws Exception {
    assertThat(TestUtils.getPropertyValue(this.s3Inbound, "autoStartup", Boolean.class)).isFalse();
    assertThat(this.s3Inbound.getComponentName()).isEqualTo("s3Inbound");
    assertThat(this.s3Inbound.getComponentType()).isEqualTo("aws:s3-inbound-streaming-channel-adapter");
    assertThat(TestUtils.getPropertyValue(this.s3Inbound, "outputChannel")).isSameAs(this.s3Channel);
    S3StreamingMessageSource source = TestUtils.getPropertyValue(this.s3Inbound, "source", S3StreamingMessageSource.class);
    assertThat(TestUtils.getPropertyValue(source, "remoteDirectoryExpression", Expression.class).getExpressionString()).isEqualTo("foo/bar");
    assertThat(TestUtils.getPropertyValue(source, "comparator")).isSameAs(this.comparator);
    String remoteFileSeparator = (String) TestUtils.getPropertyValue(source, "remoteFileSeparator");
    assertThat(remoteFileSeparator).isNotNull();
    assertThat(remoteFileSeparator).isEqualTo("\\");
    S3PersistentAcceptOnceFileListFilter filter = TestUtils.getPropertyValue(source, "filter", S3PersistentAcceptOnceFileListFilter.class);
    assertThat(filter).isSameAs(this.acceptOnceFilter);
    assertThat(TestUtils.getPropertyValue(source, "remoteFileTemplate.sessionFactory")).isSameAs(this.s3SessionFactory);
    final AtomicReference<Method> genMethod = new AtomicReference<Method>();
    ReflectionUtils.doWithMethods(AbstractInboundFileSynchronizer.class, new ReflectionUtils.MethodCallback() {

        @Override
        public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException {
            if ("generateLocalFileName".equals(method.getName())) {
                method.setAccessible(true);
                genMethod.set(method);
            }
        }
    });
}
Also used : S3StreamingMessageSource(org.springframework.integration.aws.inbound.S3StreamingMessageSource) Expression(org.springframework.expression.Expression) S3PersistentAcceptOnceFileListFilter(org.springframework.integration.aws.support.filters.S3PersistentAcceptOnceFileListFilter) AtomicReference(java.util.concurrent.atomic.AtomicReference) Method(java.lang.reflect.Method) ReflectionUtils(org.springframework.util.ReflectionUtils) Test(org.junit.Test)

Aggregations

Method (java.lang.reflect.Method)1 AtomicReference (java.util.concurrent.atomic.AtomicReference)1 Test (org.junit.Test)1 Expression (org.springframework.expression.Expression)1 S3StreamingMessageSource (org.springframework.integration.aws.inbound.S3StreamingMessageSource)1 S3PersistentAcceptOnceFileListFilter (org.springframework.integration.aws.support.filters.S3PersistentAcceptOnceFileListFilter)1 ReflectionUtils (org.springframework.util.ReflectionUtils)1