class prsComponentCppImplTestPy(unittest.TestCase):

	################################################
	# lifecycle
	################################################
	
	def setUp(self):
		self.simpleClient = PySimpleClient()
		self.componentName = "testInstanceprsComponentCppImpl"
		self.simpleClient.getLogger().logInfo("pyUnitTestprsComponentCppImpl.prsComponentCppImplTestPy.setUp()...")
        self.simpleClient.getLogger().logInfo("Get component " + self.componentName)
        self.component = self.simpleClient.getComponent(self.componentName)
	#__pPp__	    	           
	
	def tearDown(self):
		self.simpleClient.getLogger().logInfo("pyUnitTestprsComponentCppImpl.prsComponentCppImplTestPy.tearDown()...")
		self.simpleClient.getLogger().logInfo("Releasing component " + self.componentName)
		self.simpleClient.releaseComponent(self.componentName)
		self.simpleClient.disconnect()
	#__pPp__       
        
	################################################
	# test methods
	################################################
	
	def testPark(self):
		self.simpleClient.getLogger().logInfo("pyUnitTestprsComponentCppImpl.prsComponentCppImplTestPy.testPark()...")
		response = None
		response = self.component.Park()
		# no return is expected, response should be None
		assert response is None
Exemplo n.º 2
0
class TSJavaImpTestPy(unittest.TestCase):

	################################################
	# lifecycle
	################################################
	
	def setUp(self):
		self.simpleClient = PySimpleClient()
		self.componentName = "testInstanceTSJavaImp"
		self.simpleClient.getLogger().logInfo("pyUnitTestTSJavaImp.TSJavaImpTestPy.setUp()...")
        self.simpleClient.getLogger().logInfo("Get component " + self.componentName)
        self.component = self.simpleClient.getComponent(self.componentName)
	#__pPp__	    	           
	
	def tearDown(self):
		self.simpleClient.getLogger().logInfo("pyUnitTestTSJavaImp.TSJavaImpTestPy.tearDown()...")
		self.simpleClient.getLogger().logInfo("Releasing component " + self.componentName)
		self.simpleClient.releaseComponent(self.componentName)
		self.simpleClient.disconnect()
	#__pPp__       
        
	################################################
	# test methods
	################################################
	
	def testRunManualRAB(self):
		self.simpleClient.getLogger().logInfo("pyUnitTestTSJavaImp.TSJavaImpTestPy.testRunManualRAB()...")
		response = None
		type = 0
		pos = position()
		response = self.component.runManualRAB(type, pos)
		# no return is expected, response should be None
		assert response is None
	#__pPp__
			    
	def testRunAutoRAB(self):
		self.simpleClient.getLogger().logInfo("pyUnitTestTSJavaImp.TSJavaImpTestPy.testRunAutoRAB()...")
		response = None
		type = 0
		pos = position()
		response = self.component.runAutoRAB(type, pos)
		# no return is expected, response should be None
		assert response is None
	#__pPp__
			    
	def testGetRobotsList(self):
		self.simpleClient.getLogger().logInfo("pyUnitTestTSJavaImp.TSJavaImpTestPy.testGetRobotsList()...")
		response = None
		response = self.component.getRobotsList()
		# a return is expected, response should be not None
		assert response is not None
	#__pPp__
			    
	def testGetRobotStatus(self):
		self.simpleClient.getLogger().logInfo("pyUnitTestTSJavaImp.TSJavaImpTestPy.testGetRobotStatus()...")
		response = None
		id = 0
		response = self.component.getRobotStatus(id)
		# a return is expected, response should be not None
		assert response is not None
Exemplo n.º 3
0
class DCSImplTestPy(unittest.TestCase):

	################################################
	# lifecycle
	################################################
	
	def setUp(self):
		self.simpleClient = PySimpleClient()
		self.componentName = "testInstanceDCSImpl"
		self.simpleClient.getLogger().logInfo("pyUnitTestDCSImpl.DCSImplTestPy.setUp()...")
        self.simpleClient.getLogger().logInfo("Get component " + self.componentName)
        self.component = self.simpleClient.getComponent(self.componentName)
	#__pPp__	    	           
	
	def tearDown(self):
		self.simpleClient.getLogger().logInfo("pyUnitTestDCSImpl.DCSImplTestPy.tearDown()...")
		self.simpleClient.getLogger().logInfo("Releasing component " + self.componentName)
		self.simpleClient.releaseComponent(self.componentName)
		self.simpleClient.disconnect()
	#__pPp__       
        
	################################################
	# test methods
	################################################
	
	def testSendCommand(self):
		self.simpleClient.getLogger().logInfo("pyUnitTestDCSImpl.DCSImplTestPy.testSendCommand()...")
		response = None
		commandName = 'emptyString'
		parameterList = 'emptyString'
		cb = CBstring()
		desc = CBDescIn()
		response = self.component.sendCommand(commandName, parameterList, cb, desc)
		# a return is expected, response should be not None
		assert response is not None
Exemplo n.º 4
0
class TestStorageMethods(unittest.TestCase):
    def test_full(self):
        self.client = PySimpleClient()
        self.storage = self.client.getComponent("STORAGE")

        self.storage.clearAllData()

        targets = []
        images = []
        for i in range(10):
            targets.append(TYPES.Target(i, TYPES.Position(10.0, 45.0), 2))
            image = bytearray()
            for j in range(1000000):
                image.append(j % 256)
            images.append(bytes(image))
        proposal = TYPES.Proposal(0, targets, 0)
        self.storage.storeObservation(proposal, images)

        id = self.storage.getNextValidId()
        print "ID", id
        self.assertEqual(1, id, "Checking ID")

        result = self.storage.getObservation(0)
        self.assertEqual(10, len(result), "Number of observations")

        self.storage.clearAllData()

        self.client.releaseComponent(self.storage._get_name())
Exemplo n.º 5
0
class TestStorageMethods(unittest.TestCase):
    def test_full(self):
        self.client = PySimpleClient()
        self.storage = self.client.getComponent("STORAGE")

        self.storage.clearAllData()

        targets = []
        images = []
        for i in range(10):
            targets.append(TYPES.Target(i, TYPES.Position(10.0, 45.0), 2))
            image = bytearray()
            for j in range(1000000):
                image.append(j % 256)
            images.append(bytes(image))
        proposal = TYPES.Proposal(0, targets, 0)
        self.storage.storeObservation(proposal, images)

        id = self.storage.getNextValidId()
        print "ID", id
        self.assertEqual(1, id, "Checking ID")

        result = self.storage.getObservation(0)
        self.assertEqual(10, len(result), "Number of observations")

        self.storage.clearAllData()

        self.client.releaseComponent(self.storage._get_name())
class MasterComponentImplTestPy(unittest.TestCase):

	################################################
	# lifecycle
	################################################
	
	def setUp(self):
		self.simpleClient = PySimpleClient()
		self.componentName = "testInstanceMasterComponentImpl"
		self.simpleClient.getLogger().logInfo("pyUnitTestMasterComponentImpl.MasterComponentImplTestPy.setUp()...")
        self.simpleClient.getLogger().logInfo("Get component " + self.componentName)
        self.component = self.simpleClient.getComponent(self.componentName)
	#__pPp__	    	           
	
	def tearDown(self):
		self.simpleClient.getLogger().logInfo("pyUnitTestMasterComponentImpl.MasterComponentImplTestPy.tearDown()...")
		self.simpleClient.getLogger().logInfo("Releasing component " + self.componentName)
		self.simpleClient.releaseComponent(self.componentName)
		self.simpleClient.disconnect()
	#__pPp__       
        
	################################################
	# test methods
	################################################
	
	def testDoTransition(self):
		self.simpleClient.getLogger().logInfo("pyUnitTestMasterComponentImpl.MasterComponentImplTestPy.testDoTransition()...")
		response = None
		event = SubsystemStateEvent()
		response = self.component.doTransition(event)
		# no return is expected, response should be None
		assert response is None
