def test_catalog(self): # Store orig sdrroot sb.domainless._currentState['SDRROOT'] = None sdrRoot = os.environ.pop('SDRROOT') # No SDRROOT env self.assertEquals(sb.catalog(), None) # Bad Sdr root env os.environ["SDRROOT"] = "" self.assertEquals(sb.catalog(), []) # Good SDRROOT sb.domainless._currentState['SDRROOT'] = None os.environ['SDRROOT'] = sdrRoot self.assertNotEquals(sb.catalog(), 0) # Bad search path self.assertEquals(sb.catalog("my_path"), []) # Search path with no usable files self.assertEquals(len(sb.catalog("jackhammer")), 0) # Restore sdrroot os.environ['SDRROOT'] = sdrRoot
def main(): fp = open("_gnuComponentWrappers.py", "w") # Always include the sandbox import statement at the beginning # of the file fp.write("from ossie.utils import sb\n") # Write a function for each component in SDRROOT prefixed by RH_GR_PREFIX for component in sb.catalog(): if component.find(RH_GR_PREFIX) != -1: writeComponentFunction(component, fp) fp.close
def test_catalog(self): # Store orig sdrroot sdrRoot = os.environ.pop('SDRROOT') # No SDRROOT env (should default to current directory). self.assertEquals(sb.catalog(), []) # Bad Sdr root env; dispose of existing sandbox instance to test. sb.domainless._sandbox = None os.environ["SDRROOT"] = "" self.assertEquals(sb.catalog(), []) # Good SDRROOT sb.setSDRROOT(sdrRoot) self.assertNotEquals(len(sb.catalog()), 0) # Bad search path self.assertEquals(len(sb.catalog("my_path")), 0) # Search path with no usable files self.assertEquals(len(sb.catalog("jackhammer")), 0) # Restore sdrroot os.environ['SDRROOT'] = sdrRoot
#f.write('Components stopped\n') # #if passed: # print "\nUnit Test 4 ....................",u'\u2714' # f.write("\nUnit Test 4 .................... "+u'\u2714'.encode('utf8')) #else: # print "\nUnit Test 4 ....................",u'\u2718' # f.write("\nUnit Test 4 .................... "+u'\u2718'.encode('utf8')) #f.write('\n\n') f.write('*********************************\n') f.write('********** Unit Test 5 **********\n') f.write('*********************************\n\n') # This unit test relies on rhSourceVITA49 component for end-to-end testing if "rh.SourceVITA49" not in sb.catalog(): print "ERROR - cannot run tests without rh.SourceVITA49. Install in $SDRROOT and try again." sys.exit(1) f.write('********** Creating components and connections **********\n') sink = sb.launch('../SinkVITA49.spd.xml', execparams={"DEBUG_LEVEL": 0}) source = sb.launch('rh.SourceVITA49', execparams={"DEBUG_LEVEL": 0}) #push data into the sink NIC inputS = sb.DataSource() outputS = sb.DataSink() sink.connect(source, providesPortName='dataVITA49_in') inputS.connect(sink, providesPortName='dataShort_in') source.connect(outputS, providesPortName='shortIn') f.write('***** Source Configuration *****\n')
# #if passed: # print "\nUnit Test 4 ....................",u'\u2714' # f.write("\nUnit Test 4 .................... "+u'\u2714'.encode('utf8')) #else: # print "\nUnit Test 4 ....................",u'\u2718' # f.write("\nUnit Test 4 .................... "+u'\u2718'.encode('utf8')) #f.write('\n\n') f.write('*********************************\n') f.write('********** Unit Test 5 **********\n') f.write( '*********************************\n\n') # This unit test relies on rhSourceVITA49 component for end-to-end testing if "rh.SourceVITA49" not in sb.catalog(): print "ERROR - cannot run tests without rh.SourceVITA49. Install in $SDRROOT and try again." sys.exit(1) f.write('********** Creating components and connections **********\n') sink = sb.launch('../SinkVITA49.spd.xml',execparams={"DEBUG_LEVEL":0}) source = sb.launch('rh.SourceVITA49',execparams={"DEBUG_LEVEL":0}) #push data into the sink NIC inputS=sb.DataSource(); outputS=sb.DataSink(); sink.connect(source, providesPortName='dataVITA49_in') inputS.connect(sink,providesPortName='dataShort_in') source.connect(outputS,providesPortName='shortIn') f.write( '***** Source Configuration *****\n')