use of org.opendaylight.netconf.sal.restconf.impl.ControllerContext in project netconf by opendaylight.
the class JSONRestconfServiceImplTest method setup.
@Before
public void setup() throws FileNotFoundException {
final EffectiveModelContext mountPointSchemaContext = TestUtils.loadSchemaContext("/full-versions/test-module");
final ControllerContext controllerContext = TestRestconfUtils.newControllerContext(schemaContext, mockMountPoint);
doReturn(java.util.Optional.of(FixedDOMSchemaService.of(() -> mountPointSchemaContext))).when(mockMountPoint).getService(eq(DOMSchemaService.class));
service = new JSONRestconfServiceImpl(controllerContext, RestconfImpl.newInstance(brokerFacade, controllerContext));
}
use of org.opendaylight.netconf.sal.restconf.impl.ControllerContext in project netconf by opendaylight.
the class InstanceIdentifierTypeLeafTest method stringToInstanceIdentifierTest.
@Test
public void stringToInstanceIdentifierTest() throws Exception {
final EffectiveModelContext schemaContext = YangParserTestUtils.parseYangFiles(TestRestconfUtils.loadFiles("/instanceidentifier"));
ControllerContext controllerContext = TestRestconfUtils.newControllerContext(schemaContext);
final InstanceIdentifierContext<?> instanceIdentifier = controllerContext.toInstanceIdentifier("/iid-value-module:cont-iid/iid-list/%2Fiid-value-module%3Acont-iid%2Fiid-value-module%3A" + "values-iid%5Biid-value-module:value-iid='value'%5D");
final YangInstanceIdentifier yiD = instanceIdentifier.getInstanceIdentifier();
Assert.assertNotNull(yiD);
final PathArgument lastPathArgument = yiD.getLastPathArgument();
Assert.assertTrue(lastPathArgument.getNodeType().getNamespace().toString().equals("iid:value:module"));
Assert.assertTrue(lastPathArgument.getNodeType().getLocalName().equals("iid-list"));
final NodeIdentifierWithPredicates list = (NodeIdentifierWithPredicates) lastPathArgument;
final YangInstanceIdentifier value = (YangInstanceIdentifier) list.getValue(QName.create(lastPathArgument.getNodeType(), "iid-leaf"));
final PathArgument lastPathArgumentOfValue = value.getLastPathArgument();
Assert.assertTrue(lastPathArgumentOfValue.getNodeType().getNamespace().toString().equals("iid:value:module"));
Assert.assertTrue(lastPathArgumentOfValue.getNodeType().getLocalName().equals("values-iid"));
final NodeIdentifierWithPredicates valueList = (NodeIdentifierWithPredicates) lastPathArgumentOfValue;
final String valueIid = (String) valueList.getValue(QName.create(lastPathArgumentOfValue.getNodeType(), "value-iid"));
Assert.assertEquals("value", valueIid);
}
use of org.opendaylight.netconf.sal.restconf.impl.ControllerContext in project netconf by opendaylight.
the class RestPutOperationTest method configure.
@Override
protected Application configure() {
/* enable/disable Jersey logs to console */
// enable(TestProperties.LOG_TRAFFIC);
// enable(TestProperties.DUMP_ENTITY);
// enable(TestProperties.RECORD_LOG_LEVEL);
// set(TestProperties.RECORD_LOG_LEVEL, Level.ALL.intValue());
mountInstance = mock(DOMMountPoint.class);
final ControllerContext controllerContext = TestRestconfUtils.newControllerContext(schemaContextYangsIetf, mountInstance);
brokerFacade = mock(BrokerFacade.class);
restconfImpl = RestconfImpl.newInstance(brokerFacade, controllerContext);
ResourceConfig resourceConfig = new ResourceConfig();
resourceConfig = resourceConfig.registerInstances(restconfImpl, new XmlNormalizedNodeBodyReader(controllerContext), new NormalizedNodeXmlBodyWriter(), new JsonNormalizedNodeBodyReader(controllerContext), new NormalizedNodeJsonBodyWriter(), new RestconfDocumentedExceptionMapper(controllerContext));
return resourceConfig;
}
use of org.opendaylight.netconf.sal.restconf.impl.ControllerContext in project netconf by opendaylight.
the class RestconfDocumentedExceptionMapperTest method configure.
@Override
protected Application configure() {
ResourceConfig resourceConfig = new ResourceConfig();
ControllerContext controllerContext = TestRestconfUtils.newControllerContext(schemaContext);
resourceConfig = resourceConfig.registerInstances(mockRestConf, new XmlNormalizedNodeBodyReader(controllerContext), new JsonNormalizedNodeBodyReader(controllerContext), new NormalizedNodeJsonBodyWriter(), new NormalizedNodeXmlBodyWriter(), new RestconfDocumentedExceptionMapper(controllerContext));
return resourceConfig;
}
use of org.opendaylight.netconf.sal.restconf.impl.ControllerContext in project netconf by opendaylight.
the class RestStreamTest method configure.
@Override
protected Application configure() {
/* enable/disable Jersey logs to console */
// enable(TestProperties.LOG_TRAFFIC);
// enable(TestProperties.DUMP_ENTITY);
// enable(TestProperties.RECORD_LOG_LEVEL);
// set(TestProperties.RECORD_LOG_LEVEL, Level.ALL.intValue());
final ControllerContext controllerContext = TestRestconfUtils.newControllerContext(schemaContextYangsIetf);
brokerFacade = mock(BrokerFacade.class);
restconfImpl = RestconfImpl.newInstance(brokerFacade, controllerContext);
ResourceConfig resourceConfig = new ResourceConfig();
resourceConfig = resourceConfig.registerInstances(restconfImpl, new NormalizedNodeJsonBodyWriter(), new NormalizedNodeXmlBodyWriter(), new XmlNormalizedNodeBodyReader(controllerContext), new JsonNormalizedNodeBodyReader(controllerContext), new RestconfDocumentedExceptionMapper(controllerContext));
return resourceConfig;
}
Aggregations