From 955b28a7abd1c43ca68558af59fef742ace075d6 Mon Sep 17 00:00:00 2001
From: gary_williams <gary_williams@localhost>
Date: Mon, 08 Jan 2007 11:27:28 +0000
Subject: [PATCH] quality Issue 1074 generate an email containing test report

---
 opendj-sdk/opends/tests/functional-tests/testcases/runTestJob.xml |   43 +++++++++++++++++++++++++++++++++++++++++++
 opendj-sdk/opends/tests/functional-tests/config/config.py         |    2 ++
 2 files changed, 45 insertions(+), 0 deletions(-)

diff --git a/opendj-sdk/opends/tests/functional-tests/config/config.py b/opendj-sdk/opends/tests/functional-tests/config/config.py
index 5ab7036..d201765 100644
--- a/opendj-sdk/opends/tests/functional-tests/config/config.py
+++ b/opendj-sdk/opends/tests/functional-tests/config/config.py
@@ -26,3 +26,5 @@
 DIRECTORY_INSTANCE_SFX  = 'dc=com'
 STAGED_DATA_DIR         = '%s/functional-tests/shared/data' % DIRECTORY_INSTANCE_DIR
 JAVA_HOME               = '/usr/jdk/jdk1.5.0_01'
+SEND_MAIL_AFTER_TEST_RUN= 'FALSE'
+SEND_MAIL_TO            = ' '
diff --git a/opendj-sdk/opends/tests/functional-tests/testcases/runTestJob.xml b/opendj-sdk/opends/tests/functional-tests/testcases/runTestJob.xml
index fe02c98..f452fd5 100644
--- a/opendj-sdk/opends/tests/functional-tests/testcases/runTestJob.xml
+++ b/opendj-sdk/opends/tests/functional-tests/testcases/runTestJob.xml
@@ -300,6 +300,49 @@
         transformer.transform(source, result)      
       </script>
 
+      <if expr="SEND_MAIL_AFTER_TEST_RUN == 'TRUE'">
+
+        <sequence>
+
+          <message>
+            'Sending Email Test Report to %s.' % SEND_MAIL_TO
+          </message>
+
+          <script>
+            MailToList= SEND_MAIL_TO.split(",")
+            MailSubject= 'OpenDS Test Report for %s' % STAF_REMOTE_HOSTNAME
+            MailSendTo= ' '
+          </script>
+
+          <iterate var="Recipient" in="MailToList">
+            <script>
+             MailSendTo='to %s %s' % (Recipient,MailSendTo)
+            </script>
+          </iterate>
+          
+          <stafcmd name="'STAF Command: Send test report %s' % MailSendTo">
+            <location>'%s' % STAF_LOCAL_HOSTNAME </location>
+            <service>'email'</service>
+            <request>
+              'send %s contenttype "text/html" file %s subject "%s" noheader' % (MailSendTo,htmlfile,MailSubject)
+            </request>
+          </stafcmd>
+
+          <if expr="RC != 0">
+            <message log="1" level="'Error'">
+              'Send test report failed. RC: %s STAFResult: %s' % (RC,STAFResult)
+            </message>
+          <else>
+            <message>
+              'Send test report successful. RC: %s' % (RC)
+            </message>
+          </else>
+          </if>
+
+        </sequence>
+
+      </if>
+
     </sequence>
 
   </function>

--
Gitblit v1.10.0