mil.dod.th.ose.gui.integration/src/mil/dod/th/ose/gui/integration/webapp/observation/TestObservationFilters.java
@Test
    public void testRetrieveByDateAndByNumber() throws InterruptedException, ExecutionException, TimeoutException
    {
        long missionStopTime = setupObsMission(15);
        
        try
        {
            ChannelsHelper.removeSocketChannel(m_Driver, ChannelsHelper.HOST_NAME, "4000", false);

            final Calendar beforeTime = Calendar.getInstance();
            //give time for mission to complete
            int timeToWaitSec = (int)((missionStopTime - System.currentTimeMillis()) / 1000 + 1);
            GeneralHelper.sleepWithText(timeToWaitSec, "Waiting for mission to complete");
            
            ChannelsHelper.createSocketChannel(m_Driver);
            
            //time when mission should be stopped
            final Calendar middleTime = Calendar.getInstance();
            NavigationHelper.navigateToPage(m_Driver, NavigationButtonNameConstants.NAVBUT_PROP_ASSETS);
            AssetHelper.chooseAssetTab(m_Driver, AssetTabConstants.OBSERVATION_TAB); 
            
            ObservationFilterHelper.clickRetrieveDeleteAccordionPanel(m_Driver, ExpandCollapse.EXPAND);
            
            ObservationFilterHelper.clickNumberCheckBoxAndEnterNumberOfObs(m_Driver, "2");
            ObservationFilterHelper.executeObservationRetrieval(m_Driver);
            ObservationFilterHelper.waitTillObsTableUpdates(m_Driver, 2, 10);
            
            ObservationFilterHelper.clickNumberFilterCheckBox(m_Driver);
            
            // mission runs for 15 seconds, new obs every 2 seconds, should be at least 5 of them
            ObservationFilterHelper.clickDateCheckBoxAndEnterDateRange(m_Driver, beforeTime, middleTime);
            ObservationFilterHelper.executeObservationRetrieval(m_Driver);
            ObservationFilterHelper.waitTillObsTableUpdatesWithAtLeast(m_Driver, 5, 15);
        }
        finally
        {
            try
            {
                NavigationHelper.navigateToPage(m_Driver, NavigationButtonNameConstants.NAVBUT_PROP_MISSIONS);
                MissionHelper.executeRemoveOnMission(m_Driver, "obs-time-mission");
                NavigationHelper.navigateToPage(m_Driver, NavigationButtonNameConstants.NAVBUT_PROP_ASSETS);
            }
            catch (Exception e)
            {
                LOG.log(Level.SEVERE, "Failed to clean up created mission", e);
            }
        }
    }
/**
     * Test the observation tab's retrieve by number and date simultaneously.
     * Verify that the correct number of observations are displayed when both the retrieve by number and date range are
     * selected.
     */
