Remove some calls to the deprecated Path.cost() API

Change-Id: I71d01fdf35d8a06639e6422b4c8d5998b14e319d
diff --git a/apps/pce/app/src/test/java/org/onosproject/pce/pceservice/PathComputationTest.java b/apps/pce/app/src/test/java/org/onosproject/pce/pceservice/PathComputationTest.java
index fd13454..2241d6d 100644
--- a/apps/pce/app/src/test/java/org/onosproject/pce/pceservice/PathComputationTest.java
+++ b/apps/pce/app/src/test/java/org/onosproject/pce/pceservice/PathComputationTest.java
@@ -483,7 +483,7 @@
         links.add(link2);
 
         assertThat(paths.iterator().next().links(), is(links));
-        assertThat(paths.iterator().next().cost(), is((double) 70));
+        assertThat(paths.iterator().next().weight(), is(ScalarWeight.toWeight(70.0)));
     }
 
     /**
@@ -524,7 +524,7 @@
         links.add(link2);
 
         assertThat(paths.iterator().next().links(), is(links));
-        assertThat(paths.iterator().next().cost(), is((double) 200));
+        assertThat(paths.iterator().next().weight(), is(ScalarWeight.toWeight(200.0)));
     }
 
     /**
@@ -561,7 +561,7 @@
 
         Set<Path> paths = computePath(link1, link2, link3, link4, constraints);
 
-        assertThat(paths.iterator().next().cost(), is((double) 2));
+        assertThat(paths.iterator().next().weight(), is(ScalarWeight.toWeight(2.0)));
     }
 
     /**
@@ -597,7 +597,7 @@
         constraints.add(bandwidthConst);
         Set<Path> paths = computePath(link1, link2, link3, link4, constraints);
 
-        assertThat(paths.iterator().next().cost(), is((double) 2));
+        assertThat(paths.iterator().next().weight(), is(ScalarWeight.toWeight(2.0)));
     }
 
     /**
@@ -662,7 +662,7 @@
         constraints.add(costConst);
         Set<Path> paths = computePath(link1, link2, link3, link4, constraints);
         assertThat(paths.iterator().next().links(), is(links));
-        assertThat(paths.iterator().next().cost(), is((double) 70));
+        assertThat(paths.iterator().next().weight(), is(ScalarWeight.toWeight(70.0)));
     }
 
     /**
@@ -727,7 +727,7 @@
         Set<Path> paths = computePath(link1, link2, link3, link4, constraints);
 
         assertThat(paths.iterator().next().links(), is(links));
-        assertThat(paths.iterator().next().cost(), is((double) 70));
+        assertThat(paths.iterator().next().weight(), is(ScalarWeight.toWeight(70.0)));
     }
 
     /**
@@ -742,7 +742,7 @@
         List<Constraint> constraints = new LinkedList<>();
         Set<Path> paths = computePath(link1, link2, link3, link4, constraints);
 
-        assertThat(paths.iterator().next().cost(), is((double) 2));
+        assertThat(paths.iterator().next().weight(), is(ScalarWeight.toWeight(2.0)));
     }
 
     /**
@@ -784,7 +784,7 @@
         links.add(link1);
         links.add(link2);
         assertThat(paths.iterator().next().links(), is(links));
-        assertThat(paths.iterator().next().cost(), is((double) 70));
+        assertThat(paths.iterator().next().weight(), is(ScalarWeight.toWeight(70.0)));
     }
 
     /**
@@ -877,7 +877,7 @@
         links.add(link1);
         links.add(link2);
         assertThat(paths.iterator().next().links(), is(links));
-        assertThat(paths.iterator().next().cost(), is((double) 70));
+        assertThat(paths.iterator().next().weight(), is(ScalarWeight.toWeight(70.0)));
     }
 
     /**
@@ -964,7 +964,7 @@
         links.add(link1);
         links.add(link2);
         assertThat(paths.iterator().next().links(), is(links));
-        assertThat(paths.iterator().next().cost(), is((double) 70));
+        assertThat(paths.iterator().next().weight(), is(ScalarWeight.toWeight(70.0)));
     }
 
     /**
@@ -1050,7 +1050,7 @@
         links.add(link1);
         links.add(link2);
         assertThat(paths.iterator().next().links(), is(links));
-        assertThat(paths.iterator().next().cost(), is((double) 70));
+        assertThat(paths.iterator().next().weight(), is(ScalarWeight.toWeight(70.0)));
     }
 
     /**
@@ -1138,7 +1138,7 @@
         links.add(link1);
         links.add(link2);
         assertThat(paths.iterator().next().links(), is(links));
-        assertThat(paths.iterator().next().cost(), is((double) 70));
+        assertThat(paths.iterator().next().weight(), is(ScalarWeight.toWeight(70.0)));
     }
 
     /**
@@ -1205,7 +1205,7 @@
         List<Link> links = new LinkedList<>();
         links.add(link1);
         links.add(link2);
-        assertThat(paths.iterator().next().cost(), is((double) 2));
+        assertThat(paths.iterator().next().weight(), is(ScalarWeight.toWeight(2.0)));
     }
 
     /**
@@ -1221,7 +1221,7 @@
         List<Constraint> constraints = new LinkedList<>();
         Set<Path> paths = computePath(link1, link2, link3, link4, constraints);
 
-        assertThat(paths.iterator().next().cost(), is((double) 2));
+        assertThat(paths.iterator().next().weight(), is(ScalarWeight.toWeight(2.0)));
     }
 
     /**
@@ -1237,7 +1237,7 @@
         List<Constraint> constraints = null;
         Set<Path> paths = computePath(link1, link2, link3, link4, constraints);
 
-        assertThat(paths.iterator().next().cost(), is((double) 2));
+        assertThat(paths.iterator().next().weight(), is(ScalarWeight.toWeight(2.0)));
     }
 
     /**
@@ -1296,7 +1296,7 @@
         links.add(link4);
         links.add(link5);
         assertThat(builder.build().iterator().next().links(), is(links));
-        assertThat(builder.build().iterator().next().cost(), is((double) 40));
+        assertThat(builder.build().iterator().next().weight(), is(ScalarWeight.toWeight(40.0)));
     }
 
     /**
@@ -1353,7 +1353,7 @@
         links.add(link2);
 
         assertThat(paths.iterator().next().links(), is(links));
-        assertThat(paths.iterator().next().cost(), is((double) 2));
+        assertThat(paths.iterator().next().weight(), is(ScalarWeight.toWeight(2.0)));
     }
 
     /**
diff --git a/apps/pce/app/src/test/java/org/onosproject/pce/pceservice/PceManagerTest.java b/apps/pce/app/src/test/java/org/onosproject/pce/pceservice/PceManagerTest.java
index 95a464e..1449eb0 100644
--- a/apps/pce/app/src/test/java/org/onosproject/pce/pceservice/PceManagerTest.java
+++ b/apps/pce/app/src/test/java/org/onosproject/pce/pceservice/PceManagerTest.java
@@ -21,6 +21,7 @@
 import org.junit.Before;
 import org.junit.Test;
 import org.onlab.graph.GraphPathSearch;
+import org.onlab.graph.ScalarWeight;
 import org.onlab.junit.TestUtils;
 import org.onlab.junit.TestUtils.TestUtilsException;
 import org.onlab.util.Bandwidth;
@@ -1011,10 +1012,10 @@
     }
 
     /**
-     * Tests resilency when L2 link is down.
+     * Tests resiliency when L2 link is down.
      */
     @Test
