Changeset 5 in tmcsimulator


Ignore:
Timestamp:
04/16/2016 12:54:43 PM (10 years ago)
Author:
jdalbey
Message:

CADSimulatorTest: added test of info messages text area.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/tmcsim/cadsimulator/CADSimulator.java

    r2 r5  
    7070     
    7171    /** Error logger. */ 
    72     private static Logger cadSimLogger = Logger.getLogger("tmcsim.simulationmanager"); 
     72    private static Logger cadSimLogger = Logger.getLogger("tmcsim.cadsimulator"); 
    7373 
    7474    /** 
     
    161161        //Create the Coordinator and register it for RMI communicator.  Start the 
    162162        //CAD Simulator Socket Handler to begin to accept connections from CAD Clients. 
    163         try {          
     163        try { 
    164164            theViewer             = new CADSimulatorViewer(); 
    165165            theCoordinator        = new Coordinator(); 
  • trunk/src/tmcsim/cadsimulator/viewer/SimulationStatusPanel.java

    r2 r5  
    393393        infoMessagesTA = new JTextArea(6, 30); 
    394394        infoMessagesTA.setEditable(false); 
    395         infoMessagesPane = new JScrollPane(errorMessagesTA); 
     395        infoMessagesTA.setName("infoMessagesTA"); 
     396        infoMessagesPane = new JScrollPane(infoMessagesTA); 
    396397        infoMessagesPane.setPreferredSize(new Dimension(300, 100)); 
    397398         
    398399        infoMessagesPane.setBorder(BorderFactory.createTitledBorder( 
    399400                BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), "Info Messages"));   
    400  
     401        infoMessagesPane.setName("infoMessagesPane"); 
    401402         
    402403        errorMessagesTA = new JTextArea(6, 30); 
  • trunk/test/tmcsim/cadsimulator/CADSimulatorTest.java

    r4 r5  
    22 
    33import java.rmi.RemoteException; 
     4import java.util.logging.Level; 
     5import java.util.logging.Logger; 
     6import javax.swing.JScrollPane; 
    47import static junit.framework.Assert.assertEquals; 
    58import static junit.framework.Assert.fail; 
     
    6770                    { 
    6871                        app = new CADSimulator(System.getProperty("CAD_SIM_PROPERTIES")); 
    69                     } catch (Exception e) 
     72                    } 
     73                    catch (Exception e) 
    7074                    { 
    7175                        fail("Couldn't launch CADSimulator"); 
     
    7377                } 
    7478            }); 
    75         } else 
     79        } 
     80        else 
    7681        { 
    7782            fail("CAD_SIM_PROPERTIES system property not defined."); 
     
    9095        app.theCoordinator.registerForCallback(ci); 
    9196        assertEquals("2", terminals.getText().trim()); 
    92          
     97 
    9398        SimulationManagerInterface si = new CADSimulatorTest.FakeSimMgr(); 
    9499        app.theCoordinator.registerForCallback(si); 
    95100        assertEquals("Yes", mainPanel.getTextBox("managerConnectedTF").getText().trim()); 
    96          
     101 
     102        Logger cadSimLogger = Logger.getLogger("tmcsim.cadsimulator"); 
     103        cadSimLogger.logp(Level.INFO, "", "", "Sample Info Message."); 
     104 
     105        Panel infoPane = mainPanel.getPanel("InfoMessagesPane"); 
     106        TextBox infoText = infoPane.getTextBox("infoMessagesTA"); 
     107        assertEquals(". = Sample Info Message.\n", infoText.getText()); 
     108 
    97109        app = null; 
    98 //        app.theViewer.dispose(); 
    99 //        Window confirmPopup = null; 
    100 //        confirmPopup = WindowInterceptor.run(new Trigger() 
    101 //        { 
    102 //            public void run() 
    103 //            { 
    104 //                app.theViewer.closeViewer(); 
    105 //            } 
    106 //        }); 
    107 //        confirmPopup.getButton("OK").click(); 
    108110    } 
    109111 
    110     class FakeClient implements CADClientInterface  
     112    class FakeClient implements CADClientInterface 
    111113    { 
     114 
    112115        @Override 
    113116        public void refresh() throws RemoteException 
     
    115118            throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. 
    116119        } 
    117      
    118120    } 
     121 
    119122    class FakeSimMgr implements SimulationManagerInterface 
    120123    { 
     124 
    121125        @Override 
    122126        public void tick(long theTime) throws RemoteException 
     
    160164            throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. 
    161165        } 
    162      
    163166    } 
    164      
    165      
    166167} 
Note: See TracChangeset for help on using the changeset viewer.