diff options
author | Jan Srnicek <jsrnicek@cisco.com> | 2016-10-06 08:54:02 +0200 |
---|---|---|
committer | Jan Srnicek <jsrnicek@cisco.com> | 2016-10-06 08:54:02 +0200 |
commit | 8c9c430823aa19912a55b0a6ccfcbbb6a1bc028d (patch) | |
tree | 1e5aa752236ada01009a353cf34eb6b7706e65fc /v3po/v3po2vpp/src/test/java/io | |
parent | 15f481bc86adfd879e0e0d001ef3dd0939aa3649 (diff) |
HONEYCOMB-236 - Unified read/write exceptions
Change-Id: Idde761d0c0c2c4d96555ef94dbdaa87fad889493
Signed-off-by: Jan Srnicek <jsrnicek@cisco.com>
Diffstat (limited to 'v3po/v3po2vpp/src/test/java/io')
9 files changed, 73 insertions, 76 deletions
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/AclCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/AclCustomizerTest.java index 4b7489f8e..ac0a003d8 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/AclCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/AclCustomizerTest.java @@ -117,7 +117,7 @@ public class AclCustomizerTest extends WriterCustomizerTest { try { customizer.writeCurrentAttributes(id, acl, writeContext); - } catch (WriteFailedException.CreateFailedException e) { + } catch (WriteFailedException e) { assertTrue(e.getCause() instanceof VppBaseCallException); verify(api).inputAclSetInterface(generateInputAclSetInterface((byte) 1, IF_INDEX, ACL_TABLE_INDEX)); return; @@ -146,7 +146,7 @@ public class AclCustomizerTest extends WriterCustomizerTest { try { customizer.deleteCurrentAttributes(id, acl, writeContext); - } catch (WriteFailedException.DeleteFailedException e) { + } catch (WriteFailedException e) { assertTrue(e.getCause() instanceof VppBaseCallException); verify(api).inputAclSetInterface(generateInputAclSetInterface((byte) 0, IF_INDEX, ACL_TABLE_INDEX)); return; diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/RewriteCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/RewriteCustomizerTest.java index 7effc876e..3cedc4f71 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/RewriteCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/RewriteCustomizerTest.java @@ -26,6 +26,10 @@ import io.fd.honeycomb.translate.vpp.util.NamingContext; import io.fd.honeycomb.translate.vpp.util.TagRewriteOperation; import io.fd.honeycomb.translate.write.WriteFailedException; import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest; +import io.fd.vpp.jvpp.VppBaseCallException; +import io.fd.vpp.jvpp.VppInvocationException; +import io.fd.vpp.jvpp.core.dto.L2InterfaceVlanTagRewrite; +import io.fd.vpp.jvpp.core.dto.L2InterfaceVlanTagRewriteReply; import org.junit.Assert; import org.junit.Test; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces; @@ -40,10 +44,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.sub._interface.base.attributes.l2.RewriteBuilder; import org.opendaylight.yangtools.yang.binding.ChildOf; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import io.fd.vpp.jvpp.VppBaseCallException; -import io.fd.vpp.jvpp.VppInvocationException; -import io.fd.vpp.jvpp.core.dto.L2InterfaceVlanTagRewrite; -import io.fd.vpp.jvpp.core.dto.L2InterfaceVlanTagRewriteReply; public class RewriteCustomizerTest extends WriterCustomizerTest { @@ -68,10 +68,10 @@ public class RewriteCustomizerTest extends WriterCustomizerTest { private static InstanceIdentifier<Rewrite> getVlanTagRewriteId(final String name, final long index) { final Class<ChildOf<? super SubInterface>> child = (Class) Rewrite.class; final InstanceIdentifier id = - InstanceIdentifier.create(Interfaces.class).child(Interface.class, new InterfaceKey(name)).augmentation( - SubinterfaceAugmentation.class).child(SubInterfaces.class) - .child(SubInterface.class, new SubInterfaceKey(index)) - .child(child); + InstanceIdentifier.create(Interfaces.class).child(Interface.class, new InterfaceKey(name)).augmentation( + SubinterfaceAugmentation.class).child(SubInterfaces.class) + .child(SubInterface.class, new SubInterfaceKey(index)) + .child(child); return id; } @@ -96,7 +96,7 @@ public class RewriteCustomizerTest extends WriterCustomizerTest { */ private void whenL2InterfaceVlanTagRewriteThenSuccess() { doReturn(future(new L2InterfaceVlanTagRewriteReply())).when(api) - .l2InterfaceVlanTagRewrite(any(L2InterfaceVlanTagRewrite.class)); + .l2InterfaceVlanTagRewrite(any(L2InterfaceVlanTagRewrite.class)); } /** @@ -133,7 +133,7 @@ public class RewriteCustomizerTest extends WriterCustomizerTest { try { customizer.writeCurrentAttributes(VLAN_IID, vlanTagRewrite, writeContext); - } catch (WriteFailedException.CreateFailedException e) { + } catch (WriteFailedException e) { assertTrue(e.getCause() instanceof VppBaseCallException); verify(api).l2InterfaceVlanTagRewrite(generateL2InterfaceVlanTagRewrite(VLAN_IF_INDEX, op)); return; @@ -151,7 +151,7 @@ public class RewriteCustomizerTest extends WriterCustomizerTest { customizer.updateCurrentAttributes(VLAN_IID, before, after, writeContext); verify(api) - .l2InterfaceVlanTagRewrite(generateL2InterfaceVlanTagRewrite(VLAN_IF_INDEX, TagRewriteOperation.pop_1)); + .l2InterfaceVlanTagRewrite(generateL2InterfaceVlanTagRewrite(VLAN_IF_INDEX, TagRewriteOperation.pop_1)); } @Test @@ -163,10 +163,11 @@ public class RewriteCustomizerTest extends WriterCustomizerTest { try { customizer.updateCurrentAttributes(VLAN_IID, before, after, writeContext); - } catch (WriteFailedException.UpdateFailedException e) { + } catch (WriteFailedException e) { assertTrue(e.getCause() instanceof VppBaseCallException); verify(api) - .l2InterfaceVlanTagRewrite(generateL2InterfaceVlanTagRewrite(VLAN_IF_INDEX, TagRewriteOperation.pop_1)); + .l2InterfaceVlanTagRewrite( + generateL2InterfaceVlanTagRewrite(VLAN_IF_INDEX, TagRewriteOperation.pop_1)); return; } fail("WriteFailedException.UpdateFailedException was expected"); @@ -187,7 +188,7 @@ public class RewriteCustomizerTest extends WriterCustomizerTest { try { customizer.deleteCurrentAttributes(VLAN_IID, null, writeContext); - } catch (WriteFailedException.DeleteFailedException e) { + } catch (WriteFailedException e) { Assert.assertTrue(e.getCause() instanceof VppBaseCallException); verifyL2InterfaceVlanTagRewriteDeleteWasInvoked(); return; diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/RoutingCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/RoutingCustomizerTest.java index 930e3d14f..6c7d05823 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/RoutingCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/RoutingCustomizerTest.java @@ -59,7 +59,7 @@ public class RoutingCustomizerTest extends WriterCustomizerTest { verify(api).swInterfaceSetTable(expectedRequest(vrfId)); } - @Test(expected = WriteFailedException.CreateFailedException.class) + @Test(expected = WriteFailedException.class) public void testWriteFailed() throws WriteFailedException { when(api.swInterfaceSetTable(any())).thenReturn(failedFuture()); customizer.writeCurrentAttributes(IID, routing(213), writeContext); @@ -72,7 +72,7 @@ public class RoutingCustomizerTest extends WriterCustomizerTest { verifyZeroInteractions(api); } - @Test(expected = WriteFailedException.UpdateFailedException.class) + @Test(expected = WriteFailedException.class) public void testUpdateFailed() throws WriteFailedException { when(api.swInterfaceSetTable(any())).thenReturn(failedFuture()); customizer.updateCurrentAttributes(IID, routing(123L), routing(321L), writeContext); diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/SubInterfaceAclCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/SubInterfaceAclCustomizerTest.java index f5ec496ef..e754ec9c1 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/SubInterfaceAclCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/SubInterfaceAclCustomizerTest.java @@ -55,9 +55,9 @@ public class SubInterfaceAclCustomizerTest extends WriterCustomizerTest { private static final int TABLE_INDEX = 123; private static final InstanceIdentifier<Ingress> IID = - InstanceIdentifier.create(Interfaces.class).child(Interface.class, new InterfaceKey(IF_NAME)).augmentation( - SubinterfaceAugmentation.class).child(SubInterfaces.class) - .child(SubInterface.class, new SubInterfaceKey(SUBIF_ID)).child(Acl.class).child(Ingress.class); + InstanceIdentifier.create(Interfaces.class).child(Interface.class, new InterfaceKey(IF_NAME)).augmentation( + SubinterfaceAugmentation.class).child(SubInterfaces.class) + .child(SubInterface.class, new SubInterfaceKey(SUBIF_ID)).child(Acl.class).child(Ingress.class); @Mock private VppClassifierContextManager classifyTableContext; @@ -67,7 +67,7 @@ public class SubInterfaceAclCustomizerTest extends WriterCustomizerTest { @Override protected void setUp() throws Exception { customizer = new SubInterfaceAclCustomizer(api, new NamingContext("prefix", IFC_TEST_INSTANCE), - classifyTableContext); + classifyTableContext); defineMapping(mappingContext, IF_NAME, IF_INDEX, IFC_TEST_INSTANCE); defineMapping(mappingContext, SUBIF_NAME, SUBIF_INDEX, IFC_TEST_INSTANCE); when(classifyTableContext.getTableIndex(TABLE_NAME, mappingContext)).thenReturn(TABLE_INDEX); @@ -80,7 +80,7 @@ public class SubInterfaceAclCustomizerTest extends WriterCustomizerTest { verify(api).inputAclSetInterface(expectedIp4AclRequest()); } - @Test(expected = WriteFailedException.CreateFailedException.class) + @Test(expected = WriteFailedException.class) public void testCreateFailed() throws WriteFailedException { when(api.inputAclSetInterface(any())).thenReturn(failedFuture()); customizer.writeCurrentAttributes(IID, ip4Acl(), writeContext); @@ -98,7 +98,7 @@ public class SubInterfaceAclCustomizerTest extends WriterCustomizerTest { verify(api).inputAclSetInterface(expectedIp6AclRequest()); } - @Test(expected = WriteFailedException.DeleteFailedException.class) + @Test(expected = WriteFailedException.class) public void testDeleteFailed() throws WriteFailedException { when(api.inputAclSetInterface(any())).thenReturn(failedFuture()); customizer.deleteCurrentAttributes(IID, ip4Acl(), writeContext); diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vpp/ArpTerminationTableEntryCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vpp/ArpTerminationTableEntryCustomizerTest.java index dece4bfe8..4ece9228b 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vpp/ArpTerminationTableEntryCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vpp/ArpTerminationTableEntryCustomizerTest.java @@ -28,6 +28,10 @@ import static org.mockito.Mockito.verify; import io.fd.honeycomb.translate.vpp.util.NamingContext; import io.fd.honeycomb.translate.write.WriteFailedException; import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest; +import io.fd.vpp.jvpp.VppBaseCallException; +import io.fd.vpp.jvpp.VppInvocationException; +import io.fd.vpp.jvpp.core.dto.BdIpMacAddDel; +import io.fd.vpp.jvpp.core.dto.BdIpMacAddDelReply; import org.junit.Test; import org.mockito.ArgumentCaptor; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress; @@ -41,10 +45,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.bridge.domains.BridgeDomain; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.bridge.domains.BridgeDomainKey; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import io.fd.vpp.jvpp.VppBaseCallException; -import io.fd.vpp.jvpp.VppInvocationException; -import io.fd.vpp.jvpp.core.dto.BdIpMacAddDel; -import io.fd.vpp.jvpp.core.dto.BdIpMacAddDelReply; public class ArpTerminationTableEntryCustomizerTest extends WriterCustomizerTest { private static final String BD_CTX_NAME = "bd-test-instance"; @@ -66,8 +66,8 @@ public class ArpTerminationTableEntryCustomizerTest extends WriterCustomizerTest public void setUp() throws Exception { customizer = new ArpTerminationTableEntryCustomizer(api, new NamingContext("generatedBdName", BD_CTX_NAME)); - ipAddressRaw = new byte[] {1, 2, 3, 4}; - physAddressRaw = new byte[] {1, 2, 3, 4, 5, 6}; + ipAddressRaw = new byte[]{1, 2, 3, 4}; + physAddressRaw = new byte[]{1, 2, 3, 4, 5, 6}; physAddress = new PhysAddress("01:02:03:04:05:06"); ipAddress = new IpAddress(Ipv4AddressNoZone.getDefaultInstance("1.2.3.4")); @@ -81,8 +81,8 @@ public class ArpTerminationTableEntryCustomizerTest extends WriterCustomizerTest private static InstanceIdentifier<ArpTerminationTableEntry> getArpEntryId(final IpAddress ipAddress, final PhysAddress physAddress) { return InstanceIdentifier.create(BridgeDomains.class).child(BridgeDomain.class, new BridgeDomainKey(BD_NAME)) - .child(ArpTerminationTable.class) - .child(ArpTerminationTableEntry.class, new ArpTerminationTableEntryKey(ipAddress, physAddress)); + .child(ArpTerminationTable.class) + .child(ArpTerminationTableEntry.class, new ArpTerminationTableEntryKey(ipAddress, physAddress)); } private void whenBdIpMacAddDelThenSuccess() { @@ -112,7 +112,7 @@ public class ArpTerminationTableEntryCustomizerTest extends WriterCustomizerTest } private void verifyBdIpMacAddDelWasInvoked(final BdIpMacAddDel expected) throws - VppInvocationException { + VppInvocationException { ArgumentCaptor<BdIpMacAddDel> argumentCaptor = ArgumentCaptor.forClass(BdIpMacAddDel.class); verify(api).bdIpMacAddDel(argumentCaptor.capture()); final BdIpMacAddDel actual = argumentCaptor.getValue(); @@ -134,7 +134,7 @@ public class ArpTerminationTableEntryCustomizerTest extends WriterCustomizerTest whenBdIpMacAddDelThenFailure(); try { customizer.writeCurrentAttributes(id, entry, writeContext); - } catch (WriteFailedException.CreateFailedException e) { + } catch (WriteFailedException e) { assertTrue(e.getCause() instanceof VppBaseCallException); verifyBdIpMacAddDelWasInvoked(generateBdIpMacAddDelRequest(ipAddressRaw, physAddressRaw, (byte) 1)); return; @@ -145,8 +145,8 @@ public class ArpTerminationTableEntryCustomizerTest extends WriterCustomizerTest @Test(expected = UnsupportedOperationException.class) public void testUpdate() throws Exception { customizer.updateCurrentAttributes(InstanceIdentifier.create(ArpTerminationTableEntry.class), - mock(ArpTerminationTableEntry.class), - mock(ArpTerminationTableEntry.class), writeContext); + mock(ArpTerminationTableEntry.class), + mock(ArpTerminationTableEntry.class), writeContext); } @Test @@ -161,7 +161,7 @@ public class ArpTerminationTableEntryCustomizerTest extends WriterCustomizerTest whenBdIpMacAddDelThenFailure(); try { customizer.deleteCurrentAttributes(id, entry, writeContext); - } catch (WriteFailedException.DeleteFailedException e) { + } catch (WriteFailedException e) { assertTrue(e.getCause() instanceof VppBaseCallException); verifyBdIpMacAddDelWasInvoked(generateBdIpMacAddDelRequest(ipAddressRaw, physAddressRaw, (byte) 0)); return; diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vpp/BridgeDomainCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vpp/BridgeDomainCustomizerTest.java index 2ab921c90..b18273350 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vpp/BridgeDomainCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vpp/BridgeDomainCustomizerTest.java @@ -27,6 +27,9 @@ import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator; import io.fd.honeycomb.translate.vpp.util.NamingContext; import io.fd.honeycomb.translate.write.WriteFailedException; import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest; +import io.fd.vpp.jvpp.VppInvocationException; +import io.fd.vpp.jvpp.core.dto.BridgeDomainAddDel; +import io.fd.vpp.jvpp.core.dto.BridgeDomainAddDelReply; import javax.annotation.Nullable; import org.junit.Test; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.BridgeDomains; @@ -35,9 +38,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.bridge.domains.BridgeDomainKey; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier; -import io.fd.vpp.jvpp.VppInvocationException; -import io.fd.vpp.jvpp.core.dto.BridgeDomainAddDel; -import io.fd.vpp.jvpp.core.dto.BridgeDomainAddDelReply; public class BridgeDomainCustomizerTest extends WriterCustomizerTest implements ByteDataTranslator { @@ -155,7 +155,7 @@ public class BridgeDomainCustomizerTest extends WriterCustomizerTest implements try { customizer.writeCurrentAttributes(bdIdentifierForName(bdName), bd, writeContext); - } catch (WriteFailedException.CreateFailedException e) { + } catch (WriteFailedException e) { verifyBridgeDomainAddOrUpdateWasInvoked(bd, bdId); return; } @@ -202,7 +202,7 @@ public class BridgeDomainCustomizerTest extends WriterCustomizerTest implements try { customizer.deleteCurrentAttributes(bdIdentifierForName(bdName), bd, writeContext); - } catch (WriteFailedException.DeleteFailedException e) { + } catch (WriteFailedException e) { verifyBridgeDomainDeleteWasInvoked(bdId); return; } @@ -265,10 +265,8 @@ public class BridgeDomainCustomizerTest extends WriterCustomizerTest implements whenBridgeDomainAddDelThenFailure(); try { - customizer - .updateCurrentAttributes(bdIdentifierForName(bdName), bdBefore, bdAfter, - writeContext); - } catch (WriteFailedException.UpdateFailedException e) { + customizer.updateCurrentAttributes(bdIdentifierForName(bdName), bdBefore, bdAfter, writeContext); + } catch (WriteFailedException e) { verifyBridgeDomainAddOrUpdateWasInvoked(bdAfter, bdId); return; } diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vpp/L2FibEntryCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vpp/L2FibEntryCustomizerTest.java index 4704ef084..d2ea4c32d 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vpp/L2FibEntryCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vpp/L2FibEntryCustomizerTest.java @@ -27,6 +27,10 @@ import static org.mockito.Mockito.verify; import io.fd.honeycomb.translate.vpp.util.NamingContext; import io.fd.honeycomb.translate.write.WriteFailedException; import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest; +import io.fd.vpp.jvpp.VppBaseCallException; +import io.fd.vpp.jvpp.VppInvocationException; +import io.fd.vpp.jvpp.core.dto.L2FibAddDel; +import io.fd.vpp.jvpp.core.dto.L2FibAddDelReply; import org.junit.Test; import org.mockito.ArgumentCaptor; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress; @@ -39,10 +43,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.bridge.domains.BridgeDomain; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.bridge.domains.BridgeDomainKey; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import io.fd.vpp.jvpp.VppBaseCallException; -import io.fd.vpp.jvpp.VppInvocationException; -import io.fd.vpp.jvpp.core.dto.L2FibAddDel; -import io.fd.vpp.jvpp.core.dto.L2FibAddDelReply; public class L2FibEntryCustomizerTest extends WriterCustomizerTest { private static final String BD_CTX_NAME = "bd-test-instance"; @@ -141,7 +141,7 @@ public class L2FibEntryCustomizerTest extends WriterCustomizerTest { try { customizer.writeCurrentAttributes(id, entry, writeContext); - } catch (WriteFailedException.CreateFailedException e) { + } catch (WriteFailedException e) { assertTrue(e.getCause() instanceof VppBaseCallException); verifyL2FibAddDelWasInvoked(generateL2FibAddDelRequest(address_vpp, (byte) 1)); return; @@ -180,7 +180,7 @@ public class L2FibEntryCustomizerTest extends WriterCustomizerTest { try { customizer.deleteCurrentAttributes(id, entry, writeContext); - } catch (WriteFailedException.DeleteFailedException e) { + } catch (WriteFailedException e) { assertTrue(e.getCause() instanceof VppBaseCallException); verifyL2FibAddDelWasInvoked(generateL2FibAddDelRequest(address_vpp, (byte) 0)); return; diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifySessionWriterTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifySessionWriterTest.java index b70ccf0f3..cb507b104 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifySessionWriterTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifySessionWriterTest.java @@ -27,6 +27,9 @@ import static org.mockito.Mockito.when; import com.google.common.base.Optional; import io.fd.honeycomb.translate.write.WriteFailedException; import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest; +import io.fd.vpp.jvpp.VppBaseCallException; +import io.fd.vpp.jvpp.core.dto.ClassifyAddDelSession; +import io.fd.vpp.jvpp.core.dto.ClassifyAddDelSessionReply; import org.junit.Test; import org.mockito.Mock; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.HexString; @@ -41,9 +44,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.clas import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev150603.vpp.classifier.ClassifyTable; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev150603.vpp.classifier.ClassifyTableKey; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import io.fd.vpp.jvpp.VppBaseCallException; -import io.fd.vpp.jvpp.core.dto.ClassifyAddDelSession; -import io.fd.vpp.jvpp.core.dto.ClassifyAddDelSessionReply; public class ClassifySessionWriterTest extends WriterCustomizerTest { @@ -81,13 +81,13 @@ public class ClassifySessionWriterTest extends WriterCustomizerTest { private static InstanceIdentifier<ClassifySession> getClassifySessionId(final String tableName, final String match) { return InstanceIdentifier.create(VppClassifier.class) - .child(ClassifyTable.class, new ClassifyTableKey(tableName)) - .child(ClassifySession.class, new ClassifySessionKey(new HexString(match))); + .child(ClassifyTable.class, new ClassifyTableKey(tableName)) + .child(ClassifySession.class, new ClassifySessionKey(new HexString(match))); } private void whenClassifyAddDelSessionThenSuccess() { doReturn(future(new ClassifyAddDelSessionReply())).when(api) - .classifyAddDelSession(any(ClassifyAddDelSession.class)); + .classifyAddDelSession(any(ClassifyAddDelSession.class)); } private void whenClassifyAddDelSessionThenFailure() { @@ -103,8 +103,8 @@ public class ClassifySessionWriterTest extends WriterCustomizerTest { request.hitNextIndex = 0; request.advance = 123; request.match = - new byte[] {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, (byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04, - (byte) 0x05, (byte) 0x06, 0x00, 0x00, 0x00, 0x00}; + new byte[]{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, (byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04, + (byte) 0x05, (byte) 0x06, 0x00, 0x00, 0x00, 0x00}; return request; } @@ -131,7 +131,7 @@ public class ClassifySessionWriterTest extends WriterCustomizerTest { try { customizer.writeCurrentAttributes(id, classifySession, writeContext); - } catch (WriteFailedException.CreateFailedException e) { + } catch (WriteFailedException e) { assertTrue(e.getCause() instanceof VppBaseCallException); verify(api).classifyAddDelSession(generateClassifyAddDelSession((byte) 1, TABLE_INDEX, SESSION_INDEX)); return; @@ -154,8 +154,7 @@ public class ClassifySessionWriterTest extends WriterCustomizerTest { customizer.deleteCurrentAttributes(id, classifySession, writeContext); - verify(api).classifyAddDelSession( - generateClassifyAddDelSession((byte) 0, TABLE_INDEX, SESSION_INDEX)); + verify(api).classifyAddDelSession(generateClassifyAddDelSession((byte) 0, TABLE_INDEX, SESSION_INDEX)); } @Test @@ -168,10 +167,9 @@ public class ClassifySessionWriterTest extends WriterCustomizerTest { try { customizer.deleteCurrentAttributes(id, classifySession, writeContext); - } catch (WriteFailedException.DeleteFailedException e) { + } catch (WriteFailedException e) { assertTrue(e.getCause() instanceof VppBaseCallException); - verify(api).classifyAddDelSession( - generateClassifyAddDelSession((byte) 0, TABLE_INDEX, SESSION_INDEX)); + verify(api).classifyAddDelSession(generateClassifyAddDelSession((byte) 0, TABLE_INDEX, SESSION_INDEX)); return; } fail("WriteFailedException.DeleteFailedException was expected"); diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifyTableWriterTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifyTableWriterTest.java index c8844e5cc..3c62c2d40 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifyTableWriterTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifyTableWriterTest.java @@ -26,6 +26,9 @@ import static org.mockito.Mockito.when; import io.fd.honeycomb.translate.write.WriteFailedException; import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest; +import io.fd.vpp.jvpp.VppBaseCallException; +import io.fd.vpp.jvpp.core.dto.ClassifyAddDelTable; +import io.fd.vpp.jvpp.core.dto.ClassifyAddDelTableReply; import org.junit.Test; import org.mockito.Mock; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.HexString; @@ -37,9 +40,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.clas import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev150603.vpp.classifier.ClassifyTableBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev150603.vpp.classifier.ClassifyTableKey; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import io.fd.vpp.jvpp.VppBaseCallException; -import io.fd.vpp.jvpp.core.dto.ClassifyAddDelTable; -import io.fd.vpp.jvpp.core.dto.ClassifyAddDelTableReply; public class ClassifyTableWriterTest extends WriterCustomizerTest { @@ -71,7 +71,7 @@ public class ClassifyTableWriterTest extends WriterCustomizerTest { private static InstanceIdentifier<ClassifyTable> getClassifyTableId(final String name) { return InstanceIdentifier.create(VppClassifier.class) - .child(ClassifyTable.class, new ClassifyTableKey(name)); + .child(ClassifyTable.class, new ClassifyTableKey(name)); } private void whenClassifyAddDelTableThenSuccess() { @@ -99,8 +99,8 @@ public class ClassifyTableWriterTest extends WriterCustomizerTest { request.nextTableIndex = ~0; request.missNextIndex = ~0; request.mask = - new byte[] {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, (byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04, - (byte) 0x05, (byte) 0x06, 0x00, 0x00, 0x00, 0x00}; + new byte[]{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, (byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04, + (byte) 0x05, (byte) 0x06, 0x00, 0x00, 0x00, 0x00}; return request; } @@ -115,7 +115,7 @@ public class ClassifyTableWriterTest extends WriterCustomizerTest { verify(api).classifyAddDelTable(generateClassifyAddDelTable((byte) 1)); verify(classifierContext) - .addTable(TABLE_INDEX, classifyTable.getName(), classifyTable.getClassifierNode(), mappingContext); + .addTable(TABLE_INDEX, classifyTable.getName(), classifyTable.getClassifierNode(), mappingContext); } @Test @@ -127,11 +127,11 @@ public class ClassifyTableWriterTest extends WriterCustomizerTest { try { customizer.writeCurrentAttributes(id, classifyTable, writeContext); - } catch (WriteFailedException.CreateFailedException e) { + } catch (WriteFailedException e) { assertTrue(e.getCause() instanceof VppBaseCallException); verify(api).classifyAddDelTable(generateClassifyAddDelTable((byte) 1)); verify(classifierContext, times(0)) - .addTable(TABLE_INDEX, classifyTable.getName(), classifyTable.getClassifierNode(), mappingContext); + .addTable(TABLE_INDEX, classifyTable.getName(), classifyTable.getClassifierNode(), mappingContext); return; } fail("WriteFailedException.CreateFailedException was expected"); @@ -162,7 +162,7 @@ public class ClassifyTableWriterTest extends WriterCustomizerTest { try { customizer.deleteCurrentAttributes(id, classifyTable, writeContext); - } catch (WriteFailedException.DeleteFailedException e) { + } catch (WriteFailedException e) { assertTrue(e.getCause() instanceof VppBaseCallException); verify(api).classifyAddDelTable(generateClassifyAddDelTable((byte) 0, TABLE_INDEX)); return; |