[asterisk-commits] mjordan: branch mjordan/voicemail_tests_082811 r2069 - in /asterisk/team/mjor...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Sep 2 15:41:13 CDT 2011


Author: mjordan
Date: Fri Sep  2 15:41:10 2011
New Revision: 2069

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=2069
Log:
Reverted local channel changes

Modified:
    asterisk/team/mjordan/voicemail_tests_082811/lib/python/asterisk/TestCase.py
    asterisk/team/mjordan/voicemail_tests_082811/lib/python/asterisk/voicemail.py
    asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/check_voicemail_nominal/configs/ast1/extensions.conf
    asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/check_voicemail_nominal/run-test

Modified: asterisk/team/mjordan/voicemail_tests_082811/lib/python/asterisk/TestCase.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mjordan/voicemail_tests_082811/lib/python/asterisk/TestCase.py?view=diff&rev=2069&r1=2068&r2=2069
==============================================================================
--- asterisk/team/mjordan/voicemail_tests_082811/lib/python/asterisk/TestCase.py (original)
+++ asterisk/team/mjordan/voicemail_tests_082811/lib/python/asterisk/TestCase.py Fri Sep  2 15:41:10 2011
@@ -117,7 +117,6 @@
         """
 
         """
-        logger.info("Setting reactor to timeout")
         reactor.callLater(self.reactor_timeout, self.stop_reactor)
 
     def ami_login_error(self, ami):
@@ -128,12 +127,3 @@
         logger.info("AMI Connect instance %s" % (ami.id + 1))
         self.ami[ami.id] = ami
 
-    """
-    Default handler for originate failures
-    """
-    def defaultHandleOriginateFailure(self, reason):
-        logger.error("Error sending originate:")
-        logger.error(reason.getTraceback())
-        self.stop_reactor()
-
-        return reason

Modified: asterisk/team/mjordan/voicemail_tests_082811/lib/python/asterisk/voicemail.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mjordan/voicemail_tests_082811/lib/python/asterisk/voicemail.py?view=diff&rev=2069&r1=2068&r2=2069
==============================================================================
--- asterisk/team/mjordan/voicemail_tests_082811/lib/python/asterisk/voicemail.py (original)
+++ asterisk/team/mjordan/voicemail_tests_082811/lib/python/asterisk/voicemail.py Fri Sep  2 15:41:10 2011
@@ -71,8 +71,7 @@
     """
     The default expected channel to be used to send info to the voicemail server
     """
-    #defaultSenderChannel = "SIP/ast1-00000000"
-    defaultSenderChannel = "Local/8052 at voicemail"
+    defaultSenderChannel = "SIP/ast1-00000000"
 
     def __init__(self):
         TestCase.__init__(self)
@@ -82,21 +81,6 @@
         self.astSender = None
         self.__testConditions = {}
         self.senderChannel = VoiceMailTest.defaultSenderChannel
-        self.channelAssigned = False
-
-    def ami_connect(self, ami):
-        super(VoiceMailTest, self).ami_connect(ami)
-        logger.info("Registering for Newchannel event")
-        """ Register for the Newchannel event to get the proper channel name """
-        ami.registerEvent('Newchannel', self.newChannelHandler)
-
-    def newChannelHandler(self, ami, event):
-        if event['event'] != 'Newchannel' or self.channelAssigned == True:
-            return
-
-        channel = event['channel']
-        logger.debug("Changing channel name to: " + channel)
-        self.senderChannel = channel
 
     """
     Create the test controller.  Should be called once amiReceiver and amiSender have both been set

Modified: asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/check_voicemail_nominal/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/check_voicemail_nominal/configs/ast1/extensions.conf?view=diff&rev=2069&r1=2068&r2=2069
==============================================================================
--- asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/check_voicemail_nominal/configs/ast1/extensions.conf (original)
+++ asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/check_voicemail_nominal/configs/ast1/extensions.conf Fri Sep  2 15:41:10 2011
@@ -22,17 +22,3 @@
 exten => a,1,UserEvent(TestResult,result: fail,status: failed to exit successfully through '#' key)
 
 exten => t,1,UserEvent(TestResult,result: fail,status: failed to exit successfully through '#' key)
-
-[voicemailCaller]
-
-exten => sendDTMF,1,NoOp()
-	same => n,Verbose(1, Sending DTMF Signal ${DTMF_TO_SEND})
-	same => n,SendDTMF(${DTMF_TO_SEND})
-	same => n,Goto(voicemailCaller,wait,1)
-
-exten => hangup,1,NoOp()
-	same => n,Verbose(1, Hanging up)
-	same => n,Hangup()
-
-exten => wait,1,NoOp()
-	same => n,Wait(10000)

Modified: asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/check_voicemail_nominal/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/check_voicemail_nominal/run-test?view=diff&rev=2069&r1=2068&r2=2069
==============================================================================
--- asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/check_voicemail_nominal/run-test (original)
+++ asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/check_voicemail_nominal/run-test Fri Sep  2 15:41:10 2011
@@ -263,7 +263,7 @@
     """
     The channel to connect to that acts as the voicemail server
     """
-    channel = "Local/8052 at voicemail"
+    channel = "sip/ast1/8052"
 
     """
     The voicemail manager object
