Ejemplo n.º 1
0
log = ion.util.ionlog.getLogger(__name__)
import logging

from twisted.internet import defer

from ion.core.object import object_utils
from ion.core.messaging import message_client

from ion.core import bootstrap

from siamci.siamci_constants import SiamDriverChannel
from siamci.util.tcolor import red, blue

from net.ooici.play.instr_driver_interface_pb2 import Command, SuccessFail, OK, ERROR

Command_type = object_utils.create_type_identifier(object_id=20034, version=1)


class SiamCiAdapterProxy():
    """
    Communicates with a SIAM-CI adapter service to support SiamInstrumentDriver operations.
    
    @note: An instance of this proxy can have an associated port (given at construction time) 
    for those operations that are instrument-specific. Other non-instrument specific operations
    are also provided.
    
    There are two main behaviors for the various operations depending on the value given to
    the 'publish_stream' parameter: If the 'publish_stream' parameter in not None, this 
    indicates that the result of the command should be published to the queue (routing key)
    given by the parameter. In this case, the return of the method is a SuccessFail object
    indicating whether the command has been or has not been successfully submitted.
@summary: tests the interaction between python and java by making requests to
          an echo service in java, and verifying the response.
"""
import ion.util.ionlog
log = ion.util.ionlog.getLogger(__name__)

from twisted.internet import defer

from ion.core import bootstrap

from ion.core.object import object_utils
from ion.core.messaging import message_client

from siamci.test.siamcitest import SiamCiTestCase

Command_type = object_utils.create_type_identifier(object_id=20034, version=1)

class JavaEchoTest(SiamCiTestCase):
    
    @defer.inlineCallbacks
    def setUp(self):
        yield self._start_container()

    @defer.inlineCallbacks
    def tearDown(self):
        yield self._stop_container()


    @defer.inlineCallbacks
    def test_send_message_instance1(self):
        """
Ejemplo n.º 3
0
log = ion.util.ionlog.getLogger(__name__)

from twisted.trial import unittest
from ion.test.iontest import IonTestCase

from twisted.internet import defer

from siamci.siamci_proxy import SiamCiAdapterProxy
from siamci.receiver_service import SiamCiReceiverServiceClient

from os import getenv

from ion.core.object.object_utils import create_type_identifier

Command_type = create_type_identifier(object_id=20034, version=1)
ChannelParameterPair_type = create_type_identifier(object_id=20035, version=1)
SuccessFail_type = create_type_identifier(object_id=20036, version=1)


class SiamCiTestCase(IonTestCase):
    """
    A base class for SIAM-CI test cases.
    Handles the situation where the tests should be skipped (via defining
    the class variable 'skip' to some string; this variable is used by 
    twisted trial to skip the whole class).
    
    Besides some helper methods, subclasses should only refer to the 'pid' and 'port' 
    class variables defined in this class:
        pid:  The queue associated with the SIAM-CI adapter service (in java)
              Note that this queue is assumed to be associated with the message broker
Ejemplo n.º 4
0
import ion.util.ionlog
log = ion.util.ionlog.getLogger(__name__)

from twisted.trial import unittest
from ion.test.iontest import IonTestCase

from twisted.internet import defer

from siamci.siamci_proxy import SiamCiAdapterProxy
from siamci.receiver_service import SiamCiReceiverServiceClient

from os import getenv

from ion.core.object.object_utils import create_type_identifier

Command_type = create_type_identifier(object_id=20034, version=1)
ChannelParameterPair_type = create_type_identifier(object_id=20035, version=1)
SuccessFail_type = create_type_identifier(object_id=20036, version=1)


class SiamCiTestCase(IonTestCase):
    """
    A base class for SIAM-CI test cases.
    Handles the situation where the tests should be skipped (via defining
    the class variable 'skip' to some string; this variable is used by 
    twisted trial to skip the whole class).
    
    Besides some helper methods, subclasses should only refer to the 'pid' and 'port' 
    class variables defined in this class:
        pid:  The queue associated with the SIAM-CI adapter service (in java)
              Note that this queue is assumed to be associated with the message broker