You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@eagle.apache.org by yo...@apache.org on 2016/09/07 17:42:07 UTC

[11/52] [abbrv] incubator-eagle git commit: EAGLE-483 Test email alert publisher Test email alert publisher: configuration and connecting authentication.

EAGLE-483 Test email alert publisher
Test email alert publisher: configuration and connecting authentication.

https://issues.apache.org/jira/browse/EAGLE-483

Author: @pkuwm <ih...@gmail.com>
Reviewer: @DadanielZ <da...@apache.org>

Closes #365


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/24e6622c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/24e6622c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/24e6622c

Branch: refs/heads/master
Commit: 24e6622cacf6189fc04dbf7dfeb32eb123fcbc35
Parents: b54a63e
Author: DadanielZ <da...@apache.org>
Authored: Wed Aug 24 14:51:11 2016 -0700
Committer: DadanielZ <da...@apache.org>
Committed: Wed Aug 24 14:51:11 2016 -0700

----------------------------------------------------------------------
 .../eagle/alert/engine/runner/AlertBolt.java    |  4 +-
 .../src/test/resources/publishments1.json       | 41 +++++++++++---------
 .../src/test/resources/publishments2.json       | 39 +++++++++++--------
 .../src/test/resources/testPublishSpec.json     | 20 ++++++----
 .../src/test/resources/testPublishSpec2.json    | 20 ++++++----
 5 files changed, 71 insertions(+), 53 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/24e6622c/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/runner/AlertBolt.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/runner/AlertBolt.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/runner/AlertBolt.java
