diff options
author | Maros Marsalek <mmarsale@cisco.com> | 2016-04-12 10:13:14 +0200 |
---|---|---|
committer | Maros Marsalek <mmarsale@cisco.com> | 2016-04-12 10:13:14 +0200 |
commit | c7ca517b00f2682987aef3ac390dfc04155a8aee (patch) | |
tree | 662791d6e857234dab467d9cddd55300060ccaca | |
parent | 4a3dce3e0e59df4e091b4f8d4efc3e20831bf22f (diff) |
HONEYCOMB-9: Split impl module into smaller parts
Change-Id: I9232e0adfe611cb97951080839b28a7b62ba5484
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
74 files changed, 1082 insertions, 258 deletions
diff --git a/v3po/artifacts/pom.xml b/v3po/artifacts/pom.xml index b4c283973..cdfb7c27f 100644 --- a/v3po/artifacts/pom.xml +++ b/v3po/artifacts/pom.xml @@ -31,6 +31,31 @@ </dependency> <dependency> <groupId>${project.groupId}</groupId> + <artifactId>vpp-facade-api</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>vpp-facade-spi</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>vpp-facade-impl</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>vpp-facade-utils</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>v3po2vpp</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> <artifactId>v3po-impl</artifactId> <version>${project.version}</version> </dependency> diff --git a/v3po/features/pom.xml b/v3po/features/pom.xml index 77473cade..142d803c1 100644 --- a/v3po/features/pom.xml +++ b/v3po/features/pom.xml @@ -134,6 +134,31 @@ <version>${project.version}</version> </dependency> <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>vpp-facade-api</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>vpp-facade-spi</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>vpp-facade-impl</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>vpp-facade-utils</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>v3po2vpp</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> <groupId>io.fd.vpp</groupId> <artifactId>vppjapi</artifactId> <version>1.0.0-SNAPSHOT</version> diff --git a/v3po/features/src/main/features/features.xml b/v3po/features/src/main/features/features.xml index 3d3ffdb3e..cea5999ae 100644 --- a/v3po/features/src/main/features/features.xml +++ b/v3po/features/src/main/features/features.xml @@ -35,6 +35,11 @@ <feature version='${netconf.version}'>odl-netconf-connector-ssh</feature> <feature version='${mdsal.version}'>odl-netconf-mdsal</feature> <bundle>mvn:io.fd.honeycomb.v3po/v3po-impl/${project.version}</bundle> + <bundle>mvn:io.fd.honeycomb.v3po/vpp-facade-api/${project.version}</bundle> + <bundle>mvn:io.fd.honeycomb.v3po/vpp-facade-spi/${project.version}</bundle> + <bundle>mvn:io.fd.honeycomb.v3po/vpp-facade-utils/${project.version}</bundle> + <bundle>mvn:io.fd.honeycomb.v3po/vpp-facade-impl/${project.version}</bundle> + <bundle>mvn:io.fd.honeycomb.v3po/v3po2vpp/${project.version}</bundle> <bundle>wrap:mvn:io.fd.vpp/vppjapi/1.0.0-SNAPSHOT</bundle> <configfile finalname="${configfile.directory}/v3po.xml">mvn:io.fd.honeycomb.v3po/v3po-impl/${project.version}/xml/config</configfile> <configfile finalname="${configfile.directory}/v3po-netconf.xml">mvn:io.fd.honeycomb.v3po/v3po-impl/${project.version}/xml/netconf</configfile> diff --git a/v3po/impl/pom.xml b/v3po/impl/pom.xml index a47b6a133..a8109a888 100644 --- a/v3po/impl/pom.xml +++ b/v3po/impl/pom.xml @@ -34,6 +34,16 @@ <artifactId>v3po-api</artifactId> <version>${project.version}</version> </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>vpp-facade-impl</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>v3po2vpp</artifactId> + <version>${project.version}</version> + </dependency> <dependency> <groupId>io.fd.vpp</groupId> 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 1982bc707..72848ad0f 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,10 @@ 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.impl.trans.VppException; -import io.fd.honeycomb.v3po.impl.trans.w.WriteContext; -import io.fd.honeycomb.v3po.impl.trans.w.WriterRegistry; -import io.fd.honeycomb.v3po.impl.trans.w.util.TransactionWriteContext; +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 java.util.Collections; import java.util.Map; import javax.annotation.Nonnull; 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 2a14f48b1..d84f0b7b7 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.impl.trans.r.ReaderRegistry; +import io.fd.honeycomb.v3po.vpp.facade.read.ReaderRegistry; import java.util.Collection; import java.util.Collections; import javassist.ClassPool; 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 7fd9b2e3a..7e62b57b0 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.impl.trans.VppException; +import io.fd.honeycomb.v3po.vpp.facade.VppException; import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification; import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException; @@ -33,8 +33,7 @@ public interface VppDataTree { * @throws DataValidationFailedException if modification data is not valid * @throws VppException if commit failed while updating VPP state */ - void commit(final DataTreeModification modification) throws DataValidationFailedException, - VppException; + void commit(final DataTreeModification modification) throws DataValidationFailedException, VppException; /** * 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 d73c22a6d..12d281611 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.impl.trans.ReadFailedException; -import io.fd.honeycomb.v3po.impl.trans.r.ReadContext; -import io.fd.honeycomb.v3po.impl.trans.r.ReaderRegistry; -import io.fd.honeycomb.v3po.impl.trans.util.Context; +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 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/VppReaderRegistry.java b/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/data/VppReaderRegistry.java index fc6a51add..ba1865494 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/VppReaderRegistry.java @@ -18,20 +18,20 @@ package io.fd.honeycomb.v3po.impl.data; import com.google.common.base.Optional; import com.google.common.collect.Multimap; -import io.fd.honeycomb.v3po.impl.trans.ReadFailedException; -import io.fd.honeycomb.v3po.impl.trans.r.ChildVppReader; -import io.fd.honeycomb.v3po.impl.trans.r.ReadContext; -import io.fd.honeycomb.v3po.impl.trans.r.ReaderRegistry; -import io.fd.honeycomb.v3po.impl.trans.r.VppReader; -import io.fd.honeycomb.v3po.impl.trans.r.impl.CompositeChildVppReader; -import io.fd.honeycomb.v3po.impl.trans.r.impl.CompositeListVppReader; -import io.fd.honeycomb.v3po.impl.trans.r.impl.CompositeRootVppReader; -import io.fd.honeycomb.v3po.impl.trans.r.util.DelegatingReaderRegistry; -import io.fd.honeycomb.v3po.impl.trans.r.util.ReflexiveChildReaderCustomizer; -import io.fd.honeycomb.v3po.impl.trans.r.util.ReflexiveRootReaderCustomizer; -import io.fd.honeycomb.v3po.impl.trans.util.VppRWUtils; -import io.fd.honeycomb.v3po.impl.vppstate.BridgeDomainCustomizer; -import io.fd.honeycomb.v3po.impl.vppstate.VersionCustomizer; +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 java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -98,7 +98,7 @@ public class VppReaderRegistry implements ReaderRegistry { @Nonnull @Override public Multimap<InstanceIdentifier<? extends DataObject>, ? extends DataObject> readAll( - @Nonnull final ReadContext ctx) throws io.fd.honeycomb.v3po.impl.trans.ReadFailedException { + @Nonnull final ReadContext ctx) throws ReadFailedException { return reader.readAll(ctx); } 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 299898bd3..1baa586b1 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.impl.trans.VppException; +import io.fd.honeycomb.v3po.vpp.facade.VppException; import javax.annotation.Nonnull; import javax.annotation.concurrent.NotThreadSafe; import org.opendaylight.controller.md.sal.common.api.TransactionStatus; 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/VppWriterRegistry.java index defcca47e..04b4bd631 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/VppWriterRegistry.java @@ -16,18 +16,19 @@ package io.fd.honeycomb.v3po.impl.data; -import io.fd.honeycomb.v3po.impl.trans.VppException; -import io.fd.honeycomb.v3po.impl.trans.util.VppRWUtils; -import io.fd.honeycomb.v3po.impl.trans.w.ChildVppWriter; -import io.fd.honeycomb.v3po.impl.trans.w.VppWriter; -import io.fd.honeycomb.v3po.impl.trans.w.WriteContext; -import io.fd.honeycomb.v3po.impl.trans.w.WriterRegistry; -import io.fd.honeycomb.v3po.impl.trans.w.impl.CompositeChildVppWriter; -import io.fd.honeycomb.v3po.impl.trans.w.impl.CompositeListVppWriter; -import io.fd.honeycomb.v3po.impl.trans.w.impl.CompositeRootVppWriter; -import io.fd.honeycomb.v3po.impl.trans.w.util.DelegatingWriterRegistry; -import io.fd.honeycomb.v3po.impl.trans.w.util.NoopWriterCustomizer; -import io.fd.honeycomb.v3po.impl.trans.w.util.ReflexiveChildWriterCustomizer; +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 java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -58,7 +59,7 @@ public class VppWriterRegistry implements WriterRegistry { private static CompositeRootVppWriter<Vpp> initVppStateWriter(@Nonnull final vppApi vppApi) { final CompositeListVppWriter<BridgeDomain, BridgeDomainKey> bridgeDomainWriter = new CompositeListVppWriter<>( BridgeDomain.class, - new io.fd.honeycomb.v3po.impl.vpp.BridgeDomainCustomizer(vppApi)); + new BridgeDomainCustomizer(vppApi)); final ChildVppWriter<BridgeDomains> bridgeDomainsWriter = new CompositeChildVppWriter<>( BridgeDomains.class, 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 8719a5356..207a64a99 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,9 @@ import static org.mockito.MockitoAnnotations.initMocks; import com.google.common.base.Optional; import com.google.common.util.concurrent.CheckedFuture; -import io.fd.honeycomb.v3po.impl.trans.VppException; -import io.fd.honeycomb.v3po.impl.trans.w.WriteContext; -import io.fd.honeycomb.v3po.impl.trans.w.WriterRegistry; +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 java.util.ArrayList; import java.util.Collections; import java.util.List; 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 30cebf2f9..2c50ec92d 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.impl.trans.r.ReaderRegistry; +import io.fd.honeycomb.v3po.vpp.facade.read.ReaderRegistry; import org.junit.Before; import org.junit.Test; import org.mockito.Mock; 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 493a01912..09e70941b 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.impl.trans.r.ReadContext; -import io.fd.honeycomb.v3po.impl.trans.r.ReaderRegistry; +import io.fd.honeycomb.v3po.vpp.facade.read.ReadContext; +import io.fd.honeycomb.v3po.vpp.facade.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.impl.trans.ReadFailedException.class).when(reader).readAll(any(ReadContext.class)); + doThrow(io.fd.honeycomb.v3po.vpp.facade.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.impl.trans.ReadFailedException); + assertTrue(e.getCause() instanceof io.fd.honeycomb.v3po.vpp.facade.read.ReadFailedException); return; } fail("ReadFailedException was expected"); diff --git a/v3po/pom.xml b/v3po/pom.xml index ef721352d..cb9073c9b 100644 --- a/v3po/pom.xml +++ b/v3po/pom.xml @@ -33,6 +33,11 @@ </prerequisites> <modules> <module>api</module> + <module>vpp-facade-spi</module> + <module>vpp-facade-api</module> + <module>vpp-facade-impl</module> + <module>vpp-facade-utils</module> + <module>v3po2vpp</module> <module>impl</module> <module>karaf</module> <module>features</module> diff --git a/v3po/v3po2vpp/pom.xml b/v3po/v3po2vpp/pom.xml new file mode 100644 index 000000000..eb4aca7fa --- /dev/null +++ b/v3po/v3po2vpp/pom.xml @@ -0,0 +1,92 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright (c) 2015 Cisco and/or its affiliates. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <groupId>io.fd.honeycomb.common</groupId> + <artifactId>api-parent</artifactId> + <version>1.0.0-SNAPSHOT</version> + <relativePath>../../common/api-parent</relativePath> + </parent> + + <modelVersion>4.0.0</modelVersion> + <groupId>io.fd.honeycomb.v3po</groupId> + <artifactId>v3po2vpp</artifactId> + <version>1.0.0-SNAPSHOT</version> + <packaging>bundle</packaging> + + <dependencies> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>vpp-facade-spi</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>vpp-facade-utils</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>v3po-api</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>io.fd.vpp</groupId> + <artifactId>vppjapi</artifactId> + <version>1.0.0-SNAPSHOT</version> + </dependency> + + <!-- Testing Dependencies --> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>vpp-facade-impl</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-all</artifactId> + <scope>test</scope> + </dependency> + <!--Needed due to final vppAPI, TODO remove once vppAPi refactored--> + <dependency> + <groupId>org.powermock</groupId> + <artifactId>powermock-api-mockito</artifactId> + <version>1.5.6</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.powermock</groupId> + <artifactId>powermock-module-junit4</artifactId> + <version>1.5.6</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.skinny-framework</groupId> + <artifactId>skinny-logback</artifactId> + <version>1.0.8</version> + <scope>test</scope> + </dependency> + + </dependencies> + +</project> diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/vpp/BridgeDomainCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/vpp/facade/v3po/vpp/BridgeDomainCustomizer.java index c56ebb1a8..2c394fe77 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/vpp/BridgeDomainCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/vpp/facade/v3po/vpp/BridgeDomainCustomizer.java @@ -14,15 +14,15 @@ * limitations under the License. */ -package io.fd.honeycomb.v3po.impl.vpp; +package io.fd.honeycomb.v3po.vpp.facade.v3po.vpp; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkState; -import io.fd.honeycomb.v3po.impl.trans.util.Context; -import io.fd.honeycomb.v3po.impl.trans.util.VppApiCustomizer; -import io.fd.honeycomb.v3po.impl.trans.w.impl.spi.ListVppWriterCustomizer; +import io.fd.honeycomb.v3po.vpp.facade.impl.util.VppApiCustomizer; +import io.fd.honeycomb.v3po.vpp.facade.Context; +import io.fd.honeycomb.v3po.vpp.facade.spi.write.ListVppWriterCustomizer; import java.util.List; import javax.annotation.Nonnull; import javax.annotation.Nullable; diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/vppstate/BridgeDomainCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/vpp/facade/v3po/vppstate/BridgeDomainCustomizer.java index 08daa4e40..178deaddf 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/vppstate/BridgeDomainCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/vpp/facade/v3po/vppstate/BridgeDomainCustomizer.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.fd.honeycomb.v3po.impl.vppstate; +package io.fd.honeycomb.v3po.vpp.facade.v3po.vppstate; import com.google.common.collect.Lists; -import io.fd.honeycomb.v3po.impl.trans.r.impl.spi.ListVppReaderCustomizer; -import io.fd.honeycomb.v3po.impl.trans.util.Context; -import io.fd.honeycomb.v3po.impl.trans.util.VppApiCustomizer; +import io.fd.honeycomb.v3po.vpp.facade.impl.util.VppApiCustomizer; +import io.fd.honeycomb.v3po.vpp.facade.Context; +import io.fd.honeycomb.v3po.vpp.facade.spi.read.ListVppReaderCustomizer; import java.util.ArrayList; import java.util.List; import javax.annotation.Nonnull; diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/vppstate/VersionCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/vpp/facade/v3po/vppstate/VersionCustomizer.java index 4cdacaa1b..3e928176e 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/vppstate/VersionCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/vpp/facade/v3po/vppstate/VersionCustomizer.java @@ -14,11 +14,11 @@ * limitations under the License. */ -package io.fd.honeycomb.v3po.impl.vppstate; +package io.fd.honeycomb.v3po.vpp.facade.v3po.vppstate; -import io.fd.honeycomb.v3po.impl.trans.r.impl.spi.ChildVppReaderCustomizer; -import io.fd.honeycomb.v3po.impl.trans.util.Context; -import io.fd.honeycomb.v3po.impl.trans.util.VppApiCustomizer; +import io.fd.honeycomb.v3po.vpp.facade.Context; +import io.fd.honeycomb.v3po.vpp.facade.impl.util.VppApiCustomizer; +import io.fd.honeycomb.v3po.vpp.facade.spi.read.ChildVppReaderCustomizer; import javax.annotation.Nonnull; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VppStateBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.state.Version; diff --git a/v3po/impl/src/test/java/io/fd/honeycomb/v3po/impl/vpp/BridgeDomainCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/vpp/facade/v3po/vpp/BridgeDomainCustomizerTest.java index 4614b875a..059713544 100644 --- a/v3po/impl/src/test/java/io/fd/honeycomb/v3po/impl/vpp/BridgeDomainCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/vpp/facade/v3po/vpp/BridgeDomainCustomizerTest.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package io.fd.honeycomb.v3po.impl.vpp; +package io.fd.honeycomb.v3po.vpp.facade.v3po.vpp; -import static io.fd.honeycomb.v3po.impl.vpp.BridgeDomainTestUtils.BD_NAME_TO_ID_ANSWER; -import static io.fd.honeycomb.v3po.impl.vpp.BridgeDomainTestUtils.bdIdentifierForName; -import static io.fd.honeycomb.v3po.impl.vpp.BridgeDomainTestUtils.bdNameToID; -import static io.fd.honeycomb.v3po.impl.vpp.BridgeDomainTestUtils.booleanToByte; -import static io.fd.honeycomb.v3po.impl.vpp.BridgeDomainTestUtils.intToBoolean; +import static io.fd.honeycomb.v3po.vpp.facade.v3po.vpp.BridgeDomainTestUtils.BD_NAME_TO_ID_ANSWER; +import static io.fd.honeycomb.v3po.vpp.facade.v3po.vpp.BridgeDomainTestUtils.bdIdentifierForName; +import static io.fd.honeycomb.v3po.vpp.facade.v3po.vpp.BridgeDomainTestUtils.bdNameToID; +import static io.fd.honeycomb.v3po.vpp.facade.v3po.vpp.BridgeDomainTestUtils.booleanToByte; +import static io.fd.honeycomb.v3po.vpp.facade.v3po.vpp.BridgeDomainTestUtils.intToBoolean; import static org.junit.Assert.fail; import static org.mockito.Matchers.anyInt; import static org.mockito.Matchers.anyString; @@ -28,7 +28,7 @@ import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; import static org.mockito.MockitoAnnotations.initMocks; -import io.fd.honeycomb.v3po.impl.trans.util.Context; +import io.fd.honeycomb.v3po.vpp.facade.Context; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/v3po/impl/src/test/java/io/fd/honeycomb/v3po/impl/vpp/BridgeDomainTestUtils.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/vpp/facade/v3po/vpp/BridgeDomainTestUtils.java index 6930493b6..51a6b023e 100644 --- a/v3po/impl/src/test/java/io/fd/honeycomb/v3po/impl/vpp/BridgeDomainTestUtils.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/vpp/facade/v3po/vpp/BridgeDomainTestUtils.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.fd.honeycomb.v3po.impl.vpp; +package io.fd.honeycomb.v3po.vpp.facade.v3po.vpp; import javax.annotation.Nullable; import org.mockito.invocation.InvocationOnMock; diff --git a/v3po/impl/src/test/java/io/fd/honeycomb/v3po/impl/vpp/VppTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/vpp/facade/v3po/vpp/VppTest.java index c9533a0e7..bc5bda383 100644 --- a/v3po/impl/src/test/java/io/fd/honeycomb/v3po/impl/vpp/VppTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/vpp/facade/v3po/vpp/VppTest.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package io.fd.honeycomb.v3po.impl.vpp; +package io.fd.honeycomb.v3po.vpp.facade.v3po.vpp; -import static io.fd.honeycomb.v3po.impl.vpp.BridgeDomainTestUtils.BD_NAME_TO_ID_ANSWER; +import static io.fd.honeycomb.v3po.vpp.facade.v3po.vpp.BridgeDomainTestUtils.BD_NAME_TO_ID_ANSWER; import static org.mockito.Matchers.anyInt; import static org.mockito.Matchers.anyString; import static org.mockito.Mockito.mock; @@ -25,10 +25,10 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyZeroInteractions; import com.google.common.collect.Lists; -import io.fd.honeycomb.v3po.impl.trans.w.VppWriter; -import io.fd.honeycomb.v3po.impl.trans.w.WriteContext; -import io.fd.honeycomb.v3po.impl.trans.w.impl.CompositeRootVppWriter; -import io.fd.honeycomb.v3po.impl.trans.w.util.DelegatingWriterRegistry; +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.write.VppWriter; +import io.fd.honeycomb.v3po.vpp.facade.write.WriteContext; import java.util.Collections; import java.util.List; import org.junit.Before; diff --git a/v3po/impl/src/test/java/io/fd/honeycomb/v3po/impl/vpp/VppUtils.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/vpp/facade/v3po/vpp/VppUtils.java index d73a8732c..ccf19c81c 100644 --- a/v3po/impl/src/test/java/io/fd/honeycomb/v3po/impl/vpp/VppUtils.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/vpp/facade/v3po/vpp/VppUtils.java @@ -14,15 +14,15 @@ * limitations under the License. */ -package io.fd.honeycomb.v3po.impl.vpp; - -import io.fd.honeycomb.v3po.impl.trans.util.VppRWUtils; -import io.fd.honeycomb.v3po.impl.trans.w.ChildVppWriter; -import io.fd.honeycomb.v3po.impl.trans.w.impl.CompositeChildVppWriter; -import io.fd.honeycomb.v3po.impl.trans.w.impl.CompositeListVppWriter; -import io.fd.honeycomb.v3po.impl.trans.w.impl.CompositeRootVppWriter; -import io.fd.honeycomb.v3po.impl.trans.w.util.NoopWriterCustomizer; -import io.fd.honeycomb.v3po.impl.trans.w.util.ReflexiveChildWriterCustomizer; +package io.fd.honeycomb.v3po.vpp.facade.v3po.vpp; + +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.NoopWriterCustomizer; +import io.fd.honeycomb.v3po.vpp.facade.impl.write.util.ReflexiveChildWriterCustomizer; +import io.fd.honeycomb.v3po.vpp.facade.write.ChildVppWriter; import java.util.ArrayList; import java.util.List; import javax.annotation.Nonnull; @@ -44,7 +44,7 @@ final class VppUtils { final CompositeListVppWriter<BridgeDomain, BridgeDomainKey> bridgeDomainWriter = new CompositeListVppWriter<>( BridgeDomain.class, - new io.fd.honeycomb.v3po.impl.vpp.BridgeDomainCustomizer(vppApi)); + new BridgeDomainCustomizer(vppApi)); final ChildVppWriter<BridgeDomains> bridgeDomainsReader = new CompositeChildVppWriter<>( BridgeDomains.class, diff --git a/v3po/impl/src/test/java/io/fd/honeycomb/v3po/impl/vppstate/VppStateTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/vpp/facade/v3po/vppstate/VppStateTest.java index 5cb678e3a..059c98f56 100644 --- a/v3po/impl/src/test/java/io/fd/honeycomb/v3po/impl/vppstate/VppStateTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/vpp/facade/v3po/vppstate/VppStateTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.fd.honeycomb.v3po.impl.vppstate; +package io.fd.honeycomb.v3po.vpp.facade.v3po.vppstate; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -26,11 +26,11 @@ import com.google.common.base.Optional; import com.google.common.base.Predicate; import com.google.common.collect.Iterables; import com.google.common.collect.Multimap; -import io.fd.honeycomb.v3po.impl.trans.r.ReadContext; -import io.fd.honeycomb.v3po.impl.trans.r.VppReader; -import io.fd.honeycomb.v3po.impl.trans.r.impl.CompositeListVppReader; -import io.fd.honeycomb.v3po.impl.trans.r.impl.CompositeRootVppReader; -import io.fd.honeycomb.v3po.impl.trans.r.util.DelegatingReaderRegistry; +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.read.ReadContext; +import io.fd.honeycomb.v3po.vpp.facade.read.VppReader; import java.util.Collections; import java.util.List; import org.junit.Before; diff --git a/v3po/impl/src/test/java/io/fd/honeycomb/v3po/impl/vppstate/VppStateUtils.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/vpp/facade/v3po/vppstate/VppStateUtils.java index 73113174c..7d5441769 100644 --- a/v3po/impl/src/test/java/io/fd/honeycomb/v3po/impl/vppstate/VppStateUtils.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/vpp/facade/v3po/vppstate/VppStateUtils.java @@ -14,15 +14,15 @@ * limitations under the License. */ -package io.fd.honeycomb.v3po.impl.vppstate; +package io.fd.honeycomb.v3po.vpp.facade.v3po.vppstate; -import io.fd.honeycomb.v3po.impl.trans.r.ChildVppReader; -import io.fd.honeycomb.v3po.impl.trans.r.impl.CompositeChildVppReader; -import io.fd.honeycomb.v3po.impl.trans.r.impl.CompositeListVppReader; -import io.fd.honeycomb.v3po.impl.trans.r.impl.CompositeRootVppReader; -import io.fd.honeycomb.v3po.impl.trans.r.util.ReflexiveChildReaderCustomizer; -import io.fd.honeycomb.v3po.impl.trans.r.util.ReflexiveRootReaderCustomizer; -import io.fd.honeycomb.v3po.impl.trans.util.VppRWUtils; +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.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 java.util.ArrayList; import java.util.List; import javax.annotation.Nonnull; diff --git a/v3po/vpp-facade-api/pom.xml b/v3po/vpp-facade-api/pom.xml new file mode 100644 index 000000000..0406f1e80 --- /dev/null +++ b/v3po/vpp-facade-api/pom.xml @@ -0,0 +1,73 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright (c) 2015 Cisco and/or its affiliates. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <groupId>io.fd.honeycomb.common</groupId> + <artifactId>api-parent</artifactId> + <version>1.0.0-SNAPSHOT</version> + <relativePath>../../common/api-parent</relativePath> + </parent> + + <modelVersion>4.0.0</modelVersion> + <groupId>io.fd.honeycomb.v3po</groupId> + <artifactId>vpp-facade-api</artifactId> + <version>1.0.0-SNAPSHOT</version> + <packaging>bundle</packaging> + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.opendaylight.mdsal</groupId> + <artifactId>mdsal-artifacts</artifactId> + <version>2.0.0-Beryllium</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + + <dependencies> + <dependency> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> + </dependency> + <dependency> + <groupId>org.opendaylight.mdsal</groupId> + <artifactId>mdsal-binding-api</artifactId> + </dependency> + + <!-- Testing Dependencies --> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>v3po-api</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-all</artifactId> + <scope>test</scope> + </dependency> + + </dependencies> + +</project> diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/util/Context.java b/v3po/vpp-facade-api/src/main/java/io/fd/honeycomb/v3po/vpp/facade/Context.java index 089d22957..16808db1f 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/util/Context.java +++ b/v3po/vpp-facade-api/src/main/java/io/fd/honeycomb/v3po/vpp/facade/Context.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.fd.honeycomb.v3po.impl.trans.util; +package io.fd.honeycomb.v3po.vpp.facade; import com.google.common.collect.Maps; import java.util.HashMap; diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/SubtreeManager.java b/v3po/vpp-facade-api/src/main/java/io/fd/honeycomb/v3po/vpp/facade/SubtreeManager.java index 0aa927cd0..28eee203b 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/SubtreeManager.java +++ b/v3po/vpp-facade-api/src/main/java/io/fd/honeycomb/v3po/vpp/facade/SubtreeManager.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.fd.honeycomb.v3po.impl.trans; +package io.fd.honeycomb.v3po.vpp.facade; import com.google.common.annotations.Beta; import javax.annotation.Nonnull; diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/VppApiInvocationException.java b/v3po/vpp-facade-api/src/main/java/io/fd/honeycomb/v3po/vpp/facade/VppApiInvocationException.java index 042c627ef..ac1d7f7db 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/VppApiInvocationException.java +++ b/v3po/vpp-facade-api/src/main/java/io/fd/honeycomb/v3po/vpp/facade/VppApiInvocationException.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.fd.honeycomb.v3po.impl.trans; +package io.fd.honeycomb.v3po.vpp.facade; import com.google.common.annotations.Beta; import com.google.common.base.Preconditions; diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/VppException.java b/v3po/vpp-facade-api/src/main/java/io/fd/honeycomb/v3po/vpp/facade/VppException.java index aadeaa996..ff6101bb8 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/VppException.java +++ b/v3po/vpp-facade-api/src/main/java/io/fd/honeycomb/v3po/vpp/facade/VppException.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.fd.honeycomb.v3po.impl.trans; +package io.fd.honeycomb.v3po.vpp.facade; import com.google.common.annotations.Beta; diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/r/ChildVppReader.java b/v3po/vpp-facade-api/src/main/java/io/fd/honeycomb/v3po/vpp/facade/read/ChildVppReader.java index 8135e8cd2..1608db4b2 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/r/ChildVppReader.java +++ b/v3po/vpp-facade-api/src/main/java/io/fd/honeycomb/v3po/vpp/facade/read/ChildVppReader.java @@ -14,10 +14,9 @@ * limitations under the License. */ -package io.fd.honeycomb.v3po.impl.trans.r; +package io.fd.honeycomb.v3po.vpp.facade.read; import com.google.common.annotations.Beta; -import io.fd.honeycomb.v3po.impl.trans.ReadFailedException; import javax.annotation.Nonnull; import org.opendaylight.yangtools.concepts.Builder; import org.opendaylight.yangtools.yang.binding.DataObject; diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/r/ListVppReader.java b/v3po/vpp-facade-api/src/main/java/io/fd/honeycomb/v3po/vpp/facade/read/ListVppReader.java index e37c76634..950014574 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/r/ListVppReader.java +++ b/v3po/vpp-facade-api/src/main/java/io/fd/honeycomb/v3po/vpp/facade/read/ListVppReader.java @@ -14,10 +14,9 @@ * limitations under the License. */ -package io.fd.honeycomb.v3po.impl.trans.r; +package io.fd.honeycomb.v3po.vpp.facade.read; import com.google.common.annotations.Beta; -import io.fd.honeycomb.v3po.impl.trans.ReadFailedException; import java.util.List; import javax.annotation.Nonnull; import org.opendaylight.yangtools.yang.binding.DataObject; diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/r/ReadContext.java b/v3po/vpp-facade-api/src/main/java/io/fd/honeycomb/v3po/vpp/facade/read/ReadContext.java index 6aa64b3b9..527888ab1 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/r/ReadContext.java +++ b/v3po/vpp-facade-api/src/main/java/io/fd/honeycomb/v3po/vpp/facade/read/ReadContext.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package io.fd.honeycomb.v3po.impl.trans.r; +package io.fd.honeycomb.v3po.vpp.facade.read; -import io.fd.honeycomb.v3po.impl.trans.util.Context; +import io.fd.honeycomb.v3po.vpp.facade.Context; import javax.annotation.Nonnull; /** diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/ReadFailedException.java b/v3po/vpp-facade-api/src/main/java/io/fd/honeycomb/v3po/vpp/facade/read/ReadFailedException.java index 4da8b0e73..3e87b925b 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/ReadFailedException.java +++ b/v3po/vpp-facade-api/src/main/java/io/fd/honeycomb/v3po/vpp/facade/read/ReadFailedException.java @@ -14,10 +14,11 @@ * limitations under the License. */ -package io.fd.honeycomb.v3po.impl.trans; +package io.fd.honeycomb.v3po.vpp.facade.read; import static com.google.common.base.Preconditions.checkNotNull; +import io.fd.honeycomb.v3po.vpp.facade.VppException; import javax.annotation.Nonnull; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/r/ReaderRegistry.java b/v3po/vpp-facade-api/src/main/java/io/fd/honeycomb/v3po/vpp/facade/read/ReaderRegistry.java index a1175533b..2bd51254f 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/r/ReaderRegistry.java +++ b/v3po/vpp-facade-api/src/main/java/io/fd/honeycomb/v3po/vpp/facade/read/ReaderRegistry.java @@ -14,11 +14,10 @@ * limitations under the License. */ -package io.fd.honeycomb.v3po.impl.trans.r; +package io.fd.honeycomb.v3po.vpp.facade.read; import com.google.common.annotations.Beta; import com.google.common.collect.Multimap; -import io.fd.honeycomb.v3po.impl.trans.ReadFailedException; import javax.annotation.Nonnull; import org.opendaylight.yangtools.yang.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/r/VppReader.java b/v3po/vpp-facade-api/src/main/java/io/fd/honeycomb/v3po/vpp/facade/read/VppReader.java index ff42b57f0..6eea594b4 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/r/VppReader.java +++ b/v3po/vpp-facade-api/src/main/java/io/fd/honeycomb/v3po/vpp/facade/read/VppReader.java @@ -14,12 +14,11 @@ * limitations under the License. */ -package io.fd.honeycomb.v3po.impl.trans.r; +package io.fd.honeycomb.v3po.vpp.facade.read; import com.google.common.annotations.Beta; import com.google.common.base.Optional; -import io.fd.honeycomb.v3po.impl.trans.ReadFailedException; -import io.fd.honeycomb.v3po.impl.trans.SubtreeManager; +import io.fd.honeycomb.v3po.vpp.facade.SubtreeManager; import javax.annotation.Nonnull; import org.opendaylight.yangtools.yang.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/w/ChildVppWriter.java b/v3po/vpp-facade-api/src/main/java/io/fd/honeycomb/v3po/vpp/facade/write/ChildVppWriter.java index 243a6528d..017f5d9aa 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/w/ChildVppWriter.java +++ b/v3po/vpp-facade-api/src/main/java/io/fd/honeycomb/v3po/vpp/facade/write/ChildVppWriter.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.fd.honeycomb.v3po.impl.trans.w; +package io.fd.honeycomb.v3po.vpp.facade.write; import com.google.common.annotations.Beta; import javax.annotation.Nonnull; diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/w/VppWriter.java b/v3po/vpp-facade-api/src/main/java/io/fd/honeycomb/v3po/vpp/facade/write/VppWriter.java index d338fafa2..83f600f5b 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/w/VppWriter.java +++ b/v3po/vpp-facade-api/src/main/java/io/fd/honeycomb/v3po/vpp/facade/write/VppWriter.java @@ -14,11 +14,11 @@ * limitations under the License. */ -package io.fd.honeycomb.v3po.impl.trans.w; +package io.fd.honeycomb.v3po.vpp.facade.write; import com.google.common.annotations.Beta; -import io.fd.honeycomb.v3po.impl.trans.SubtreeManager; -import io.fd.honeycomb.v3po.impl.trans.VppException; +import io.fd.honeycomb.v3po.vpp.facade.SubtreeManager; +import io.fd.honeycomb.v3po.vpp.facade.VppException; import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opendaylight.yangtools.yang.binding.DataObject; diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/w/WriteContext.java b/v3po/vpp-facade-api/src/main/java/io/fd/honeycomb/v3po/vpp/facade/write/WriteContext.java index 191fdf857..ffc9f20f7 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/w/WriteContext.java +++ b/v3po/vpp-facade-api/src/main/java/io/fd/honeycomb/v3po/vpp/facade/write/WriteContext.java @@ -14,11 +14,11 @@ * limitations under the License. */ -package io.fd.honeycomb.v3po.impl.trans.w; +package io.fd.honeycomb.v3po.vpp.facade.write; import com.google.common.annotations.Beta; import com.google.common.base.Optional; -import io.fd.honeycomb.v3po.impl.trans.util.Context; +import io.fd.honeycomb.v3po.vpp.facade.Context; import javax.annotation.Nonnull; import org.opendaylight.yangtools.yang.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/w/WriterRegistry.java b/v3po/vpp-facade-api/src/main/java/io/fd/honeycomb/v3po/vpp/facade/write/WriterRegistry.java index 26c294b30..0d3c17451 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/w/WriterRegistry.java +++ b/v3po/vpp-facade-api/src/main/java/io/fd/honeycomb/v3po/vpp/facade/write/WriterRegistry.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package io.fd.honeycomb.v3po.impl.trans.w; +package io.fd.honeycomb.v3po.vpp.facade.write; import static com.google.common.base.Preconditions.checkNotNull; import com.google.common.annotations.Beta; import com.google.common.collect.ImmutableList; -import io.fd.honeycomb.v3po.impl.trans.VppException; +import io.fd.honeycomb.v3po.vpp.facade.VppException; import java.util.List; import java.util.Map; import javax.annotation.Nonnull; diff --git a/v3po/impl/src/test/java/io/fd/honeycomb/v3po/impl/trans/ReadFailedExceptionTest.java b/v3po/vpp-facade-api/src/test/java/io/fd/honeycomb/v3po/vpp/facade/ReadFailedExceptionTest.java index b815434a8..594168df2 100644 --- a/v3po/impl/src/test/java/io/fd/honeycomb/v3po/impl/trans/ReadFailedExceptionTest.java +++ b/v3po/vpp-facade-api/src/test/java/io/fd/honeycomb/v3po/vpp/facade/ReadFailedExceptionTest.java @@ -14,12 +14,10 @@ * limitations under the License. */ -package io.fd.honeycomb.v3po.impl.trans; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +package io.fd.honeycomb.v3po.vpp.facade; +import io.fd.honeycomb.v3po.vpp.facade.read.ReadFailedException; +import org.junit.Assert; import org.junit.Test; 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.bridge.domain.Interface; @@ -31,9 +29,9 @@ public class ReadFailedExceptionTest { public void testInstantiation() { final InstanceIdentifier<BridgeDomain> id = InstanceIdentifier.create(BridgeDomain.class); ReadFailedException e = new ReadFailedException(id); - assertEquals(id, e.getFailedId()); - assertNull(e.getCause()); - assertTrue(e.getMessage().contains(id.toString())); + Assert.assertEquals(id, e.getFailedId()); + Assert.assertNull(e.getCause()); + Assert.assertTrue(e.getMessage().contains(id.toString())); } @Test @@ -41,9 +39,9 @@ public class ReadFailedExceptionTest { final InstanceIdentifier<Interface> id = InstanceIdentifier.create(Interface.class); final RuntimeException cause = new RuntimeException(); ReadFailedException e = new ReadFailedException(id, cause); - assertEquals(id, e.getFailedId()); - assertEquals(cause, e.getCause()); - assertTrue(e.getMessage().contains(id.toString())); + Assert.assertEquals(id, e.getFailedId()); + Assert.assertEquals(cause, e.getCause()); + Assert.assertTrue(e.getMessage().contains(id.toString())); } @Test(expected = NullPointerException.class) diff --git a/v3po/impl/src/test/java/io/fd/honeycomb/v3po/impl/trans/VppApiInvocationExceptionTest.java b/v3po/vpp-facade-api/src/test/java/io/fd/honeycomb/v3po/vpp/facade/VppApiInvocationExceptionTest.java index fed792a3b..a3a37c192 100644 --- a/v3po/impl/src/test/java/io/fd/honeycomb/v3po/impl/trans/VppApiInvocationExceptionTest.java +++ b/v3po/vpp-facade-api/src/test/java/io/fd/honeycomb/v3po/vpp/facade/VppApiInvocationExceptionTest.java @@ -14,12 +14,10 @@ * limitations under the License. */ -package io.fd.honeycomb.v3po.impl.trans; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +package io.fd.honeycomb.v3po.vpp.facade; import java.util.Random; +import org.junit.Assert; import org.junit.Test; public class VppApiInvocationExceptionTest { @@ -30,12 +28,12 @@ public class VppApiInvocationExceptionTest { final int ctxId = 1; final int code = -1; VppApiInvocationException e = new VppApiInvocationException(apiMethodName, ctxId, code); - assertEquals(apiMethodName, e.getMethodName()); - assertEquals(ctxId, e.getCtxId()); - assertEquals(code, e.getErrorCode()); - assertTrue(e.getMessage().contains(apiMethodName)); - assertTrue(e.getMessage().contains(String.valueOf(code))); - assertTrue(e.getMessage().contains(String.valueOf(ctxId))); + Assert.assertEquals(apiMethodName, e.getMethodName()); + Assert.assertEquals(ctxId, e.getCtxId()); + Assert.assertEquals(code, e.getErrorCode()); + Assert.assertTrue(e.getMessage().contains(apiMethodName)); + Assert.assertTrue(e.getMessage().contains(String.valueOf(code))); + Assert.assertTrue(e.getMessage().contains(String.valueOf(ctxId))); } @Test(expected = IllegalArgumentException.class) diff --git a/v3po/vpp-facade-impl/pom.xml b/v3po/vpp-facade-impl/pom.xml new file mode 100644 index 000000000..fff69c2b7 --- /dev/null +++ b/v3po/vpp-facade-impl/pom.xml @@ -0,0 +1,88 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright (c) 2015 Cisco and/or its affiliates. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <groupId>io.fd.honeycomb.common</groupId> + <artifactId>api-parent</artifactId> + <version>1.0.0-SNAPSHOT</version> + <relativePath>../../common/api-parent</relativePath> + </parent> + + <modelVersion>4.0.0</modelVersion> + <groupId>io.fd.honeycomb.v3po</groupId> + <artifactId>vpp-facade-impl</artifactId> + <version>1.0.0-SNAPSHOT</version> + <packaging>bundle</packaging> + + <dependencies> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>vpp-facade-api</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>vpp-facade-spi</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>vpp-facade-utils</artifactId> + <version>${project.version}</version> + </dependency> + + <!-- Testing Dependencies --> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>v3po-api</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-all</artifactId> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <artifactId>maven-jar-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <Bundle-Name>${project.groupId}.${project.artifactId}</Bundle-Name> + <Export-Package> + io.fd.honeycomb.v3po.vpp.facade.impl.* + </Export-Package> + </instructions> + </configuration> + </plugin> + </plugins> + </build> + +</project> diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/r/impl/AbstractCompositeVppReader.java b/v3po/vpp-facade-impl/src/main/java/io/fd/honeycomb/v3po/vpp/facade/impl/read/AbstractCompositeVppReader.java index 436aace84..2856937ba 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/r/impl/AbstractCompositeVppReader.java +++ b/v3po/vpp-facade-impl/src/main/java/io/fd/honeycomb/v3po/vpp/facade/impl/read/AbstractCompositeVppReader.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.fd.honeycomb.v3po.impl.trans.r.impl; +package io.fd.honeycomb.v3po.vpp.facade.impl.read; import static com.google.common.base.Preconditions.checkArgument; @@ -22,12 +22,12 @@ import com.google.common.annotations.Beta; import com.google.common.base.Optional; import com.google.common.base.Predicate; import com.google.common.collect.Iterables; -import io.fd.honeycomb.v3po.impl.trans.ReadFailedException; -import io.fd.honeycomb.v3po.impl.trans.r.ChildVppReader; -import io.fd.honeycomb.v3po.impl.trans.r.ReadContext; -import io.fd.honeycomb.v3po.impl.trans.r.VppReader; -import io.fd.honeycomb.v3po.impl.trans.util.ReflectionUtils; -import io.fd.honeycomb.v3po.impl.trans.util.VppRWUtils; +import io.fd.honeycomb.v3po.vpp.facade.impl.util.ReflectionUtils; +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.VppReader; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Collections; @@ -72,8 +72,7 @@ abstract class AbstractCompositeVppReader<D extends DataObject, B extends Builde * */ protected Optional<D> readCurrent(final InstanceIdentifier<D> id, - @Nonnull final ReadContext ctx) throws - ReadFailedException { + @Nonnull final ReadContext ctx) throws ReadFailedException { LOG.debug("{}: Reading current: {}", this, id); final B builder = getBuilder(id); // Cache empty value to determine if anything has changed later TODO cache in a field diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/r/impl/CompositeChildVppReader.java b/v3po/vpp-facade-impl/src/main/java/io/fd/honeycomb/v3po/vpp/facade/impl/read/CompositeChildVppReader.java index e6872d131..76e793dbe 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/r/impl/CompositeChildVppReader.java +++ b/v3po/vpp-facade-impl/src/main/java/io/fd/honeycomb/v3po/vpp/facade/impl/read/CompositeChildVppReader.java @@ -14,15 +14,15 @@ * limitations under the License. */ -package io.fd.honeycomb.v3po.impl.trans.r.impl; +package io.fd.honeycomb.v3po.vpp.facade.impl.read; import com.google.common.annotations.Beta; import com.google.common.base.Optional; -import io.fd.honeycomb.v3po.impl.trans.ReadFailedException; -import io.fd.honeycomb.v3po.impl.trans.r.ChildVppReader; -import io.fd.honeycomb.v3po.impl.trans.r.ReadContext; -import io.fd.honeycomb.v3po.impl.trans.r.impl.spi.ChildVppReaderCustomizer; -import io.fd.honeycomb.v3po.impl.trans.util.VppRWUtils; +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.spi.read.ChildVppReaderCustomizer; import java.util.List; import javax.annotation.Nonnull; import javax.annotation.concurrent.ThreadSafe; diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/r/impl/CompositeListVppReader.java b/v3po/vpp-facade-impl/src/main/java/io/fd/honeycomb/v3po/vpp/facade/impl/read/CompositeListVppReader.java index 9d7ad3446..fcfa8b428 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/r/impl/CompositeListVppReader.java +++ b/v3po/vpp-facade-impl/src/main/java/io/fd/honeycomb/v3po/vpp/facade/impl/read/CompositeListVppReader.java @@ -14,18 +14,18 @@ * limitations under the License. */ -package io.fd.honeycomb.v3po.impl.trans.r.impl; +package io.fd.honeycomb.v3po.vpp.facade.impl.read; import static com.google.common.base.Preconditions.checkArgument; import com.google.common.annotations.Beta; import com.google.common.base.Optional; -import io.fd.honeycomb.v3po.impl.trans.ReadFailedException; -import io.fd.honeycomb.v3po.impl.trans.r.ChildVppReader; -import io.fd.honeycomb.v3po.impl.trans.r.ListVppReader; -import io.fd.honeycomb.v3po.impl.trans.r.ReadContext; -import io.fd.honeycomb.v3po.impl.trans.r.impl.spi.ListVppReaderCustomizer; -import io.fd.honeycomb.v3po.impl.trans.util.VppRWUtils; +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.ListVppReader; +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.spi.read.ListVppReaderCustomizer; import java.util.ArrayList; import java.util.List; import javax.annotation.Nonnull; @@ -41,7 +41,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * Composite implementation of {@link ChildVppReader} able to place the read result into parent builder object intended + * Composite implementation of {@link io.fd.honeycomb.v3po.vpp.facade.read.ChildVppReader} able to place the read result into parent builder object intended * for list node type. * * This reader checks if the IDs are wildcarded in which case it performs read of all list entries. In case the ID has a diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/r/impl/CompositeRootVppReader.java b/v3po/vpp-facade-impl/src/main/java/io/fd/honeycomb/v3po/vpp/facade/impl/read/CompositeRootVppReader.java index 34d4dce74..95f2a8eec 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/r/impl/CompositeRootVppReader.java +++ b/v3po/vpp-facade-impl/src/main/java/io/fd/honeycomb/v3po/vpp/facade/impl/read/CompositeRootVppReader.java @@ -14,15 +14,15 @@ * limitations under the License. */ -package io.fd.honeycomb.v3po.impl.trans.r.impl; +package io.fd.honeycomb.v3po.vpp.facade.impl.read; import com.google.common.annotations.Beta; -import io.fd.honeycomb.v3po.impl.trans.ReadFailedException; -import io.fd.honeycomb.v3po.impl.trans.r.ChildVppReader; -import io.fd.honeycomb.v3po.impl.trans.r.ReadContext; -import io.fd.honeycomb.v3po.impl.trans.r.VppReader; -import io.fd.honeycomb.v3po.impl.trans.r.impl.spi.RootVppReaderCustomizer; -import io.fd.honeycomb.v3po.impl.trans.util.VppRWUtils; +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.VppReader; +import io.fd.honeycomb.v3po.vpp.facade.spi.read.RootVppReaderCustomizer; import java.util.List; import javax.annotation.Nonnull; import javax.annotation.concurrent.ThreadSafe; @@ -33,7 +33,7 @@ import org.opendaylight.yangtools.yang.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; /** - * Composite implementation of {@link VppReader} + * Composite implementation of {@link io.fd.honeycomb.v3po.vpp.facade.read.VppReader} */ @Beta @ThreadSafe @@ -79,8 +79,7 @@ public final class CompositeRootVppReader<C extends DataObject, B extends Builde @Override protected void readCurrentAttributes(@Nonnull final InstanceIdentifier<C> id, @Nonnull final B builder, - @Nonnull final ReadContext ctx) - throws ReadFailedException { + @Nonnull final ReadContext ctx) throws ReadFailedException { customizer.readCurrentAttributes(id, builder, ctx.getContext()); } diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/w/impl/AbstractCompositeVppWriter.java b/v3po/vpp-facade-impl/src/main/java/io/fd/honeycomb/v3po/vpp/facade/impl/write/AbstractCompositeVppWriter.java index 6e8f8bc85..add62e2ba 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/w/impl/AbstractCompositeVppWriter.java +++ b/v3po/vpp-facade-impl/src/main/java/io/fd/honeycomb/v3po/vpp/facade/impl/write/AbstractCompositeVppWriter.java @@ -14,17 +14,17 @@ * limitations under the License. */ -package io.fd.honeycomb.v3po.impl.trans.w.impl; +package io.fd.honeycomb.v3po.vpp.facade.impl.write; import static com.google.common.base.Preconditions.checkArgument; import com.google.common.base.Optional; import com.google.common.collect.Lists; -import io.fd.honeycomb.v3po.impl.trans.VppException; -import io.fd.honeycomb.v3po.impl.trans.util.VppRWUtils; -import io.fd.honeycomb.v3po.impl.trans.w.ChildVppWriter; -import io.fd.honeycomb.v3po.impl.trans.w.VppWriter; -import io.fd.honeycomb.v3po.impl.trans.w.WriteContext; +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.write.ChildVppWriter; +import io.fd.honeycomb.v3po.vpp.facade.write.VppWriter; +import io.fd.honeycomb.v3po.vpp.facade.write.WriteContext; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/w/impl/CompositeChildVppWriter.java b/v3po/vpp-facade-impl/src/main/java/io/fd/honeycomb/v3po/vpp/facade/impl/write/CompositeChildVppWriter.java index d94e4fedf..a11004e86 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/w/impl/CompositeChildVppWriter.java +++ b/v3po/vpp-facade-impl/src/main/java/io/fd/honeycomb/v3po/vpp/facade/impl/write/CompositeChildVppWriter.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package io.fd.honeycomb.v3po.impl.trans.w.impl; +package io.fd.honeycomb.v3po.vpp.facade.impl.write; import com.google.common.base.Optional; -import io.fd.honeycomb.v3po.impl.trans.util.VppRWUtils; -import io.fd.honeycomb.v3po.impl.trans.w.ChildVppWriter; -import io.fd.honeycomb.v3po.impl.trans.w.WriteContext; -import io.fd.honeycomb.v3po.impl.trans.w.impl.spi.ChildVppWriterCustomizer; +import io.fd.honeycomb.v3po.vpp.facade.impl.util.VppRWUtils; +import io.fd.honeycomb.v3po.vpp.facade.spi.write.ChildVppWriterCustomizer; +import io.fd.honeycomb.v3po.vpp.facade.write.ChildVppWriter; +import io.fd.honeycomb.v3po.vpp.facade.write.WriteContext; import java.util.List; import javax.annotation.Nonnull; import org.opendaylight.yangtools.yang.binding.Augmentation; diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/w/impl/CompositeListVppWriter.java b/v3po/vpp-facade-impl/src/main/java/io/fd/honeycomb/v3po/vpp/facade/impl/write/CompositeListVppWriter.java index 1722b4652..805d951f9 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/w/impl/CompositeListVppWriter.java +++ b/v3po/vpp-facade-impl/src/main/java/io/fd/honeycomb/v3po/vpp/facade/impl/write/CompositeListVppWriter.java @@ -14,16 +14,16 @@ * limitations under the License. */ -package io.fd.honeycomb.v3po.impl.trans.w.impl; +package io.fd.honeycomb.v3po.vpp.facade.impl.write; import com.google.common.base.Function; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Maps; import com.google.common.collect.Sets; -import io.fd.honeycomb.v3po.impl.trans.util.VppRWUtils; -import io.fd.honeycomb.v3po.impl.trans.w.ChildVppWriter; -import io.fd.honeycomb.v3po.impl.trans.w.WriteContext; -import io.fd.honeycomb.v3po.impl.trans.w.impl.spi.ListVppWriterCustomizer; +import io.fd.honeycomb.v3po.vpp.facade.impl.util.VppRWUtils; +import io.fd.honeycomb.v3po.vpp.facade.spi.write.ListVppWriterCustomizer; +import io.fd.honeycomb.v3po.vpp.facade.write.ChildVppWriter; +import io.fd.honeycomb.v3po.vpp.facade.write.WriteContext; import java.util.List; import java.util.Map; import javax.annotation.Nonnull; diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/w/impl/CompositeRootVppWriter.java b/v3po/vpp-facade-impl/src/main/java/io/fd/honeycomb/v3po/vpp/facade/impl/write/CompositeRootVppWriter.java index a7139e57a..7bcb8dbbb 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/w/impl/CompositeRootVppWriter.java +++ b/v3po/vpp-facade-impl/src/main/java/io/fd/honeycomb/v3po/vpp/facade/impl/write/CompositeRootVppWriter.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.fd.honeycomb.v3po.impl.trans.w.impl; +package io.fd.honeycomb.v3po.vpp.facade.impl.write; -import io.fd.honeycomb.v3po.impl.trans.util.VppRWUtils; -import io.fd.honeycomb.v3po.impl.trans.w.ChildVppWriter; -import io.fd.honeycomb.v3po.impl.trans.w.WriteContext; -import io.fd.honeycomb.v3po.impl.trans.w.impl.spi.RootVppWriterCustomizer; +import io.fd.honeycomb.v3po.vpp.facade.impl.util.VppRWUtils; +import io.fd.honeycomb.v3po.vpp.facade.spi.write.RootVppWriterCustomizer; +import io.fd.honeycomb.v3po.vpp.facade.write.ChildVppWriter; +import io.fd.honeycomb.v3po.vpp.facade.write.WriteContext; import java.util.List; import javax.annotation.Nonnull; import org.opendaylight.yangtools.yang.binding.Augmentation; diff --git a/v3po/impl/src/test/java/io/fd/honeycomb/v3po/impl/trans/w/util/DelegatingWriterRegistryTest.java b/v3po/vpp-facade-impl/src/test/java/io/fd/honeycomb/v3po/vpp/facade/impl/write/util/DelegatingWriterRegistryTest.java index 26f63f40f..6730cfe26 100644 --- a/v3po/impl/src/test/java/io/fd/honeycomb/v3po/impl/trans/w/util/DelegatingWriterRegistryTest.java +++ b/v3po/vpp-facade-impl/src/test/java/io/fd/honeycomb/v3po/vpp/facade/impl/write/util/DelegatingWriterRegistryTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.fd.honeycomb.v3po.impl.trans.w.util; +package io.fd.honeycomb.v3po.vpp.facade.impl.write.util; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; @@ -24,11 +24,11 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; -import io.fd.honeycomb.v3po.impl.trans.VppException; -import io.fd.honeycomb.v3po.impl.trans.w.VppWriter; -import io.fd.honeycomb.v3po.impl.trans.w.WriteContext; -import io.fd.honeycomb.v3po.impl.trans.w.WriterRegistry; -import io.fd.honeycomb.v3po.impl.trans.w.impl.CompositeRootVppWriter; +import io.fd.honeycomb.v3po.vpp.facade.VppException; +import io.fd.honeycomb.v3po.vpp.facade.impl.write.CompositeRootVppWriter; +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 java.util.ArrayList; import java.util.Collections; import java.util.HashMap; diff --git a/v3po/impl/src/test/java/io/fd/honeycomb/v3po/impl/trans/w/util/TransactionWriteContextTest.java b/v3po/vpp-facade-impl/src/test/java/io/fd/honeycomb/v3po/vpp/facade/impl/write/util/TransactionWriteContextTest.java index 0f906d20c..0e46e2fa4 100644 --- a/v3po/impl/src/test/java/io/fd/honeycomb/v3po/impl/trans/w/util/TransactionWriteContextTest.java +++ b/v3po/vpp-facade-impl/src/test/java/io/fd/honeycomb/v3po/vpp/facade/impl/write/util/TransactionWriteContextTest.java @@ -1,4 +1,20 @@ -package io.fd.honeycomb.v3po.impl.trans.w.util; +/* + * Copyright (c) 2016 Cisco and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.fd.honeycomb.v3po.vpp.facade.impl.write.util; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; @@ -13,7 +29,7 @@ import static org.mockito.MockitoAnnotations.initMocks; import com.google.common.base.Optional; import com.google.common.util.concurrent.CheckedFuture; -import io.fd.honeycomb.v3po.impl.trans.util.Context; +import io.fd.honeycomb.v3po.vpp.facade.Context; import java.util.Map; import org.junit.Before; import org.junit.Test; diff --git a/v3po/vpp-facade-spi/pom.xml b/v3po/vpp-facade-spi/pom.xml new file mode 100644 index 000000000..87f9c2848 --- /dev/null +++ b/v3po/vpp-facade-spi/pom.xml @@ -0,0 +1,72 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright (c) 2015 Cisco and/or its affiliates. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <groupId>io.fd.honeycomb.common</groupId> + <artifactId>api-parent</artifactId> + <version>1.0.0-SNAPSHOT</version> + <relativePath>../../common/api-parent</relativePath> + </parent> + + <modelVersion>4.0.0</modelVersion> + <groupId>io.fd.honeycomb.v3po</groupId> + <artifactId>vpp-facade-spi</artifactId> + <version>1.0.0-SNAPSHOT</version> + <packaging>bundle</packaging> + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.opendaylight.mdsal</groupId> + <artifactId>mdsal-artifacts</artifactId> + <version>2.0.0-Beryllium</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + + <dependencies> + <dependency> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>vpp-facade-api</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.opendaylight.mdsal</groupId> + <artifactId>mdsal-binding-api</artifactId> + </dependency> + + <!-- Testing Dependencies --> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-all</artifactId> + <scope>test</scope> + </dependency> + + </dependencies> + +</project> diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/r/impl/spi/ChildVppReaderCustomizer.java b/v3po/vpp-facade-spi/src/main/java/io/fd/honeycomb/v3po/vpp/facade/spi/read/ChildVppReaderCustomizer.java index 900f8f8c6..376474301 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/r/impl/spi/ChildVppReaderCustomizer.java +++ b/v3po/vpp-facade-spi/src/main/java/io/fd/honeycomb/v3po/vpp/facade/spi/read/ChildVppReaderCustomizer.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.fd.honeycomb.v3po.impl.trans.r.impl.spi; +package io.fd.honeycomb.v3po.vpp.facade.spi.read; import com.google.common.annotations.Beta; import javax.annotation.Nonnull; @@ -22,7 +22,7 @@ import org.opendaylight.yangtools.concepts.Builder; import org.opendaylight.yangtools.yang.binding.DataObject; /** - * {@link io.fd.honeycomb.v3po.impl.trans.r.impl.CompositeChildVppReader} SPI to customize its behavior + * CompositeChildVppReader SPI to customize its behavior * * @param <C> Specific DataObject derived type (Identifiable), that is handled by this customizer * @param <B> Specific Builder for handled type (C) diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/r/impl/spi/ListVppReaderCustomizer.java b/v3po/vpp-facade-spi/src/main/java/io/fd/honeycomb/v3po/vpp/facade/spi/read/ListVppReaderCustomizer.java index c87050bd6..610b2da8b 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/r/impl/spi/ListVppReaderCustomizer.java +++ b/v3po/vpp-facade-spi/src/main/java/io/fd/honeycomb/v3po/vpp/facade/spi/read/ListVppReaderCustomizer.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.fd.honeycomb.v3po.impl.trans.r.impl.spi; +package io.fd.honeycomb.v3po.vpp.facade.spi.read; import com.google.common.annotations.Beta; -import io.fd.honeycomb.v3po.impl.trans.util.Context; +import io.fd.honeycomb.v3po.vpp.facade.Context; import java.util.List; import javax.annotation.Nonnull; import org.opendaylight.yangtools.concepts.Builder; @@ -27,7 +27,7 @@ import org.opendaylight.yangtools.yang.binding.Identifier; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; /** - * {@link io.fd.honeycomb.v3po.impl.trans.r.impl.CompositeListVppReader} SPI to customize its behavior + * CompositeListVppReader SPI to customize its behavior * * @param <C> Specific DataObject derived type (Identifiable), that is handled by this customizer * @param <K> Specific Identifier for handled type (C) diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/r/impl/spi/RootVppReaderCustomizer.java b/v3po/vpp-facade-spi/src/main/java/io/fd/honeycomb/v3po/vpp/facade/spi/read/RootVppReaderCustomizer.java index b35a1c66c..8035933df 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/r/impl/spi/RootVppReaderCustomizer.java +++ b/v3po/vpp-facade-spi/src/main/java/io/fd/honeycomb/v3po/vpp/facade/spi/read/RootVppReaderCustomizer.java @@ -14,18 +14,18 @@ * limitations under the License. */ -package io.fd.honeycomb.v3po.impl.trans.r.impl.spi; +package io.fd.honeycomb.v3po.vpp.facade.spi.read; import com.google.common.annotations.Beta; -import io.fd.honeycomb.v3po.impl.trans.ReadFailedException; -import io.fd.honeycomb.v3po.impl.trans.util.Context; +import io.fd.honeycomb.v3po.vpp.facade.Context; +import io.fd.honeycomb.v3po.vpp.facade.read.ReadFailedException; import javax.annotation.Nonnull; import org.opendaylight.yangtools.concepts.Builder; import org.opendaylight.yangtools.yang.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; /** - * {@link io.fd.honeycomb.v3po.impl.trans.r.impl.CompositeRootVppReader} SPI to customize its behavior + * CompositeRootVppReader SPI to customize its behavior * * @param <C> Specific DataObject derived type, that is handled by this customizer * @param <B> Specific Builder for handled type (C) diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/w/impl/spi/ChildVppWriterCustomizer.java b/v3po/vpp-facade-spi/src/main/java/io/fd/honeycomb/v3po/vpp/facade/spi/write/ChildVppWriterCustomizer.java index 1e79c6830..7b7e257a2 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/w/impl/spi/ChildVppWriterCustomizer.java +++ b/v3po/vpp-facade-spi/src/main/java/io/fd/honeycomb/v3po/vpp/facade/spi/write/ChildVppWriterCustomizer.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.fd.honeycomb.v3po.impl.trans.w.impl.spi; +package io.fd.honeycomb.v3po.vpp.facade.spi.write; import com.google.common.annotations.Beta; import com.google.common.base.Optional; @@ -23,7 +23,7 @@ import org.opendaylight.yangtools.yang.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; /** - * {@link io.fd.honeycomb.v3po.impl.trans.w.impl.CompositeChildVppWriter} SPI to customize its behavior + * CompositeChildVppWriter SPI to customize its behavior * * @param <D> Specific DataObject derived type (Identifiable), that is handled by this customizer */ diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/w/impl/spi/ListVppWriterCustomizer.java b/v3po/vpp-facade-spi/src/main/java/io/fd/honeycomb/v3po/vpp/facade/spi/write/ListVppWriterCustomizer.java index 6e72fc719..b4bf1aa41 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/w/impl/spi/ListVppWriterCustomizer.java +++ b/v3po/vpp-facade-spi/src/main/java/io/fd/honeycomb/v3po/vpp/facade/spi/write/ListVppWriterCustomizer.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.fd.honeycomb.v3po.impl.trans.w.impl.spi; +package io.fd.honeycomb.v3po.vpp.facade.spi.write; import com.google.common.annotations.Beta; import java.util.List; @@ -25,7 +25,7 @@ import org.opendaylight.yangtools.yang.binding.Identifier; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; /** - * {@link io.fd.honeycomb.v3po.impl.trans.w.impl.CompositeListVppWriter} SPI to customize its behavior + * CompositeListVppWriter SPI to customize its behavior * * @param <C> Specific DataObject derived type (Identifiable), that is handled by this customizer * @param <K> Specific Identifier for handled type (C) diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/w/impl/spi/RootVppWriterCustomizer.java b/v3po/vpp-facade-spi/src/main/java/io/fd/honeycomb/v3po/vpp/facade/spi/write/RootVppWriterCustomizer.java index 0fa89d2af..1335e8afb 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/w/impl/spi/RootVppWriterCustomizer.java +++ b/v3po/vpp-facade-spi/src/main/java/io/fd/honeycomb/v3po/vpp/facade/spi/write/RootVppWriterCustomizer.java @@ -14,16 +14,16 @@ * limitations under the License. */ -package io.fd.honeycomb.v3po.impl.trans.w.impl.spi; +package io.fd.honeycomb.v3po.vpp.facade.spi.write; import com.google.common.annotations.Beta; -import io.fd.honeycomb.v3po.impl.trans.util.Context; +import io.fd.honeycomb.v3po.vpp.facade.Context; import javax.annotation.Nonnull; import org.opendaylight.yangtools.yang.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; /** - * {@link io.fd.honeycomb.v3po.impl.trans.w.impl.CompositeRootVppWriter} SPI to customize its behavior + * CompositeRootVppReader SPI to customize its behavior * * @param <D> Specific DataObject derived type, that is handled by this customizer */ diff --git a/v3po/vpp-facade-utils/pom.xml b/v3po/vpp-facade-utils/pom.xml new file mode 100644 index 000000000..83c7d7415 --- /dev/null +++ b/v3po/vpp-facade-utils/pom.xml @@ -0,0 +1,95 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright (c) 2015 Cisco and/or its affiliates. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <groupId>io.fd.honeycomb.common</groupId> + <artifactId>api-parent</artifactId> + <version>1.0.0-SNAPSHOT</version> + <relativePath>../../common/api-parent</relativePath> + </parent> + + <modelVersion>4.0.0</modelVersion> + <groupId>io.fd.honeycomb.v3po</groupId> + <artifactId>vpp-facade-utils</artifactId> + <version>1.0.0-SNAPSHOT</version> + <packaging>bundle</packaging> + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.opendaylight.mdsal</groupId> + <artifactId>mdsal-artifacts</artifactId> + <version>2.0.0-Beryllium</version> + <type>pom</type> + <scope>import</scope> + </dependency> + <dependency> + <groupId>org.opendaylight.controller</groupId> + <artifactId>mdsal-artifacts</artifactId> + <version>1.3.0-Beryllium</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + + <dependencies> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>vpp-facade-api</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>vpp-facade-spi</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>io.fd.vpp</groupId> + <artifactId>vppjapi</artifactId> + <version>1.0.0-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.opendaylight.controller</groupId> + <artifactId>sal-core-api</artifactId> + </dependency> + <dependency> + <groupId>org.opendaylight.mdsal</groupId> + <artifactId>mdsal-binding-dom-codec</artifactId> + </dependency> + + <!-- Testing Dependencies --> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>v3po-api</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-all</artifactId> + <scope>test</scope> + </dependency> + + </dependencies> + +</project> diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/r/util/DelegatingReaderRegistry.java b/v3po/vpp-facade-utils/src/main/java/io/fd/honeycomb/v3po/vpp/facade/impl/read/util/DelegatingReaderRegistry.java index 51334e6db..5217024e8 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/r/util/DelegatingReaderRegistry.java +++ b/v3po/vpp-facade-utils/src/main/java/io/fd/honeycomb/v3po/vpp/facade/impl/read/util/DelegatingReaderRegistry.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.fd.honeycomb.v3po.impl.trans.r.util; +package io.fd.honeycomb.v3po.vpp.facade.impl.read.util; import static com.google.common.base.Preconditions.checkNotNull; @@ -22,12 +22,12 @@ import com.google.common.base.Optional; import com.google.common.collect.Iterables; import com.google.common.collect.LinkedListMultimap; import com.google.common.collect.Multimap; -import io.fd.honeycomb.v3po.impl.trans.ReadFailedException; -import io.fd.honeycomb.v3po.impl.trans.r.ListVppReader; -import io.fd.honeycomb.v3po.impl.trans.r.ReadContext; -import io.fd.honeycomb.v3po.impl.trans.r.ReaderRegistry; -import io.fd.honeycomb.v3po.impl.trans.r.VppReader; -import io.fd.honeycomb.v3po.impl.trans.util.VppRWUtils; +import io.fd.honeycomb.v3po.vpp.facade.impl.util.VppRWUtils; +import io.fd.honeycomb.v3po.vpp.facade.read.ListVppReader; +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 java.util.Collections; import java.util.List; import java.util.Map; diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/r/util/NoopReaderCustomizer.java b/v3po/vpp-facade-utils/src/main/java/io/fd/honeycomb/v3po/vpp/facade/impl/read/util/NoopReaderCustomizer.java index 657af97f4..5b78cdbba 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/r/util/NoopReaderCustomizer.java +++ b/v3po/vpp-facade-utils/src/main/java/io/fd/honeycomb/v3po/vpp/facade/impl/read/util/NoopReaderCustomizer.java @@ -14,15 +14,16 @@ * limitations under the License. */ -package io.fd.honeycomb.v3po.impl.trans.r.util; +package io.fd.honeycomb.v3po.vpp.facade.impl.read.util; -import io.fd.honeycomb.v3po.impl.trans.r.impl.spi.RootVppReaderCustomizer; -import io.fd.honeycomb.v3po.impl.trans.util.Context; +import io.fd.honeycomb.v3po.vpp.facade.Context; +import io.fd.honeycomb.v3po.vpp.facade.spi.read.RootVppReaderCustomizer; import org.opendaylight.yangtools.concepts.Builder; import org.opendaylight.yangtools.yang.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -public abstract class NoopReaderCustomizer<C extends DataObject, B extends Builder<C>> implements RootVppReaderCustomizer<C, B> { +public abstract class NoopReaderCustomizer<C extends DataObject, B extends Builder<C>> implements + RootVppReaderCustomizer<C, B> { @Override public void readCurrentAttributes(InstanceIdentifier<C> id, final B builder, final Context context) { diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/r/util/ReflexiveChildReaderCustomizer.java b/v3po/vpp-facade-utils/src/main/java/io/fd/honeycomb/v3po/vpp/facade/impl/read/util/ReflexiveChildReaderCustomizer.java index 6eb7ef576..a83269658 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/r/util/ReflexiveChildReaderCustomizer.java +++ b/v3po/vpp-facade-utils/src/main/java/io/fd/honeycomb/v3po/vpp/facade/impl/read/util/ReflexiveChildReaderCustomizer.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.fd.honeycomb.v3po.impl.trans.r.util; +package io.fd.honeycomb.v3po.vpp.facade.impl.read.util; import com.google.common.base.Optional; import com.google.common.base.Preconditions; -import io.fd.honeycomb.v3po.impl.trans.r.impl.spi.ChildVppReaderCustomizer; -import io.fd.honeycomb.v3po.impl.trans.util.ReflectionUtils; +import io.fd.honeycomb.v3po.vpp.facade.impl.util.ReflectionUtils; +import io.fd.honeycomb.v3po.vpp.facade.spi.read.ChildVppReaderCustomizer; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Collections; diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/r/util/ReflexiveRootReaderCustomizer.java b/v3po/vpp-facade-utils/src/main/java/io/fd/honeycomb/v3po/vpp/facade/impl/read/util/ReflexiveRootReaderCustomizer.java index b1f776c01..b78bcdc06 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/r/util/ReflexiveRootReaderCustomizer.java +++ b/v3po/vpp-facade-utils/src/main/java/io/fd/honeycomb/v3po/vpp/facade/impl/read/util/ReflexiveRootReaderCustomizer.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.fd.honeycomb.v3po.impl.trans.r.util; +package io.fd.honeycomb.v3po.vpp.facade.impl.read.util; import org.opendaylight.yangtools.concepts.Builder; import org.opendaylight.yangtools.yang.binding.DataObject; diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/util/ReflectionUtils.java b/v3po/vpp-facade-utils/src/main/java/io/fd/honeycomb/v3po/vpp/facade/impl/util/ReflectionUtils.java index 6602d750d..db560622c 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/util/ReflectionUtils.java +++ b/v3po/vpp-facade-utils/src/main/java/io/fd/honeycomb/v3po/vpp/facade/impl/util/ReflectionUtils.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.fd.honeycomb.v3po.impl.trans.util; +package io.fd.honeycomb.v3po.vpp.facade.impl.util; import com.google.common.base.Optional; import java.lang.reflect.Method; diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/util/VppApiCustomizer.java b/v3po/vpp-facade-utils/src/main/java/io/fd/honeycomb/v3po/vpp/facade/impl/util/VppApiCustomizer.java index f33dd988e..41090f493 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/util/VppApiCustomizer.java +++ b/v3po/vpp-facade-utils/src/main/java/io/fd/honeycomb/v3po/vpp/facade/impl/util/VppApiCustomizer.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.fd.honeycomb.v3po.impl.trans.util; +package io.fd.honeycomb.v3po.vpp.facade.impl.util; import com.google.common.annotations.Beta; diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/util/VppRWUtils.java b/v3po/vpp-facade-utils/src/main/java/io/fd/honeycomb/v3po/vpp/facade/impl/util/VppRWUtils.java index d11910b6f..64667b85f 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/util/VppRWUtils.java +++ b/v3po/vpp-facade-utils/src/main/java/io/fd/honeycomb/v3po/vpp/facade/impl/util/VppRWUtils.java @@ -14,16 +14,16 @@ * limitations under the License. */ -package io.fd.honeycomb.v3po.impl.trans.util; +package io.fd.honeycomb.v3po.vpp.facade.impl.util; import com.google.common.base.Function; import com.google.common.base.Preconditions; import com.google.common.base.Predicate; import com.google.common.collect.Iterables; import com.google.common.collect.Maps; -import io.fd.honeycomb.v3po.impl.trans.SubtreeManager; -import io.fd.honeycomb.v3po.impl.trans.r.ChildVppReader; -import io.fd.honeycomb.v3po.impl.trans.w.ChildVppWriter; +import io.fd.honeycomb.v3po.vpp.facade.SubtreeManager; +import io.fd.honeycomb.v3po.vpp.facade.read.ChildVppReader; +import io.fd.honeycomb.v3po.vpp.facade.write.ChildVppWriter; import java.util.Collection; import java.util.Collections; import java.util.List; diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/w/util/DelegatingWriterRegistry.java b/v3po/vpp-facade-utils/src/main/java/io/fd/honeycomb/v3po/vpp/facade/impl/write/util/DelegatingWriterRegistry.java index cc1188e17..14cec7a55 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/w/util/DelegatingWriterRegistry.java +++ b/v3po/vpp-facade-utils/src/main/java/io/fd/honeycomb/v3po/vpp/facade/impl/write/util/DelegatingWriterRegistry.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.fd.honeycomb.v3po.impl.trans.w.util; +package io.fd.honeycomb.v3po.vpp.facade.impl.write.util; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; @@ -24,11 +24,11 @@ import com.google.common.collect.Collections2; import com.google.common.collect.Iterables; import com.google.common.collect.Lists; import com.google.common.collect.Sets; -import io.fd.honeycomb.v3po.impl.trans.VppException; -import io.fd.honeycomb.v3po.impl.trans.util.VppRWUtils; -import io.fd.honeycomb.v3po.impl.trans.w.VppWriter; -import io.fd.honeycomb.v3po.impl.trans.w.WriteContext; -import io.fd.honeycomb.v3po.impl.trans.w.WriterRegistry; +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.write.VppWriter; +import io.fd.honeycomb.v3po.vpp.facade.write.WriteContext; +import io.fd.honeycomb.v3po.vpp.facade.write.WriterRegistry; import java.util.LinkedList; import java.util.List; import java.util.Map; diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/w/util/NoopWriterCustomizer.java b/v3po/vpp-facade-utils/src/main/java/io/fd/honeycomb/v3po/vpp/facade/impl/write/util/NoopWriterCustomizer.java index 7691f558b..96b7d19b4 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/w/util/NoopWriterCustomizer.java +++ b/v3po/vpp-facade-utils/src/main/java/io/fd/honeycomb/v3po/vpp/facade/impl/write/util/NoopWriterCustomizer.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.fd.honeycomb.v3po.impl.trans.w.util; +package io.fd.honeycomb.v3po.vpp.facade.impl.write.util; -import io.fd.honeycomb.v3po.impl.trans.util.Context; -import io.fd.honeycomb.v3po.impl.trans.w.impl.spi.RootVppWriterCustomizer; +import io.fd.honeycomb.v3po.vpp.facade.Context; +import io.fd.honeycomb.v3po.vpp.facade.spi.write.RootVppWriterCustomizer; import javax.annotation.Nonnull; import org.opendaylight.yangtools.yang.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/w/util/ReflexiveChildWriterCustomizer.java b/v3po/vpp-facade-utils/src/main/java/io/fd/honeycomb/v3po/vpp/facade/impl/write/util/ReflexiveChildWriterCustomizer.java index 9d324a059..820f469d6 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/w/util/ReflexiveChildWriterCustomizer.java +++ b/v3po/vpp-facade-utils/src/main/java/io/fd/honeycomb/v3po/vpp/facade/impl/write/util/ReflexiveChildWriterCustomizer.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package io.fd.honeycomb.v3po.impl.trans.w.util; +package io.fd.honeycomb.v3po.vpp.facade.impl.write.util; import com.google.common.base.Optional; import com.google.common.base.Preconditions; import com.google.common.collect.Iterables; -import io.fd.honeycomb.v3po.impl.trans.util.ReflectionUtils; -import io.fd.honeycomb.v3po.impl.trans.w.impl.spi.ChildVppWriterCustomizer; +import io.fd.honeycomb.v3po.vpp.facade.impl.util.ReflectionUtils; +import io.fd.honeycomb.v3po.vpp.facade.spi.write.ChildVppWriterCustomizer; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Collections; diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/w/util/TransactionWriteContext.java b/v3po/vpp-facade-utils/src/main/java/io/fd/honeycomb/v3po/vpp/facade/impl/write/util/TransactionWriteContext.java index 21e5f19ce..da124b03c 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/w/util/TransactionWriteContext.java +++ b/v3po/vpp-facade-utils/src/main/java/io/fd/honeycomb/v3po/vpp/facade/impl/write/util/TransactionWriteContext.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.fd.honeycomb.v3po.impl.trans.w.util; +package io.fd.honeycomb.v3po.vpp.facade.impl.write.util; import com.google.common.base.Optional; import com.google.common.util.concurrent.CheckedFuture; -import io.fd.honeycomb.v3po.impl.trans.util.Context; -import io.fd.honeycomb.v3po.impl.trans.w.WriteContext; +import io.fd.honeycomb.v3po.vpp.facade.Context; +import io.fd.honeycomb.v3po.vpp.facade.write.WriteContext; import java.util.Map; import javax.annotation.Nonnull; import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; diff --git a/v3po/vpp-facade-utils/src/test/java/io/fd/honeycomb/v3po/vpp/facade/impl/write/util/DelegatingWriterRegistryTest.java b/v3po/vpp-facade-utils/src/test/java/io/fd/honeycomb/v3po/vpp/facade/impl/write/util/DelegatingWriterRegistryTest.java new file mode 100644 index 000000000..774974d4f --- /dev/null +++ b/v3po/vpp-facade-utils/src/test/java/io/fd/honeycomb/v3po/vpp/facade/impl/write/util/DelegatingWriterRegistryTest.java @@ -0,0 +1,188 @@ +/* + * Copyright (c) 2016 Cisco and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.fd.honeycomb.v3po.vpp.facade.impl.write.util; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; + +import io.fd.honeycomb.v3po.vpp.facade.VppException; +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 java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mockito; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.Vpp; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VppState; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; + +public class DelegatingWriterRegistryTest { + + private final InstanceIdentifier<Vpp> vppId; + private final InstanceIdentifier<VppState> vppStateId; + private final InstanceIdentifier<Interfaces> interfaceId; + + private WriteContext ctx; + private VppWriter<Vpp> vppWriter; + private VppWriter<VppState> vppStateWriter; + private VppWriter<Interfaces> interfacesWriter; + + private DelegatingWriterRegistry registry; + + public DelegatingWriterRegistryTest() { + vppId = InstanceIdentifier.create(Vpp.class); + vppStateId = InstanceIdentifier.create(VppState.class); + interfaceId = InstanceIdentifier.create(Interfaces.class); + } + + @SuppressWarnings("unchecked") + private <D extends DataObject> VppWriter<D> mockWriter(Class<D> clazz) { + final VppWriter<D> mock = (VppWriter<D>) Mockito.mock(VppWriter.class); + doReturn(InstanceIdentifier.create(clazz)).when(mock).getManagedDataObjectType(); + return mock; + } + + private DataObject mockDataObject(final String name, final Class<? extends DataObject> classToMock) { + final DataObject dataBefore = mock(classToMock, name); + doReturn(classToMock).when(dataBefore).getImplementedInterface(); + return dataBefore; + } + + @SuppressWarnings("unchecked") + private static Map<InstanceIdentifier<?>, DataObject> asMap(DataObject... objects) { + final Map<InstanceIdentifier<?>, DataObject> map = new HashMap<>(); + for (DataObject object : objects) { + final Class<? extends DataObject> implementedInterface = + (Class<? extends DataObject>) object.getImplementedInterface(); + final InstanceIdentifier<?> id = InstanceIdentifier.create(implementedInterface); + map.put(id, object); + } + return map; + } + + @Before + public void setUp() { + ctx = mock(WriteContext.class); + vppWriter = mockWriter(Vpp.class); + vppStateWriter = mockWriter(VppState.class); + interfacesWriter = mockWriter(Interfaces.class); + + final List<VppWriter<? extends DataObject>> writers = new ArrayList<>(); + writers.add(vppWriter); + writers.add(vppStateWriter); + writers.add(interfacesWriter); + + registry = new DelegatingWriterRegistry(writers); + } + + @Test(expected = UnsupportedOperationException.class) + public void testGetManagedDataObjectType() { + registry.getManagedDataObjectType(); + } + + @Test + public void testBulkUpdateRevert() throws Exception { + // Prepare data changes: + final DataObject dataBefore1 = mockDataObject("Vpp before", Vpp.class); + final DataObject dataAfter1 = mockDataObject("Vpp after", Vpp.class); + + final DataObject dataBefore2 = mockDataObject("VppState before", VppState.class); + final DataObject dataAfter2 = mockDataObject("VppState after", VppState.class); + + // Fail on update + doThrow(new VppException("vpp failed")).when(vppStateWriter) + .update(vppStateId, dataBefore2, dataAfter2, ctx); + + // Run the test + try { + registry.update(asMap(dataBefore1, dataBefore2), asMap(dataAfter1, dataAfter2), ctx); + } catch (WriterRegistry.BulkUpdateException e) { + // Check second update failed + assertEquals(vppStateId, e.getFailedId()); + verify(vppWriter).update(vppId, dataBefore1, dataAfter1, ctx); + verify(vppStateWriter).update(vppStateId, dataBefore2, dataAfter2, ctx); + + // Try to revert changes + e.revertChanges(); + + // Check revert was successful + verify(vppWriter).update(vppId, dataAfter1, dataBefore1, ctx); + verify(vppStateWriter, never()).update(vppStateId, dataAfter2, dataBefore2, ctx); + + return; + } + fail("BulkUpdateException expected"); + } + + @Test + public void testBulkUpdateRevertFail() throws Exception { + // Prepare data changes: + final DataObject dataBefore1 = mockDataObject("Vpp before", Vpp.class); + final DataObject dataAfter1 = mockDataObject("Vpp after", Vpp.class); + + final DataObject dataBefore2 = mockDataObject("VppState before", VppState.class); + final DataObject dataAfter2 = mockDataObject("VppState after", VppState.class); + + final DataObject dataBefore3 = mockDataObject("Interfaces before", Interfaces.class); + final DataObject dataAfter3 = mockDataObject("Interfaces after", Interfaces.class); + + // Fail on the third update + doThrow(new VppException("vpp failed")).when(interfacesWriter) + .update(interfaceId, dataBefore3, dataAfter3, ctx); + + // Fail on the second revert + doThrow(new VppException("vpp failed again")).when(vppWriter) + .update(vppId, dataAfter1, dataBefore1, ctx); + + // Run the test + try { + registry.update(asMap(dataBefore1, dataBefore2, dataBefore3), asMap(dataAfter1, dataAfter2, dataAfter3), ctx); + } catch (WriterRegistry.BulkUpdateException e) { + // Check third update failed + assertEquals(interfaceId, e.getFailedId()); + verify(vppWriter).update(vppId, dataBefore1, dataAfter1, ctx); + verify(vppStateWriter).update(vppStateId, dataBefore2, dataAfter2, ctx); + verify(interfacesWriter).update(interfaceId, dataBefore3, dataAfter3, ctx); + + // Try to revert changes + try { + e.revertChanges(); + } catch (WriterRegistry.Reverter.RevertFailedException e2) { + // Check second revert failed + assertEquals(Collections.singletonList(vppId), e2.getNotRevertedChanges()); + verify(vppWriter).update(vppId, dataAfter1, dataBefore1, ctx); + verify(vppStateWriter).update(vppStateId, dataAfter2, dataBefore2, ctx); + verify(interfacesWriter, never()).update(interfaceId, dataAfter3, dataBefore3, ctx); + return; + } + fail("WriterRegistry.Revert.RevertFailedException expected"); + } + fail("BulkUpdateException expected"); + } +}
\ No newline at end of file diff --git a/v3po/vpp-facade-utils/src/test/java/io/fd/honeycomb/v3po/vpp/facade/impl/write/util/TransactionWriteContextTest.java b/v3po/vpp-facade-utils/src/test/java/io/fd/honeycomb/v3po/vpp/facade/impl/write/util/TransactionWriteContextTest.java new file mode 100644 index 000000000..0e46e2fa4 --- /dev/null +++ b/v3po/vpp-facade-utils/src/test/java/io/fd/honeycomb/v3po/vpp/facade/impl/write/util/TransactionWriteContextTest.java @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2016 Cisco and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.fd.honeycomb.v3po.vpp.facade.impl.write.util; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +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.Context; +import java.util.Map; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mock; +import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; +import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException; +import org.opendaylight.controller.md.sal.dom.api.DOMDataReadOnlyTransaction; +import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.Vpp; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VppState; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.BridgeDomains; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.bridge.domains.BridgeDomain; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; + +public class TransactionWriteContextTest { + + @Mock + private BindingNormalizedNodeSerializer serializer; + @Mock + private DOMDataReadOnlyTransaction beforeTx; + @Mock + private DOMDataReadOnlyTransaction afterTx; + @Mock + private CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> future; + @Mock + private Optional<org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode<?, ?>> optional; + @Mock + private Map.Entry entry; + + private TransactionWriteContext transactionWriteContext; + + @Before + public void setUp() { + initMocks(this); + transactionWriteContext = new TransactionWriteContext(serializer, beforeTx, afterTx); + } + + @Test + public void testReadBeforeNoData() throws Exception { + when(beforeTx.read(eq(LogicalDatastoreType.CONFIGURATION), any(YangInstanceIdentifier.class))).thenReturn(future); + when(future.checkedGet()).thenReturn(optional); + when(optional.isPresent()).thenReturn(false); + + final InstanceIdentifier<BridgeDomain> instanceId = + InstanceIdentifier.create(Vpp.class).child(BridgeDomains.class).child(BridgeDomain.class); + + final Optional<DataObject> dataObjects = transactionWriteContext.readBefore(instanceId); + assertNotNull(dataObjects); + assertFalse(dataObjects.isPresent()); + + verify(serializer).toYangInstanceIdentifier(instanceId); + verify(serializer, never()).fromNormalizedNode(any(YangInstanceIdentifier.class), any(NormalizedNode.class)); + } + + + @Test + public void testReadBefore() throws Exception { + when(beforeTx.read(eq(LogicalDatastoreType.CONFIGURATION), any(YangInstanceIdentifier.class))).thenReturn(future); + when(future.checkedGet()).thenReturn(optional); + when(optional.isPresent()).thenReturn(true); + + final InstanceIdentifier<BridgeDomain> instanceId = + InstanceIdentifier.create(Vpp.class).child(BridgeDomains.class).child(BridgeDomain.class); + final YangInstanceIdentifier yangId = YangInstanceIdentifier.builder().node(VppState.QNAME).node( + BridgeDomains.QNAME).node(BridgeDomain.QNAME).build(); + when(serializer.toYangInstanceIdentifier(any(InstanceIdentifier.class))).thenReturn(yangId); + when(serializer.fromNormalizedNode(eq(yangId), any(NormalizedNode.class))).thenReturn(entry); + when(entry.getValue()).thenReturn(mock(DataObject.class)); + + final Optional<DataObject> dataObjects = transactionWriteContext.readBefore(instanceId); + assertNotNull(dataObjects); + assertTrue(dataObjects.isPresent()); + + verify(serializer).toYangInstanceIdentifier(instanceId); + verify(serializer).fromNormalizedNode(eq(yangId), any(NormalizedNode.class)); + } + + @Test(expected = IllegalStateException.class) + public void testReadBeforeFailed() throws Exception { + when(beforeTx.read(eq(LogicalDatastoreType.CONFIGURATION), any(YangInstanceIdentifier.class))).thenReturn(future); + when(future.checkedGet()).thenThrow(ReadFailedException.class); + transactionWriteContext.readBefore(mock(InstanceIdentifier.class)); + } + + @Test(expected = IllegalStateException.class) + public void testReadAfterFailed() throws Exception { + when(afterTx.read(eq(LogicalDatastoreType.CONFIGURATION), any(YangInstanceIdentifier.class))).thenReturn(future); + when(future.checkedGet()).thenThrow(ReadFailedException.class); + transactionWriteContext.readAfter(mock(InstanceIdentifier.class)); + } + + @Test + public void testGetContext() throws Exception { + assertNotNull(transactionWriteContext.getContext()); + } + + @Test + public void testClose() throws Exception { + final Context context = transactionWriteContext.getContext(); + transactionWriteContext.close(); + // TODO verify context was closed + } +}
\ No newline at end of file |