class StopWatchLightImplTestPy(unittest.TestCase):

	################################################
	# lifecycle
	################################################
	
	def setUp(self):
		self.simpleClient = PySimpleClient()
		self.componentName = "testInstanceStopWatchLightImpl"
		self.simpleClient.getLogger().logInfo("pyUnitTestStopWatchLightImpl.StopWatchLightImplTestPy.setUp()...")
        self.simpleClient.getLogger().logInfo("Get component " + self.componentName)
        self.component = self.simpleClient.getComponent(self.componentName)
	#__pPp__	    	           
	
	def tearDown(self):
		self.simpleClient.getLogger().logInfo("pyUnitTestStopWatchLightImpl.StopWatchLightImplTestPy.tearDown()...")
		self.simpleClient.getLogger().logInfo("Releasing component " + self.componentName)
		self.simpleClient.releaseComponent(self.componentName)
		self.simpleClient.disconnect()
	#__pPp__       
        
	################################################
	# test methods
	################################################
	
	def testGetDisplay(self):
		self.simpleClient.getLogger().logInfo("pyUnitTestStopWatchLightImpl.StopWatchLightImplTestPy.testGetDisplay()...")
		response = None
		response = self.component.getDisplay()
		# a return is expected, response should be not None
		assert response is not None
Exemplo n.º 8
0
class TRDJavaImpTestPy(unittest.TestCase):

	################################################
	# lifecycle
	################################################
	
	def setUp(self):
		self.simpleClient = PySimpleClient()
		self.componentName = "testInstanceTRDJavaImp"
		self.simpleClient.getLogger().logInfo("pyUnitTestTRDJavaImp.TRDJavaImpTestPy.setUp()...")
        self.simpleClient.getLogger().logInfo("Get component " + self.componentName)
        self.component = self.simpleClient.getComponent(self.componentName)
	#__pPp__	    	           
	
	def tearDown(self):
		self.simpleClient.getLogger().logInfo("pyUnitTestTRDJavaImp.TRDJavaImpTestPy.tearDown()...")
		self.simpleClient.getLogger().logInfo("Releasing component " + self.componentName)
		self.simpleClient.releaseComponent(self.componentName)
		self.simpleClient.disconnect()
	#__pPp__       
        
	################################################
	# test methods
	################################################
	
	def testGetRAB(self):
		self.simpleClient.getLogger().logInfo("pyUnitTestTRDJavaImp.TRDJavaImpTestPy.testGetRAB()...")
		response = None
		type = 0
		response = self.component.getRAB(type)
		# a return is expected, response should be not None
		assert response is not None
	#__pPp__
			    
	def testCreateReport(self):
		self.simpleClient.getLogger().logInfo("pyUnitTestTRDJavaImp.TRDJavaImpTestPy.testCreateReport()...")
		response = None
		rep = report()
		response = self.component.createReport(rep)
		# a return is expected, response should be not None
		assert response is not None
	#__pPp__
			    
	def testGetReportsList(self):
		self.simpleClient.getLogger().logInfo("pyUnitTestTRDJavaImp.TRDJavaImpTestPy.testGetReportsList()...")
		response = None
		response = self.component.getReportsList()
		# a return is expected, response should be not None
		assert response is not None
	#__pPp__
			    
	def testGetReport(self):
		self.simpleClient.getLogger().logInfo("pyUnitTestTRDJavaImp.TRDJavaImpTestPy.testGetReport()...")
		response = None
		id = 0
		response = self.component.getReport(id)
		# a return is expected, response should be not None
		assert response is not None
Exemplo n.º 9
0
class CCDImagImplTestPy(unittest.TestCase):

	################################################
	# lifecycle
	################################################
	
	def setUp(self):
		self.simpleClient = PySimpleClient()
		self.componentName = "testInstanceCCDImagImpl"
		self.simpleClient.getLogger().logInfo("pyUnitTestCCDImagImpl.CCDImagImplTestPy.setUp()...")
        self.simpleClient.getLogger().logInfo("Get component " + self.componentName)
        self.component = self.simpleClient.getComponent(self.componentName)
	#__pPp__	    	           
	
	def tearDown(self):
		self.simpleClient.getLogger().logInfo("pyUnitTestCCDImagImpl.CCDImagImplTestPy.tearDown()...")
		self.simpleClient.getLogger().logInfo("Releasing component " + self.componentName)
		self.simpleClient.releaseComponent(self.componentName)
		self.simpleClient.disconnect()
	#__pPp__       
        
	################################################
	# test methods
	################################################
	
	def testStandby(self):
		self.simpleClient.getLogger().logInfo("pyUnitTestCCDImagImpl.CCDImagImplTestPy.testStandby()...")
		response = None
		response = self.component.standby()
		# no return is expected, response should be None
		assert response is None
	#__pPp__
			    
	def testOnline(self):
		self.simpleClient.getLogger().logInfo("pyUnitTestCCDImagImpl.CCDImagImplTestPy.testOnline()...")
		response = None
		response = self.component.online()
		# no return is expected, response should be None
		assert response is None
	#__pPp__
			    
	def testOff(self):
		self.simpleClient.getLogger().logInfo("pyUnitTestCCDImagImpl.CCDImagImplTestPy.testOff()...")
		response = None
		response = self.component.off()
		# no return is expected, response should be None
		assert response is None
	#__pPp__
			    
	def testSetup(self):
		self.simpleClient.getLogger().logInfo("pyUnitTestCCDImagImpl.CCDImagImplTestPy.testSetup()...")
		response = None
		val = 'emptyString'
		timeout = 0
		response = self.component.setup(val, timeout)
		# no return is expected, response should be None
		assert response is None
Exemplo n.º 10
0
class SCJavaImpTestPy(unittest.TestCase):

	################################################
	# lifecycle
	################################################
	
	def setUp(self):
		self.simpleClient = PySimpleClient()
		self.componentName = "testInstanceSCJavaImp"
		self.simpleClient.getLogger().logInfo("pyUnitTestSCJavaImp.SCJavaImpTestPy.setUp()...")
        self.simpleClient.getLogger().logInfo("Get component " + self.componentName)
        self.component = self.simpleClient.getComponent(self.componentName)
	#__pPp__	    	           
	
	def tearDown(self):
		self.simpleClient.getLogger().logInfo("pyUnitTestSCJavaImp.SCJavaImpTestPy.tearDown()...")
		self.simpleClient.getLogger().logInfo("Releasing component " + self.componentName)
		self.simpleClient.releaseComponent(self.componentName)
		self.simpleClient.disconnect()
	#__pPp__       
        
	################################################
	# test methods
	################################################
	
	def testReset(self):
		self.simpleClient.getLogger().logInfo("pyUnitTestSCJavaImp.SCJavaImpTestPy.testReset()...")
		response = None
		response = self.component.reset()
		# no return is expected, response should be None
		assert response is None
	#__pPp__
			    
	def testStatus(self):
		self.simpleClient.getLogger().logInfo("pyUnitTestSCJavaImp.SCJavaImpTestPy.testStatus()...")
		response = None
		response = self.component.status()
		# a return is expected, response should be not None
		assert response is not None
	#__pPp__
			    
	def testGetPosition(self):
		self.simpleClient.getLogger().logInfo("pyUnitTestSCJavaImp.SCJavaImpTestPy.testGetPosition()...")
		response = None
		response = self.component.getPosition()
		# a return is expected, response should be not None
		assert response is not None
	#__pPp__
			    
	def testSensorType(self):
		self.simpleClient.getLogger().logInfo("pyUnitTestSCJavaImp.SCJavaImpTestPy.testSensorType()...")
		response = None
		response = self.component.sensorType()
		# a return is expected, response should be not None
		assert response is not None
