Bump upstreams
[netconf.git] / restconf / restconf-nb / src / test / java / org / opendaylight / restconf / nb / jaxrs / RestconfSchemaServiceTest.java
index 24ed46264f0e8fce7ff3949b28b01172d54e62ab..822f5ec60a86cd50c2b848b86c180a6c1fe5f0e2 100644 (file)
@@ -9,13 +9,15 @@ package org.opendaylight.restconf.nb.jaxrs;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertSame;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.doCallRealMethod;
 import static org.mockito.Mockito.doReturn;
 import static org.opendaylight.restconf.nb.jaxrs.AbstractRestconfTest.assertEntity;
 import static org.opendaylight.restconf.nb.jaxrs.AbstractRestconfTest.assertError;
 
-import com.google.common.collect.ImmutableClassToInstanceMap;
 import com.google.common.util.concurrent.Futures;
 import java.io.Reader;
+import java.util.List;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -26,14 +28,14 @@ import org.opendaylight.mdsal.dom.api.DOMDataBroker;
 import org.opendaylight.mdsal.dom.api.DOMMountPointService;
 import org.opendaylight.mdsal.dom.api.DOMRpcService;
 import org.opendaylight.mdsal.dom.api.DOMSchemaService;
-import org.opendaylight.mdsal.dom.api.DOMYangTextSourceProvider;
+import org.opendaylight.mdsal.dom.api.DOMSchemaService.YangTextSourceExtension;
 import org.opendaylight.restconf.server.mdsal.MdsalRestconfServer;
 import org.opendaylight.yangtools.yang.common.ErrorTag;
 import org.opendaylight.yangtools.yang.common.ErrorType;
 import org.opendaylight.yangtools.yang.common.Revision;
 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
-import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
-import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource;
+import org.opendaylight.yangtools.yang.model.api.source.SourceIdentifier;
+import org.opendaylight.yangtools.yang.model.api.source.YangTextSource;
 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
 
 /**
@@ -48,7 +50,7 @@ public class RestconfSchemaServiceTest {
     @Mock
     private DOMSchemaService schemaService;
     @Mock
-    private DOMYangTextSourceProvider sourceProvider;
+    private YangTextSourceExtension sourceProvider;
     @Mock
     private DOMDataBroker dataBroker;
     @Mock
@@ -58,7 +60,7 @@ public class RestconfSchemaServiceTest {
     @Mock
     private DOMMountPointService mountPointService;
     @Mock
-    private YangTextSchemaSource yangSource;
+    private YangTextSource yangSource;
     @Mock
     private Reader yangReader;
 
@@ -68,8 +70,8 @@ public class RestconfSchemaServiceTest {
     @Before
     public void setup() throws Exception {
         doReturn(SCHEMA_CONTEXT).when(schemaService).getGlobalContext();
-        doReturn(ImmutableClassToInstanceMap.of(DOMYangTextSourceProvider.class, sourceProvider)).when(schemaService)
-            .getExtensions();
+        doCallRealMethod().when(schemaService).extension(any());
+        doReturn(List.of(sourceProvider)).when(schemaService).supportedExtensions();
 
         restconf = new JaxRsRestconf(new MdsalRestconfServer(schemaService, dataBroker, rpcService, actionService,
             mountPointService));
@@ -81,7 +83,7 @@ public class RestconfSchemaServiceTest {
     @Test
     public void getSchemaTest() throws Exception {
         doReturn(Futures.immediateFuture(yangSource)).when(sourceProvider)
-            .getSource(new SourceIdentifier("module1", Revision.of("2014-01-01")));
+            .getYangTexttSource(new SourceIdentifier("module1", Revision.of("2014-01-01")));
         doReturn(yangReader).when(yangSource).openStream();
 
         assertSame(yangReader, assertEntity(Reader.class, 200,