*/
package org.opendaylight.restconf.common.schema;
+import org.opendaylight.mdsal.dom.api.DOMYangTextSourceProvider;
import org.opendaylight.yangtools.yang.model.api.Module;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
private final SchemaContext schemaContext;
private final Module module;
+ private final DOMYangTextSourceProvider sourceProvider;
- public SchemaExportContext(final SchemaContext ctx, final Module module) {
+ public SchemaExportContext(final SchemaContext ctx, final Module module,
+ final DOMYangTextSourceProvider sourceProvider) {
schemaContext = ctx;
this.module = module;
+ this.sourceProvider = sourceProvider;
}
public SchemaContext getSchemaContext() {
return module;
}
+ public DOMYangTextSourceProvider getSourceProvider() {
+ return sourceProvider;
+ }
}
import java.io.IOException;
import java.io.OutputStream;
-import java.io.PrintWriter;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import javax.ws.rs.Produces;
import javax.ws.rs.ext.MessageBodyWriter;
import javax.ws.rs.ext.Provider;
import org.opendaylight.restconf.common.schema.SchemaExportContext;
+import org.opendaylight.yangtools.yang.model.repo.api.RevisionSourceIdentifier;
+import org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceException;
+import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource;
@Provider
@Produces({ SchemaRetrievalService.YANG_MEDIA_TYPE })
final Annotation[] annotations, final MediaType mediaType,
final MultivaluedMap<String, Object> httpHeaders, final OutputStream entityStream) throws IOException,
WebApplicationException {
- final PrintWriter writer = new PrintWriter(entityStream);
- writer.write(context.getModule().getSource());
-
+ final RevisionSourceIdentifier sourceId = RevisionSourceIdentifier.create(context.getModule().getName(),
+ context.getModule().getQNameModule().getFormattedRevision());
+ final YangTextSchemaSource yangTextSchemaSource;
+ try {
+ yangTextSchemaSource = context.getSourceProvider().getSource(sourceId).checkedGet();
+ } catch (SchemaSourceException e) {
+ throw new WebApplicationException("Unable to retrieve source from SourceProvider.", e);
+ }
+ yangTextSchemaSource.copyTo(entityStream);
}
}
import java.text.ParseException;
import java.util.Date;
import java.util.Iterator;
+import org.opendaylight.mdsal.dom.api.DOMYangTextSourceProvider;
import org.opendaylight.netconf.sal.restconf.impl.ControllerContext;
import org.opendaylight.restconf.common.context.InstanceIdentifierContext;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
RestconfValidationUtils.checkDocumentedError(componentIter.hasNext(),
ErrorType.PROTOCOL, ErrorTag.INVALID_VALUE, "Revision date must be supplied.");
final String revisionString = componentIter.next();
- return getExportUsingNameAndRevision(schemaContext, moduleName, revisionString);
+ return getExportUsingNameAndRevision(schemaContext, moduleName, revisionString,
+ salContext.getYangTextSourceProvider());
}
private static SchemaExportContext getExportUsingNameAndRevision(final SchemaContext schemaContext,
- final String moduleName, final String revisionStr) {
+ final String moduleName, final String revisionStr,
+ final DOMYangTextSourceProvider yangTextSourceProvider) {
try {
final Date revision = SimpleDateFormatUtil.getRevisionFormat().parse(revisionStr);
final Module module = schemaContext.findModuleByName(moduleName, revision);
+
return new SchemaExportContext(
- schemaContext, RestconfValidationUtils.checkNotNullDocumented(module, moduleName));
+ schemaContext, RestconfValidationUtils.checkNotNullDocumented(module, moduleName),
+ yangTextSourceProvider);
} catch (final ParseException e) {
throw new RestconfDocumentedException("Supplied revision is not in expected date format YYYY-mm-dd", e);
}
import org.opendaylight.controller.md.sal.common.impl.util.compat.DataNormalizer;
import org.opendaylight.controller.md.sal.dom.api.DOMMountPoint;
import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService;
+import org.opendaylight.mdsal.dom.api.DOMYangTextSourceProvider;
import org.opendaylight.netconf.sal.rest.api.Draft02.RestConfModule;
import org.opendaylight.restconf.common.context.InstanceIdentifierContext;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
// FIXME; these three should be final
private volatile SchemaContext globalSchema;
private volatile DOMMountPointService mountService;
+ private volatile DOMYangTextSourceProvider yangTextSourceProvider;
private DataNormalizer dataNormalizer;
this.mountService = mountService;
}
+ public DOMYangTextSourceProvider getYangTextSourceProvider() {
+ return yangTextSourceProvider;
+ }
+
+ public void setYangTextSourceProvider(DOMYangTextSourceProvider yangTextSourceProvider) {
+ this.yangTextSourceProvider = yangTextSourceProvider;
+ }
+
private ControllerContext() {
}
import org.opendaylight.controller.md.sal.dom.api.DOMNotificationService;
import org.opendaylight.controller.md.sal.dom.api.DOMRpcService;
import org.opendaylight.controller.sal.core.api.model.SchemaService;
+import org.opendaylight.mdsal.dom.api.DOMSchemaService;
+import org.opendaylight.mdsal.dom.api.DOMYangTextSourceProvider;
import org.opendaylight.netconf.sal.rest.api.RestConnector;
import org.opendaylight.netconf.sal.restconf.impl.jmx.Config;
import org.opendaylight.netconf.sal.restconf.impl.jmx.Delete;
private final IpAddress websocketAddress;
private final PortNumber websocketPort;
private final StatisticsRestconfServiceWrapper stats = StatisticsRestconfServiceWrapper.getInstance();
+ private final DOMSchemaService domSchemaService;
private ListenerRegistration<SchemaContextListener> listenerRegistration;
private Thread webSocketServerThread;
public RestconfProviderImpl(DOMDataBroker domDataBroker, SchemaService schemaService, DOMRpcService rpcService,
DOMNotificationService notificationService, DOMMountPointService mountPointService,
- IpAddress websocketAddress, PortNumber websocketPort) {
+ DOMSchemaService domSchemaService, IpAddress websocketAddress, PortNumber websocketPort) {
super("Draft02ProviderStatistics", "restconf-connector", null);
this.domDataBroker = Preconditions.checkNotNull(domDataBroker);
this.schemaService = Preconditions.checkNotNull(schemaService);
this.mountPointService = Preconditions.checkNotNull(mountPointService);
this.websocketAddress = Preconditions.checkNotNull(websocketAddress);
this.websocketPort = Preconditions.checkNotNull(websocketPort);
+ this.domSchemaService = Preconditions.checkNotNull(domSchemaService);
}
public void start() {
ControllerContext.getInstance().setSchemas(schemaService.getGlobalContext());
ControllerContext.getInstance().setMountService(mountPointService);
+ final DOMYangTextSourceProvider domSchemaServiceExtension =
+ (DOMYangTextSourceProvider) domSchemaService.getSupportedExtensions()
+ .get(DOMYangTextSourceProvider.class);
+ ControllerContext.getInstance().setYangTextSourceProvider(domSchemaServiceExtension);
this.webSocketServerThread = new Thread(WebSocketServer.createInstance(
new String(websocketAddress.getValue()), websocketPort.getValue()));
<reference id="domNotificationService" interface="org.opendaylight.controller.md.sal.dom.api.DOMNotificationService"/>
<reference id="domDataBroker" interface="org.opendaylight.controller.md.sal.dom.api.DOMDataBroker"
ext:filter="(type=@{databroker-service-type})"/>
+ <reference id="domSchemaService" interface="org.opendaylight.mdsal.dom.api.DOMSchemaService"/>
<bean id="webSocketPort" class="org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber">
<argument value="${websocket-port}"/>
<argument ref="domRpcService"/>
<argument ref="domNotificationService"/>
<argument ref="domMountPointService"/>
+ <argument ref="domSchemaService"/>
<argument ref="webSocketAddress"/>
<argument ref="webSocketPort"/>
</bean>
import org.opendaylight.controller.md.sal.dom.api.DOMNotificationService;
import org.opendaylight.controller.md.sal.dom.api.DOMRpcService;
import org.opendaylight.controller.sal.core.api.model.SchemaService;
+import org.opendaylight.mdsal.dom.api.DOMSchemaService;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.nb.rfc8040.handlers.DOMDataBrokerHandler;
import org.opendaylight.restconf.nb.rfc8040.handlers.DOMMountPointServiceHandler;
private final DOMRpcService rpcService;
private final DOMNotificationService notificationService;
private final DOMMountPointService mountPointService;
+ private final DOMSchemaService domSchemaService;
private final Builder<Object> servicesProperties;
private ListenerRegistration<SchemaContextListener> listenerRegistration;
// FIXME: refactor this class and its users to interact via builder pattern, where individual
// services are injected and then the provider is created
public RestConnectorProvider(final DOMDataBroker domDataBroker,
- final SchemaService schemaService, final DOMRpcService rpcService,
- final DOMNotificationService notificationService, final DOMMountPointService mountPointService) {
- this(domDataBroker, schemaService, rpcService, notificationService, mountPointService, null);
+ final SchemaService schemaService, final DOMRpcService rpcService,
+ final DOMNotificationService notificationService, final DOMMountPointService mountPointService,
+ final DOMSchemaService domSchemaService) {
+ this(domDataBroker, schemaService, rpcService, notificationService, mountPointService, domSchemaService, null);
+
}
public RestConnectorProvider(final DOMDataBroker domDataBroker, final SchemaService schemaService,
- final DOMRpcService rpcService,
- final DOMNotificationService notificationService, final DOMMountPointService mountPointService,
- final T wrapperServices) {
+ final DOMRpcService rpcService,
+ final DOMNotificationService notificationService,
+ final DOMMountPointService mountPointService,
+ final DOMSchemaService domSchemaService, final T wrapperServices) {
this.servicesProperties = ImmutableSet.<Object>builder();
this.wrapperServices = wrapperServices;
this.schemaService = Preconditions.checkNotNull(schemaService);
this.rpcService = Preconditions.checkNotNull(rpcService);
this.notificationService = Preconditions.checkNotNull(notificationService);
this.mountPointService = Preconditions.checkNotNull(mountPointService);
+ this.domSchemaService = Preconditions.checkNotNull(domSchemaService);
RestConnectorProvider.dataBroker = Preconditions.checkNotNull(domDataBroker);
}
if (wrapperServices != null) {
wrapperServices.setHandlers(this.schemaCtxHandler, RestConnectorProvider.mountPointServiceHandler,
- RestConnectorProvider.transactionChainHandler, brokerHandler, rpcServiceHandler,
- notificationServiceHandler);
+ RestConnectorProvider.transactionChainHandler, brokerHandler, rpcServiceHandler,
+ notificationServiceHandler, domSchemaService);
}
}
import java.io.IOException;
import java.io.OutputStream;
-import java.io.PrintWriter;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import javax.ws.rs.Produces;
import javax.ws.rs.ext.Provider;
import org.opendaylight.restconf.common.schema.SchemaExportContext;
import org.opendaylight.restconf.nb.rfc8040.Rfc8040;
+import org.opendaylight.yangtools.yang.model.repo.api.RevisionSourceIdentifier;
+import org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceException;
+import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource;
@Provider
@Produces({ Rfc8040.MediaTypes.YANG })
final Annotation[] annotations, final MediaType mediaType,
final MultivaluedMap<String, Object> httpHeaders, final OutputStream entityStream) throws IOException,
WebApplicationException {
- final PrintWriter writer = new PrintWriter(entityStream);
- writer.write(context.getModule().getSource());
-
+ final RevisionSourceIdentifier sourceId = RevisionSourceIdentifier.create(context.getModule().getName(),
+ context.getModule().getQNameModule().getFormattedRevision());
+ final YangTextSchemaSource yangTextSchemaSource;
+ try {
+ yangTextSchemaSource = context.getSourceProvider().getSource(sourceId).checkedGet();
+ } catch (SchemaSourceException e) {
+ throw new WebApplicationException("Unable to retrieve source from SourceProvider.", e);
+ }
+ yangTextSchemaSource.copyTo(entityStream);
}
}
*/
package org.opendaylight.restconf.nb.rfc8040.services.simple.impl;
+import org.opendaylight.mdsal.dom.api.DOMYangTextSourceProvider;
import org.opendaylight.restconf.common.schema.SchemaExportContext;
import org.opendaylight.restconf.nb.rfc8040.handlers.DOMMountPointServiceHandler;
import org.opendaylight.restconf.nb.rfc8040.handlers.SchemaContextHandler;
private SchemaContextHandler schemaContextHandler;
private DOMMountPointServiceHandler domMountPointServiceHandler;
+ private DOMYangTextSourceProvider sourceProvider;
/**
* Set {@link SchemaContextHandler} for getting actual {@link SchemaContext}
* handling dom mount point service
*/
public RestconfSchemaServiceImpl(final SchemaContextHandler schemaContextHandler,
- final DOMMountPointServiceHandler domMountPointServiceHandler) {
+ final DOMMountPointServiceHandler domMountPointServiceHandler,
+ final DOMYangTextSourceProvider sourceProvider) {
this.schemaContextHandler = schemaContextHandler;
this.domMountPointServiceHandler = domMountPointServiceHandler;
+ this.sourceProvider = sourceProvider;
}
@Override
public SchemaExportContext getSchema(final String identifier) {
final SchemaContextRef schemaContextRef = new SchemaContextRef(this.schemaContextHandler.get());
return ParserIdentifier.toSchemaExportContextFromIdentifier(schemaContextRef.get(), identifier,
- this.domMountPointServiceHandler.get());
+ this.domMountPointServiceHandler.get(), sourceProvider);
}
@Override
schemaContextHandler = (SchemaContextHandler) object;
} else if (object instanceof DOMMountPointServiceHandler) {
domMountPointServiceHandler = (DOMMountPointServiceHandler) object;
+ } else if (object instanceof DOMYangTextSourceProvider) {
+ sourceProvider = (DOMYangTextSourceProvider) object;
}
}
}
*/
package org.opendaylight.restconf.nb.rfc8040.services.wrapper;
+import org.opendaylight.mdsal.dom.api.DOMSchemaService;
import org.opendaylight.restconf.nb.rfc8040.handlers.DOMDataBrokerHandler;
import org.opendaylight.restconf.nb.rfc8040.handlers.DOMMountPointServiceHandler;
import org.opendaylight.restconf.nb.rfc8040.handlers.NotificationServiceHandler;
void setHandlers(SchemaContextHandler schemaCtxHandler, DOMMountPointServiceHandler domMountPointServiceHandler,
TransactionChainHandler transactionChainHandler, DOMDataBrokerHandler domDataBrokerHandler,
- RpcServiceHandler rpcServiceHandler, NotificationServiceHandler notificationServiceHandler);
+ RpcServiceHandler rpcServiceHandler, NotificationServiceHandler notificationServiceHandler,
+ DOMSchemaService domSchemaService);
}
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
+import org.opendaylight.mdsal.dom.api.DOMSchemaService;
+import org.opendaylight.mdsal.dom.api.DOMYangTextSourceProvider;
import org.opendaylight.restconf.common.context.NormalizedNodeContext;
import org.opendaylight.restconf.common.patch.PatchContext;
import org.opendaylight.restconf.common.patch.PatchStatusContext;
public void setHandlers(final SchemaContextHandler schemaCtxHandler,
final DOMMountPointServiceHandler domMountPointServiceHandler,
final TransactionChainHandler transactionChainHandler, final DOMDataBrokerHandler domDataBrokerHandler,
- final RpcServiceHandler rpcServiceHandler, final NotificationServiceHandler notificationServiceHandler) {
+ final RpcServiceHandler rpcServiceHandler, final NotificationServiceHandler notificationServiceHandler,
+ final DOMSchemaService domSchemaService) {
this.delegRestOpsService = new RestconfOperationsServiceImpl(schemaCtxHandler, domMountPointServiceHandler);
- this.delegRestSchService = new RestconfSchemaServiceImpl(schemaCtxHandler, domMountPointServiceHandler);
+ final DOMYangTextSourceProvider yangTextSourceProvider =
+ (DOMYangTextSourceProvider) domSchemaService.getSupportedExtensions()
+ .get(DOMYangTextSourceProvider.class);
+ this.delegRestSchService = new RestconfSchemaServiceImpl(schemaCtxHandler, domMountPointServiceHandler,
+ yangTextSourceProvider);
this.delegRestconfSubscrService = new RestconfStreamsSubscriptionServiceImpl(domDataBrokerHandler,
notificationServiceHandler, schemaCtxHandler, transactionChainHandler);
this.delegRestconfDataService =
import java.util.List;
import org.opendaylight.controller.md.sal.dom.api.DOMMountPoint;
import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService;
+import org.opendaylight.mdsal.dom.api.DOMYangTextSourceProvider;
import org.opendaylight.restconf.common.context.InstanceIdentifierContext;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag;
* @return {@link SchemaExportContext}
*/
public static SchemaExportContext toSchemaExportContextFromIdentifier(final SchemaContext schemaContext,
- final String identifier, final DOMMountPointService domMountPointService) {
+ final String identifier, final DOMMountPointService domMountPointService,
+ final DOMYangTextSourceProvider sourceProvider) {
final Iterable<String> pathComponents = RestconfConstants.SLASH_SPLITTER.split(identifier);
final Iterator<String> componentIter = pathComponents.iterator();
if (!Iterables.contains(pathComponents, RestconfConstants.MOUNT)) {
final String moduleName = RestconfValidation.validateAndGetModulName(componentIter);
final Date revision = RestconfValidation.validateAndGetRevision(componentIter);
final Module module = schemaContext.findModuleByName(moduleName, revision);
- return new SchemaExportContext(schemaContext, module);
+
+ return new SchemaExportContext(schemaContext, module, sourceProvider);
} else {
final StringBuilder pathBuilder = new StringBuilder();
while (componentIter.hasNext()) {
final String moduleName = RestconfValidation.validateAndGetModulName(componentIter);
final Date revision = RestconfValidation.validateAndGetRevision(componentIter);
final Module module = point.getMountPoint().getSchemaContext().findModuleByName(moduleName, revision);
- return new SchemaExportContext(point.getMountPoint().getSchemaContext(), module);
+ return new SchemaExportContext(point.getMountPoint().getSchemaContext(), module, sourceProvider);
}
}
}
<reference id="domNotificationService" interface="org.opendaylight.controller.md.sal.dom.api.DOMNotificationService"/>
<reference id="domDataBroker" interface="org.opendaylight.controller.md.sal.dom.api.DOMDataBroker"
ext:filter="(type=@{databroker-service-type})"/>
+ <reference id="domSchemaService" interface="org.opendaylight.mdsal.dom.api.DOMSchemaService"/>
<bean id="wrapper" class="org.opendaylight.restconf.nb.rfc8040.services.wrapper.ServicesWrapperImpl"
factory-method="getInstance" />
<argument ref="domRpcService"/>
<argument ref="domNotificationService"/>
<argument ref="domMountPointService"/>
+ <argument ref="domSchemaService"/>
<argument ref="wrapper"/>
</bean>
import org.opendaylight.controller.md.sal.dom.api.DOMRpcService;
import org.opendaylight.controller.md.sal.dom.api.DOMTransactionChain;
import org.opendaylight.controller.sal.core.api.model.SchemaService;
+import org.opendaylight.mdsal.dom.api.DOMSchemaService;
import org.opendaylight.restconf.nb.rfc8040.handlers.SchemaContextHandler;
import org.opendaylight.restconf.nb.rfc8040.services.wrapper.ServicesWrapperImpl;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
@Mock private DOMNotificationService mockNotificationService;
@Mock DOMTransactionChain mockTransactionChain;
@Mock private ListenerRegistration<SchemaContextListener> mockRegistration;
+ @Mock
+ private DOMSchemaService domSchemaService;
@Rule
public ExpectedException thrown = ExpectedException.none();
Mockito.any(SchemaContextHandler.class));
this.connectorProvider = new RestConnectorProvider(mockDataBroker, mockSchemaService, mockRpcService,
- mockNotificationService, mockMountPointService, ServicesWrapperImpl.getInstance());
+ mockNotificationService, mockMountPointService, domSchemaService, ServicesWrapperImpl.getInstance());
}
/**
import org.opendaylight.controller.md.sal.dom.api.DOMRpcService;
import org.opendaylight.controller.md.sal.dom.api.DOMTransactionChain;
import org.opendaylight.controller.md.sal.dom.spi.DefaultDOMRpcResult;
+import org.opendaylight.mdsal.dom.api.DOMSchemaService;
import org.opendaylight.restconf.nb.rfc8040.TestUtils;
import org.opendaylight.restconf.nb.rfc8040.handlers.DOMDataBrokerHandler;
import org.opendaylight.restconf.nb.rfc8040.handlers.DOMMountPointServiceHandler;
@Mock
private DOMRpcService mockRpcService;
+ @Mock
+ private DOMSchemaService domSchemaService;
+
private JSONRestconfServiceRfc8040Impl service;
@BeforeClass
ServicesWrapperImpl.getInstance().setHandlers(mockSchemaContextHandler, mountPointServiceHandler,
txChainHandler, new DOMDataBrokerHandler(mockDOMDataBroker),
new RpcServiceHandler(mockRpcService),
- new NotificationServiceHandler(mock(DOMNotificationService.class)));
+ new NotificationServiceHandler(mock(DOMNotificationService.class)), domSchemaService);
service = new JSONRestconfServiceRfc8040Impl(ServicesWrapperImpl.getInstance(), mountPointServiceHandler);
}
import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService;
import org.opendaylight.controller.md.sal.dom.broker.impl.mount.DOMMountPointServiceImpl;
import org.opendaylight.controller.md.sal.dom.broker.spi.mount.SimpleDOMMountPoint;
+import org.opendaylight.mdsal.dom.api.DOMYangTextSourceProvider;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.errors.RestconfError;
import org.opendaylight.restconf.common.schema.SchemaExportContext;
private SchemaContextHandler mockContextHandler;
@Mock
private DOMMountPointServiceHandler mockMountPointHandler;
+ @Mock
+ private DOMYangTextSourceProvider sourceProvider;
// schema context with modules
private SchemaContext schemaContext;
((DOMMountPointServiceImpl) this.mountPointService).registerMountPoint(this.mountPointWithNullSchemaContext);
when(this.mockMountPointHandler.get()).thenReturn(this.mountPointService);
- this.schemaService = new RestconfSchemaServiceImpl(this.mockContextHandler, this.mockMountPointHandler);
+ this.schemaService = new RestconfSchemaServiceImpl(this.mockContextHandler, this.mockMountPointHandler,
+ sourceProvider);
}
/**
import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService;
import org.opendaylight.controller.md.sal.dom.broker.impl.mount.DOMMountPointServiceImpl;
import org.opendaylight.controller.md.sal.dom.broker.spi.mount.SimpleDOMMountPoint;
+import org.opendaylight.mdsal.dom.api.DOMSchemaService;
+import org.opendaylight.mdsal.dom.api.DOMYangTextSourceProvider;
import org.opendaylight.restconf.common.context.InstanceIdentifierContext;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.errors.RestconfError;
private DOMMountPoint mockMountPoint;
@Mock
private DOMMountPointService mockMountPointService;
+ @Mock
+ private DOMSchemaService domSchemaService;
+ @Mock
+ private DOMYangTextSourceProvider sourceProvider;
@Rule
public final ExpectedException thrown = ExpectedException.none();
@Test
public void toSchemaExportContextFromIdentifierTest() {
final SchemaExportContext exportContext = ParserIdentifier.toSchemaExportContextFromIdentifier(
- this.schemaContext, TEST_MODULE_NAME + "/" + TEST_MODULE_REVISION, null);
+ this.schemaContext, TEST_MODULE_NAME + "/" + TEST_MODULE_REVISION, null, sourceProvider);
assertNotNull("Export context should be parsed", exportContext);
final SchemaExportContext exportContext = ParserIdentifier.toSchemaExportContextFromIdentifier(
this.schemaContext,
"not-existing-module" + "/" + "2016-01-01",
- null);
+ null, sourceProvider);
assertNotNull("Export context should be parsed", exportContext);
assertNull("Not-existing module should be null", exportContext.getModule());
public void toSchemaExportContextFromIdentifierInvalidIdentifierNegativeTest() {
try {
ParserIdentifier.toSchemaExportContextFromIdentifier(
- this.schemaContext, TEST_MODULE_REVISION + "/" + TEST_MODULE_NAME, null);
+ this.schemaContext, TEST_MODULE_REVISION + "/" + TEST_MODULE_NAME, null, sourceProvider);
fail("Test should fail due to invalid identifier supplied");
} catch (final RestconfDocumentedException e) {
assertEquals("Not expected error type",
final SchemaExportContext exportContext = ParserIdentifier.toSchemaExportContextFromIdentifier(
this.schemaContext,
MOUNT_POINT_IDENT + "/" + TEST_MODULE_NAME + "/" + TEST_MODULE_REVISION,
- this.mountPointService);
+ this.mountPointService, sourceProvider);
final Module module = exportContext.getModule();
assertNotNull("Export context should contains test module", module);
final SchemaExportContext exportContext = ParserIdentifier.toSchemaExportContextFromIdentifier(
this.schemaContext,
MOUNT_POINT_IDENT + "/" + "not-existing-module" + "/" + "2016-01-01",
- this.mountPointService);
+ this.mountPointService, sourceProvider);
assertNotNull("Export context should be parsed", exportContext);
assertNull("Not-existing module should be null", exportContext.getModule());
ParserIdentifier.toSchemaExportContextFromIdentifier(
this.schemaContext,
MOUNT_POINT_IDENT + "/" + TEST_MODULE_REVISION + "/" + TEST_MODULE_NAME,
- this.mountPointService);
+ this.mountPointService, sourceProvider);
fail("Test should fail due to invalid identifier supplied");
} catch (final RestconfDocumentedException e) {
@Test
public void toSchemaExportContextFromIdentifierNullIdentifierNegativeTest() {
this.thrown.expect(NullPointerException.class);
- ParserIdentifier.toSchemaExportContextFromIdentifier(this.schemaContext, null, null);
+ ParserIdentifier.toSchemaExportContextFromIdentifier(this.schemaContext, null, null, sourceProvider);
}
/**
@Test
public void toSchemaExportContextFromIdentifierNullSchemaContextNegativeTest() {
this.thrown.expect(NullPointerException.class);
- ParserIdentifier.toSchemaExportContextFromIdentifier(null, TEST_MODULE_NAME + "/" + TEST_MODULE_REVISION, null);
+ ParserIdentifier.toSchemaExportContextFromIdentifier(null, TEST_MODULE_NAME + "/" + TEST_MODULE_REVISION, null,
+ sourceProvider);
}
/**
+ TEST_MODULE_NAME
+ "/"
+ TEST_MODULE_REVISION,
- this.mountPointService);
+ this.mountPointService,
+ sourceProvider);
}
/**
+ TEST_MODULE_NAME
+ "/"
+ TEST_MODULE_REVISION,
- null);
+ null,
+ sourceProvider);
}
/**
+ TEST_MODULE_NAME
+ "/"
+ TEST_MODULE_REVISION,
- this.mockMountPointService);
+ this.mockMountPointService,
+ sourceProvider);
}
/**