Ignore:
Timestamp:
09/14/2022 03:31:54 PM (4 years ago)
Author:
jdalbey
Message:

Multifile commit - revise source to match revisions to config filenames. Fix broken system tests. Fix defect #160.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/tmcsim/simulationmanager/SimulationManagerSmokeTest.java

    r658 r664  
    33import java.awt.Component; 
    44import java.io.File; 
     5import java.util.Arrays; 
    56import javax.swing.JButton; 
    67import static junit.framework.Assert.assertEquals; 
     
    3940     * Call constructors for both classes 
    4041     */ 
    41     public void testBothGUIs() throws ScriptException, SimulationException 
     42    public void testBothGUIs() throws ScriptException, SimulationException, InterruptedException 
    4243    { 
    4344        System.out.println("Smoke Test Sim Mgr & CADSimulator"); 
    4445 
    4546        Window cadwindow = null; 
    46         System.setProperty("CAD_SIM_PROPERTIES", "config/cad_simulator_smoketest_config.properties"); 
     47        System.setProperty("CAD_SIM_PROPERTIES", "config/cad_server.properties");  
    4748        if (System.getProperty("CAD_SIM_PROPERTIES") != null) 
    4849        { 
     
    7778 
    7879        Window simMgrWindow = null; 
    79         System.setProperty("SIM_MGR_PROPERTIES", "config/sim_manager_smoketest_config.properties"); 
     80        System.setProperty("SIM_MGR_PROPERTIES", "config/sim_manager.properties"); 
    8081        if (System.getProperty("SIM_MGR_PROPERTIES") != null) 
    8182        { 
     
    118119        // Click "Start" 
    119120        win.getButton("Start").click(); 
    120         try 
    121         { 
    122             Thread.sleep(200); 
    123         } catch (Exception ex) 
    124         { 
    125             ex.printStackTrace(); 
    126         } 
     121        Thread.sleep(200); 
    127122        assertEquals("Running", txtSimStatus.getText()); 
    128123 
    129         //List all available buttons 
    130         Component[] buttons = win.getSwingComponents(JButton.class); 
    131         for (Component comp : buttons) 
    132         { 
    133             System.out.println(comp); 
    134         } 
     124        java.util.ArrayList<String> expectedButtons = new java.util.ArrayList<String>(Arrays.asList("Load Script","Start","Pause","Reset","Connect to Paramics", 
     125                "Load Network","Reschedule","Trigger","Delete","Add New Incident","Divert Traffic")); 
     126        // Check for appearance of buttons in the GUI 
    135127        win.getButton("Load Script"); 
    136         win.getButton("Pause"); 
    137         win.getButton("Disconnect from Paramics"); 
    138128        win.getButton("Reset"); 
    139         win.getButton("Load Network"); 
     129        win.getButton("Add New Incident"); 
     130        win.getButton("Reschedule"); 
     131        win.getButton("Trigger"); 
     132        win.getButton("Delete"); 
     133        //Find all available buttons - obsolete, replaced by stmts above 
     134//        Component[] buttons = win.getSwingComponents(JButton.class); 
     135//        java.util.List<Component> actualButtons = Arrays.asList(buttons); 
     136//        for (Component actualBtn: actualButtons) 
     137//        { 
     138//            if (actualBtn instanceof JButton) 
     139//            { 
     140//                String btnName = ((JButton) actualBtn).getText(); 
     141//                if (btnName.length()>0) 
     142//                { 
     143//                    if (expectedButtons.contains(btnName)) 
     144//                    { 
     145//                        expectedButtons.remove(btnName); 
     146//                    } 
     147//                    else 
     148//                    { 
     149//                        fail("GUI has an unexpected button: "+btnName); 
     150//                    } 
     151//                } 
     152//            } 
     153//        } 
     154//        if (expectedButtons.size() > 0) 
     155//        { 
     156//            fail("GUI is missing a button: "+expectedButtons); 
     157//        } 
     158 
     159        // Pause the simulation     
     160        win.getButton("Pause").click(); 
     161        Thread.sleep(200); 
     162        win.getButton("Resume");    // resume should appear when paused 
    140163        // Quit 
    141164        engine = null; 
Note: See TracChangeset for help on using the changeset viewer.