Example #1
0
    def __init__(self, comm):
        self.ice = comm
        self.manager = get_service_object(
            self.ice, 'IceStorm/[email protected]',
            IceStorm.TopicManagerPrx)
        topicname = "logger"
        try:
            self.topic = self.manager.retrieve(topicname)
        except IceStorm.NoSuchTopic:
            try:
                self.topic = self.manager.create(topicname)
            except IceStorm.TopicExists:
                self.topic = self.manager.retrieve(topicname)
        # defined in config.icegrid
        self.adapter = \
            self.ice.createObjectAdapterWithEndpoints("LoggingServiceAdapter",
                                                      "tcp")

        subscriber = self.adapter.addWithUUID(LoggerImpl()).ice_oneway()
        qos = {}
        try:
            self.topic.subscribeAndGetPublisher(qos, subscriber)
        except IceStorm.AlreadySubscribed:
            self.topic.unsubscribe(self.subscriber)
            self.topic.subscribeAndGetPublisher(qos, self.subscriber)
        self.adapter.activate()
Example #2
0
    def __init__(self, comm):
        self.ice = comm
        self.manager = get_service_object(
            self.ice,
            'IceStorm/[email protected]',
            IceStorm.TopicManagerPrx)
        topicname = "logger"
        try:
            self.topic = self.manager.retrieve(topicname)
        except IceStorm.NoSuchTopic:
            try:
                self.topic = self.manager.create(topicname)
            except IceStorm.TopicExists:
                self.topic = self.manager.retrieve(topicname)
        # defined in config.icegrid
        self.adapter = \
            self.ice.createObjectAdapterWithEndpoints("LoggingServiceAdapter",
                                                      "tcp")

        subscriber = self.adapter.addWithUUID(LoggerImpl()).ice_twoway()

        qos = {'reliability': 'ordered'}
        try:
            self.topic.subscribeAndGetPublisher(qos, subscriber)
        except IceStorm.AlreadySubscribed:
            self.topic.unsubscribe(self.subscriber)
            self.topic.subscribeAndGetPublisher(qos, self.subscriber)
        self.adapter.activate()
 def setup(self):
     os.environ["ICE_CONFIG"] = 'ice.cfg'
     os.chdir('functests')
     self.igsession = IceSession('applications2.txt', cleanup=True)
     try:
         self.igsession.start()
         self.service = get_service_object(
             self.igsession.communicator,
             "MonProviderService@MonProviderAdapter",
             askap.interfaces.monitoring.MonitoringProviderPrx)
     except Exception as ex:
         self.teardown()
         raise
Example #4
0
    def setUp(self):
        # Note that the working directory is 'functests', thus paths are
        # relative to that location.
        os.environ["ICE_CONFIG"] = "config-files/ice.cfg"
        os.environ['TEST_DIR'] = 'test_lifecycle'
        super(Test, self).setUp()

        try:
            self.sms_client = get_service_object(
                self.ice_session.communicator,
                "SkyModelService@SkyModelServiceAdapter", ISkyModelServicePrx)
        except Exception as ex:
            self.shutdown()
            raise
Example #5
0
    def setUp(self):
        # Note that the working directory is 'functests', thus paths are
        # relative to that location.
        os.environ["ICE_CONFIG"] = "config-files/ice.cfg"
        os.environ['TEST_DIR'] = 'test_sbstate_changed'
        super(Test, self).setUp()

        try:
            self.cpclient = get_service_object(
                self.ice_session.communicator,
                "CentralProcessorService@CentralProcessorAdapter",
                ICPObsServicePrx)
        except Exception as ex:
            self.shutdown()
            raise
Example #6
0
    def setup_icestorm(self, topic="sbstatechange"):
        """Create the IceStorm connection
        Modelled on the TOS TypedValuePublisher Python class
        """
        self.topic_manager = get_service_object(
            self.ice_session.communicator,
            'IceStorm/[email protected]',
            IceStorm.TopicManagerPrx)

        if not topic:
            return

        self.topic = topic
        try:
            topic = self.topic_manager.retrieve(topic)
        except IceStorm.NoSuchTopic:
            try:
                topic = self.topic_manager.create(topic)
            except IceStorm.TopicExists:
                return
        publisher = topic.getPublisher().ice_oneway()
        self.publisher_proxy = ISBStateMonitorPrx.uncheckedCast(publisher)
Example #7
0
    def _setup_subscriber(self):
        self.manager = get_service_object(
            self.ice, 'IceStorm/[email protected]',
            IceStorm.TopicManagerPrx)
        try:
            self.topic = self.manager.retrieve(self.topic_name)
        except IceStorm.NoSuchTopic:
            try:
                self.topic = self.manager.create(self.topic_name)
            except IceStorm.TopicExists:
                self.topic = self.manager.retrieve(self.topic_name)
        # defined in config.icegrid
        self.adapter = \
            self.ice.createObjectAdapterWithEndpoints("SBStateSubAdapter",
                                                      "tcp")

        self.subscriber = self.adapter.addWithUUID(
            SBStateMonitorImpl(self.get_error)).ice_oneway()
        qos = {}
        try:
            self.topic.subscribeAndGetPublisher(qos, self.subscriber)
        except IceStorm.AlreadySubscribed:
            raise
        self.adapter.activate()
Example #8
0
 def _setup_sbservice(self):
     self._sb = get_service_object(
         self.ice, "SchedulingBlockService@DataServiceAdapter",
         iceint.schedblock.ISchedulingBlockServicePrx)