Bump MRI upstreams
[netconf.git] / restconf / restconf-nb-bierman02 / src / test / java / org / opendaylight / controller / sal / restconf / impl / test / RestPostOperationTest.java
index 599875a1ee3eeef52b4ac88e53e5304da75e19aa..3aa6a9c8cbff7276aae39c69579f091110a37cc1 100644 (file)
@@ -23,6 +23,7 @@ import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 import java.net.URISyntaxException;
 import java.text.ParseException;
+import java.util.Optional;
 import javax.ws.rs.client.Entity;
 import javax.ws.rs.core.Application;
 import javax.ws.rs.core.MediaType;
@@ -35,6 +36,8 @@ import org.mockito.ArgumentCaptor;
 import org.opendaylight.controller.md.sal.rest.common.TestRestconfUtils;
 import org.opendaylight.mdsal.common.api.CommitInfo;
 import org.opendaylight.mdsal.dom.api.DOMMountPoint;
+import org.opendaylight.mdsal.dom.api.DOMSchemaService;
+import org.opendaylight.mdsal.dom.spi.FixedDOMSchemaService;
 import org.opendaylight.netconf.sal.rest.api.Draft02;
 import org.opendaylight.netconf.sal.rest.impl.JsonNormalizedNodeBodyReader;
 import org.opendaylight.netconf.sal.rest.impl.NormalizedNodeJsonBodyWriter;
@@ -47,7 +50,6 @@ import org.opendaylight.netconf.sal.restconf.impl.RestconfImpl;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
 public class RestPostOperationTest extends JerseyTest {
 
@@ -105,7 +107,8 @@ public class RestPostOperationTest extends JerseyTest {
         when(brokerFacade.commitConfigurationDataPost(any(DOMMountPoint.class), any(YangInstanceIdentifier.class),
                 any(NormalizedNode.class), null, null)).thenReturn(mock(FluentFuture.class));
 
-        when(mountInstance.getSchemaContext()).thenReturn(schemaContextTestModule);
+        when(mountInstance.getService(DOMSchemaService.class))
+            .thenReturn(Optional.of(FixedDOMSchemaService.of(schemaContextTestModule)));
 
         String uri = "/config/ietf-interfaces:interfaces/interface/0/";
         assertEquals(204, post(uri, Draft02.MediaTypes.DATA + XML, xmlData4));
@@ -120,13 +123,12 @@ public class RestPostOperationTest extends JerseyTest {
     @Ignore //jenkins has problem with JerseyTest
     // - we expecting problems with singletons ControllerContext as schemaContext holder
     public void createConfigurationDataTest() throws UnsupportedEncodingException, ParseException {
-        when(brokerFacade.commitConfigurationDataPost((SchemaContext) null, any(YangInstanceIdentifier.class),
+        when(brokerFacade.commitConfigurationDataPost((EffectiveModelContext) null, any(YangInstanceIdentifier.class),
                 any(NormalizedNode.class), null, null))
                 .thenReturn(mock(FluentFuture.class));
 
         final ArgumentCaptor<YangInstanceIdentifier> instanceIdCaptor =
                 ArgumentCaptor.forClass(YangInstanceIdentifier.class);
-        @SuppressWarnings("rawtypes")
         final ArgumentCaptor<NormalizedNode> compNodeCaptor = ArgumentCaptor.forClass(NormalizedNode.class);
 
 
@@ -142,8 +144,8 @@ public class RestPostOperationTest extends JerseyTest {
         // FIXME : NEVER test a nr. of call some service in complex test suite
 //        verify(brokerFacade, times(2))
         verify(brokerFacade, times(1))
-                .commitConfigurationDataPost((SchemaContext) null, instanceIdCaptor.capture(), compNodeCaptor.capture(),
-                        null, null);
+                .commitConfigurationDataPost((EffectiveModelContext) null, instanceIdCaptor.capture(),
+                        compNodeCaptor.capture(), null, null);
 //        identifier = "[(urn:ietf:params:xml:ns:yang:test-interface?revision=2014-07-01)interfaces," +
 //                "(urn:ietf:params:xml:ns:yang:test-interface?revision=2014-07-01)block]";
         assertEquals(identifier, ImmutableList.copyOf(instanceIdCaptor.getValue().getPathArguments()).toString());
@@ -152,7 +154,7 @@ public class RestPostOperationTest extends JerseyTest {
     @Test
     public void createConfigurationDataNullTest() throws UnsupportedEncodingException {
         doReturn(CommitInfo.emptyFluentFuture()).when(brokerFacade).commitConfigurationDataPost(
-            any(SchemaContext.class), any(YangInstanceIdentifier.class), any(NormalizedNode.class), isNull(),
+            any(EffectiveModelContext.class), any(YangInstanceIdentifier.class), any(NormalizedNode.class), isNull(),
             isNull());
 
         //FIXME : find who is set schemaContext