Exemplo n.º 11
0
class PingerImplTestPy(unittest.TestCase):

	################################################
	# lifecycle
	################################################
	
	def setUp(self):
		self.simpleClient = PySimpleClient()
		self.componentName = "testInstancePingerImpl"
		self.simpleClient.getLogger().logInfo("pyUnitTestPingerImpl.PingerImplTestPy.setUp()...")
        self.simpleClient.getLogger().logInfo("Get component " + self.componentName)
        self.component = self.simpleClient.getComponent(self.componentName)
	#__pPp__	    	           
	
	def tearDown(self):
		self.simpleClient.getLogger().logInfo("pyUnitTestPingerImpl.PingerImplTestPy.tearDown()...")
		self.simpleClient.getLogger().logInfo("Releasing component " + self.componentName)
		self.simpleClient.releaseComponent(self.componentName)
		self.simpleClient.disconnect()
	#__pPp__       
        
	################################################
	# test methods
	################################################
	
	def testSpawnChildren(self):
		self.simpleClient.getLogger().logInfo("pyUnitTestPingerImpl.PingerImplTestPy.testSpawnChildren()...")
		response = None
		howMany = 0
		container = 'emptyString'
		baseName = 'emptyString'
		response = self.component.spawnChildren(howMany, container, baseName)
		# no return is expected, response should be None
		assert response is None
	#__pPp__
			    
	def testLogInfo(self):
		self.simpleClient.getLogger().logInfo("pyUnitTestPingerImpl.PingerImplTestPy.testLogInfo()...")
		response = None
		response = self.component.logInfo()
		# no return is expected, response should be None
		assert response is None
	#__pPp__
			    
	def testPing(self):
		self.simpleClient.getLogger().logInfo("pyUnitTestPingerImpl.PingerImplTestPy.testPing()...")
		response = None
		fast = False
		recursive = False
		id = 0
		response = self.component.ping(fast, recursive, id)
		# a return is expected, response should be not None
		assert response is not None
Exemplo n.º 12
0
class LegoImplTestPy(unittest.TestCase):

	################################################
	# lifecycle
	################################################
	
	def setUp(self):
		self.simpleClient = PySimpleClient()
		self.componentName = "testInstanceLegoImpl"
		self.simpleClient.getLogger().logInfo("pyUnitTestLegoImpl.LegoImplTestPy.setUp()...")
        self.simpleClient.getLogger().logInfo("Get component " + self.componentName)
        self.component = self.simpleClient.getComponent(self.componentName)
	#__pPp__	    	           
	
	def tearDown(self):
		self.simpleClient.getLogger().logInfo("pyUnitTestLegoImpl.LegoImplTestPy.tearDown()...")
		self.simpleClient.getLogger().logInfo("Releasing component " + self.componentName)
		self.simpleClient.releaseComponent(self.componentName)
		self.simpleClient.disconnect()
	#__pPp__       
        
	################################################
	# test methods
	################################################
	
	def testObserve(self):
		self.simpleClient.getLogger().logInfo("pyUnitTestLegoImpl.LegoImplTestPy.testObserve()...")
		response = None
		coordinates = Position()
		exposureTime = 0
		response = self.component.observe(coordinates, exposureTime)
		# a return is expected, response should be not None
		assert response is not None
	#__pPp__
			    
	def testMoveTo(self):
		self.simpleClient.getLogger().logInfo("pyUnitTestLegoImpl.LegoImplTestPy.testMoveTo()...")
		response = None
		coordinates = Position()
		response = self.component.moveTo(coordinates)
		# no return is expected, response should be None
		assert response is None
	#__pPp__
			    
	def testGetCurrentPosition(self):
		self.simpleClient.getLogger().logInfo("pyUnitTestLegoImpl.LegoImplTestPy.testGetCurrentPosition()...")
		response = None
		response = self.component.getCurrentPosition()
		# a return is expected, response should be not None
		assert response is not None
Exemplo n.º 13
0
class SchedulerImplTestPy(unittest.TestCase):

	################################################
	# lifecycle
	################################################
	
	def setUp(self):
		self.simpleClient = PySimpleClient()
		self.componentName = "testInstanceSchedulerImpl"
		self.simpleClient.getLogger().logInfo("pyUnitTestSchedulerImpl.SchedulerImplTestPy.setUp()...")
        self.simpleClient.getLogger().logInfo("Get component " + self.componentName)
        self.component = self.simpleClient.getComponent(self.componentName)
	#__pPp__	    	           
	
	def tearDown(self):
		self.simpleClient.getLogger().logInfo("pyUnitTestSchedulerImpl.SchedulerImplTestPy.tearDown()...")
		self.simpleClient.getLogger().logInfo("Releasing component " + self.componentName)
		self.simpleClient.releaseComponent(self.componentName)
		self.simpleClient.disconnect()
	#__pPp__       
        
	################################################
	# test methods
	################################################
	
	def testStart(self):
		self.simpleClient.getLogger().logInfo("pyUnitTestSchedulerImpl.SchedulerImplTestPy.testStart()...")
		response = None
		response = self.component.start()
		# no return is expected, response should be None
		assert response is None
	#__pPp__
			    
	def testStop(self):
		self.simpleClient.getLogger().logInfo("pyUnitTestSchedulerImpl.SchedulerImplTestPy.testStop()...")
		response = None
		response = self.component.stop()
		# no return is expected, response should be None
		assert response is None
	#__pPp__
			    
	def testProposalUnderExecution(self):
		self.simpleClient.getLogger().logInfo("pyUnitTestSchedulerImpl.SchedulerImplTestPy.testProposalUnderExecution()...")
		response = None
		response = self.component.proposalUnderExecution()
		# a return is expected, response should be not None
		assert response is not None
class EventSubscriberImplTestPy(unittest.TestCase):

	################################################
	# lifecycle
	################################################
	
	def setUp(self):
		self.simpleClient = PySimpleClient()
		self.componentName = "testInstanceEventSubscriberImpl"
		self.simpleClient.getLogger().logInfo("pyUnitTestEventSubscriberImpl.EventSubscriberImplTestPy.setUp()...")
        self.simpleClient.getLogger().logInfo("Get component " + self.componentName)
        self.component = self.simpleClient.getComponent(self.componentName)
	#__pPp__	    	           
	
	def tearDown(self):
		self.simpleClient.getLogger().logInfo("pyUnitTestEventSubscriberImpl.EventSubscriberImplTestPy.tearDown()...")
		self.simpleClient.getLogger().logInfo("Releasing component " + self.componentName)
		self.simpleClient.releaseComponent(self.componentName)
		self.simpleClient.disconnect()
Exemplo n.º 15
0
def set_array_frec():
    client = PySimpleClient()
    master = client.getComponent("CONTROL/MASTER")
    arrayList = master.getAutomaticArrayComponents() + master.getManualArrayComponents()
    for array in arrayList:
        master.destroyArray(array.ComponentName)
    arrayList = []    
    antennas = master.getAvailableAntennas()
    master.createManualArray(antennas)
    arrayList = master.getAutomaticArrayComponents() +  master.getManualArrayComponents()
    if ( arrayList != 1 ):
        if( len(arrayList) == 0):
            print "Could not create an array!!"
            client.releaseComponent("CONTROL/MASTER")
            sys.exit(0)
        else:
            print "Could not destroy previosly arrays and create a new fresh array!"
            client.releaseComponent("CONTROL/MASTER")
            sys.exist(0)
    currentArray = client.getComponent(arrayList[0].ComponentName)
    client.releaseComponent("CONTROL/MASTER")
    setArrayName(currentArray.getArrayName())
    array = getArray()
    tp = array.getTotalPowerObservingMode()
    return tp
class BasicAntennaJavaImplTestPy(unittest.TestCase):

	################################################
	# lifecycle
	################################################
	
	def setUp(self):
		self.simpleClient = PySimpleClient()
		self.componentName = "testInstanceBasicAntennaJavaImpl"
		self.simpleClient.getLogger().logInfo("pyUnitTestBasicAntennaJavaImpl.BasicAntennaJavaImplTestPy.setUp()...")
        self.simpleClient.getLogger().logInfo("Get component " + self.componentName)
        self.component = self.simpleClient.getComponent(self.componentName)
	#__pPp__	    	           
	
	def tearDown(self):
		self.simpleClient.getLogger().logInfo("pyUnitTestBasicAntennaJavaImpl.BasicAntennaJavaImplTestPy.tearDown()...")
		self.simpleClient.getLogger().logInfo("Releasing component " + self.componentName)
		self.simpleClient.releaseComponent(self.componentName)
		self.simpleClient.disconnect()
	#__pPp__       
        
	################################################
	# test methods
	################################################
	
	def testSetAntennaPosition(self):
		self.simpleClient.getLogger().logInfo("pyUnitTestBasicAntennaJavaImpl.BasicAntennaJavaImplTestPy.testSetAntennaPosition()...")
		response = None
		pos = position()
		response = self.component.setAntennaPosition(pos)
		# no return is expected, response should be None
		assert response is None
	#__pPp__
			    
	def testGetAntennaPosition(self):
		self.simpleClient.getLogger().logInfo("pyUnitTestBasicAntennaJavaImpl.BasicAntennaJavaImplTestPy.testGetAntennaPosition()...")
		response = None
		response = self.component.getAntennaPosition()
		# a return is expected, response should be not None
		assert response is not None
