mil.dod.th.ose.core/test/mil/dod/th/ose/core/impl/mp/TestMissionProgramManagerImpl.java
private void mockProgram2DependsProgram1()
    {
        List<PersistentData> missionPrograms = new ArrayList<>();
        
        MissionProgramSchedule schedule = new MissionProgramSchedule().withIndefiniteInterval(false).
                withImmediately(true).withAtReset(true).withActive(true);
        
        Map<String, Object> paramArgs = new HashMap<>();
        paramArgs.put("program", "program1");
        
        MissionProgramParameters params1 = new MissionProgramParameters().
                withSchedule(schedule).withProgramName("program1").withTemplateName("program-nodeps");
        MissionProgramParameters params2 = new MissionProgramParameters().withSchedule(schedule).
                withParameters(MapTranslator.translateMap(paramArgs)).withProgramName("program2").
                withTemplateName("program");
        
        PersistentData dataParam1 = mock(PersistentData.class);
        PersistentData dataParam2 = mock(PersistentData.class);
        
        when((byte[])dataParam1.getEntity()).thenReturn(XmlUtils.toXML(params1, true));
        when(dataParam1.getDescription()).thenReturn("program1");
        when((byte[])dataParam2.getEntity()).thenReturn(XmlUtils.toXML(params2, true));
        when(dataParam2.getDescription()).thenReturn("program2");
        
        missionPrograms.add(dataParam1);
        missionPrograms.add(dataParam2);
        
        doReturn(missionPrograms).when(m_PersistentDataStore).query(MissionProgramManagerImpl.class);
        
    }
/**
     * Method to mock two programs program1 and program2. Program2 is dependent on 
     * program1.
     */
Method to mock two programs program1 and program2. Program2 is dependent on
program1.
Method to mock two programs program1 and program2 . Program2 is dependent on program1 .
private void mockProgram2DependsProgram1()
    {
        List<PersistentData> missionPrograms = new ArrayList<>();
        MissionProgramSchedule schedule = new MissionProgramSchedule().withIndefiniteInterval(false).
                withImmediately(true).withAtReset(true).withActive(true);
        Map<String, Object> paramArgs = new HashMap<>();
        paramArgs.put("program", "program1");
        MissionProgramParameters params1 = new MissionProgramParameters().
                withSchedule(schedule).withProgramName("program1").withTemplateName("program-nodeps");
        MissionProgramParameters params2 = new MissionProgramParameters().withSchedule(schedule).
                withParameters(MapTranslator.translateMap(paramArgs)).withProgramName("program2").
                withTemplateName("program");
        PersistentData dataParam1 = mock(PersistentData.class);
        PersistentData dataParam2 = mock(PersistentData.class);
        when((byte[])dataParam1.getEntity()).thenReturn(XmlUtils.toXML(params1, true));
        when(dataParam1.getDescription()).thenReturn("program1");
        when((byte[])dataParam2.getEntity()).thenReturn(XmlUtils.toXML(params2, true));
        when(dataParam2.getDescription()).thenReturn("program2");
        missionPrograms.add(dataParam1);
        missionPrograms.add(dataParam2);
        doReturn(missionPrograms).when(m_PersistentDataStore).query(MissionProgramManagerImpl.class);
    }
private void mockProgram2DependsProgram1 ( ) { List < PersistentData > missionPrograms = new ArrayList < > ( ) ; MissionProgramSchedule schedule = new MissionProgramSchedule ( ) . withIndefiniteInterval ( false ) . withImmediately ( true ) . withAtReset ( true ) . withActive ( true ) ; Map < String , Object > paramArgs = new HashMap < > ( ) ; paramArgs . put ( "program" , "program1" ) ; MissionProgramParameters params1 = new MissionProgramParameters ( ) . withSchedule ( schedule ) . withProgramName ( "program1" ) . withTemplateName ( "program-nodeps" ) ; MissionProgramParameters params2 = new MissionProgramParameters ( ) . withSchedule ( schedule ) . withParameters ( MapTranslator . translateMap ( paramArgs ) ) . withProgramName ( "program2" ) . withTemplateName ( "program" ) ; PersistentData dataParam1 = mock ( PersistentData . class ) ; PersistentData dataParam2 = mock ( PersistentData . class ) ; when ( ( byte [ ] ) dataParam1 . getEntity ( ) ) . thenReturn ( XmlUtils . toXML ( params1 , true ) ) ; when ( dataParam1 . getDescription ( ) ) . thenReturn ( "program1" ) ; when ( ( byte [ ] ) dataParam2 . getEntity ( ) ) . thenReturn ( XmlUtils . toXML ( params2 , true ) ) ; when ( dataParam2 . getDescription ( ) ) . thenReturn ( "program2" ) ; missionPrograms . add ( dataParam1 ) ; missionPrograms . add ( dataParam2 ) ; doReturn ( missionPrograms ) . when ( m_PersistentDataStore ) . query ( MissionProgramManagerImpl . class ) ; }
Method to mock two programs program1 and program2.
Method to mock two programs program1 and program2 .