HONEYCOMB-154: update revison of models that changed since 16.09
[honeycomb.git] / lisp / lisp2vpp / src / test / java / io / fd / honeycomb / lisp / translate / read / dump / executor / VniTableDumpExecutorTest.java
index 3bc95d5..305fa96 100644 (file)
@@ -7,65 +7,72 @@ import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 import com.google.common.collect.ImmutableList;
+import io.fd.honeycomb.translate.read.ReadFailedException;
 import io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor;
-import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.DumpExecutionFailedException;
-import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.i.DumpCallFailedException;
-import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.i.DumpTimeoutException;
 import io.fd.honeycomb.vpp.test.read.JvppDumpExecutorTest;
+import io.fd.vpp.jvpp.VppCallbackException;
+import io.fd.vpp.jvpp.core.dto.LispEidTableVniDetails;
+import io.fd.vpp.jvpp.core.dto.LispEidTableVniDetailsReplyDump;
 import java.util.concurrent.TimeoutException;
 import org.junit.Before;
 import org.junit.Test;
 import org.mockito.Mockito;
-import io.fd.vpp.jvpp.core.dto.LispEidTableMapDetails;
-import io.fd.vpp.jvpp.core.dto.LispEidTableMapDetailsReplyDump;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.VniTable;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
 
 public class VniTableDumpExecutorTest extends JvppDumpExecutorTest<VniTableDumpExecutor> {
 
-    private LispEidTableMapDetailsReplyDump validDump;
+    private LispEidTableVniDetailsReplyDump validDump;
+    private InstanceIdentifier<VniTable> identifier;
 
     @Before
     public void init() {
-        validDump = new LispEidTableMapDetailsReplyDump();
-        LispEidTableMapDetails detail = new LispEidTableMapDetails();
-        detail.dpTable = 1;
+        validDump = new LispEidTableVniDetailsReplyDump();
+        identifier = InstanceIdentifier.create(VniTable.class);
+        LispEidTableVniDetails detail = new LispEidTableVniDetails();
         detail.vni = 2;
         detail.context = 4;
-        validDump.lispEidTableMapDetails = ImmutableList.of(detail);
+        validDump.lispEidTableVniDetails = ImmutableList.of(detail);
     }
 
-    @Test(expected = DumpCallFailedException.class)
-    public void testExecuteDumpFail() throws DumpExecutionFailedException {
-        doThrowFailExceptionWhen().lispEidTableMapDump(Mockito.any());
-        getExecutor().executeDump(EntityDumpExecutor.NO_PARAMS);
-    }
+    @Test
+    public void testExecuteDumpFail() throws Exception {
+        doThrowFailExceptionWhen().lispEidTableVniDump(Mockito.any());
+        try {
+            getExecutor().executeDump(identifier, EntityDumpExecutor.NO_PARAMS);
+        } catch (ReadFailedException e) {
+            assertTrue(e.getCause() instanceof VppCallbackException);
+            return;
+        }
 
+        fail("Test should have thrown ReadFailedException");
+    }
 
     @Test
     public void testExecuteDumpTimeout() throws Exception {
-        doThrowTimeoutExceptionWhen().lispEidTableMapDump(Mockito.any());
+        doThrowTimeoutExceptionWhen().lispEidTableVniDump(Mockito.any());
         try {
-            getExecutor().executeDump(EntityDumpExecutor.NO_PARAMS);
-        } catch (Exception e) {
-            assertTrue(e instanceof DumpTimeoutException);
+            getExecutor().executeDump(identifier, EntityDumpExecutor.NO_PARAMS);
+        } catch (ReadFailedException e) {
             assertTrue(e.getCause() instanceof TimeoutException);
             return;
         }
-        fail("Test should have thrown exception");
+        fail("Test should have thrown ReadFailedException");
     }
 
     @Test
-    public void testExecuteDump() throws DumpExecutionFailedException {
+    public void testExecuteDump() throws Exception {
 
-        doReturnResponseWhen(validDump).lispEidTableMapDump(Mockito.any());
-        final LispEidTableMapDetailsReplyDump reply = getExecutor().executeDump(EntityDumpExecutor.NO_PARAMS);
+        doReturnResponseWhen(validDump).lispEidTableVniDump(Mockito.any());
+        final LispEidTableVniDetailsReplyDump reply =
+                getExecutor().executeDump(identifier, EntityDumpExecutor.NO_PARAMS);
 
         assertNotNull(reply);
-        assertEquals(1, reply.lispEidTableMapDetails.size());
-        final LispEidTableMapDetails detail = reply.lispEidTableMapDetails.get(0);
+        assertEquals(1, reply.lispEidTableVniDetails.size());
+        final LispEidTableVniDetails detail = reply.lispEidTableVniDetails.get(0);
 
         assertEquals(4, detail.context);
-        assertEquals(1, detail.dpTable);
         assertEquals(2, detail.vni);
     }