diff --git a/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/AbstractS3Processor.java b/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/AbstractS3Processor.java index 2f3fde8878..b96c05e0c7 100644 --- a/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/AbstractS3Processor.java +++ b/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/AbstractS3Processor.java @@ -121,7 +121,7 @@ public abstract class AbstractS3Processor extends AbstractAWSCredentialsProvider .required(false) .allowableValues( new AllowableValue("Default Signature", "Default Signature"), - new AllowableValue("AWSS3V4Signer", "Signature v4"), + new AllowableValue("AWSS3V4SignerType", "Signature v4"), new AllowableValue("S3SignerType", "Signature v2")) .defaultValue("Default Signature") .build(); diff --git a/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/s3/TestPutS3Object.java b/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/s3/TestPutS3Object.java new file mode 100644 index 0000000000..00f4423911 --- /dev/null +++ b/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/s3/TestPutS3Object.java @@ -0,0 +1,64 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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.apache.nifi.processors.aws.s3; + +import java.util.List; + +import org.apache.nifi.components.AllowableValue; +import org.apache.nifi.processor.ProcessContext; +import org.apache.nifi.util.TestRunner; +import org.apache.nifi.util.TestRunners; + +import com.amazonaws.ClientConfiguration; +import com.amazonaws.auth.AWSCredentialsProvider; +import com.amazonaws.auth.DefaultAWSCredentialsProviderChain; +import com.amazonaws.services.s3.AmazonS3Client; + +import org.junit.Assert; +import org.junit.Test; + + +/** + * Unit tests for {@link PutS3Object}, without interaction with S3. + */ +public class TestPutS3Object { + + @Test + public void testSignerOverrideOptions() { + final AWSCredentialsProvider credentialsProvider = new DefaultAWSCredentialsProviderChain(); + final ClientConfiguration config = new ClientConfiguration(); + final PutS3Object processor = new PutS3Object(); + final TestRunner runner = TestRunners.newTestRunner(processor); + + final List allowableSignerValues = PutS3Object.SIGNER_OVERRIDE.getAllowableValues(); + final String defaultSignerValue = PutS3Object.SIGNER_OVERRIDE.getDefaultValue(); + + for (AllowableValue allowableSignerValue : allowableSignerValues) { + String signerType = allowableSignerValue.getValue(); + if (!signerType.equals(defaultSignerValue)) { + runner.setProperty(PutS3Object.SIGNER_OVERRIDE, signerType); + ProcessContext context = runner.getProcessContext(); + try { + AmazonS3Client s3Client = processor.createClient(context, credentialsProvider, config); + } catch (IllegalArgumentException argEx) { + Assert.fail(argEx.getMessage()); + } + } + } + } + +}