diff options
author | Jan Srnicek <jsrnicek@cisco.com> | 2017-08-15 11:30:28 +0200 |
---|---|---|
committer | Marek Gradzki <mgradzki@cisco.com> | 2017-08-16 08:18:47 +0000 |
commit | b8cf23cd61c2d3f57f9450570236534bce69232e (patch) | |
tree | 1840014acfe504fb58f81787e1ed52841453631f /lisp/lisp2vpp/src/test/java/io | |
parent | 3a7a67fe142749eb6b41f660d101f3fdffb8b3de (diff) |
HONEYCOMB-386 - Hc2vpp Customizers update
Utilizes new default update implementation
Change-Id: I9bf8473336274ba5fcfc18804f7b414937b3708e
Signed-off-by: Jan Srnicek <jsrnicek@cisco.com>
Diffstat (limited to 'lisp/lisp2vpp/src/test/java/io')
4 files changed, 12 insertions, 30 deletions
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/write/NativeForwardPathsTableCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/write/NativeForwardPathsTableCustomizerTest.java index 80bb2c600..e2f55fdd1 100644 --- a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/write/NativeForwardPathsTableCustomizerTest.java +++ b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/write/NativeForwardPathsTableCustomizerTest.java @@ -79,7 +79,11 @@ public class NativeForwardPathsTableCustomizerTest extends WriterCustomizerTest @Test public void testUpdateValid() throws WriteFailedException { when(api.gpeAddDelNativeFwdRpath(any())).thenReturn(future(new GpeAddDelNativeFwdRpathReply())); - customizer.updateCurrentAttributes(validId, validTableBefore(), validTable(), writeContext); + final NativeForwardPathsTable before = validTableBefore(); + final NativeForwardPathsTable after = validTable(); + // emulates what default update would do + customizer.deleteCurrentAttributes(validId, before, writeContext); + customizer.writeCurrentAttributes(validId, after, writeContext); verify(api, times(2)).gpeAddDelIface(requestCaptor.capture()); final List<GpeAddDelIface> requests = requestCaptor.getAllValues(); diff --git a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/ItrRemoteLocatorSetCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/ItrRemoteLocatorSetCustomizerTest.java index 4d76f7d6f..a05866114 100644 --- a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/ItrRemoteLocatorSetCustomizerTest.java +++ b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/ItrRemoteLocatorSetCustomizerTest.java @@ -84,16 +84,9 @@ public class ItrRemoteLocatorSetCustomizerTest extends LispWriterCustomizerTest fail("Test should have thrown exception"); } - @Test - public void updateCurrentAttributes() { - try { - customizer.updateCurrentAttributes(validId, validData, validData, writeContext); - } catch (WriteFailedException e) { - assertTrue(e.getCause() instanceof UnsupportedOperationException); - return; - } - - fail("Test should have thrown exception"); + @Test(expected = UnsupportedOperationException.class) + public void updateCurrentAttributes() throws WriteFailedException { + customizer.updateCurrentAttributes(validId, validData, validData, writeContext); } @Test diff --git a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/LocatorSetCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/LocatorSetCustomizerTest.java index edb648bd9..52ed5dfd1 100755 --- a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/LocatorSetCustomizerTest.java +++ b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/LocatorSetCustomizerTest.java @@ -18,7 +18,6 @@ package io.fd.hc2vpp.lisp.translate.write; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; @@ -121,18 +120,10 @@ public class LocatorSetCustomizerTest extends LispWriterCustomizerTest { assertEquals(1, request.isAdd); } - @Test + @Test(expected = UnsupportedOperationException.class) public void testUpdateCurrentAttributes() throws WriteFailedException { final InstanceIdentifier<LocatorSet> identifier = InstanceIdentifier.create(LocatorSet.class); - try { - customizer - .updateCurrentAttributes(identifier, mock(LocatorSet.class), mock(LocatorSet.class), writeContext); - } catch (WriteFailedException e) { - assertTrue(e.getCause() instanceof UnsupportedOperationException); - assertEquals(identifier, e.getFailedId()); - return; - } - fail("Test should have failed"); + customizer.updateCurrentAttributes(identifier, mock(LocatorSet.class), mock(LocatorSet.class), writeContext); } @Test(expected = NullPointerException.class) diff --git a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/MapServerCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/MapServerCustomizerTest.java index 19f8b0af4..27c716080 100644 --- a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/MapServerCustomizerTest.java +++ b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/MapServerCustomizerTest.java @@ -72,15 +72,9 @@ public class MapServerCustomizerTest extends LispWriterCustomizerTest implements } - @Test + @Test(expected = UnsupportedOperationException.class) public void updateCurrentAttributes() throws Exception { - try { - customizer.updateCurrentAttributes(ID, data, data, writeContext); - } catch (WriteFailedException e) { - assertTrue(e instanceof WriteFailedException.UpdateFailedException); - assertTrue(e.getCause() instanceof UnsupportedOperationException); - verify(api, times(0)).oneAddDelMapServer(any()); - } + customizer.updateCurrentAttributes(ID, data, data, writeContext); } @Test |