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>();