use of org.opendaylight.mdsal.binding.generator.api.ModuleInfoRegistry in project controller by opendaylight.
the class RefreshingSCPModuleInfoRegistryTest method testConstructor.
@Test
public void testConstructor() throws Exception {
final ModuleInfoRegistry reg = mock(ModuleInfoRegistry.class);
final SchemaContextProvider prov = mock(SchemaContextProvider.class);
doReturn("string").when(prov).toString();
final BundleContext ctxt = mock(BundleContext.class);
final ServiceRegistration<?> servReg = mock(ServiceRegistration.class);
doReturn(servReg).when(ctxt).registerService(any(Class.class), any(SchemaContextProvider.class), any(Dictionary.class));
doReturn(servReg).when(ctxt).registerService(Mockito.anyString(), any(Object.class), any(Dictionary.class));
doNothing().when(servReg).setProperties(any(Dictionary.class));
final ClassLoadingStrategy classLoadingStrat = mock(ClassLoadingStrategy.class);
final BindingContextProvider codecRegistryProvider = mock(BindingContextProvider.class);
doNothing().when(codecRegistryProvider).update(classLoadingStrat, prov);
final BindingRuntimeContext bindingRuntimeContext = mock(BindingRuntimeContext.class);
doReturn("B-runtime-context").when(bindingRuntimeContext).toString();
doReturn(bindingRuntimeContext).when(codecRegistryProvider).getBindingContext();
final RefreshingSCPModuleInfoRegistry scpreg = new RefreshingSCPModuleInfoRegistry(reg, prov, classLoadingStrat, this.sourceProvider, codecRegistryProvider, ctxt);
doNothing().when(servReg).unregister();
final YangModuleInfo modInfo = mock(YangModuleInfo.class);
doReturn("").when(modInfo).toString();
final ObjectRegistration<YangModuleInfo> ymi = mock(ObjectRegistration.class);
doReturn(ymi).when(reg).registerModuleInfo(modInfo);
scpreg.registerModuleInfo(modInfo);
scpreg.updateService();
verify(codecRegistryProvider).update(classLoadingStrat, prov);
scpreg.close();
Mockito.verify(servReg, Mockito.times(1)).setProperties(any(Dictionary.class));
Mockito.verify(servReg, Mockito.times(1)).unregister();
}
Aggregations