Test the observation tab's retrieve by number and date simultaneously.
Verify that the correct number of observations are displayed when both the retrieve by number and date range are
selected.
Test the observation tab ' s retrieve by number and date simultaneously . Verify that the correct number of observations are displayed when both the retrieve by number and date range are selected .
@Test
    public void testRetrieveByDateAndByNumber() throws InterruptedException, ExecutionException, TimeoutException
    {
        long missionStopTime = setupObsMission(15);
        try
        {
            ChannelsHelper.removeSocketChannel(m_Driver, ChannelsHelper.HOST_NAME, "4000", false);
            final Calendar beforeTime = Calendar.getInstance();
            int timeToWaitSec = (int)((missionStopTime - System.currentTimeMillis()) / 1000 + 1);
            GeneralHelper.sleepWithText(timeToWaitSec, "Waiting for mission to complete");
            ChannelsHelper.createSocketChannel(m_Driver);
            final Calendar middleTime = Calendar.getInstance();
            NavigationHelper.navigateToPage(m_Driver, NavigationButtonNameConstants.NAVBUT_PROP_ASSETS);
            AssetHelper.chooseAssetTab(m_Driver, AssetTabConstants.OBSERVATION_TAB); 
            ObservationFilterHelper.clickRetrieveDeleteAccordionPanel(m_Driver, ExpandCollapse.EXPAND);
            ObservationFilterHelper.clickNumberCheckBoxAndEnterNumberOfObs(m_Driver, "2");
            ObservationFilterHelper.executeObservationRetrieval(m_Driver);
            ObservationFilterHelper.waitTillObsTableUpdates(m_Driver, 2, 10);
            ObservationFilterHelper.clickNumberFilterCheckBox(m_Driver);
            ObservationFilterHelper.clickDateCheckBoxAndEnterDateRange(m_Driver, beforeTime, middleTime);
            ObservationFilterHelper.executeObservationRetrieval(m_Driver);
            ObservationFilterHelper.waitTillObsTableUpdatesWithAtLeast(m_Driver, 5, 15);
        }
        finally
        {
            try
            {
                NavigationHelper.navigateToPage(m_Driver, NavigationButtonNameConstants.NAVBUT_PROP_MISSIONS);
                MissionHelper.executeRemoveOnMission(m_Driver, "obs-time-mission");
                NavigationHelper.navigateToPage(m_Driver, NavigationButtonNameConstants.NAVBUT_PROP_ASSETS);
            }
            catch (Exception e)
            {
                LOG.log(Level.SEVERE, "Failed to clean up created mission", e);
            }
        }
    }
@ Test public void testRetrieveByDateAndByNumber ( ) throws InterruptedException , ExecutionException , TimeoutException { long missionStopTime = setupObsMission ( 15 ) ; try { ChannelsHelper . removeSocketChannel ( m_Driver , ChannelsHelper . HOST_NAME , "4000" , false ) ; final Calendar beforeTime = Calendar . getInstance ( ) ; int timeToWaitSec = ( int ) ( ( missionStopTime - System . currentTimeMillis ( ) ) / 1000 + 1 ) ; GeneralHelper . sleepWithText ( timeToWaitSec , "Waiting for mission to complete" ) ; ChannelsHelper . createSocketChannel ( m_Driver ) ; final Calendar middleTime = Calendar . getInstance ( ) ; NavigationHelper . navigateToPage ( m_Driver , NavigationButtonNameConstants . NAVBUT_PROP_ASSETS ) ; AssetHelper . chooseAssetTab ( m_Driver , AssetTabConstants . OBSERVATION_TAB ) ; ObservationFilterHelper . clickRetrieveDeleteAccordionPanel ( m_Driver , ExpandCollapse . EXPAND ) ; ObservationFilterHelper . clickNumberCheckBoxAndEnterNumberOfObs ( m_Driver , "2" ) ; ObservationFilterHelper . executeObservationRetrieval ( m_Driver ) ; ObservationFilterHelper . waitTillObsTableUpdates ( m_Driver , 2 , 10 ) ; ObservationFilterHelper . clickNumberFilterCheckBox ( m_Driver ) ; ObservationFilterHelper . clickDateCheckBoxAndEnterDateRange ( m_Driver , beforeTime , middleTime ) ; ObservationFilterHelper . executeObservationRetrieval ( m_Driver ) ; ObservationFilterHelper . waitTillObsTableUpdatesWithAtLeast ( m_Driver , 5 , 15 ) ; } finally { try { NavigationHelper . navigateToPage ( m_Driver , NavigationButtonNameConstants . NAVBUT_PROP_MISSIONS ) ; MissionHelper . executeRemoveOnMission ( m_Driver , "obs-time-mission" ) ; NavigationHelper . navigateToPage ( m_Driver , NavigationButtonNameConstants . NAVBUT_PROP_ASSETS ) ; } catch ( Exception e ) { LOG . log ( Level . SEVERE , "Failed to clean up created mission" , e ) ; } } }
Test the observation tab's retrieve by number and date simultaneously.
Test the observation tab ' s retrieve by number and date simultaneously .
//give time for mission to complete //time when mission should be stopped // mission runs for 15 seconds, new obs every 2 seconds, should be at least 5 of them