Changeset 43 in tmcsimulator


Ignore:
Timestamp:
06/23/2016 11:34:59 AM (10 years ago)
Author:
jdalbey
Message:

ExitAction?.java Remove confirmation prompt from exiting Sim Mgr. Enhance Sim Mgr smoke test.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/IDE_metadata/NetBeans/TMCSim/nbproject/project.properties

    r40 r43  
    4040    ${file.reference.uispec4j-jdk17.jar}:\ 
    4141    ${file.reference.mp3plugin.jar}:\ 
    42     ${file.reference.mockito-1.10.19.jar} 
     42    ${file.reference.mockito-1.10.19.jar}:\ 
     43    ${libs.junit_4.classpath} 
    4344# Space-separated list of extra javac options 
    4445javac.compilerargs= 
     
    5152    ${javac.classpath}:\ 
    5253    ${build.classes.dir}:\ 
    53     ${libs.junit.classpath}:\ 
    54     ${libs.junit_4.classpath} 
     54    ${libs.junit.classpath} 
    5555javac.test.processorpath=\ 
    5656    ${javac.test.classpath} 
  • trunk/src/tmcsim/simulationmanager/actions/ExitAction.java

    r2 r43  
    22 
    33import java.awt.event.ActionEvent; 
     4import javax.swing.AbstractAction; 
     5import tmcsim.simulationmanager.SimulationManagerView; 
    46 
    5 import javax.swing.AbstractAction; 
    6 import javax.swing.JOptionPane; 
    7  
    8 import tmcsim.simulationmanager.SimulationManagerView; 
    97/** 
    108 * ExitAction is an AbstractAction that is used for exiting the Simulation 
    11  * Manager application.  When the action is performed, the action prompts the  
    12  * user to confirm the exit, and then disposes of the SimulationManagerView class.  
     9 * Manager application. When the action is performed, the action prompts the 
     10 * user to confirm the exit, and then disposes of the SimulationManagerView 
     11 * class. 
     12 * 
    1313 * @author Matthew Cechini 
     14 * @author jdalbey 06/23/2016 Removed confirmation prompt to simplify system 
     15 * testing. 
    1416 */ 
    1517@SuppressWarnings("serial") 
    16 public class ExitAction extends AbstractAction {     
    17      
    18     /** Reference to the SimulationManagerView object. */ 
     18public class ExitAction extends AbstractAction 
     19{ 
     20 
     21    /** 
     22     * Reference to the SimulationManagerView object. 
     23     */ 
    1924    private SimulationManagerView theSimManagerView = null; 
    20      
    21     /**  
     25 
     26    /** 
    2227     * Constructor. 
     28     * 
    2329     * @param view View class object for the Simulation Manager. 
    2430     */ 
    25     public ExitAction(SimulationManagerView view) { 
     31    public ExitAction(SimulationManagerView view) 
     32    { 
    2633        super("Exit"); 
    27          
    28         theSimManagerView = view;        
     34 
     35        theSimManagerView = view; 
    2936    } 
    30      
    3137 
    32     public void actionPerformed(ActionEvent evt) { 
    33          
    34         if(JOptionPane.showConfirmDialog( 
    35                 null, "Exit Simulation Manager?", "Confirm Exit", 
    36                 JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION)  
    37         {    
    38             theSimManagerView.dispose();     
    39         }    
     38    public void actionPerformed(ActionEvent evt) 
     39    { 
     40        theSimManagerView.dispose(); 
     41//        if(JOptionPane.showConfirmDialog( 
     42//                null, "Exit Simulation Manager?", "Confirm Exit", 
     43//                JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) 
     44//        { 
     45//            theSimManagerView.dispose(); 
     46//        } 
    4047    } 
    4148} 
  • trunk/test/tmcsim/simulationmanager/SimulationManagerSmokeTest.java

    r34 r43  
    11package tmcsim.simulationmanager; 
    22 
     3import java.awt.Component; 
    34import java.io.File; 
     5import javax.swing.JButton; 
    46import static junit.framework.Assert.assertEquals; 
     7import static junit.framework.Assert.assertFalse; 
     8import static junit.framework.Assert.assertTrue; 
    59import static junit.framework.Assert.fail; 
    6 import org.uispec4j.*; 
     10import org.uispec4j.Panel; 
     11import org.uispec4j.TextBox; 
     12import org.uispec4j.Trigger; 
     13import org.uispec4j.UISpecTestCase; 
     14import org.uispec4j.Window; 
    715import org.uispec4j.interception.WindowInterceptor; 
    816import tmcsim.cadsimulator.CADSimulator; 
     
    3543 
    3644        Window cadwindow = null; 
    37         System.setProperty("CONFIG_DIR", "config/testConfig"); 
    38         if (System.getProperty("CONFIG_DIR") != null) 
     45        System.setProperty("CAD_SIM_PROPERTIES", "config/cad_simulator_smoketest_config.properties"); 
     46        if (System.getProperty("CAD_SIM_PROPERTIES") != null) 
    3947        { 
    4048            cadwindow = WindowInterceptor.run(new Trigger() 
     
    4452                    try 
    4553                    { 
    46                         engine = new CADSimulator(System.getProperty("CONFIG_DIR") + System.getProperty("file.separator") + "cad_simulator_config.properties"); 
    47  
     54                        engine = new CADSimulator(System.getProperty("CAD_SIM_PROPERTIES")); 
    4855                    } catch (Exception e) 
    4956                    { 
     
    5259                } 
    5360            }); 
    54         } else 
     61        } 
     62        else 
    5563        { 
    56             fail("CONFIG_DIR system property not defined."); 
     64            fail("CAD_SIM_PROPERTIES system property not defined."); 
    5765        } 
    5866 
    5967        // Check CAD Simulator appears with no script and nothing connected 
    60         assertEquals("CAD Simulator", cadwindow.getTitle()); 
     68        assertTrue("Window title incorrect", cadwindow.getTitle().startsWith("CAD Simulator")); 
    6169        Panel mainPanel = cadwindow.getPanel("contentPane"); 
    6270        TextBox txtStatus = mainPanel.getTextBox("simulationStatus"); 
     
    6775 
    6876        Window simMgrWindow = null; 
    69         System.setProperty("CONFIG_DIR", "config/testConfig"); 
    70         if (System.getProperty("CONFIG_DIR") != null) 
     77        System.setProperty("SIM_MGR_PROPERTIES", "config/sim_manager_smoketest_config.properties"); 
     78        if (System.getProperty("SIM_MGR_PROPERTIES") != null) 
    7179        { 
    7280            simMgrWindow = WindowInterceptor.run(new Trigger() 
     
    7684                    try 
    7785                    { 
    78                         //simMgrApp = new SimulationManager(System.getProperty("SIM_MGR_PROPERTIES")); 
    79                         simMgrApp = new SimulationManager(System.getProperty("CONFIG_DIR") + System.getProperty("file.separator") + "sim_manager_config.properties"); 
     86                        simMgrApp = new SimulationManager(System.getProperty("SIM_MGR_PROPERTIES")); 
    8087                    } catch (Exception ex) 
    8188                    { 
     
    8491                } 
    8592            }); 
    86         } else 
     93        } 
     94        else 
    8795        { 
    88             fail("CONFIG_DIR system property not defined."); 
     96            fail("SIM_MGR_PROPERTIES system property not defined."); 
    8997        } 
    9098 
     
    117125        assertEquals("Running", txtSimStatus.getText()); 
    118126 
     127        //List all available buttons 
     128        Component[] buttons = win.getSwingComponents(JButton.class); 
     129        for (Component comp : buttons) 
     130        { 
     131            System.out.println(comp); 
     132        } 
     133        win.getButton("Load Script"); 
     134        win.getButton("Pause"); 
     135        win.getButton("Disconnect from Paramics"); 
     136        win.getButton("Reset"); 
     137        win.getButton("Load Network"); 
    119138        // Quit 
    120139        engine = null; 
    121         simMgrApp = null; 
     140        win.getMenuBar().getMenu("File").getSubMenu("Exit").click(); 
     141        //simMgrApp = null; 
    122142    } 
    123143} 
Note: See TracChangeset for help on using the changeset viewer.