Exemplo n.º 17
0
def mostRecentAsdm(date=None) :
    if date == None :
        date='%4.2d-%2.2d-%2.2d'%(time.gmtime()[0], time.gmtime()[1], time.gmtime()[2])
    client = PySimpleClient()
    archConn = client.getComponent('ARCHIVE_CONNECTION')
    archOp = archConn.getOperational('XMLQueryTest')
    uids = archOp.queryRecent('ASDM',date+'T00:00:00.000')
    asdm_name=[]
    for uid in uids:
        result = archOp.retrieveDirty(uid)
        dataSet = ArchivedAsdm(result.xmlString)
        dateOfCreation =  dataSet.getDateOfCreation()
        if dataSet.isAsdm() & (dateOfCreation==date):
            asdm_name.append("%s \t%s" % (dateOfCreation,uid))
    asdm_name.sort()
    client.releaseComponent('ARCHIVE_CONNECTION')
    client.disconnect()
    if len(asdm_name) == 0 :
        print 'there are no asdms for %s' % date
        return None
    else :
        return asdm_name[-1].split('\t')[1]
Exemplo n.º 18
0
def mostRecentAsdm(date = None):
    '''
    Get the most recent Asdm, given a date. 
    If the date is None, it takes the  actual hour.

    return asdm or None
    '''
    from Acspy.Clients.SimpleClient import PySimpleClient
    from ArchivedAsdm import ArchivedAsdm
    if date == None :
        date_T = '%4.2d-%2.2d-%2.2dT00:00:00.000' % (gmtime()[0] , gmtime()[1] , gmtime()[2])
        date  = '%4.2d-%2.2d-%2.2d'% (gmtime()[0] , gmtime()[1] , gmtime()[2]) 
    else:
        date_T = '%4.2d-%2.2d-%2.2dT%2.2d:00:00.00' % (date[0] , date[1] , date[2] , date[3])
        date  = '%4.2d-%2.2d-%2.2d'% (date[0] , date[1] , date[2]) 
    client = PySimpleClient()
    archConn = client.getComponent('ARCHIVE_CONNECTION')
    archOp = archConn.getOperational('XMLQueryTest')
    uids = archOp.queryRecent('ASDM' , date_T)
    print "Connection entablish with archive ..."
    asdm_name = []
    for uid in uids:
        print "Checking date of " +str(uid),
        result = archOp.retrieveDirty(uid)
        dataSet = ArchivedAsdm(result.xmlString)
        dateOfCreation =  dataSet.getDateOfCreation()
        print "  created: "+str(dataSet.getDateTimeOfCreation()),
        if dataSet.isAsdm() & (dateOfCreation==date):
            asdm_name.append("%s \t%s" % (dataSet.getDateTimeOfCreation() , uid))
            print " --> is an asdm!",
        print ""
    asdm_name.sort()
    client.releaseComponent('ARCHIVE_CONNECTION')
    client.disconnect()
    if len(asdm_name) == 0 :
        print 'There are no asdms for %s' % date
        return None
    else :
        return asdm_name[-1].split('\t')[1]
Exemplo n.º 19
0
import ACSErrTypeCommon
import ACSErrTypeCommonImpl

# Import the acspy.PySimpleClient class
from Acspy.Clients.SimpleClient import PySimpleClient

# Make an instance of the PySimpleClient
simpleClient = PySimpleClient()

try:
    # Get the standard HelloWorld device
    hw = simpleClient.getComponent("HELLOWORLD1")
    simpleClient.getLogger().logInfo("Trying to invoke bad method")
    hw.badMethod()

except ACSErrTypeCommon.UnknownEx, e:
    simpleClient.getLogger().logCritical(
        "Caught an ACSException...don't worry because this SHOULD happen.")
    helperException = ACSErrTypeCommonImpl.UnknownExImpl(exception=e)
    helperException.Print()
    helperException.log(simpleClient.getLogger())
    # Release it
    simpleClient.releaseComponent("HELLOWORLD1")

except Exception, e:
    simpleClient.getLogger().logAlert("Caught the wrong type of exception!!!")
    simpleClient.getLogger().logDebug("The exception was:" + str(e))

