Split out sal-distributed-eos 79/86679/7
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 2 Jan 2020 12:20:37 +0000 (13:20 +0100)
committerStephen Kitt <skitt@redhat.com>
Mon, 6 Jan 2020 10:48:35 +0000 (10:48 +0000)
This splits out entity ownership implementation from
sal-distributed-datastore. Key point here is that the tie with
CDS is an implementation detail, which is subject to future
revision (for example by using purely raft-based-approach).

JIRA: CONTROLLER-1922
Change-Id: Ia62b0a14991e64424b08e0d4274b0e8eaffdacbd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
50 files changed:
features/mdsal/odl-mdsal-distributed-datastore/pom.xml
opendaylight/md-sal/mdsal-artifacts/pom.xml
opendaylight/md-sal/pom.xml
opendaylight/md-sal/sal-distributed-datastore/pom.xml
opendaylight/md-sal/sal-distributed-datastore/src/main/resources/OSGI-INF/blueprint/clustered-datastore.xml
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/SchemaContextHelper.java
opendaylight/md-sal/sal-distributed-eos/pom.xml [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-eos/src/main/java/org/opendaylight/controller/cluster/entityownership/AbstractEntityOwnerChangeListener.java [moved from opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/AbstractEntityOwnerChangeListener.java with 77% similarity]
opendaylight/md-sal/sal-distributed-eos/src/main/java/org/opendaylight/controller/cluster/entityownership/CandidateListChangeListener.java [moved from opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/CandidateListChangeListener.java with 88% similarity]
opendaylight/md-sal/sal-distributed-eos/src/main/java/org/opendaylight/controller/cluster/entityownership/DistributedEntityOwnershipCandidateRegistration.java [moved from opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/DistributedEntityOwnershipCandidateRegistration.java with 94% similarity]
opendaylight/md-sal/sal-distributed-eos/src/main/java/org/opendaylight/controller/cluster/entityownership/DistributedEntityOwnershipListenerRegistration.java [moved from opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/DistributedEntityOwnershipListenerRegistration.java with 96% similarity]
opendaylight/md-sal/sal-distributed-eos/src/main/java/org/opendaylight/controller/cluster/entityownership/DistributedEntityOwnershipService.java [moved from opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/DistributedEntityOwnershipService.java with 91% similarity]
opendaylight/md-sal/sal-distributed-eos/src/main/java/org/opendaylight/controller/cluster/entityownership/EntityOwnerChangeListener.java [moved from opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/EntityOwnerChangeListener.java with 94% similarity]
opendaylight/md-sal/sal-distributed-eos/src/main/java/org/opendaylight/controller/cluster/entityownership/EntityOwnersModel.java [moved from opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/EntityOwnersModel.java with 99% similarity]
opendaylight/md-sal/sal-distributed-eos/src/main/java/org/opendaylight/controller/cluster/entityownership/EntityOwnershipChangePublisher.java [moved from opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/EntityOwnershipChangePublisher.java with 90% similarity]
opendaylight/md-sal/sal-distributed-eos/src/main/java/org/opendaylight/controller/cluster/entityownership/EntityOwnershipListenerActor.java [moved from opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/EntityOwnershipListenerActor.java with 97% similarity]
opendaylight/md-sal/sal-distributed-eos/src/main/java/org/opendaylight/controller/cluster/entityownership/EntityOwnershipListenerSupport.java [moved from opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/EntityOwnershipListenerSupport.java with 99% similarity]
opendaylight/md-sal/sal-distributed-eos/src/main/java/org/opendaylight/controller/cluster/entityownership/EntityOwnershipShard.java [moved from opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/EntityOwnershipShard.java with 92% similarity]
opendaylight/md-sal/sal-distributed-eos/src/main/java/org/opendaylight/controller/cluster/entityownership/EntityOwnershipShardCommitCoordinator.java [moved from opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/EntityOwnershipShardCommitCoordinator.java with 98% similarity]
opendaylight/md-sal/sal-distributed-eos/src/main/java/org/opendaylight/controller/cluster/entityownership/EntityOwnershipStatistics.java [moved from opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/EntityOwnershipStatistics.java with 94% similarity]
opendaylight/md-sal/sal-distributed-eos/src/main/java/org/opendaylight/controller/cluster/entityownership/messages/CandidateAdded.java [moved from opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/messages/CandidateAdded.java with 85% similarity]
opendaylight/md-sal/sal-distributed-eos/src/main/java/org/opendaylight/controller/cluster/entityownership/messages/CandidateRemoved.java [moved from opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/messages/CandidateRemoved.java with 85% similarity]
opendaylight/md-sal/sal-distributed-eos/src/main/java/org/opendaylight/controller/cluster/entityownership/messages/RegisterCandidateLocal.java [moved from opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/messages/RegisterCandidateLocal.java with 85% similarity]
opendaylight/md-sal/sal-distributed-eos/src/main/java/org/opendaylight/controller/cluster/entityownership/messages/RegisterListenerLocal.java [moved from opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/messages/RegisterListenerLocal.java with 94% similarity]
opendaylight/md-sal/sal-distributed-eos/src/main/java/org/opendaylight/controller/cluster/entityownership/messages/RemoveAllCandidates.java [moved from opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/messages/RemoveAllCandidates.java with 87% similarity]
opendaylight/md-sal/sal-distributed-eos/src/main/java/org/opendaylight/controller/cluster/entityownership/messages/SelectOwner.java [moved from opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/messages/SelectOwner.java with 89% similarity]
opendaylight/md-sal/sal-distributed-eos/src/main/java/org/opendaylight/controller/cluster/entityownership/messages/UnregisterCandidateLocal.java [moved from opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/messages/UnregisterCandidateLocal.java with 85% similarity]
opendaylight/md-sal/sal-distributed-eos/src/main/java/org/opendaylight/controller/cluster/entityownership/messages/UnregisterListenerLocal.java [moved from opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/messages/UnregisterListenerLocal.java with 85% similarity]
opendaylight/md-sal/sal-distributed-eos/src/main/java/org/opendaylight/controller/cluster/entityownership/selectionstrategy/AbstractEntityOwnerSelectionStrategy.java [moved from opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/selectionstrategy/AbstractEntityOwnerSelectionStrategy.java with 79% similarity]
opendaylight/md-sal/sal-distributed-eos/src/main/java/org/opendaylight/controller/cluster/entityownership/selectionstrategy/EntityOwnerSelectionStrategy.java [moved from opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/selectionstrategy/EntityOwnerSelectionStrategy.java with 92% similarity]
opendaylight/md-sal/sal-distributed-eos/src/main/java/org/opendaylight/controller/cluster/entityownership/selectionstrategy/EntityOwnerSelectionStrategyConfig.java [moved from opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/selectionstrategy/EntityOwnerSelectionStrategyConfig.java with 97% similarity]
opendaylight/md-sal/sal-distributed-eos/src/main/java/org/opendaylight/controller/cluster/entityownership/selectionstrategy/EntityOwnerSelectionStrategyConfigReader.java [moved from opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/selectionstrategy/EntityOwnerSelectionStrategyConfigReader.java with 94% similarity]
opendaylight/md-sal/sal-distributed-eos/src/main/java/org/opendaylight/controller/cluster/entityownership/selectionstrategy/FirstCandidateSelectionStrategy.java [moved from opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/selectionstrategy/FirstCandidateSelectionStrategy.java with 76% similarity]
opendaylight/md-sal/sal-distributed-eos/src/main/java/org/opendaylight/controller/cluster/entityownership/selectionstrategy/LeastLoadedCandidateSelectionStrategy.java [moved from opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/selectionstrategy/LeastLoadedCandidateSelectionStrategy.java with 86% similarity]
opendaylight/md-sal/sal-distributed-eos/src/main/resources/OSGI-INF/blueprint/distributed-eos.xml [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-eos/src/main/yang/entity-owners.yang [moved from opendaylight/md-sal/sal-distributed-datastore/src/main/yang/entity-owners.yang with 100% similarity]
opendaylight/md-sal/sal-distributed-eos/src/test/java/org/opendaylight/controller/cluster/entityownership/AbstractClusterRefEntityOwnershipTest.java [moved from opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/entityownership/AbstractClusterRefEntityOwnershipTest.java with 93% similarity]
opendaylight/md-sal/sal-distributed-eos/src/test/java/org/opendaylight/controller/cluster/entityownership/AbstractEntityOwnershipTest.java [moved from opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/entityownership/AbstractEntityOwnershipTest.java with 93% similarity]
opendaylight/md-sal/sal-distributed-eos/src/test/java/org/opendaylight/controller/cluster/entityownership/CandidateListChangeListenerTest.java [moved from opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/entityownership/CandidateListChangeListenerTest.java with 85% similarity]
opendaylight/md-sal/sal-distributed-eos/src/test/java/org/opendaylight/controller/cluster/entityownership/DistributedEntityOwnershipIntegrationTest.java [moved from opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/entityownership/DistributedEntityOwnershipIntegrationTest.java with 92% similarity]
opendaylight/md-sal/sal-distributed-eos/src/test/java/org/opendaylight/controller/cluster/entityownership/DistributedEntityOwnershipServiceTest.java [moved from opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/entityownership/DistributedEntityOwnershipServiceTest.java with 88% similarity]
opendaylight/md-sal/sal-distributed-eos/src/test/java/org/opendaylight/controller/cluster/entityownership/EOSTestUtils.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-eos/src/test/java/org/opendaylight/controller/cluster/entityownership/EntityOwnerChangeListenerTest.java [moved from opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/entityownership/EntityOwnerChangeListenerTest.java with 91% similarity]
opendaylight/md-sal/sal-distributed-eos/src/test/java/org/opendaylight/controller/cluster/entityownership/EntityOwnershipListenerActorTest.java [moved from opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/entityownership/EntityOwnershipListenerActorTest.java with 98% similarity]
opendaylight/md-sal/sal-distributed-eos/src/test/java/org/opendaylight/controller/cluster/entityownership/EntityOwnershipListenerSupportTest.java [moved from opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/entityownership/EntityOwnershipListenerSupportTest.java with 99% similarity]
opendaylight/md-sal/sal-distributed-eos/src/test/java/org/opendaylight/controller/cluster/entityownership/EntityOwnershipShardTest.java [moved from opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/entityownership/EntityOwnershipShardTest.java with 97% similarity]
opendaylight/md-sal/sal-distributed-eos/src/test/java/org/opendaylight/controller/cluster/entityownership/EntityOwnershipStatisticsTest.java [moved from opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/entityownership/EntityOwnershipStatisticsTest.java with 91% similarity]
opendaylight/md-sal/sal-distributed-eos/src/test/java/org/opendaylight/controller/cluster/entityownership/selectionstrategy/EntityOwnerSelectionStrategyConfigReaderTest.java [moved from opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/entityownership/selectionstrategy/EntityOwnerSelectionStrategyConfigReaderTest.java with 77% similarity]
opendaylight/md-sal/sal-distributed-eos/src/test/java/org/opendaylight/controller/cluster/entityownership/selectionstrategy/LastCandidateSelectionStrategy.java [moved from opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/entityownership/selectionstrategy/LastCandidateSelectionStrategy.java with 90% similarity]
opendaylight/md-sal/sal-distributed-eos/src/test/java/org/opendaylight/controller/cluster/entityownership/selectionstrategy/LeastLoadedCandidateSelectionStrategyTest.java [moved from opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/entityownership/selectionstrategy/LeastLoadedCandidateSelectionStrategyTest.java with 97% similarity]

index 5f8f37d..32c3102 100644 (file)
             <groupId>${project.groupId}</groupId>
             <artifactId>sal-distributed-datastore</artifactId>
         </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>sal-distributed-eos</artifactId>
+        </dependency>
         <dependency>
             <groupId>${project.groupId}</groupId>
             <artifactId>sal-cluster-admin-api</artifactId>
index 24c3d42..40bc832 100644 (file)
                 <artifactId>sal-distributed-datastore</artifactId>
                 <version>${project.version}</version>
             </dependency>
+            <dependency>
+                <groupId>${project.groupId}</groupId>
+                <artifactId>sal-distributed-eos</artifactId>
+                <version>${project.version}</version>
+            </dependency>
             <dependency>
                 <groupId>${project.groupId}</groupId>
                 <artifactId>sal-remoterpc-connector</artifactId>
index 43653b8..5978e41 100644 (file)
@@ -58,6 +58,7 @@
     <module>sal-dummy-distributed-datastore</module>
     <module>sal-cluster-admin-api</module>
     <module>sal-cluster-admin-impl</module>
+    <module>sal-distributed-eos</module>
 
     <!-- Yang Test Models for MD-SAL -->
     <module>sal-test-model</module>
index b062191..775f5c7 100644 (file)
       <groupId>org.opendaylight.mdsal</groupId>
       <artifactId>mdsal-dom-api</artifactId>
     </dependency>
-    <dependency>
-      <groupId>org.opendaylight.mdsal</groupId>
-      <artifactId>mdsal-eos-dom-api</artifactId>
-    </dependency>
     <dependency>
       <groupId>org.opendaylight.mdsal</groupId>
       <artifactId>mdsal-dom-spi</artifactId>
                 org.opendaylight.controller.cluster.datastore;
                 org.opendaylight.controller.cluster.datastore.config;
                 org.opendaylight.controller.cluster.datastore.exceptions;
+                org.opendaylight.controller.cluster.datastore.identifiers;
                 org.opendaylight.controller.cluster.datastore.messages;
+                org.opendaylight.controller.cluster.datastore.modification;
                 org.opendaylight.controller.cluster.datastore.persisted;
                 org.opendaylight.controller.cluster.datastore.utils;
                 org.opendaylight.controller.cluster.datastore.jmx.mbeans.shard;
index 36e768a..ac3d982 100644 (file)
     <argument value="DOMDataBroker"/>
   </bean>
 
-  <!-- Distributed EntityOwnershipService -->
-  <cm:cm-properties id="strategiesProps" persistent-id="org.opendaylight.controller.cluster.entity.owner.selection.strategies" />
-
-  <bean id="selectionStrategyConfig" class="org.opendaylight.controller.cluster.datastore.entityownership.selectionstrategy.EntityOwnerSelectionStrategyConfigReader"
-          factory-method="loadStrategyWithConfig">
-    <argument ref="strategiesProps"/>
-  </bean>
-
-  <bean id="distributedEntityOwnershipService" class="org.opendaylight.controller.cluster.datastore.entityownership.DistributedEntityOwnershipService"
-          factory-method="start" destroy-method="close">
-    <argument>
-      <bean factory-ref="operDatastore" factory-method="getActorUtils"/>
-    </argument>
-    <argument ref="selectionStrategyConfig"/>
-  </bean>
-
-  <service ref="distributedEntityOwnershipService" interface="org.opendaylight.mdsal.eos.dom.api.DOMEntityOwnershipService"
-        odl:type="default"/>
-
   <!-- CDS shard manager -->
   <bean id="cdsNodeManager" class="org.opendaylight.controller.cluster.sharding.DistributedShardedDOMDataTree"
           init-method="init">
index 7f8b748..c98044a 100644 (file)
@@ -5,10 +5,8 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.controller.md.cluster.datastore.model;
 
-import java.io.File;
 import java.io.InputStream;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
@@ -41,8 +39,4 @@ public final class SchemaContextHelper {
         return YangParserTestUtils.parseYangResources(SchemaContextHelper.class, ODL_DATASTORE_TEST_YANG,
             "/META-INF/yang/prefix-shard-configuration@2017-01-10.yang");
     }
-
-    public static SchemaContext entityOwners() {
-        return YangParserTestUtils.parseYangFiles(new File("src/main/yang/entity-owners.yang"));
-    }
 }
diff --git a/opendaylight/md-sal/sal-distributed-eos/pom.xml b/opendaylight/md-sal/sal-distributed-eos/pom.xml
new file mode 100644 (file)
index 0000000..b513b97
--- /dev/null
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.opendaylight.controller</groupId>
+    <artifactId>mdsal-parent</artifactId>
+    <version>1.11.0-SNAPSHOT</version>
+    <relativePath>../parent</relativePath>
+  </parent>
+
+  <artifactId>sal-distributed-eos</artifactId>
+  <version>1.11.0-SNAPSHOT</version>
+  <packaging>bundle</packaging>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.opendaylight.mdsal</groupId>
+      <artifactId>mdsal-eos-dom-api</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.core</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal-distributed-datastore</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>commons-lang</groupId>
+      <artifactId>commons-lang</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>com.typesafe.akka</groupId>
+      <artifactId>akka-testkit_2.12</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal-akka-raft-example</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal-akka-raft</artifactId>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal-distributed-datastore</artifactId>
+      <version>1.11.0-SNAPSHOT</version>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-simple</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.yangtools</groupId>
+      <artifactId>yang-test-util</artifactId>
+    </dependency>
+  </dependencies>
+
+  <scm>
+    <connection>scm:git:http://git.opendaylight.org/gerrit/controller.git</connection>
+    <developerConnection>scm:git:ssh://git.opendaylight.org:29418/controller.git</developerConnection>
+    <tag>HEAD</tag>
+    <url>https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL:Architecture:Clustering</url>
+  </scm>
+</project>
@@ -5,11 +5,11 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.controller.cluster.datastore.entityownership;
+package org.opendaylight.controller.cluster.entityownership;
 
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.ENTITY_OWNERS_PATH;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.ENTITY_OWNER_QNAME;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.ENTITY_QNAME;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.ENTITY_OWNERS_PATH;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.ENTITY_OWNER_QNAME;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.ENTITY_QNAME;
 
 import java.util.Optional;
 import org.opendaylight.controller.cluster.datastore.ShardDataTree;
@@ -5,13 +5,13 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.controller.cluster.datastore.entityownership;
+package org.opendaylight.controller.cluster.entityownership;
 
 import static java.util.Objects.requireNonNull;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.CANDIDATE_NAME_QNAME;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.ENTITY_ID_QNAME;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.ENTITY_OWNERS_PATH;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.ENTITY_QNAME;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.CANDIDATE_NAME_QNAME;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.ENTITY_ID_QNAME;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.ENTITY_OWNERS_PATH;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.ENTITY_QNAME;
 
 import akka.actor.ActorRef;
 import java.util.ArrayList;
@@ -23,8 +23,8 @@ import java.util.List;
 import java.util.Map;
 import java.util.Optional;
 import org.opendaylight.controller.cluster.datastore.ShardDataTree;
-import org.opendaylight.controller.cluster.datastore.entityownership.messages.CandidateAdded;
-import org.opendaylight.controller.cluster.datastore.entityownership.messages.CandidateRemoved;
+import org.opendaylight.controller.cluster.entityownership.messages.CandidateAdded;
+import org.opendaylight.controller.cluster.entityownership.messages.CandidateRemoved;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeChangeListener;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.clustering.entity.owners.rev150804.entity.owners.EntityType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.clustering.entity.owners.rev150804.entity.owners.entity.type.entity.Candidate;
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.controller.cluster.datastore.entityownership;
+package org.opendaylight.controller.cluster.entityownership;
 
 import org.opendaylight.mdsal.eos.dom.api.DOMEntity;
 import org.opendaylight.mdsal.eos.dom.api.DOMEntityOwnershipCandidateRegistration;
@@ -5,12 +5,12 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.controller.cluster.datastore.entityownership;
+package org.opendaylight.controller.cluster.entityownership;
 
 import static java.util.Objects.requireNonNull;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.CANDIDATE_NODE_ID;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.ENTITY_OWNER_NODE_ID;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.entityPath;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.CANDIDATE_NODE_ID;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.ENTITY_OWNER_NODE_ID;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.entityPath;
 
 import akka.actor.ActorRef;
 import akka.dispatch.OnComplete;
@@ -28,15 +28,15 @@ import java.util.concurrent.TimeoutException;
 import org.opendaylight.controller.cluster.access.concepts.MemberName;
 import org.opendaylight.controller.cluster.datastore.config.Configuration;
 import org.opendaylight.controller.cluster.datastore.config.ModuleShardConfiguration;
-import org.opendaylight.controller.cluster.datastore.entityownership.messages.RegisterCandidateLocal;
-import org.opendaylight.controller.cluster.datastore.entityownership.messages.RegisterListenerLocal;
-import org.opendaylight.controller.cluster.datastore.entityownership.messages.UnregisterCandidateLocal;
-import org.opendaylight.controller.cluster.datastore.entityownership.messages.UnregisterListenerLocal;
-import org.opendaylight.controller.cluster.datastore.entityownership.selectionstrategy.EntityOwnerSelectionStrategyConfig;
 import org.opendaylight.controller.cluster.datastore.messages.CreateShard;
 import org.opendaylight.controller.cluster.datastore.messages.GetShardDataTree;
 import org.opendaylight.controller.cluster.datastore.shardstrategy.ModuleShardStrategy;
 import org.opendaylight.controller.cluster.datastore.utils.ActorUtils;
+import org.opendaylight.controller.cluster.entityownership.messages.RegisterCandidateLocal;
+import org.opendaylight.controller.cluster.entityownership.messages.RegisterListenerLocal;
+import org.opendaylight.controller.cluster.entityownership.messages.UnregisterCandidateLocal;
+import org.opendaylight.controller.cluster.entityownership.messages.UnregisterListenerLocal;
+import org.opendaylight.controller.cluster.entityownership.selectionstrategy.EntityOwnerSelectionStrategyConfig;
 import org.opendaylight.mdsal.eos.common.api.CandidateAlreadyRegisteredException;
 import org.opendaylight.mdsal.eos.common.api.EntityOwnershipState;
 import org.opendaylight.mdsal.eos.dom.api.DOMEntity;
@@ -90,7 +90,7 @@ public class DistributedEntityOwnershipService implements DOMEntityOwnershipServ
                         newShardBuilder(context, strategyConfig), null);
 
         Future<Object> createFuture = context.executeOperationAsync(shardManagerActor, createShard, MESSAGE_TIMEOUT);
