Cleanup tests. 79/20679/1
authorSteven Pisarski <s.pisarski@cablelabs.com>
Mon, 18 May 2015 21:59:18 +0000 (15:59 -0600)
committerSteven Pisarski <s.pisarski@cablelabs.com>
Mon, 18 May 2015 21:59:18 +0000 (15:59 -0600)
Change-Id: I7869a5d2f3db56ca0633c819383e6d5a5576085e
Signed-off-by: Steven Pisarski <s.pisarski@cablelabs.com>
packetcable-policy-server/src/test/java/org/opendaylight/controller/packetcable/provider/PCMMServiceTest.java

index 3a1a24f78dac945d30af257e352b3b72713057df..12a609b8a5e0ca6ef1095f8c9b4d01354eb08b39 100644 (file)
@@ -100,14 +100,6 @@ public class PCMMServiceTest {
 
     @Before
     public void setup() throws IOException {
-        final Set<String> upGates = new HashSet<>();
-        upGates.add("extrm_up");
-        final Set<String> dnGates = new HashSet<>();
-        dnGates.add("extrm_dn");
-        final Map<Direction, Set<String>> gates = new HashMap<>();
-        gates.put(Direction.UPSTREAM, upGates);
-        gates.put(Direction.DOWNSTREAM, dnGates);
-
         srcAddr = new Ipv4Address("10.10.10.0");
         dstAddr = new Ipv4Address("10.32.99.99");
 
@@ -125,6 +117,14 @@ public class PCMMServiceTest {
             // Use me for automated testing and the CMTS emulator running in the same JVM
             cmtsAddr = new Ipv4Address("127.0.0.1");
 
+            final Set<String> upGates = new HashSet<>();
+            upGates.add("extrm_up");
+            final Set<String> dnGates = new HashSet<>();
+            dnGates.add("extrm_dn");
+            final Map<Direction, Set<String>> gates = new HashMap<>();
+            gates.put(Direction.UPSTREAM, upGates);
+            gates.put(Direction.DOWNSTREAM, dnGates);
+
             final Map<String, Boolean> cmStatus = new HashMap<>();
             cmStatus.put(cmAddrInet.getHostAddress(), true);
             cmStatus.put(invalidCmAddrInet.getHostAddress(), false);
@@ -148,27 +148,15 @@ public class PCMMServiceTest {
         connectToCmts(service);
     }
 
-    @Test
-    public void testAddInvalidCcapBadHost() {
-        cmtsAddr = new Ipv4Address("0.0.0.0");
-        ccap = makeCcapsObj(PCMMPdpAgent.WELL_KNOWN_PDP_PORT, cmtsAddr, ccapId);
-        service = new PCMMService(IPCMMClient.CLIENT_TYPE, ccap);
-        final String message = service.addCcap();
-        Assert.assertNotNull(message);
-        final String expectedMsg = "404 Not Found - CCAP " + ccapId + " failed to connect @ " + cmtsAddr.getValue()
-                + ':' + PCMMPdpAgent.WELL_KNOWN_PDP_PORT + " - Connection refused";
-        Assert.assertEquals(expectedMsg, message);
-    }
-
     @Test
     public void testAddInvalidCcapBadPort() {
-        ccap = makeCcapsObj(1234, cmtsAddr, ccapId);
+        ccap = makeCcapsObj((icmts.getPort() + 1), cmtsAddr, ccapId);
         service = new PCMMService(IPCMMClient.CLIENT_TYPE, ccap);
         final String message = service.addCcap();
         Assert.assertNotNull(message);
         final String expectedMsg = "404 Not Found - CCAP " + ccapId + " failed to connect @ " + cmtsAddr.getValue()
-                + ":1234 - Connection refused";
-        Assert.assertEquals(expectedMsg, message);
+                + ':' + (icmts.getPort() + 1) + " - ";
+        Assert.assertTrue(expectedMsg, message.startsWith(expectedMsg));
     }
 
     @Test