#121 Automatikus email tárgy módosításának lehetősége
authorVásáry Dániel <daniel.vasary@userrendszerhaz.hu>
Fri, 18 Jan 2019 13:52:02 +0000 (13:52 +0000)
committerVásáry Dániel <daniel.vasary@userrendszerhaz.hu>
Fri, 18 Jan 2019 13:52:02 +0000 (13:52 +0000)
git-tfs-id: [http://tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube;C31390

client/IntegrationTests/JobEngineIT.cs
client/Maestro/Configuration/configuration.json
client/MaestroShared/Commons/PatternNameMaker.cs
client/MaestroShared/Configuration/ConfigurationInfo.cs
client/MaestroShared/Interfaces/IMediaCubeApi.cs
client/MaestroShared/Targets/UNCTargetProcessor.cs
client/MediaCubeClient/MediaCubeApi.cs
server/-configuration/test-deploy-bkup-mediacube-modules.launch [deleted file]

index 94a01ef510d77a69ff0a183e5ed1b09365ec0b48..ffe0859e2a8dac219ce2171c2ffc84f259abbb17 100644 (file)
@@ -1,8 +1,8 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;\r
+using MaestroShared.Model;\r
 using MediaCubeClient;\r
-using System.Net;\r
+using Microsoft.VisualStudio.TestTools.UnitTesting;\r
 using System;\r
-using MaestroShared.Model;\r
+using System.Net;\r
 \r
 namespace IntegrationTests {\r
     [TestClass]\r
@@ -77,7 +77,7 @@ namespace IntegrationTests {
         [TestMethod]\r
         public void TestNotify() {\r
             MediaCubeApi client = new MediaCubeApi("http://localhost:8080/services/rest/jobengine/", null, null, 100, null);\r
-            client.Notify("vasay@elgekko.net", "Újravágást kérek!");\r
+            client.Notify("vasay@elgekko.net", null, "Újravágást kérek!");\r
         }\r
 \r
     }\r
index b26d006572bad1b5ce953e854571dd82ab607fd8..20b85668165af316012fa6d39e52a838287a6764 100644 (file)
@@ -53,7 +53,7 @@
     "timeout": 1000\r
   },\r
   "wsserver": {\r
-    "address": "ws://10.10.1.27/services/wsapi",\r
+    "address": "ws://10.10.1.29:88/services/wsapi",\r
     "timeout": 1000\r
   },\r
   "jobTemplate": "retrieve-material.xml",\r
         "timeout": 1000\r
       }\r
     },\r
