diff options
author | Marek Gradzki <mgradzki@cisco.com> | 2018-06-14 12:12:42 +0200 |
---|---|---|
committer | Marek Gradzki <mgradzki@cisco.com> | 2018-06-14 10:18:24 +0000 |
commit | 41e130b7f5d0aaf32c57c7b66ea6751adb219ba5 (patch) | |
tree | fb290521aa7ef3e6c8103337c483f0fe663e344a /l3/impl | |
parent | a5ed4b176e17675f6fd3319b33e8b6a96b2b2307 (diff) |
l3: remove redundant stubbing for WriteContext.readBefore
Change-Id: I8c4cc2564ad0f4c6452984234d4c9466677db052
Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'l3/impl')
3 files changed, 0 insertions, 53 deletions
diff --git a/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ipv4/Ipv4AddressCustomizerTest.java b/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ipv4/Ipv4AddressCustomizerTest.java index 850c1baeb..efab72bb1 100644 --- a/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ipv4/Ipv4AddressCustomizerTest.java +++ b/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ipv4/Ipv4AddressCustomizerTest.java @@ -22,9 +22,7 @@ import static org.mockito.Matchers.any; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import com.google.common.base.Optional; import io.fd.hc2vpp.common.test.write.WriterCustomizerTest; import io.fd.hc2vpp.common.translate.util.NamingContext; import io.fd.honeycomb.translate.write.WriteFailedException; @@ -95,7 +93,6 @@ public class Ipv4AddressCustomizerTest extends WriterCustomizerTest { @Test public void testAddPrefixLengthIpv4Address() throws Exception { final InstanceIdentifier<Address> id = getAddressId(IFACE_NAME); - when(writeContext.readBefore(id)).thenReturn(Optional.absent()); Ipv4AddressNoZone noZoneIp = new Ipv4AddressNoZone(new Ipv4Address("192.168.2.1")); PrefixLength length = new PrefixLengthBuilder().setPrefixLength(new Integer(24).shortValue()).build(); @@ -113,7 +110,6 @@ public class Ipv4AddressCustomizerTest extends WriterCustomizerTest { @Test public void testAddPrefixLengthIpv4AddressFailed() throws Exception { final InstanceIdentifier<Address> id = getAddressId(IFACE_NAME); - when(writeContext.readBefore(id)).thenReturn(Optional.absent()); Ipv4AddressNoZone noZoneIp = new Ipv4AddressNoZone(new Ipv4Address("192.168.2.1")); PrefixLength length = new PrefixLengthBuilder().setPrefixLength(new Integer(24).shortValue()).build(); @@ -197,7 +193,6 @@ public class Ipv4AddressCustomizerTest extends WriterCustomizerTest { final int expectedPrefixLength = 1; final String stringMask = "128.0.0.0"; final InstanceIdentifier<Address> id = getAddressId(IFACE_NAME); - when(writeContext.readBefore(id)).thenReturn(Optional.absent()); Ipv4AddressNoZone noZoneIp = new Ipv4AddressNoZone(new Ipv4Address("192.168.2.1")); Netmask subnet = new NetmaskBuilder().setNetmask(new DottedQuad(stringMask)).build(); @@ -220,7 +215,6 @@ public class Ipv4AddressCustomizerTest extends WriterCustomizerTest { private void testSingleNetmask(final int expectedPrefixLength, final String stringMask) throws Exception { final InstanceIdentifier<Address> id = getAddressId(IFACE_NAME); - when(writeContext.readBefore(id)).thenReturn(Optional.absent()); Ipv4AddressNoZone noZoneIp = new Ipv4AddressNoZone(new Ipv4Address("192.168.2.1")); Netmask subnet = new NetmaskBuilder().setNetmask(new DottedQuad(stringMask)).build(); @@ -238,7 +232,6 @@ public class Ipv4AddressCustomizerTest extends WriterCustomizerTest { private void testSingleIllegalNetmask(final String stringMask) throws Exception { try { final InstanceIdentifier<Address> id = getAddressId(IFACE_NAME); - when(writeContext.readBefore(id)).thenReturn(Optional.absent()); Ipv4AddressNoZone noZoneIp = new Ipv4AddressNoZone(new Ipv4Address("192.168.2.1")); Netmask subnet = new NetmaskBuilder().setNetmask(new DottedQuad(stringMask)).build(); diff --git a/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ipv4/Ipv4NeighbourCustomizerTest.java b/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ipv4/Ipv4NeighbourCustomizerTest.java index d9050b11b..bab261a31 100644 --- a/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ipv4/Ipv4NeighbourCustomizerTest.java +++ b/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ipv4/Ipv4NeighbourCustomizerTest.java @@ -23,7 +23,6 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import com.google.common.base.Optional; import io.fd.hc2vpp.common.test.write.WriterCustomizerTest; import io.fd.hc2vpp.common.translate.util.Ipv4Translator; import io.fd.hc2vpp.common.translate.util.NamingContext; @@ -36,16 +35,12 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types. import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceBuilder; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.Interface1; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.Ipv4; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.Neighbor; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.NeighborBuilder; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev170607.VppInterfaceAugmentation; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev170607.VppInterfaceAugmentationBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev170607.interfaces._interface.RoutingBuilder; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; public class Ipv4NeighbourCustomizerTest extends WriterCustomizerTest implements Ipv4Translator { @@ -67,7 +62,6 @@ public class Ipv4NeighbourCustomizerTest extends WriterCustomizerTest implements @Test public void testWriteCurrentAttributes() throws WriteFailedException { - when(writeContext.readBefore(IID.firstIdentifierOf(Interface.class))).thenReturn(Optional.absent()); when(api.ipNeighborAddDel(any())).thenReturn(future(new IpNeighborAddDelReply())); customizer.writeCurrentAttributes(IID, getData(), writeContext); verify(api).ipNeighborAddDel(getExpectedRequest(true)); @@ -75,7 +69,6 @@ public class Ipv4NeighbourCustomizerTest extends WriterCustomizerTest implements @Test public void testWriteCurrentAttributesFailed() { - when(writeContext.readBefore(IID.firstIdentifierOf(Interface.class))).thenReturn(Optional.absent()); when(api.ipNeighborAddDel(any())).thenReturn(failedFuture()); try { customizer.writeCurrentAttributes(IID, getData(), writeContext); @@ -93,7 +86,6 @@ public class Ipv4NeighbourCustomizerTest extends WriterCustomizerTest implements @Test public void testDeleteCurrentAttributes() throws WriteFailedException { - when(writeContext.readBefore(IID.firstIdentifierOf(Interface.class))).thenReturn(Optional.absent()); when(api.ipNeighborAddDel(any())).thenReturn(future(new IpNeighborAddDelReply())); customizer.deleteCurrentAttributes(IID, getData(), writeContext); verify(api).ipNeighborAddDel(getExpectedRequest(false)); @@ -101,7 +93,6 @@ public class Ipv4NeighbourCustomizerTest extends WriterCustomizerTest implements @Test public void testDeleteCurrentAttributesFailed() { - when(writeContext.readBefore(IID.firstIdentifierOf(Interface.class))).thenReturn(Optional.absent()); when(api.ipNeighborAddDel(any())).thenReturn(failedFuture()); try { customizer.deleteCurrentAttributes(IID, getData(), writeContext); @@ -116,20 +107,6 @@ public class Ipv4NeighbourCustomizerTest extends WriterCustomizerTest implements @Test public void testVrfExtractionCornerCases() throws WriteFailedException { when(api.ipNeighborAddDel(any())).thenReturn(future(new IpNeighborAddDelReply())); - - when(writeContext.readBefore(IID.firstIdentifierOf(Interface.class))) - // no augment - .thenReturn(Optional.of(new InterfaceBuilder().build())) - // empty augment - .thenReturn(Optional.of(new InterfaceBuilder() - .addAugmentation(VppInterfaceAugmentation.class, new VppInterfaceAugmentationBuilder().build()).build())) - //empty routing - .thenReturn(Optional.of(new InterfaceBuilder() - .addAugmentation(VppInterfaceAugmentation.class, new VppInterfaceAugmentationBuilder() - .setRouting(new RoutingBuilder().build()) - .build()).build())); - - customizer.writeCurrentAttributes(IID, getData(), writeContext); customizer.writeCurrentAttributes(IID, getData(), writeContext); customizer.writeCurrentAttributes(IID, getData(), writeContext); diff --git a/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ipv6/Ipv6NeighbourCustomizerTest.java b/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ipv6/Ipv6NeighbourCustomizerTest.java index f5a28f236..5f11a5d5c 100644 --- a/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ipv6/Ipv6NeighbourCustomizerTest.java +++ b/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ipv6/Ipv6NeighbourCustomizerTest.java @@ -22,7 +22,6 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import com.google.common.base.Optional; import io.fd.hc2vpp.common.test.write.WriterCustomizerTest; import io.fd.hc2vpp.common.translate.util.Ipv6Translator; import io.fd.hc2vpp.common.translate.util.NamingContext; @@ -35,16 +34,12 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types. import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6AddressNoZone; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceBuilder; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.Interface1; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.Ipv6; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv6.Neighbor; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv6.NeighborBuilder; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev170607.VppInterfaceAugmentation; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev170607.VppInterfaceAugmentationBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev170607.interfaces._interface.RoutingBuilder; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; public class Ipv6NeighbourCustomizerTest extends WriterCustomizerTest implements Ipv6Translator { @@ -66,7 +61,6 @@ public class Ipv6NeighbourCustomizerTest extends WriterCustomizerTest implements @Test public void testWriteCurrentAttributes() throws WriteFailedException { - when(writeContext.readBefore(IID.firstIdentifierOf(Interface.class))).thenReturn(Optional.absent()); when(api.ipNeighborAddDel(any())).thenReturn(future(new IpNeighborAddDelReply())); customizer.writeCurrentAttributes(IID, getData(), writeContext); verify(api).ipNeighborAddDel(getExpectedRequest(true)); @@ -74,7 +68,6 @@ public class Ipv6NeighbourCustomizerTest extends WriterCustomizerTest implements @Test public void testWriteCurrentAttributesFailed() { - when(writeContext.readBefore(IID.firstIdentifierOf(Interface.class))).thenReturn(Optional.absent()); when(api.ipNeighborAddDel(any())).thenReturn(failedFuture()); try { customizer.writeCurrentAttributes(IID, getData(), writeContext); @@ -93,7 +86,6 @@ public class Ipv6NeighbourCustomizerTest extends WriterCustomizerTest implements @Test public void testDeleteCurrentAttributes() throws WriteFailedException { - when(writeContext.readBefore(IID.firstIdentifierOf(Interface.class))).thenReturn(Optional.absent()); when(api.ipNeighborAddDel(any())).thenReturn(future(new IpNeighborAddDelReply())); customizer.deleteCurrentAttributes(IID, getData(), writeContext); verify(api).ipNeighborAddDel(getExpectedRequest(false)); @@ -101,7 +93,6 @@ public class Ipv6NeighbourCustomizerTest extends WriterCustomizerTest implements @Test public void testDeleteCurrentAttributesFailed() { - when(writeContext.readBefore(IID.firstIdentifierOf(Interface.class))).thenReturn(Optional.absent()); when(api.ipNeighborAddDel(any())).thenReturn(failedFuture()); try { customizer.deleteCurrentAttributes(IID, getData(), writeContext); @@ -116,20 +107,6 @@ public class Ipv6NeighbourCustomizerTest extends WriterCustomizerTest implements @Test public void testVrfExtractionCornerCases() throws WriteFailedException { when(api.ipNeighborAddDel(any())).thenReturn(future(new IpNeighborAddDelReply())); - - when(writeContext.readBefore(IID.firstIdentifierOf(Interface.class))) - // no augment - .thenReturn(Optional.of(new InterfaceBuilder().build())) - // empty augment - .thenReturn(Optional.of(new InterfaceBuilder() - .addAugmentation(VppInterfaceAugmentation.class, new VppInterfaceAugmentationBuilder().build()).build())) - //empty routing - .thenReturn(Optional.of(new InterfaceBuilder() - .addAugmentation(VppInterfaceAugmentation.class, new VppInterfaceAugmentationBuilder() - .setRouting(new RoutingBuilder().build()) - .build()).build())); - - customizer.writeCurrentAttributes(IID, getData(), writeContext); customizer.writeCurrentAttributes(IID, getData(), writeContext); customizer.writeCurrentAttributes(IID, getData(), writeContext); |