Changeset 664 in tmcsimulator for trunk


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.

Location:
trunk
Files:
2 added
1 deleted
20 edited

Legend:

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

    r384 r664  
    11main.class=tmcsim.client.CADClient 
    2 run.jvmargs=-Djava.util.logging.config.file=config/cad_client_logging.properties 
     2run.jvmargs=-Djava.util.logging.config.file=config/logging_cad_client.properties 
  • trunk/IDE_metadata/NetBeans/TMCSim/nbproject/configs/CADServer_Console.properties

    r523 r664  
    11$label=CADServer Console 
    2 main.class=tmcsim.cadsimulator.CADServer 
    3 run.jvmargs=-DPROP_FILE=cad_simulator_console_config.properties 
     2run.jvmargs=-DPROP_FILE=cad_server_console.properties 
  • trunk/IDE_metadata/NetBeans/TMCSim/nbproject/configs/Sim_Mgr.properties

    r14 r664  
    11$label=Sim Mgr 
    22main.class=tmcsim.simulationmanager.SimulationManager 
    3 run.jvmargs=-DSIM_MGR_PROPERTIES=config/sim_manager_config.properties 
     3run.jvmargs=-DSIM_MGR_PROPERTIES=config/sim_manager.properties 
  • trunk/src/tmcsim/cadsimulator/CADClientConnector.java

    r660 r664  
    107107        catch (ClassNotFoundException cnfe) { 
    108108            cnfe.printStackTrace(); 
     109        } 
     110        catch (java.io.EOFException except) 
     111        { 
     112            cadLogger.logp(Level.INFO, "CADClientConnector", "run", "Client appears to have shutdown, removing client.\n"); 
     113            disconnectClient(); 
    109114        } 
    110115        catch (SocketException except) 
  • trunk/src/tmcsim/cadsimulator/CADServer.java

    r654 r664  
    2727 
    2828/** 
    29  * CADSimulator is main class for the CAD Simulator application. At construction 
    30  * the Coordinator, CoordinatorViewer, and all CAD Simulator Managers are 
     29 * CADServer is main class for the CAD Simulator application.  
     30 * CADServer must be running before starting any other components of the TMCSim. 
     31 * At construction the Coordinator, CoordinatorViewer, and all CAD Simulator Managers are 
    3132 * initialized and data relationships are established. Simulation control is 
    32  * managed through the Coordinator and Managers. The CADSimulator contains the 
     33 * managed through the Coordinator and Managers. The CADServer contains the 
    3334 * instances of all Manager Objects that are used to control the Simulation flow 
    3435 * of data.<br> 
     36 * There is a GUI (and for testing, a text-based UI) that displays the state 
     37 * of the server. 
    3538 * <br> 
     39 * A properties file contains settings for many parameters of the CADServer<br> 
    3640 * 
    37  * The CADSimulator is initialized with a properties file containing the 
    38  * following data items:<br> 
    39  * <code> 
    40  * -----------------------------------------------------------------------------<br> 
    41  * CADClientPort The port number to use for remote CAD Client connections.<br> 
    42  * CoordinatorRMIPort The port number to use for binding the Coordinator.<br> 
    43  * CMSDiversionXML The filepath for the xml file containing initialization data 
    44  * for the Diversion "database." AudioFileLocation The root directory path where 
    45  * audio files are referenced from.<br> 
    46  * ParamicsProperties The filepath for the properties file to initialize the 
    47  * ParamicsControlManager.<br> 
    48  * ATMSProperties The filepath for the properties file to initialize the 
    49  * ATMSManager.<br> 
    50  * MediaProperties The filepath for the properties file to initialize the 
    51  * MediaManager.<br> 
    52  * ErrorFile The filename of the error file used for logging errors.<br> 
    53  * ----------------------------------------------------------------------------<br> 
    54  * Example File:<br> 
    55  * CADClientPort = 4444<br> 
    56  * CoordinatorRMIPort = 4445<br> 
    57  * CMSDiversionXML = ../data/cmsdiversions.xml<br> 
    58  * AudioFileLocation = ../audio/<br> 
    59  * ParamicsProperties = ../config/paramics.properties<br> 
    60  * ATMSProperties = ../config/atms.properties<br> 
    61  * MediaProperties = ../config/media.properties<br> 
    62  * ErrorFile = cad_sim_error.xml<br> 
    63  * </code> 
    64  * 
    65  * @author Matthew Cechini (mcechini@calpoly.edu) jdalbey 
     41 * @author Matthew Cechini (mcechini@calpoly.edu) 
     42 * @author John Dalbey (jdalbey@calpoly.edu) 
    6643 * @version $Date: 2009/04/17 16:27:46 $ $Revision: 1.5 $ 
    6744 */ 
     
    6946{ 
    7047 
    71     private static String CONFIG_FILE_NAME = "cad_simulator_config.properties"; 
     48    private static String CONFIG_FILE_NAME = "cad_server.properties"; 
    7249    /** 
    7350     * Error logger. 
     
    7653 
    7754    /** 
    78      * Enumeration containing properties name values. See CADSimulator class 
     55     * Enumeration containing properties name values. See CADServer class 
    7956     * description for more information. 
    8057     * 
     
    149126    /** NOTE: Protected fields are accessed by Coordinator */ 
    150127    /** 
    151      * CADSimulatorViewer instance. 
     128     * CADServerViewer instance. 
    152129     */ 
    153130    protected static CADViewer theViewer; 
     
    189166     
    190167    /** 
    191      * Properties file for the CADSimulator. 
     168     * Properties file for the CADServer, read from CONFIG_FILE_NAME. 
    192169     */ 
    193170    private Properties cadServerProperties; 
     
    211188            cadServerProperties = new Properties(); 
    212189            cadServerProperties.load(new FileInputStream(propertiesFile)); 
    213             cadSimLogger.logp(Level.INFO, "CADSimulator", "Constructor", 
     190            cadSimLogger.logp(Level.INFO, "CADServer", "Constructor", 
    214191                    "Properties loaded from " + propertiesFile); 
    215192        } catch (Exception e) 
    216193        { 
    217             cadSimLogger.logp(Level.SEVERE, "CADSimulator", "Constructor", 
     194            cadSimLogger.logp(Level.SEVERE, "CADServer", "Constructor", 
    218195                    "Exception in reading properties file.", e); 
    219196            JOptionPane.showMessageDialog(new JWindow(), e.getMessage() + 
     
    233210            if (userInterfaceName == null) 
    234211            { 
    235                 cadSimLogger.logp(Level.SEVERE, "CADSimulator", "Constructor", 
     212                cadSimLogger.logp(Level.SEVERE, "CADServer", "Constructor", 
    236213                        propertiesFile + " missing property for user interface."); 
    237214                throw new SimulationException(SimulationException.PROPERTY_MISSING_ERROR); 
     
    244221            } catch (Exception exc) 
    245222            { 
    246                 cadSimLogger.logp(Level.SEVERE, "CADSimulator", "Constructor", 
     223                cadSimLogger.logp(Level.SEVERE, "CADServer", "Constructor", 
    247224                        "Unable to instantiate user interface: " + userInterfaceName 
    248225                        + " " + exc); 
     
    257234            if (simTimeFilename == null) 
    258235            { 
    259                 cadSimLogger.logp(Level.SEVERE, "CADSimulator", "Constructor", 
     236                cadSimLogger.logp(Level.SEVERE, "CADServer", "Constructor", 
    260237                        propertiesFile + " missing property for " + CAD_PROPERTIES.ELAPSED_TIME_FILE.name); 
    261238                throw new SimulationException(SimulationException.PROPERTY_MISSING_ERROR); 
     
    267244            if (commentLogname == null) 
    268245            { 
    269                 cadSimLogger.logp(Level.SEVERE, "CADSimulator", "Constructor", 
     246                cadSimLogger.logp(Level.SEVERE, "CADServer", "Constructor", 
    270247                        propertiesFile + " missing property for " + CAD_PROPERTIES.CAD_COMMENTS_LOG.name); 
    271248                throw new SimulationException(SimulationException.PROPERTY_MISSING_ERROR); 
     
    317294        } catch (RemoteException e) 
    318295        { 
    319             cadSimLogger.logp(Level.SEVERE, "CADSimulator", "Constructor", 
     296            cadSimLogger.logp(Level.SEVERE, "CADServer", "Constructor", 
    320297                    "Exception in starting Coordinator.", e); 
    321298 
     
    336313        } catch (Exception e) 
    337314        { 
    338             cadSimLogger.logp(Level.SEVERE, "CADSimulator", "Constructor", 
     315            cadSimLogger.logp(Level.SEVERE, "CADServer", "Constructor", 
    339316                    "Exception in parsing CMSDiversion xml file.", e); 
    340317 
     
    472449        } catch (Exception e) 
    473450        { 
    474             cadSimLogger.logp(Level.SEVERE, "CADSimulator", "Main", 
     451            cadSimLogger.logp(Level.SEVERE, "CADServer", "Main", 
    475452                    "Error initializing application.", e); 
    476453 
  • trunk/src/tmcsim/cadsimulator/viewer/ConfigStatusTab.java

    r455 r664  
    132132        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 
    133133        frame.setSize(1050, 450); 
    134         ConfigStatusTab pnl = new ConfigStatusTab("config/cad_simulator_config.properties"); 
     134        ConfigStatusTab pnl = new ConfigStatusTab("config/cad_server.properties"); 
    135135        frame.add(pnl); 
    136136        frame.setVisible(true); 
  • trunk/src/tmcsim/paramicslog/ParamicsLog.java

    r47 r664  
    5656        } 
    5757    } 
    58     private static final String CONFIG_FILE_NAME = "paramics_communicator_logging.properties"; 
     58    private static final String CONFIG_FILE_NAME = "logging_paramics_communicator.properties"; 
    5959    /** 
    6060     * Error logger. 
  • trunk/src/tmcsim/paramicslog/ParamicsLogFileHandler.java

    r47 r664  
    8888    public static ParamicsLogFileHandler getInstance() throws IOException 
    8989    { 
    90         System.setProperty("PARAMICS_LOG_PROPERTIES", "config/paramics_communicator_logging.properties"); 
     90        System.setProperty("PARAMICS_LOG_PROPERTIES", "config/logging_paramics_communicator.properties"); 
    9191        // Has an instance been created yet? 
    9292        if (instance == null) 
  • trunk/src/tmcsim/simulationmanager/SimulationManager.java

    r658 r664  
    2222 * communicator and applying diversions. A history of all events is shown as 
    2323 * well.<br> 
    24  * The SimulationManager may be started at any point before, during, or after a 
    25  * simulation has begun. The SimulationManager connects to the CADSimulator and 
     24 * The CADServer must be running before the SimulationManager is started.  
     25 * SimulationManager connects to the CADServer and 
    2626 * communicates through Java RMI methods. If two SimulationManagers are started, 
    2727 * the second one started, chronologically, will receive communication from the 
    28  * CADSimulator. <br><br> 
    29  * The properties file for the SimulationManager class contains the following 
    30  * data.<br> 
    31  * <code> 
    32  * -----------------------------------------------------------------------------<br> 
    33  * Host Name The host name where the CADSimulator is located.<br> 
    34  * Error File The target file to use for error logging.<br> 
    35  * -----------------------------------------------------------------------------<br> 
    36  * Example File: <br> 
    37  * CADSimulatorHost = localhost <br> 
    38  * ErrorFile = sim_mgr_error.xml <br> 
    39  * -----------------------------------------------------------------------------<br> 
    40  * </code> 
     28 * CADServer. (It's a bad idea to do this, there's no normal use case 
     29 * that requires it.)<br><br> 
    4130 * 
    4231 * @author Matthew Cechini (mcechini@calpoly.edu) 
     
    4635{ 
    4736 
    48     private static final String CONFIG_FILE_NAME = "sim_manager_config.properties"; 
     37    private static final String CONFIG_FILE_NAME = "sim_manager.properties"; 
    4938    /* 
    5039     * Default name of folder that contains Scenario xml files. 
     
    6554    { 
    6655 
    67         CAD_SIM_HOST("CADSimulatorHost"), 
    68         CAD_SIM_PORT("CADSimulatorRMIPort"), 
     56        CAD_SERVER_HOST("CADServerHost"), 
     57        CAD_SERVER_PORT("CADServerRMIPort"), 
    6958        SCENARIOS_DIR("ScenariosDir"), 
    7059        FAKE_PARAMICS("FakeParamicsConnection"); 
     
    116105 
    117106            //make sure properties aren't null 
    118             if (simManagerProperties.getProperty(PROPERTIES.CAD_SIM_HOST.name) == null) 
     107            if (simManagerProperties.getProperty(PROPERTIES.CAD_SERVER_HOST.name) == null) 
    119108            { 
    120109                throw new Exception("CAD Simulator host property is null."); 
    121110            } 
    122111 
    123             if (simManagerProperties.getProperty(PROPERTIES.CAD_SIM_PORT.name) == null) 
     112            if (simManagerProperties.getProperty(PROPERTIES.CAD_SERVER_PORT.name) == null) 
    124113            { 
    125114                throw new Exception("CAD Simulator port property is null."); 
     
    138127        { 
    139128            theSimManagerModel = new SimulationManagerModel( 
    140                     simManagerProperties.getProperty(PROPERTIES.CAD_SIM_HOST.name).trim(), 
    141                     simManagerProperties.getProperty(PROPERTIES.CAD_SIM_PORT.name).trim()); 
     129                    simManagerProperties.getProperty(PROPERTIES.CAD_SERVER_HOST.name).trim(), 
     130                    simManagerProperties.getProperty(PROPERTIES.CAD_SERVER_PORT.name).trim()); 
    142131 
    143132            //Construct the SimulationManagerView and set up the Model-View references. 
  • trunk/test/tmcsim/cadsimulator/CADSimulatorConsoleDriver.java

    r658 r664  
    3131            + "ParamicsProperties     = pconfig.txt\n" 
    3232            + "ATMSProperties         = empty.txt\n" 
    33             + "MediaProperties        = empty.txt\n"; 
     33            + "MediaProperties        = empty.txt\n" 
     34            + "TrafficMgrProperties   = config/traffic_model_config/traffic_model_config.properties\n" 
     35            + "ElapsedTimeFile        = webapps/dynamicdata/sim_elapsedtime.json\n" 
     36            + "CADcommentsLog         = webapps/dynamicdata/CADcomments.log\n"; 
    3437    static final String paramicsData = "ParamicsCommHost       = 192.168.251.45\n" 
    3538            + "ParamicsCommPort       = 4450\n" 
  • trunk/test/tmcsim/cadsimulator/CADSimulatorGUITest.java

    r658 r664  
    7878                    try 
    7979                    { 
    80                         app = new CADServer(System.getProperty("CONFIG_DIR") + System.getProperty("file.separator") + "cad_simulator_config.properties"); 
     80                        app = new CADServer(System.getProperty("CONFIG_DIR") + System.getProperty("file.separator") + "cad_server.properties"); 
    8181 
    8282                    } catch (Exception e) 
  • trunk/test/tmcsim/cadsimulator/SystemConsoleTest.java

    r658 r664  
    5353        try 
    5454        { 
    55             engine = new CADServer("config/cad_simulator_console_config.properties"); 
     55            engine = new CADServer("config/cad_server_console.properties"); 
    5656        } catch (Exception e) 
    5757        { 
     
    7474                try 
    7575                { 
    76                     simMgrApp = new SimulationManager("config/sim_manager_systest_config.properties"); 
     76                    simMgrApp = new SimulationManager("config/sim_manager.properties"); 
    7777                } catch (Exception ex) 
    7878                { 
  • trunk/test/tmcsim/cadsimulator/SystemTest.java

    r658 r664  
    1919/** 
    2020 * System test (include CADSimulator) with emulated Paramics Modeler NO ATMS 
    21  * server captures GUI display using UISpec4J. 
     21 * server. Captures GUI display using UISpec4J. 
    2222 * 
    2323 * @author jdalbey 
     
    5454                try 
    5555                { 
    56                     engine = new CADServer("config/cad_simulator_config.properties"); 
     56                    engine = new CADServer("config/cad_server.properties"); 
    5757                } catch (Exception e) 
    5858                { 
     
    8282                try 
    8383                { 
    84                     simMgrApp = new SimulationManager("config/sim_manager_systest_config.properties"); 
     84                    simMgrApp = new SimulationManager("config/sim_manager.properties"); 
    8585                } catch (Exception ex) 
    8686                { 
  • trunk/test/tmcsim/cadsimulator/viewer/CADConsoleViewerTest.java

    r657 r664  
    2828    { 
    2929        super.setUp(); 
    30         console = new CADConsoleViewer("config/cad_simulator_config.properties"); 
     30        console = new CADConsoleViewer("config/cad_server.properties"); 
    3131        cadmodel = new CADSimulatorState(); 
    3232        cadmodel.addObserver(console); 
  • trunk/test/tmcsim/cadsimulator/viewer/CADSimulatorViewModelTest.java

    r455 r664  
    3030    { 
    3131        super.setUp(); 
    32         viewer = new CADServerViewer("config/cad_simulator_config.properties"); 
     32        viewer = new CADServerViewer("config/cad_server.properties"); 
    3333        cadwindow = new Window(viewer); 
    3434        model = new CADSimulatorState(); 
  • trunk/test/tmcsim/highwaymodel/ConsoleTrafficDriver.java

    r457 r664  
    1919 
    2020/** 
    21  * A console application to drive the ATMS Server. 
     21 * A console application to drive the ATMS Server (is this really CPTMS now?). 
    2222 * Use for test driving the Highway Model. 
    2323 * 
  • trunk/test/tmcsim/highwaymodel/runtraffic.bash

    r457 r664  
    11#!/bin/bash 
    22 
    3 java -DATMSDRIVER_PROPERTIES=config/console_driver_config.properties -jar deploy/ConsoleTrafficDriver.jar << EOF 
     3java -DATMSDRIVER_PROPERTIES=config/test_trafficdriver.properties -jar deploy/ConsoleTrafficDriver.jar << EOF 
    445 S 10 24.0 Y 
    55A 
  • trunk/test/tmcsim/paramicslog/ParamicsLogFileHandlerTest.java

    r422 r664  
    3333        super.setUp(); 
    3434    } 
    35     String propsfile = "config/paramics_communicator_logging.properties"; 
     35    String propsfile = "config/logging_paramics_communicator.properties"; 
    3636 
    3737    /** 
     
    4343        try 
    4444        { 
    45             new CADServer("config/cad_simulator_console_config.properties"); 
     45            new CADServer("config/cad_server_console.properties"); 
    4646        } catch (Exception e) 
    4747        { 
  • trunk/test/tmcsim/paramicslog/ParamicsLogRMITestSkeleton.java

    r422 r664  
    3434        super.setUp(); 
    3535    } 
    36     String propsfile = "config/paramics_communicator_logging.properties"; 
     36    String propsfile = "config/logging_paramics_communicator.properties"; 
    3737 
    3838    /** 
     
    4444        try 
    4545        { 
    46             CADServer engine = new CADServer("config/cad_simulator_console_config.properties"); 
     46            CADServer engine = new CADServer("config/cad_server_console.properties"); 
    4747        } catch (Exception e) 
    4848        { 
  • 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.