mil.dod.th.ose.datastream.integration/src/mil/dod/th/ose/datastream/integration/TestDataStreamService.java
public void testSetStreamProfileName() throws StreamProfileException, FactoryException
    {
        DataStreamService dataStreamService = ServiceUtils.getService(m_Context, DataStreamService.class);
        assertThat(dataStreamService, is(notNullValue()));
        
        EventHandlerSyncer syncer = new EventHandlerSyncer(m_Context,
                FactoryDescriptor.TOPIC_FACTORY_OBJ_NAME_UPDATED, String.format("(%s=%s)",
                        FactoryDescriptor.EVENT_PROP_OBJ_NAME, "testSetNameStreamProfile"));
        
        Map<String, Object> props = new HashMap<>();
        props.put(StreamProfileAttributes.CONFIG_PROP_ASSET_NAME, "asset1");
        props.put(StreamProfileAttributes.CONFIG_PROP_BITRATE_KBPS, "10.0");
        props.put(StreamProfileAttributes.CONFIG_PROP_FORMAT, "video/mpeg");
        props.put(StreamProfileAttributes.CONFIG_PROP_DATA_SOURCE, "rtsp://hostname:9999");

        StreamProfile streamProfile = dataStreamService.createStreamProfile(ExampleStreamProfile.class.getName(), 
                "testSetNameStreamProfile", props);
        streamProfile.setName("testSetNameStreamProfile");
        
        syncer.waitForEvent(10);
        
        StreamProfile streamProfile2 = dataStreamService.createStreamProfile(ExampleStreamProfile.class.getName(),
                "notTestSetNameStreamProfile", props);
        
        try
        {
            streamProfile2.setName("testSetNameStreamProfile");
            fail("expecting exception");
        }
        catch (IllegalArgumentException e)
        {
            // do nothing; this exception is expected.
        }
        
        assertThat(streamProfile.getName(), is("testSetNameStreamProfile"));
        assertThat(streamProfile2.getName(), is(not("testSetNameStreamProfile")));               
    }
/**
     * Test that a StreamProfile name is correctly set if the name is unique. If the name is not unique,
     * it should not be set.
     */
Test that a StreamProfile name is correctly set if the name is unique. If the name is not unique,
it should not be set.
Test that a StreamProfile name is correctly set if the name is unique . If the name is not unique it should not be set .
public void testSetStreamProfileName() throws StreamProfileException, FactoryException
    {
        DataStreamService dataStreamService = ServiceUtils.getService(m_Context, DataStreamService.class);
        assertThat(dataStreamService, is(notNullValue()));
        EventHandlerSyncer syncer = new EventHandlerSyncer(m_Context,
                FactoryDescriptor.TOPIC_FACTORY_OBJ_NAME_UPDATED, String.format("(%s=%s)",
                        FactoryDescriptor.EVENT_PROP_OBJ_NAME, "testSetNameStreamProfile"));
        Map<String, Object> props = new HashMap<>();
        props.put(StreamProfileAttributes.CONFIG_PROP_ASSET_NAME, "asset1");
        props.put(StreamProfileAttributes.CONFIG_PROP_BITRATE_KBPS, "10.0");
        props.put(StreamProfileAttributes.CONFIG_PROP_FORMAT, "video/mpeg");
        props.put(StreamProfileAttributes.CONFIG_PROP_DATA_SOURCE, "rtsp://hostname:9999");
        StreamProfile streamProfile = dataStreamService.createStreamProfile(ExampleStreamProfile.class.getName(), 
                "testSetNameStreamProfile", props);
        streamProfile.setName("testSetNameStreamProfile");
        syncer.waitForEvent(10);
        StreamProfile streamProfile2 = dataStreamService.createStreamProfile(ExampleStreamProfile.class.getName(),
                "notTestSetNameStreamProfile", props);
        try
        {
            streamProfile2.setName("testSetNameStreamProfile");
            fail("expecting exception");
        }
        catch (IllegalArgumentException e)
        {
        }
        assertThat(streamProfile.getName(), is("testSetNameStreamProfile"));
        assertThat(streamProfile2.getName(), is(not("testSetNameStreamProfile")));               
    }
public void testSetStreamProfileName ( ) throws StreamProfileException , FactoryException { DataStreamService dataStreamService = ServiceUtils . getService ( m_Context , DataStreamService . class ) ; assertThat ( dataStreamService , is ( notNullValue ( ) ) ) ; EventHandlerSyncer syncer = new EventHandlerSyncer ( m_Context , FactoryDescriptor . TOPIC_FACTORY_OBJ_NAME_UPDATED , String . format ( "(%s=%s)" , FactoryDescriptor . EVENT_PROP_OBJ_NAME , "testSetNameStreamProfile" ) ) ; Map < String , Object > props = new HashMap < > ( ) ; props . put ( StreamProfileAttributes . CONFIG_PROP_ASSET_NAME , "asset1" ) ; props . put ( StreamProfileAttributes . CONFIG_PROP_BITRATE_KBPS , "10.0" ) ; props . put ( StreamProfileAttributes . CONFIG_PROP_FORMAT , "video/mpeg" ) ; props . put ( StreamProfileAttributes . CONFIG_PROP_DATA_SOURCE , "rtsp://hostname:9999" ) ; StreamProfile streamProfile = dataStreamService . createStreamProfile ( ExampleStreamProfile . class . getName ( ) , "testSetNameStreamProfile" , props ) ; streamProfile . setName ( "testSetNameStreamProfile" ) ; syncer . waitForEvent ( 10 ) ; StreamProfile streamProfile2 = dataStreamService . createStreamProfile ( ExampleStreamProfile . class . getName ( ) , "notTestSetNameStreamProfile" , props ) ; try { streamProfile2 . setName ( "testSetNameStreamProfile" ) ; fail ( "expecting exception" ) ; } catch ( IllegalArgumentException e ) { } assertThat ( streamProfile . getName ( ) , is ( "testSetNameStreamProfile" ) ) ; assertThat ( streamProfile2 . getName ( ) , is ( not ( "testSetNameStreamProfile" ) ) ) ; }
Test that a StreamProfile name is correctly set if the name is unique.
Test that a StreamProfile name is correctly set if the name is unique .
// do nothing; this exception is expected.