diff options
Diffstat (limited to 'v3po/impl')
12 files changed, 104 insertions, 106 deletions
diff --git a/v3po/impl/pom.xml b/v3po/impl/pom.xml index a8109a888..56dcf8555 100644 --- a/v3po/impl/pom.xml +++ b/v3po/impl/pom.xml @@ -36,7 +36,7 @@ </dependency> <dependency> <groupId>${project.groupId}</groupId> - <artifactId>vpp-facade-impl</artifactId> + <artifactId>translate-impl</artifactId> <version>${project.version}</version> </dependency> <dependency> diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/V3poProvider.java b/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/V3poProvider.java index 931ecefd6..0ea4525f0 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/V3poProvider.java +++ b/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/V3poProvider.java @@ -21,8 +21,8 @@ import com.google.common.collect.Lists; import com.google.common.util.concurrent.CheckedFuture; import com.google.common.util.concurrent.Futures; import io.fd.honeycomb.v3po.impl.data.VppDataBrokerInitializationProvider; -import io.fd.honeycomb.v3po.impl.data.VppReaderRegistry; -import io.fd.honeycomb.v3po.impl.data.VppWriterRegistry; +import io.fd.honeycomb.v3po.impl.data.ReaderRegistry; +import io.fd.honeycomb.v3po.impl.data.WriterRegistry; import java.io.IOException; import java.util.Collections; import java.util.HashMap; @@ -196,8 +196,8 @@ public class V3poProvider implements BindingAwareProvider, AutoCloseable, Broker vppPollOperData); startOperationalUpdateTimer(); - final VppReaderRegistry readerRegistry = VppReaderRegistry.getInstance(api); - final VppWriterRegistry writerRegistry = VppWriterRegistry.getInstance(api); + final ReaderRegistry readerRegistry = ReaderRegistry.getInstance(api); + final WriterRegistry writerRegistry = WriterRegistry.getInstance(api); // TODO make configurable: vppDataBrokerInitializationProvider = new VppDataBrokerInitializationProvider(db, readerRegistry, writerRegistry); diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/data/VppReaderRegistry.java b/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/data/ReaderRegistry.java index ba1865494..5e547094f 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/data/VppReaderRegistry.java +++ b/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/data/ReaderRegistry.java @@ -18,20 +18,19 @@ package io.fd.honeycomb.v3po.impl.data; import com.google.common.base.Optional; import com.google.common.collect.Multimap; -import io.fd.honeycomb.v3po.vpp.facade.impl.read.CompositeChildVppReader; -import io.fd.honeycomb.v3po.vpp.facade.impl.read.CompositeListVppReader; -import io.fd.honeycomb.v3po.vpp.facade.impl.read.CompositeRootVppReader; -import io.fd.honeycomb.v3po.vpp.facade.impl.read.util.DelegatingReaderRegistry; -import io.fd.honeycomb.v3po.vpp.facade.impl.read.util.ReflexiveChildReaderCustomizer; -import io.fd.honeycomb.v3po.vpp.facade.impl.read.util.ReflexiveRootReaderCustomizer; -import io.fd.honeycomb.v3po.vpp.facade.impl.util.VppRWUtils; -import io.fd.honeycomb.v3po.vpp.facade.read.ChildVppReader; -import io.fd.honeycomb.v3po.vpp.facade.read.ReadContext; -import io.fd.honeycomb.v3po.vpp.facade.read.ReadFailedException; -import io.fd.honeycomb.v3po.vpp.facade.read.ReaderRegistry; -import io.fd.honeycomb.v3po.vpp.facade.read.VppReader; -import io.fd.honeycomb.v3po.vpp.facade.v3po.vppstate.BridgeDomainCustomizer; -import io.fd.honeycomb.v3po.vpp.facade.v3po.vppstate.VersionCustomizer; +import io.fd.honeycomb.v3po.translate.impl.read.CompositeChildReader; +import io.fd.honeycomb.v3po.translate.impl.read.CompositeListReader; +import io.fd.honeycomb.v3po.translate.impl.read.CompositeRootReader; +import io.fd.honeycomb.v3po.translate.util.read.DelegatingReaderRegistry; +import io.fd.honeycomb.v3po.translate.util.read.ReflexiveChildReaderCustomizer; +import io.fd.honeycomb.v3po.translate.util.read.ReflexiveRootReaderCustomizer; +import io.fd.honeycomb.v3po.translate.util.RWUtils; +import io.fd.honeycomb.v3po.translate.read.ChildReader; +import io.fd.honeycomb.v3po.translate.read.ReadContext; +import io.fd.honeycomb.v3po.translate.read.ReadFailedException; +import io.fd.honeycomb.v3po.translate.read.Reader; +import io.fd.honeycomb.v3po.translate.v3po.vppstate.BridgeDomainCustomizer; +import io.fd.honeycomb.v3po.translate.v3po.vppstate.VersionCustomizer; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -50,47 +49,47 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.openvpp.vppjapi.vppApi; // TODO use some DI framework instead of singleton -public class VppReaderRegistry implements ReaderRegistry { +public class ReaderRegistry implements io.fd.honeycomb.v3po.translate.read.ReaderRegistry { - private static VppReaderRegistry instance; + private static ReaderRegistry instance; private final DelegatingReaderRegistry reader; - private VppReaderRegistry(@Nonnull final vppApi vppApi) { - final CompositeRootVppReader<VppState, VppStateBuilder> vppStateReader = initVppStateReader(vppApi); + private ReaderRegistry(@Nonnull final vppApi vppApi) { + final CompositeRootReader<VppState, VppStateBuilder> vppStateReader = initVppStateReader(vppApi); // TODO add more root readers - reader = new DelegatingReaderRegistry(Collections.<VppReader<? extends DataObject>>singletonList(vppStateReader)); + reader = new DelegatingReaderRegistry(Collections.<Reader<? extends DataObject>>singletonList(vppStateReader)); } - private static CompositeRootVppReader<VppState, VppStateBuilder> initVppStateReader(@Nonnull final vppApi vppApi) { + private static CompositeRootReader<VppState, VppStateBuilder> initVppStateReader(@Nonnull final vppApi vppApi) { - final ChildVppReader<Version> versionReader = new CompositeChildVppReader<>( + final ChildReader<Version> versionReader = new CompositeChildReader<>( Version.class, new VersionCustomizer(vppApi)); - final CompositeListVppReader<BridgeDomain, BridgeDomainKey, BridgeDomainBuilder> - bridgeDomainReader = new CompositeListVppReader<>( + final CompositeListReader<BridgeDomain, BridgeDomainKey, BridgeDomainBuilder> + bridgeDomainReader = new CompositeListReader<>( BridgeDomain.class, new BridgeDomainCustomizer(vppApi)); - final ChildVppReader<BridgeDomains> bridgeDomainsReader = new CompositeChildVppReader<>( + final ChildReader<BridgeDomains> bridgeDomainsReader = new CompositeChildReader<>( BridgeDomains.class, - VppRWUtils.singletonChildReaderList(bridgeDomainReader), + RWUtils.singletonChildReaderList(bridgeDomainReader), new ReflexiveChildReaderCustomizer<>(BridgeDomainsBuilder.class)); - final List<ChildVppReader<? extends ChildOf<VppState>>> childVppReaders = new ArrayList<>(); + final List<ChildReader<? extends ChildOf<VppState>>> childVppReaders = new ArrayList<>(); childVppReaders.add(versionReader); childVppReaders.add(bridgeDomainsReader); - return new CompositeRootVppReader<>( + return new CompositeRootReader<>( VppState.class, childVppReaders, - VppRWUtils.<VppState>emptyAugReaderList(), + RWUtils.<VppState>emptyAugReaderList(), new ReflexiveRootReaderCustomizer<>(VppStateBuilder.class)); } - public static synchronized VppReaderRegistry getInstance(@Nonnull final vppApi vppApi) { + public static synchronized ReaderRegistry getInstance(@Nonnull final vppApi vppApi) { if (instance == null) { - instance = new VppReaderRegistry(vppApi); + instance = new ReaderRegistry(vppApi); } return instance; } diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/data/VppConfigDataTree.java b/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/data/VppConfigDataTree.java index 72848ad0f..1a631fc2e 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/data/VppConfigDataTree.java +++ b/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/data/VppConfigDataTree.java @@ -21,10 +21,9 @@ import static com.google.common.base.Preconditions.checkNotNull; import com.google.common.base.Optional; import com.google.common.util.concurrent.CheckedFuture; import com.google.common.util.concurrent.Futures; -import io.fd.honeycomb.v3po.vpp.facade.VppException; -import io.fd.honeycomb.v3po.vpp.facade.impl.write.util.TransactionWriteContext; -import io.fd.honeycomb.v3po.vpp.facade.write.WriteContext; -import io.fd.honeycomb.v3po.vpp.facade.write.WriterRegistry; +import io.fd.honeycomb.v3po.translate.TranslationException; +import io.fd.honeycomb.v3po.translate.util.write.TransactionWriteContext; +import io.fd.honeycomb.v3po.translate.write.WriteContext; import java.util.Collections; import java.util.Map; import javax.annotation.Nonnull; @@ -54,7 +53,7 @@ public final class VppConfigDataTree implements VppDataTree { private final BindingNormalizedNodeSerializer serializer; private final DataTree dataTree; - private final VppWriterRegistry writer; + private final WriterRegistry writer; public static final ReadableVppDataTree EMPTY_OPERATIONAL = new ReadableVppDataTree() { @Override public CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> read( @@ -72,7 +71,7 @@ public final class VppConfigDataTree implements VppDataTree { * @param vppWriter service for translation between Java Binding Data and Vpp. */ public VppConfigDataTree(@Nonnull final BindingNormalizedNodeSerializer serializer, - @Nonnull final DataTree dataTree, @Nonnull final VppWriterRegistry vppWriter) { + @Nonnull final DataTree dataTree, @Nonnull final WriterRegistry vppWriter) { this.serializer = checkNotNull(serializer, "serializer should not be null"); this.dataTree = checkNotNull(dataTree, "dataTree should not be null"); this.writer = checkNotNull(vppWriter, "vppWriter should not be null"); @@ -85,7 +84,7 @@ public final class VppConfigDataTree implements VppDataTree { @Override public void commit(final DataTreeModification modification) - throws DataValidationFailedException, VppException { + throws DataValidationFailedException, TranslationException { dataTree.validate(modification); final DataTreeCandidate candidate = dataTree.prepare(modification); @@ -109,21 +108,21 @@ public final class VppConfigDataTree implements VppDataTree { final DOMDataReadOnlyTransaction afterTx = new VppReadOnlyTransaction(EMPTY_OPERATIONAL, modificationSnapshot); try(final WriteContext ctx = new TransactionWriteContext(serializer, beforeTx, afterTx)) { writer.update(nodesBefore, nodesAfter, ctx); - } catch (WriterRegistry.BulkUpdateException e) { + } catch (io.fd.honeycomb.v3po.translate.write.WriterRegistry.BulkUpdateException e) { LOG.warn("Failed to apply all changes", e); LOG.info("Trying to revert successful changes for current transaction"); try { e.revertChanges(); LOG.info("Changes successfully reverted"); - } catch (WriterRegistry.Reverter.RevertFailedException revertFailedException) { + } catch (io.fd.honeycomb.v3po.translate.write.WriterRegistry.Reverter.RevertFailedException revertFailedException) { // fail with failed revert LOG.error("Failed to revert successful changes", revertFailedException); throw revertFailedException; } throw e; // fail with success revert - } catch (VppException e) { + } catch (TranslationException e) { LOG.error("Error while processing data change (before={}, after={})", nodesBefore, nodesAfter, e); throw e; } diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/data/VppDataBrokerInitializationProvider.java b/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/data/VppDataBrokerInitializationProvider.java index d84f0b7b7..bdfc89079 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/data/VppDataBrokerInitializationProvider.java +++ b/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/data/VppDataBrokerInitializationProvider.java @@ -24,7 +24,7 @@ import com.google.common.util.concurrent.AsyncFunction; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import io.fd.honeycomb.v3po.impl.LoggingFuturesCallBack; -import io.fd.honeycomb.v3po.vpp.facade.read.ReaderRegistry; +import io.fd.honeycomb.v3po.translate.read.ReaderRegistry; import java.util.Collection; import java.util.Collections; import javassist.ClassPool; @@ -85,13 +85,13 @@ public final class VppDataBrokerInitializationProvider implements Provider, Auto private final DataBroker bindingBroker; private final ReaderRegistry readerRegistry; private final InstanceIdentifier<Node> mountPointPath; - private final VppWriterRegistry writerRegistry; + private final WriterRegistry writerRegistry; private ObjectRegistration<DOMMountPoint> mountPointRegistration; private DOMDataBroker broker; public VppDataBrokerInitializationProvider(@Nonnull final DataBroker bindingBroker, final ReaderRegistry readerRegistry, - final VppWriterRegistry writerRegistry) { + final WriterRegistry writerRegistry) { this.bindingBroker = checkNotNull(bindingBroker, "bindingBroker should not be null"); this.readerRegistry = checkNotNull(readerRegistry, "readerRegistry should not be null"); this.writerRegistry = checkNotNull(writerRegistry, "writerRegistry should not be null"); diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/data/VppDataTree.java b/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/data/VppDataTree.java index 7e62b57b0..aba8ab133 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/data/VppDataTree.java +++ b/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/data/VppDataTree.java @@ -17,7 +17,7 @@ package io.fd.honeycomb.v3po.impl.data; import com.google.common.annotations.Beta; -import io.fd.honeycomb.v3po.vpp.facade.VppException; +import io.fd.honeycomb.v3po.translate.TranslationException; import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification; import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException; @@ -31,9 +31,9 @@ public interface VppDataTree { * * @param modification VPP data tree modification * @throws DataValidationFailedException if modification data is not valid - * @throws VppException if commit failed while updating VPP state + * @throws TranslationException if commit failed while updating VPP state */ - void commit(final DataTreeModification modification) throws DataValidationFailedException, VppException; + void commit(final DataTreeModification modification) throws DataValidationFailedException, TranslationException; /** * Creates read-only snapshot of a VppDataTree. diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/data/VppOperationalDataTree.java b/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/data/VppOperationalDataTree.java index 12d281611..8f606fdbf 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/data/VppOperationalDataTree.java +++ b/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/data/VppOperationalDataTree.java @@ -26,10 +26,10 @@ import com.google.common.collect.Collections2; import com.google.common.collect.Multimap; import com.google.common.util.concurrent.CheckedFuture; import com.google.common.util.concurrent.Futures; -import io.fd.honeycomb.v3po.vpp.facade.Context; -import io.fd.honeycomb.v3po.vpp.facade.read.ReadContext; -import io.fd.honeycomb.v3po.vpp.facade.read.ReadFailedException; -import io.fd.honeycomb.v3po.vpp.facade.read.ReaderRegistry; +import io.fd.honeycomb.v3po.translate.Context; +import io.fd.honeycomb.v3po.translate.read.ReadContext; +import io.fd.honeycomb.v3po.translate.read.ReadFailedException; +import io.fd.honeycomb.v3po.translate.read.ReaderRegistry; import java.util.Collection; import java.util.Map; import javax.annotation.Nonnull; diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/data/VppWriteTransaction.java b/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/data/VppWriteTransaction.java index 1baa586b1..b33fffa68 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/data/VppWriteTransaction.java +++ b/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/data/VppWriteTransaction.java @@ -26,7 +26,7 @@ import com.google.common.base.Preconditions; import com.google.common.util.concurrent.CheckedFuture; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; -import io.fd.honeycomb.v3po.vpp.facade.VppException; +import io.fd.honeycomb.v3po.translate.TranslationException; import javax.annotation.Nonnull; import javax.annotation.concurrent.NotThreadSafe; import org.opendaylight.controller.md.sal.common.api.TransactionStatus; @@ -121,7 +121,7 @@ final class VppWriteTransaction implements DOMDataWriteTransaction { try { configDataTree.commit(modification); status = COMMITED; - } catch (DataValidationFailedException | VppException e) { + } catch (DataValidationFailedException | TranslationException e) { status = FAILED; LOG.error("Failed to commit VPP state modification", e); return Futures.immediateFailedCheckedFuture( diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/data/VppWriterRegistry.java b/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/data/WriterRegistry.java index 04b4bd631..00dc22520 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/data/VppWriterRegistry.java +++ b/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/data/WriterRegistry.java @@ -16,19 +16,18 @@ package io.fd.honeycomb.v3po.impl.data; -import io.fd.honeycomb.v3po.vpp.facade.VppException; -import io.fd.honeycomb.v3po.vpp.facade.impl.util.VppRWUtils; -import io.fd.honeycomb.v3po.vpp.facade.impl.write.CompositeChildVppWriter; -import io.fd.honeycomb.v3po.vpp.facade.impl.write.CompositeListVppWriter; -import io.fd.honeycomb.v3po.vpp.facade.impl.write.CompositeRootVppWriter; -import io.fd.honeycomb.v3po.vpp.facade.impl.write.util.DelegatingWriterRegistry; -import io.fd.honeycomb.v3po.vpp.facade.impl.write.util.NoopWriterCustomizer; -import io.fd.honeycomb.v3po.vpp.facade.impl.write.util.ReflexiveChildWriterCustomizer; -import io.fd.honeycomb.v3po.vpp.facade.v3po.vpp.BridgeDomainCustomizer; -import io.fd.honeycomb.v3po.vpp.facade.write.ChildVppWriter; -import io.fd.honeycomb.v3po.vpp.facade.write.VppWriter; -import io.fd.honeycomb.v3po.vpp.facade.write.WriteContext; -import io.fd.honeycomb.v3po.vpp.facade.write.WriterRegistry; +import io.fd.honeycomb.v3po.translate.TranslationException; +import io.fd.honeycomb.v3po.translate.util.RWUtils; +import io.fd.honeycomb.v3po.translate.impl.write.CompositeChildWriter; +import io.fd.honeycomb.v3po.translate.impl.write.CompositeListWriter; +import io.fd.honeycomb.v3po.translate.impl.write.CompositeRootWriter; +import io.fd.honeycomb.v3po.translate.util.write.DelegatingWriterRegistry; +import io.fd.honeycomb.v3po.translate.util.write.NoopWriterCustomizer; +import io.fd.honeycomb.v3po.translate.util.write.ReflexiveChildWriterCustomizer; +import io.fd.honeycomb.v3po.translate.v3po.vpp.BridgeDomainCustomizer; +import io.fd.honeycomb.v3po.translate.write.ChildWriter; +import io.fd.honeycomb.v3po.translate.write.Writer; +import io.fd.honeycomb.v3po.translate.write.WriteContext; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -45,39 +44,39 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.openvpp.vppjapi.vppApi; // TODO use some DI framework instead of singleton -public class VppWriterRegistry implements WriterRegistry { +public class WriterRegistry implements io.fd.honeycomb.v3po.translate.write.WriterRegistry { - private static VppWriterRegistry instance; + private static WriterRegistry instance; private final DelegatingWriterRegistry writer; - private VppWriterRegistry(@Nonnull final vppApi vppApi) { - final CompositeRootVppWriter<Vpp> vppWriter = initVppStateWriter(vppApi); - writer = new DelegatingWriterRegistry(Collections.<VppWriter<? extends DataObject>>singletonList(vppWriter)); + private WriterRegistry(@Nonnull final vppApi vppApi) { + final CompositeRootWriter<Vpp> vppWriter = initVppStateWriter(vppApi); + writer = new DelegatingWriterRegistry(Collections.<Writer<? extends DataObject>>singletonList(vppWriter)); } - private static CompositeRootVppWriter<Vpp> initVppStateWriter(@Nonnull final vppApi vppApi) { - final CompositeListVppWriter<BridgeDomain, BridgeDomainKey> bridgeDomainWriter = new CompositeListVppWriter<>( + private static CompositeRootWriter<Vpp> initVppStateWriter(@Nonnull final vppApi vppApi) { + final CompositeListWriter<BridgeDomain, BridgeDomainKey> bridgeDomainWriter = new CompositeListWriter<>( BridgeDomain.class, new BridgeDomainCustomizer(vppApi)); - final ChildVppWriter<BridgeDomains> bridgeDomainsWriter = new CompositeChildVppWriter<>( + final ChildWriter<BridgeDomains> bridgeDomainsWriter = new CompositeChildWriter<>( BridgeDomains.class, - VppRWUtils.singletonChildWriterList(bridgeDomainWriter), + RWUtils.singletonChildWriterList(bridgeDomainWriter), new ReflexiveChildWriterCustomizer<BridgeDomains>()); - final List<ChildVppWriter<? extends ChildOf<Vpp>>> childWriters = new ArrayList<>(); + final List<ChildWriter<? extends ChildOf<Vpp>>> childWriters = new ArrayList<>(); childWriters.add(bridgeDomainsWriter); - return new CompositeRootVppWriter<>( + return new CompositeRootWriter<>( Vpp.class, childWriters, new NoopWriterCustomizer<Vpp>()); } - public static synchronized VppWriterRegistry getInstance(@Nonnull final vppApi vppApi) { + public static synchronized WriterRegistry getInstance(@Nonnull final vppApi vppApi) { if (instance == null) { - instance = new VppWriterRegistry(vppApi); + instance = new WriterRegistry(vppApi); } return instance; } @@ -91,7 +90,7 @@ public class VppWriterRegistry implements WriterRegistry { @Override public void update(@Nonnull final InstanceIdentifier<? extends DataObject> id, @Nullable final DataObject dataBefore, - @Nullable final DataObject data, @Nonnull final WriteContext ctx) throws VppException { + @Nullable final DataObject data, @Nonnull final WriteContext ctx) throws TranslationException { writer.update(id, dataBefore, data, ctx); } @@ -99,7 +98,7 @@ public class VppWriterRegistry implements WriterRegistry { public void update(@Nonnull final Map<InstanceIdentifier<?>, DataObject> dataBefore, @Nonnull final Map<InstanceIdentifier<?>, DataObject> dataAfter, @Nonnull final WriteContext ctx) - throws VppException { + throws TranslationException { writer.update(dataBefore, dataAfter, ctx); } } diff --git a/v3po/impl/src/test/java/io/fd/honeycomb/v3po/impl/data/VPPConfigDataTreeTest.java b/v3po/impl/src/test/java/io/fd/honeycomb/v3po/impl/data/VPPConfigDataTreeTest.java index 207a64a99..c4315cd38 100644 --- a/v3po/impl/src/test/java/io/fd/honeycomb/v3po/impl/data/VPPConfigDataTreeTest.java +++ b/v3po/impl/src/test/java/io/fd/honeycomb/v3po/impl/data/VPPConfigDataTreeTest.java @@ -31,9 +31,8 @@ import static org.mockito.MockitoAnnotations.initMocks; import com.google.common.base.Optional; import com.google.common.util.concurrent.CheckedFuture; -import io.fd.honeycomb.v3po.vpp.facade.VppException; -import io.fd.honeycomb.v3po.vpp.facade.write.WriteContext; -import io.fd.honeycomb.v3po.vpp.facade.write.WriterRegistry; +import io.fd.honeycomb.v3po.translate.TranslationException; +import io.fd.honeycomb.v3po.translate.write.WriteContext; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -60,7 +59,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot; public class VPPConfigDataTreeTest { @Mock - private VppWriterRegistry vppWriter; + private WriterRegistry vppWriter; @Mock private BindingNormalizedNodeSerializer serializer; @Mock @@ -156,11 +155,12 @@ public class VPPConfigDataTreeTest { final DataObject dataBefore = mockDataObject("before", Ethernet.class); final DataObject dataAfter = mockDataObject("after", Ethernet.class); - final WriterRegistry.Reverter reverter = mock(WriterRegistry.Reverter.class); + final io.fd.honeycomb.v3po.translate.write.WriterRegistry.Reverter reverter = mock( + io.fd.honeycomb.v3po.translate.write.WriterRegistry.Reverter.class); // Fail on update: - final VppException failedOnUpdateException = new VppException("update failed"); - doThrow(new WriterRegistry.BulkUpdateException(InstanceIdentifier.create(Ethernet.class), reverter, + final TranslationException failedOnUpdateException = new TranslationException("update failed"); + doThrow(new io.fd.honeycomb.v3po.translate.write.WriterRegistry.BulkUpdateException(InstanceIdentifier.create(Ethernet.class), reverter, failedOnUpdateException)).when(vppWriter).update(anyMap(), anyMap(), any(WriteContext.class)); // Prepare modification: @@ -175,7 +175,7 @@ public class VPPConfigDataTreeTest { // Run the test try { proxy.commit(modification); - } catch (WriterRegistry.BulkUpdateException e) { + } catch (io.fd.honeycomb.v3po.translate.write.WriterRegistry.BulkUpdateException e) { verify(vppWriter).update(anyMap(), anyMap(), any(WriteContext.class)); verify(reverter).revert(); assertEquals(failedOnUpdateException, e.getCause()); @@ -191,16 +191,17 @@ public class VPPConfigDataTreeTest { final DataObject dataBefore = mockDataObject("before", Ethernet.class); final DataObject dataAfter = mockDataObject("after", Ethernet.class); - final WriterRegistry.Reverter reverter = mock(WriterRegistry.Reverter.class); + final io.fd.honeycomb.v3po.translate.write.WriterRegistry.Reverter reverter = mock( + io.fd.honeycomb.v3po.translate.write.WriterRegistry.Reverter.class); // Fail on update: - doThrow(new WriterRegistry.BulkUpdateException(InstanceIdentifier.create(Ethernet.class), reverter, - new VppException("update failed"))).when(vppWriter).update(anyMap(), anyMap(), any(WriteContext.class)); + doThrow(new io.fd.honeycomb.v3po.translate.write.WriterRegistry.BulkUpdateException(InstanceIdentifier.create(Ethernet.class), reverter, + new TranslationException("update failed"))).when(vppWriter).update(anyMap(), anyMap(), any(WriteContext.class)); // Fail on revert: - final VppException failedOnRevertException = new VppException("update failed"); - final WriterRegistry.Reverter.RevertFailedException revertFailedException = - new WriterRegistry.Reverter.RevertFailedException(Collections.<InstanceIdentifier<?>>emptyList(), + final TranslationException failedOnRevertException = new TranslationException("update failed"); + final io.fd.honeycomb.v3po.translate.write.WriterRegistry.Reverter.RevertFailedException revertFailedException = + new io.fd.honeycomb.v3po.translate.write.WriterRegistry.Reverter.RevertFailedException(Collections.<InstanceIdentifier<?>>emptyList(), failedOnRevertException); doThrow(revertFailedException).when(reverter).revert(); @@ -216,7 +217,7 @@ public class VPPConfigDataTreeTest { // Run the test try { proxy.commit(modification); - } catch (WriterRegistry.Reverter.RevertFailedException e) { + } catch (io.fd.honeycomb.v3po.translate.write.WriterRegistry.Reverter.RevertFailedException e) { verify(vppWriter).update(anyMap(), anyMap(), any(WriteContext.class)); verify(reverter).revert(); assertEquals(failedOnRevertException, e.getCause()); diff --git a/v3po/impl/src/test/java/io/fd/honeycomb/v3po/impl/data/VppDataBrokerInitializationProviderTest.java b/v3po/impl/src/test/java/io/fd/honeycomb/v3po/impl/data/VppDataBrokerInitializationProviderTest.java index 2c50ec92d..51f57a252 100644 --- a/v3po/impl/src/test/java/io/fd/honeycomb/v3po/impl/data/VppDataBrokerInitializationProviderTest.java +++ b/v3po/impl/src/test/java/io/fd/honeycomb/v3po/impl/data/VppDataBrokerInitializationProviderTest.java @@ -26,7 +26,7 @@ import static org.mockito.Mockito.verify; import static org.mockito.MockitoAnnotations.initMocks; import com.google.common.util.concurrent.CheckedFuture; -import io.fd.honeycomb.v3po.vpp.facade.read.ReaderRegistry; +import io.fd.honeycomb.v3po.translate.read.ReaderRegistry; import org.junit.Before; import org.junit.Test; import org.mockito.Mock; @@ -45,7 +45,7 @@ public class VppDataBrokerInitializationProviderTest { @Mock private ReaderRegistry readerRegistry; @Mock - private VppWriterRegistry writerRegistry; + private WriterRegistry writerRegistry; private VppDataBrokerInitializationProvider provider; diff --git a/v3po/impl/src/test/java/io/fd/honeycomb/v3po/impl/data/VppOperationalDataTreeTest.java b/v3po/impl/src/test/java/io/fd/honeycomb/v3po/impl/data/VppOperationalDataTreeTest.java index 09e70941b..049c2a0c8 100644 --- a/v3po/impl/src/test/java/io/fd/honeycomb/v3po/impl/data/VppOperationalDataTreeTest.java +++ b/v3po/impl/src/test/java/io/fd/honeycomb/v3po/impl/data/VppOperationalDataTreeTest.java @@ -34,8 +34,8 @@ import com.google.common.collect.Iterables; import com.google.common.collect.LinkedListMultimap; import com.google.common.collect.Multimap; import com.google.common.util.concurrent.CheckedFuture; -import io.fd.honeycomb.v3po.vpp.facade.read.ReadContext; -import io.fd.honeycomb.v3po.vpp.facade.read.ReaderRegistry; +import io.fd.honeycomb.v3po.translate.read.ReadContext; +import io.fd.honeycomb.v3po.translate.read.ReaderRegistry; import java.util.Map; import org.junit.Before; import org.junit.Test; @@ -121,7 +121,7 @@ public class VppOperationalDataTreeTest { @Test public void testReadFailed() throws Exception{ - doThrow(io.fd.honeycomb.v3po.vpp.facade.read.ReadFailedException.class).when(reader).readAll(any(ReadContext.class)); + doThrow(io.fd.honeycomb.v3po.translate.read.ReadFailedException.class).when(reader).readAll(any(ReadContext.class)); final CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> future = operationalData.read( YangInstanceIdentifier.EMPTY); @@ -129,7 +129,7 @@ public class VppOperationalDataTreeTest { try { future.checkedGet(); } catch (ReadFailedException e) { - assertTrue(e.getCause() instanceof io.fd.honeycomb.v3po.vpp.facade.read.ReadFailedException); + assertTrue(e.getCause() instanceof io.fd.honeycomb.v3po.translate.read.ReadFailedException); return; } fail("ReadFailedException was expected"); |