Changeset 422 in tmcsimulator for trunk/test
- Timestamp:
- 06/23/2019 10:27:35 AM (7 years ago)
- Location:
- trunk/test
- Files:
-
- 1 added
- 9 edited
- 6 copied
-
atmsdriver/TrafficModelEventDriver.java (modified) (2 diffs)
-
tmcsim/cadsimulator/CADSimulatorConsoleTest.java (modified) (2 diffs)
-
tmcsim/cadsimulator/CADSimulatorGUITest.java (modified) (1 diff)
-
tmcsim/cadsimulator/SystemConsoleTest.java (modified) (3 diffs)
-
tmcsim/cadsimulator/SystemTest.java (modified) (3 diffs)
-
tmcsim/cadsimulator/VisibleSystemDemoDriver.java (modified) (1 diff)
-
tmcsim/cadsimulator/managers/TrafficModelManagerTest.java (modified) (1 diff)
-
tmcsim/highwaymodel (added)
-
tmcsim/highwaymodel/HighwayTest.java (copied) (copied from trunk/test/atmsdriver/model/HighwayTest.java) (1 diff)
-
tmcsim/highwaymodel/HighwaysTest.java (copied) (copied from trunk/test/atmsdriver/model/HighwaysTest.java) (6 diffs)
-
tmcsim/highwaymodel/LoadHighwaysTest.java (copied) (copied from trunk/test/atmsdriver/model/LoadHighwaysTest.java) (7 diffs)
-
tmcsim/highwaymodel/PostmileCoordsTest.java (copied) (copied from trunk/test/atmsdriver/model/PostmileCoordsTest.java) (1 diff)
-
tmcsim/highwaymodel/StationTest.java (copied) (copied from trunk/test/atmsdriver/model/StationTest.java) (2 diffs)
-
tmcsim/highwaymodel/TrafficEventTest.java (copied) (copied from trunk/test/atmsdriver/model/TrafficEventTest.java) (1 diff)
-
tmcsim/paramicslog/ParamicsLogFileHandlerTest.java (modified) (1 diff)
-
tmcsim/paramicslog/ParamicsLogRMITestSkeleton.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/atmsdriver/TrafficModelEventDriver.java
r343 r422 1 1 package atmsdriver; 2 2 3 import atmsdriver.model.Highways;4 import atmsdriver.model.TrafficEvent;3 import tmcsim.highwaymodel.Highways; 4 import tmcsim.highwaymodel.TrafficEvent; 5 5 import java.io.FileInputStream; 6 6 import java.io.FileNotFoundException; … … 63 63 incidents = new HashMap<String, List<TrafficEvent>>(); 64 64 highways = new Highways( 65 "config/vds_data/highways_fullmap.txt", 66 // following aren't used by this application 67 "localhost", 8080); 65 "config/vds_data/highways_fullmap.txt"); 68 66 final String CONFIG_FILE_NAME = "traffic_model_config.properties"; 69 67 String propertiesFile = "config" + System.getProperty("file.separator") -
trunk/test/tmcsim/cadsimulator/CADSimulatorConsoleTest.java
r345 r422 60 60 removeMe.delete(); 61 61 removeMe = new File("pconfig.txt"); 62 removeMe.delete(); 63 removeMe = new File("tconfig.txt"); 62 64 removeMe.delete(); 63 65 removeMe = new File("empty.txt"); … … 272 274 + "ATMSProperties = empty.txt\n" 273 275 + "TrafficMgrProperties = tconfig.txt\n" 274 + "MediaProperties = empty.txt\n"; 275 static final String trafficMgrData = "Highways_Map_File = config/vds_data/highways_fullmap.txt\n" 276 + "MediaProperties = empty.txt\n" 277 + "ElapsedTimeFile = webapps/dynamicdata/sim_elapsedtime.json"; 278 static final String trafficMgrData = "Highways_Map_File = config/vds_data/postmile_coordinates.txt\n" 276 279 +"Events_File = config/vds_data/atmsBatchEvents.txt\n" 277 280 +"FEPSim_IP_addr = localhost\n" 278 281 +"Output_Destination = Console\n" 279 +" Json_Path= /tmp/highway_status.json\n";282 +"Highway_Status_File = /tmp/highway_status.json\n"; 280 283 static final String paramicsData = "ParamicsCommHost = 127.0.0.1\n" 281 284 + "ParamicsCommPort = 4450\n" -
trunk/test/tmcsim/cadsimulator/CADSimulatorGUITest.java
r228 r422 68 68 // } 69 69 70 System.setProperty("CONFIG_DIR", "config/ testConfig");70 System.setProperty("CONFIG_DIR", "config/"); 71 71 if (System.getProperty("CONFIG_DIR") != null) 72 72 { -
trunk/test/tmcsim/cadsimulator/SystemConsoleTest.java
r123 r422 52 52 try 53 53 { 54 engine = new CADServer("config/ testConfig/cad_simulator_console_config.properties");54 engine = new CADServer("config/cad_simulator_console_config.properties"); 55 55 } catch (Exception e) 56 56 { … … 59 59 60 60 ParamicsCommunicator pc = null; 61 pc = new ParamicsCommunicator("config/ testConfig/paramics_communicator_config.properties");61 pc = new ParamicsCommunicator("config/paramics_communicator_config.properties"); 62 62 ParamicsCommunicatorGUI theGUI = new ParamicsCommunicatorGUI(); 63 63 pc.setGUI(theGUI); … … 145 145 { 146 146 } 147 assertEquals("Network 1 Loaded", txtParamStatus.getText());148 System.out.println("Network Loaded Passed");147 //assertEquals("Network 1 Loaded", txtParamStatus.getText()); 148 //System.out.println("Network Loaded Passed"); 149 149 150 150 // Load a script file -
trunk/test/tmcsim/cadsimulator/SystemTest.java
r210 r422 53 53 try 54 54 { 55 engine = new CADServer("config/ testConfig/cad_simulator_config.properties");55 engine = new CADServer("config/cad_simulator_config.properties"); 56 56 } catch (Exception e) 57 57 { … … 72 72 73 73 ParamicsCommunicator pc = null; 74 pc = new ParamicsCommunicator("config/ testConfig/paramics_communicator_config.properties");74 pc = new ParamicsCommunicator("config/paramics_communicator_config.properties"); 75 75 ParamicsCommunicatorGUI theGUI = new ParamicsCommunicatorGUI(); 76 76 pc.setGUI(theGUI); … … 158 158 { 159 159 } 160 assertEquals("Network 1 Loaded", txtParamStatus.getText());161 assertEquals("network id should be 1", "1", mainPanel.getTextBox("networkLoadedTF").getText().trim());160 //assertEquals("Network 1 Loaded", txtParamStatus.getText()); 161 //assertEquals("network id should be 1", "1", mainPanel.getTextBox("networkLoadedTF").getText().trim()); 162 162 163 163 -
trunk/test/tmcsim/cadsimulator/VisibleSystemDemoDriver.java
r52 r422 48 48 49 49 ParamicsCommunicator pc = null; 50 pc = new ParamicsCommunicator("config/ testConfig/paramics_communicator_config.properties");50 pc = new ParamicsCommunicator("config/paramics_communicator_config.properties"); 51 51 ParamicsCommunicatorGUI theGUI = new ParamicsCommunicatorGUI(); 52 52 pc.setGUI(theGUI); -
trunk/test/tmcsim/cadsimulator/managers/TrafficModelManagerTest.java
r220 r422 2 2 package tmcsim.cadsimulator.managers; 3 3 4 import atmsdriver.model.TrafficEvent;4 import tmcsim.highwaymodel.TrafficEvent; 5 5 import java.text.ParseException; 6 6 import java.util.LinkedList; -
trunk/test/tmcsim/highwaymodel/HighwayTest.java
r343 r422 1 1 2 package atmsdriver.model;2 package tmcsim.highwaymodel; 3 3 4 import atmsdriver.model.Station.DIRECTION; 4 import tmcsim.highwaymodel.LoopDetector; 5 import tmcsim.highwaymodel.Station; 6 import tmcsim.highwaymodel.Highway; 7 import tmcsim.highwaymodel.Station.DIRECTION; 5 8 import java.util.ArrayList; 6 9 import java.util.Set; -
trunk/test/tmcsim/highwaymodel/HighwaysTest.java
r354 r422 1 package atmsdriver.model;2 3 import archive.ATMSDriver;4 import atmsdriver.model.LoopDetector.DOTCOLOR;5 import atmsdriver.model.Station.DIRECTION;6 import java.io.File;1 package tmcsim.highwaymodel; 2 3 import tmcsim.highwaymodel.LoopDetector; 4 import tmcsim.highwaymodel.Station; 5 import tmcsim.highwaymodel.Highways; 6 import tmcsim.highwaymodel.Station.DIRECTION; 7 7 import java.io.FileWriter; 8 8 import java.io.PrintWriter; … … 31 31 PrintWriter writer = null; 32 32 try { 33 writer = new PrintWriter(new FileWriter("test/atmsdriver/model/ldssample.txt")); 34 writer.println("2"); 35 writer.println("32 0 2"); 36 writer.println("1210831 1 5 S 0.9 4 CALAFIA"); 37 writer.println("1210832 ML ML_1"); 38 writer.println("1210833 ML ML_2"); 39 writer.println("1210834 ML ML_3"); 40 writer.println("1210835 ML ML_4"); 41 writer.println("1210845 2 5 S 1.49 4 EL CAMINO REAL"); 42 writer.println("1210846 ML ML_1"); 43 writer.println("1210847 ML ML_2"); 44 writer.println("1210848 ML ML_3"); 45 writer.println("1210849 ML ML_4"); 46 writer.println("74 0 1"); 47 writer.println("1204203 2 5 N 1.26 4 MAGDALENA"); 48 writer.println("1204212 ML ML_1"); 49 writer.println("1204213 ML ML_2"); 50 writer.println("1204214 ML ML_3"); 51 writer.println("1204215 ML ML_4"); 33 writer = new PrintWriter(new FileWriter("test/atmsdriver/postmiles1.txt")); 34 writer.println("5 S 0.9,33.408425,-117.599923,CALAFIA,0,0"); 35 writer.println("5 N 1.24,33.413051,-117.601964,MAGDALENA,0,0"); 36 writer.println("5 S 1.49,33.416348,-117.603827,EL CAMINO REAL,0,0"); 52 37 writer.close(); 53 54 writer = new PrintWriter(new FileWriter("test/atmsdriver/model/ldssample2.txt")); 55 writer.println("1"); 56 writer.println("44 0 6"); 57 writer.println("1204390 6 5 S 7.99 5 AEROPUERTO"); 58 writer.println("1204391 ML ML_1"); 59 writer.println("1204392 ML ML_2"); 60 writer.println("1204393 ML ML_3"); 61 writer.println("1204394 ML ML_4"); 62 writer.println("1210062 ML ML_5"); 63 writer.println("1204384 5 5 N 7.46 4 CAPISTRANO"); 64 writer.println("1204385 ML ML_1"); 65 writer.println("1204386 ML ML_2"); 66 writer.println("1204387 ML ML_3"); 67 writer.println("1204388 ML ML_4"); 68 writer.println("1204316 1 5 N 5.73 4 ESTRELLA1"); 69 writer.println("1204317 ML ML_1"); 70 writer.println("1204318 ML ML_2"); 71 writer.println("1204319 ML ML_3"); 72 writer.println("1204320 ML ML_4"); 73 writer.println("1204340 3 5 N 6.47 4 SACRAMENTO"); 74 writer.println("1204341 ML ML_1"); 75 writer.println("1204342 ML ML_2"); 76 writer.println("1204343 ML ML_3"); 77 writer.println("1204344 ML ML_4"); 78 writer.println("1204345 3 5 S 6.47 5 SACRAMENTO"); 79 writer.println("1204346 OS OS_1"); 80 writer.println("1204347 OS OS_2"); 81 writer.println("1204348 OS OS_3"); 82 writer.println("1204349 OS OS_4"); 83 writer.println("1204350 OS OS_5"); 84 writer.println("1211075 5 5 S 7.46 5 CAPISTRANO"); 85 writer.println("1211069 OS OS_1"); 86 writer.println("1211070 OS OS_2"); 87 writer.println("1211071 OS OS_3"); 88 writer.println("1211072 OS OS_4"); 89 writer.println("1211073 OS OS_5"); 38 39 writer = new PrintWriter(new FileWriter("test/atmsdriver/postmiles2.txt")); 40 writer.println("5 N 5.89,33.459637,-117.657305,ESTRELLA2,0,0"); 41 writer.println("5 S 6.47,33.464281,-117.665631,SACRAMENTO,-0.56275,-0.826627"); 42 writer.println("5 N 6.47,33.464404,-117.665509,SACRAMENTO,0.523797,0.851843"); 43 writer.println("5 S 7.46,33.475102,-117.674584,CAPISTRANO,-0.815879,0.578222"); 44 writer.println("5 N 7.46,33.475073,-117.674271,CAPISTRANO,0.816519,-0.577318"); 45 writer.println("5 S 7.99,33.481738,-117.669881,AEROPUERTO,-0.815879,0.578222"); 46 writer.println("5 N 7.99,33.481685,-117.669596,AEROPUERTO,0.816519,-0.577318"); 90 47 writer.close(); 91 48 92 writer = new PrintWriter(new FileWriter("test/atmsdriver/model/ldssample3.txt")); 93 writer.println("1"); 94 writer.println("44 0 6"); 95 writer.println("1204390 6 73 N 23.9 5 BISON 2"); 96 writer.println("1204391 ML ML_1"); 97 writer.println("1204392 ML ML_2"); 98 writer.println("1204393 ML ML_3"); 99 writer.println("1204394 ML ML_4"); 100 writer.println("1210062 ML ML_5"); 101 writer.println("1204384 2 55 S 6.88 4 MACARTHU1"); 102 writer.println("1204385 ML ML_1"); 103 writer.println("1204386 ML ML_2"); 104 writer.println("1204387 ML ML_3"); 105 writer.println("1204388 ML ML_4"); 106 writer.println("1204316 1 5 N 5.73 4 ESTRELLA1"); 107 writer.println("1204317 ML ML_1"); 108 writer.println("1204318 ML ML_2"); 109 writer.println("1204319 ML ML_3"); 110 writer.println("1204320 ML ML_4"); 111 writer.println("1204340 3 5 N 6.47 4 SACRAMENTO"); 112 writer.println("1204341 ML ML_1"); 113 writer.println("1204342 ML ML_2"); 114 writer.println("1204343 ML ML_3"); 115 writer.println("1204344 ML ML_4"); 116 writer.println("1204345 4 405 N 6.21 5 HARVARD"); 117 writer.println("1204346 OS OS_1"); 118 writer.println("1204347 OS OS_2"); 119 writer.println("1204348 OS OS_3"); 120 writer.println("1204349 OS OS_4"); 121 writer.println("1204350 OS OS_5"); 122 writer.println("1211075 5 405 S 6.8 5 JAMBOREE1"); 123 writer.println("1211069 OS OS_1"); 124 writer.println("1211070 OS OS_2"); 125 writer.println("1211071 OS OS_3"); 126 writer.println("1211072 OS OS_4"); 127 writer.println("1211073 OS OS_5"); 49 writer = new PrintWriter(new FileWriter("test/atmsdriver/postmiles3.txt")); 50 writer.println("73 N 23.9,33.643656,-117.859875,BISON 2,0.976131,0.217185"); 51 writer.println("55 S 6.88,33.697495,-117.862677,MACARTHU1,-0.710326,0.703873"); 52 writer.println("5 N 5.73,33.458342,-117.655008,ESTRELLA1,0,0"); 53 writer.println("5 N 6.47,33.464404,-117.665509,SACRAMENTO,0.523797,0.851843"); 54 writer.println("405 N 6.21,33.672851,-117.832271,HARVARD,0.320278,0.947323"); 55 writer.println("405 S 6.8,33.675863,-117.84179,JAMBOREE1,-0.402558,-0.915394"); 128 56 writer.close(); 129 57 } catch (Exception e) { … … 135 63 protected void tearDown() throws Exception { 136 64 super.tearDown(); 137 Path path = FileSystems.getDefault().getPath("test/atmsdriver /model", "ldssample.txt");65 Path path = FileSystems.getDefault().getPath("test/atmsdriver", "postmiles1.txt"); 138 66 Files.delete(path); 139 path = FileSystems.getDefault().getPath("test/atmsdriver /model", "ldssample2.txt");67 path = FileSystems.getDefault().getPath("test/atmsdriver", "postmiles2.txt"); 140 68 Files.delete(path); 141 path = FileSystems.getDefault().getPath("test/atmsdriver /model", "ldssample3.txt");69 path = FileSystems.getDefault().getPath("test/atmsdriver", "postmiles3.txt"); 142 70 Files.delete(path); 143 71 } 144 72 145 public void testFindStation() 146 { 73 public void testFindStation() { 147 74 System.out.println("test FindStation()"); 148 75 Highways highways = new Highways( 149 "test/atmsdriver/model/ldssample.txt", 150 "localhost", 8080); 76 "test/atmsdriver/postmiles1.txt"); 151 77 assertTrue(null != highways.findStation(5, DIRECTION.SOUTH, 0.9)); 152 78 assertTrue(null != highways.findStation(5, DIRECTION.SOUTH, 1.49)); 153 assertTrue(null != highways.findStation(5, DIRECTION.NORTH, 1.2 6));154 assertTrue(null == highways.findStation(5, DIRECTION.SOUTH, 1.1));155 } 79 assertTrue(null != highways.findStation(5, DIRECTION.NORTH, 1.24)); 80 } 81 156 82 /** 157 83 * Test of toString method … … 160 86 System.out.println("toString"); 161 87 Highways highways = new Highways( 162 "config/vds_data/highways_fullmap.txt", 163 "localhost", 8080); 88 "test/atmsdriver/postmiles2.txt"); 164 89 highways.getHighwayByRouteNumber(5).stations.get(0).loops.get(0).vol = 1; 165 90 String result = highways.toString(); 166 91 String[] resultLines = result.split("\n"); 167 String actual = resultLines[3].substring(0,9); 168 assertEquals(" 5 S @.-",actual); 169 highways.applyColorToHighwayStretch(241, Station.DIRECTION.NORTH, 18.8, 0.8, 170 LoopDetector.DOTCOLOR.RED); 171 result = highways.toString(); 172 System.out.println("bravo:\n"+result); 173 assertEquals("241 N -@.@@.-",result.substring(0,13)); 174 highways.applyColorToHighwayStretch(241, Station.DIRECTION.SOUTH, 18.8, 2.0, 92 String actual = resultLines[0]; 93 assertEquals(" 5 N @.-.-.-", actual); 94 highways.applyColorToHighwayStretch(5, Station.DIRECTION.NORTH, 7.99, 2.0, 175 95 LoopDetector.DOTCOLOR.YELLOW); 176 96 result = highways.toString(); 177 System.out.println("charly:\n"+result); 178 resultLines = result.split("\n"); 179 actual = resultLines[1].substring(0,16); 180 assertEquals("241 S ..-..+.++.",actual); 181 } 182 97 System.out.println("bravo:\n" + result); 98 assertEquals("5 N @.+.+.+\n 5 S .-.-.-.", result.trim()); 99 highways.applyColorToHighwayStretch(5, Station.DIRECTION.SOUTH, 6.47, 1.51, 100 LoopDetector.DOTCOLOR.YELLOW); 101 result = highways.toString(); 102 System.out.println("charly:\n" + result); 103 actual = result.trim(); 104 assertEquals("5 N @.+.+.+\n 5 S .+.+.-.", actual); 105 } 183 106 184 107 public void testToJson() throws ParseException { 185 108 System.out.println("toJson"); 186 109 Highways highways = new Highways( 187 "test/atmsdriver/model/ldssample.txt", 188 "localhost", 8080); 110 "test/atmsdriver/postmiles1.txt"); 189 111 String result = highways.toJson(); 190 112 System.out.println(result); … … 193 115 JSONObject obj = (JSONObject) parser.parse(result); 194 116 System.out.println(obj); 195 JSONArray array = (JSONArray) obj.get("features");196 JSONObject item1 = (JSONObject) array.get(0);117 JSONArray array = (JSONArray) obj.get("features"); 118 JSONObject item1 = (JSONObject) array.get(0); 197 119 String id1 = (String) item1.get("id"); 198 JSONObject item2 = (JSONObject) array.get(1);120 JSONObject item2 = (JSONObject) array.get(1); 199 121 String id2 = (String) item2.get("id"); 200 JSONObject item3 = (JSONObject) array.get(2);122 JSONObject item3 = (JSONObject) array.get(2); 201 123 String id3 = (String) item3.get("id"); 202 assertEquals("5 N 1.2 6", id1);124 assertEquals("5 N 1.24", id1); 203 125 assertEquals("5 S 0.9", id2); 204 126 assertEquals("5 S 1.49", id3); 205 127 } 128 206 129 public void testStationSort() throws ParseException { 207 130 System.out.println("stationSort"); 208 131 Highways highways = new Highways( 209 "test/atmsdriver/model/ldssample2.txt", 210 "localhost", 8080); 132 "test/atmsdriver/postmiles3.txt"); 211 133 String result = highways.toJson(); 212 134 JSONParser parser = new JSONParser(); 213 135 JSONObject obj = (JSONObject) parser.parse(result); 214 JSONArray array = (JSONArray) obj.get("features");215 JSONObject item1 = (JSONObject) array.get(0);136 JSONArray array = (JSONArray) obj.get("features"); 137 JSONObject item1 = (JSONObject) array.get(0); 216 138 String id1 = (String) item1.get("id"); 217 JSONObject item2 = (JSONObject) array.get(1);139 JSONObject item2 = (JSONObject) array.get(1); 218 140 String id2 = (String) item2.get("id"); 219 JSONObject item3 = (JSONObject) array.get(2);141 JSONObject item3 = (JSONObject) array.get(2); 220 142 String id3 = (String) item3.get("id"); 221 143 assertEquals("5 N 5.73", id1); 222 144 assertEquals("5 N 6.47", id2); 223 assertEquals("5 N 7.46", id3);224 JSONObject item4 = (JSONObject) array.get(3);145 assertEquals("55 S 6.88", id3); 146 JSONObject item4 = (JSONObject) array.get(3); 225 147 String id4 = (String) item4.get("id"); 226 JSONObject item5 = (JSONObject) array.get(4);148 JSONObject item5 = (JSONObject) array.get(4); 227 149 String id5 = (String) item5.get("id"); 228 assertEquals("5 S 6.47", id4); 229 assertEquals("5 S 7.46", id5); 230 } 150 assertEquals("73 N 23.9", id4); 151 assertEquals("405 N 6.21", id5); 152 } 153 231 154 public void testRouteSort() throws ParseException { 232 155 System.out.println("routeSort"); 233 156 Highways highways = new Highways( 234 "test/atmsdriver/model/ldssample3.txt", 235 "localhost", 8080); 157 "test/atmsdriver/postmiles3.txt"); 236 158 String result = highways.toJson(); 237 159 JSONParser parser = new JSONParser(); 238 160 JSONObject obj = (JSONObject) parser.parse(result); 239 JSONArray array = (JSONArray) obj.get("features");240 JSONObject item1 = (JSONObject) array.get(0);161 JSONArray array = (JSONArray) obj.get("features"); 162 JSONObject item1 = (JSONObject) array.get(0); 241 163 String id1 = (String) item1.get("id"); 242 JSONObject item2 = (JSONObject) array.get(1);164 JSONObject item2 = (JSONObject) array.get(1); 243 165 String id2 = (String) item2.get("id"); 244 JSONObject item3 = (JSONObject) array.get(2);166 JSONObject item3 = (JSONObject) array.get(2); 245 167 String id3 = (String) item3.get("id"); 246 JSONObject item4 = (JSONObject) array.get(3);168 JSONObject item4 = (JSONObject) array.get(3); 247 169 String id4 = (String) item4.get("id"); 248 JSONObject item5 = (JSONObject) array.get(4);170 JSONObject item5 = (JSONObject) array.get(4); 249 171 String id5 = (String) item5.get("id"); 250 172 assertEquals("5 N 5.73", id1); … … 254 176 assertEquals("405 N 6.21", id5); 255 177 } 256 257 public void testApplyColor() 258 { 178 179 public void testApplyColor() { 259 180 System.out.println("apply color"); 260 181 Highways highways = new Highways( 261 "test/atmsdriver/model/ldssample.txt", 262 "localhost", 8080); 263 highways.applyColorToHighwayStretch(5, Station.DIRECTION.SOUTH, 0.9, 2.0, 182 "test/atmsdriver/postmiles1.txt"); 183 highways.applyColorToHighwayStretch(5, Station.DIRECTION.SOUTH, 0.9, 2.0, 264 184 LoopDetector.DOTCOLOR.RED); 265 185 Station target = highways.findStation(5, DIRECTION.SOUTH, 0.9); 266 assertEquals('@', target.getColor());186 assertEquals('@', target.getColor().symbol()); 267 187 String result = highways.toString(); 268 System.out.println("applyto:\n" +result);188 System.out.println("applyto:\n" + result); 269 189 assertEquals("5 N .-.\n 5 S @.@", result.trim()); 270 271 highways.applyColorToHighwayStretch(5, Station.DIRECTION.SOUTH, 1.49, 2.0, 190 191 highways.applyColorToHighwayStretch(5, Station.DIRECTION.SOUTH, 1.49, 2.0, 272 192 LoopDetector.DOTCOLOR.YELLOW); 273 193 result = highways.toString(); 274 194 assertEquals("5 N .-.\n 5 S @.+", result.trim()); 275 276 highways.applyColorToHighwayStretch(5, Station.DIRECTION.SOUTH, 1.49, 0.59, 195 196 highways.applyColorToHighwayStretch(5, Station.DIRECTION.SOUTH, 1.49, 0.59, 277 197 LoopDetector.DOTCOLOR.GREEN); 278 198 result = highways.toString(); 279 199 assertEquals("5 N .-.\n 5 S @.-", result.trim()); 280 200 281 highways.applyColorToHighwayStretch(5, Station.DIRECTION.NORTH, 1.83, 2.0, 201 highways.applyColorToHighwayStretch(5, Station.DIRECTION.NORTH, 1.83, 2.0, 282 202 LoopDetector.DOTCOLOR.RED); 283 203 result = highways.toString(); 284 204 assertEquals("5 N .@.\n 5 S @.-", result.trim()); 285 205 286 206 //highways.applyColorToHighwayStretch(241, Station.DIRECTION.NORTH, 20.13, 4.0, LoopDetector.DOTCOLOR.RED); 287 207 //result = highways.toString(); 288 208 //assertTrue(result.length()>0); //"241 N @@ @@@@@-",result.substring(0,15)); 289 290 } 291 292 public void testToCondensedFormat() 293 { 294 System.out.println("ToCondensedFormat"); 295 Highways highways = new Highways( 296 "test/atmsdriver/model/ldssample.txt", 297 "localhost", 8080); 298 299 String actualCondensedFormatMeta = highways.toCondensedFormat(true); 300 String actualCondensedFormatFEP = highways.toCondensedFormat(false); 301 System.out.println(actualCondensedFormatMeta); 302 303 assertEquals(expectedCondensedFormatFEP, actualCondensedFormatFEP); 304 assertEquals(expectedCondensedFormatMeta, actualCondensedFormatMeta); 305 } 306 String expectedCondensedFormatMeta = 307 "2\n" + 308 "32 0 2\n" + 309 "1210831 1 5 S 0.9 4 CALAFIA\n" + 310 "1210832 ML ML_1\n" + 311 "1210833 ML ML_2\n" + 312 "1210834 ML ML_3\n" + 313 "1210835 ML ML_4\n" + 314 "1210845 2 5 S 1.49 4 EL CAMINO REAL\n" + 315 "1210846 ML ML_1\n" + 316 "1210847 ML ML_2\n" + 317 "1210848 ML ML_3\n" + 318 "1210849 ML ML_4\n" + 319 "74 0 1\n" + 320 "1204203 2 5 N 1.26 4 MAGDALENA\n" + 321 "1204212 ML ML_1\n" + 322 "1204213 ML ML_2\n" + 323 "1204214 ML ML_3\n" + 324 "1204215 ML ML_4\n"; 325 String expectedCondensedFormatFEP = 326 "2\n" + 327 "32 0 2\n" + 328 "1210831 1 5 S 0.9 4 \n" + 329 "1210832 0.0 0 ML_1\n" + 330 "1210833 0.0 0 ML_2\n" + 331 "1210834 0.0 0 ML_3\n" + 332 "1210835 0.0 0 ML_4\n" + 333 "1210845 2 5 S 1.49 4 \n" + 334 "1210846 0.0 0 ML_1\n" + 335 "1210847 0.0 0 ML_2\n" + 336 "1210848 0.0 0 ML_3\n" + 337 "1210849 0.0 0 ML_4\n" + 338 "74 0 1\n" + 339 "1204203 2 5 N 1.26 4 \n" + 340 "1204212 0.0 0 ML_1\n" + 341 "1204213 0.0 0 ML_2\n" + 342 "1204214 0.0 0 ML_3\n" + 343 "1204215 0.0 0 ML_4\n"; 344 209 210 highways.reset(); 211 result = highways.toString(); 212 assertEquals("5 N .-.\n 5 S -.-", result.trim()); 213 } 214 215 345 216 } -
trunk/test/tmcsim/highwaymodel/LoadHighwaysTest.java
r343 r422 1 package atmsdriver.model;1 package tmcsim.highwaymodel; 2 2 3 import tmcsim.highwaymodel.Station; 4 import tmcsim.highwaymodel.Highways; 5 import tmcsim.highwaymodel.Highway; 3 6 import java.io.FileWriter; 4 7 import java.io.PrintWriter; … … 25 28 PrintWriter writer = null; 26 29 try { 27 writer = new PrintWriter(new FileWriter("test/atmsdriver/model/lds_loadhighways_sample.txt")); 28 29 writer.println("2"); 30 writer.println("32 0 2"); 31 writer.println("1210831 1 5 S 0.9 4 CALAFIA"); 32 writer.println("1210832 ML ML_1"); 33 writer.println("1210833 ML ML_2"); 34 writer.println("1210834 ML ML_3"); 35 writer.println("1210835 ML ML_4"); 36 writer.println("1210845 2 5 S 1.49 4 EL CAMINO REAL"); 37 writer.println("1210846 ML ML_1"); 38 writer.println("1210847 ML ML_2"); 39 writer.println("1210848 ML ML_3"); 40 writer.println("1210849 ML ML_4"); 41 writer.println("74 0 1"); 42 writer.println("1204203 2 5 N 1.26 4 MAGDALENA"); 43 writer.println("1204212 ML ML_1"); 44 writer.println("1204213 ML ML_2"); 45 writer.println("1204214 ML ML_3"); 46 writer.println("1204215 ML ML_4"); 30 writer = new PrintWriter(new FileWriter("test/atmsdriver/postmiles1.txt")); 31 writer.println("5 S 0.9,33.408425,-117.599923,CALAFIA,0,0"); 32 writer.println("5 N 1.24,33.413051,-117.601964,MAGDALENA,0,0"); 33 writer.println("5 S 1.49,33.416348,-117.603827,EL CAMINO REAL,0,0"); 47 34 writer.close(); 35 writer = new PrintWriter(new FileWriter("test/atmsdriver/postmiles3.txt")); 36 writer.println("73 N 23.9,33.643656,-117.859875,BISON 2,0.976131,0.217185"); 37 writer.println("55 S 6.88,33.697495,-117.862677,MACARTHU1,-0.710326,0.703873"); 38 writer.println("5 N 5.73,33.458342,-117.655008,ESTRELLA1,0,0"); 39 writer.println("5 N 6.47,33.464404,-117.665509,SACRAMENTO,0.523797,0.851843"); 40 writer.println("405 N 6.21,33.672851,-117.832271,HARVARD,0.320278,0.947323"); 41 writer.println("405 S 6.8,33.675863,-117.84179,JAMBOREE1,-0.402558,-0.915394"); 42 writer.close(); 48 43 } catch (Exception e) { 49 44 e.printStackTrace(); … … 54 49 protected void tearDown() throws Exception { 55 50 super.tearDown(); 56 Path path = FileSystems.getDefault().getPath("test/atmsdriver/model", "lds_loadhighways_sample.txt"); 51 Path path = FileSystems.getDefault().getPath("test/atmsdriver", "postmiles1.txt"); 52 Files.delete(path); 53 path = FileSystems.getDefault().getPath("test/atmsdriver", "postmiles3.txt"); 57 54 Files.delete(path); 58 55 } … … 62 59 */ 63 60 public void testLoadHighways() { 64 System.out.println("t oXML");61 System.out.println("testLoadHighways"); 65 62 Highways highways = new Highways( 66 "test/atmsdriver/model/lds_loadhighways_sample.txt", 67 "localhost", 8080); 63 "test/atmsdriver/postmiles1.txt"); 68 64 69 65 // Test for correct number of highways … … 78 74 assertEquals(new Integer(3), new Integer(fiveS.stations.size())); 79 75 80 // Test 5 stations are sorted by postmile76 // Test hwy5 stations are sorted by postmile 81 77 List<Station> stations = (ArrayList) fiveS.stations; 82 78 ArrayList<Double> stationsPostmiles = new ArrayList<>(); … … 89 85 ArrayList<Double> expectedStationsPostmiles = new ArrayList<>(); 90 86 expectedStationsPostmiles.add(new Double(0.9)); 91 expectedStationsPostmiles.add(new Double(1.2 6));87 expectedStationsPostmiles.add(new Double(1.24)); 92 88 expectedStationsPostmiles.add(new Double(1.49)); 93 89 … … 97 93 stationsPostmiles.get(i)); 98 94 } 95 } 96 public void testLoadHighways2() { 97 System.out.println("testLoadHighways2"); 98 Highways highways = new Highways( 99 "test/atmsdriver/postmiles3.txt"); 100 101 // Test for correct number of highways 102 List<Highway> result = (ArrayList) highways.highways; 103 assertEquals(4, result.size()); 99 104 100 // Test for correct number of loops 101 assertEquals(new Integer(12), new Integer(fiveS.stations.get(0).loops.size() 102 + fiveS.stations.get(1).loops.size() + fiveS.stations.get(2).loops.size())); 105 Highway five = result.get(0); 106 assertEquals(new Integer(5), five.routeNumber); 107 assertEquals(new Integer(405), result.get(1).routeNumber); 108 assertEquals(new Integer(55), result.get(2).routeNumber); 109 assertEquals(new Integer(73), result.get(3).routeNumber); 103 110 } 104 111 } -
trunk/test/tmcsim/highwaymodel/PostmileCoordsTest.java
r269 r422 1 1 2 package atmsdriver.model;2 package tmcsim.highwaymodel; 3 3 4 import tmcsim.highwaymodel.PostmileCoords; 4 5 import java.io.FileInputStream; 5 6 import java.io.FileNotFoundException; -
trunk/test/tmcsim/highwaymodel/StationTest.java
r343 r422 1 1 2 package atmsdriver.model;2 package tmcsim.highwaymodel; 3 3 4 import atmsdriver.model.Station.DIRECTION; 4 import tmcsim.highwaymodel.LoopDetector; 5 import tmcsim.highwaymodel.Station; 6 import tmcsim.highwaymodel.Station.DIRECTION; 5 7 import java.util.ArrayList; 6 8 import junit.framework.TestCase; … … 81 83 } 82 84 /** 83 * T ODO: Test of toXML method, of class Station.85 * Test get Color and LoopDetector accessors 84 86 */ 85 87 public void testGetColor() 88 { 89 LoopDetector lane = new LoopDetector(999,"locid","loc"); 90 ArrayList<LoopDetector> lanes = new ArrayList<LoopDetector>(); 91 lanes.add(lane); 92 Station alpha = new Station(1,2,3,"A",lanes, 4, DIRECTION.NORTH, 2.0); 93 assertEquals('-',alpha.getColor().symbol()); 94 assertEquals("lime",alpha.getColor().htmlColor()); 95 lane.setAttributes(LoopDetector.DOTCOLOR.YELLOW); 96 assertEquals('+',alpha.getColor().symbol()); 97 assertEquals("yellow",alpha.getColor().htmlColor()); 98 lane.setAttributes(LoopDetector.DOTCOLOR.RED); 99 assertEquals('@',alpha.getColor().symbol()); 100 assertEquals("red",alpha.getColor().htmlColor()); 101 } 86 102 } -
trunk/test/tmcsim/highwaymodel/TrafficEventTest.java
r183 r422 1 1 2 package atmsdriver.model;2 package tmcsim.highwaymodel; 3 3 4 import tmcsim.highwaymodel.TrafficEvent; 4 5 import java.text.ParseException; 5 6 import java.util.PriorityQueue; -
trunk/test/tmcsim/paramicslog/ParamicsLogFileHandlerTest.java
r123 r422 43 43 try 44 44 { 45 new CADServer("config/ testConfig/cad_simulator_console_config.properties");45 new CADServer("config/cad_simulator_console_config.properties"); 46 46 } catch (Exception e) 47 47 { -
trunk/test/tmcsim/paramicslog/ParamicsLogRMITestSkeleton.java
r123 r422 44 44 try 45 45 { 46 CADServer engine = new CADServer("config/ testConfig/cad_simulator_console_config.properties");46 CADServer engine = new CADServer("config/cad_simulator_console_config.properties"); 47 47 } catch (Exception e) 48 48 {
Note: See TracChangeset
for help on using the changeset viewer.
