Commit a4a64e23 authored by Marco Buttu's avatar Marco Buttu
Browse files

In PF the setup does not turn AS conf and elevation tracking ON

The setup() turns the ASConfiguration and elevation tracking ON
only when the SRP is active
parent 11db5897
Loading
Loading
Loading
Loading
+14 −5
Original line number Original line Diff line number Diff line
@@ -339,11 +339,18 @@ void MinorServoBossImpl::setup(const char *config) throw (CORBA::SystemException


void MinorServoBossImpl::setupImpl(const char *config) throw (ManagementErrors::ConfigurationErrorExImpl)
void MinorServoBossImpl::setupImpl(const char *config) throw (ManagementErrors::ConfigurationErrorExImpl)
{
{

    try {
    try {
        if(!m_configuration->isElevationTrackingEn())
        if(!endswith(string(config), "P")) {
            if(!m_configuration->isElevationTrackingEn()) {
                setElevationTrackingImpl(IRA::CString("ON"));
                setElevationTrackingImpl(IRA::CString("ON"));
            }
            }
        }
        else {
            if(m_configuration->isElevationTrackingEn()) {
                turnTrackingOff();
            }
        }
    }
    catch(...) {
    catch(...) {
        THROW_EX(ManagementErrors, ConfigurationErrorEx, "cannot turn the tracking on", false);
        THROW_EX(ManagementErrors, ConfigurationErrorEx, "cannot turn the tracking on", false);
    }
    }
@@ -354,7 +361,9 @@ void MinorServoBossImpl::setupImpl(const char *config) throw (ManagementErrors::
    if(m_configuration->isParking())
    if(m_configuration->isParking())
        THROW_EX(ManagementErrors, ConfigurationErrorEx, "The system is executing a park", false);
        THROW_EX(ManagementErrors, ConfigurationErrorEx, "The system is executing a park", false);


    if(!endswith(string(config), "P")) {
        m_configuration->setASConfiguration(IRA::CString("ON"));
        m_configuration->setASConfiguration(IRA::CString("ON"));
    }
    m_configuration->init(string(config));  // Throw (ComponentErrors::CDBAccessExImpl);
    m_configuration->init(string(config));  // Throw (ComponentErrors::CDBAccessExImpl);


    try {
    try {
+1 −1
Original line number Original line Diff line number Diff line
@@ -155,7 +155,7 @@ void ParkThread::run()
                }
                }
            }
            }
            catch(...) {
            catch(...) {
                ACS_SHORT_LOG((LM_ERROR, ("ParkThread: cannot disable "  + comp_name).c_str()));
                ACS_SHORT_LOG((LM_ERROR, ("ParkThread: unexpected error, cannot disable "  + comp_name).c_str()));
            }
            }
        }
        }
        else {
        else {
+29 −0
Original line number Original line Diff line number Diff line
@@ -32,6 +32,10 @@ class SetupTest(unittest2.TestCase):
        cls.client.releaseComponent('MINORSERVO/Boss')
        cls.client.releaseComponent('MINORSERVO/Boss')
        cls.client.disconnect()
        cls.client.disconnect()


    def tearDown(self):
        self.boss.park()
        self.wait_until_not_ready()

    def test_elevation_tracking_ON(self):
    def test_elevation_tracking_ON(self):
        """The setup turns the elevation tracking on"""
        """The setup turns the elevation tracking on"""
        self.boss.setup('KKG')
        self.boss.setup('KKG')
@@ -44,19 +48,44 @@ class SetupTest(unittest2.TestCase):
        self.wait_until_ready()
        self.wait_until_ready()
        self.assertEqual(self.boss.getActualSetup(), 'KKG_ASACTIVE')
        self.assertEqual(self.boss.getActualSetup(), 'KKG_ASACTIVE')


    def test_do_not_turn_PF_elevation_tracking_ON(self):
        """In the Primary Focus, do not turn the elevation tracking on"""
        self.boss.setup('LLP')
        self.wait_until_ready()
        self.assertFalse(self.boss.isElevationTrackingEn())

    def test_do_not_turn_PF_as_configuration_ON(self):
        """In the Primary Focus, do not turn the AS configuration on"""
        self.boss.setup('LLP')
        self.wait_until_ready()
        self.assertEqual(self.boss.getActualSetup(), 'LLP')

    def test_actual_setup_unknown(self):
    def test_actual_setup_unknown(self):
        self.boss.setup('KKG')
        self.boss.setup('KKG')
        self.wait_until_ready()
        self.wait_until_ready()
        self.boss.setup('KKG')
        self.boss.setup('KKG')
        self.assertEqual(self.boss.getActualSetup(), 'unknown')
        self.assertEqual(self.boss.getActualSetup(), 'unknown')
        self.wait_until_ready() # Becase the tearDown() executes a park


    def wait_until_ready(self, timeout=240):
    def wait_until_ready(self, timeout=240):
        time.sleep(0.5)
        t0 = datetime.now()
        t0 = datetime.now()
        while not self.boss.isReady():
        while not self.boss.isReady():
            if (datetime.now() - t0).seconds > timeout:
            if (datetime.now() - t0).seconds > timeout:
                assert False, 'The minor servo boss is not ready'
                assert False, 'The minor servo boss is not ready'
            else:
            else:
                time.sleep(1)
                time.sleep(1)
        time.sleep(0.5)

    def wait_until_not_ready(self, timeout=240):
        time.sleep(0.5)
        t0 = datetime.now()
        while self.boss.isReady():
            if (datetime.now() - t0).seconds > timeout:
                assert False, 'The minor servo boss is not parked'
            else:
                time.sleep(1)
        time.sleep(0.5)




if __name__ == '__main__':
if __name__ == '__main__':