mil.dod.th.ose.core/test/mil/dod/th/ose/core/impl/mp/TestMissionProgramManagerImpl.java
private void mockDependentMissionPrograms()
    {
        //mock the persistent data store for mission programs
        List<PersistentData> missionPrograms = new ArrayList<PersistentData>();
        
        //schedule that all the missions use
        MissionProgramSchedule schedule = new MissionProgramSchedule().withIndefiniteInterval(false).
            withImmediately(true).withAtReset(true).withActive(true);
        
        //create params individually for each template, note that although these values are the same
        //in an actual program they need not be, the key is the name of the variable, the value is the 
        //is the variables value, ie I might have a variable named asset, but with a value of ExampleAsset.
        Map<String, Object> paramArgs = new HashMap<String, Object>();
        paramArgs.put("program", "program2");
        MissionProgramParameters params1 = new MissionProgramParameters().withSchedule(schedule).
            withProgramName("program1").withParameters(MapTranslator.translateMap(paramArgs)).
                withTemplateName("program");
        
        paramArgs.put("program", "program3");
        MissionProgramParameters params2 = new MissionProgramParameters().withSchedule(schedule).
            withProgramName("program2").withParameters(MapTranslator.translateMap(paramArgs)).
                withTemplateName("program");
        
        MissionProgramParameters params3 = new MissionProgramParameters().withSchedule(schedule).
            withProgramName("program3").withParameters(MapTranslator.translateMap(paramArgs)).
                withTemplateName("program-nodeps");
        
        
        //mock the schedule and parameter values
        PersistentData dataParam1 = mock(PersistentData.class);
        PersistentData dataParam2 = mock(PersistentData.class);
        PersistentData dataParam3 = mock(PersistentData.class);
        
        //mock response from data store when iterating over query results        
        when((byte[])dataParam1.getEntity()).thenReturn(XmlUtils.toXML(params1, true));
        when((byte[])dataParam2.getEntity()).thenReturn(XmlUtils.toXML(params2, true));
        when((byte[])dataParam3.getEntity()).thenReturn(XmlUtils.toXML(params3, true));
        
        //Add the mocked PersistantData to the list
        missionPrograms.add(dataParam1);
        missionPrograms.add(dataParam2);
        missionPrograms.add(dataParam3);
        
        //mocked response when data store is queried 
        doReturn(missionPrograms).when(m_PersistentDataStore).query(MissionProgramManagerImpl.class);        
        
        //mock responses for get UUID
        when(dataParam1.getDescription()).thenReturn("program1");
        when(dataParam2.getDescription()).thenReturn("program2");
        when(dataParam3.getDescription()).thenReturn("program3");
    }
/**
     * Create mission programs that depend on each other, used by
     * {@link #testActivationProgramNotCheckedOnceSatisfied()}. 
     * 
     * P1 -> P2 -> P3, all should be executed on activation
     */
Create mission programs that depend on each other, used by
#testActivationProgramNotCheckedOnceSatisfied().

> P2 -> P3, all should be executed on activation
Create mission programs that depend on each other used by #testActivationProgramNotCheckedOnceSatisfied () . > P2 - > P3 all should be executed on activation
private void mockDependentMissionPrograms()
    {
        List<PersistentData> missionPrograms = new ArrayList<PersistentData>();
        MissionProgramSchedule schedule = new MissionProgramSchedule().withIndefiniteInterval(false).
            withImmediately(true).withAtReset(true).withActive(true);
        Map<String, Object> paramArgs = new HashMap<String, Object>();
        paramArgs.put("program", "program2");
        MissionProgramParameters params1 = new MissionProgramParameters().withSchedule(schedule).
            withProgramName("program1").withParameters(MapTranslator.translateMap(paramArgs)).
                withTemplateName("program");
        paramArgs.put("program", "program3");
        MissionProgramParameters params2 = new MissionProgramParameters().withSchedule(schedule).
            withProgramName("program2").withParameters(MapTranslator.translateMap(paramArgs)).
                withTemplateName("program");
        MissionProgramParameters params3 = new MissionProgramParameters().withSchedule(schedule).
            withProgramName("program3").withParameters(MapTranslator.translateMap(paramArgs)).
                withTemplateName("program-nodeps");
        PersistentData dataParam1 = mock(PersistentData.class);
        PersistentData dataParam2 = mock(PersistentData.class);
        PersistentData dataParam3 = mock(PersistentData.class);
        when((byte[])dataParam1.getEntity()).thenReturn(XmlUtils.toXML(params1, true));
        when((byte[])dataParam2.getEntity()).thenReturn(XmlUtils.toXML(params2, true));
        when((byte[])dataParam3.getEntity()).thenReturn(XmlUtils.toXML(params3, true));
        missionPrograms.add(dataParam1);
        missionPrograms.add(dataParam2);
        missionPrograms.add(dataParam3);
        doReturn(missionPrograms).when(m_PersistentDataStore).query(MissionProgramManagerImpl.class);        
        when(dataParam1.getDescription()).thenReturn("program1");
        when(dataParam2.getDescription()).thenReturn("program2");
        when(dataParam3.getDescription()).thenReturn("program3");
    }
