mil.dod.th.ose.datastream/test/mil/dod/th/ose/datastream/TestDataStreamServiceImpl.java
@Test
    public void testGetStreamProfilesByAsset() throws InvalidSyntaxException
    {
        Map<String, Object> props = new HashMap<String, Object>();
        props.put(DataStreamServiceConfig.CONFIG_PROP_MULTICAST_HOST, "225.1.2.3");
        props.put(DataStreamServiceConfig.CONFIG_PROP_START_PORT, 5004);
        
        m_SUT.activate(Collections.unmodifiableMap(props), m_BundleContext);
        
        final String assetName1 = "TestAsset1";
        final String assetName2 = "TestAsset2";
        
        StreamProfileInternal internal1 = mock(StreamProfileInternal.class);
        StreamProfileInternal internal2 = mock(StreamProfileInternal.class);
        StreamProfileInternal internal3 = mock(StreamProfileInternal.class);
        StreamProfileInternal internal4 = mock(StreamProfileInternal.class);
        StreamProfileInternal internal5 = mock(StreamProfileInternal.class);
        
        Asset asset1 = mock(Asset.class);
        Asset asset2 = mock(Asset.class);
        when(asset1.getName()).thenReturn(assetName1);
        when(asset2.getName()).thenReturn(assetName2);
        
        when(internal1.getAsset()).thenReturn(asset1);
        when(internal2.getAsset()).thenReturn(asset1);
        when(internal3.getAsset()).thenReturn(asset2);
        when(internal4.getAsset()).thenReturn(asset2);
        when(internal5.getAsset()).thenReturn(asset2);
        
        Set<StreamProfileInternal> set = new HashSet<StreamProfileInternal>();
        set.add(internal1);
        set.add(internal2);
        set.add(internal3);
        set.add(internal4);
        set.add(internal5);
        when(m_Registry.getObjects()).thenReturn(set);
        
        Set<StreamProfile> streamProfileSet1 = m_SUT.getStreamProfiles(asset1);
        assertThat(streamProfileSet1.size(), is(2));
        
        Set<StreamProfile> streamProfileSet2 = m_SUT.getStreamProfiles(asset2);
        assertThat(streamProfileSet2.size(), is(3));            
    }
/**
     * Verify the correct stream profiles are returned when requesting all stream profiles associated
     * with a particular asset.
     */
Verify the correct stream profiles are returned when requesting all stream profiles associated
with a particular asset.
Verify the correct stream profiles are returned when requesting all stream profiles associated with a particular asset .
@Test
    public void testGetStreamProfilesByAsset() throws InvalidSyntaxException
    {
        Map<String, Object> props = new HashMap<String, Object>();
        props.put(DataStreamServiceConfig.CONFIG_PROP_MULTICAST_HOST, "225.1.2.3");
        props.put(DataStreamServiceConfig.CONFIG_PROP_START_PORT, 5004);
        m_SUT.activate(Collections.unmodifiableMap(props), m_BundleContext);
        final String assetName1 = "TestAsset1";
        final String assetName2 = "TestAsset2";
        StreamProfileInternal internal1 = mock(StreamProfileInternal.class);
        StreamProfileInternal internal2 = mock(StreamProfileInternal.class);
        StreamProfileInternal internal3 = mock(StreamProfileInternal.class);
        StreamProfileInternal internal4 = mock(StreamProfileInternal.class);
        StreamProfileInternal internal5 = mock(StreamProfileInternal.class);
        Asset asset1 = mock(Asset.class);
        Asset asset2 = mock(Asset.class);
        when(asset1.getName()).thenReturn(assetName1);
        when(asset2.getName()).thenReturn(assetName2);
        when(internal1.getAsset()).thenReturn(asset1);
        when(internal2.getAsset()).thenReturn(asset1);
        when(internal3.getAsset()).thenReturn(asset2);
        when(internal4.getAsset()).thenReturn(asset2);
        when(internal5.getAsset()).thenReturn(asset2);
        Set<StreamProfileInternal> set = new HashSet<StreamProfileInternal>();
        set.add(internal1);
        set.add(internal2);
        set.add(internal3);
        set.add(internal4);
        set.add(internal5);
        when(m_Registry.getObjects()).thenReturn(set);
        Set<StreamProfile> streamProfileSet1 = m_SUT.getStreamProfiles(asset1);
        assertThat(streamProfileSet1.size(), is(2));
        Set<StreamProfile> streamProfileSet2 = m_SUT.getStreamProfiles(asset2);
        assertThat(streamProfileSet2.size(), is(3));            
    }
@ Test public void testGetStreamProfilesByAsset ( ) throws InvalidSyntaxException { Map < String , Object > props = new HashMap < String , Object > ( ) ; props . put ( DataStreamServiceConfig . CONFIG_PROP_MULTICAST_HOST , "225.1.2.3" ) ; props . put ( DataStreamServiceConfig . CONFIG_PROP_START_PORT , 5004 ) ; m_SUT . activate ( Collections . unmodifiableMap ( props ) , m_BundleContext ) ; final String assetName1 = "TestAsset1" ; final String assetName2 = "TestAsset2" ; StreamProfileInternal internal1 = mock ( StreamProfileInternal . class ) ; StreamProfileInternal internal2 = mock ( StreamProfileInternal . class ) ; StreamProfileInternal internal3 = mock ( StreamProfileInternal . class ) ; StreamProfileInternal internal4 = mock ( StreamProfileInternal . class ) ; StreamProfileInternal internal5 = mock ( StreamProfileInternal . class ) ; Asset asset1 = mock ( Asset . class ) ; Asset asset2 = mock ( Asset . class ) ; when ( asset1 . getName ( ) ) . thenReturn ( assetName1 ) ; when ( asset2 . getName ( ) ) . thenReturn ( assetName2 ) ; when ( internal1 . getAsset ( ) ) . thenReturn ( asset1 ) ; when ( internal2 . getAsset ( ) ) . thenReturn ( asset1 ) ; when ( internal3 . getAsset ( ) ) . thenReturn ( asset2 ) ; when ( internal4 . getAsset ( ) ) . thenReturn ( asset2 ) ; when ( internal5 . getAsset ( ) ) . thenReturn ( asset2 ) ; Set < StreamProfileInternal > set = new HashSet < StreamProfileInternal > ( ) ; set . add ( internal1 ) ; set . add ( internal2 ) ; set . add ( internal3 ) ; set . add ( internal4 ) ; set . add ( internal5 ) ; when ( m_Registry . getObjects ( ) ) . thenReturn ( set ) ; Set < StreamProfile > streamProfileSet1 = m_SUT . getStreamProfiles ( asset1 ) ; assertThat ( streamProfileSet1 . size ( ) , is ( 2 ) ) ; Set < StreamProfile > streamProfileSet2 = m_SUT . getStreamProfiles ( asset2 ) ; assertThat ( streamProfileSet2 . size ( ) , is ( 3 ) ) ; }
Verify the correct stream profiles are returned when requesting all stream profiles associated
 with a particular asset.
Verify the correct stream profiles are returned when requesting all stream profiles associated with a particular asset .