# You should have received a copy of the GNU Lesser General Public License 
# along with this program.  If not, see http://www.gnu.org/licenses/.
#

import sys

from omniORB import CORBA

from ossie.cf import CF

import jackhammer

class LoadUnload(jackhammer.Jackhammer):
    def initialize (self, filename):
        self.fileMgr = self.domMgr._get_fileMgr()
        self.filename = filename
        for devMgr in self.domMgr._get_deviceManagers():
            for device in devMgr._get_registeredDevices():
                if device._is_a("IDL:CF/LoadableDevice:1.0"):
                    self.device = device
                    return

        raise RuntimeError, "No LoadableDevice available"
        
    def test (self):
        self.device.load(self.fileMgr, self.filename, CF.LoadableDevice.EXECUTABLE)
        self.device.unload(self.filename)

if __name__ == '__main__':
    jackhammer.run(LoadUnload)
Esempio n. 2
0
    def test (self):
        if self.__ignore_app:
            try:
                print "Creating  app: " + str( self.app_cnt ) 
                app = self.appFact.create(self.appFact._get_name(), [], [])
                app.stop()
                app.releaseObject()
                print "Cleaned up app: " + str( self.app_cnt ) 
                self.app_cnt += 1
            except:
                pass
        else:
            app = self.appFact.create(self.appFact._get_name(), [], [])
            app.stop()
            app.releaseObject()

    def options(self):
        return '', ['timeout=','ignore']

    def setOption(self, key, value):
        if key == '--timeout':
            self.__timeout = int(value)
        if key == '--ignore':
            self.__ignore_app = True
        else:
            raise KeyError("Unknown option '%s'" % (key,))

if __name__ == '__main__':
    jackhammer.run(CreateApp)
# distributed with this source distribution.
# 
# This file is part of REDHAWK core.
# 
# REDHAWK core is free software: you can redistribute it and/or modify it under 
# the terms of the GNU Lesser General Public License as published by the Free 
# Software Foundation, either version 3 of the License, or (at your option) any 
# later version.
# 
# REDHAWK core is distributed in the hope that it will be useful, but WITHOUT 
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
# FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
# details.
# 
# You should have received a copy of the GNU Lesser General Public License 
# along with this program.  If not, see http://www.gnu.org/licenses/.
#

import jackhammer

class ListFiles(jackhammer.Jackhammer):
    def initialize (self, path):
        self.fm = self.domMgr._get_fileMgr()
        self.path = path

    def test (self):
        files = self.fm.list(self.path)

if __name__ == '__main__':
    jackhammer.run(ListFiles)
Esempio n. 4
0
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program.  If not, see http://www.gnu.org/licenses/.
#

import sys

from omniORB import CORBA

from ossie.cf import CF

import jackhammer


class AllocDealloc(jackhammer.Jackhammer):
    def initialize(self):
        bogomipsId = "DCE:5636c210-0346-4df7-a5a3-8fd34c5540a8"
        self.devMgr = self.domMgr._get_deviceManagers()[0]
        self.device = self.devMgr._get_registeredDevices()[0]
        self.props = [
            CF.DataType(bogomipsId, CORBA.Any(CORBA.TC_long, 100000000 / 100))
        ]

    def test(self):
        self.device.allocateCapacity(self.props)
        self.device.deallocateCapacity(self.props)


if __name__ == '__main__':
    jackhammer.run(AllocDealloc)
Esempio n. 5
0
        if self.__ignore_app:
            try:
                print "Creating  app: " + str( self.app_cnt ) 
                app = self.appFact.create(self.appFact._get_name(), [], [])
                time.sleep(self.__delay)
                app.releaseObject()
                print "Cleaned up app: " + str( self.app_cnt ) 
                self.app_cnt += 1
            except:
                pass
        else:
            app = self.appFact.create(self.appFact._get_name(), [], [])
            time.sleep(self.__delay)
            app.releaseObject()

    def options(self):
        return '', ['timeout=','ignore','delay=']

    def setOption(self, key, value):
        if key == '--timeout':
            self.__timeout = int(value)
        elif key == '--ignore':
            self.__ignore_app = True
        elif key == '--delay':
            self.__delay = float(value)
        else:
            raise KeyError("Unknown option '%s'" % (key,))

if __name__ == '__main__':
    jackhammer.run(CreateApp)
Esempio n. 6
0
        self.allocMgr = self.domMgr._get_allocationMgr()
        self.lock = threading.Lock()
        self.index = 0

    def next_scope(self):
        self.lock.acquire()
        try:
            index = self.index
            self.index = (self.index + 1) % len(SCOPES)
            return SCOPES[index]
        finally:
            self.lock.release()

    def test (self):
        try:
            items, allociter = self.allocMgr.listAllocations(self.next_scope(), 0)
        except:
            import traceback, sys
            traceback.print_exception(*sys.exc_info())
            raise
        if allociter is not None:
            try:
                status = True
                while status:
                    status, item = allociter.next_one()
            finally:
                allociter.destroy()

if __name__ == '__main__':
    jackhammer.run(AllocListIterators)
Esempio n. 7
0

