use of org.opendaylight.mdsal.singleton.dom.impl.DOMClusterSingletonServiceProviderImpl in project netconf by opendaylight.
the class MountPointEndToEndTest method setupMaster.
private void setupMaster() throws Exception {
AbstractConcurrentDataBrokerTest dataBrokerTest = newDataBrokerTest();
masterDataBroker = dataBrokerTest.getDataBroker();
deviceDOMDataBroker = dataBrokerTest.getDomBroker();
bindingToNormalized = dataBrokerTest.getDataBrokerTestCustomizer().getAdapterContext().currentSerializer();
masterSystem = ActorSystem.create(ACTOR_SYSTEM_NAME, ConfigFactory.load().getConfig("Master"));
masterClusterSingletonServiceProvider = new DOMClusterSingletonServiceProviderImpl();
masterClusterSingletonServiceProvider.initializeProvider();
doReturn(masterSystem).when(mockMasterActorSystemProvider).getActorSystem();
doReturn(MoreExecutors.newDirectExecutorService()).when(mockThreadPool).getExecutor();
final SchemaResourcesDTO resources = resourceManager.getSchemaResources(new NetconfNodeBuilder().setSchemaCacheDirectory(TEST_DEFAULT_SUBDIR).build(), "test");
resources.getSchemaRegistry().registerSchemaSource(id -> Futures.immediateFuture(YangTextSchemaSource.delegateForByteSource(id, topModuleInfo.getYangTextByteSource())), PotentialSchemaSource.create(RevisionSourceIdentifier.create(TOP_MODULE_NAME, topModuleInfo.getName().getRevision()), YangTextSchemaSource.class, 1));
masterNetconfTopologyManager = new NetconfTopologyManager(BASE_SCHEMAS, masterDataBroker, mockRpcProviderRegistry, mockActionProviderRegistry, masterClusterSingletonServiceProvider, mockKeepaliveExecutor, mockThreadPool, mockMasterActorSystemProvider, eventExecutor, mockClientDispatcher, TOPOLOGY_ID, config, masterMountPointService, mockEncryptionService, mockRpcProviderService, deviceActionFactory, resourceManager) {
@Override
protected NetconfTopologyContext newNetconfTopologyContext(final NetconfTopologySetup setup, final ServiceGroupIdentifier serviceGroupIdent, final Timeout actorResponseWaitTime, final DeviceActionFactory deviceActionFact) {
NetconfTopologyContext context = super.newNetconfTopologyContext(setup, serviceGroupIdent, actorResponseWaitTime, deviceActionFact);
NetconfTopologyContext spiedContext = spy(context);
doAnswer(invocation -> {
final MasterSalFacade spiedFacade = (MasterSalFacade) spy(invocation.callRealMethod());
doReturn(deviceDOMDataBroker).when(spiedFacade).newDeviceDataBroker();
masterSalFacadeFuture.set(spiedFacade);
return spiedFacade;
}).when(spiedContext).newMasterSalFacade();
return spiedContext;
}
};
masterNetconfTopologyManager.init();
verifyTopologyNodesCreated(masterDataBroker);
}
Aggregations