summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Srnicek <jsrnicek@cisco.com>2017-02-07 12:52:23 +0100
committerMarek Gradzki <mgradzki@cisco.com>2017-02-07 12:18:52 +0000
commit52812370c20d7f6628da5c7680fb42cbd60a21b9 (patch)
tree3b741c214d5bc5e8f03e26f70e036850dcbeb8e5
parentfd88a38ef0c95452953deb2c52a07eb1232a82a5 (diff)
Fixed use of structural readers in tests
ioam plugin disabled till ioam team provides fix for HC2VPP-63 Change-Id: Ibf4970283c4dfefabc73634e522786d74ad32889 Signed-off-by: Jan Srnicek <jsrnicek@cisco.com>
-rw-r--r--acl/acl-impl/src/test/java/io/fd/hc2vpp/acl/AclModuleTest.java29
-rw-r--r--ioam/impl/src/main/java/io/fd/hc2vpp/vppioam/impl/oper/VppIoamReaderFactory.java11
-rw-r--r--nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/NatModuleTest.java32
-rw-r--r--pom.xml3
4 files changed, 42 insertions, 33 deletions
diff --git a/acl/acl-impl/src/test/java/io/fd/hc2vpp/acl/AclModuleTest.java b/acl/acl-impl/src/test/java/io/fd/hc2vpp/acl/AclModuleTest.java
index 671cd283c..f2c47f7b5 100644
--- a/acl/acl-impl/src/test/java/io/fd/hc2vpp/acl/AclModuleTest.java
+++ b/acl/acl-impl/src/test/java/io/fd/hc2vpp/acl/AclModuleTest.java
@@ -16,14 +16,6 @@
package io.fd.hc2vpp.acl;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.Matchers.empty;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.MockitoAnnotations.initMocks;
-
import com.google.inject.Guice;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -32,14 +24,14 @@ import com.google.inject.name.Named;
import com.google.inject.testing.fieldbinder.Bind;
import com.google.inject.testing.fieldbinder.BoundFieldModule;
import io.fd.hc2vpp.common.translate.util.NamingContext;
+import io.fd.honeycomb.translate.impl.read.GenericListReader;
import io.fd.honeycomb.translate.impl.read.registry.CompositeReaderRegistryBuilder;
import io.fd.honeycomb.translate.impl.write.registry.FlatWriterRegistryBuilder;
import io.fd.honeycomb.translate.read.ReaderFactory;
+import io.fd.honeycomb.translate.spi.read.ListReaderCustomizer;
import io.fd.honeycomb.translate.write.WriterFactory;
import io.fd.vpp.jvpp.JVppRegistry;
import io.fd.vpp.jvpp.acl.future.FutureJVppAclFacade;
-import java.util.HashSet;
-import java.util.Set;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
@@ -47,9 +39,19 @@ import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesStateBuilder;
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.InterfaceBuilder;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import java.util.HashSet;
+import java.util.Set;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.Matchers.empty;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.MockitoAnnotations.initMocks;
+
public class AclModuleTest {
@@ -88,8 +90,9 @@ public class AclModuleTest {
.addBinding().toInstance(registry -> {
registry.addStructuralReader(InstanceIdentifier.create(InterfacesState.class),
InterfacesStateBuilder.class);
- registry.addStructuralReader(InstanceIdentifier.create(InterfacesState.class).child(Interface.class),
- InterfaceBuilder.class);
+ registry.add(new GenericListReader<>(InstanceIdentifier.create(InterfacesState.class)
+ .child(Interface.class),
+ mock(ListReaderCustomizer.class)));
}), new AclModule(MockJVppAclProvider.class), BoundFieldModule.of(this)).injectMembers(this);
}
diff --git a/ioam/impl/src/main/java/io/fd/hc2vpp/vppioam/impl/oper/VppIoamReaderFactory.java b/ioam/impl/src/main/java/io/fd/hc2vpp/vppioam/impl/oper/VppIoamReaderFactory.java
index 9efd2e11f..ece73fa8c 100644
--- a/ioam/impl/src/main/java/io/fd/hc2vpp/vppioam/impl/oper/VppIoamReaderFactory.java
+++ b/ioam/impl/src/main/java/io/fd/hc2vpp/vppioam/impl/oper/VppIoamReaderFactory.java
@@ -20,8 +20,6 @@ import io.fd.honeycomb.translate.read.ReaderFactory;
import io.fd.honeycomb.translate.read.registry.ModifiableReaderRegistryBuilder;
import io.fd.vpp.jvpp.ioampot.future.FutureJVppIoampot;
import io.fd.vpp.jvpp.ioamtrace.future.FutureJVppIoamtrace;
-import javax.annotation.Nonnull;
-import javax.inject.Inject;
import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.ioam.sb.trace.rev160512.IoamTraceConfig;
import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.ioam.sb.trace.rev160512.IoamTraceConfigBuilder;
import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.ioam.sb.trace.rev160512.ioam.trace.config.TraceConfig;
@@ -29,9 +27,11 @@ import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot
import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev170112.PotProfilesBuilder;
import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev170112.pot.profile.PotProfileList;
import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev170112.pot.profiles.PotProfileSet;
-import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev170112.pot.profiles.PotProfileSetBuilder;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import javax.annotation.Nonnull;
+import javax.inject.Inject;
+
public class VppIoamReaderFactory implements ReaderFactory {
@Nonnull
@@ -67,9 +67,10 @@ public class VppIoamReaderFactory implements ReaderFactory {
final InstanceIdentifier<PotProfiles> potProfilesInstanceIdentifier = InstanceIdentifier.create(PotProfiles.class);
registry.addStructuralReader(potProfilesInstanceIdentifier, PotProfilesBuilder.class);
//PotProfileSet (Structural)
- final InstanceIdentifier<PotProfileSet> potProfileSetInstanceIdentifier =
+ final InstanceIdentifier<PotProfileSet> potProfileSetInstanceIdentifier =
potProfilesInstanceIdentifier.child(PotProfileSet.class);
- registry.addStructuralReader(potProfileSetInstanceIdentifier, PotProfileSetBuilder.class);
+ //TODO - temporary disabled till HC2VPP-63 is resolved
+ //registry.addStructuralReader(potProfileSetInstanceIdentifier, PotProfileSetBuilder.class);
//PotProfileList
final InstanceIdentifier<PotProfileList> potProfileListInstanceIdentifier= potProfileSetInstanceIdentifier.child(PotProfileList.class);
registry.add(new GenericInitListReader<>(potProfileListInstanceIdentifier,
diff --git a/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/NatModuleTest.java b/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/NatModuleTest.java
index 6052d7e8c..f89129d63 100644
--- a/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/NatModuleTest.java
+++ b/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/NatModuleTest.java
@@ -16,14 +16,6 @@
package io.fd.hc2vpp.nat;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.Matchers.empty;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.MockitoAnnotations.initMocks;
-
import com.google.inject.Guice;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -31,14 +23,14 @@ import com.google.inject.multibindings.Multibinder;
import com.google.inject.name.Named;
import com.google.inject.testing.fieldbinder.Bind;
import com.google.inject.testing.fieldbinder.BoundFieldModule;
-import io.fd.honeycomb.translate.read.ReaderFactory;
+import io.fd.hc2vpp.common.translate.util.NamingContext;
+import io.fd.honeycomb.translate.impl.read.GenericListReader;
import io.fd.honeycomb.translate.impl.read.registry.CompositeReaderRegistryBuilder;
import io.fd.honeycomb.translate.impl.write.registry.FlatWriterRegistryBuilder;
-import io.fd.hc2vpp.common.translate.util.NamingContext;
+import io.fd.honeycomb.translate.read.ReaderFactory;
+import io.fd.honeycomb.translate.spi.read.ListReaderCustomizer;
import io.fd.honeycomb.translate.write.WriterFactory;
import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade;
-import java.util.HashSet;
-import java.util.Set;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
@@ -49,6 +41,17 @@ 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.InterfaceBuilder;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import java.util.HashSet;
+import java.util.Set;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.Matchers.empty;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.MockitoAnnotations.initMocks;
+
public class NatModuleTest {
@Named("honeycomb-context")
@@ -88,8 +91,9 @@ public class NatModuleTest {
.addBinding().toInstance(registry -> {
registry.addStructuralReader(InstanceIdentifier.create(InterfacesState.class),
InterfacesStateBuilder.class);
- registry.addStructuralReader(InstanceIdentifier.create(InterfacesState.class).child(Interface.class),
- InterfaceBuilder.class);
+ registry.add(new GenericListReader<>(
+ InstanceIdentifier.create(InterfacesState.class).child(Interface.class),
+ mock(ListReaderCustomizer.class)));
}), new NatModule(MockJVppSnatProvider.class), BoundFieldModule.of(this)).injectMembers(this);
}
diff --git a/pom.xml b/pom.xml
index cdda10117..434eefca3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -36,7 +36,8 @@
<modules>
<module>vpp-common</module>
<module>v3po</module>
- <module>ioam</module>
+ <!-- TODO temporary disabled till HC2VPP-63 is resolved -->
+ <!--<module>ioam</module>-->
<module>nsh</module>
<module>routing</module>
<module>nat</module>