mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/observation/TestObservationMessageService.java
private ObservationQuery mockObservationQuery(UUID assetUuid, String type, ObservationSubTypeEnum subtype,  
            Date start, Date stop, Date observedStart, Date observedStop, Integer maxObs)
    {
        ObservationQuery query = mock(ObservationQuery.class);
        
        when(m_ObservationStore.newQuery()).thenReturn(query);
        
        if (uuid != null)
        {
            when(query.withAssetUuid(assetUuid)).thenReturn(query);
        }
        
        if (type != null)
        {
            when(query.withAssetType(type)).thenReturn(query);
        }
        
        if (subtype != null)
        {
            when(query.withSubType(subtype)).thenReturn(query);
        }
        
        if (start != null && stop != null)
        {
            when(query.withTimeCreatedRange(start, stop)).thenReturn(query);
        }

        if (observedStart != null && observedStop != null)
        {
            when(query.withTimeObservedRange(observedStart, observedStop)).thenReturn(query);
        }
        
        if (maxObs != null)
        {
            when(query.withMaxObservations(maxObs)).thenReturn(query);
        }
        
        return query;
    }
/**
     * Mocks an ObservationQuery based on the inputs given. 
     * uuid of the asset; null if it is not to be set
     * @param type
     *  the type of the asset; null if it is not to be set
     * @param start
     *  the start date object for a time range; null if not to be set
     * @param stop
     *  the stop date object for a time range; null if not to be set
     * @param observedStart
     *  the start date object for the observed time range; null if not to be set
     * @param observedStop
     *  the stop date object for the observed time range; null if not to be set
     * @param maxObs
     *  the max number of observations; null if not to be set
     * @return
     *  the observation query
     */
Mocks an ObservationQuery based on the inputs given.
Mocks an ObservationQuery based on the inputs given .
private ObservationQuery mockObservationQuery(UUID assetUuid, String type, ObservationSubTypeEnum subtype,  
            Date start, Date stop, Date observedStart, Date observedStop, Integer maxObs)
    {
        ObservationQuery query = mock(ObservationQuery.class);
        when(m_ObservationStore.newQuery()).thenReturn(query);
        if (uuid != null)
        {
            when(query.withAssetUuid(assetUuid)).thenReturn(query);
        }
        if (type != null)
        {
            when(query.withAssetType(type)).thenReturn(query);
        }
        if (subtype != null)
        {
            when(query.withSubType(subtype)).thenReturn(query);
        }
        if (start != null && stop != null)
        {
            when(query.withTimeCreatedRange(start, stop)).thenReturn(query);
        }
        if (observedStart != null && observedStop != null)
        {
            when(query.withTimeObservedRange(observedStart, observedStop)).thenReturn(query);
        }
        if (maxObs != null)
        {
            when(query.withMaxObservations(maxObs)).thenReturn(query);
        }
        return query;
    }
private ObservationQuery mockObservationQuery ( UUID assetUuid , String type , ObservationSubTypeEnum subtype , Date start , Date stop , Date observedStart , Date observedStop , Integer maxObs ) { ObservationQuery query = mock ( ObservationQuery . class ) ; when ( m_ObservationStore . newQuery ( ) ) . thenReturn ( query ) ; if ( uuid != null ) { when ( query . withAssetUuid ( assetUuid ) ) . thenReturn ( query ) ; } if ( type != null ) { when ( query . withAssetType ( type ) ) . thenReturn ( query ) ; } if ( subtype != null ) { when ( query . withSubType ( subtype ) ) . thenReturn ( query ) ; } if ( start != null && stop != null ) { when ( query . withTimeCreatedRange ( start , stop ) ) . thenReturn ( query ) ; } if ( observedStart != null && observedStop != null ) { when ( query . withTimeObservedRange ( observedStart , observedStop ) ) . thenReturn ( query ) ; } if ( maxObs != null ) { when ( query . withMaxObservations ( maxObs ) ) . thenReturn ( query ) ; } return query ; }
Mocks an ObservationQuery based on the inputs given.
Mocks an ObservationQuery based on the inputs given .