-        createFuture.onComplete(new OnComplete<Object>() {
+        createFuture.onComplete(new OnComplete<>() {
             @Override
             public void onComplete(final Throwable failure, final Object response) {
                 if (failure != null) {
@@ -106,7 +106,7 @@ public class DistributedEntityOwnershipService implements DOMEntityOwnershipServ
 
     private void executeEntityOwnershipShardOperation(final ActorRef shardActor, final Object message) {
         Future<Object> future = context.executeOperationAsync(shardActor, message, MESSAGE_TIMEOUT);
-        future.onComplete(new OnComplete<Object>() {
+        future.onComplete(new OnComplete<>() {
             @Override
             public void onComplete(final Throwable failure, final Object response) {
                 if (failure != null) {
@@ -5,11 +5,11 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.controller.cluster.datastore.entityownership;
+package org.opendaylight.controller.cluster.entityownership;
 
 import static com.google.common.base.Verify.verifyNotNull;
 import static java.util.Objects.requireNonNull;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.createEntity;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.createEntity;
 
 import com.google.common.base.Strings;
 import java.util.Collection;
@@ -5,23 +5,23 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.controller.cluster.datastore.entityownership;
+package org.opendaylight.controller.cluster.entityownership;
 
 import static java.util.Objects.requireNonNull;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.CANDIDATE_NAME_NODE_ID;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.CANDIDATE_NODE_ID;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.ENTITY_ID_NODE_ID;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.ENTITY_ID_QNAME;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.ENTITY_NODE_ID;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.ENTITY_OWNERS_PATH;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.ENTITY_OWNER_NODE_ID;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.ENTITY_OWNER_QNAME;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.ENTITY_TYPES_PATH;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.ENTITY_TYPE_NODE_ID;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.ENTITY_TYPE_QNAME;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.candidateNodeKey;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.candidatePath;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.entityOwnersWithCandidate;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.CANDIDATE_NAME_NODE_ID;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.CANDIDATE_NODE_ID;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.ENTITY_ID_NODE_ID;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.ENTITY_ID_QNAME;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.ENTITY_NODE_ID;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.ENTITY_OWNERS_PATH;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.ENTITY_OWNER_NODE_ID;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.ENTITY_OWNER_QNAME;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.ENTITY_TYPES_PATH;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.ENTITY_TYPE_NODE_ID;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.ENTITY_TYPE_QNAME;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.candidateNodeKey;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.candidatePath;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.entityOwnersWithCandidate;
 
 import akka.actor.ActorRef;
 import akka.actor.ActorSelection;
@@ -46,16 +46,6 @@ import java.util.concurrent.TimeUnit;
 import org.opendaylight.controller.cluster.access.concepts.MemberName;
 import org.opendaylight.controller.cluster.datastore.DatastoreContext;
 import org.opendaylight.controller.cluster.datastore.Shard;
-import org.opendaylight.controller.cluster.datastore.entityownership.messages.CandidateAdded;
-import org.opendaylight.controller.cluster.datastore.entityownership.messages.CandidateRemoved;
-import org.opendaylight.controller.cluster.datastore.entityownership.messages.RegisterCandidateLocal;
-import org.opendaylight.controller.cluster.datastore.entityownership.messages.RegisterListenerLocal;
-import org.opendaylight.controller.cluster.datastore.entityownership.messages.RemoveAllCandidates;
-import org.opendaylight.controller.cluster.datastore.entityownership.messages.SelectOwner;
-import org.opendaylight.controller.cluster.datastore.entityownership.messages.UnregisterCandidateLocal;
-import org.opendaylight.controller.cluster.datastore.entityownership.messages.UnregisterListenerLocal;
-import org.opendaylight.controller.cluster.datastore.entityownership.selectionstrategy.EntityOwnerSelectionStrategy;
-import org.opendaylight.controller.cluster.datastore.entityownership.selectionstrategy.EntityOwnerSelectionStrategyConfig;
 import org.opendaylight.controller.cluster.datastore.identifiers.ShardIdentifier;
 import org.opendaylight.controller.cluster.datastore.messages.BatchedModifications;
 import org.opendaylight.controller.cluster.datastore.messages.PeerDown;
@@ -65,6 +55,16 @@ import org.opendaylight.controller.cluster.datastore.modification.DeleteModifica
 import org.opendaylight.controller.cluster.datastore.modification.MergeModification;
 import org.opendaylight.controller.cluster.datastore.modification.Modification;
 import org.opendaylight.controller.cluster.datastore.modification.WriteModification;
+import org.opendaylight.controller.cluster.entityownership.messages.CandidateAdded;
+import org.opendaylight.controller.cluster.entityownership.messages.CandidateRemoved;
+import org.opendaylight.controller.cluster.entityownership.messages.RegisterCandidateLocal;
+import org.opendaylight.controller.cluster.entityownership.messages.RegisterListenerLocal;
+import org.opendaylight.controller.cluster.entityownership.messages.RemoveAllCandidates;
+import org.opendaylight.controller.cluster.entityownership.messages.SelectOwner;
+import org.opendaylight.controller.cluster.entityownership.messages.UnregisterCandidateLocal;
+import org.opendaylight.controller.cluster.entityownership.messages.UnregisterListenerLocal;
+import org.opendaylight.controller.cluster.entityownership.selectionstrategy.EntityOwnerSelectionStrategy;
+import org.opendaylight.controller.cluster.entityownership.selectionstrategy.EntityOwnerSelectionStrategyConfig;
 import org.opendaylight.controller.cluster.raft.RaftState;
 import org.opendaylight.controller.cluster.raft.VotingState;
 import org.opendaylight.mdsal.eos.dom.api.DOMEntity;
@@ -5,10 +5,10 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.controller.cluster.datastore.entityownership;
+package org.opendaylight.controller.cluster.entityownership;
 
 import static java.util.Objects.requireNonNull;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.ENTITY_OWNER_QNAME;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.ENTITY_OWNER_QNAME;
 
 import akka.actor.ActorRef;
 import akka.actor.Cancellable;
@@ -5,9 +5,9 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.controller.cluster.datastore.entityownership;
+package org.opendaylight.controller.cluster.entityownership;
 
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.entityTypeFromEntityPath;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.entityTypeFromEntityPath;
 
 import com.google.common.base.Strings;
 import java.util.Collection;
@@ -5,8 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
-package org.opendaylight.controller.cluster.datastore.entityownership.messages;
+package org.opendaylight.controller.cluster.entityownership.messages;
 
 import java.util.Collection;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
@@ -22,7 +21,8 @@ public class CandidateAdded {
     private final Collection<String> allCandidates;
     private final String newCandidate;
 
-    public CandidateAdded(YangInstanceIdentifier entityPath, String newCandidate, Collection<String> allCandidates) {
+    public CandidateAdded(final YangInstanceIdentifier entityPath, final String newCandidate,
+            final Collection<String> allCandidates) {
         this.entityPath = entityPath;
         this.newCandidate = newCandidate;
         this.allCandidates = allCandidates;
@@ -5,8 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
-package org.opendaylight.controller.cluster.datastore.entityownership.messages;
+package org.opendaylight.controller.cluster.entityownership.messages;
 
 import java.util.Collection;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
@@ -22,8 +21,8 @@ public class CandidateRemoved {
     private final String removedCandidate;
     private final Collection<String> remainingCandidates;
 
-    public CandidateRemoved(YangInstanceIdentifier entityPath, String removedCandidate,
-            Collection<String> remainingCandidates) {
+    public CandidateRemoved(final YangInstanceIdentifier entityPath, final String removedCandidate,
+            final Collection<String> remainingCandidates) {
         this.entityPath = entityPath;
         this.removedCandidate = removedCandidate;
         this.remainingCandidates = remainingCandidates;
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.controller.cluster.datastore.entityownership.messages;
+package org.opendaylight.controller.cluster.entityownership.messages;
 
 import org.opendaylight.mdsal.eos.dom.api.DOMEntity;
 
@@ -17,7 +17,7 @@ import org.opendaylight.mdsal.eos.dom.api.DOMEntity;
 public class RegisterCandidateLocal {
     private final DOMEntity entity;
 
-    public RegisterCandidateLocal(DOMEntity entity) {
+    public RegisterCandidateLocal(final DOMEntity entity) {
         this.entity = entity;
     }
 
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.controller.cluster.datastore.entityownership.messages;
+package org.opendaylight.controller.cluster.entityownership.messages;
 
 import java.io.Serializable;
 import org.opendaylight.controller.cluster.access.concepts.MemberName;
@@ -20,7 +20,7 @@ public class RemoveAllCandidates implements Serializable {
 
     private final MemberName memberName;
 
-    public RemoveAllCandidates(MemberName memberName) {
+    public RemoveAllCandidates(final MemberName memberName) {
         this.memberName = memberName;
     }
 
@@ -5,12 +5,12 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.controller.cluster.datastore.entityownership.messages;
+package org.opendaylight.controller.cluster.entityownership.messages;
 
 import static java.util.Objects.requireNonNull;
 
 import java.util.Collection;
-import org.opendaylight.controller.cluster.datastore.entityownership.selectionstrategy.EntityOwnerSelectionStrategy;
+import org.opendaylight.controller.cluster.entityownership.selectionstrategy.EntityOwnerSelectionStrategy;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
 /**
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.controller.cluster.datastore.entityownership.messages;
+package org.opendaylight.controller.cluster.entityownership.messages;
 
 import org.opendaylight.mdsal.eos.dom.api.DOMEntity;
 
@@ -17,7 +17,7 @@ import org.opendaylight.mdsal.eos.dom.api.DOMEntity;
 public class UnregisterCandidateLocal {
     private final DOMEntity entity;
 
-    public UnregisterCandidateLocal(DOMEntity entity) {
+    public UnregisterCandidateLocal(final DOMEntity entity) {
         this.entity = entity;
     }
 
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.controller.cluster.datastore.entityownership.messages;
+package org.opendaylight.controller.cluster.entityownership.messages;
 
 import org.opendaylight.mdsal.eos.dom.api.DOMEntityOwnershipListener;
 
@@ -18,7 +18,7 @@ public class UnregisterListenerLocal {
     private final DOMEntityOwnershipListener listener;
     private final String entityType;
 
-    public UnregisterListenerLocal(DOMEntityOwnershipListener listener, String entityType) {
+    public UnregisterListenerLocal(final DOMEntityOwnershipListener listener, final String entityType) {
         this.listener = listener;
         this.entityType = entityType;
     }
@@ -5,8 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
-package org.opendaylight.controller.cluster.datastore.entityownership.selectionstrategy;
+package org.opendaylight.controller.cluster.entityownership.selectionstrategy;
 
 import java.util.Map;
 
@@ -15,7 +14,8 @@ public abstract class AbstractEntityOwnerSelectionStrategy implements EntityOwne
     private final long selectionDelayInMillis;
     private final Map<String, Long> initialStatistics;
 
-    protected AbstractEntityOwnerSelectionStrategy(long selectionDelayInMillis, Map<String, Long> initialStatistics) {
+    protected AbstractEntityOwnerSelectionStrategy(final long selectionDelayInMillis,
+            final Map<String, Long> initialStatistics) {
         this.selectionDelayInMillis = selectionDelayInMillis;
         this.initialStatistics = initialStatistics;
     }
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.controller.cluster.datastore.entityownership.selectionstrategy;
+package org.opendaylight.controller.cluster.entityownership.selectionstrategy;
 
 import java.util.Collection;
 import org.eclipse.jdt.annotation.Nullable;
@@ -22,7 +22,6 @@ public interface EntityOwnerSelectionStrategy {
      */
     long getSelectionDelayInMillis();
 
-
     /**
      * Selects a new owner from the list of viable candidates.
      *
@@ -5,8 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
-package org.opendaylight.controller.cluster.datastore.entityownership.selectionstrategy;
+package org.opendaylight.controller.cluster.entityownership.selectionstrategy;
 
 import java.lang.reflect.InvocationTargetException;
 import java.util.HashMap;
@@ -5,13 +5,12 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
-package org.opendaylight.controller.cluster.datastore.entityownership.selectionstrategy;
+package org.opendaylight.controller.cluster.entityownership.selectionstrategy;
 
 import com.google.common.base.Preconditions;
 import java.util.Map;
 import java.util.Map.Entry;
-import org.opendaylight.controller.cluster.datastore.entityownership.selectionstrategy.EntityOwnerSelectionStrategyConfig.Builder;
+import org.opendaylight.controller.cluster.entityownership.selectionstrategy.EntityOwnerSelectionStrategyConfig.Builder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -5,8 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
-package org.opendaylight.controller.cluster.datastore.entityownership.selectionstrategy;
+package org.opendaylight.controller.cluster.entityownership.selectionstrategy;
 
 import com.google.common.base.Preconditions;
 import java.util.Collection;
@@ -21,12 +20,13 @@ public class FirstCandidateSelectionStrategy extends AbstractEntityOwnerSelectio
     public static final FirstCandidateSelectionStrategy INSTANCE =
             new FirstCandidateSelectionStrategy(0L, Collections.emptyMap());
 
-    public FirstCandidateSelectionStrategy(long selectionDelayInMillis, Map<String, Long> initialStatistics) {
+    public FirstCandidateSelectionStrategy(final long selectionDelayInMillis,
+            final Map<String, Long> initialStatistics) {
         super(selectionDelayInMillis, initialStatistics);
     }
 
     @Override
-    public String newOwner(String currentOwner, Collection<String> viableCandidates) {
+    public String newOwner(final String currentOwner, final Collection<String> viableCandidates) {
         Preconditions.checkArgument(viableCandidates.size() > 0, "No viable candidates provided");
         return viableCandidates.iterator().next();
     }
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.controller.cluster.datastore.entityownership.selectionstrategy;
+package org.opendaylight.controller.cluster.entityownership.selectionstrategy;
 
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.MoreObjects;
@@ -22,14 +22,15 @@ import java.util.Map;
 public class LeastLoadedCandidateSelectionStrategy extends AbstractEntityOwnerSelectionStrategy {
     private final Map<String, Long> localStatistics = new HashMap<>();
 
-    protected LeastLoadedCandidateSelectionStrategy(long selectionDelayInMillis, Map<String, Long> initialStatistics) {
+    protected LeastLoadedCandidateSelectionStrategy(final long selectionDelayInMillis,
+            final Map<String, Long> initialStatistics) {
         super(selectionDelayInMillis, initialStatistics);
 
         localStatistics.putAll(initialStatistics);
     }
 
     @Override
-    public String newOwner(String currentOwner, Collection<String> viableCandidates) {
+    public String newOwner(final String currentOwner, final Collection<String> viableCandidates) {
         Preconditions.checkArgument(viableCandidates.size() > 0);
         String leastLoadedCandidate = null;
         long leastLoadedCount = Long.MAX_VALUE;
diff --git a/opendaylight/md-sal/sal-distributed-eos/src/main/resources/OSGI-INF/blueprint/distributed-eos.xml b/opendaylight/md-sal/sal-distributed-eos/src/main/resources/OSGI-INF/blueprint/distributed-eos.xml
new file mode 100644 (file)
index 0000000..aeb10b5
--- /dev/null
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+           xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+           xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.2.0">
+
+  <!-- Distributed EntityOwnershipService -->
+  <cm:cm-properties id="strategiesProps" persistent-id="org.opendaylight.controller.cluster.entity.owner.selection.strategies" />
+
+  <reference id="operDatastore" interface="org.opendaylight.controller.cluster.datastore.DistributedDataStoreInterface" odl:type="distributed-operational"/>
+
+  <bean id="selectionStrategyConfig" class="org.opendaylight.controller.cluster.entityownership.selectionstrategy.EntityOwnerSelectionStrategyConfigReader"
+          factory-method="loadStrategyWithConfig">
+    <argument ref="strategiesProps"/>
+  </bean>
+
+  <bean id="distributedEntityOwnershipService" class="org.opendaylight.controller.cluster.entityownership.DistributedEntityOwnershipService"
+          factory-method="start" destroy-method="close">
+    <argument>
+      <bean factory-ref="operDatastore" factory-method="getActorUtils"/>
+    </argument>
+    <argument ref="selectionStrategyConfig"/>
+  </bean>
+
+  <service ref="distributedEntityOwnershipService" interface="org.opendaylight.mdsal.eos.dom.api.DOMEntityOwnershipService"
+        odl:type="default"/>
+</blueprint>
@@ -5,20 +5,20 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.controller.cluster.datastore.entityownership;
+package org.opendaylight.controller.cluster.entityownership;
 
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 import static org.mockito.ArgumentMatchers.argThat;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.CANDIDATE_NAME_QNAME;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.ENTITY_ID_QNAME;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.ENTITY_OWNERS_PATH;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.ENTITY_OWNER_QNAME;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.ENTITY_QNAME;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.ENTITY_TYPE_QNAME;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.candidatePath;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.entityPath;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.CANDIDATE_NAME_QNAME;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.ENTITY_ID_QNAME;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.ENTITY_OWNERS_PATH;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.ENTITY_OWNER_QNAME;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.ENTITY_QNAME;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.ENTITY_TYPE_QNAME;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.candidatePath;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.entityPath;
 
 import akka.pattern.Patterns;
 import akka.testkit.TestActorRef;
@@ -5,13 +5,13 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.controller.cluster.datastore.entityownership;
+package org.opendaylight.controller.cluster.entityownership;
 
 import static org.junit.Assert.assertEquals;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.ENTITY_OWNERS_PATH;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.candidatePath;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.entityOwnersWithCandidate;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.entityPath;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.ENTITY_OWNERS_PATH;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.candidatePath;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.entityOwnersWithCandidate;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.entityPath;
 
 import akka.testkit.javadsl.TestKit;
 import com.google.common.collect.ImmutableSet;
@@ -23,9 +23,8 @@ import org.mockito.MockitoAnnotations;
 import org.opendaylight.controller.cluster.datastore.AbstractActorTest;
 import org.opendaylight.controller.cluster.datastore.Shard;
 import org.opendaylight.controller.cluster.datastore.ShardDataTree;
-import org.opendaylight.controller.cluster.datastore.entityownership.messages.CandidateAdded;
-import org.opendaylight.controller.cluster.datastore.entityownership.messages.CandidateRemoved;
-import org.opendaylight.controller.md.cluster.datastore.model.SchemaContextHelper;
+import org.opendaylight.controller.cluster.entityownership.messages.CandidateAdded;
+import org.opendaylight.controller.cluster.entityownership.messages.CandidateRemoved;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
@@ -52,7 +51,7 @@ public class CandidateListChangeListenerTest extends AbstractActorTest {
     @Before
     public void setup() {
         MockitoAnnotations.initMocks(this);
-        shardDataTree = new ShardDataTree(mockShard, SchemaContextHelper.entityOwners(), TreeType.OPERATIONAL);
+        shardDataTree = new ShardDataTree(mockShard, EOSTestUtils.SCHEMA_CONTEXT, TreeType.OPERATIONAL);
     }
 
     @Test
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.controller.cluster.datastore.entityownership;
+package org.opendaylight.controller.cluster.entityownership;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
@@ -18,10 +18,10 @@ import static org.mockito.Mockito.reset;
 import static org.mockito.Mockito.timeout;
 import static org.mockito.Mockito.verify;
 import static org.opendaylight.controller.cluster.datastore.MemberNode.verifyRaftState;
-import static org.opendaylight.controller.cluster.datastore.entityownership.AbstractEntityOwnershipTest.ownershipChange;
-import static org.opendaylight.controller.cluster.datastore.entityownership.DistributedEntityOwnershipService.ENTITY_OWNERSHIP_SHARD_NAME;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.CANDIDATE_NAME_NODE_ID;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.entityPath;
+import static org.opendaylight.controller.cluster.entityownership.AbstractEntityOwnershipTest.ownershipChange;
+import static org.opendaylight.controller.cluster.entityownership.DistributedEntityOwnershipService.ENTITY_OWNERSHIP_SHARD_NAME;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.CANDIDATE_NAME_NODE_ID;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.entityPath;
 
 import akka.actor.ActorRef;
 import akka.actor.Status.Failure;
@@ -52,13 +52,12 @@ import org.opendaylight.controller.cluster.datastore.AbstractDataStore;
 import org.opendaylight.controller.cluster.datastore.DatastoreContext;
 import org.opendaylight.controller.cluster.datastore.IntegrationTestKit;
 import org.opendaylight.controller.cluster.datastore.MemberNode;
-import org.opendaylight.controller.cluster.datastore.entityownership.selectionstrategy.EntityOwnerSelectionStrategyConfig;
 import org.opendaylight.controller.cluster.datastore.messages.AddShardReplica;
 import org.opendaylight.controller.cluster.datastore.messages.ChangeShardMembersVotingStatus;
+import org.opendaylight.controller.cluster.entityownership.selectionstrategy.EntityOwnerSelectionStrategyConfig;
 import org.opendaylight.controller.cluster.raft.policy.DisableElectionsRaftPolicy;
 import org.opendaylight.controller.cluster.raft.utils.InMemoryJournal;
 import org.opendaylight.controller.cluster.raft.utils.InMemorySnapshotStore;
-import org.opendaylight.controller.md.cluster.datastore.model.SchemaContextHelper;
 import org.opendaylight.mdsal.eos.common.api.EntityOwnershipState;
 import org.opendaylight.mdsal.eos.dom.api.DOMEntity;
 import org.opendaylight.mdsal.eos.dom.api.DOMEntityOwnershipCandidateRegistration;
@@ -69,7 +68,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controll
 import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
 import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import scala.concurrent.Await;
 import scala.concurrent.Future;
 import scala.concurrent.duration.FiniteDuration;
@@ -90,8 +88,6 @@ public class DistributedEntityOwnershipIntegrationTest {
     private static final DOMEntity ENTITY2 = new DOMEntity(ENTITY_TYPE1, "entity2");
     private static final DOMEntity ENTITY3 = new DOMEntity(ENTITY_TYPE1, "entity3");
     private static final DOMEntity ENTITY4 = new DOMEntity(ENTITY_TYPE1, "entity4");
-    private static final SchemaContext SCHEMA_CONTEXT = SchemaContextHelper.entityOwners();
-
     private final DatastoreContext.Builder leaderDatastoreContextBuilder =
             DatastoreContext.newBuilder().shardHeartbeatIntervalInMillis(100).shardElectionTimeoutFactor(5)
                     .shardIsolatedLeaderCheckIntervalInMillis(1000000);
@@ -137,16 +133,16 @@ public class DistributedEntityOwnershipIntegrationTest {
     public void testFunctionalityWithThreeNodes() throws Exception {
         String name = "testFunctionalityWithThreeNodes";
         MemberNode leaderNode = MemberNode.builder(memberNodes).akkaConfig("Member1").testName(name)
-                .moduleShardsConfig(MODULE_SHARDS_CONFIG).schemaContext(SCHEMA_CONTEXT).createOperDatastore(false)
-                .datastoreContextBuilder(leaderDatastoreContextBuilder).build();
+                .moduleShardsConfig(MODULE_SHARDS_CONFIG).schemaContext(EOSTestUtils.SCHEMA_CONTEXT)
+                .createOperDatastore(false).datastoreContextBuilder(leaderDatastoreContextBuilder).build();
 
         MemberNode follower1Node = MemberNode.builder(memberNodes).akkaConfig("Member2").testName(name)
-                .moduleShardsConfig(MODULE_SHARDS_CONFIG).schemaContext(SCHEMA_CONTEXT).createOperDatastore(false)
-                .datastoreContextBuilder(followerDatastoreContextBuilder).build();
+                .moduleShardsConfig(MODULE_SHARDS_CONFIG).schemaContext(EOSTestUtils.SCHEMA_CONTEXT)
+                .createOperDatastore(false).datastoreContextBuilder(followerDatastoreContextBuilder).build();
 
         MemberNode follower2Node = MemberNode.builder(memberNodes).akkaConfig("Member3").testName(name)
-                .moduleShardsConfig(MODULE_SHARDS_CONFIG).schemaContext(SCHEMA_CONTEXT).createOperDatastore(false)
-                .datastoreContextBuilder(followerDatastoreContextBuilder).build();
+                .moduleShardsConfig(MODULE_SHARDS_CONFIG).schemaContext(EOSTestUtils.SCHEMA_CONTEXT)
+                .createOperDatastore(false).datastoreContextBuilder(followerDatastoreContextBuilder).build();
 
         AbstractDataStore leaderDistributedDataStore = leaderNode.configDataStore();
 
@@ -280,16 +276,16 @@ public class DistributedEntityOwnershipIntegrationTest {
 
         String name = "testLeaderEntityOwnersReassignedAfterShutdown";
         MemberNode leaderNode = MemberNode.builder(memberNodes).akkaConfig("Member1").testName(name)
-                .moduleShardsConfig(MODULE_SHARDS_CONFIG).schemaContext(SCHEMA_CONTEXT).createOperDatastore(false)
-                .datastoreContextBuilder(leaderDatastoreContextBuilder).build();
+                .moduleShardsConfig(MODULE_SHARDS_CONFIG).schemaContext(EOSTestUtils.SCHEMA_CONTEXT)
+                .createOperDatastore(false).datastoreContextBuilder(leaderDatastoreContextBuilder).build();
 
         MemberNode follower1Node = MemberNode.builder(memberNodes).akkaConfig("Member2").testName(name)
-                .moduleShardsConfig(MODULE_SHARDS_CONFIG).schemaContext(SCHEMA_CONTEXT).createOperDatastore(false)
-                .datastoreContextBuilder(followerDatastoreContextBuilder).build();
+                .moduleShardsConfig(MODULE_SHARDS_CONFIG).schemaContext(EOSTestUtils.SCHEMA_CONTEXT)
+                .createOperDatastore(false).datastoreContextBuilder(followerDatastoreContextBuilder).build();
 
         MemberNode follower2Node = MemberNode.builder(memberNodes).akkaConfig("Member3").testName(name)
-                .moduleShardsConfig(MODULE_SHARDS_CONFIG).schemaContext(SCHEMA_CONTEXT).createOperDatastore(false)
-                .datastoreContextBuilder(followerDatastoreContextBuilder).build();
+                .moduleShardsConfig(MODULE_SHARDS_CONFIG).schemaContext(EOSTestUtils.SCHEMA_CONTEXT)
+                .createOperDatastore(false).datastoreContextBuilder(followerDatastoreContextBuilder).build();
 
         AbstractDataStore leaderDistributedDataStore = leaderNode.configDataStore();
 
@@ -363,27 +359,27 @@ public class DistributedEntityOwnershipIntegrationTest {
         String name = "testLeaderAndFollowerEntityOwnersReassignedAfterShutdown";
         final MemberNode leaderNode = MemberNode.builder(memberNodes).akkaConfig("Member1")
                 .useAkkaArtery(false).testName(name)
-                .moduleShardsConfig(MODULE_SHARDS_5_NODE_CONFIG).schemaContext(SCHEMA_CONTEXT)
+                .moduleShardsConfig(MODULE_SHARDS_5_NODE_CONFIG).schemaContext(EOSTestUtils.SCHEMA_CONTEXT)
                 .createOperDatastore(false).datastoreContextBuilder(leaderDatastoreContextBuilder).build();
 
         final MemberNode follower1Node = MemberNode.builder(memberNodes).akkaConfig("Member2")
                 .useAkkaArtery(false).testName(name)
-                .moduleShardsConfig(MODULE_SHARDS_5_NODE_CONFIG).schemaContext(SCHEMA_CONTEXT)
+                .moduleShardsConfig(MODULE_SHARDS_5_NODE_CONFIG).schemaContext(EOSTestUtils.SCHEMA_CONTEXT)
                 .createOperDatastore(false).datastoreContextBuilder(followerDatastoreContextBuilder).build();
 
         final MemberNode follower2Node = MemberNode.builder(memberNodes).akkaConfig("Member3")
                 .useAkkaArtery(false).testName(name)
-                .moduleShardsConfig(MODULE_SHARDS_5_NODE_CONFIG).schemaContext(SCHEMA_CONTEXT)
+                .moduleShardsConfig(MODULE_SHARDS_5_NODE_CONFIG).schemaContext(EOSTestUtils.SCHEMA_CONTEXT)
                 .createOperDatastore(false).datastoreContextBuilder(followerDatastoreContextBuilder).build();
 
         final MemberNode follower3Node = MemberNode.builder(memberNodes).akkaConfig("Member4")
                 .useAkkaArtery(false).testName(name)
-                .moduleShardsConfig(MODULE_SHARDS_5_NODE_CONFIG).schemaContext(SCHEMA_CONTEXT)
+                .moduleShardsConfig(MODULE_SHARDS_5_NODE_CONFIG).schemaContext(EOSTestUtils.SCHEMA_CONTEXT)
                 .createOperDatastore(false).datastoreContextBuilder(followerDatastoreContextBuilder).build();
 
         final MemberNode follower4Node = MemberNode.builder(memberNodes).akkaConfig("Member5")
                 .useAkkaArtery(false).testName(name)
-                .moduleShardsConfig(MODULE_SHARDS_5_NODE_CONFIG).schemaContext(SCHEMA_CONTEXT)
+                .moduleShardsConfig(MODULE_SHARDS_5_NODE_CONFIG).schemaContext(EOSTestUtils.SCHEMA_CONTEXT)
                 .createOperDatastore(false).datastoreContextBuilder(followerDatastoreContextBuilder).build();
 
         AbstractDataStore leaderDistributedDataStore = leaderNode.configDataStore();
@@ -480,16 +476,16 @@ public class DistributedEntityOwnershipIntegrationTest {
     public void testCloseCandidateRegistrationInQuickSuccession() throws Exception {
         String name = "testCloseCandidateRegistrationInQuickSuccession";
         MemberNode leaderNode = MemberNode.builder(memberNodes).akkaConfig("Member1").testName(name)
-                .moduleShardsConfig(MODULE_SHARDS_CONFIG).schemaContext(SCHEMA_CONTEXT).createOperDatastore(false)
-                .datastoreContextBuilder(leaderDatastoreContextBuilder).build();
+                .moduleShardsConfig(MODULE_SHARDS_CONFIG).schemaContext(EOSTestUtils.SCHEMA_CONTEXT)
+                .createOperDatastore(false).datastoreContextBuilder(leaderDatastoreContextBuilder).build();
 
         MemberNode follower1Node = MemberNode.builder(memberNodes).akkaConfig("Member2").testName(name)
-                .moduleShardsConfig(MODULE_SHARDS_CONFIG).schemaContext(SCHEMA_CONTEXT).createOperDatastore(false)
-                .datastoreContextBuilder(followerDatastoreContextBuilder).build();
+                .moduleShardsConfig(MODULE_SHARDS_CONFIG).schemaContext(EOSTestUtils.SCHEMA_CONTEXT)
+                .createOperDatastore(false).datastoreContextBuilder(followerDatastoreContextBuilder).build();
 
         MemberNode follower2Node = MemberNode.builder(memberNodes).akkaConfig("Member3").testName(name)
-                .moduleShardsConfig(MODULE_SHARDS_CONFIG).schemaContext(SCHEMA_CONTEXT).createOperDatastore(false)
-                .datastoreContextBuilder(followerDatastoreContextBuilder).build();
+                .moduleShardsConfig(MODULE_SHARDS_CONFIG).schemaContext(EOSTestUtils.SCHEMA_CONTEXT)
+                .createOperDatastore(false).datastoreContextBuilder(followerDatastoreContextBuilder).build();
 
         AbstractDataStore leaderDistributedDataStore = leaderNode.configDataStore();
 
@@ -562,7 +558,8 @@ public class DistributedEntityOwnershipIntegrationTest {
         assertTrue("No ownership change message was sent with hasOwner=false", passed);
     }
 
-    private static Optional<DOMEntityOwnershipChange> getValueSafely(ArgumentCaptor<DOMEntityOwnershipChange> captor) {
+    private static Optional<DOMEntityOwnershipChange> getValueSafely(
+            final ArgumentCaptor<DOMEntityOwnershipChange> captor) {
         try {
             return Optional.ofNullable(captor.getValue());
         } catch (MockitoException e) {
@@ -581,8 +578,8 @@ public class DistributedEntityOwnershipIntegrationTest {
         String name = "testEntityOwnershipShardBootstrapping";
         String moduleShardsConfig = MODULE_SHARDS_MEMBER_1_CONFIG;
         MemberNode leaderNode = MemberNode.builder(memberNodes).akkaConfig("Member1").testName(name)
-                .moduleShardsConfig(moduleShardsConfig).schemaContext(SCHEMA_CONTEXT).createOperDatastore(false)
-                .datastoreContextBuilder(leaderDatastoreContextBuilder).build();
+                .moduleShardsConfig(moduleShardsConfig).schemaContext(EOSTestUtils.SCHEMA_CONTEXT)
+                .createOperDatastore(false).datastoreContextBuilder(leaderDatastoreContextBuilder).build();
 
         AbstractDataStore leaderDistributedDataStore = leaderNode.configDataStore();
         final DOMEntityOwnershipService leaderEntityOwnershipService = newOwnershipService(leaderDistributedDataStore);
@@ -590,8 +587,8 @@ public class DistributedEntityOwnershipIntegrationTest {
         leaderNode.kit().waitUntilLeader(leaderNode.configDataStore().getActorUtils(), ENTITY_OWNERSHIP_SHARD_NAME);
 
         MemberNode follower1Node = MemberNode.builder(memberNodes).akkaConfig("Member2").testName(name)
-                .moduleShardsConfig(moduleShardsConfig).schemaContext(SCHEMA_CONTEXT).createOperDatastore(false)
-                .datastoreContextBuilder(followerDatastoreContextBuilder).build();
+                .moduleShardsConfig(moduleShardsConfig).schemaContext(EOSTestUtils.SCHEMA_CONTEXT)
+                .createOperDatastore(false).datastoreContextBuilder(followerDatastoreContextBuilder).build();
 
         AbstractDataStore follower1DistributedDataStore = follower1Node.configDataStore();
         follower1DistributedDataStore.waitTillReady();
@@ -632,8 +629,8 @@ public class DistributedEntityOwnershipIntegrationTest {
         follower1Node.cleanup();
 
         follower1Node = MemberNode.builder(memberNodes).akkaConfig("Member2").testName(name)
-                .moduleShardsConfig(moduleShardsConfig).schemaContext(SCHEMA_CONTEXT).createOperDatastore(false)
-                .datastoreContextBuilder(followerDatastoreContextBuilder).build();
+                .moduleShardsConfig(moduleShardsConfig).schemaContext(EOSTestUtils.SCHEMA_CONTEXT)
+                .createOperDatastore(false).datastoreContextBuilder(followerDatastoreContextBuilder).build();
         follower1EntityOwnershipService = newOwnershipService(follower1Node.configDataStore());
 
         follower1EntityOwnershipService.registerCandidate(ENTITY1);
@@ -651,16 +648,16 @@ public class DistributedEntityOwnershipIntegrationTest {
     public void testOwnerSelectedOnRapidUnregisteringAndRegisteringOfCandidates() throws Exception {
         String name = "testOwnerSelectedOnRapidUnregisteringAndRegisteringOfCandidates";
         MemberNode leaderNode = MemberNode.builder(memberNodes).akkaConfig("Member1").testName(name)
-                .moduleShardsConfig(MODULE_SHARDS_CONFIG).schemaContext(SCHEMA_CONTEXT).createOperDatastore(false)
-                .datastoreContextBuilder(leaderDatastoreContextBuilder).build();
+                .moduleShardsConfig(MODULE_SHARDS_CONFIG).schemaContext(EOSTestUtils.SCHEMA_CONTEXT)
+                .createOperDatastore(false).datastoreContextBuilder(leaderDatastoreContextBuilder).build();
 
         MemberNode follower1Node = MemberNode.builder(memberNodes).akkaConfig("Member2").testName(name)
-                .moduleShardsConfig(MODULE_SHARDS_CONFIG).schemaContext(SCHEMA_CONTEXT).createOperDatastore(false)
-                .datastoreContextBuilder(followerDatastoreContextBuilder).build();
+                .moduleShardsConfig(MODULE_SHARDS_CONFIG).schemaContext(EOSTestUtils.SCHEMA_CONTEXT)
+                .createOperDatastore(false).datastoreContextBuilder(followerDatastoreContextBuilder).build();
 
         MemberNode follower2Node = MemberNode.builder(memberNodes).akkaConfig("Member3").testName(name)
-                .moduleShardsConfig(MODULE_SHARDS_CONFIG).schemaContext(SCHEMA_CONTEXT).createOperDatastore(false)
-                .datastoreContextBuilder(followerDatastoreContextBuilder).build();
+                .moduleShardsConfig(MODULE_SHARDS_CONFIG).schemaContext(EOSTestUtils.SCHEMA_CONTEXT)
+                .createOperDatastore(false).datastoreContextBuilder(followerDatastoreContextBuilder).build();
 
         AbstractDataStore leaderDistributedDataStore = leaderNode.configDataStore();
 
@@ -694,16 +691,16 @@ public class DistributedEntityOwnershipIntegrationTest {
     public void testOwnerSelectedOnRapidRegisteringAndUnregisteringOfCandidates() throws Exception {
         String name = "testOwnerSelectedOnRapidRegisteringAndUnregisteringOfCandidates";
         MemberNode leaderNode = MemberNode.builder(memberNodes).akkaConfig("Member1").testName(name)
-                .moduleShardsConfig(MODULE_SHARDS_CONFIG).schemaContext(SCHEMA_CONTEXT).createOperDatastore(false)
-                .datastoreContextBuilder(leaderDatastoreContextBuilder).build();
+                .moduleShardsConfig(MODULE_SHARDS_CONFIG).schemaContext(EOSTestUtils.SCHEMA_CONTEXT)
+                .createOperDatastore(false).datastoreContextBuilder(leaderDatastoreContextBuilder).build();
 
         MemberNode follower1Node = MemberNode.builder(memberNodes).akkaConfig("Member2").testName(name)
-                .moduleShardsConfig(MODULE_SHARDS_CONFIG).schemaContext(SCHEMA_CONTEXT).createOperDatastore(false)
-                .datastoreContextBuilder(followerDatastoreContextBuilder).build();
+                .moduleShardsConfig(MODULE_SHARDS_CONFIG).schemaContext(EOSTestUtils.SCHEMA_CONTEXT)
+                .createOperDatastore(false).datastoreContextBuilder(followerDatastoreContextBuilder).build();
 
         MemberNode follower2Node = MemberNode.builder(memberNodes).akkaConfig("Member3").testName(name)
-                .moduleShardsConfig(MODULE_SHARDS_CONFIG).schemaContext(SCHEMA_CONTEXT).createOperDatastore(false)
-                .datastoreContextBuilder(followerDatastoreContextBuilder).build();
+                .moduleShardsConfig(MODULE_SHARDS_CONFIG).schemaContext(EOSTestUtils.SCHEMA_CONTEXT)
+                .createOperDatastore(false).datastoreContextBuilder(followerDatastoreContextBuilder).build();
 
         AbstractDataStore leaderDistributedDataStore = leaderNode.configDataStore();
 
@@ -741,27 +738,27 @@ public class DistributedEntityOwnershipIntegrationTest {
         String name = "testEntityOwnershipWithNonVotingMembers";
         final MemberNode member1LeaderNode = MemberNode.builder(memberNodes).akkaConfig("Member1")
                 .useAkkaArtery(false).testName(name)
-                .moduleShardsConfig(MODULE_SHARDS_5_NODE_CONFIG).schemaContext(SCHEMA_CONTEXT)
+                .moduleShardsConfig(MODULE_SHARDS_5_NODE_CONFIG).schemaContext(EOSTestUtils.SCHEMA_CONTEXT)
                 .createOperDatastore(false).datastoreContextBuilder(leaderDatastoreContextBuilder).build();
 
         final MemberNode member2FollowerNode = MemberNode.builder(memberNodes).akkaConfig("Member2")
                 .useAkkaArtery(false).testName(name)
-                .moduleShardsConfig(MODULE_SHARDS_5_NODE_CONFIG).schemaContext(SCHEMA_CONTEXT)
+                .moduleShardsConfig(MODULE_SHARDS_5_NODE_CONFIG).schemaContext(EOSTestUtils.SCHEMA_CONTEXT)
                 .createOperDatastore(false).datastoreContextBuilder(followerDatastoreContextBuilder).build();
 
         final MemberNode member3FollowerNode = MemberNode.builder(memberNodes).akkaConfig("Member3")
                 .useAkkaArtery(false).testName(name)
-                .moduleShardsConfig(MODULE_SHARDS_5_NODE_CONFIG).schemaContext(SCHEMA_CONTEXT)
+                .moduleShardsConfig(MODULE_SHARDS_5_NODE_CONFIG).schemaContext(EOSTestUtils.SCHEMA_CONTEXT)
                 .createOperDatastore(false).datastoreContextBuilder(followerDatastoreContextBuilder).build();
 
         final MemberNode member4FollowerNode = MemberNode.builder(memberNodes).akkaConfig("Member4")
                 .useAkkaArtery(false).testName(name)
-                .moduleShardsConfig(MODULE_SHARDS_5_NODE_CONFIG).schemaContext(SCHEMA_CONTEXT)
+                .moduleShardsConfig(MODULE_SHARDS_5_NODE_CONFIG).schemaContext(EOSTestUtils.SCHEMA_CONTEXT)
                 .createOperDatastore(false).datastoreContextBuilder(followerDatastoreContextBuilder).build();
 
         final MemberNode member5FollowerNode = MemberNode.builder(memberNodes).akkaConfig("Member5")
                 .useAkkaArtery(false).testName(name)
-                .moduleShardsConfig(MODULE_SHARDS_5_NODE_CONFIG).schemaContext(SCHEMA_CONTEXT)
+                .moduleShardsConfig(MODULE_SHARDS_5_NODE_CONFIG).schemaContext(EOSTestUtils.SCHEMA_CONTEXT)
                 .createOperDatastore(false).datastoreContextBuilder(followerDatastoreContextBuilder).build();
 
         AbstractDataStore leaderDistributedDataStore = member1LeaderNode.configDataStore();
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.controller.cluster.datastore.entityownership;
+package org.opendaylight.controller.cluster.entityownership;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -18,15 +18,15 @@ import static org.mockito.Mockito.reset;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.ENTITY_ID_QNAME;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.ENTITY_OWNERS_PATH;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.ENTITY_QNAME;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.candidatePath;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.entityEntryWithOwner;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.entityOwnersWithCandidate;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.entityOwnersWithEntityTypeEntry;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.entityPath;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.entityTypeEntryWithEntityEntry;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.ENTITY_ID_QNAME;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.ENTITY_OWNERS_PATH;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.ENTITY_QNAME;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.candidatePath;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.entityEntryWithOwner;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.entityOwnersWithCandidate;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.entityOwnersWithEntityTypeEntry;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.entityPath;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.entityTypeEntryWithEntityEntry;
 
 import akka.actor.ActorRef;
 import com.google.common.collect.Sets;
@@ -48,13 +48,12 @@ import org.opendaylight.controller.cluster.datastore.ShardDataTree;
 import org.opendaylight.controller.cluster.datastore.config.Configuration;
 import org.opendaylight.controller.cluster.datastore.config.ConfigurationImpl;
 import org.opendaylight.controller.cluster.datastore.config.EmptyModuleShardConfigProvider;
-import org.opendaylight.controller.cluster.datastore.entityownership.messages.RegisterCandidateLocal;
-import org.opendaylight.controller.cluster.datastore.entityownership.messages.RegisterListenerLocal;
-import org.opendaylight.controller.cluster.datastore.entityownership.messages.UnregisterCandidateLocal;
-import org.opendaylight.controller.cluster.datastore.entityownership.messages.UnregisterListenerLocal;
-import org.opendaylight.controller.cluster.datastore.entityownership.selectionstrategy.EntityOwnerSelectionStrategyConfig;
 import org.opendaylight.controller.cluster.datastore.utils.MockClusterWrapper;
-import org.opendaylight.controller.md.cluster.datastore.model.SchemaContextHelper;
+import org.opendaylight.controller.cluster.entityownership.messages.RegisterCandidateLocal;
+import org.opendaylight.controller.cluster.entityownership.messages.RegisterListenerLocal;
+import org.opendaylight.controller.cluster.entityownership.messages.UnregisterCandidateLocal;
+import org.opendaylight.controller.cluster.entityownership.messages.UnregisterListenerLocal;
+import org.opendaylight.controller.cluster.entityownership.selectionstrategy.EntityOwnerSelectionStrategyConfig;
 import org.opendaylight.mdsal.eos.common.api.CandidateAlreadyRegisteredException;
 import org.opendaylight.mdsal.eos.common.api.EntityOwnershipState;
 import org.opendaylight.mdsal.eos.dom.api.DOMEntity;
@@ -102,7 +101,7 @@ public class DistributedEntityOwnershipServiceTest extends AbstractClusterRefEnt
         dataStore = new DistributedDataStore(getSystem(), new MockClusterWrapper(), configuration,
                 mockContextFactory, null);
 
-        dataStore.onGlobalContextUpdated(SchemaContextHelper.entityOwners());
+        dataStore.onGlobalContextUpdated(EOSTestUtils.SCHEMA_CONTEXT);
     }
 
     @After
@@ -225,8 +224,7 @@ public class DistributedEntityOwnershipServiceTest extends AbstractClusterRefEnt
             dataStore.getActorUtils(), EntityOwnerSelectionStrategyConfig.newBuilder().build()));
 
         final Shard mockShard = Mockito.mock(Shard.class);
-        ShardDataTree shardDataTree = new ShardDataTree(mockShard, SchemaContextHelper.entityOwners(),
-            TreeType.OPERATIONAL);
+        ShardDataTree shardDataTree = new ShardDataTree(mockShard, EOSTestUtils.SCHEMA_CONTEXT, TreeType.OPERATIONAL);
 
         when(service.getLocalEntityOwnershipShardDataTree()).thenReturn(shardDataTree.getDataTree());
 
diff --git a/opendaylight/md-sal/sal-distributed-eos/src/test/java/org/opendaylight/controller/cluster/entityownership/EOSTestUtils.java b/opendaylight/md-sal/sal-distributed-eos/src/test/java/org/opendaylight/controller/cluster/entityownership/EOSTestUtils.java
new file mode 100644 (file)
index 0000000..118190a
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2019 PANTHEON.tech, s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.cluster.entityownership;
+
+import java.io.File;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
+
+final class EOSTestUtils {
+    static final SchemaContext SCHEMA_CONTEXT = YangParserTestUtils.parseYangFiles(
+        new File("src/main/yang/entity-owners.yang"));
+
+    private EOSTestUtils() {
+        // Hidden on purpose
+    }
+}
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.controller.cluster.datastore.entityownership;
+package org.opendaylight.controller.cluster.entityownership;
 
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.anyBoolean;
@@ -13,10 +13,10 @@ import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.reset;
 import static org.mockito.Mockito.verify;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.ENTITY_OWNERS_PATH;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.entityEntryWithOwner;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.entityOwnersWithCandidate;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.entityPath;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.ENTITY_OWNERS_PATH;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.entityEntryWithOwner;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.entityOwnersWithCandidate;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.entityPath;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -24,7 +24,6 @@ import org.mockito.Mockito;
 import org.opendaylight.controller.cluster.access.concepts.MemberName;
 import org.opendaylight.controller.cluster.datastore.Shard;
 import org.opendaylight.controller.cluster.datastore.ShardDataTree;
-import org.opendaylight.controller.md.cluster.datastore.model.SchemaContextHelper;
 import org.opendaylight.mdsal.eos.dom.api.DOMEntity;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
@@ -51,7 +50,7 @@ public class EntityOwnerChangeListenerTest {
 
     private final Shard mockShard = Mockito.mock(Shard.class);
 
-    private final ShardDataTree shardDataTree = new ShardDataTree(mockShard, SchemaContextHelper.entityOwners(),
+    private final ShardDataTree shardDataTree = new ShardDataTree(mockShard, EOSTestUtils.SCHEMA_CONTEXT,
         TreeType.OPERATIONAL);
     private final EntityOwnershipListenerSupport mockListenerSupport = mock(EntityOwnershipListenerSupport.class);
     private EntityOwnerChangeListener listener;
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.controller.cluster.datastore.entityownership;
+package org.opendaylight.controller.cluster.entityownership;
 
 import static org.junit.Assert.assertEquals;
 import static org.mockito.AdditionalMatchers.or;
@@ -44,19 +44,19 @@ import org.opendaylight.controller.cluster.access.concepts.MemberName;
 import org.opendaylight.controller.cluster.datastore.DatastoreContext;
 import org.opendaylight.controller.cluster.datastore.DatastoreContext.Builder;
 import org.opendaylight.controller.cluster.datastore.ShardTestKit;
-import org.opendaylight.controller.cluster.datastore.entityownership.messages.CandidateAdded;
-import org.opendaylight.controller.cluster.datastore.entityownership.messages.RegisterCandidateLocal;
-import org.opendaylight.controller.cluster.datastore.entityownership.messages.RegisterListenerLocal;
-import org.opendaylight.controller.cluster.datastore.entityownership.messages.UnregisterCandidateLocal;
-import org.opendaylight.controller.cluster.datastore.entityownership.messages.UnregisterListenerLocal;
-import org.opendaylight.controller.cluster.datastore.entityownership.selectionstrategy.EntityOwnerSelectionStrategyConfig;
-import org.opendaylight.controller.cluster.datastore.entityownership.selectionstrategy.LastCandidateSelectionStrategy;
 import org.opendaylight.controller.cluster.datastore.identifiers.ShardIdentifier;
 import org.opendaylight.controller.cluster.datastore.messages.BatchedModifications;
 import org.opendaylight.controller.cluster.datastore.messages.PeerAddressResolved;
 import org.opendaylight.controller.cluster.datastore.messages.PeerDown;
 import org.opendaylight.controller.cluster.datastore.messages.PeerUp;
 import org.opendaylight.controller.cluster.datastore.messages.SuccessReply;
+import org.opendaylight.controller.cluster.entityownership.messages.CandidateAdded;
+import org.opendaylight.controller.cluster.entityownership.messages.RegisterCandidateLocal;
+import org.opendaylight.controller.cluster.entityownership.messages.RegisterListenerLocal;
+import org.opendaylight.controller.cluster.entityownership.messages.UnregisterCandidateLocal;
+import org.opendaylight.controller.cluster.entityownership.messages.UnregisterListenerLocal;
+import org.opendaylight.controller.cluster.entityownership.selectionstrategy.EntityOwnerSelectionStrategyConfig;
+import org.opendaylight.controller.cluster.entityownership.selectionstrategy.LastCandidateSelectionStrategy;
 import org.opendaylight.controller.cluster.raft.RaftState;
 import org.opendaylight.controller.cluster.raft.TestActorFactory;
 import org.opendaylight.controller.cluster.raft.base.messages.ElectionTimeout;
@@ -64,13 +64,11 @@ import org.opendaylight.controller.cluster.raft.base.messages.TimeoutNow;
 import org.opendaylight.controller.cluster.raft.messages.AppendEntries;
 import org.opendaylight.controller.cluster.raft.messages.RequestVote;
 import org.opendaylight.controller.cluster.raft.utils.MessageCollectorActor;
-import org.opendaylight.controller.md.cluster.datastore.model.SchemaContextHelper;
 import org.opendaylight.mdsal.eos.dom.api.DOMEntity;
 import org.opendaylight.mdsal.eos.dom.api.DOMEntityOwnershipChange;
 import org.opendaylight.mdsal.eos.dom.api.DOMEntityOwnershipListener;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
 /**
  * Unit tests for EntityOwnershipShard.
@@ -89,7 +87,6 @@ public class EntityOwnershipShardTest extends AbstractEntityOwnershipTest {
             YangInstanceIdentifier.of(QName.create("test", "2015-08-14", "entity4"));
     private static final YangInstanceIdentifier ENTITY_ID5 =
             YangInstanceIdentifier.of(QName.create("test", "2015-08-14", "entity5"));
-    private static final SchemaContext SCHEMA_CONTEXT = SchemaContextHelper.entityOwners();
     private static final String LOCAL_MEMBER_NAME = "local-member-1";
     private static final String PEER_MEMBER_1_NAME = "peer-member-1";
     private static final String PEER_MEMBER_2_NAME = "peer-member-2";
@@ -1245,10 +1242,13 @@ public class EntityOwnershipShardTest extends AbstractEntityOwnershipTest {
 
     private EntityOwnershipShard.Builder newShardBuilder(final ShardIdentifier shardId, final Map<String, String> peers,
             final String memberName) {
-        return EntityOwnershipShard.newBuilder().id(shardId).peerAddresses(peers).datastoreContext(
-                dataStoreContextBuilder.build()).schemaContextProvider(() -> SCHEMA_CONTEXT).localMemberName(
-                        MemberName.forName(memberName)).ownerSelectionStrategyConfig(
-                                EntityOwnerSelectionStrategyConfig.newBuilder().build());
+        return EntityOwnershipShard.newBuilder()
+                .id(shardId)
+                .peerAddresses(peers)
+                .datastoreContext(dataStoreContextBuilder.build())
+                .schemaContextProvider(() -> EOSTestUtils.SCHEMA_CONTEXT)
+                .localMemberName(MemberName.forName(memberName))
+                .ownerSelectionStrategyConfig(EntityOwnerSelectionStrategyConfig.newBuilder().build());
     }
 
     private Map<String, String> peerMap(final String... peerIds) {
@@ -5,14 +5,13 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
-package org.opendaylight.controller.cluster.datastore.entityownership;
+package org.opendaylight.controller.cluster.entityownership;
 
 import static org.junit.Assert.assertEquals;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.ENTITY_OWNERS_PATH;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.entityEntryWithOwner;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.entityOwnersWithCandidate;
-import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.entityPath;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.ENTITY_OWNERS_PATH;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.entityEntryWithOwner;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.entityOwnersWithCandidate;
+import static org.opendaylight.controller.cluster.entityownership.EntityOwnersModel.entityPath;
 
 import java.util.Map;
 import org.junit.Before;
@@ -21,7 +20,6 @@ import org.mockito.Mockito;
 import org.opendaylight.controller.cluster.datastore.AbstractActorTest;
 import org.opendaylight.controller.cluster.datastore.Shard;
 import org.opendaylight.controller.cluster.datastore.ShardDataTree;
-import org.opendaylight.controller.md.cluster.datastore.model.SchemaContextHelper;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
@@ -40,7 +38,7 @@ public class EntityOwnershipStatisticsTest extends AbstractActorTest {
 
     private final Shard mockShard = Mockito.mock(Shard.class);
 
-    private final ShardDataTree shardDataTree = new ShardDataTree(mockShard, SchemaContextHelper.entityOwners(),
+    private final ShardDataTree shardDataTree = new ShardDataTree(mockShard, EOSTestUtils.SCHEMA_CONTEXT,
         TreeType.OPERATIONAL);
     private EntityOwnershipStatistics ownershipStatistics;
 
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.controller.cluster.datastore.entityownership.selectionstrategy;
+package org.opendaylight.controller.cluster.entityownership.selectionstrategy;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -15,22 +15,15 @@ import static org.junit.Assert.assertTrue;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
-import org.junit.Before;
 import org.junit.Test;
-import org.mockito.MockitoAnnotations;
 
 public class EntityOwnerSelectionStrategyConfigReaderTest {
 
-    @Before
-    public void setup() {
-        MockitoAnnotations.initMocks(this);
-    }
-
     @Test
     public void testReadStrategies() {
         final Map<Object, Object> props = new java.util.HashMap<>();
-        props.put("entity.type.test", "org.opendaylight.controller.cluster.datastore.entityownership."
-                + "selectionstrategy.LastCandidateSelectionStrategy,100");
+        props.put("entity.type.test",
+            "org.opendaylight.controller.cluster.entityownership.selectionstrategy.LastCandidateSelectionStrategy,100");
 
 
         final EntityOwnerSelectionStrategyConfig config = EntityOwnerSelectionStrategyConfigReader
@@ -72,8 +65,8 @@ public class EntityOwnerSelectionStrategyConfigReaderTest {
     @Test(expected = IllegalArgumentException.class)
     public void testReadStrategiesInvalidDelay() {
         final Map<Object, Object> props = new HashMap<>();
-        props.put("entity.type.test", "org.opendaylight.controller.cluster.datastore.entityownership."
-                + "selectionstrategy.LastCandidateSelectionStrategy,foo");
+        props.put("entity.type.test",
+            "org.opendaylight.controller.cluster.entityownership.selectionstrategy.LastCandidateSelectionStrategy,foo");
         EntityOwnerSelectionStrategyConfigReader.loadStrategyWithConfig(props);
     }
 
@@ -87,10 +80,10 @@ public class EntityOwnerSelectionStrategyConfigReaderTest {
     @Test
     public void testReadStrategiesMissingDelay() {
         final Map<Object, Object> props = new HashMap<>();
-        props.put("entity.type.test", "org.opendaylight.controller.cluster.datastore.entityownership."
-                + "selectionstrategy.LastCandidateSelectionStrategy,100");
-        props.put("entity.type.test1", "org.opendaylight.controller.cluster.datastore.entityownership."
-                + "selectionstrategy.LastCandidateSelectionStrategy");
+        props.put("entity.type.test",
+            "org.opendaylight.controller.cluster.entityownership.selectionstrategy.LastCandidateSelectionStrategy,100");
+        props.put("entity.type.test1",
+            "org.opendaylight.controller.cluster.entityownership.selectionstrategy.LastCandidateSelectionStrategy");
 
 
         final EntityOwnerSelectionStrategyConfig config = EntityOwnerSelectionStrategyConfigReader
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.controller.cluster.datastore.entityownership.selectionstrategy;
+package org.opendaylight.controller.cluster.entityownership.selectionstrategy;
 
 import static org.junit.Assert.assertEquals;
 

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.