import org.opendaylight.yangtools.yang.model.api.Module;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.opendaylight.yangtools.yang.model.api.SchemaPath;
+import org.opendaylight.yangtools.yang.model.repo.api.EffectiveModelContextFactory;
import org.opendaylight.yangtools.yang.model.repo.api.MissingSchemaSourceException;
import org.opendaylight.yangtools.yang.model.repo.api.RevisionSourceIdentifier;
-import org.opendaylight.yangtools.yang.model.repo.api.SchemaContextFactory;
import org.opendaylight.yangtools.yang.model.repo.api.SchemaRepository;
import org.opendaylight.yangtools.yang.model.repo.api.SchemaResolutionException;
import org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceRepresentation;
final RemoteDeviceHandler<NetconfSessionPreferences> facade = getFacade();
final NetconfDeviceCommunicator listener = getListener();
- final SchemaContextFactory schemaFactory = getSchemaFactory();
+ final EffectiveModelContextFactory schemaFactory = getSchemaFactory();
final SchemaRepository schemaRepository = getSchemaRepository();
final SchemaResolutionException schemaResolutionException =
} else {
return Futures.immediateFuture(SCHEMA_CONTEXT);
}
- }).when(schemaFactory).createSchemaContext(anyCollectionOf(SourceIdentifier.class));
+ }).when(schemaFactory).createEffectiveModelContext(anyCollectionOf(SourceIdentifier.class));
final NetconfDeviceSchemasResolver stateSchemasResolver = (deviceRpc, remoteSessionCapabilities, id,
schemaContext) -> {
Mockito.verify(facade, Mockito.timeout(5000)).onDeviceConnected(any(MountPointContext.class),
any(NetconfSessionPreferences.class), any(NetconfDeviceRpc.class), isNull());
- Mockito.verify(schemaFactory, times(2)).createSchemaContext(anyCollectionOf(SourceIdentifier.class));
+ Mockito.verify(schemaFactory, times(2)).createEffectiveModelContext(anyCollectionOf(SourceIdentifier.class));
}
@Test
final RemoteDeviceHandler<NetconfSessionPreferences> facade = getFacade();
final NetconfDeviceCommunicator listener = getListener();
- final SchemaContextFactory schemaFactory = getSchemaFactory();
+ final EffectiveModelContextFactory schemaFactory = getSchemaFactory();
final SchemaRepository schemaRepository = getSchemaRepository();
// Make fallback attempt to fail due to empty resolved sources
= new SchemaResolutionException("fail first",
Collections.emptyList(), HashMultimap.create());
doReturn(Futures.immediateFailedFuture(schemaResolutionException))
- .when(schemaFactory).createSchemaContext(anyCollectionOf(SourceIdentifier.class));
+ .when(schemaFactory).createEffectiveModelContext(anyCollectionOf(SourceIdentifier.class));
final NetconfDevice.SchemaResourcesDTO schemaResourcesDTO = new NetconfDevice
.SchemaResourcesDTO(getSchemaRegistry(), schemaRepository, schemaFactory, STATE_SCHEMAS_RESOLVER);
Mockito.verify(facade, Mockito.timeout(5000)).onDeviceDisconnected();
Mockito.verify(listener, Mockito.timeout(5000)).close();
- Mockito.verify(schemaFactory, times(1)).createSchemaContext(anyCollectionOf(SourceIdentifier.class));
+ Mockito.verify(schemaFactory, times(1)).createEffectiveModelContext(anyCollectionOf(SourceIdentifier.class));
}
@Test
final RemoteDeviceHandler<NetconfSessionPreferences> facade = getFacade();
final NetconfDeviceCommunicator listener = getListener();
- final SchemaContextFactory schemaFactory = getSchemaFactory();
+ final EffectiveModelContextFactory schemaFactory = getSchemaFactory();
final SchemaRepository schemaRepository = getSchemaRepository();
// Make fallback attempt to fail due to empty resolved sources
} else {
return Futures.immediateFuture(SCHEMA_CONTEXT);
}
- }).when(schemaFactory).createSchemaContext(anyCollectionOf(SourceIdentifier.class));
+ }).when(schemaFactory).createEffectiveModelContext(anyCollectionOf(SourceIdentifier.class));
final NetconfDeviceSchemasResolver stateSchemasResolver = (deviceRpc, remoteSessionCapabilities, id,
schemaContext) -> {
Mockito.verify(facade, Mockito.timeout(5000)).onDeviceConnected(any(MountPointContext.class),
any(NetconfSessionPreferences.class), any(NetconfDeviceRpc.class), isNull());
- Mockito.verify(schemaFactory, times(1)).createSchemaContext(anyCollectionOf(SourceIdentifier.class));
+ Mockito.verify(schemaFactory, times(1)).createEffectiveModelContext(anyCollectionOf(SourceIdentifier.class));
}
private static SchemaSourceRegistry getSchemaRegistry() {
public void testNotificationBeforeSchema() throws Exception {
final RemoteDeviceHandler<NetconfSessionPreferences> facade = getFacade();
final NetconfDeviceCommunicator listener = getListener();
- final SchemaContextFactory schemaContextProviderFactory = mock(SchemaContextFactory.class);
+ final EffectiveModelContextFactory schemaContextProviderFactory = mock(EffectiveModelContextFactory.class);
final SettableFuture<SchemaContext> schemaFuture = SettableFuture.create();
- doReturn(schemaFuture).when(schemaContextProviderFactory).createSchemaContext(any(Collection.class));
+ doReturn(schemaFuture).when(schemaContextProviderFactory).createEffectiveModelContext(any(Collection.class));
final NetconfDevice.SchemaResourcesDTO schemaResourcesDTO =
new NetconfDevice.SchemaResourcesDTO(getSchemaRegistry(), getSchemaRepository(),
schemaContextProviderFactory, STATE_SCHEMAS_RESOLVER);
final RemoteDeviceHandler<NetconfSessionPreferences> facade = getFacade();
final NetconfDeviceCommunicator listener = getListener();
- final SchemaContextFactory schemaContextProviderFactory = getSchemaFactory();
+ final EffectiveModelContextFactory schemaContextProviderFactory = getSchemaFactory();
final NetconfDevice.SchemaResourcesDTO schemaResourcesDTO = new NetconfDevice.SchemaResourcesDTO(
getSchemaRegistry(), getSchemaRepository(), schemaContextProviderFactory, STATE_SCHEMAS_RESOLVER);
Lists.newArrayList(TEST_NAMESPACE + "?module=" + TEST_MODULE + "&revision=" + TEST_REVISION));
device.onRemoteSessionUp(sessionCaps, listener);
- verify(schemaContextProviderFactory, timeout(5000)).createSchemaContext(any(Collection.class));
+ verify(schemaContextProviderFactory, timeout(5000)).createEffectiveModelContext(any(Collection.class));
verify(facade, timeout(5000)).onDeviceConnected(
any(MountPointContext.class), any(NetconfSessionPreferences.class), any(DOMRpcService.class),
isNull());
device.onRemoteSessionUp(sessionCaps, listener);
- verify(schemaContextProviderFactory, timeout(5000).times(2)).createSchemaContext(any(Collection.class));
+ verify(schemaContextProviderFactory, timeout(5000).times(2)).createEffectiveModelContext(any(Collection.class));
verify(facade, timeout(5000).times(2)).onDeviceConnected(
any(MountPointContext.class), any(NetconfSessionPreferences.class), any(DOMRpcService.class),
isNull());
public void testNetconfDeviceDisconnectListenerCallCancellation() throws Exception {
final RemoteDeviceHandler<NetconfSessionPreferences> facade = getFacade();
final NetconfDeviceCommunicator listener = getListener();
- final SchemaContextFactory schemaContextProviderFactory = mock(SchemaContextFactory.class);
+ final EffectiveModelContextFactory schemaContextProviderFactory = mock(EffectiveModelContextFactory.class);
final SettableFuture<SchemaContext> schemaFuture = SettableFuture.create();
- doReturn(schemaFuture).when(schemaContextProviderFactory).createSchemaContext(any(Collection.class));
+ doReturn(schemaFuture).when(schemaContextProviderFactory).createEffectiveModelContext(any(Collection.class));
final NetconfDevice.SchemaResourcesDTO schemaResourcesDTO
= new NetconfDevice.SchemaResourcesDTO(getSchemaRegistry(), getSchemaRepository(),
schemaContextProviderFactory, STATE_SCHEMAS_RESOLVER);
final RemoteDeviceHandler<NetconfSessionPreferences> facade = getFacade();
final NetconfDeviceCommunicator listener = getListener();
- final SchemaContextFactory schemaContextProviderFactory = getSchemaFactory();
+ final EffectiveModelContextFactory schemaContextProviderFactory = getSchemaFactory();
final NetconfDevice.SchemaResourcesDTO schemaResourcesDTO = new NetconfDevice.SchemaResourcesDTO(
getSchemaRegistry(), getSchemaRepository(), schemaContextProviderFactory, STATE_SCHEMAS_RESOLVER);
QName.create(entry.getCapability())).getName(), entry.getCapabilityOrigin().getName()));
}
- private static SchemaContextFactory getSchemaFactory() throws Exception {
- final SchemaContextFactory schemaFactory = mockClass(SchemaContextFactory.class);
+ private static EffectiveModelContextFactory getSchemaFactory() throws Exception {
+ final EffectiveModelContextFactory schemaFactory = mockClass(EffectiveModelContextFactory.class);
doReturn(Futures.immediateFuture(SCHEMA_CONTEXT))
- .when(schemaFactory).createSchemaContext(any(Collection.class));
+ .when(schemaFactory).createEffectiveModelContext(any(Collection.class));
return schemaFactory;
}