simpleClient.disconnect()
print "The end __oOo__"
Exemplo n.º 20
0
class ComponentUtilTest(unittest.TestCase):
    """
    This test requires ACS running with the testacsproperties CDB and
    the myC cpp container up
    """
    def setUp(self):
        self._my_acs_client = PySimpleClient()
        logger = self._my_acs_client.getLogger()
        logger.setLevel(logging.WARNING)
        # disable annoying output from the tests

    def tearDown(self):
        self._my_acs_client.disconnect()

    def test_get_enum_prop_dict(self):

        my_component = self._my_acs_client.getComponent(
            "TEST_PROPERTIES_COMPONENT", True)

        enum_prop = my_component._get_EnumTestROProp()

        decoded = component_util.get_enum_prop_dict(enum_prop)
        expected_value = {'0': 'STATE1', '1': 'STATE2', '2': 'STATE3'}
        self.assertEqual(expected_value, decoded)

        enum_prop = my_component._get_EnumTestRWProp()

        decoded = component_util.get_enum_prop_dict(enum_prop)
        expected_value = {'0': 'STATE1', '1': 'STATE2', '2': 'STATE3'}
        self.assertEqual(expected_value, decoded)

        self._my_acs_client.releaseComponent("TEST_PROPERTIES_COMPONENT")

    def test_get_property_type(self):
        my_component = self._my_acs_client.getComponent(
            "TEST_PROPERTIES_COMPONENT", True)

        self.assertEqual(
            component_util.get_property_type(
                my_component._get_EnumTestROProp()._NP_RepositoryId),
            PropertyType.OBJECT)

        self.assertEqual(
            component_util.get_property_type(
                my_component._get_EnumTestRWProp()._NP_RepositoryId),
            PropertyType.OBJECT)

        PropertyType.OBJECT

        self.assertEqual(
            component_util.get_property_type(
                my_component._get_doubleROProp()._NP_RepositoryId),
            PropertyType.DOUBLE)

        self.assertEqual(
            component_util.get_property_type(
                my_component._get_floatSeqRWProp()._NP_RepositoryId),
            PropertyType.FLOAT_SEQ)

        self.assertEqual(
            component_util.get_property_type(
                my_component._get_longSeqRWProp()._NP_RepositoryId),
            PropertyType.LONG_SEQ)

        self.assertEqual(
            component_util.get_property_type(
                my_component._get_uLongLongRWProp()._NP_RepositoryId),
            PropertyType.LONG_LONG)

        self.assertEqual(
            component_util.get_property_type(
                my_component._get_uLongLongRWProp()._NP_RepositoryId),
            PropertyType.LONG_LONG)
        self.assertEqual(
            component_util.get_property_type(
                my_component._get_doubleRWProp()._NP_RepositoryId),
            PropertyType.DOUBLE)

        self.assertEqual(
            component_util.get_property_type(
                my_component._get_uLongROProp()._NP_RepositoryId),
            PropertyType.LONG)

        self.assertEqual(
            component_util.get_property_type(
                my_component._get_booleanROProp()._NP_RepositoryId),
            PropertyType.BOOL)

        self.assertEqual(
            component_util.get_property_type(
                my_component._get_doubleSeqROProp()._NP_RepositoryId),
            PropertyType.DOUBLE_SEQ)

        self.assertEqual(
            component_util.get_property_type(
                my_component._get_longLongROProp()._NP_RepositoryId),
            PropertyType.LONG_LONG)

        self.assertEqual(
            component_util.get_property_type(
                my_component._get_patternROProp()._NP_RepositoryId),
            PropertyType.BIT_FIELD)

        self.assertEqual(
            component_util.get_property_type(
                my_component._get_uLongRWProp()._NP_RepositoryId),
            PropertyType.LONG)

        self.assertEqual(
            component_util.get_property_type(
                my_component._get_booleanRWProp()._NP_RepositoryId),
            PropertyType.BOOL)

        self.assertEqual(
            component_util.get_property_type(
                my_component._get_doubleSeqRWProp()._NP_RepositoryId),
            PropertyType.DOUBLE_SEQ)

        self.assertEqual(
            component_util.get_property_type(
                my_component._get_longLongRWProp()._NP_RepositoryId),
            PropertyType.LONG_LONG)

        self.assertEqual(
            component_util.get_property_type(
                my_component._get_patternRWProp()._NP_RepositoryId),
            PropertyType.BIT_FIELD)

        self.assertEqual(
            component_util.get_property_type(
                my_component._get_uLongSeqROProp()._NP_RepositoryId),
            PropertyType.LONG_SEQ)

        self.assertRaises(
            UnsupporterPropertyTypeError, component_util.get_property_type,
            my_component._get_booleanSeqROProp()._NP_RepositoryId)

        self.assertEqual(
            component_util.get_property_type(
                my_component._get_floatROProp()._NP_RepositoryId),
            PropertyType.FLOAT)

        self.assertEqual(
            component_util.get_property_type(
                my_component._get_longROProp()._NP_RepositoryId),
            PropertyType.LONG)

        self.assertEqual(
            component_util.get_property_type(
                my_component._get_stringROProp()._NP_RepositoryId),
            PropertyType.STRING)

        self.assertEqual(
            component_util.get_property_type(
                my_component._get_uLongSeqRWProp()._NP_RepositoryId),
            PropertyType.LONG_SEQ)

        self.assertRaises(
            UnsupporterPropertyTypeError, component_util.get_property_type,
            my_component._get_booleanSeqRWProp()._NP_RepositoryId)

        self.assertEqual(
            component_util.get_property_type(
                my_component._get_floatRWProp()._NP_RepositoryId),
            PropertyType.FLOAT)

        self.assertEqual(
            component_util.get_property_type(
                my_component._get_longRWProp()._NP_RepositoryId),
            PropertyType.LONG)

        self.assertEqual(
            component_util.get_property_type(
                my_component._get_stringRWProp()._NP_RepositoryId),
            PropertyType.STRING)

        self.assertEqual(
            component_util.get_property_type(
                my_component._get_floatSeqROProp()._NP_RepositoryId),
            PropertyType.FLOAT_SEQ)

        self.assertEqual(
            component_util.get_property_type(
                my_component._get_longSeqROProp()._NP_RepositoryId),
            PropertyType.LONG_SEQ)

        self.assertEqual(
            component_util.get_property_type(
                my_component._get_uLongLongROProp()._NP_RepositoryId),
            PropertyType.LONG_LONG)

    def test_is_archive_delta_enabled(self):

        # First test the cases when it should be false
        self.assertFalse(component_util.is_archive_delta_enabled(None))
        self.assertFalse(component_util.is_archive_delta_enabled(False))
        self.assertFalse(component_util.is_archive_delta_enabled("0"))
        self.assertFalse(component_util.is_archive_delta_enabled("0.0"))
        self.assertFalse(component_util.is_archive_delta_enabled(0))
        self.assertFalse(component_util.is_archive_delta_enabled(0.0))
Exemplo n.º 21
0
class FrontEndTest(unittest.TestCase):
    """
    This test requires ACS running with the testacsproperties CDB and
    the myC cpp container up
    """
    def setUp(self):
        self._my_acs_client = PySimpleClient()
        self._my_acs_client.getLogger().setLevel(logging.CRITICAL)
        self._front_end = FrontEnd(RecorderConfig(), self._my_acs_client)
        self.__my_component_id = "TEST_PROPERTIES_COMPONENT"

    def test_is_acs_client_ok(self):
        self.assertTrue(self._front_end.is_acs_client_ok)

    def test_update_acs_client(self):
        other_client = PySimpleClient()
        other_client.getLogger().setLevel(logging.CRITICAL)
        self._front_end.update_acs_client(other_client)
        self.assertTrue(self._front_end.is_acs_client_ok)
        self._front_end.start_recording()
        yet_other_client = PySimpleClient()
        yet_other_client.getLogger().setLevel(logging.CRITICAL)
        self._front_end.update_acs_client(yet_other_client)
        self._front_end.stop_recording()

    def test_start_recording(self):
        self._front_end.start_recording()
        self.assertTrue(self._front_end.is_recording)
        self._front_end.stop_recording()

        self._my_acs_client.getComponent(self.__my_component_id, True)
        self._front_end.start_recording()
        self.assertTrue(self._front_end.is_recording)
        self._front_end.stop_recording()
        self._my_acs_client.releaseComponent(self.__my_component_id)

    def test_process_component(self):
        self._my_acs_client.getComponent(self.__my_component_id, True)

        self._front_end.process_component(self.__my_component_id)

        self._my_acs_client.releaseComponent(self.__my_component_id)

        self.assertRaises(CannotAddComponentException,
                          self._front_end.process_component, "I_DO_NOT_EXIST")

    def test_remove_wrong_components(self):
        self._my_acs_client.getComponent(self.__my_component_id, True)
        self._front_end.start_recording()

        time.sleep(3)

        self._my_acs_client.releaseComponent(self.__my_component_id)

        time.sleep(10)

        self._front_end.stop_recording()

    def tearDown(self):
        self._front_end.cancel()
        self._front_end = None
Exemplo n.º 22
0
class NexstarImplTestPy(unittest.TestCase):

	################################################
	# lifecycle
	################################################
	
	def setUp(self):
		self.simpleClient = PySimpleClient()
		self.componentName = "testInstanceNexstarImpl"
		self.simpleClient.getLogger().logInfo("pyUnitTestNexstarImpl.NexstarImplTestPy.setUp()...")
        self.simpleClient.getLogger().logInfo("Get component " + self.componentName)
        self.component = self.simpleClient.getComponent(self.componentName)
	#__pPp__	    	           
	
	def tearDown(self):
		self.simpleClient.getLogger().logInfo("pyUnitTestNexstarImpl.NexstarImplTestPy.tearDown()...")
		self.simpleClient.getLogger().logInfo("Releasing component " + self.componentName)
		self.simpleClient.releaseComponent(self.componentName)
		self.simpleClient.disconnect()
	#__pPp__       
        
	################################################
	# test methods
	################################################
	
	def testImage(self):
		self.simpleClient.getLogger().logInfo("pyUnitTestNexstarImpl.NexstarImplTestPy.testImage()...")
		response = None
		exposure = double()
		response = self.component.image(exposure)
		# a return is expected, response should be not None
		assert response is not None
	#__pPp__
			    
	def testLock(self):
		self.simpleClient.getLogger().logInfo("pyUnitTestNexstarImpl.NexstarImplTestPy.testLock()...")
		response = None
		response = self.component.lock()
		# no return is expected, response should be None
		assert response is None
	#__pPp__
			    
	def testUnlock(self):
		self.simpleClient.getLogger().logInfo("pyUnitTestNexstarImpl.NexstarImplTestPy.testUnlock()...")
		response = None
		response = self.component.unlock()
		# no return is expected, response should be None
		assert response is None
	#__pPp__
			    
	def testOn(self):
		self.simpleClient.getLogger().logInfo("pyUnitTestNexstarImpl.NexstarImplTestPy.testOn()...")
		response = None
		response = self.component.on()
		# no return is expected, response should be None
		assert response is None
	#__pPp__
			    
	def testOff(self):
		self.simpleClient.getLogger().logInfo("pyUnitTestNexstarImpl.NexstarImplTestPy.testOff()...")
		response = None
		response = self.component.off()
		# no return is expected, response should be None
		assert response is None
