#!/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 "fixed" type transmission. # class FixedTest(unittest.TestCase): def __init__(self, orb_runner): unittest.TestCase.__init__(self) self.orb_runner = orb_runner; # # Create the implementation of the "fixed" type test interface and # register it with the ORB. # def setUp(self): orb = self.orb_runner.getORB() stringified_ior = open('fixed.ref', 'r').read() self.obj = orb.string_to_object(stringified_ior) def tearDown(self): # Do nothing for the time being pass # # Perform the "fixed" type interface tests. # def runTest(self): fixed = datatransfer.Fixed.FixedType(12345) self.assertEqual(self.obj.fixedIn(fixed), fixed) self.assertEqual(self.obj.fixedOut(fixed), fixed) fixed_in = datatransfer.Fixed.FixedType(12345) (fixed_ret, fixed_out) = self.obj.fixedInOut(fixed, fixed_in) self.assertEqual(fixed_ret, fixed_in) self.assertEqual(fixed_out, fixed) # # Create a testsuite for testing "fixed" type transmission. This is # meant to be used by other modules wanting to incorporate these # tests. # def build_test_suite(orb_runner): fixed_test = FixedTest(orb_runner) test_suite = unittest.TestSuite([fixed_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()