index 86c8b3d..ce5125b 100755
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/runner/AlertBolt.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/runner/AlertBolt.java
@@ -115,8 +115,8 @@ public class AlertBolt extends AbstractStreamBolt implements AlertBoltSpecListen
                         specVersion.contains("spec_version_") && stream_event_version.contains("spec_version_")){
 //                    Long timestamp_of_specVersion = Long.valueOf(specVersion.split("spec_version_")[1]);
 //                    Long timestamp_of_streamEventVersion = Long.valueOf(stream_event_version.split("spec_version_")[1]);
-                    Long timestamp_of_specVersion = Long.valueOf(specVersion.substring(13));
-                    Long timestamp_of_streamEventVersion = Long.valueOf(stream_event_version.substring(13));
+                    long timestamp_of_specVersion = Long.valueOf(specVersion.substring(13));
+                    long timestamp_of_streamEventVersion = Long.valueOf(stream_event_version.substring(13));
                     specVersionOutofdate = timestamp_of_specVersion < timestamp_of_streamEventVersion;
                     if (!specVersionOutofdate){
                         pe.getEvent().setMetaVersion(specVersion);

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/24e6622c/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/publishments1.json
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/publishments1.json b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/publishments1.json
index 2e04e78..0b2d727 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/publishments1.json
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/publishments1.json
@@ -1,20 +1,25 @@
 [
-{
-	"name":"test-stream-output",
-	"type":"org.apache.eagle.alert.engine.publisher.impl.AlertEmailPublisher",
-	"policyIds": [
-		"perfmon_cpu_host_check", "perfmon_cpu_pool_check"
-	],
-	"properties": {
-	  "subject":"UMP Test Alert",
-	  "template":"",
-	  "sender": "sender@corp.com",
-	  "recipients": "services@corp.com",
-	  "smtp.server":"sender.mailhost.com",
-	  "connection": "plaintext",
-	  "smtp.port": "25"
-	},
-	"dedupIntervalMin" : "PT1M",
-	"serializer" : "org.apache.eagle.alert.engine.publisher.impl.StringEventSerializer"
-}
+  {
+    "name": "test-stream-output",
+    "type": "org.apache.eagle.alert.engine.publisher.impl.AlertEmailPublisher",
+    "policyIds": [
+      "perfmon_cpu_host_check",
+      "perfmon_cpu_pool_check"
+    ],
+    "properties": {
+      "subject": "Test Alert",
+      "template": "",
+      "sender": "sender@corp.com",
+      "recipients": "services@corp.com",
+      "mail.smtp.host": "smtp.mailhost.com",
+      "mail.smtp.auth": "true",
+      "mail.username": "username",
+      "mail.password": "password",
+      "mail.debug": "false",
+      "mail.connection": "tls",
+      "mail.smtp.port": "587"
+    },
+    "dedupIntervalMin": "PT1M",
+    "serializer": "org.apache.eagle.alert.engine.publisher.impl.StringEventSerializer"
+  }
 ]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/24e6622c/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/publishments2.json
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/publishments2.json b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/publishments2.json
index 277ba75..6a4918a 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/publishments2.json
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/publishments2.json
@@ -1,19 +1,24 @@
 [
-{
-	"name":"test-stream-output",
-	"type":"org.apache.eagle.alert.engine.publisher.impl.AlertEmailPublisher",
-	"policyIds": [
-		"policy1", "policy2"
-	],
-	"properties": {
-	  "subject":"UMP Test Alert",
-	  "template":"",
-	  "sender": "sender@corp.com",
-	  "recipients": "receiver@corp.com",
-	  "smtp.server":"mailhost.com",
-	  "connection": "plaintext",
-	  "smtp.port": "25"
-	},
-	"dedupIntervalMin" : "PT0M"
-}
+  {
+    "name": "test-stream-output",
+    "type": "org.apache.eagle.alert.engine.publisher.impl.AlertEmailPublisher",
+    "policyIds": [
+      "policy1",
+      "policy2"
+    ],
+    "properties": {
+      "subject": "Test Alert",
+      "template": "",
+      "sender": "sender@corp.com",
+      "recipients": "receiver@corp.com",
+      "mail.smtp.host": "smtp.mailhost.com",
+      "mail.smtp.auth": "true",
+      "mail.username": "username",
+      "mail.password": "password",
+      "mail.debug": "false",
+      "mail.connection": "tls",
+      "mail.smtp.port": "587"
+    },
+    "dedupIntervalMin": "PT0M"
+  }
 ]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/24e6622c/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/testPublishSpec.json
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/testPublishSpec.json b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/testPublishSpec.json
index 220c8fe..66b3852 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/testPublishSpec.json
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/testPublishSpec.json
@@ -8,14 +8,18 @@
       "name":"email-testAlertStream",
       "policyIds": ["policy1", "policy2", "policy3"],
       "dedupIntervalMin": "PT1M",
-      "properties":{
-        "subject":"UMP Test Alert",
-        "template":"",
-	  "sender": "sender@corp.com",
-	  "recipients": "receiver@corp.com",
-	  "smtp.server":"mailhost.com",
-        "connection": "plaintext",
-        "smtp.port": "25"
+      "properties": {
+        "subject": "Test Alert",
+        "template": "",
+        "sender": "sender@corp.com",
+        "recipients": "receiver@corp.com",
+        "mail.smtp.host": "smtp.mailhost.com",
+        "mail.smtp.auth": "true",
+        "mail.username": "username",
+        "mail.password": "password",
+        "mail.debug": "false",
+        "mail.connection": "tls",
+        "mail.smtp.port": "587"
       }
     }
 /*    {

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/24e6622c/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/testPublishSpec2.json
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/testPublishSpec2.json b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/testPublishSpec2.json
index 0a16540..0108a1e 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/testPublishSpec2.json
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/testPublishSpec2.json
@@ -8,14 +8,18 @@
       "name":"email-testAlertStream",
       "policyIds": ["policy1"],
       "dedupIntervalMin": "PT2M",
-      "properties":{
-        "subject":"UMP Test Alert",
-        "template":"",
-	  "sender": "sender@corp.com",
-	  "recipients": "receiver@corp.com",
-	  "smtp.server":"mailhost.com",
-        "connection": "plaintext",
-        "smtp.port": "25"
+      "properties": {
+        "subject": "Test Alert",
+        "template": "",
+        "sender": "sender@corp.com",
+        "recipients": "receiver@corp.com",
+        "mail.smtp.host": "smtp.mailhost.com",
+        "mail.smtp.auth": "true",
+        "mail.username": "username",
+        "mail.password": "password",
+        "mail.debug": "false",
+        "mail.connection": "tls",
+        "mail.smtp.port": "587"
       }
     }
 //    {