Adjust unit test to YangModuleInfo API change 22/70222/1
authorRobert Varga <robert.varga@pantheon.tech>
Sat, 31 Mar 2018 13:06:00 +0000 (15:06 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Sat, 31 Mar 2018 13:06:00 +0000 (15:06 +0200)
YangModuleInfo has better interface, hence we can take advantage
of it.

Change-Id: I971bd0bd9fe521b63bb0133fdac3a1b1a30504a7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/DOMRpcServiceTestBugfix560.java

index 4b10353..041c207 100644 (file)
@@ -12,12 +12,9 @@ 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.concurrent.ExecutionException;
 import java.util.concurrent.Future;
 import org.junit.After;
@@ -44,7 +41,6 @@ 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;
@@ -98,14 +94,9 @@ public class DOMRpcServiceTestBugfix560 {
         assertNotNull(moduleInfo);
 
         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();
-                }
-            }));
+            YangTextSchemaSource.delegateForByteSource(RevisionSourceIdentifier.create(
+                    moduleInfo.getName().getLocalName(), moduleInfo.getName().getRevision()),
+                moduleInfo.getYangTextByteSource()));
     }
 
     private static org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier createBITllIdentifier(

©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.