mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/asset/TestAssetMgrImpl.java
@Test
    public void testResponseHandler()
    {
        RemoteEventRegistrationHandler handler = new RemoteEventRegistrationHandler(m_MessageFactory);
        
        //response messages to process
        EventRegistrationResponseData response1 = EventRegistrationResponseData.newBuilder().
            setId(1).build();
        EventRegistrationResponseData response2 = EventRegistrationResponseData.newBuilder().
            setId(2).build();

        EventAdminNamespace nameResponse1 = EventAdminNamespace.newBuilder().
            setData(response1.toByteString()).
            setType(EventAdminMessageType.EventRegistrationResponse).build();
        EventAdminNamespace nameResponse2 = EventAdminNamespace.newBuilder().
            setData(response2.toByteString()).
            setType(EventAdminMessageType.EventRegistrationResponse).build();

        TerraHarvestPayload payload1 = TerraHarvestPayload.newBuilder().setNamespace(Namespace.EventAdmin).
            setNamespaceMessage(response1.toByteString()).build();
        TerraHarvestPayload payload2 = TerraHarvestPayload.newBuilder().setNamespace(Namespace.EventAdmin).
                setNamespaceMessage(response2.toByteString()).build();    
            
        TerraHarvestMessage thMessage1 = TerraHarvestMessageHelper.createTerraHarvestMessage(systemId1, 0,
            Namespace.EventAdmin, 123, nameResponse1);

        TerraHarvestMessage thMessage2 = TerraHarvestMessageHelper.createTerraHarvestMessage(systemId2, 0, 
            Namespace.EventAdmin, 321, nameResponse2);
        
        //this will load the registration ids into the response handler
        handler.handleResponse(thMessage1, payload1, nameResponse1, response1);
        handler.handleResponse(thMessage2, payload2, nameResponse2, response2);
        
        //verify that handler will send unregister requests
        handler.unregisterRegistrations();
        verify(m_MessageFactory, times(2)).createEventAdminMessage(eq(EventAdminMessageType.UnregisterEventRequest),
            Mockito.any(Message.class));
        verify(m_MessageWrapper).queue(eq(systemId1), (ResponseHandler) eq(null));
        verify(m_MessageWrapper).queue(eq(systemId2), (ResponseHandler) eq(null));
    }
/**
     * Test the handling of remote response handler.
     * Verify the handler send unreg requests.
     */
Test the handling of remote response handler.
Verify the handler send unreg requests.
Test the handling of remote response handler . Verify the handler send unreg requests .
@Test
    public void testResponseHandler()
    {
        RemoteEventRegistrationHandler handler = new RemoteEventRegistrationHandler(m_MessageFactory);
        EventRegistrationResponseData response1 = EventRegistrationResponseData.newBuilder().
            setId(1).build();
        EventRegistrationResponseData response2 = EventRegistrationResponseData.newBuilder().
            setId(2).build();
        EventAdminNamespace nameResponse1 = EventAdminNamespace.newBuilder().
            setData(response1.toByteString()).
            setType(EventAdminMessageType.EventRegistrationResponse).build();
        EventAdminNamespace nameResponse2 = EventAdminNamespace.newBuilder().
            setData(response2.toByteString()).
            setType(EventAdminMessageType.EventRegistrationResponse).build();
        TerraHarvestPayload payload1 = TerraHarvestPayload.newBuilder().setNamespace(Namespace.EventAdmin).
            setNamespaceMessage(response1.toByteString()).build();
        TerraHarvestPayload payload2 = TerraHarvestPayload.newBuilder().setNamespace(Namespace.EventAdmin).
                setNamespaceMessage(response2.toByteString()).build();    
        TerraHarvestMessage thMessage1 = TerraHarvestMessageHelper.createTerraHarvestMessage(systemId1, 0,
            Namespace.EventAdmin, 123, nameResponse1);
        TerraHarvestMessage thMessage2 = TerraHarvestMessageHelper.createTerraHarvestMessage(systemId2, 0, 
            Namespace.EventAdmin, 321, nameResponse2);
        handler.handleResponse(thMessage1, payload1, nameResponse1, response1);
        handler.handleResponse(thMessage2, payload2, nameResponse2, response2);
        handler.unregisterRegistrations();
        verify(m_MessageFactory, times(2)).createEventAdminMessage(eq(EventAdminMessageType.UnregisterEventRequest),
            Mockito.any(Message.class));
        verify(m_MessageWrapper).queue(eq(systemId1), (ResponseHandler) eq(null));
        verify(m_MessageWrapper).queue(eq(systemId2), (ResponseHandler) eq(null));
    }
@ Test public void testResponseHandler ( ) { RemoteEventRegistrationHandler handler = new RemoteEventRegistrationHandler ( m_MessageFactory ) ; EventRegistrationResponseData response1 = EventRegistrationResponseData . newBuilder ( ) . setId ( 1 ) . build ( ) ; EventRegistrationResponseData response2 = EventRegistrationResponseData . newBuilder ( ) . setId ( 2 ) . build ( ) ; EventAdminNamespace nameResponse1 = EventAdminNamespace . newBuilder ( ) . setData ( response1 . toByteString ( ) ) . setType ( EventAdminMessageType . EventRegistrationResponse ) . build ( ) ; EventAdminNamespace nameResponse2 = EventAdminNamespace . newBuilder ( ) . setData ( response2 . toByteString ( ) ) . setType ( EventAdminMessageType . EventRegistrationResponse ) . build ( ) ; TerraHarvestPayload payload1 = TerraHarvestPayload . newBuilder ( ) . setNamespace ( Namespace . EventAdmin ) . setNamespaceMessage ( response1 . toByteString ( ) ) . build ( ) ; TerraHarvestPayload payload2 = TerraHarvestPayload . newBuilder ( ) . setNamespace ( Namespace . EventAdmin ) . setNamespaceMessage ( response2 . toByteString ( ) ) . build ( ) ; TerraHarvestMessage thMessage1 = TerraHarvestMessageHelper . createTerraHarvestMessage ( systemId1 , 0 , Namespace . EventAdmin , 123 , nameResponse1 ) ; TerraHarvestMessage thMessage2 = TerraHarvestMessageHelper . createTerraHarvestMessage ( systemId2 , 0 , Namespace . EventAdmin , 321 , nameResponse2 ) ; handler . handleResponse ( thMessage1 , payload1 , nameResponse1 , response1 ) ; handler . handleResponse ( thMessage2 , payload2 , nameResponse2 , response2 ) ; handler . unregisterRegistrations ( ) ; verify ( m_MessageFactory , times ( 2 ) ) . createEventAdminMessage ( eq ( EventAdminMessageType . UnregisterEventRequest ) , Mockito . any ( Message . class ) ) ; verify ( m_MessageWrapper ) . queue ( eq ( systemId1 ) , ( ResponseHandler ) eq ( null ) ) ; verify ( m_MessageWrapper ) . queue ( eq ( systemId2 ) , ( ResponseHandler ) eq ( null ) ) ; }
Test the handling of remote response handler.
Test the handling of remote response handler .
//response messages to process //this will load the registration ids into the response handler //verify that handler will send unregister requests