def __init__(self, resource_tester_class, service_under_test_class, log):
     """
     @param resource_tester_class the class that will perform the setup/ testing
     @param service_under_test_class the class of the service that's being tested
     @param log the log object 
     """
     ResourceImplMetatest.__init__(self, resource_tester_class, service_under_test_class, log)
Example #2
0
    def __init__(self, resource_tester_class, service_under_test_class, log):
        """
        @param resource_tester_class the class that will perform the setup/ testing
        @param service_under_test_class the class of the service that's being tested
        @param log the log object 
        """
        ResourceImplMetatest.__init__(self, resource_tester_class, service_under_test_class, log)

        self.all_in_one = False
        # now try to get the deleted dp object
        try:
            dp_obj = client.read_data_product(dp_id)
        except NotFound as ex:
            pass
        else:
            self.fail("deleted data product was found during read")

        # now try to delete the already deleted dp object
        print "deleting non-existing data product"
        try:
            client.delete_data_product(dp_id)
        except NotFound as ex:
            pass
        else:
            self.fail("non-existing data product was found during delete")

        # Shut down container
        #container.stop()



 
#dynamically add tests to the test classes. THIS MUST HAPPEN OUTSIDE THE CLASS

#unit
rim = ResourceImplMetatest(TestDataProductManagementServiceUnit, DataProductManagementService, log)
rim.add_resource_impl_unittests(DataProductImpl)

@attr('UNIT', group='sa')
class TestInstrumentManagement(PyonTestCase):

    def setUp(self):
        self.mock_ionobj = self._create_IonObject_mock('ion.services.sa.instrument.instrument_management_service.IonObject')

        #self.mock_ionobj = IonObject
        mock_clients = self._create_service_mock('instrument_management')

        self.instrument_mgmt_service = InstrumentManagementService()
        self.instrument_mgmt_service.clients = mock_clients
        
        # must call this manually
        self.instrument_mgmt_service.on_init()

rim = ResourceImplMetatest(TestInstrumentManagement, InstrumentManagementService, log)

rim.add_resource_impl_unittests(InstrumentAgentInstanceImpl, {"exchange_name": "rhubarb"})
rim.add_resource_impl_unittests(InstrumentAgentImpl, {"agent_version": "3", "time_source": "the universe"})
rim.add_resource_impl_unittests(InstrumentDeviceImpl, {"serial_number": "123", "firmware_version": "x"})
rim.add_resource_impl_unittests(InstrumentModelImpl, {"model_label": "redundant?"})
rim.add_resource_impl_unittests(PlatformAgentInstanceImpl, {"exchange_name": "sausage"})
rim.add_resource_impl_unittests(PlatformAgentImpl, {"description": "the big donut"})
rim.add_resource_impl_unittests(PlatformDeviceImpl, {"serial_number": "2345"})
rim.add_resource_impl_unittests(PlatformModelImpl, {"description": "tammy breathed deeply"})
rim.add_resource_impl_unittests(SensorDeviceImpl, {"serial_number": "123"})
rim.add_resource_impl_unittests(SensorModelImpl, {"model_label": "redundant field?"})


#from pyon.core.exception import BadRequest, Conflict, Inconsistent, NotFound
#import unittest
from pyon.util.unit_test import PyonTestCase


@attr('UNIT', group='sa')
class TestObservatoryManagement(PyonTestCase):
    def setUp(self):
        self.mock_ionobj = self._create_IonObject_mock(
            'ion.services.sa.observatory.observatory_management_service.IonObject'
        )

        #self.mock_ionobj = IonObject
        mock_clients = self._create_service_mock('observatory_management')

        self.observatory_mgmt_service = ObservatoryManagementService()
        self.observatory_mgmt_service.clients = mock_clients

        # must call this manually
        self.observatory_mgmt_service.on_init()


rim = ResourceImplMetatest(TestObservatoryManagement,
                           ObservatoryManagementService, log)

rim.add_resource_impl_unittests(InstrumentSiteImpl, {})
rim.add_resource_impl_unittests(PlatformSiteImpl, {})
rim.add_resource_impl_unittests(ObservatoryImpl, {})
rim.add_resource_impl_unittests(SubsiteImpl, {})
#from pyon.core.exception import BadRequest, Conflict, Inconsistent, NotFound
#import unittest
from pyon.util.unit_test import PyonTestCase