-  {\r
-    "label": "Teszt",\r
-    "processor": "FTPTargetProcessor",\r
-    "outputFormat": "%ID%-%SOURCENAME%",\r
-    "tag": "Betöltés",\r
-    "killDateDays": 7,\r
-    "saveArchiveMetadata": false,\r
-    "sendEmailOnSuccess": true,\r
-    "successEmailPattern": "A %ID% - %ITEMTITLE% anyag felkerült a szerverre.\r\nJSON: %JSON%",\r
-    "successEmailRecipient": "vasary@elgekko.net",\r
-    "remote": {\r
-      "address": "ftp://10.10.1.105/TESZT/CHECK",\r
-      "userName": "mediacube",\r
-      "password": "Dn8t4gfHcK98o8hyPgLDhr5SgSji4JCxsfpMJsODikUp3nXgrM0UNCi45lLAK8ZOnmEneO44P9qpJ4QDqhctN6MxZodjJgdZTyoZKmSa+ECzEzLr/wPYNgxVaXrVotEy",\r
-      "timeout": 1000\r
-    }\r
-  },\r
+    {\r
+      "label": "Teszt",\r
+      "processor": "FTPTargetProcessor",\r
+      "outputFormat": "%ID%-%SOURCENAME%",\r
+      "tag": "Betöltés",\r
+      "killDateDays": 7,\r
+      "saveArchiveMetadata": false,\r
+      "sendEmailOnSuccess": true,\r
+      "successEmailPattern": "%JSON%",\r
+      "successEmailSubject": "%ID% - %ITEMTITLE% sikeres feltöltése",\r
+      "successEmailRecipient": "vasary@elgekko.net",\r
+      "remote": {\r
+        "address": "ftp://10.10.1.105/TESZT/CHECK",\r
+        "userName": "mediacube",\r
+        "password": "Dn8t4gfHcK98o8hyPgLDhr5SgSji4JCxsfpMJsODikUp3nXgrM0UNCi45lLAK8ZOnmEneO44P9qpJ4QDqhctN6MxZodjJgdZTyoZKmSa+ECzEzLr/wPYNgxVaXrVotEy",\r
+        "timeout": 1000\r
+      }\r
+    },\r
     {\r
       "label": "Napi megtekintőbe",\r
       "processor": "FTPTargetProcessor",\r
index 60dbd5a6ec294824b084f3fa5b62fa83fb04870e..6194280346e5c432b58bfbcf60a7e296abc05548 100644 (file)
@@ -45,19 +45,17 @@ namespace MaestroShared.Commons {
         }\r
 \r
         static public string Get(string pattern, string id, string inputName, string outputName, string userName, string text, DateTime? storedDateTime = null, string json = null, string itemTitle = null, string mediaTitle = null) {\r
+            if (pattern == null)\r
+                return null;\r
             string idRoot = id != null && id.Contains(UNDERSCORE) ? id.Split(UNDERSCORE[0])[0] : id;\r
             DateTime dt = storedDateTime == null ? DateTime.Now : (DateTime)storedDateTime;\r
-            var trimmedJSON = json;\r
-            if (json != null) {\r
-                trimmedJSON = json.Replace("\r", "").Replace("\n", "");\r
-            }\r
             string result = pattern\r
                 .Replace(PATTERN_ID, id)\r
                 .Replace(PATTERN_IDROOT, idRoot)\r
                 .Replace(PATTERN_GUID, ((ShortGuid)Guid.NewGuid()).ToString())\r
                 .Replace(PATTERN_TIMESTAMP, dt.ToString(DATETIME_FORMAT, CultureInfo.InvariantCulture))\r
                 .Replace(PATTERN_DATESTAMP, dt.ToString(DATE_FORMAT_NODOTS, CultureInfo.InvariantCulture))\r
-                .Replace(PATTERN_JSON, trimmedJSON)\r
+                .Replace(PATTERN_JSON, json)\r
                 .Replace(PATTERN_ITEMTITLE, itemTitle)\r
                 .Replace(PATTERN_MEDIATITLE, mediaTitle);\r
 \r
index 320d33cb31a4ced461ffb522f060877b0a31567c..825a4c8c6a598471adff3d8d849c38be66767bdb 100644 (file)
@@ -116,6 +116,7 @@ namespace MaestroShared.Configuration {
         public string ErrorEmailPattern { get; set; }\r
         public bool SendEmailOnSuccess { get; set; }\r
         public string SuccessEmailRecipient { get; set; }\r
+        public string SuccessEmailSubject { get; set; }\r
         public string SuccessEmailPattern { get; set; }\r
         public string[] Reference { get; set; }\r
         public bool NexioServer { get; set; }\r
index eb5e1bf9064fc350c52095de1a9307bdf9a314db..eba6cab356ab66ec251b4c2ed8992a811c3a9ddd 100644 (file)
@@ -2,6 +2,6 @@
 namespace MaestroShared.Interfaces {\r
     public interface IMediaCubeApi {\r
         T Create<T>(object data);\r
-        void Notify(string to, string content);\r
+        void Notify(string to, string subject, string content);\r
     }\r
 }\r
index dfe3609e346cb15041047d25087b737bb9e5f8a6..1b1311b37960bd6599894be921468edc553960c1 100644 (file)
@@ -116,7 +116,7 @@ namespace MaestroShared.Targets {
                 workFlowAction.successful = false;\r
                 logger.Error(e);\r
                 if (Parameters.TargetConfig.SendEmailOnError && !string.IsNullOrEmpty(Parameters.TargetConfig.ErrorEmailRecipient) && !String.IsNullOrEmpty(Parameters.TargetConfig.ErrorEmailPattern))\r
-                    SendEmail(Parameters.TargetConfig.ErrorEmailRecipient, Parameters.TargetConfig.ErrorEmailPattern);\r
+                    SendEmail(Parameters.TargetConfig.ErrorEmailRecipient, null, Parameters.TargetConfig.ErrorEmailPattern);\r
             } finally {\r
                 AfterExecute();\r
             }\r
@@ -214,7 +214,7 @@ namespace MaestroShared.Targets {
                 Parameters?.TrafficApi?.Approve(Parameters.VariantID, true, Parameters.MetadataKind, trafficItem, ifCompleted);\r
             }\r
             if (Parameters.TargetConfig.SendEmailOnSuccess && !String.IsNullOrEmpty(Parameters.TargetConfig.SuccessEmailRecipient) && !String.IsNullOrEmpty(Parameters.TargetConfig.SuccessEmailPattern))\r
-                SendEmail(Parameters.TargetConfig.SuccessEmailRecipient, Parameters.TargetConfig.SuccessEmailPattern);\r
+                SendEmail(Parameters.TargetConfig.SuccessEmailRecipient, Parameters.TargetConfig.SuccessEmailSubject, Parameters.TargetConfig.SuccessEmailPattern);\r
             logger.Trace(Strings.EXIT);\r
         }\r
 \r
@@ -258,11 +258,12 @@ namespace MaestroShared.Targets {
             logger.Trace(Strings.EXIT);\r
         }\r
 \r
-        private void SendEmail(string to, string messagePattern) {\r
+        private void SendEmail(string to, string subjectPattern, string messagePattern) {\r
             logger.Trace(Strings.ENTRY);\r
             try {\r
                 string message = GetDynamicText(messagePattern);\r
-                Parameters.MediaCubeApi.Notify(to, message);\r
+                string subject = GetDynamicText(subjectPattern);\r
+                Parameters.MediaCubeApi.Notify(to, subject, message);\r
             } catch (Exception e) {\r
                 MessageBox.Show(parent, e.Message);\r
             }\r
index f2614a45de4ede260c5130cc13f73d51f06c4302..fdcc547227aaedfcac3584cf11977e2e21df35aa 100644 (file)
@@ -49,10 +49,11 @@ namespace MediaCubeClient {
             return result;\r
         }\r
 \r
-        public void Notify(string to, string content) {\r
+        public void Notify(string to, string subject, string content) {\r
             var request = new RestRequest("notify", Method.GET);\r
             //Debug.WriteLine(body);\r
             request.AddQueryParameter("to", to);\r
+            request.AddQueryParameter("subject", subject);\r
             request.AddQueryParameter("content", content);\r
             var response = client.Execute(request);\r
             if (response.StatusCode != HttpStatusCode.OK || response.ContentLength < 1)\r
diff --git a/server/-configuration/test-deploy-bkup-mediacube-modules.launch b/server/-configuration/test-deploy-bkup-mediacube-modules.launch
deleted file mode 100644 (file)
index ed06cb2..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>\r
-<launchConfiguration type="org.eclipse.m2e.Maven2LaunchConfigurationType">\r
-<booleanAttribute key="M2_DEBUG_OUTPUT" value="false"/>\r
-<stringAttribute key="M2_GOALS" value="clean deploy -Dremote.address=scp://root:password@10.10.1.29 -Dremote.location=/opt/test-mediacube"/>\r
-<booleanAttribute key="M2_NON_RECURSIVE" value="false"/>\r
-<booleanAttribute key="M2_OFFLINE" value="false"/>\r
-<stringAttribute key="M2_PROFILES" value=""/>\r
-<listAttribute key="M2_PROPERTIES"/>\r
-<stringAttribute key="M2_RUNTIME" value="EMBEDDED"/>\r
-<booleanAttribute key="M2_SKIP_TESTS" value="false"/>\r
-<intAttribute key="M2_THREADS" value="1"/>\r
-<booleanAttribute key="M2_UPDATE_SNAPSHOTS" value="false"/>\r
-<stringAttribute key="M2_USER_SETTINGS" value=""/>\r
-<booleanAttribute key="M2_WORKSPACE_RESOLUTION" value="false"/>\r
-<listAttribute key="org.eclipse.debug.ui.favoriteGroups">\r
-<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>\r
-</listAttribute>\r
-<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc}/-modules"/>\r
-</launchConfiguration>\r