Exemplo n.º 23
0
#! /usr/bin/env python

from sys import argv
from time import sleep
from Acspy.Clients.SimpleClient import PySimpleClient
import ACS
import time, os

simpleClient = PySimpleClient()
cdb_mount = simpleClient.getComponent("COMP99") 

sleep(10)

simpleClient.releaseComponent("COMP99")


Exemplo n.º 24
0
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307  USA
#
# @(#) $Id: javaSupplierComponent.py,v 1.1 2008/05/23 12:53:45 eallaert Exp $
"""
"""
from Acspy.Clients.SimpleClient import PySimpleClient
from time import sleep
import sys

simpleClient = PySimpleClient()
sleep(5)

print "Getting the Supplier"
sys.stdout.flush()
mySupplierComp = simpleClient.getComponent("SUPPLIERCOMP1")

print "Sending events"
sys.stdout.flush()
for i in range(50):
    mySupplierComp.sendEvents(1)
    sleep(1)

simpleClient.releaseComponent("SUPPLIERCOMP1")

print "Finished sending events"
sys.stdout.flush()
Exemplo n.º 25
0
class ServerRepresentationTest(unittest.TestCase):
    """
    Test cases for the Server representation.
    """

    #---------------------------------------------------------------------------
    def setUp(self):
        """
        Test case fixture.
        """
        self.client = PySimpleClient("ServerRepresentationTest")
        self.simulator = self.client.getComponent("SIMULATION_SERVER")
        self.lamp = self.client.getComponent("LAMP_ACCESS")

    #---------------------------------------------------------------------------
    def tearDown(self):
        """
        Test case fixture cleanup.
        """
        self.client.releaseComponent("SIMULATION_SERVER")
        self.client.releaseComponent("LAMP_ACCESS")
        self.client.disconnect()

    #---------------------------------------------------------------------------
    def testSetupBehavior(self):
        """
        Modify the behavior of the simulated LAMP_ACCESS component.
        Setup the getLampBrightness function so it returns a constant 
        number.
        """

        code = """LOGGER.logInfo('getLampBrightness called.')
6.8"""
        self.simulator.setMethod('LAMP_ACCESS', 'getLampBrightness', code, 0.0)

        brightness = self.lamp.getLampBrightness()
        assert abs(brightness - 6.8) <= 0.01

    #---------------------------------------------------------------------------
    def testPersistentData(self):
        """
        Data can be left in a global buffer located in the Goodies module.
        This allows to get input data to persist between calls to the simulated
        component.
        As this test case shows, this can be useful to simulate get/set methods.
        """
        code = """LOGGER.logInfo('setLampBrightness called; brightness='+str(parameters[0]))
from Acssim.Goodies import setGlobalData
setGlobalData('brightness', parameters[0])
None"""
        self.simulator.setMethod('LAMP_ACCESS', 'setLampBrightness', code, 0.0)
        code = """LOGGER.logInfo('getLampBrightness called.')
from Acssim.Goodies import setGlobalData
getGlobalData('brightness')"""
        self.simulator.setMethod('LAMP_ACCESS', 'getLampBrightness', code, 0.0)

        self.lamp.setLampBrightness(3.14)
        brightness = self.lamp.getLampBrightness()
        assert abs(brightness - 3.14) <= 0.01

    #---------------------------------------------------------------------------
    def testGetGlobalData(self):
        """
        The SIMULATION_SERVER component implements also a getGlobalData() function,
        which is tested here.
        """
        code = """LOGGER.logInfo('setLampBrightness called; brightness='+str(parameters[0]))
from Acssim.Goodies import setGlobalData
setGlobalData('brightness', parameters[0])
None"""
        self.simulator.setMethod('LAMP_ACCESS', 'setLampBrightness', code, 0.0)
        self.lamp.setLampBrightness(3.14)
        brightness = self.simulator.getGlobalData('brightness')
        assert brightness == '3.14'

    #---------------------------------------------------------------------------
    def testRaiseException(self):
        """
        Modify the behaviour of the LAMP_ACCESS component so it raises the
        LampUnavailable exception when the getLampBrightness() function is
        called.
        """
        code = """from demo import LampUnavailable
raise LampUnavailable()"""
        self.simulator.setMethod('LAMP_ACCESS', 'getLampBrightness', code, 0.0)

        try:
            b = self.lamp.getLampBrightness()
        except LampUnavailable, ex:
            return  # Correct exception was raised.
        except:
Exemplo n.º 26
0
testComplexRWProperty(pybaci._get_uLongLongRWProp(),
                      CBuLongLong()._this(), 12345L)
print "----------------------------------------------------------------"
testComplexRWProperty(pybaci._get_doubleSeqRWProp(),
                      CBdoubleSeq()._this(), [1.0, 2.0, 3.0])
print "----------------------------------------------------------------"
testComplexRWProperty(pybaci._get_longSeqRWProp(),
                      CBlongSeq()._this(), [10, 20, 30])
print "----------------------------------------------------------------"
print "----------------------------------------------------------------"
testComplexROProperty(pybaci._get_timestampROProp(), CBlongSeq()._this())
print "----------------------------------------------------------------"

#property = pybaci._get_strSeqProp()
#cbMon = CBstringSeq(archive=1)
#cbMonServant = cbMon._this()
## Create the real monitor registered with PYBACI1
#actMon = property.create_monitor(cbMonServant, DESC)
## Tell PYBACI1 that the monitor's working method should be invoked 1 once second
#actMon.set_timer_trigger(10000000)
## destroy the monitor after ten seconds
#from time import sleep
#sleep(10)
#actMon.destroy()
#sleep(5)
#print cbMon.values

simpleClient.releaseComponent("PYBACI1")
simpleClient.disconnect()
print "The end __oOo__"
Exemplo n.º 27
0
                       help="The desired sky frequency for the beacon")

(options, args) = parser.parse_args()
if options.skyFreq == None:
	print "You must specify a sky frequency use the \"-f\" option"
	sys.exit(-1)

options.skyFreq = float(options.skyFreq)

# Check with the Control Master to see what arrays are in existence
client = PySimpleClient()
master = client.getComponent("CONTROL/MASTER")

arrayList = master.getAutomaticArrayComponents() + \
            master.getManualArrayComponents()
client.releaseComponent("CONTROL/MASTER")

if len(arrayList) != 1:
    if len(arrayList) == 0:
        print "Error: No Arrays in existence, unable to set frequency"
    else:
        print "Error: Multiple arrays detected...are you sure your at the ATF"
    sys.exit


array = client.getComponent(arrayList[0].ComponentName)

antennaList = array.getAntennas()


harmonic = 1
Exemplo n.º 28
0
from time import sleep
from Acspy.Clients.SimpleClient import PySimpleClient
from Acspy.Common.Callbacks     import CBvoid
from ACS import CBDescIn

compName = argv[1]
compMethod = argv[2]

print "Parameters to this generic test script are:", argv[1:]

# Make an instance of the PySimpleClient
simpleClient = PySimpleClient()
comp = simpleClient.getComponent(compName)

myCB = CBvoid()
myCorbaCB = simpleClient.activateOffShoot(myCB)
myDescIn = CBDescIn(0L, 0L, 0L)

joe = eval("comp." + compMethod + "(myCorbaCB, myDescIn)")
print "Method executed...now just waiting on CB status"

for i in range(0, 50):
    if myCB.status == 'DONE':
        print "The callback has finished!"
        break
    else:
        sleep(1)
    
simpleClient.releaseComponent(compName)
simpleClient.disconnect()
Exemplo n.º 29
0
    #Let the Notification Service know we are ready to start processing events.
    g.consumerReady()

    #After five events have been received, disconnect from the channel
    simpleClient.getLogger().logInfo("Waiting for events . . .")
    while(count<5):
        sleep(1)

    simpleClient.getLogger().logInfo("Events all done . . . exiting")
    g.disconnect()

    #Turn the C++ Fridge device off.
    aFridge.off()

    # Release it
    simpleClient.releaseComponent("FRIDGE1")

    simpleClient.disconnect()