@@ -271,7 +271,7 @@
     voicemailManager = None
 
     def __init__(self):
-        super(CheckVoicemailNominal, self).__init__()
+        VoiceMailTest.__init__(self)
 
         """
         Add our test conditions to the test - these will help us verify through the
@@ -296,51 +296,62 @@
         self.addTestCondition("savedMessages", TestCondition(checkSavedMessages, 0))
 
         self.reactor_timeout = 120
-        self.create_asterisk()
+        self.create_asterisk(2)
 
     def ami_connect(self, ami):
-        logger.debug("BLAH")
-        super(CheckVoicemailNominal, self).ami_connect(ami)
-        logger.debug("BLAH")
+        logger.debug("Got AMI Connect for instance " + str(ami.id))
+        TestCase.ami_connect(self, ami)
 
         """ Record which AMI instance we've received and attempt to set up the test controller """
-        self.amiReceiver = ami
-        self.amiSender = ami
-        self.astSender = self.ast[self.amiSender.id]
-        logger.debug("BLAH")
+        if (ami.id == 0):
+            self.amiReceiver = ami
+        elif (ami.id == 1):
+            self.amiSender = ami
+            self.astSender = self.ast[self.amiSender.id]
+
         self.createTestController()
         if (self.testStateController != None):
             startObject = StartVoiceMailState(self.testStateController, self)
             self.testStateController.changeState(startObject)
             self.testStateController.addAssertHandler(self.handleAssert)
-        logger.debug("BLAH")
-        ami.registerEvent('UserEvent', self.user_event)
-        logger.debug("BLAH")
-        """
-        Create some dummy voicemails in a valid voicemailbox - 1 urgent, 2 new, 2 old
-        """
-        self.voicemailManager = VoiceMailMailboxManagement(self.ast[0])
-        self.voicemailManager.createMailbox("default", "1234", True)
-
-        logger.debug("Creating dummy voicemails")
-        for i in range(0, 2):
-            if not self.voicemailManager.createDummyVoicemail("default","1234", self.voicemailManager.inboxFolderName, i, self.formats):
-                logger.error("Failed to create voicemails in folder " + self.voicemailManager.inboxFolderName)
-                self.stop_reactor()
-        for i in range(0, 1):
-            if not self.voicemailManager.createDummyVoicemail("default", "1234", self.voicemailManager.urgentFolderName, i, self.formats):
-                logger.error("Failed to create voicemails in folder " + self.voicemailManager.urgentFolderName)
-                self.stop_reactor()
-        for i in range(0, 2):
-            if not self.voicemailManager.createDummyVoicemail("default", "1234", self.voicemailManager.oldFolderName, i, self.formats):
-                logger.error("Failed to create voicemails in folder " + self.voicemailManager.oldFolderName)
-                self.stop_reactor()
-
-        logger.debug("Originating call to " + self.channel)
-        df = ami.originate(self.channel, "voicemailCaller", "wait", 1)
-        df.addErrback(self.defaultHandleOriginateFailure)
-
-    def handleAssert(self, ami, event):
+
+        """ Now do specific processing on the AMI instances """
+        if (ami.id == 0):
+
+            ami.registerEvent('UserEvent', self.user_event)
+
+            """
+            Create some dummy voicemails in a valid voicemailbox - 1 urgent, 2 new, 2 old
+            """
+            self.voicemailManager = VoiceMailMailboxManagement(self.ast[0])
+            self.voicemailManager.createMailbox("default", "1234", True)
+
+            logger.debug("Creating dummy voicemails")
+            for i in range(0, 2):
+                if not self.voicemailManager.createDummyVoicemail("default","1234", self.voicemailManager.inboxFolderName, i, self.formats):
+                    logger.error("Failed to create voicemails in folder " + self.voicemailManager.inboxFolderName)
+                    self.stop_reactor()
+            for i in range(0, 1):
+                if not self.voicemailManager.createDummyVoicemail("default", "1234", self.voicemailManager.urgentFolderName, i, self.formats):
+                    logger.error("Failed to create voicemails in folder " + self.voicemailManager.urgentFolderName)
+                    self.stop_reactor()
+            for i in range(0, 2):
+                if not self.voicemailManager.createDummyVoicemail("default", "1234", self.voicemailManager.oldFolderName, i, self.formats):
+                    logger.error("Failed to create voicemails in folder " + self.voicemailManager.oldFolderName)
+                    self.stop_reactor()
+        else:
+            logger.debug("Originating call to " + self.channel)
+            df = ami.originate(self.channel, "voicemailCaller", "wait", 1)
+            df.addErrback(self.handleOriginateFailure)
+
+    def handleOriginateFailure(self, reason):
+        logger.error("Error sending originate:")
+        logger.error(reason.getTraceback())
+        self.stop_reactor()
+
+        return reason
+
+    def handleAssert(self, event):
         self.passed = False
         logger.error("Test Failed - Assert received")
         logger.error("\t\t AppFunction: " + event['appfunction'])
@@ -365,8 +376,8 @@
 
 
     def run(self):
-        super(CheckVoicemailNominal, self).run()
-        self.create_ami_factory()
+        TestCase.run(self)
+        self.create_ami_factory(2)
 
 
 def main():




More information about the asterisk-commits mailing list