mil.dod.th.ose.core/test/mil/dod/th/ose/core/impl/mp/TestProgramImpl.java
@Test
    public void testGetProgramDeps()
    {
        //Creating variable data, schedule and template
        MissionVariableMetaData programVars = new MissionVariableMetaData().withDescription("made up program deps")
                .withName("prog1").
            withOptionValues("prog2", "prog3").withType(MissionVariableTypesEnum.PROGRAM_DEPENDENCIES);
        MissionProgramTemplate progInstance = new MissionProgramTemplate().withSource("dragon").withName("George").
            withVariableMetaData(programVars);
        MissionProgramSchedule schedule = new MissionProgramSchedule().withIndefiniteInterval(false);
        List<MapEntry> paramVals = new ArrayList<MapEntry>();
        paramVals.add(new MapEntry("prog1", "prog2"));
        //the program's parameters
        MissionProgramParameters params = new MissionProgramParameters().withSchedule(schedule).
            withParameters(paramVals).withProgramName("NAME");
        ProgramImpl program = new ProgramImpl(m_Manager, m_EventAdmin, progInstance, params,  UUID.randomUUID());
        assertThat(program.getProgramDeps(), hasItem("prog2"));
        //verify that optional values were not placed as dependencies, as they should only be used when actual value is
        //not assigned
        assertThat(program.getProgramDeps(), not(hasItem("prog3")));
        List<MissionVariableMetaData> newVarData = program.getVariableMetaData();
        //there should only be one in the list
        assertThat(newVarData.get(0).getOptionValues(), hasItem("prog2"));
        assertThat(newVarData.get(0).getOptionValues(), hasItem("prog3"));
        assertThat(program.getProgramDeps(), is(notNullValue()));        
        try
        {
            program.getProgramDeps().add("other program");
            fail("expecting exception");
        }
        catch (UnsupportedOperationException e)
        {
            //expected exception    
        }
    }
/**
     *  Checks that program defined program dependencies can be correctly retrieved.
     */
Checks that program defined program dependencies can be correctly retrieved.
Checks that program defined program dependencies can be correctly retrieved .
@Test
    public void testGetProgramDeps()
    {
        MissionVariableMetaData programVars = new MissionVariableMetaData().withDescription("made up program deps")
                .withName("prog1").
            withOptionValues("prog2", "prog3").withType(MissionVariableTypesEnum.PROGRAM_DEPENDENCIES);
        MissionProgramTemplate progInstance = new MissionProgramTemplate().withSource("dragon").withName("George").
            withVariableMetaData(programVars);
        MissionProgramSchedule schedule = new MissionProgramSchedule().withIndefiniteInterval(false);
        List<MapEntry> paramVals = new ArrayList<MapEntry>();
        paramVals.add(new MapEntry("prog1", "prog2"));
        MissionProgramParameters params = new MissionProgramParameters().withSchedule(schedule).
            withParameters(paramVals).withProgramName("NAME");
        ProgramImpl program = new ProgramImpl(m_Manager, m_EventAdmin, progInstance, params,  UUID.randomUUID());
        assertThat(program.getProgramDeps(), hasItem("prog2"));
        assertThat(program.getProgramDeps(), not(hasItem("prog3")));
        List<MissionVariableMetaData> newVarData = program.getVariableMetaData();
        assertThat(newVarData.get(0).getOptionValues(), hasItem("prog2"));
        assertThat(newVarData.get(0).getOptionValues(), hasItem("prog3"));
        assertThat(program.getProgramDeps(), is(notNullValue()));        
        try
        {
            program.getProgramDeps().add("other program");
            fail("expecting exception");
        }
        catch (UnsupportedOperationException e)
        {
        }
    }
@ Test public void testGetProgramDeps ( ) { MissionVariableMetaData programVars = new MissionVariableMetaData ( ) . withDescription ( "made up program deps" ) . withName ( "prog1" ) . withOptionValues ( "prog2" , "prog3" ) . withType ( MissionVariableTypesEnum . PROGRAM_DEPENDENCIES ) ; MissionProgramTemplate progInstance = new MissionProgramTemplate ( ) . withSource ( "dragon" ) . withName ( "George" ) . withVariableMetaData ( programVars ) ; MissionProgramSchedule schedule = new MissionProgramSchedule ( ) . withIndefiniteInterval ( false ) ; List < MapEntry > paramVals = new ArrayList < MapEntry > ( ) ; paramVals . add ( new MapEntry ( "prog1" , "prog2" ) ) ; MissionProgramParameters params = new MissionProgramParameters ( ) . withSchedule ( schedule ) . withParameters ( paramVals ) . withProgramName ( "NAME" ) ; ProgramImpl program = new ProgramImpl ( m_Manager , m_EventAdmin , progInstance , params , UUID . randomUUID ( ) ) ; assertThat ( program . getProgramDeps ( ) , hasItem ( "prog2" ) ) ; assertThat ( program . getProgramDeps ( ) , not ( hasItem ( "prog3" ) ) ) ; List < MissionVariableMetaData > newVarData = program . getVariableMetaData ( ) ; assertThat ( newVarData . get ( 0 ) . getOptionValues ( ) , hasItem ( "prog2" ) ) ; assertThat ( newVarData . get ( 0 ) . getOptionValues ( ) , hasItem ( "prog3" ) ) ; assertThat ( program . getProgramDeps ( ) , is ( notNullValue ( ) ) ) ; try { program . getProgramDeps ( ) . add ( "other program" ) ; fail ( "expecting exception" ) ; } catch ( UnsupportedOperationException e ) { } }
Checks that program defined program dependencies can be correctly retrieved.
Checks that program defined program dependencies can be correctly retrieved .
//Creating variable data, schedule and template //the program's parameters //verify that optional values were not placed as dependencies, as they should only be used when actual value is //not assigned //there should only be one in the list //expected exception    