#------------------------------------------------------------------------------











Exemplo n.º 30
0
    g.consumerReady()

    sampObj.start()
    print " ACS sampling started"
    sleep(5)
    sampObj.suspend()
    print "ACS sampling suspended"
    
    sleep(5)
    sampObj.resume()
    print "ACS sampling resumed"
    
    sleep(6)
    sampObj.stop()
    print "ACS sampling stopped"
    
    sleep(2)
    sampObj.destroy()
    print "ACS sampling destroyed"
    

    #After five events have been received, disconnect from the channel
    print "Waiting for events . . ."
    while(count<5):
        sleep(1)
        
    client.releaseComponent(argv[1])
    g.disconnect()
    client.disconnect()
#------------------------------------------------------------------------------
Exemplo n.º 31
0
magicNumber = int(argv[2])


def myHandler(ts, device, parameter, value):
    '''
    '''
    global count
    if count < magicNumber:
        count = count + 1
    return


#create the consumer
myConsumer = ArchiveConsumer(myHandler)
myConsumer.consumerReady()
#activate the component which will publish the events automatically
joe = PySimpleClient()
ps = joe.getComponent("TEST_PS_1")
#give the consumer a chance to receive the events
sleep(int(argv[1]))

#shutdown everything cleanly
myConsumer.disconnect()
joe.releaseComponent("TEST_PS_1")
joe.disconnect()

if count == magicNumber:
    print "Test passed!"
else:
    print "Test failed:", count
Exemplo n.º 32
0
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
# MA 02111-1307  USA
#
# @(#) $Id: javaSupplierComponent.py,v 1.1 2008/05/23 12:53:45 eallaert Exp $
"""
"""
from Acspy.Clients.SimpleClient import PySimpleClient
from time import sleep
import sys

simpleClient = PySimpleClient()
sleep(5)

print "Getting the Supplier"
sys.stdout.flush()
mySupplierComp = simpleClient.getComponent("SUPPLIERCOMP1")


print "Sending events"
sys.stdout.flush()
for i in range(50):
    mySupplierComp.sendEvents(1)
    sleep(1)

simpleClient.releaseComponent("SUPPLIERCOMP1")

print "Finished sending events"
sys.stdout.flush()
Exemplo n.º 33
0
if not val:
    print "TESTCOMPONENT.testServices() FAILED!!!"

#test a mortal component next
print "Testing TESTCOMPONENT1 (i.e., mortal components)"
test1 = simpleClient.getComponent("TESTCOMPONENT1")
test1.sayHello()
val = test1.testServices()
if not val:
    print "TESTCOMPONENT1.testServices() FAILED!!!"

#should have been activated and deactivated twice already
print "Testing TESTCOMPONENT2 (i.e., getComponent() and component activation/deactivation"
test2 = simpleClient.getComponent("TESTCOMPONENT2")
test2.invokeSayHello("TESTCOMPONENT")
test2.invokeSayHello("TESTCOMPONENT1")
#DWF-removed because it causes problems for ACS 4.1.x manager involving cyclic dependencies
#test2.invokeSayHello("TESTCOMPONENT2")
test2.invokeSayHello("TESTCOMPONENT3")
test2.invokeSayHello("TESTCOMPONENT4")
test2.invokeSayHello("TESTCOMPONENT5")

#release everything
sleep(5)
print "Deactivating components"
simpleClient.releaseComponent("TESTCOMPONENT")
simpleClient.releaseComponent("TESTCOMPONENT1")

print "The end __oOo__"

Exemplo n.º 34
0
        DevIO.__init__(self, 3.14)

    def read(self):
        return 3.14
#-------------------------------------------------------
class MyCallback(CBvoid):
     def working (self, completion, desc):
         '''
         '''
         print "Ramped PowerSupply startRamping CB: working method called"

#-------------------------------------------------------
from time import sleep
if __name__=="__main__":
    compName = "TEST_RPS_1"

    # Make an instance of the PySimpleClient
    simpleClient = PySimpleClient()
    comp = simpleClient.getComponent(compName)

    myCB = MyCallback()
    myCorbaCB = simpleClient.activateOffShoot(myCB)
    myDescIn = ACS.CBDescIn(0L, 0L, 0L)
    
    print "Ramped PowerSupply readback value:", comp._get_readback().get_sync()[0]

    comp.startRamping(1L, myCorbaCB, myDescIn)
    
    simpleClient.releaseComponent(compName)
    simpleClient.disconnect()
Exemplo n.º 35
0
from Acspy.Clients.SimpleClient import PySimpleClient

remoteComponentName = "TESTMAXMSGSIZE"

# Loop and call the sendSequence method on the component
# making the size of the sequence sent larger w/ each iteration
# at some point, the ORB should fail because omniorb's max
# msg size will have been exceeded.

# Make an instance of the PySimpleClient
simpleClient = PySimpleClient()

while 1:
    try:
        characters = "1"

        # Get the test component by name
        remoteComponent = simpleClient.getComponent(remoteComponentName)

        for i in range(0, 22):
            print "Length being sent: ", len(characters)
            remoteComponent.sendSequence(characters)
            characters = characters + characters

        simpleClient.releaseComponent(remoteComponentName)
    except:
        print "FAILED to send: ", len(characters)
        time.sleep(1)

simpleClient.disconnect()
Exemplo n.º 36
0
from Acspy.Clients.SimpleClient import PySimpleClient

# Make an instance of the PySimpleClient
simpleClient = PySimpleClient()

# Get the standard MOUNT1 Mount device
mount = simpleClient.getComponent("MOUNT1")

# Get the actAz property and print it out
print "MOUNT1 actual azimuth: ", mount._get_actAz().get_sync()[0]

# See what's available
components = [c.name for c in simpleClient.availableComponents()]
components.sort()
print "Available components: ", components

from ACS__POA import OffShoot


class MyOffShoot(OffShoot):
    pass


simpleClient.activateOffShoot(MyOffShoot())

#cleanly disconnect
simpleClient.releaseComponent("MOUNT1")
simpleClient.disconnect()

print "The end __oOo__"
Exemplo n.º 37
0
from Acspy.Clients.SimpleClient import PySimpleClient

# Make an instance of the PySimpleClient
simpleClient = PySimpleClient()

# Print information about the available COBs

# Do something on a device.
simpleClient.getLogger().logInfo(
    "We can directly manipulate a device once we get it, which is easy.")
try:
    # Get the standard MOUNT1 Mount device
    ws = simpleClient.getComponent("MONITOR_COLLECTOR")

    # Get the humidity
    ws.registerMonitoredDevice("SensorTag", "1")
    # Print value
    ws.startMonitoring("SensorTag")
    raw_input("##################Press enter to quit#########################")
    # Release it
    simpleClient.releaseComponent("MONITOR_COLLECTOR")

except Exception, e:
    simpleClient.getLogger().logCritical(
        "Sorry, I expected there to be a Mount in the system and there isn't.")
    simpleClient.getLogger().logDebug("The exception was:" + str(e))
simpleClient.disconnect()
print "The end __oOo__"
#
# ___oOo___
Exemplo n.º 38
0
# Print information about the available COBs
components = simpleClient.availableComponents()

simpleClient.getLogger().logInfo("COBs available are: ")
for cob in components:
    simpleClient.getLogger().logInfo(cob.name + " of type " + cob.type)

# Do something on a device.
simpleClient.getLogger().logInfo("We can directly manipulate a device once we get it, which is easy.")
try:
    # Get the standard MOUNT1 Mount device
    mount = simpleClient.getComponent("MOUNT1")

    # Get the actAz property
    actAzProperty = mount._get_actAz()

    # Ask the current value of the property
    (azm, compl) = actAzProperty.get_sync()
    simpleClient.getLogger().logInfo("MOUNT1 actual azimuth: " + str(azm))

    # Release it
    simpleClient.releaseComponent("MOUNT1")
    
