From 66588c9dbb53da4656af2983bb8f71ade863420c Mon Sep 17 00:00:00 2001 From: Marek Gradzki Date: Mon, 26 Sep 2016 08:20:34 +0200 Subject: HONEYCOMB-116: generic merge test for reader customizers Change-Id: I5c2505e6b3bcf622312f8dc324912507f6519a5b Signed-off-by: Marek Gradzki --- .../v3po/interfacesstate/AclCustomizerTest.java | 10 +--------- .../v3po/interfacesstate/GreCustomizerTest.java | 3 ++- .../v3po/interfacesstate/InterfaceCustomizerTest.java | 12 ++---------- .../v3po/interfacesstate/L2CustomizerTest.java | 10 +--------- .../v3po/interfacesstate/RewriteCustomizerTest.java | 10 +--------- .../interfacesstate/SubInterfaceCustomizerTest.java | 10 +--------- .../v3po/interfacesstate/VxlanCustomizerTest.java | 3 ++- .../v3po/interfacesstate/VxlanGpeCustomizerTest.java | 3 ++- .../interfacesstate/ip/Ipv4AddressCustomizerTest.java | 15 +-------------- .../v3po/vppclassifier/ClassifySessionReaderTest.java | 11 +---------- .../v3po/vppclassifier/ClassifyTableReaderTest.java | 10 +--------- .../v3po/vppstate/BridgeDomainCustomizerTest.java | 18 ++---------------- .../v3po/vppstate/L2FibEntryCustomizerTest.java | 10 +--------- .../translate/v3po/vppstate/VersionCustomizerTest.java | 11 +---------- 14 files changed, 19 insertions(+), 117 deletions(-) (limited to 'v3po') diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/AclCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/AclCustomizerTest.java index 00dadddb1..8977a74bf 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/AclCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/AclCustomizerTest.java @@ -54,7 +54,7 @@ public class AclCustomizerTest extends ReaderCustomizerTest { private VppClassifierContextManager classifyTableContext; public AclCustomizerTest() { - super(Acl.class); + super(Acl.class, VppInterfaceStateAugmentationBuilder.class); } @Override @@ -68,14 +68,6 @@ public class AclCustomizerTest extends ReaderCustomizerTest { return new AclCustomizer(api, interfaceContext, classifyTableContext); } - @Test - public void testMerge() { - final VppInterfaceStateAugmentationBuilder builder = mock(VppInterfaceStateAugmentationBuilder.class); - final Acl value = mock(Acl.class); - getCustomizer().merge(builder, value); - verify(builder).setAcl(value); - } - private InstanceIdentifier getAclId(final String name) { return InstanceIdentifier.create(InterfacesState.class).child(Interface.class, new InterfaceKey(name)) .augmentation( diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/GreCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/GreCustomizerTest.java index e62edadef..519236c16 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/GreCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/GreCustomizerTest.java @@ -37,6 +37,7 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces. import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VppInterfaceStateAugmentation; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VppInterfaceStateAugmentationBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.Gre; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.GreBuilder; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; @@ -58,7 +59,7 @@ public class GreCustomizerTest extends ReaderCustomizerTest { .augmentation(VppInterfaceStateAugmentation.class).child(Gre.class); public GreCustomizerTest() { - super(Gre.class); + super(Gre.class, VppInterfaceStateAugmentationBuilder.class); } @Override diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterfaceCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterfaceCustomizerTest.java index 94dfd077a..a10468ee8 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterfaceCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterfaceCustomizerTest.java @@ -63,7 +63,7 @@ public class InterfaceCustomizerTest extends private DisabledInterfacesManager interfaceDisableContext; public InterfaceCustomizerTest() { - super(Interface.class); + super(Interface.class, InterfacesStateBuilder.class); } @Override @@ -79,15 +79,7 @@ public class InterfaceCustomizerTest extends return new InterfaceCustomizer(api, interfacesContext, interfaceDisableContext); } - @Test - public void testMerge() throws Exception { - final InterfacesStateBuilder builder = mock(InterfacesStateBuilder.class); - final List value = Collections.emptyList(); - getCustomizer().merge(builder, value); - verify(builder).setInterface(value); - } - - public void whenSwInterfaceDumpThenReturn(final List interfaceList) { + private void whenSwInterfaceDumpThenReturn(final List interfaceList) { final SwInterfaceDetailsReplyDump reply = new SwInterfaceDetailsReplyDump(); reply.swInterfaceDetails = interfaceList; when(api.swInterfaceDump(any(SwInterfaceDump.class))).thenReturn(future(reply)); diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/L2CustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/L2CustomizerTest.java index 6be759bc5..5583ae348 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/L2CustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/L2CustomizerTest.java @@ -53,7 +53,7 @@ public class L2CustomizerTest extends ReaderCustomizerTest { private NamingContext bridgeDomainContext; public L2CustomizerTest() { - super(L2.class); + super(L2.class, VppInterfaceStateAugmentationBuilder.class); } @Override @@ -67,14 +67,6 @@ public class L2CustomizerTest extends ReaderCustomizerTest { return new L2Customizer(api, interfaceContext, bridgeDomainContext); } - @Test - public void testMerge() { - final VppInterfaceStateAugmentationBuilder builder = mock(VppInterfaceStateAugmentationBuilder.class); - final L2 value = mock(L2.class); - getCustomizer().merge(builder, value); - verify(builder).setL2(value); - } - private InstanceIdentifier getL2Id(final String name) { return InstanceIdentifier.create(InterfacesState.class).child(Interface.class, new InterfaceKey(name)) .augmentation( diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/RewriteCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/RewriteCustomizerTest.java index ad2d4f6ce..481ac676b 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/RewriteCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/RewriteCustomizerTest.java @@ -61,7 +61,7 @@ public class RewriteCustomizerTest extends ReaderCustomizerTest> captor; public RewriteCustomizerTest() { - super(Rewrite.class); + super(Rewrite.class, L2Builder.class); } @Override @@ -75,14 +75,6 @@ public class RewriteCustomizerTest extends ReaderCustomizerTest getVlanTagRewriteId(final String name, final long index) { final Class> child = (Class)Rewrite.class; final InstanceIdentifier id = diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/SubInterfaceCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/SubInterfaceCustomizerTest.java index 74580bb73..d52cb3fc2 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/SubInterfaceCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/SubInterfaceCustomizerTest.java @@ -63,7 +63,7 @@ public class SubInterfaceCustomizerTest extends private NamingContext interfacesContext; public SubInterfaceCustomizerTest() { - super(SubInterface.class); + super(SubInterface.class, SubInterfacesBuilder.class); } @Override @@ -84,14 +84,6 @@ public class SubInterfaceCustomizerTest extends SubInterfaces.class).child(SubInterface.class, new SubInterfaceKey(id)); } - @Test - public void testMerge() { - final SubInterfacesBuilder builder = mock(SubInterfacesBuilder.class); - final List value = mock(List.class); - getCustomizer().merge(builder, value); - verify(builder).setSubInterface(value); - } - @Test public void testRead() throws ReadFailedException { final Map cachedInterfaceDump = new HashMap<>(); diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/VxlanCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/VxlanCustomizerTest.java index 4bab8fcfa..a4cf9b535 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/VxlanCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/VxlanCustomizerTest.java @@ -37,6 +37,7 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces. import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VppInterfaceStateAugmentation; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VppInterfaceStateAugmentationBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.Vxlan; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.VxlanBuilder; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; @@ -58,7 +59,7 @@ public class VxlanCustomizerTest extends ReaderCustomizerTest value = mock(List.class); - getCustomizer().merge(builder, value); - verify(builder).setClassifySession(value); - } - @Test public void testReadWithCache() throws ReadFailedException { final InstanceIdentifier id = getClassifySessionId(TABLE_NAME, MATCH_1); diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifyTableReaderTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifyTableReaderTest.java index 95864ce6e..cc5ac6b7d 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifyTableReaderTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifyTableReaderTest.java @@ -58,7 +58,7 @@ public class ClassifyTableReaderTest extends private VppClassifierContextManager classifierContext; public ClassifyTableReaderTest() { - super(ClassifyTable.class); + super(ClassifyTable.class, VppClassifierStateBuilder.class); } @Override @@ -94,14 +94,6 @@ public class ClassifyTableReaderTest extends verify(builder).setActiveSessions(0L); } - @Test - public void testMerge() { - final VppClassifierStateBuilder builder = mock(VppClassifierStateBuilder.class); - final List value = mock(List.class); - getCustomizer().merge(builder, value); - verify(builder).setClassifyTable(value); - } - @Test public void testRead() throws ReadFailedException { doReturn(future(generateClassifyTableInfoReply())).when(api).classifyTableInfo(any(ClassifyTableInfo.class)); diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppstate/BridgeDomainCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppstate/BridgeDomainCustomizerTest.java index 67e612868..bbf53caa7 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppstate/BridgeDomainCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppstate/BridgeDomainCustomizerTest.java @@ -16,15 +16,9 @@ package io.fd.honeycomb.translate.v3po.vppstate; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; - import io.fd.honeycomb.translate.spi.read.ReaderCustomizer; -import io.fd.honeycomb.vpp.test.read.ListReaderCustomizerTest; import io.fd.honeycomb.translate.v3po.util.NamingContext; -import java.util.Collections; -import java.util.List; -import org.junit.Test; +import io.fd.honeycomb.vpp.test.read.ListReaderCustomizerTest; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.state.BridgeDomainsBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.state.bridge.domains.BridgeDomain; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.state.bridge.domains.BridgeDomainBuilder; @@ -37,7 +31,7 @@ public class BridgeDomainCustomizerTest private NamingContext interfacesContext; public BridgeDomainCustomizerTest() { - super(BridgeDomain.class); + super(BridgeDomain.class, BridgeDomainsBuilder.class); } @Override @@ -46,14 +40,6 @@ public class BridgeDomainCustomizerTest interfacesContext = new NamingContext("generatedIfaceName", "ifc-test-instance"); } - @Test - public void testMerge() throws Exception { - final BridgeDomainsBuilder builder = mock(BridgeDomainsBuilder.class); - final List value = Collections.emptyList(); - getCustomizer().merge(builder, value); - verify(builder).setBridgeDomain(value); - } - @Override protected ReaderCustomizer initCustomizer() { return new BridgeDomainCustomizer(api, bdContext); diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppstate/L2FibEntryCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppstate/L2FibEntryCustomizerTest.java index f837717c7..4c0fcd539 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppstate/L2FibEntryCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppstate/L2FibEntryCustomizerTest.java @@ -57,7 +57,7 @@ public class L2FibEntryCustomizerTest extends ListReaderCustomizerTest value = Collections.emptyList(); - getCustomizer().merge(builder, value); - verify(builder).setL2FibEntry(value); - } - private static InstanceIdentifier getL2FibEntryId(final String bdName, final PhysAddress address) { return InstanceIdentifier.create(BridgeDomains.class).child(BridgeDomain.class, new BridgeDomainKey(bdName)) .child(L2FibTable.class).child(L2FibEntry.class, new L2FibEntryKey(address)); diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppstate/VersionCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppstate/VersionCustomizerTest.java index 71b7dccf3..771e1aa87 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppstate/VersionCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppstate/VersionCustomizerTest.java @@ -17,7 +17,6 @@ package io.fd.honeycomb.translate.v3po.vppstate; import static org.mockito.Matchers.any; -import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -34,7 +33,7 @@ import org.openvpp.jvpp.core.dto.ShowVersionReply; public class VersionCustomizerTest extends ReaderCustomizerTest { public VersionCustomizerTest() { - super(Version.class); + super(Version.class, VppStateBuilder.class); } @Override @@ -42,14 +41,6 @@ public class VersionCustomizerTest extends ReaderCustomizerTest