mil.dod.th.ose.config/test/mil/dod/th/ose/config/loading/impl/TestRemoteEventLoaderImpl.java
@Test
    public void testEventConfigLoading()
    {
        m_SUT.process(createEventConfigs());
        
        //verify
        ArgumentCaptor<EventRegistrationRequestData> messageCap = 
                ArgumentCaptor.forClass(EventRegistrationRequestData.class);
        verify(m_RemoteEventAdmin).addRemoteEventRegistration(eq(1), messageCap.capture());
        verify(m_RemoteEventAdmin).addRemoteEventRegistration(eq(2), messageCap.capture());
        verify(m_RemoteEventAdmin).addRemoteEventRegistration(eq(3), messageCap.capture());
        verify(m_RemoteEventAdmin).addRemoteEventRegistration(eq(4), messageCap.capture());
        
        //verify each captured message
        for (EventRegistrationRequestData message : messageCap.getAllValues())
        {
            //messages were created such that the number of topics is the event configs order
            //config1 has one topic, config2, has two, see createEventConfigs method below
            int numberOfTopics = message.getTopicCount();
            switch (numberOfTopics)
            {
                case 1:
                    assertThat(message.getTopic(0), is(m_Top1));
                    assertThat(message.hasFilter(), is(false));
                    assertThat(message.getCanQueueEvent(), is(true));
                    assertThat(message.getObjectFormat(), is(RemoteTypesGen.LexiconFormat.Enum.XML));
                    assertThat(message.getExpirationTimeHours(), is(10));
                    break;
                case 2:
                    assertThat(message.getTopic(1), is(m_Top2));
                    assertThat(message.getFilter(), is(m_Filter1));
                    assertThat(message.getCanQueueEvent(), is(true));
                    assertThat(message.getObjectFormat(), is(RemoteTypesGen.LexiconFormat.Enum.NATIVE));
                    assertThat(message.getExpirationTimeHours(), is(20));
                    break;
                case 3:
                    assertThat(message.getTopic(2), is(m_Top3));
                    assertThat(message.hasFilter(), is(false));
                    assertThat(message.getCanQueueEvent(), is(false));
                    assertThat(message.getObjectFormat(), is(RemoteTypesGen.LexiconFormat.Enum.NATIVE));
                    assertThat(message.getExpirationTimeHours(), is(30));
                    break;
                case 4:
                    assertThat(message.getTopic(3), is(m_Top4));
                    assertThat(message.getFilter(), is(m_Filter2));
                    assertThat(message.getCanQueueEvent(), is(true));
                    assertThat(message.getObjectFormat(), is(RemoteTypesGen.LexiconFormat.Enum.UUID_ONLY));
                    assertThat(message.getExpirationTimeHours(), is(40));
                    break;
                default:
                    fail("unknown event config!");
            }
        }
    }
/**
     * Verify registering of event config items.
     * Verify proper messages are created and passed to the remote event service.
     */
Verify registering of event config items.
Verify proper messages are created and passed to the remote event service.
Verify registering of event config items . Verify proper messages are created and passed to the remote event service .
@Test
    public void testEventConfigLoading()
    {
        m_SUT.process(createEventConfigs());
        ArgumentCaptor<EventRegistrationRequestData> messageCap = 
                ArgumentCaptor.forClass(EventRegistrationRequestData.class);
        verify(m_RemoteEventAdmin).addRemoteEventRegistration(eq(1), messageCap.capture());
        verify(m_RemoteEventAdmin).addRemoteEventRegistration(eq(2), messageCap.capture());
        verify(m_RemoteEventAdmin).addRemoteEventRegistration(eq(3), messageCap.capture());
        verify(m_RemoteEventAdmin).addRemoteEventRegistration(eq(4), messageCap.capture());
         each captured message
        for (EventRegistrationRequestData message : messageCap.getAllValues())
        {
            int numberOfTopics = message.getTopicCount();
            switch (numberOfTopics)
            {
                case 1:
                    assertThat(message.getTopic(0), is(m_Top1));
                    assertThat(message.hasFilter(), is(false));
                    assertThat(message.getCanQueueEvent(), is(true));
                    assertThat(message.getObjectFormat(), is(RemoteTypesGen.LexiconFormat.Enum.XML));
                    assertThat(message.getExpirationTimeHours(), is(10));
                    break;
                case 2:
                    assertThat(message.getTopic(1), is(m_Top2));
                    assertThat(message.getFilter(), is(m_Filter1));
                    assertThat(message.getCanQueueEvent(), is(true));
                    assertThat(message.getObjectFormat(), is(RemoteTypesGen.LexiconFormat.Enum.NATIVE));
                    assertThat(message.getExpirationTimeHours(), is(20));
                    break;
                case 3:
                    assertThat(message.getTopic(2), is(m_Top3));
                    assertThat(message.hasFilter(), is(false));
                    assertThat(message.getCanQueueEvent(), is(false));
                    assertThat(message.getObjectFormat(), is(RemoteTypesGen.LexiconFormat.Enum.NATIVE));
                    assertThat(message.getExpirationTimeHours(), is(30));
                    break;
                case 4:
                    assertThat(message.getTopic(3), is(m_Top4));
                    assertThat(message.getFilter(), is(m_Filter2));
                    assertThat(message.getCanQueueEvent(), is(true));
                    assertThat(message.getObjectFormat(), is(RemoteTypesGen.LexiconFormat.Enum.UUID_ONLY));
                    assertThat(message.getExpirationTimeHours(), is(40));
                    break;
                default:
                    fail("unknown event config!");
            }
        }
    }
