Changeset 50 in tmcsimulator


Ignore:
Timestamp:
07/02/2016 03:41:05 PM (10 years ago)
Author:
jdalbey
Message:

ParamicsLogFileHandlerTest?.java: Revised to use CADSimulator so no log errors are written.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/tmcsim/application.properties

    r49 r50  
    1 #Sat, 02 Jul 2016 09:45:14 -0700 
     1#Sat, 02 Jul 2016 16:19:54 -0700 
    22 
    3 Application.revision=47 
     3Application.revision=49 
    44 
    55Application.buildnumber=19 
  • trunk/test/tmcsim/paramicslog/ParamicsLogFileHandlerTest.java

    r47 r50  
    1010import static junit.framework.Assert.assertEquals; 
    1111import static junit.framework.Assert.assertTrue; 
     12import static junit.framework.Assert.fail; 
    1213import junit.framework.TestCase; 
     14import tmcsim.cadsimulator.CADSimulator; 
    1315import tmcsim.common.ScriptException; 
    1416import tmcsim.common.SimulationException; 
     
    3941    { 
    4042        System.out.println("getInstance"); 
     43        try 
     44        { 
     45            new CADSimulator("config/testConfig/cad_simulator_console_config.properties"); 
     46        } catch (Exception e) 
     47        { 
     48            fail("Couldn't launch CADSimulator"); 
     49        } 
    4150        //ParamicsLog plog = ParamicsLog.getInstance(); 
    4251        Properties paramicsLogProp = new Properties(); 
    4352        paramicsLogProp.load(new FileInputStream(propsfile)); 
    4453        String logFilename = paramicsLogProp.getProperty("LogFile"); 
    45         // This test assumes there is NO CADSimulator running. 
     54        // This test requires a CADSimulator running. 
    4655        Logger logger = Logger.getLogger("tmcsim.parmicsLog"); 
    4756        ParamicsLogFileHandler fh = ParamicsLogFileHandler.getInstance(); 
    4857        logger.addHandler(fh); 
     58        // write a message to the log. 
    4959        logger.info("Hello friendly log."); 
     60        // Read from the log file and see if the desired msg is there. 
    5061        File logFile = new File(logFilename); 
    5162        assertTrue("log file doesn't exist", logFile.exists()); 
    52         String expected = "\n<!-- Time written to file: ? -->\nHello friendly log.\n"; 
     63        String expected = "\n<!-- Time written to file: 00:00:00 -->\nHello friendly log.\n"; 
    5364        String actual = fh.getLog(); 
    5465        assertEquals("log written incorrectly", expected, actual); 
Note: See TracChangeset for help on using the changeset viewer.