import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-import com.google.common.base.Optional;
import java.io.File;
import java.io.InputStream;
import java.net.URI;
import org.junit.BeforeClass;
import org.junit.Test;
import org.opendaylight.controller.md.sal.dom.api.DOMMountPoint;
-import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService;
import org.opendaylight.controller.md.sal.rest.common.TestRestconfUtils;
import org.opendaylight.netconf.sal.rest.impl.JsonNormalizedNodeBodyReader;
-import org.opendaylight.netconf.sal.restconf.impl.ControllerContext;
import org.opendaylight.restconf.common.context.NormalizedNodeContext;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.QNameModule;
private static final QNameModule INSTANCE_IDENTIFIER_MODULE_QNAME = QNameModule.create(
URI.create("instance:identifier:module"), Revision.of("2014-01-17"));
- public TestJsonBodyReaderMountPoint() throws NoSuchFieldException,
- SecurityException {
- this.jsonBodyReader = new JsonNormalizedNodeBodyReader();
+ public TestJsonBodyReaderMountPoint() throws NoSuchFieldException, SecurityException {
+ super(schemaContext, mock(DOMMountPoint.class));
+ this.jsonBodyReader = new JsonNormalizedNodeBodyReader(controllerContext);
}
@Override
final Collection<File> testFiles = TestRestconfUtils.loadFiles("/instanceidentifier/yang");
testFiles.addAll(TestRestconfUtils.loadFiles("/invoke-rpc"));
schemaContext = YangParserTestUtils.parseYangFiles(testFiles);
-
- final DOMMountPoint mountInstance = mock(DOMMountPoint.class);
- when(mountInstance.getSchemaContext()).thenReturn(schemaContext);
- final DOMMountPointService mockMountService = mock(DOMMountPointService.class);
- when(mockMountService.getMountPoint(any(YangInstanceIdentifier.class)))
- .thenReturn(Optional.of(mountInstance));
-
- ControllerContext.getInstance().setMountService(mockMountService);
- CONTROLLER_CONTEXT.setSchemas(schemaContext);
}
@Test