You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by ma...@apache.org on 2015/10/25 16:03:07 UTC

[07/41] nifi git commit: Remove the process to check if the target key exists or not

Remove the process to check if the target key exists or not


Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/d32a32a9
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/d32a32a9
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/d32a32a9

Branch: refs/heads/NIFI-810-InputRequirement
Commit: d32a32a92d29707d22899862594a2679d3fb2273
Parents: c492a1a
Author: Yu ISHIKAWA <yu...@gmail.com>
Authored: Mon Sep 7 23:32:48 2015 +0900
Committer: Yu ISHIKAWA <yu...@gmail.com>
Committed: Mon Sep 7 23:32:48 2015 +0900

----------------------------------------------------------------------
 .../nifi/processors/aws/s3/DeleteS3Object.java       | 15 ---------------
 .../nifi/processors/aws/s3/TestDeleteS3Object.java   | 14 ++------------
 2 files changed, 2 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/d32a32a9/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/DeleteS3Object.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/DeleteS3Object.java b/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/DeleteS3Object.java
index dffcab8..c8950c3 100644
--- a/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/DeleteS3Object.java
+++ b/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/DeleteS3Object.java
@@ -65,11 +65,6 @@ public class DeleteS3Object extends AbstractS3Processor {
             new HashSet<>(Arrays.asList(REL_SUCCESS, REL_FAILURE, REL_NOT_FOUND)));
 
     @Override
-    public Set<Relationship> getRelationships() {
-        return relationships;
-    }
-
-    @Override
     protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
         return properties;
     }
@@ -89,16 +84,6 @@ public class DeleteS3Object extends AbstractS3Processor {
 
         final AmazonS3 s3 = getClient();
 
-        // Checks if the key exists or not
-        // If there is no such a key, then throws a exception
-        try {
-          s3.getObjectMetadata(bucket, key);
-        } catch (final AmazonServiceException ase) {
-            getLogger().error("Not found such a S3 object for {}; routing to not found", new Object[]{flowFile, ase});
-            session.transfer(flowFile, REL_NOT_FOUND);
-            return;
-        }
-
         // Deletes a key on Amazon S3
         try {
             if (versionId == null) {

http://git-wip-us.apache.org/repos/asf/nifi/blob/d32a32a9/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/s3/TestDeleteS3Object.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/s3/TestDeleteS3Object.java b/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/s3/TestDeleteS3Object.java
index 04d9e61..082a80d 100644
--- a/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/s3/TestDeleteS3Object.java
+++ b/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/s3/TestDeleteS3Object.java
@@ -22,12 +22,9 @@ import java.io.IOException;
 import java.net.URL;
 import java.util.HashMap;
 import java.util.Map;
-import java.util.Set;
-
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
-import static org.junit.Assert.assertEquals;
 
 import com.amazonaws.auth.PropertiesCredentials;
 import com.amazonaws.services.s3.AmazonS3Client;
@@ -36,7 +33,7 @@ import com.amazonaws.services.s3.model.CreateBucketRequest;
 import com.amazonaws.services.s3.model.DeleteBucketRequest;
 import com.amazonaws.services.s3.model.PutObjectRequest;
 import com.amazonaws.services.s3.model.PutObjectResult;
-import org.apache.nifi.processor.Relationship;
+
 import org.apache.nifi.util.TestRunner;
 import org.apache.nifi.util.TestRunners;
 
@@ -128,14 +125,7 @@ public class TestDeleteS3Object {
         runner.enqueue(new byte[0], attrs);
         runner.run(1);
 
-        runner.assertAllFlowFilesTransferred(DeleteS3Object.REL_NOT_FOUND, 1);
-    }
-
-    @Test
-    public void testGetRelationships() {
-        DeleteS3Object deleter = new DeleteS3Object();
-        Set<Relationship> relationships = deleter.getRelationships();
-        assertEquals(relationships.size(), 3);
+        runner.assertAllFlowFilesTransferred(DeleteS3Object.REL_FAILURE, 1);
     }
 
     // Uploads a test file