mil.dod.th.ose.datastream/test/mil/dod/th/ose/datastream/TestDataStreamServiceImpl.java
@SuppressWarnings({"unchecked"})
    @Test
    public void testCreateStreamProfile() throws StreamProfileException, FactoryException, 
        FactoryObjectInformationException, 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);
        
        StreamProfileInternal mockStreamProfile = mock(StreamProfileInternal.class);
        when(m_Registry.createNewObject(eq(m_StreamProfileFactory), Mockito.any(String.class),
                Mockito.any(Map.class))).thenReturn(mockStreamProfile);
        
        StreamProfile streamProfile = m_SUT.createStreamProfile(PRODUCT_TYPE, m_ProductName, 
                new HashMap<String, Object>());
        assertThat(streamProfile, is(notNullValue()));
        
        verify(m_Registry).createNewObject(m_StreamProfileFactory, m_ProductName, new HashMap<String, Object>());
        verify(m_WakeLock).activate();
        verify(m_WakeLock).cancel();
        
        Set<StreamProfile> profileSet = new HashSet<>();
        profileSet.add(streamProfile);
        when(m_SUT.getStreamProfiles()).thenReturn(profileSet);        
        
        //create second stream profile
        StreamProfileInternal mockStreamProfile2 = mock(StreamProfileInternal.class);
        when(m_Registry.createNewObject(eq(m_StreamProfileFactory), Mockito.any(String.class),
                Mockito.any(Map.class))).thenReturn(mockStreamProfile2);
        
        StreamProfile streamProfile2 = m_SUT.createStreamProfile(PRODUCT_TYPE, "StreamProfileProxy2", 
                new HashMap<String, Object>());
        assertThat(streamProfile2, is(notNullValue()));
        
        verify(m_Registry).createNewObject(m_StreamProfileFactory, "StreamProfileProxy2", 
                new HashMap<String, Object>());
        verify(m_WakeLock, times(2)).activate();
        verify(m_WakeLock, times(2)).cancel();
    }
/**
    * Verify that stream profile is created and dictionary passed in is correct.
    */
Verify that stream profile is created and dictionary passed in is correct.
Verify that stream profile is created and dictionary passed in is correct .
@SuppressWarnings({"unchecked"})
    @Test
    public void testCreateStreamProfile() throws StreamProfileException, FactoryException, 
        FactoryObjectInformationException, 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);
        StreamProfileInternal mockStreamProfile = mock(StreamProfileInternal.class);
        when(m_Registry.createNewObject(eq(m_StreamProfileFactory), Mockito.any(String.class),
                Mockito.any(Map.class))).thenReturn(mockStreamProfile);
        StreamProfile streamProfile = m_SUT.createStreamProfile(PRODUCT_TYPE, m_ProductName, 
                new HashMap<String, Object>());
        assertThat(streamProfile, is(notNullValue()));
        verify(m_Registry).createNewObject(m_StreamProfileFactory, m_ProductName, new HashMap<String, Object>());
        verify(m_WakeLock).activate();
        verify(m_WakeLock).cancel();
        Set<StreamProfile> profileSet = new HashSet<>();
        profileSet.add(streamProfile);
        when(m_SUT.getStreamProfiles()).thenReturn(profileSet);        
        StreamProfileInternal mockStreamProfile2 = mock(StreamProfileInternal.class);
        when(m_Registry.createNewObject(eq(m_StreamProfileFactory), Mockito.any(String.class),
                Mockito.any(Map.class))).thenReturn(mockStreamProfile2);
        StreamProfile streamProfile2 = m_SUT.createStreamProfile(PRODUCT_TYPE, "StreamProfileProxy2", 
                new HashMap<String, Object>());
        assertThat(streamProfile2, is(notNullValue()));
        verify(m_Registry).createNewObject(m_StreamProfileFactory, "StreamProfileProxy2", 
                new HashMap<String, Object>());
        verify(m_WakeLock, times(2)).activate();
        verify(m_WakeLock, times(2)).cancel();
    }
@ SuppressWarnings ( { "unchecked" } ) @ Test public void testCreateStreamProfile ( ) throws StreamProfileException , FactoryException , FactoryObjectInformationException , 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 ) ; StreamProfileInternal mockStreamProfile = mock ( StreamProfileInternal . class ) ; when ( m_Registry . createNewObject ( eq ( m_StreamProfileFactory ) , Mockito . any ( String . class ) , Mockito . any ( Map . class ) ) ) . thenReturn ( mockStreamProfile ) ; StreamProfile streamProfile = m_SUT . createStreamProfile ( PRODUCT_TYPE , m_ProductName , new HashMap < String , Object > ( ) ) ; assertThat ( streamProfile , is ( notNullValue ( ) ) ) ; verify ( m_Registry ) . createNewObject ( m_StreamProfileFactory , m_ProductName , new HashMap < String , Object > ( ) ) ; verify ( m_WakeLock ) . activate ( ) ; verify ( m_WakeLock ) . cancel ( ) ; Set < StreamProfile > profileSet = new HashSet < > ( ) ; profileSet . add ( streamProfile ) ; when ( m_SUT . getStreamProfiles ( ) ) . thenReturn ( profileSet ) ; StreamProfileInternal mockStreamProfile2 = mock ( StreamProfileInternal . class ) ; when ( m_Registry . createNewObject ( eq ( m_StreamProfileFactory ) , Mockito . any ( String . class ) , Mockito . any ( Map . class ) ) ) . thenReturn ( mockStreamProfile2 ) ; StreamProfile streamProfile2 = m_SUT . createStreamProfile ( PRODUCT_TYPE , "StreamProfileProxy2" , new HashMap < String , Object > ( ) ) ; assertThat ( streamProfile2 , is ( notNullValue ( ) ) ) ; verify ( m_Registry ) . createNewObject ( m_StreamProfileFactory , "StreamProfileProxy2" , new HashMap < String , Object > ( ) ) ; verify ( m_WakeLock , times ( 2 ) ) . activate ( ) ; verify ( m_WakeLock , times ( 2 ) ) . cancel ( ) ; }
Verify that stream profile is created and dictionary passed in is correct.
Verify that stream profile is created and dictionary passed in is correct .
//create second stream profile