use of org.opendaylight.yangtools.yang.model.api.EffectiveModelContextListener in project netconf by opendaylight.
the class RuntimeRpcTest method setUp.
@Before
public void setUp() throws Exception {
doNothing().when(registration).close();
doAnswer(invocationOnMock -> {
((EffectiveModelContextListener) invocationOnMock.getArguments()[0]).onModelContextUpdated(SCHEMA_CONTEXT);
return registration;
}).when(schemaService).registerSchemaContextListener(any(EffectiveModelContextListener.class));
XMLUnit.setIgnoreWhitespace(true);
XMLUnit.setIgnoreAttributeOrder(true);
doAnswer(invocationOnMock -> {
final SourceIdentifier sId = (SourceIdentifier) invocationOnMock.getArguments()[0];
final YangTextSchemaSource yangTextSchemaSource = YangTextSchemaSource.delegateForByteSource(sId, ByteSource.wrap("module test".getBytes()));
return immediateFluentFuture(yangTextSchemaSource);
}).when(sourceProvider).getSource(any(SourceIdentifier.class));
this.currentSchemaContext = new CurrentSchemaContext(schemaService, sourceProvider);
}
use of org.opendaylight.yangtools.yang.model.api.EffectiveModelContextListener in project mdsal by opendaylight.
the class DOMRpcRouterTest method testClose.
@Test
public void testClose() {
final ListenerRegistration<EffectiveModelContextListener> reg = mock(ListenerRegistration.class);
doNothing().when(reg).close();
final DOMSchemaService schema = mock(DOMSchemaService.class);
doReturn(reg).when(schema).registerSchemaContextListener(any());
final DOMRpcRouter rpcRouter = new DOMRpcRouter(schema);
rpcRouter.close();
final DOMRpcProviderService svc = rpcRouter.getRpcProviderService();
assertThrows(RejectedExecutionException.class, () -> svc.registerRpcImplementation(getTestRpcImplementation(), DOMRpcIdentifier.create(Rpcs.FOO, null)));
}
Aggregations