mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/utils/push/TestPushChannelMessageManager.java
@Test
    public void testPushMessage() throws InterruptedException
    {
        //activate the component.
        m_SUT.postConstruct();
        
        PushGrowlMessage msg = new PushGrowlMessage(FacesMessage.SEVERITY_INFO, "summary", "description", false);
        
        //push message
        m_SUT.addMessage(msg);
        
        PushEventMessage msg2 = new PushEventMessage("some event", new HashMap<String, Object>());
        msg2.setType(PushMessageType.EVENT);
        
        //push message
        m_SUT.addMessage(msg2);
        
        //verify that both messages were pushed
        ArgumentCaptor<PushDataMessage> captor = ArgumentCaptor.forClass(PushDataMessage.class);
        verify(m_PushContext, timeout(2000).times(2)).push(eq(PushChannelConstants.PUSH_CHANNEL_THOSE_MESSAGES), 
                captor.capture());
        
        assertThat(captor.getAllValues().size(), is(2));
        
        PushGrowlMessage rcvMsg = (PushGrowlMessage)captor.getAllValues().get(0);
        assertThat(rcvMsg, notNullValue());
        assertThat(rcvMsg.getSummary(), is("summary"));
        assertThat(rcvMsg.getDetail(), is("description"));
        assertThat(rcvMsg.getSticky(), is(false));
        assertThat(rcvMsg.getSeverity(), is("info"));
        
        PushEventMessage rcvEvent = (PushEventMessage)captor.getAllValues().get(1);
        assertThat(rcvEvent, notNullValue());
        assertThat(rcvEvent.getTopic(), is("some event"));
        assertThat(rcvEvent.getProperties().size(), is(0));
    }
/**
     * Tests pushing of a message.
     */
Tests pushing of a message.
Tests pushing of a message .
@Test
    public void testPushMessage() throws InterruptedException
    {
        m_SUT.postConstruct();
        PushGrowlMessage msg = new PushGrowlMessage(FacesMessage.SEVERITY_INFO, "summary", "description", false);
        m_SUT.addMessage(msg);
        PushEventMessage msg2 = new PushEventMessage("some event", new HashMap<String, Object>());
        msg2.setType(PushMessageType.EVENT);
        m_SUT.addMessage(msg2);
        ArgumentCaptor<PushDataMessage> captor = ArgumentCaptor.forClass(PushDataMessage.class);
        verify(m_PushContext, timeout(2000).times(2)).push(eq(PushChannelConstants.PUSH_CHANNEL_THOSE_MESSAGES), 
                captor.capture());
        assertThat(captor.getAllValues().size(), is(2));
        PushGrowlMessage rcvMsg = (PushGrowlMessage)captor.getAllValues().get(0);
        assertThat(rcvMsg, notNullValue());
        assertThat(rcvMsg.getSummary(), is("summary"));
        assertThat(rcvMsg.getDetail(), is("description"));
        assertThat(rcvMsg.getSticky(), is(false));
        assertThat(rcvMsg.getSeverity(), is("info"));
        PushEventMessage rcvEvent = (PushEventMessage)captor.getAllValues().get(1);
        assertThat(rcvEvent, notNullValue());
        assertThat(rcvEvent.getTopic(), is("some event"));
        assertThat(rcvEvent.getProperties().size(), is(0));
    }
@ Test public void testPushMessage ( ) throws InterruptedException { m_SUT . postConstruct ( ) ; PushGrowlMessage msg = new PushGrowlMessage ( FacesMessage . SEVERITY_INFO , "summary" , "description" , false ) ; m_SUT . addMessage ( msg ) ; PushEventMessage msg2 = new PushEventMessage ( "some event" , new HashMap < String , Object > ( ) ) ; msg2 . setType ( PushMessageType . EVENT ) ; m_SUT . addMessage ( msg2 ) ; ArgumentCaptor < PushDataMessage > captor = ArgumentCaptor . forClass ( PushDataMessage . class ) ; verify ( m_PushContext , timeout ( 2000 ) . times ( 2 ) ) . push ( eq ( PushChannelConstants . PUSH_CHANNEL_THOSE_MESSAGES ) , captor . capture ( ) ) ; assertThat ( captor . getAllValues ( ) . size ( ) , is ( 2 ) ) ; PushGrowlMessage rcvMsg = ( PushGrowlMessage ) captor . getAllValues ( ) . get ( 0 ) ; assertThat ( rcvMsg , notNullValue ( ) ) ; assertThat ( rcvMsg . getSummary ( ) , is ( "summary" ) ) ; assertThat ( rcvMsg . getDetail ( ) , is ( "description" ) ) ; assertThat ( rcvMsg . getSticky ( ) , is ( false ) ) ; assertThat ( rcvMsg . getSeverity ( ) , is ( "info" ) ) ; PushEventMessage rcvEvent = ( PushEventMessage ) captor . getAllValues ( ) . get ( 1 ) ; assertThat ( rcvEvent , notNullValue ( ) ) ; assertThat ( rcvEvent . getTopic ( ) , is ( "some event" ) ) ; assertThat ( rcvEvent . getProperties ( ) . size ( ) , is ( 0 ) ) ; }
Tests pushing of a message.
Tests pushing of a message .
//activate the component. //push message //push message //verify that both messages were pushed