#!/usr/bin/env python import sys import time import unittest from threading import Thread from Fnorb.orb import BOA, CORBA import datatransfer, datatransfer_skel from orbrunner import ORBRunner from serverrunner import ServerRunner # # The test case for "short" type transmission. # class ShortTest(unittest.TestCase): def __init__(self, orb_runner): unittest.TestCase.__init__(self) self.orb_runner = orb_runner; # # Create the implementation of the "short" type test interface and # register it with the ORB. # def setUp(self): orb = self.orb_runner.getORB() stringified_ior = open('short.ref', 'r').read() self.obj = orb.string_to_object(stringified_ior) def tearDown(self): # Do nothing for the time being pass # # Perform the "short" type interface tests. # def runTest(self): short = 42 self.assertEqual(self.obj.shortIn(short), short) self.assertEqual(self.obj.shortOut(short), short) short_in = 13 (short_ret, short_out) = self.obj.shortInOut(short, short_in) self.assertEqual(short_ret, short_in) self.assertEqual(short_out, short) # # Create a testsuite for testing "short" type transmission. This is # meant to be used by other modules wanting to incorporate these # tests. # def build_test_suite(orb_runner): short_test = ShortTest(orb_runner) test_suite = unittest.TestSuite([short_test]) return test_suite # # Run the tests with an ORB. This is meant to be used when this module # is executed as a stand-alone program. # def run_tests(): orb_runner = ORBRunner() test_suite = build_test_suite(orb_runner) test_runner = unittest.TextTestRunner() test_runner.run(test_suite) # # If this module was loaded as a program, then run the tests. # if __name__ == "__main__": run_tests()