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/02/23 21:35:32 UTC

[3/5] incubator-nifi git commit: NIFI-333 - Adding failure test for PutEmail

NIFI-333 - Adding failure test for PutEmail

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

Branch: refs/heads/develop
Commit: 0fa1b16c831c413a2e31e768398da0602ca3758d
Parents: 361ac1f
Author: danbress <db...@onyxconsults.com>
Authored: Sun Feb 15 09:24:51 2015 -0500
Committer: danbress <db...@onyxconsults.com>
Committed: Sun Feb 15 09:24:51 2015 -0500

----------------------------------------------------------------------
 .../nifi/processors/standard/TestPutEmail.java  | 45 ++++++++++++++++++++
 1 file changed, 45 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/0fa1b16c/nifi/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestPutEmail.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestPutEmail.java b/nifi/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestPutEmail.java
new file mode 100644
index 0000000..b737ed6
--- /dev/null
+++ b/nifi/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestPutEmail.java
@@ -0,0 +1,45 @@
+/*
+ * 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.standard;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.nifi.util.TestRunner;
+import org.apache.nifi.util.TestRunners;
+import org.junit.Test;
+
+public class TestPutEmail {
+
+    @Test
+    public void testHotNotFound() {
+        // verifies that files are routed to failure when the SMTP host doesn't exist
+        final TestRunner runner = TestRunners.newTestRunner(new PutEmail());
+        runner.setProperty(PutEmail.SMTP_HOSTNAME, "host-doesnt-exist123");
+        runner.setProperty(PutEmail.FROM, "test@apache.org");
+        runner.setProperty(PutEmail.TO, "test@apache.org");
+        runner.setProperty(PutEmail.MESSAGE, "Message Body");
+
+        final Map<String, String> attributes = new HashMap<>();
+        runner.enqueue("Some Text".getBytes(), attributes);
+
+        runner.run();
+
+        runner.assertQueueEmpty();
+        runner.assertAllFlowFilesTransferred(PutEmail.REL_FAILURE);
+    }
+}