private void mockDependentMissionPrograms ( ) { List < PersistentData > missionPrograms = new ArrayList < PersistentData > ( ) ; MissionProgramSchedule schedule = new MissionProgramSchedule ( ) . withIndefiniteInterval ( false ) . withImmediately ( true ) . withAtReset ( true ) . withActive ( true ) ; Map < String , Object > paramArgs = new HashMap < String , Object > ( ) ; paramArgs . put ( "program" , "program2" ) ; MissionProgramParameters params1 = new MissionProgramParameters ( ) . withSchedule ( schedule ) . withProgramName ( "program1" ) . withParameters ( MapTranslator . translateMap ( paramArgs ) ) . withTemplateName ( "program" ) ; paramArgs . put ( "program" , "program3" ) ; MissionProgramParameters params2 = new MissionProgramParameters ( ) . withSchedule ( schedule ) . withProgramName ( "program2" ) . withParameters ( MapTranslator . translateMap ( paramArgs ) ) . withTemplateName ( "program" ) ; MissionProgramParameters params3 = new MissionProgramParameters ( ) . withSchedule ( schedule ) . withProgramName ( "program3" ) . withParameters ( MapTranslator . translateMap ( paramArgs ) ) . withTemplateName ( "program-nodeps" ) ; PersistentData dataParam1 = mock ( PersistentData . class ) ; PersistentData dataParam2 = mock ( PersistentData . class ) ; PersistentData dataParam3 = mock ( PersistentData . class ) ; when ( ( byte [ ] ) dataParam1 . getEntity ( ) ) . thenReturn ( XmlUtils . toXML ( params1 , true ) ) ; when ( ( byte [ ] ) dataParam2 . getEntity ( ) ) . thenReturn ( XmlUtils . toXML ( params2 , true ) ) ; when ( ( byte [ ] ) dataParam3 . getEntity ( ) ) . thenReturn ( XmlUtils . toXML ( params3 , true ) ) ; missionPrograms . add ( dataParam1 ) ; missionPrograms . add ( dataParam2 ) ; missionPrograms . add ( dataParam3 ) ; doReturn ( missionPrograms ) . when ( m_PersistentDataStore ) . query ( MissionProgramManagerImpl . class ) ; when ( dataParam1 . getDescription ( ) ) . thenReturn ( "program1" ) ; when ( dataParam2 . getDescription ( ) ) . thenReturn ( "program2" ) ; when ( dataParam3 . getDescription ( ) ) . thenReturn ( "program3" ) ; }
Create mission programs that depend on each other, used by
 {@link #testActivationProgramNotCheckedOnceSatisfied()}.
Create mission programs that depend on each other used by { @link #testActivationProgramNotCheckedOnceSatisfied () } .
//mock the persistent data store for mission programs //schedule that all the missions use //create params individually for each template, note that although these values are the same //in an actual program they need not be, the key is the name of the variable, the value is the  //is the variables value, ie I might have a variable named asset, but with a value of ExampleAsset. //mock the schedule and parameter values //mock response from data store when iterating over query results         //Add the mocked PersistantData to the list //mocked response when data store is queried  //mock responses for get UUID