Adjust to yangtools-2.0.0 changes
[controller.git] / opendaylight / md-sal / sal-binding-dom-it / src / test / java / org / opendaylight / controller / sal / binding / test / connect / dom / DOMRpcServiceTestBugfix560.java
index c7399e89f0503fcaa1ceaa630c1a406a9f82d9e8..4b10353caab032c4b1a5569af4c475e6b26ffd2e 100644 (file)
@@ -12,12 +12,12 @@ import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 import com.google.common.base.Optional;
+import com.google.common.io.ByteSource;
 import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.MoreExecutors;
+import java.io.IOException;
 import java.io.InputStream;
-import java.util.Collections;
-import java.util.List;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
 import org.junit.After;
@@ -41,12 +41,17 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controll
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.two.level.list.TopLevelListKey;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.binding.YangModuleInfo;
 import org.opendaylight.yangtools.yang.binding.util.BindingReflections;
 import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.common.Revision;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
+import org.opendaylight.yangtools.yang.model.repo.api.RevisionSourceIdentifier;
+import org.opendaylight.yangtools.yang.model.repo.api.StatementParserMode;
+import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource;
 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
 
 /**
@@ -89,13 +94,18 @@ public class DOMRpcServiceTestBugfix560 {
         bindingMountPointService = testContext.getBindingMountPointService();
         assertNotNull(domMountPointService);
 
-        final InputStream moduleStream = BindingReflections.getModuleInfo(
-                OpendaylightTestRpcServiceService.class)
-                .getModuleSourceStream();
+        final YangModuleInfo moduleInfo = BindingReflections.getModuleInfo(OpendaylightTestRpcServiceService.class);
+        assertNotNull(moduleInfo);
 
-        assertNotNull(moduleStream);
-        final List<InputStream> rpcModels = Collections.singletonList(moduleStream);
-        schemaContext = YangParserTestUtils.parseYangStreams(rpcModels);
+        schemaContext = YangParserTestUtils.parseYangSources(StatementParserMode.DEFAULT_MODE, null,
+            YangTextSchemaSource.delegateForByteSource(RevisionSourceIdentifier.create(moduleInfo.getName(),
+                Revision.ofNullable(moduleInfo.getRevision())), new ByteSource() {
+
+                @Override
+                public InputStream openStream() throws IOException {
+                    return moduleInfo.getModuleSourceStream();
+                }
+            }));
     }
 
     private static org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier createBITllIdentifier(