[asterisk-commits] mjordan: testsuite/asterisk/trunk r3136 - /asterisk/trunk/tests/fastagi/recor...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Mar 23 10:11:27 CDT 2012


Author: mjordan
Date: Fri Mar 23 10:11:25 2012
New Revision: 3136

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=3136
Log:
Another fastagi migration

This time its record-file.  Moved over to use twisted
for process management.

Modified:
    asterisk/trunk/tests/fastagi/record-file/run-test

Modified: asterisk/trunk/tests/fastagi/record-file/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/fastagi/record-file/run-test?view=diff&rev=3136&r1=3135&r2=3136
==============================================================================
--- asterisk/trunk/tests/fastagi/record-file/run-test (original)
+++ asterisk/trunk/tests/fastagi/record-file/run-test Fri Mar 23 10:11:25 2012
@@ -103,9 +103,14 @@
             print "Failed"
 
     def stop_reactor(self):
-        print "Stopping Reactor ..."
-        if reactor.running:
-            reactor.stop()
+        def __finish_stop(result):
+            print "Stopping Reactor ..."
+            if reactor.running:
+                reactor.stop()
+            return result
+
+        df = self.ast1.stop()
+        df.addCallback(__finish_stop)
 
     def launch_test(self):
         print "Originating call to begin test which terminates recording",\
@@ -117,29 +122,25 @@
         else:
             self.result_changed()
 
-    def start_asterisk(self):
-        print "Starting Asterisk"
-        self.ast1.start()
-
-    def stop_asterisk(self):
-        print "Stopping Asterisk"
-        self.ast1.stop()
-
     # Read result before timeout
     def result_changed(self):
         if self.passed['DTMF'] is True and self.passed['HANGUP'] is True:
             self.read_result()
 
     def run(self):
-        self.launch_test()
-        reactor.callLater(self.timeout, self.stop_reactor)
+        def __finish_start_ops(result):
+            self.launch_test()
+            reactor.callLater(self.timeout, self.stop_reactor)
+            return result
+
+        print "Starting Asterisk"
+        df = self.ast1.start()
+        df.addCallback(__finish_start_ops)
 
 
 def main():
     test = FastAGIRecordFileTest()
-    test.start_asterisk()
     reactor.run()
-    test.stop_asterisk()
     if test.overall_result is not True:
         return 1
 




More information about the asterisk-commits mailing list