import org.mockito.Mockito;
import org.opendaylight.controller.md.sal.rest.common.TestRestconfUtils;
import org.opendaylight.controller.sal.restconf.impl.test.TestUtils;
+import org.opendaylight.netconf.sal.rest.impl.NormalizedNodeContext;
import org.opendaylight.netconf.sal.restconf.impl.BrokerFacade;
import org.opendaylight.netconf.sal.restconf.impl.ControllerContext;
import org.opendaylight.netconf.sal.restconf.impl.PutResult;
import org.opendaylight.netconf.sal.restconf.impl.RestconfImpl;
import org.opendaylight.restconf.common.context.InstanceIdentifierContext;
-import org.opendaylight.restconf.common.context.NormalizedNodeContext;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.errors.RestconfError;
-import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag;
-import org.opendaylight.restconf.common.errors.RestconfError.ErrorType;
+import org.opendaylight.yangtools.yang.common.ErrorTag;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
-import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeBuilder;
-import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.NormalizedNodeBuilder;
+import org.opendaylight.yangtools.yang.data.api.schema.builder.DataContainerNodeBuilder;
+import org.opendaylight.yangtools.yang.data.api.schema.builder.NormalizedNodeBuilder;
+import org.opendaylight.yangtools.yang.data.impl.schema.SchemaAwareBuilders;
import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.valid.DataValidationException;
import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
public class RestPutListDataTest {
- private static SchemaContext schemaContextTestModule;
+ private static EffectiveModelContext schemaContextTestModule;
private static BrokerFacade brokerFacade;
private static RestconfImpl restconfImpl;
brokerFacade = mock(BrokerFacade.class);
restconfImpl = RestconfImpl.newInstance(brokerFacade, controllerContext);
final PutResult result = mock(PutResult.class);
- when(brokerFacade.commitConfigurationDataPut(any(SchemaContext.class), any(YangInstanceIdentifier.class),
- any(NormalizedNode.class), Mockito.anyString(), Mockito.anyString()))
+ when(brokerFacade.commitConfigurationDataPut(any(EffectiveModelContext.class),
+ any(YangInstanceIdentifier.class), any(NormalizedNode.class), Mockito.anyString(), Mockito.anyString()))
.thenReturn(result);
when(result.getFutureOfPutData()).thenReturn(mock(FluentFuture.class));
when(result.getStatus()).thenReturn(Status.OK);
assertTrue(testNodeSchemaNode != null);
assertTrue(testNodeSchemaNode instanceof ListSchemaNode);
final DataContainerNodeBuilder<NodeIdentifierWithPredicates, MapEntryNode> testNodeContainer =
- Builders.mapEntryBuilder((ListSchemaNode) testNodeSchemaNode);
+ SchemaAwareBuilders.mapEntryBuilder((ListSchemaNode) testNodeSchemaNode);
List<DataSchemaNode> testChildren = ControllerContext.findInstanceDataChildrenByName(
(ListSchemaNode) testNodeSchemaNode, key1.getLocalName());
assertTrue(testLeafKey1SchemaNode != null);
assertTrue(testLeafKey1SchemaNode instanceof LeafSchemaNode);
final NormalizedNodeBuilder<NodeIdentifier, Object, LeafNode<Object>> leafKey1 =
- Builders.leafBuilder((LeafSchemaNode) testLeafKey1SchemaNode);
+ SchemaAwareBuilders.leafBuilder((LeafSchemaNode) testLeafKey1SchemaNode);
leafKey1.withValue(payloadKey1);
testNodeContainer.withChild(leafKey1.build());
assertTrue(testLeafKey2SchemaNode != null);
assertTrue(testLeafKey2SchemaNode instanceof LeafSchemaNode);
final NormalizedNodeBuilder<NodeIdentifier, Object, LeafNode<Object>> leafKey2 =
- Builders.leafBuilder((LeafSchemaNode) testLeafKey2SchemaNode);
+ SchemaAwareBuilders.leafBuilder((LeafSchemaNode) testLeafKey2SchemaNode);
leafKey2.withValue(payloadKey2);
testNodeContainer.withChild(leafKey2.build());
}
- final NormalizedNodeContext testCompositeContext = new NormalizedNodeContext(new InstanceIdentifierContext<>(
+ final NormalizedNodeContext testCompositeContext = new NormalizedNodeContext(new InstanceIdentifierContext(
null, testNodeSchemaNode, null, schemaContextTestModule), testNodeContainer.build());
final UriInfo uriInfo = Mockito.mock(UriInfo.class);