@ Test public void testEventConfigLoading ( ) { m_SUT . process ( createEventConfigs ( ) ) ; ArgumentCaptor < EventRegistrationRequestData > messageCap = ArgumentCaptor . forClass ( EventRegistrationRequestData . class ) ; verify ( m_RemoteEventAdmin ) . addRemoteEventRegistration ( eq ( 1 ) , messageCap . capture ( ) ) ; verify ( m_RemoteEventAdmin ) . addRemoteEventRegistration ( eq ( 2 ) , messageCap . capture ( ) ) ; verify ( m_RemoteEventAdmin ) . addRemoteEventRegistration ( eq ( 3 ) , messageCap . capture ( ) ) ; verify ( m_RemoteEventAdmin ) . addRemoteEventRegistration ( eq ( 4 ) , messageCap . capture ( ) ) ; for ( EventRegistrationRequestData message : messageCap . getAllValues ( ) ) { int numberOfTopics = message . getTopicCount ( ) ; switch ( numberOfTopics ) { case 1 : assertThat ( message . getTopic ( 0 ) , is ( m_Top1 ) ) ; assertThat ( message . hasFilter ( ) , is ( false ) ) ; assertThat ( message . getCanQueueEvent ( ) , is ( true ) ) ; assertThat ( message . getObjectFormat ( ) , is ( RemoteTypesGen . LexiconFormat . Enum . XML ) ) ; assertThat ( message . getExpirationTimeHours ( ) , is ( 10 ) ) ; break ; case 2 : assertThat ( message . getTopic ( 1 ) , is ( m_Top2 ) ) ; assertThat ( message . getFilter ( ) , is ( m_Filter1 ) ) ; assertThat ( message . getCanQueueEvent ( ) , is ( true ) ) ; assertThat ( message . getObjectFormat ( ) , is ( RemoteTypesGen . LexiconFormat . Enum . NATIVE ) ) ; assertThat ( message . getExpirationTimeHours ( ) , is ( 20 ) ) ; break ; case 3 : assertThat ( message . getTopic ( 2 ) , is ( m_Top3 ) ) ; assertThat ( message . hasFilter ( ) , is ( false ) ) ; assertThat ( message . getCanQueueEvent ( ) , is ( false ) ) ; assertThat ( message . getObjectFormat ( ) , is ( RemoteTypesGen . LexiconFormat . Enum . NATIVE ) ) ; assertThat ( message . getExpirationTimeHours ( ) , is ( 30 ) ) ; break ; case 4 : assertThat ( message . getTopic ( 3 ) , is ( m_Top4 ) ) ; assertThat ( message . getFilter ( ) , is ( m_Filter2 ) ) ; assertThat ( message . getCanQueueEvent ( ) , is ( true ) ) ; assertThat ( message . getObjectFormat ( ) , is ( RemoteTypesGen . LexiconFormat . Enum . UUID_ONLY ) ) ; assertThat ( message . getExpirationTimeHours ( ) , is ( 40 ) ) ; break ; default : fail ( "unknown event config!" ) ; } } }
Verify registering of event config items.
Verify registering of event config items .
//verify //verify each captured message //messages were created such that the number of topics is the event configs order //config1 has one topic, config2, has two, see createEventConfigs method below