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 /routing | |
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 'routing')
7 files changed, 8 insertions, 65 deletions
diff --git a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/Ipv6RouteCustomizer.java b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/Ipv6RouteCustomizer.java index 9d87a5bea..b8d34edc7 100644 --- a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/Ipv6RouteCustomizer.java +++ b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/Ipv6RouteCustomizer.java @@ -102,15 +102,6 @@ public class Ipv6RouteCustomizer extends FutureJVppCustomizer } @Override - public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<Route> instanceIdentifier, - @Nonnull final Route route, - @Nonnull final Route d1, @Nonnull final WriteContext writeContext) - throws WriteFailedException { - throw new WriteFailedException(instanceIdentifier, - new UnsupportedOperationException("Operation not supported")); - } - - @Override public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<Route> instanceIdentifier, @Nonnull final Route route, @Nonnull final WriteContext writeContext) throws WriteFailedException { diff --git a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RoutingCustomizer.java b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RoutingCustomizer.java index bd50ce77b..0e99aeead 100644 --- a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RoutingCustomizer.java +++ b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RoutingCustomizer.java @@ -40,13 +40,6 @@ public class RoutingCustomizer implements WriterCustomizer<Routing> { } @Override - public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<Routing> instanceIdentifier, - @Nonnull final Routing before, @Nonnull final Routing after, - @Nonnull final WriteContext writeContext) throws WriteFailedException { - LOG.debug("Updating {} to {}", instanceIdentifier, after); - } - - @Override public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<Routing> instanceIdentifier, @Nonnull final Routing routing, @Nonnull final WriteContext writeContext) throws WriteFailedException { diff --git a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RoutingInstanceCustomizer.java b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RoutingInstanceCustomizer.java index fa6885d5d..7d63647e0 100644 --- a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RoutingInstanceCustomizer.java +++ b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RoutingInstanceCustomizer.java @@ -47,15 +47,6 @@ public class RoutingInstanceCustomizer implements ListWriterCustomizer<RoutingIn } @Override - public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<RoutingInstance> id, - @Nonnull final RoutingInstance dataBefore, - @Nonnull final RoutingInstance dataAfter, - @Nonnull final WriteContext writeContext) throws WriteFailedException { - throw new WriteFailedException.UpdateFailedException(id, dataBefore, dataAfter, - new UnsupportedOperationException("Operation not supported")); - } - - @Override public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<RoutingInstance> id, @Nonnull final RoutingInstance dataBefore, @Nonnull final WriteContext writeContext) diff --git a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RoutingProtocolCustomizer.java b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RoutingProtocolCustomizer.java index 69b8e509e..d79f9d666 100644 --- a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RoutingProtocolCustomizer.java +++ b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RoutingProtocolCustomizer.java @@ -72,15 +72,6 @@ public class RoutingProtocolCustomizer } @Override - public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<RoutingProtocol> instanceIdentifier, - @Nonnull final RoutingProtocol routingProtocolBefore, - @Nonnull final RoutingProtocol routingProtocolAfter, - @Nonnull final WriteContext writeContext) throws WriteFailedException { - throw new WriteFailedException.UpdateFailedException(instanceIdentifier, routingProtocolBefore, - routingProtocolAfter, new UnsupportedOperationException("Operation not supported")); - } - - @Override public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<RoutingProtocol> instanceIdentifier, @Nonnull final RoutingProtocol routingProtocol, @Nonnull final WriteContext writeContext) diff --git a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/Ipv6RouteCustomizerTest.java b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/Ipv6RouteCustomizerTest.java index dc932cd0f..8a52b8cc6 100644 --- a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/Ipv6RouteCustomizerTest.java +++ b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/Ipv6RouteCustomizerTest.java @@ -18,8 +18,6 @@ package io.fd.hc2vpp.routing.write; import static io.fd.hc2vpp.routing.helpers.InterfaceTestHelper.INTERFACE_INDEX; import static io.fd.hc2vpp.routing.helpers.InterfaceTestHelper.INTERFACE_NAME; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; import com.google.common.collect.ImmutableList; import io.fd.hc2vpp.common.test.write.WriterCustomizerTest; @@ -119,17 +117,10 @@ public class Ipv6RouteCustomizerTest extends WriterCustomizerTest requestCaptor); } - @Test - public void testUpdate() { - try { - customizer.updateCurrentAttributes(validId, Ipv6RouteData.IPV6_ROUTE_WITH_CLASSIFIER_BLACKHOLE_HOP, - Ipv6RouteData.IPV6_ROUTE_WITH_CLASSIFIER_RECEIVE_HOP, writeContext); - } catch (WriteFailedException e) { - assertTrue(e.getCause() instanceof UnsupportedOperationException); - verifyNotInvoked(api); - return; - } - fail("Test should have thrown exception"); + @Test(expected = UnsupportedOperationException.class) + public void testUpdate() throws WriteFailedException { + customizer.updateCurrentAttributes(validId, Ipv6RouteData.IPV6_ROUTE_WITH_CLASSIFIER_BLACKHOLE_HOP, + Ipv6RouteData.IPV6_ROUTE_WITH_CLASSIFIER_RECEIVE_HOP, writeContext); } @Test diff --git a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/RoutingInstanceCustomizerTest.java b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/RoutingInstanceCustomizerTest.java index 68fcba5ac..2e073d726 100644 --- a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/RoutingInstanceCustomizerTest.java +++ b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/RoutingInstanceCustomizerTest.java @@ -15,13 +15,11 @@ */ package io.fd.hc2vpp.routing.write; -import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.mockito.Mockito.when; import io.fd.hc2vpp.common.test.write.WriterCustomizerTest; import io.fd.hc2vpp.routing.RoutingConfiguration; -import io.fd.honeycomb.translate.write.WriteFailedException; import org.junit.Test; import org.mockito.Mock; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.routing.RoutingInstance; @@ -67,15 +65,9 @@ public class RoutingInstanceCustomizerTest extends WriterCustomizerTest { customizer.writeCurrentAttributes(id, invalidData, writeContext); } - @Test + @Test(expected = UnsupportedOperationException.class) public void updateCurrentAttributes() throws Exception { - try { - customizer.updateCurrentAttributes(id, validData, validData, writeContext); - } catch (WriteFailedException.UpdateFailedException e) { - assertTrue(e.getCause() instanceof UnsupportedOperationException); - return; - } - fail("Test should throw WriteFailedException.UpdateFailedException"); + customizer.updateCurrentAttributes(id, validData, validData, writeContext); } @Test diff --git a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/RoutingProtocolCustomizerTest.java b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/RoutingProtocolCustomizerTest.java index 21a2bdc14..6174f8473 100644 --- a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/RoutingProtocolCustomizerTest.java +++ b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/RoutingProtocolCustomizerTest.java @@ -125,14 +125,8 @@ public class RoutingProtocolCustomizerTest extends WriterCustomizerTest { fail("Test should have thrown exception"); } - @Test + @Test(expected = UnsupportedOperationException.class) public void testUpdate() throws WriteFailedException { - try { - customizer.updateCurrentAttributes(validId, validData, validData, writeContext); - } catch (Exception e) { - assertTrue(e.getCause() instanceof UnsupportedOperationException); - return; - } - fail("Test should have thrown exception"); + customizer.updateCurrentAttributes(validId, validData, validData, writeContext); } } |