Bump upstream dependencies to S-SR1
[transportpce.git] / servicehandler / src / test / java / org / opendaylight / transportpce / servicehandler / DowngradeConstraintsTest.java
index 3a4ebd7877ab9b426018c8a9261278ad90ae0b36..61596966ebe50196b155fbde00acfba310d5fac4 100644 (file)
@@ -317,7 +317,7 @@ public class DowngradeConstraintsTest {
     }
 
     @Test
-    public void testUpdateSoftConstraintsForHopCount() {
+    public void testUpdateSoftConstraintsForHopCountAndTEmetric() {
         HardConstraints initialHardConstraints =
             buildHardConstraint(null, false, null, null, null, null, false, false, null, null);
         SoftConstraints initialSoftConstraints =
@@ -327,18 +327,22 @@ public class DowngradeConstraintsTest {
         assertNull("updated soft constraints should contain no hop-count constraint",
             generatedSoftConstraints.getHopCount());
 
-        initialSoftConstraints = buildSoftConstraint(null, false, null, null, null, null, true, false, null, null);
+        initialSoftConstraints = buildSoftConstraint(null, false, null, null, null, null, true, true, null, null);
         generatedSoftConstraints = DowngradeConstraints.updateSoftConstraints(
             initialHardConstraints, initialSoftConstraints);
         assertEquals("updated soft constraints should not be changed",
             initialSoftConstraints.getHopCount(), generatedSoftConstraints.getHopCount());
         assertEquals("updated soft constraints max-wdm-hop-count should be '3'",
             3, generatedSoftConstraints.getHopCount().getMaxWdmHopCount().intValue());
-        assertNull("updated soft constraints max-otn-hop-count should be null",
-            generatedSoftConstraints.getHopCount().getMaxOtnHopCount());
+        assertEquals("updated soft constraints max-otn-hop-count should be '5'",
+            5, generatedSoftConstraints.getHopCount().getMaxOtnHopCount().intValue());
+        assertEquals("updated soft constraints max-wdm-TE-metric should be '8'",
+            8, generatedSoftConstraints.getTEMetric().getMaxWdmTEMetric().intValue());
+        assertEquals("updated soft constraints max-otn-TE-metric should be '11'",
+            11, generatedSoftConstraints.getTEMetric().getMaxOtnTEMetric().intValue());
 
         // test addition of hard hop-count when no soft hop-count
-        initialHardConstraints = buildHardConstraint(null, false, null, null, null, null, true, false, null, null);
+        initialHardConstraints = buildHardConstraint(null, false, null, null, null, null, true, true, null, null);
         initialSoftConstraints = buildSoftConstraint(null, false, null, null, null, null, false, false, null, null);
         generatedSoftConstraints = DowngradeConstraints.updateSoftConstraints(
             initialHardConstraints, initialSoftConstraints);
@@ -346,17 +350,25 @@ public class DowngradeConstraintsTest {
             initialHardConstraints.getHopCount(), generatedSoftConstraints.getHopCount());
         assertEquals("updated soft constraints max-wdm-hop-count should be '3'",
             3, generatedSoftConstraints.getHopCount().getMaxWdmHopCount().intValue());
-        assertNull("updated soft constraints max-otn-hop-count should be null",
-            generatedSoftConstraints.getHopCount().getMaxOtnHopCount());
+        assertEquals("updated soft constraints max-otn-hop-count should be '5'",
+            5, generatedSoftConstraints.getHopCount().getMaxOtnHopCount().intValue());
+        assertEquals("updated soft constraints max-wdm-TE-metric should be '8'",
+            8, generatedSoftConstraints.getTEMetric().getMaxWdmTEMetric().intValue());
+        assertEquals("updated soft constraints max-otn-TE-metric should be '11'",
+            11, generatedSoftConstraints.getTEMetric().getMaxOtnTEMetric().intValue());
 
         // test addition of hard hop-count when existing soft hop-count
-        initialSoftConstraints = buildSoftConstraint(null, false, null, null, null, null, true, false, null, null);
+        initialSoftConstraints = buildSoftConstraint(null, false, null, null, null, null, true, true, null, null);
         generatedSoftConstraints = DowngradeConstraints.updateSoftConstraints(
             initialHardConstraints, initialSoftConstraints);
         assertEquals("updated soft constraints max-wdm-hop-count should be '3'",
             3, generatedSoftConstraints.getHopCount().getMaxWdmHopCount().intValue());
-        assertNull("updated soft constraints max-otn-hop-count should be null",
-            generatedSoftConstraints.getHopCount().getMaxOtnHopCount());
+        assertEquals("updated soft constraints max-otn-hop-count should be '5'",
+            5, generatedSoftConstraints.getHopCount().getMaxOtnHopCount().intValue());
+        assertEquals("updated soft constraints max-wdm-TE-metric should be '8'",
+            8, generatedSoftConstraints.getTEMetric().getMaxWdmTEMetric().intValue());
+        assertEquals("updated soft constraints max-otn-TE-metric should be '11'",
+            11, generatedSoftConstraints.getTEMetric().getMaxOtnTEMetric().intValue());
     }
 
     @Test