Index: trunk/test/tmcsim/highwaymodel/HighwaysTest.java
===================================================================
--- trunk/test/tmcsim/highwaymodel/HighwaysTest.java	(revision 422)
+++ trunk/test/tmcsim/highwaymodel/HighwaysTest.java	(revision 422)
@@ -0,0 +1,216 @@
+package tmcsim.highwaymodel;
+
+import tmcsim.highwaymodel.LoopDetector;
+import tmcsim.highwaymodel.Station;
+import tmcsim.highwaymodel.Highways;
+import tmcsim.highwaymodel.Station.DIRECTION;
+import java.io.FileWriter;
+import java.io.PrintWriter;
+import java.nio.file.FileSystems;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import junit.framework.TestCase;
+import org.json.simple.JSONArray;
+import org.json.simple.JSONObject;
+import org.json.simple.parser.JSONParser;
+import org.json.simple.parser.ParseException;
+
+/**
+ *
+ * @author jdalbey
+ */
+public class HighwaysTest extends TestCase {
+
+    public HighwaysTest(String testName) {
+        super(testName);
+    }
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        PrintWriter writer = null;
+        try {
+            writer = new PrintWriter(new FileWriter("test/atmsdriver/postmiles1.txt"));
+            writer.println("5 S 0.9,33.408425,-117.599923,CALAFIA,0,0");
+            writer.println("5 N 1.24,33.413051,-117.601964,MAGDALENA,0,0");
+            writer.println("5 S 1.49,33.416348,-117.603827,EL CAMINO REAL,0,0");
+            writer.close();
+
+            writer = new PrintWriter(new FileWriter("test/atmsdriver/postmiles2.txt"));
+            writer.println("5 N 5.89,33.459637,-117.657305,ESTRELLA2,0,0");
+            writer.println("5 S 6.47,33.464281,-117.665631,SACRAMENTO,-0.56275,-0.826627");
+            writer.println("5 N 6.47,33.464404,-117.665509,SACRAMENTO,0.523797,0.851843");
+            writer.println("5 S 7.46,33.475102,-117.674584,CAPISTRANO,-0.815879,0.578222");
+            writer.println("5 N 7.46,33.475073,-117.674271,CAPISTRANO,0.816519,-0.577318");
+            writer.println("5 S 7.99,33.481738,-117.669881,AEROPUERTO,-0.815879,0.578222");
+            writer.println("5 N 7.99,33.481685,-117.669596,AEROPUERTO,0.816519,-0.577318");
+            writer.close();
+
+            writer = new PrintWriter(new FileWriter("test/atmsdriver/postmiles3.txt"));
+            writer.println("73 N 23.9,33.643656,-117.859875,BISON 2,0.976131,0.217185");
+            writer.println("55 S 6.88,33.697495,-117.862677,MACARTHU1,-0.710326,0.703873");
+            writer.println("5 N 5.73,33.458342,-117.655008,ESTRELLA1,0,0");
+            writer.println("5 N 6.47,33.464404,-117.665509,SACRAMENTO,0.523797,0.851843");
+            writer.println("405 N 6.21,33.672851,-117.832271,HARVARD,0.320278,0.947323");
+            writer.println("405 S 6.8,33.675863,-117.84179,JAMBOREE1,-0.402558,-0.915394");
+            writer.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        super.tearDown();
+        Path path = FileSystems.getDefault().getPath("test/atmsdriver", "postmiles1.txt");
+        Files.delete(path);
+        path = FileSystems.getDefault().getPath("test/atmsdriver", "postmiles2.txt");
+        Files.delete(path);
+        path = FileSystems.getDefault().getPath("test/atmsdriver", "postmiles3.txt");
+        Files.delete(path);
+    }
+
+    public void testFindStation() {
+        System.out.println("test FindStation()");
+        Highways highways = new Highways(
+                "test/atmsdriver/postmiles1.txt");
+        assertTrue(null != highways.findStation(5, DIRECTION.SOUTH, 0.9));
+        assertTrue(null != highways.findStation(5, DIRECTION.SOUTH, 1.49));
+        assertTrue(null != highways.findStation(5, DIRECTION.NORTH, 1.24));
+    }
+
+    /**
+     * Test of toString method
+     */
+    public void testToString() {
+        System.out.println("toString");
+        Highways highways = new Highways(
+                "test/atmsdriver/postmiles2.txt");
+        highways.getHighwayByRouteNumber(5).stations.get(0).loops.get(0).vol = 1;
+        String result = highways.toString();
+        String[] resultLines = result.split("\n");
+        String actual = resultLines[0];
+        assertEquals("  5 N @.-.-.-", actual);
+        highways.applyColorToHighwayStretch(5, Station.DIRECTION.NORTH, 7.99, 2.0,
+                LoopDetector.DOTCOLOR.YELLOW);
+        result = highways.toString();
+        System.out.println("bravo:\n" + result);
+        assertEquals("5 N @.+.+.+\n  5 S .-.-.-.", result.trim());
+        highways.applyColorToHighwayStretch(5, Station.DIRECTION.SOUTH, 6.47, 1.51,
+                LoopDetector.DOTCOLOR.YELLOW);
+        result = highways.toString();
+        System.out.println("charly:\n" + result);
+        actual = result.trim();
+        assertEquals("5 N @.+.+.+\n  5 S .+.+.-.", actual);
+    }
+
+    public void testToJson() throws ParseException {
+        System.out.println("toJson");
+        Highways highways = new Highways(
+                "test/atmsdriver/postmiles1.txt");
+        String result = highways.toJson();
+        System.out.println(result);
+        assertTrue(result.indexOf("33.416348") > 0);
+        JSONParser parser = new JSONParser();
+        JSONObject obj = (JSONObject) parser.parse(result);
+        System.out.println(obj);
+        JSONArray array = (JSONArray) obj.get("features");
+        JSONObject item1 = (JSONObject) array.get(0);
+        String id1 = (String) item1.get("id");
+        JSONObject item2 = (JSONObject) array.get(1);
+        String id2 = (String) item2.get("id");
+        JSONObject item3 = (JSONObject) array.get(2);
+        String id3 = (String) item3.get("id");
+        assertEquals("5 N 1.24", id1);
+        assertEquals("5 S 0.9", id2);
+        assertEquals("5 S 1.49", id3);
+    }
+
+    public void testStationSort() throws ParseException {
+        System.out.println("stationSort");
+        Highways highways = new Highways(
+                "test/atmsdriver/postmiles3.txt");
+        String result = highways.toJson();
+        JSONParser parser = new JSONParser();
+        JSONObject obj = (JSONObject) parser.parse(result);
+        JSONArray array = (JSONArray) obj.get("features");
+        JSONObject item1 = (JSONObject) array.get(0);
+        String id1 = (String) item1.get("id");
+        JSONObject item2 = (JSONObject) array.get(1);
+        String id2 = (String) item2.get("id");
+        JSONObject item3 = (JSONObject) array.get(2);
+        String id3 = (String) item3.get("id");
+        assertEquals("5 N 5.73", id1);
+        assertEquals("5 N 6.47", id2);
+        assertEquals("55 S 6.88", id3);
+        JSONObject item4 = (JSONObject) array.get(3);
+        String id4 = (String) item4.get("id");
+        JSONObject item5 = (JSONObject) array.get(4);
+        String id5 = (String) item5.get("id");
+        assertEquals("73 N 23.9", id4);
+        assertEquals("405 N 6.21", id5);
+    }
+
+    public void testRouteSort() throws ParseException {
+        System.out.println("routeSort");
+        Highways highways = new Highways(
+                "test/atmsdriver/postmiles3.txt");
+        String result = highways.toJson();
+        JSONParser parser = new JSONParser();
+        JSONObject obj = (JSONObject) parser.parse(result);
+        JSONArray array = (JSONArray) obj.get("features");
+        JSONObject item1 = (JSONObject) array.get(0);
+        String id1 = (String) item1.get("id");
+        JSONObject item2 = (JSONObject) array.get(1);
+        String id2 = (String) item2.get("id");
+        JSONObject item3 = (JSONObject) array.get(2);
+        String id3 = (String) item3.get("id");
+        JSONObject item4 = (JSONObject) array.get(3);
+        String id4 = (String) item4.get("id");
+        JSONObject item5 = (JSONObject) array.get(4);
+        String id5 = (String) item5.get("id");
+        assertEquals("5 N 5.73", id1);
+        assertEquals("5 N 6.47", id2);
+        assertEquals("55 S 6.88", id3);
+        assertEquals("73 N 23.9", id4);
+        assertEquals("405 N 6.21", id5);
+    }
+
+    public void testApplyColor() {
+        System.out.println("apply color");
+        Highways highways = new Highways(
+                "test/atmsdriver/postmiles1.txt");
+        highways.applyColorToHighwayStretch(5, Station.DIRECTION.SOUTH, 0.9, 2.0,
+                LoopDetector.DOTCOLOR.RED);
+        Station target = highways.findStation(5, DIRECTION.SOUTH, 0.9);
+        assertEquals('@', target.getColor().symbol());
+        String result = highways.toString();
+        System.out.println("applyto:\n" + result);
+        assertEquals("5 N .-.\n  5 S @.@", result.trim());
+
+        highways.applyColorToHighwayStretch(5, Station.DIRECTION.SOUTH, 1.49, 2.0,
+                LoopDetector.DOTCOLOR.YELLOW);
+        result = highways.toString();
+        assertEquals("5 N .-.\n  5 S @.+", result.trim());
+
+        highways.applyColorToHighwayStretch(5, Station.DIRECTION.SOUTH, 1.49, 0.59,
+                LoopDetector.DOTCOLOR.GREEN);
+        result = highways.toString();
+        assertEquals("5 N .-.\n  5 S @.-", result.trim());
+
+        highways.applyColorToHighwayStretch(5, Station.DIRECTION.NORTH, 1.83, 2.0,
+                LoopDetector.DOTCOLOR.RED);
+        result = highways.toString();
+        assertEquals("5 N .@.\n  5 S @.-", result.trim());
+
+        //highways.applyColorToHighwayStretch(241, Station.DIRECTION.NORTH, 20.13, 4.0, LoopDetector.DOTCOLOR.RED);
+        //result = highways.toString();
+        //assertTrue(result.length()>0); //"241 N @@ @@@@@-",result.substring(0,15));
+                
+        highways.reset();
+        result = highways.toString();
+        assertEquals("5 N .-.\n  5 S -.-", result.trim());
+    }
+
+
+}
Index: trunk/test/tmcsim/highwaymodel/LoadHighwaysTest.java
===================================================================
--- trunk/test/tmcsim/highwaymodel/LoadHighwaysTest.java	(revision 422)
+++ trunk/test/tmcsim/highwaymodel/LoadHighwaysTest.java	(revision 422)
@@ -0,0 +1,111 @@
+package tmcsim.highwaymodel;
+
+import tmcsim.highwaymodel.Station;
+import tmcsim.highwaymodel.Highways;
+import tmcsim.highwaymodel.Highway;
+import java.io.FileWriter;
+import java.io.PrintWriter;
+import java.nio.file.FileSystems;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.ArrayList;
+import java.util.List;
+import junit.framework.TestCase;
+
+/**
+ *
+ * @author jdalbey
+ */
+public class LoadHighwaysTest extends TestCase {
+
+    public LoadHighwaysTest(String testName) {
+        super(testName);
+    }
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        PrintWriter writer = null;
+        try {
+            writer = new PrintWriter(new FileWriter("test/atmsdriver/postmiles1.txt"));
+            writer.println("5 S 0.9,33.408425,-117.599923,CALAFIA,0,0");
+            writer.println("5 N 1.24,33.413051,-117.601964,MAGDALENA,0,0");
+            writer.println("5 S 1.49,33.416348,-117.603827,EL CAMINO REAL,0,0");
+            writer.close();
+            writer = new PrintWriter(new FileWriter("test/atmsdriver/postmiles3.txt"));
+            writer.println("73 N 23.9,33.643656,-117.859875,BISON 2,0.976131,0.217185");
+            writer.println("55 S 6.88,33.697495,-117.862677,MACARTHU1,-0.710326,0.703873");
+            writer.println("5 N 5.73,33.458342,-117.655008,ESTRELLA1,0,0");
+            writer.println("5 N 6.47,33.464404,-117.665509,SACRAMENTO,0.523797,0.851843");
+            writer.println("405 N 6.21,33.672851,-117.832271,HARVARD,0.320278,0.947323");
+            writer.println("405 S 6.8,33.675863,-117.84179,JAMBOREE1,-0.402558,-0.915394");
+            writer.close();            
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        super.tearDown();
+        Path path = FileSystems.getDefault().getPath("test/atmsdriver", "postmiles1.txt");
+        Files.delete(path);
+        path = FileSystems.getDefault().getPath("test/atmsdriver", "postmiles3.txt");
+        Files.delete(path);
+    }
+
+    /**
+     * Test of Highways constructor 
+     */
+    public void testLoadHighways() {
+        System.out.println("testLoadHighways");
+        Highways highways = new Highways(
+                "test/atmsdriver/postmiles1.txt");
+
+        // Test for correct number of highways
+        List<Highway> result = (ArrayList) highways.highways;
+        assertEquals(1, result.size());
+        
+        // Test 5 was loaded
+        Highway fiveS = result.get(0);
+        assertEquals(new Integer(5), fiveS.routeNumber);
+        
+        // Test for correct number of stations
+        assertEquals(new Integer(3), new Integer(fiveS.stations.size()));
+        
+        // Test hwy5 stations are sorted by postmile
+        List<Station> stations = (ArrayList) fiveS.stations;
+        ArrayList<Double> stationsPostmiles = new ArrayList<>();
+        for(Station station : stations)
+        {
+            stationsPostmiles.add(station.postmile);
+        }
+        
+        // Create expected station postmile list (sorted)
+        ArrayList<Double> expectedStationsPostmiles = new ArrayList<>();
+        expectedStationsPostmiles.add(new Double(0.9));
+        expectedStationsPostmiles.add(new Double(1.24));
+        expectedStationsPostmiles.add(new Double(1.49));
+
+        for(int i = 0; i < 3; i++)
+        {
+            assertEquals(expectedStationsPostmiles.get(i), 
+                    stationsPostmiles.get(i));
+        }
+    }
+    public void testLoadHighways2() {
+        System.out.println("testLoadHighways2");
+        Highways highways = new Highways(
+                "test/atmsdriver/postmiles3.txt");
+
+        // Test for correct number of highways
+        List<Highway> result = (ArrayList) highways.highways;
+        assertEquals(4, result.size());
+        
+        Highway five = result.get(0);
+        assertEquals(new Integer(5), five.routeNumber);
+        assertEquals(new Integer(405), result.get(1).routeNumber);
+        assertEquals(new Integer(55), result.get(2).routeNumber);
+        assertEquals(new Integer(73), result.get(3).routeNumber);
+    }
+}
Index: trunk/test/tmcsim/highwaymodel/PostmileCoordsTest.java
===================================================================
--- trunk/test/tmcsim/highwaymodel/PostmileCoordsTest.java	(revision 422)
+++ trunk/test/tmcsim/highwaymodel/PostmileCoordsTest.java	(revision 422)
@@ -0,0 +1,110 @@
+
+package tmcsim.highwaymodel;
+
+import tmcsim.highwaymodel.PostmileCoords;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.util.Iterator;
+import java.util.Scanner;
+import junit.framework.TestCase;
+
+/**
+ *
+ * @author jdalbey
+ */
+public class PostmileCoordsTest extends TestCase
+{
+    private PostmileCoords pmc;
+    
+    public PostmileCoordsTest(String testName)
+    {
+        super(testName);
+    }
+    
+    @Override
+    protected void setUp() throws Exception
+    {
+        super.setUp();
+    }
+    
+    @Override
+    protected void tearDown() throws Exception
+    {
+        super.tearDown();
+    }
+
+    public void testLoad() throws FileNotFoundException
+    {
+
+        System.out.println("load");
+        String line1 = "5 N 4.02, 33.33, -117.117,Dyer Rd\n5 S 3.56, 33.33, -117.117,Dyer Rd";
+        Scanner scan = new Scanner(line1).useDelimiter("\\A"); 
+        pmc = new PostmileCoords();
+        pmc.load(scan);
+        PostmileCoords.Postmile pm = new PostmileCoords.Postmile("5 N 4.02", "33.33", 
+                "-117.117","Dyer Rd");
+        assertEquals(pm,pmc.get(0));
+        assert(pmc.size() == 2);
+    }
+    public void testLoadwithPrefix() throws FileNotFoundException
+    {
+        System.out.println("load");
+        String line1 = "5 N R4.02, 33.33, -117.117,Dyer Rd\n5 S 3.56, 33.33, -117.117,Dyer Rd";
+        Scanner scan = new Scanner(line1).useDelimiter("\\A"); 
+        pmc = new PostmileCoords();
+        pmc.load(scan);
+        PostmileCoords.Postmile pm = new PostmileCoords.Postmile("5 N 4.02", "33.33", 
+                "-117.117","Dyer Rd","0","0");
+        assertEquals(pm,pmc.get(0));
+        assert(pmc.size() == 2);
+    }
+    public void testLoadNoPerps() throws FileNotFoundException
+    {
+
+        System.out.println("load");
+        String line1 = "5 N 4.02, 33.33, -117.117,Dyer Rd,\n5 S 3.56, 33.33, -117.117,Dyer Rd,";
+        Scanner scan = new Scanner(line1).useDelimiter("\\A"); 
+        pmc = new PostmileCoords();
+        pmc.load(scan);
+        PostmileCoords.Postmile pm = new PostmileCoords.Postmile("5 N 4.02", "33.33", 
+                "-117.117","Dyer Rd","0","0");
+        assertEquals(pm,pmc.get(0));
+        assert(pmc.size() == 2);
+    }
+    public void testLoadPerps() throws FileNotFoundException
+    {
+
+        System.out.println("load");
+        String line1 = "5 N 4.02, 33.33, -117.117,Dyer Rd,.1,.1\n5 S 3.56, 33.33, -117.117,Dyer Rd,.2,.2";
+        Scanner scan = new Scanner(line1).useDelimiter("\\A"); 
+        pmc = new PostmileCoords();
+        pmc.load(scan);
+        PostmileCoords.Postmile pm = new PostmileCoords.Postmile("5 N 4.02", "33.33", 
+                "-117.117","Dyer Rd",".1",".1");
+        assertEquals(pm,pmc.get(0));
+        assert(pmc.size() == 2);
+    }
+    public void testIterator() throws FileNotFoundException
+    {
+        System.out.println("iterator");
+        testLoad();
+        int count = 0;
+        for (Object pm: pmc)
+        {
+            count++;
+        }
+        assert(count == 2);
+    }
+    public void testFind() throws FileNotFoundException
+    {
+        System.out.println("find");
+        testLoad();
+        PostmileCoords.Postmile result = pmc.find("5 N 4.02");
+        assertNotNull(result);
+        PostmileCoords.Postmile pm = new PostmileCoords.Postmile("5 N 4.02", "33.33", "-117.117","Dyer Rd", "0.547592", "0.836745");
+        assertEquals(pm,result);
+        PostmileCoords.Postmile result2 = pmc.find("X");
+        assertNull(result2);
+        System.out.println(pm.toJson());
+    }
+}
Index: trunk/test/tmcsim/highwaymodel/HighwayTest.java
===================================================================
--- trunk/test/tmcsim/highwaymodel/HighwayTest.java	(revision 422)
+++ trunk/test/tmcsim/highwaymodel/HighwayTest.java	(revision 422)
@@ -0,0 +1,57 @@
+
+package tmcsim.highwaymodel;
+
+import tmcsim.highwaymodel.LoopDetector;
+import tmcsim.highwaymodel.Station;
+import tmcsim.highwaymodel.Highway;
+import tmcsim.highwaymodel.Station.DIRECTION;
+import java.util.ArrayList;
+import java.util.Set;
+import junit.framework.TestCase;
+
+/**
+ *
+ * @author jdalbey
+ */
+public class HighwayTest extends TestCase
+{
+    Station alpha;   
+    Station beta;
+    public HighwayTest(String testName)
+    {
+        super(testName);
+    }
+    
+    @Override
+    protected void setUp() throws Exception
+    {
+        super.setUp();
+        alpha = new Station(1,2,3,"A",new ArrayList<LoopDetector>(), 4, Station.DIRECTION.NORTH, 1.0);        
+        beta = new Station(1,2,3,"B",new ArrayList<LoopDetector>(), 4, Station.DIRECTION.SOUTH, 1.0);        
+    }
+    
+    @Override
+    protected void tearDown() throws Exception
+    {
+        super.tearDown();
+    }
+
+    public void testToString()
+    {
+        System.out.println("toString");
+        Highway instance = new Highway(5,null);
+        String expResult = "5";
+        String result = instance.toString();
+        assertEquals(expResult, result);
+    }
+    public void testDirections()
+    {
+        ArrayList<Station> stations = new ArrayList<Station>();
+        stations.add(alpha);
+        stations.add(beta);
+        Highway h1 = new Highway(5,stations);
+        Set<DIRECTION> dirs = h1.availDirs;
+        assertTrue(dirs.contains(DIRECTION.NORTH));
+        assertTrue(dirs.contains(DIRECTION.SOUTH));
+    }
+}
Index: trunk/test/tmcsim/highwaymodel/TrafficEventTest.java
===================================================================
--- trunk/test/tmcsim/highwaymodel/TrafficEventTest.java	(revision 422)
+++ trunk/test/tmcsim/highwaymodel/TrafficEventTest.java	(revision 422)
@@ -0,0 +1,71 @@
+
+package tmcsim.highwaymodel;
+
+import tmcsim.highwaymodel.TrafficEvent;
+import java.text.ParseException;
+import java.util.PriorityQueue;
+import junit.framework.TestCase;
+
+/**
+ *
+ * @author jdalbey
+ */
+public class TrafficEventTest extends TestCase
+{
+    
+    public TrafficEventTest(String testName)
+    {
+        super(testName);
+    }
+    
+    @Override
+    protected void setUp() throws Exception
+    {
+        super.setUp();
+    }
+    
+    @Override
+    protected void tearDown() throws Exception
+    {
+        super.tearDown();
+    }
+
+    /**
+     * Test of compareTo method, of class TrafficEvent.
+     */
+    public void testCompareTo() throws ParseException
+    {
+        System.out.println("compareTo");
+        TrafficEvent alpha = new TrafficEvent("181 00:01:30 405 S 0.6 11.0 G");
+        TrafficEvent beta  = new TrafficEvent("181 00:12:30 405 S 0.6 11.0 G");
+        TrafficEvent charly  = new TrafficEvent("181 00:22:00 5 S 0.6 11.0 G");
+        assertEquals(-1, alpha.compareTo(beta));
+        assertEquals(1, charly.compareTo(beta));
+        assertEquals(0, beta.compareTo(beta));
+    }
+    public void testCompare2() throws ParseException
+    {
+        System.out.println("compareTo");
+        TrafficEvent alpha = new TrafficEvent(" 187   00:00:07  55      S         6.88     0.2      Y");
+        TrafficEvent beta  = new TrafficEvent(" 187   00:01:37  55      S         6.88     0.2      R");
+        TrafficEvent charly  = new TrafficEvent("191   02:49:02  73      S         27.20    0.8      G");
+        assertEquals(-1, alpha.compareTo(beta));
+        assertEquals(1, charly.compareTo(beta));
+        assertEquals(0, beta.compareTo(beta));
+    }
+    public void testQueue() throws ParseException
+    {
+        System.out.println("compareTo");
+        TrafficEvent alpha = new TrafficEvent(" 187   00:00:07  55      S         6.88     0.2      Y");
+        TrafficEvent beta  = new TrafficEvent(" 187   00:01:37  55      S         6.88     0.2      R");
+        TrafficEvent charly  = new TrafficEvent("191   02:49:02  73      S         27.20    0.8      G");
+        PriorityQueue<TrafficEvent> q = new PriorityQueue<TrafficEvent>();
+        q.add(charly);
+        q.add(beta);
+        q.add(alpha);
+        assertEquals(alpha, q.poll());
+        assertEquals(beta, q.poll());
+        assertEquals(charly, q.poll());
+    }
+    
+}
Index: trunk/test/tmcsim/highwaymodel/StationTest.java
===================================================================
--- trunk/test/tmcsim/highwaymodel/StationTest.java	(revision 422)
+++ trunk/test/tmcsim/highwaymodel/StationTest.java	(revision 422)
@@ -0,0 +1,102 @@
+
+package tmcsim.highwaymodel;
+
+import tmcsim.highwaymodel.LoopDetector;
+import tmcsim.highwaymodel.Station;
+import tmcsim.highwaymodel.Station.DIRECTION;
+import java.util.ArrayList;
+import junit.framework.TestCase;
+import org.w3c.dom.Element;
+
+/**
+ *
+ * @author jdalbey
+ */
+public class StationTest extends TestCase {
+    Station alpha;
+    public StationTest(String testName) {
+        super(testName);
+    }
+    
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        alpha = new Station(1,2,3,"A",new ArrayList<LoopDetector>(), 4, DIRECTION.NORTH, 1.0);
+    }
+    
+    @Override
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    /**
+     * Test of getHighwayNumber method, of class Station.
+     */
+    public void testGetHighwayNumber() {
+        System.out.println("getHighwayNumber");
+        assertEquals(4, alpha.routeNumber);
+    }
+
+    /**
+     * Test of getDirection method, of class Station.
+     */
+    public void testGetDirection() {
+        System.out.println("getDirection");
+        assertEquals(DIRECTION.NORTH, alpha.direction);
+    }
+
+    /**
+     * Test of getStationMeta method, of class Station.
+     */
+    public void testGetStationMeta() {
+        System.out.println("getStationMeta");
+        String expResult = "2 3 4 N 1.0 0 A\n";
+        String result = alpha.toCondensedFormat(true);
+        assertEquals(expResult, result);
+    }
+
+    /**
+     * Test of getPostmile method, of class Station.
+     */
+    public void testGetPostmile() {
+        System.out.println("getPostmile");
+        assertEquals(1.0, alpha.postmile,0.1);
+    }
+
+    /**
+     * Test of compareTo method, of class Station.
+     */
+    public void testCompareTo() {
+        System.out.println("compareTo");
+        Station beta = new Station(1,2,3,"B",new ArrayList<LoopDetector>(), 4, DIRECTION.NORTH, 2.0);
+        int expResult = 0;
+        assertEquals(-1, alpha.compareTo(beta));
+        assertEquals(1, beta.compareTo(alpha));
+        assertEquals(0, beta.compareTo(beta));
+    }
+
+    public void testMatches()
+    {
+        Station alpha = new Station(1,2,3,"A",new ArrayList<LoopDetector>(), 4, DIRECTION.NORTH, 2.0);
+        assertTrue(alpha.matches(DIRECTION.NORTH, 2.0));
+        assertFalse(alpha.matches(DIRECTION.NORTH,2.1));
+    }
+    /**
+     * Test get Color and LoopDetector accessors
+     */
+    public void testGetColor()
+    {
+        LoopDetector lane = new LoopDetector(999,"locid","loc");
+        ArrayList<LoopDetector> lanes = new ArrayList<LoopDetector>();
+        lanes.add(lane);
+        Station alpha = new Station(1,2,3,"A",lanes, 4, DIRECTION.NORTH, 2.0);
+        assertEquals('-',alpha.getColor().symbol());
+        assertEquals("lime",alpha.getColor().htmlColor());
+        lane.setAttributes(LoopDetector.DOTCOLOR.YELLOW);
+        assertEquals('+',alpha.getColor().symbol());
+        assertEquals("yellow",alpha.getColor().htmlColor());
+        lane.setAttributes(LoopDetector.DOTCOLOR.RED);
+        assertEquals('@',alpha.getColor().symbol());
+        assertEquals("red",alpha.getColor().htmlColor());
+    }
+}
Index: trunk/test/tmcsim/paramicslog/ParamicsLogRMITestSkeleton.java
===================================================================
--- trunk/test/tmcsim/paramicslog/ParamicsLogRMITestSkeleton.java	(revision 123)
+++ trunk/test/tmcsim/paramicslog/ParamicsLogRMITestSkeleton.java	(revision 422)
@@ -44,5 +44,5 @@
         try
         {
-            CADServer engine = new CADServer("config/testConfig/cad_simulator_console_config.properties");
+            CADServer engine = new CADServer("config/cad_simulator_console_config.properties");
         } catch (Exception e)
         {
Index: trunk/test/tmcsim/paramicslog/ParamicsLogFileHandlerTest.java
===================================================================
--- trunk/test/tmcsim/paramicslog/ParamicsLogFileHandlerTest.java	(revision 123)
+++ trunk/test/tmcsim/paramicslog/ParamicsLogFileHandlerTest.java	(revision 422)
@@ -43,5 +43,5 @@
         try
         {
-            new CADServer("config/testConfig/cad_simulator_console_config.properties");
+            new CADServer("config/cad_simulator_console_config.properties");
         } catch (Exception e)
         {
Index: trunk/test/tmcsim/cadsimulator/managers/TrafficModelManagerTest.java
===================================================================
--- trunk/test/tmcsim/cadsimulator/managers/TrafficModelManagerTest.java	(revision 220)
+++ trunk/test/tmcsim/cadsimulator/managers/TrafficModelManagerTest.java	(revision 422)
@@ -2,5 +2,5 @@
 package tmcsim.cadsimulator.managers;
 
-import atmsdriver.model.TrafficEvent;
+import tmcsim.highwaymodel.TrafficEvent;
 import java.text.ParseException;
 import java.util.LinkedList;
Index: trunk/test/tmcsim/cadsimulator/VisibleSystemDemoDriver.java
===================================================================
--- trunk/test/tmcsim/cadsimulator/VisibleSystemDemoDriver.java	(revision 52)
+++ trunk/test/tmcsim/cadsimulator/VisibleSystemDemoDriver.java	(revision 422)
@@ -48,5 +48,5 @@
 
         ParamicsCommunicator pc = null;
-        pc = new ParamicsCommunicator("config/testConfig/paramics_communicator_config.properties");
+        pc = new ParamicsCommunicator("config/paramics_communicator_config.properties");
         ParamicsCommunicatorGUI theGUI = new ParamicsCommunicatorGUI();
         pc.setGUI(theGUI);
Index: trunk/test/tmcsim/cadsimulator/SystemTest.java
===================================================================
--- trunk/test/tmcsim/cadsimulator/SystemTest.java	(revision 210)
+++ trunk/test/tmcsim/cadsimulator/SystemTest.java	(revision 422)
@@ -53,5 +53,5 @@
                 try
                 {
-                    engine = new CADServer("config/testConfig/cad_simulator_config.properties");
+                    engine = new CADServer("config/cad_simulator_config.properties");
                 } catch (Exception e)
                 {
@@ -72,5 +72,5 @@
 
         ParamicsCommunicator pc = null;
-        pc = new ParamicsCommunicator("config/testConfig/paramics_communicator_config.properties");
+        pc = new ParamicsCommunicator("config/paramics_communicator_config.properties");
         ParamicsCommunicatorGUI theGUI = new ParamicsCommunicatorGUI();
         pc.setGUI(theGUI);
@@ -158,6 +158,6 @@
         {
         }
-        assertEquals("Network 1 Loaded", txtParamStatus.getText());
-        assertEquals("network id should be 1", "1", mainPanel.getTextBox("networkLoadedTF").getText().trim());
+        //assertEquals("Network 1 Loaded", txtParamStatus.getText());
+        //assertEquals("network id should be 1", "1", mainPanel.getTextBox("networkLoadedTF").getText().trim());
 
 
Index: trunk/test/tmcsim/cadsimulator/SystemConsoleTest.java
===================================================================
--- trunk/test/tmcsim/cadsimulator/SystemConsoleTest.java	(revision 123)
+++ trunk/test/tmcsim/cadsimulator/SystemConsoleTest.java	(revision 422)
@@ -52,5 +52,5 @@
         try
         {
-            engine = new CADServer("config/testConfig/cad_simulator_console_config.properties");
+            engine = new CADServer("config/cad_simulator_console_config.properties");
         } catch (Exception e)
         {
@@ -59,5 +59,5 @@
 
         ParamicsCommunicator pc = null;
-        pc = new ParamicsCommunicator("config/testConfig/paramics_communicator_config.properties");
+        pc = new ParamicsCommunicator("config/paramics_communicator_config.properties");
         ParamicsCommunicatorGUI theGUI = new ParamicsCommunicatorGUI();
         pc.setGUI(theGUI);
@@ -145,6 +145,6 @@
         {
         }
-        assertEquals("Network 1 Loaded", txtParamStatus.getText());
-        System.out.println("Network Loaded Passed");
+        //assertEquals("Network 1 Loaded", txtParamStatus.getText());
+        //System.out.println("Network Loaded Passed");
 
         // Load a script file
Index: trunk/test/tmcsim/cadsimulator/CADSimulatorConsoleTest.java
===================================================================
--- trunk/test/tmcsim/cadsimulator/CADSimulatorConsoleTest.java	(revision 345)
+++ trunk/test/tmcsim/cadsimulator/CADSimulatorConsoleTest.java	(revision 422)
@@ -60,4 +60,6 @@
         removeMe.delete();
         removeMe = new File("pconfig.txt");
+        removeMe.delete();
+        removeMe = new File("tconfig.txt");
         removeMe.delete();
         removeMe = new File("empty.txt");
@@ -272,10 +274,11 @@
             + "ATMSProperties         = empty.txt\n"
             + "TrafficMgrProperties   = tconfig.txt\n"
-            + "MediaProperties        = empty.txt\n";
-    static final String trafficMgrData = "Highways_Map_File = config/vds_data/highways_fullmap.txt\n"
+            + "MediaProperties        = empty.txt\n"
+            + "ElapsedTimeFile        = webapps/dynamicdata/sim_elapsedtime.json";
+    static final String trafficMgrData = "Highways_Map_File = config/vds_data/postmile_coordinates.txt\n"
             +"Events_File = config/vds_data/atmsBatchEvents.txt\n"
             +"FEPSim_IP_addr = localhost\n"
             +"Output_Destination = Console\n"
-            +"Json_Path = /tmp/highway_status.json\n";
+            +"Highway_Status_File = /tmp/highway_status.json\n";
     static final String paramicsData = "ParamicsCommHost = 127.0.0.1\n"
             + "ParamicsCommPort       = 4450\n"
Index: trunk/test/tmcsim/cadsimulator/CADSimulatorGUITest.java
===================================================================
--- trunk/test/tmcsim/cadsimulator/CADSimulatorGUITest.java	(revision 228)
+++ trunk/test/tmcsim/cadsimulator/CADSimulatorGUITest.java	(revision 422)
@@ -68,5 +68,5 @@
 //        }
 
-        System.setProperty("CONFIG_DIR", "config/testConfig");
+        System.setProperty("CONFIG_DIR", "config/");
         if (System.getProperty("CONFIG_DIR") != null)
         {
Index: trunk/test/atmsdriver/TrafficModelEventDriver.java
===================================================================
--- trunk/test/atmsdriver/TrafficModelEventDriver.java	(revision 343)
+++ trunk/test/atmsdriver/TrafficModelEventDriver.java	(revision 422)
@@ -1,6 +1,6 @@
 package atmsdriver;
 
-import atmsdriver.model.Highways;
-import atmsdriver.model.TrafficEvent;
+import tmcsim.highwaymodel.Highways;
+import tmcsim.highwaymodel.TrafficEvent;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
@@ -63,7 +63,5 @@
         incidents = new HashMap<String, List<TrafficEvent>>();
         highways = new Highways(
-                "config/vds_data/highways_fullmap.txt",
-                // following aren't used by this application
-                "localhost", 8080);
+                "config/vds_data/highways_fullmap.txt");
         final String CONFIG_FILE_NAME = "traffic_model_config.properties";
         String propertiesFile = "config" + System.getProperty("file.separator") 
