mil.dod.th.ose.config/test/mil/dod/th/ose/config/loading/impl/TestStreamProfileTrackerCustomizer.java
@SuppressWarnings("unchecked")
    @Test
    public void testAddingServiceMissing() throws StreamProfileException
    {
        FactoryObjectConfig objectConfig = new FactoryObjectConfig()
            .withFactoryType(FactoryTypeEnum.STREAM_PROFILE)
            .withProperties(m_Properties)
            .withProductType(TEST_PID)
            .withCreatePolicy(CreatePolicyEnum.FIRST_RUN)
            .withName("StreamProfile1");
        
        when(m_DataStreamService.getStreamProfiles()).thenReturn(new HashSet<StreamProfile>());
        when(m_DataStreamService.createStreamProfile(eq(TEST_PID), eq("StreamProfile1"), 
                any(Map.class))).thenReturn(m_StreamProfile);
        
        StreamProfileTrackerCustomizer sut = new StreamProfileTrackerCustomizer(objectConfig,
                m_DataStreamService, m_Log, m_EventAdmin);
        
        sut.addingService(m_ServiceReference);
        
        verify(m_DataStreamService, times(1)).createStreamProfile(eq(TEST_PID), 
                eq("StreamProfile1"), eq(m_ExpectedProps));
    }
/**
     * Test adding a StreamProfile that doesn't exist yet.
     */
Test adding a StreamProfile that doesn't exist yet.
Test adding a StreamProfile that doesn ' t exist yet .
@SuppressWarnings("unchecked")
    @Test
    public void testAddingServiceMissing() throws StreamProfileException
    {
        FactoryObjectConfig objectConfig = new FactoryObjectConfig()
            .withFactoryType(FactoryTypeEnum.STREAM_PROFILE)
            .withProperties(m_Properties)
            .withProductType(TEST_PID)
            .withCreatePolicy(CreatePolicyEnum.FIRST_RUN)
            .withName("StreamProfile1");
        when(m_DataStreamService.getStreamProfiles()).thenReturn(new HashSet<StreamProfile>());
        when(m_DataStreamService.createStreamProfile(eq(TEST_PID), eq("StreamProfile1"), 
                any(Map.class))).thenReturn(m_StreamProfile);
        StreamProfileTrackerCustomizer sut = new StreamProfileTrackerCustomizer(objectConfig,
                m_DataStreamService, m_Log, m_EventAdmin);
        sut.addingService(m_ServiceReference);
        verify(m_DataStreamService, times(1)).createStreamProfile(eq(TEST_PID), 
                eq("StreamProfile1"), eq(m_ExpectedProps));
    }
@ SuppressWarnings ( "unchecked" ) @ Test public void testAddingServiceMissing ( ) throws StreamProfileException { FactoryObjectConfig objectConfig = new FactoryObjectConfig ( ) . withFactoryType ( FactoryTypeEnum . STREAM_PROFILE ) . withProperties ( m_Properties ) . withProductType ( TEST_PID ) . withCreatePolicy ( CreatePolicyEnum . FIRST_RUN ) . withName ( "StreamProfile1" ) ; when ( m_DataStreamService . getStreamProfiles ( ) ) . thenReturn ( new HashSet < StreamProfile > ( ) ) ; when ( m_DataStreamService . createStreamProfile ( eq ( TEST_PID ) , eq ( "StreamProfile1" ) , any ( Map . class ) ) ) . thenReturn ( m_StreamProfile ) ; StreamProfileTrackerCustomizer sut = new StreamProfileTrackerCustomizer ( objectConfig , m_DataStreamService , m_Log , m_EventAdmin ) ; sut . addingService ( m_ServiceReference ) ; verify ( m_DataStreamService , times ( 1 ) ) . createStreamProfile ( eq ( TEST_PID ) , eq ( "StreamProfile1" ) , eq ( m_ExpectedProps ) ) ; }
Test adding a StreamProfile that doesn't exist yet.
Test adding a StreamProfile that doesn ' t exist yet .