BUG-7965 Switch distributed-data backend to a separate shard
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / test / java / org / opendaylight / controller / md / cluster / datastore / model / SchemaContextHelper.java
index 164f363573297f8c588336ca26b14e20b1f81501..4e906a4d157850b54e42cafeb2f5d181a3fda9bc 100644 (file)
@@ -10,6 +10,8 @@ package org.opendaylight.controller.md.cluster.datastore.model;
 
 import com.google.common.base.Throwables;
 import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.ArrayList;
@@ -46,6 +48,19 @@ public class SchemaContextHelper {
         }
     }
 
+    public static SchemaContext distributedShardedDOMDataTreeSchemaContext() {
+        final List<InputStream> streams = new ArrayList<>();
+        try {
+            // we need prefix-shard-configuration and odl-datastore-test models
+            // for DistributedShardedDOMDataTree tests
+            streams.add(getInputStream(ODL_DATASTORE_TEST_YANG));
+            streams.add(new FileInputStream("src/main/yang/prefix-shard-configuration.yang"));
+            return YangParserTestUtils.parseYangStreams(streams);
+        } catch (FileNotFoundException | ReactorException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
     public static SchemaContext entityOwners() {
         try {
             return YangParserTestUtils.parseYangSources(new File("src/main/yang/entity-owners.yang"));