except Exception, e:
    simpleClient.getLogger().logCritical("Sorry, I expected there to be a Mount in the system and there isn't.")
    simpleClient.getLogger().logDebug("The exception was:" + str(e))

simpleClient.disconnect()
print "The end __oOo__"
Exemplo n.º 39
0
###############################################################################
'''
Tests reloading components
'''
from Acspy.Clients.SimpleClient import PySimpleClient
from time import sleep
###############################################################################
if __name__ == "__main__":
    simpleClient = PySimpleClient()
    #this bit a code should make the container print out one special statement
    print "...should see 1 module message now..."
    c1 = simpleClient.getComponent("RELOADCOMP1")
    sleep(4)
    #releasing it should do the same thing
    print "...and another one after it's released..."
    simpleClient.releaseComponent("RELOADCOMP1")
    sleep(4)
    
    print "...there should not be one here though..."
    c1 = simpleClient.getComponent("RELOADCOMP1")
    sleep(4)
    print "...or here..."
    c2 = simpleClient.getComponent("RELOADCOMP2")
    sleep(4)
    print "...or even here"
    simpleClient.releaseComponent("RELOADCOMP1")
    sleep(4)
    print "...but there should be one here..."
    simpleClient.releaseComponent("RELOADCOMP2")
    sleep(4)
    simpleClient.disconnect()
Exemplo n.º 40
0
        ]
    mc.registerMonitoredDeviceWithMultipleSerial('MC_TEST_PROPERTIES_COMPONENT', psns)
    mc.startMonitoring('MC_TEST_PROPERTIES_COMPONENT')    
    time.sleep(3)
    mc.stopMonitoring('MC_TEST_PROPERTIES_COMPONENT')
except MonitorErr.RegisteringDeviceProblemEx, _ex:
    ex = MonitorErrImpl.RegisteringDeviceProblemExImpl(exception=_ex)
    ex.Print();   

data = mc.getMonitorData()

print "Number of Devices:", len(data);
for d in data:
    print d.componentName, d.deviceSerialNumber 
    for blob in d.monitorBlobs:
        print "\t", blob.propertyName, blob.propertySerialNumber
        i=0
        for blobData in any.from_any(blob.blobDataSeq):
            if i<2:
                print "\t\t", blobData
                i+=1

mc.deregisterMonitoredDevice('MC_TEST_PROPERTIES_COMPONENT')

#cleanly disconnect
simpleClient.releaseComponent(argv[1])
simpleClient.disconnect()
stdout.flush()


Exemplo n.º 41
0
    exit()
client = PySimpleClient()
stateSystem = client.getDefaultComponent("IDL:alma/projectlifecycle/StateSystem:1.0")
archive = client.getDefaultComponent("IDL:alma/xmlstore/ArchiveConnection:1.0")
ops = archive.getOperational("SCRIPT")

for uid in sys.argv[1:]:
    print "Trying to transition SB with UID:", uid
    xml = ops.retrieve(uid)
    sb = APDMEntities.SchedBlock.CreateFromDocument(xml.xmlString)
    sbs_id = sb.SBStatusRef.entityId

    try:
        # First try with CSV SB
        #        stateSystem.changeSBStatus(str(sbs_id), 'Running', 'scheduling', 'user_with_all_roles')
        #        stateSystem.changeSBStatus(str(sbs_id), 'CSVReady', 'scheduling', 'aod')
        stateSystem.changeSBStatus(str(sbs_id), "CSVReady", "scheduling", "user_with_all_roles")
    except:
        # Then with a Regular SB
        try:
            #            stateSystem.changeSBStatus(str(sbs_id), 'Ready', 'scheduling', 'aod')
            #            stateSystem.changeSBStatus(str(sbs_id), 'Running', 'scheduling', 'user_with_all_roles')
            stateSystem.changeSBStatus(str(sbs_id), "Ready", "scheduling", "user_with_all_roles")
        except:
            # if it fails, continue
            traceback.print_exc()
            pass

client.releaseComponent(stateSystem._get_name())
client.releaseComponent(archive._get_name())
Exemplo n.º 42
0
#! /usr/bin/env python

from sys import argv
from time import sleep
from Acspy.Clients.SimpleClient import PySimpleClient
import ACS
import time, os

simpleClient = PySimpleClient()
cdb_mount = simpleClient.getComponent("COMP99")

sleep(10)

simpleClient.releaseComponent("COMP99")
Exemplo n.º 43
0
print "----------------------------------------------------------------"
testComplexRWProperty(pybaci._get_longLongRWProp(), CBlongLong()._this(), 1234L)
print "----------------------------------------------------------------"
testComplexRWProperty(pybaci._get_uLongLongRWProp(), CBuLongLong()._this(), 12345L)
print "----------------------------------------------------------------"
testComplexRWProperty(pybaci._get_doubleSeqRWProp(), CBdoubleSeq()._this(), [1.0, 2.0, 3.0])
print "----------------------------------------------------------------"
testComplexRWProperty(pybaci._get_longSeqRWProp(), CBlongSeq()._this(), [10, 20, 30])
print "----------------------------------------------------------------"
print "----------------------------------------------------------------"
testComplexROProperty(pybaci._get_timestampROProp(), CBlongSeq()._this())
print "----------------------------------------------------------------"

#property = pybaci._get_strSeqProp()
#cbMon = CBstringSeq(archive=1)
#cbMonServant = cbMon._this()
## Create the real monitor registered with PYBACI1
#actMon = property.create_monitor(cbMonServant, DESC)
## Tell PYBACI1 that the monitor's working method should be invoked 1 once second
#actMon.set_timer_trigger(10000000)
## destroy the monitor after ten seconds
#from time import sleep
#sleep(10)
#actMon.destroy()
#sleep(5)
#print cbMon.values

simpleClient.releaseComponent("PYBACI1")
simpleClient.disconnect()
print "The end __oOo__"
Exemplo n.º 44
0
val = test1.testServices()
if not val:
    print "TESTCOMPONENT1.testServices() FAILED!!!"

#should have been activated and deactivated twice already
print "Testing TESTCOMPONENT2 (i.e., getComponent() and component activation/deactivation"
test2 = simpleClient.getComponent("TESTCOMPONENT2")
test2.invokeSayHello("TESTCOMPONENT")
test2.invokeSayHello("TESTCOMPONENT1")
#DWF-removed because it causes problems for ACS 4.1.x manager involving cyclic dependencies
#test2.invokeSayHello("TESTCOMPONENT2")
test2.invokeSayHello("TESTCOMPONENT3")
test2.invokeSayHello("TESTCOMPONENT4")
test2.invokeSayHello("TESTCOMPONENT5")

# trying to get a non existent component should through a exception
try:
    testNotFound = simpleClient.getComponent("THIS_COMPONENT_DOES_NOT_EXIST")
    print "This message should not appear", testNotFound
except:
    # This is what we expect
    print "Failure loading a component throws a exception as expected. OK."

#release everything
sleep(5)
print "Deactivating components"
simpleClient.releaseComponent("TESTCOMPONENT")
simpleClient.releaseComponent("TESTCOMPONENT1")

print "The end __oOo__"
Exemplo n.º 45
0
from Acspy.Clients.SimpleClient import PySimpleClient     # Import the acspy.PySimpleClient class
from Acspy.Common.Callbacks     import CBdouble
import ACS                      # Import the Python CORBA stubs for BACI
from time                       import sleep

#------------------------------------------------------------------------------
simpleClient = PySimpleClient()

#Get the MOUNT1 Mount device
mount = simpleClient.getComponent("MOUNT2_LOOP")

#Get the actAz property
actAzProperty = mount._get_actAz()

#Create a callback monitor for the actAz Property
cbMon = CBdouble(name="actAz", archive=1)  
actMon = actAzProperty.create_monitor(cbMon._this(), ACS.CBDescIn(0L, 0L, 0L))

#Working method gets invoked once per second
actMon.set_timer_trigger(10000000)  

#Destroy the monitor after ten seconds
sleep(10)  
actMon.destroy()

print "The monitored values are: ", cbMon.values

# Release the component
simpleClient.releaseComponent("MOUNT2_LOOP")
simpleClient.disconnect()