class DevListIterators(jackhammer.Jackhammer):
    def initialize(self):
        self.allocMgr = self.domMgr._get_allocationMgr()
        self.lock = threading.Lock()
        self.index = 0

    def next_scope(self):
        self.lock.acquire()
        try:
            index = self.index
            self.index = (self.index + 1) % len(SCOPES)
            return SCOPES[index]
        finally:
            self.lock.release()

    def test(self):
        items, deviter = self.allocMgr.listDevices(self.next_scope(), 0)
        if deviter is not None:
            try:
                status = True
                while status:
                    status, item = deviter.next_one()
            finally:
                deviter.destroy()


if __name__ == '__main__':
    jackhammer.run(DevListIterators)
Esempio n. 8
0
# This file is part of REDHAWK core.
# 
# REDHAWK core is free software: you can redistribute it and/or modify it under 
# the terms of the GNU Lesser General Public License as published by the Free 
# Software Foundation, either version 3 of the License, or (at your option) any 
# later version.
# 
# REDHAWK core is distributed in the hope that it will be useful, but WITHOUT 
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
# FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
# details.
# 
# You should have received a copy of the GNU Lesser General Public License 
# along with this program.  If not, see http://www.gnu.org/licenses/.
#

import jackhammer

class OpenFile(jackhammer.Jackhammer):
    def initialize (self, filename):
        self.filename = filename
        self.fs = self.domMgr._get_fileMgr()

    def test (self):
        file = self.fs.open(self.filename, True)
        data = file.read(file.sizeOf())
        file.close()

if __name__ == '__main__':
    jackhammer.run(OpenFile)
Esempio n. 9
0
        self.index = 0

    def next_scope(self):
        self.lock.acquire()
        try:
            index = self.index
            self.index = (self.index + 1) % len(SCOPES)
            return SCOPES[index]
        finally:
            self.lock.release()

    def test(self):
        try:
            items, allociter = self.allocMgr.listAllocations(
                self.next_scope(), 0)
        except:
            import traceback, sys
            traceback.print_exception(*sys.exc_info())
            raise
        if allociter is not None:
            try:
                status = True
                while status:
                    status, item = allociter.next_one()
            finally:
                allociter.destroy()


if __name__ == '__main__':
    jackhammer.run(AllocListIterators)
Esempio n. 10
0
# This file is part of REDHAWK core.
#
# REDHAWK core is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option) any
# later version.
#
# REDHAWK core is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
# details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program.  If not, see http://www.gnu.org/licenses/.
#

import jackhammer


class ListFiles(jackhammer.Jackhammer):
    def initialize(self, path):
        self.fm = self.domMgr._get_fileMgr()
        self.path = path

    def test(self):
        files = self.fm.list(self.path)


if __name__ == '__main__':
    jackhammer.run(ListFiles)
Esempio n. 11
0
    CF.AllocationManager.AUTHORIZED_DEVICES
]

class DevListIterators(jackhammer.Jackhammer):
    def initialize (self):
        self.allocMgr = self.domMgr._get_allocationMgr()
        self.lock = threading.Lock()
        self.index = 0

    def next_scope(self):
        self.lock.acquire()
        try:
            index = self.index
            self.index = (self.index + 1) % len(SCOPES)
            return SCOPES[index]
        finally:
            self.lock.release()

    def test (self):
        items, deviter = self.allocMgr.listDevices(self.next_scope(), 0)
        if deviter is not None:
            try:
                status = True
                while status:
                    status, item = deviter.next_one()
            finally:
                deviter.destroy()

if __name__ == '__main__':
    jackhammer.run(DevListIterators)
Esempio n. 12
0
import sys

from omniORB import CORBA

from ossie.cf import CF

import jackhammer


class LoadUnload(jackhammer.Jackhammer):
    def initialize(self, filename):
        self.fileMgr = self.domMgr._get_fileMgr()
        self.filename = filename
        for devMgr in self.domMgr._get_deviceManagers():
            for device in devMgr._get_registeredDevices():
                if device._is_a("IDL:CF/LoadableDevice:1.0"):
                    self.device = device
                    return

        raise RuntimeError, "No LoadableDevice available"

    def test(self):
        self.device.load(self.fileMgr, self.filename,
                         CF.LoadableDevice.EXECUTABLE)
        self.device.unload(self.filename)


if __name__ == '__main__':
    jackhammer.run(LoadUnload)
Esempio n. 13
0
# REDHAWK core is distributed in the hope that it will be useful, but WITHOUT 
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
# FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
# details.
# 
# You should have received a copy of the GNU Lesser General Public License 
# along with this program.  If not, see http://www.gnu.org/licenses/.
#

import sys

from omniORB import CORBA

from ossie.cf import CF

import jackhammer

class AllocDealloc(jackhammer.Jackhammer):
    def initialize (self):
        bogomipsId = "DCE:5636c210-0346-4df7-a5a3-8fd34c5540a8"
        self.devMgr = self.domMgr._get_deviceManagers()[0]
        self.device = self.devMgr._get_registeredDevices()[0]
        self.props = [CF.DataType(bogomipsId, CORBA.Any(CORBA.TC_long, 100000000/100))]

    def test (self):
        self.device.allocateCapacity(self.props)
        self.device.deallocateCapacity(self.props)

if __name__ == '__main__':
    jackhammer.run(AllocDealloc)