-    public void resilencyTest1() {
+    public void resiliencyTest1() {
         build4RouterTopo(true, false, false, false, 10);
 
 
@@ -1050,14 +1051,14 @@
 
         //Path is D1-D3-D4
         assertThat(pathService.paths().iterator().next().links(), is(links));
-        assertThat(pathService.paths().iterator().next().cost(), is((double) 180));
+        assertThat(pathService.paths().iterator().next().weight(), is(ScalarWeight.toWeight(180.0)));
     }
 
     /**
-     * Tests resilency when L2 and L4 link is down.
+     * Tests resiliency when L2 and L4 link is down.
      */
     @Test
-    public void resilencyTest2() {
+    public void resiliencyTest2() {
         build4RouterTopo(true, false, false, false, 10);
 
         List<Constraint> constraints = new LinkedList<Constraint>();
@@ -1093,10 +1094,10 @@
     }
 
     /**
-     * Tests resilency when D2 device is down.
+     * Tests resiliency when D2 device is down.
      */
     @Test
-    public void resilencyTest3() {
+    public void resiliencyTest3() {
         build4RouterTopo(true, false, false, false, 10);
 
         List<Constraint> constraints = new LinkedList<Constraint>();
@@ -1134,14 +1135,14 @@
         Path path = tunnelService.queryAllTunnels().iterator().next().path();
         //Path is D1-D3-D4
         assertThat(path.links(), is(links));
-        assertThat(path.cost(), is((double) 180));
+        assertThat(path.weight(), is(ScalarWeight.toWeight(180.0)));
     }
 
     /**
-     * Tests resilency when ingress device is down.
+     * Tests resiliency when ingress device is down.
      */
     @Test
-    public void resilencyTest4() {
+    public void resiliencyTest4() {
         build4RouterTopo(true, false, false, false, 10);
 
         List<Constraint> constraints = new LinkedList<Constraint>();
@@ -1177,10 +1178,10 @@
     }
 
     /**
-     * Tests resilency when D2 and D3 devices are down.
+     * Tests resiliency when D2 and D3 devices are down.
      */
     @Test
-    public void resilencyTest5() {
+    public void resiliencyTest5() {
         build4RouterTopo(true, false, false, false, 10);
 
         List<Constraint> constraints = new LinkedList<Constraint>();
@@ -1226,10 +1227,10 @@
     }
 
     /**
-     * Tests resilency when egress device is down.
+     * Tests resiliency when egress device is down.
      */
     @Test
-    public void resilencyTest6() {
+    public void resiliencyTest6() {
         build4RouterTopo(true, false, false, false, 10);
 
         List<Constraint> constraints = new LinkedList<Constraint>();
@@ -1268,10 +1269,10 @@
     }
 
     /**
-     * Tests resilency when egress device is down.
+     * Tests resiliency when egress device is down.
      */
     @Test
-    public void resilencyTest7() {
+    public void resiliencyTest7() {
         build4RouterTopo(true, false, false, false, 10);
 
         List<Constraint> constraints = new LinkedList<Constraint>();
@@ -1310,10 +1311,10 @@
     }
 
     /**
-     * Tests resilency when D2 device is suspended.
+     * Tests resiliency when D2 device is suspended.
      */
     @Test
-    public void resilencyTest8() {
+    public void resiliencyTest8() {
         build4RouterTopo(true, false, false, false, 10);
 
         List<Constraint> constraints = new LinkedList<Constraint>();
@@ -1355,14 +1356,14 @@
 
         //Path is D1-D3-D4
         assertThat(path.links(), is(links));
-        assertThat(path.cost(), is((double) 180));
+        assertThat(path.weight(), is(ScalarWeight.toWeight(180.0)));
     }
 
     /**
-     * Tests resilency when D2 device availability is changed.
+     * Tests resiliency when D2 device availability is changed.
      */
     @Test
-    public void resilencyTest11() {
+    public void resiliencyTest11() {
         build4RouterTopo(true, false, false, false, 10);
 
         List<Constraint> constraints = new LinkedList<Constraint>();
@@ -1404,14 +1405,14 @@
 
         //Path is D1-D3-D4
         assertThat(path.links(), is(links));
-        assertThat(path.cost(), is((double) 180));
+        assertThat(path.weight(), is(ScalarWeight.toWeight(180.0)));
     }
 
     /**
-     * Tests resilency when link2 availability is changed.
+     * Tests resiliency when link2 availability is changed.
      */
     @Test
-    public void resilencyTest12() {
+    public void resiliencyTest12() {
         build4RouterTopo(true, false, false, false, 10);
 
         List<Constraint> constraints = new LinkedList<Constraint>();
diff --git a/core/api/src/test/java/org/onosproject/net/DefaultDisjointPathTest.java b/core/api/src/test/java/org/onosproject/net/DefaultDisjointPathTest.java
index 5c30c57..abe4627 100644
--- a/core/api/src/test/java/org/onosproject/net/DefaultDisjointPathTest.java
+++ b/core/api/src/test/java/org/onosproject/net/DefaultDisjointPathTest.java
@@ -84,7 +84,7 @@
         assertThat(disjointPath1.primary(), is(path1));
         assertThat(disjointPath1.backup(), is(path2));
         assertThat(disjointPath1.links(), is(links1));
-        assertThat(disjointPath1.cost(), is(1.0));
+        assertThat(disjointPath1.weight(), is(ScalarWeight.toWeight(1.0)));
     }
 
     /**
diff --git a/core/net/src/test/java/org/onosproject/net/topology/impl/TopologyManagerTest.java b/core/net/src/test/java/org/onosproject/net/topology/impl/TopologyManagerTest.java
index 3516058..fe1e73b 100644
--- a/core/net/src/test/java/org/onosproject/net/topology/impl/TopologyManagerTest.java
+++ b/core/net/src/test/java/org/onosproject/net/topology/impl/TopologyManagerTest.java
@@ -18,6 +18,7 @@
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
+import org.onlab.graph.ScalarWeight;
 import org.onosproject.event.Event;
 import org.onosproject.common.event.impl.TestEventDispatcher;
 import org.onosproject.net.ConnectPoint;
@@ -168,7 +169,7 @@
         assertEquals("wrong path count", 2, paths.size());
         Path path = paths.iterator().next();
         assertEquals("wrong path length", 2, path.links().size());
-        assertEquals("wrong path cost", 2, path.cost(), 0.01);
+        assertEquals("wrong path cost", ScalarWeight.toWeight(2), path.weight());
     }
 
     @Test
@@ -181,7 +182,7 @@
         assertEquals("wrong path count", 2, paths.size());
         Path path = paths.iterator().next();
         assertEquals("wrong path length", 2, path.links().size());
-        assertEquals("wrong path cost", 6.6, path.cost(), 0.01);
+        assertEquals("wrong path cost", ScalarWeight.toWeight(6.6), path.weight());
     }
 
     protected void validateEvents(Enum... types) {
diff --git a/incubator/net/src/test/java/org/onosproject/incubator/net/virtual/impl/VirtualNetworkPathManagerTest.java b/incubator/net/src/test/java/org/onosproject/incubator/net/virtual/impl/VirtualNetworkPathManagerTest.java
index cf49106..fee06a4 100644
--- a/incubator/net/src/test/java/org/onosproject/incubator/net/virtual/impl/VirtualNetworkPathManagerTest.java
+++ b/incubator/net/src/test/java/org/onosproject/incubator/net/virtual/impl/VirtualNetworkPathManagerTest.java
@@ -19,6 +19,7 @@
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
+import org.onlab.graph.ScalarWeight;
 import org.onlab.junit.TestUtils;
 import org.onlab.osgi.TestServiceDirectory;
 import org.onosproject.common.event.impl.TestEventDispatcher;
@@ -233,7 +234,7 @@
             assertEquals("incorrect length", length, path.links().size());
             assertEquals("incorrect source", src, path.src().elementId());
             assertEquals("incorrect destination", dst, path.dst().elementId());
-            assertEquals("incorrect cost", cost, path.cost(), 0);
+            assertEquals("incorrect cost", ScalarWeight.toWeight(cost), path.weight());
         }
     }
 }
diff --git a/incubator/net/src/test/java/org/onosproject/incubator/net/virtual/impl/VirtualNetworkTopologyManagerTest.java b/incubator/net/src/test/java/org/onosproject/incubator/net/virtual/impl/VirtualNetworkTopologyManagerTest.java
index ed51f94..3d74d4b 100644
--- a/incubator/net/src/test/java/org/onosproject/incubator/net/virtual/impl/VirtualNetworkTopologyManagerTest.java
+++ b/incubator/net/src/test/java/org/onosproject/incubator/net/virtual/impl/VirtualNetworkTopologyManagerTest.java
@@ -19,6 +19,7 @@
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
+import org.onlab.graph.ScalarWeight;
 import org.onlab.junit.TestUtils;
 import org.onlab.osgi.TestServiceDirectory;
 import org.onosproject.common.event.impl.TestEventDispatcher;
@@ -420,7 +421,7 @@
         assertEquals("The paths size did not match.", 1, paths1.size());
         Path path = paths1.iterator().next();
         assertEquals("wrong path length", 1, path.links().size());
-        assertEquals("wrong path cost", 1.0, path.cost(), 0.01);
+        assertEquals("wrong path cost", ScalarWeight.toWeight(1.0), path.weight());
     }
 
     /**