mil.dod.th.ose.test/src/mil/dod/th/ose/test/EventAdminVerifier.java
public static void assertEventByTopicAsset(EventAdmin eventAdmin, String topic, Asset asset)
    {
        ArgumentCaptor<Event> eventCaptor = ArgumentCaptor.forClass(Event.class);
        verify(eventAdmin, atLeastOnce()).postEvent(eventCaptor.capture());
        
        String topicStr = "";
        
        for (Event event : eventCaptor.getAllValues())
        {
            if (event.getTopic().equals(topic))
            {
                if (event.getProperty(FactoryDescriptor.EVENT_PROP_OBJ).equals(asset))
                {
                    assertThat((String)event.getProperty(FactoryDescriptor.EVENT_PROP_OBJ_NAME), 
                            is(asset.getName()));
                    assertThat((String)event.getProperty(FactoryDescriptor.EVENT_PROP_OBJ_TYPE), 
                            is(asset.getFactory().getProductType()));
                    assertThat((String)event.getProperty(FactoryDescriptor.EVENT_PROP_OBJ_UUID), 
                            is(asset.getUuid().toString()));
                    assertThat((String)event.getProperty(FactoryDescriptor.EVENT_PROP_OBJ_PID), 
                            is(asset.getPid()));
                    return;
                }
            }
            
            topicStr += event.getTopic() + ": " + event.getProperty(FactoryDescriptor.EVENT_PROP_OBJ) + "\n"; 
        }
        
        fail("Topic [" + topic + "] not found for asset: " + asset + "\n" + topicStr);
    }
/**
     * Create a map where the key is the topic and the value are the event properties.  This can be used to assert 
     * equality and verify event was posted.
     */
Create a map where the key is the topic and the value are the event properties.  This can be used to assert
equality and verify event was posted.
Create a map where the key is the topic and the value are the event properties . This can be used to assert equality and verify event was posted .
public static void assertEventByTopicAsset(EventAdmin eventAdmin, String topic, Asset asset)
    {
        ArgumentCaptor<Event> eventCaptor = ArgumentCaptor.forClass(Event.class);
        verify(eventAdmin, atLeastOnce()).postEvent(eventCaptor.capture());
        String topicStr = "";
        for (Event event : eventCaptor.getAllValues())
        {
            if (event.getTopic().equals(topic))
            {
                if (event.getProperty(FactoryDescriptor.EVENT_PROP_OBJ).equals(asset))
                {
                    assertThat((String)event.getProperty(FactoryDescriptor.EVENT_PROP_OBJ_NAME), 
                            is(asset.getName()));
                    assertThat((String)event.getProperty(FactoryDescriptor.EVENT_PROP_OBJ_TYPE), 
                            is(asset.getFactory().getProductType()));
                    assertThat((String)event.getProperty(FactoryDescriptor.EVENT_PROP_OBJ_UUID), 
                            is(asset.getUuid().toString()));
                    assertThat((String)event.getProperty(FactoryDescriptor.EVENT_PROP_OBJ_PID), 
                            is(asset.getPid()));
                    return;
                }
            }
            topicStr += event.getTopic() + ": " + event.getProperty(FactoryDescriptor.EVENT_PROP_OBJ) + "\n"; 
        }
        fail("Topic [" + topic + "] not found for asset: " + asset + "\n" + topicStr);
    }
public static void assertEventByTopicAsset ( EventAdmin eventAdmin , String topic , Asset asset ) { ArgumentCaptor < Event > eventCaptor = ArgumentCaptor . forClass ( Event . class ) ; verify ( eventAdmin , atLeastOnce ( ) ) . postEvent ( eventCaptor . capture ( ) ) ; String topicStr = "" ; for ( Event event : eventCaptor . getAllValues ( ) ) { if ( event . getTopic ( ) . equals ( topic ) ) { if ( event . getProperty ( FactoryDescriptor . EVENT_PROP_OBJ ) . equals ( asset ) ) { assertThat ( ( String ) event . getProperty ( FactoryDescriptor . EVENT_PROP_OBJ_NAME ) , is ( asset . getName ( ) ) ) ; assertThat ( ( String ) event . getProperty ( FactoryDescriptor . EVENT_PROP_OBJ_TYPE ) , is ( asset . getFactory ( ) . getProductType ( ) ) ) ; assertThat ( ( String ) event . getProperty ( FactoryDescriptor . EVENT_PROP_OBJ_UUID ) , is ( asset . getUuid ( ) . toString ( ) ) ) ; assertThat ( ( String ) event . getProperty ( FactoryDescriptor . EVENT_PROP_OBJ_PID ) , is ( asset . getPid ( ) ) ) ; return ; } } topicStr += event . getTopic ( ) + ": " + event . getProperty ( FactoryDescriptor . EVENT_PROP_OBJ ) + "\n" ; } fail ( "Topic [" + topic + "] not found for asset: " + asset + "\n" + topicStr ) ; }
Create a map where the key is the topic and the value are the event properties.
Create a map where the key is the topic and the value are the event properties .