@attr('UNIT', group='sa')
class TestObservatoryManagement(PyonTestCase):

    def setUp(self):
        self.mock_ionobj = self._create_IonObject_mock('ion.services.sa.observatory.observatory_management_service.IonObject')
        
        #self.mock_ionobj = IonObject
        mock_clients = self._create_service_mock('observatory_management')

        self.observatory_mgmt_service = ObservatoryManagementService()
        self.observatory_mgmt_service.clients = mock_clients
        
        # must call this manually
        self.observatory_mgmt_service.on_init()


rim = ResourceImplMetatest(TestObservatoryManagement, ObservatoryManagementService, log)
rim.test_all_in_one(True)

rim.add_resource_impl_unittests(InstrumentSiteImpl, {})
rim.add_resource_impl_unittests(PlatformSiteImpl, {})
rim.add_resource_impl_unittests(ObservatoryImpl, {})
rim.add_resource_impl_unittests(SubsiteImpl, {})


Example #7
0
    def setUp(self):
        self.mock_ionobj = self._create_IonObject_mock(
            'ion.services.sa.instrument.instrument_management_service.IonObject'
        )

        #self.mock_ionobj = IonObject
        mock_clients = self._create_service_mock('instrument_management')

        self.instrument_mgmt_service = InstrumentManagementService()
        self.instrument_mgmt_service.clients = mock_clients

        # must call this manually
        self.instrument_mgmt_service.on_init()


rim = ResourceImplMetatest(TestInstrumentManagement,
                           InstrumentManagementService, log)

rim.add_resource_impl_unittests(InstrumentAgentInstanceImpl,
                                {"exchange_name": "rhubarb"})
rim.add_resource_impl_unittests(InstrumentAgentImpl, {
    "agent_version": "3",
    "time_source": "the universe"
})
rim.add_resource_impl_unittests(InstrumentDeviceImpl, {
    "serial_number": "123",
    "firmware_version": "x"
})
rim.add_resource_impl_unittests(InstrumentModelImpl,
                                {"model_label": "redundant?"})
rim.add_resource_impl_unittests(PlatformAgentInstanceImpl,
                                {"exchange_name": "sausage"})
#from pyon.core.exception import BadRequest, Conflict, Inconsistent, NotFound
#import unittest
from pyon.util.unit_test import PyonTestCase


@attr('UNIT', group='sa')
class TestMarineFacilityManagement(PyonTestCase):

    def setUp(self):
        self.mock_ionobj = self._create_IonObject_mock('ion.services.sa.marine_facility.marine_facility_management_service.IonObject')
        
        #self.mock_ionobj = IonObject
        mock_clients = self._create_service_mock('marine_facility_management')

        self.marine_facility_mgmt_service = MarineFacilityManagementService()
        self.marine_facility_mgmt_service.clients = mock_clients
        
        # must call this manually
        self.marine_facility_mgmt_service.on_init()


rim = ResourceImplMetatest(TestMarineFacilityManagement, MarineFacilityManagementService, log)

rim.add_resource_impl_unittests(LogicalInstrumentImpl, {})
rim.add_resource_impl_unittests(LogicalPlatformImpl, {})
rim.add_resource_impl_unittests(MarineFacilityImpl, {})
rim.add_resource_impl_unittests(SiteImpl, {})


    def setUp(self):
        self.mock_ionobj = self._create_IonObject_mock('ion.services.sa.instrument.instrument_management_service.IonObject')

        #self.mock_ionobj = IonObject
        mock_clients = self._create_service_mock('instrument_management')

        self.instrument_mgmt_service = InstrumentManagementService()
        self.instrument_mgmt_service.clients = mock_clients
        
        # must call this manually
        self.instrument_mgmt_service.on_init()

        self.addCleanup(delattr, self, "instrument_mgmt_service")
        self.addCleanup(delattr, self, "mock_ionobj")
        #self.resource_impl_cleanup()

    #def resource_impl_cleanup(self):
        #pass

rim = ResourceImplMetatest(TestInstrumentManagement, InstrumentManagementService, log)
rim.test_all_in_one(True)

rim.add_resource_impl_unittests(InstrumentAgentImpl, {"driver_module": "potato"})
rim.add_resource_impl_unittests(InstrumentDeviceImpl, {"serial_number": "123", "firmware_version": "x"})
rim.add_resource_impl_unittests(PlatformAgentImpl, {"description": "the big donut"})
rim.add_resource_impl_unittests(PlatformDeviceImpl, {"serial_number": "2345"})
rim.add_resource_impl_unittests(PlatformModelImpl, {"description": "desc"})
rim.add_resource_impl_unittests(SensorDeviceImpl, {"serial_number": "123"})