use of org.opendaylight.mdsal.binding.dom.codec.impl.BindingNormalizedNodeCodecRegistry in project controller by opendaylight.
the class BindingNormalizedCodecTest method setupWithSchema.
@Override
protected void setupWithSchema(final SchemaContext schemaContext) {
this.context = schemaContext;
final DataObjectSerializerGenerator streamWriter = StreamWriterGenerator.create(JavassistUtils.forClassPool(ClassPool.getDefault()));
final BindingNormalizedNodeCodecRegistry registry = new BindingNormalizedNodeCodecRegistry(streamWriter);
this.codec = new BindingToNormalizedNodeCodec(GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy(), registry, true);
}
use of org.opendaylight.mdsal.binding.dom.codec.impl.BindingNormalizedNodeCodecRegistry in project bgpcep by opendaylight.
the class AbstractAddPathTest method setUp.
@Before
public void setUp() throws Exception {
super.setUp();
this.ribActivator = new RIBActivator();
this.ribExtension = new SimpleRIBExtensionProviderContext();
this.ribActivator.startRIBExtensionProvider(this.ribExtension);
this.bgpActivator = new BGPActivator();
this.inetActivator = new org.opendaylight.protocol.bgp.inet.BGPActivator();
this.context = new SimpleBGPExtensionProviderContext();
this.bgpActivator.start(this.context);
this.inetActivator.start(this.context);
this.mappingService = new BindingToNormalizedNodeCodec(GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy(), new BindingNormalizedNodeCodecRegistry(StreamWriterGenerator.create(JavassistUtils.forClassPool(ClassPool.getDefault()))));
final ModuleInfoBackedContext moduleInfoBackedContext = ModuleInfoBackedContext.create();
moduleInfoBackedContext.registerModuleInfo(BindingReflections.getModuleInfo(BgpParameters.class));
moduleInfoBackedContext.registerModuleInfo(BindingReflections.getModuleInfo(MultiprotocolCapability.class));
moduleInfoBackedContext.registerModuleInfo(BindingReflections.getModuleInfo(DestinationIpv4Case.class));
moduleInfoBackedContext.registerModuleInfo(BindingReflections.getModuleInfo(AdvertizedRoutes.class));
moduleInfoBackedContext.registerModuleInfo(BindingReflections.getModuleInfo(BgpRib.class));
moduleInfoBackedContext.registerModuleInfo(BindingReflections.getModuleInfo(Attributes1.class));
moduleInfoBackedContext.registerModuleInfo(BindingReflections.getModuleInfo(MpReachNlri.class));
this.mappingService.onGlobalContextUpdated(moduleInfoBackedContext.tryToCreateSchemaContext().get());
this.schemaContext = moduleInfoBackedContext.getSchemaContext();
if (!Epoll.isAvailable()) {
this.worker = new NioEventLoopGroup();
this.boss = new NioEventLoopGroup();
}
this.serverRegistry = new StrictBGPPeerRegistry();
this.serverDispatcher = new BGPDispatcherImpl(this.context.getMessageRegistry(), this.boss, this.worker, this.serverRegistry);
doReturn(Mockito.mock(ClusterSingletonServiceRegistration.class)).when(this.clusterSingletonServiceProvider).registerClusterSingletonService(any(ClusterSingletonService.class));
this.codecsRegistry = CodecsRegistryImpl.create(this.mappingService.getCodecFactory(), this.ribExtension.getClassLoadingStrategy());
}
use of org.opendaylight.mdsal.binding.dom.codec.impl.BindingNormalizedNodeCodecRegistry in project bgpcep by opendaylight.
the class AbstractRIBTestSetup method createCodecFactory.
private static BindingCodecTreeFactory createCodecFactory(final ClassLoadingStrategy str, final SchemaContext ctx) {
final DataObjectSerializerGenerator generator = StreamWriterGenerator.create(JavassistUtils.forClassPool(ClassPool.getDefault()));
final BindingNormalizedNodeCodecRegistry codec = new BindingNormalizedNodeCodecRegistry(generator);
codec.onBindingRuntimeContextUpdated(BindingRuntimeContext.create(str, ctx));
return codec;
}
use of org.opendaylight.mdsal.binding.dom.codec.impl.BindingNormalizedNodeCodecRegistry in project bgpcep by opendaylight.
the class AbstractRIBSupportTest method setUp.
@Before
public void setUp() throws Exception {
initMocks(this);
doAnswer(invocation -> {
final Object[] args = invocation.getArguments();
AbstractRIBSupportTest.this.insertedRoutes.add(AbstractRIBSupportTest.this.mappingService.fromNormalizedNode((YangInstanceIdentifier) args[1], (NormalizedNode<?, ?>) args[2]));
return args[1];
}).when(this.tx).put(any(LogicalDatastoreType.class), any(YangInstanceIdentifier.class), any(NormalizedNode.class));
doAnswer(invocation -> {
final Object[] args = invocation.getArguments();
AbstractRIBSupportTest.this.deletedRoutes.add(AbstractRIBSupportTest.this.mappingService.fromYangInstanceIdentifier((YangInstanceIdentifier) args[1]));
return args[1];
}).when(this.tx).delete(any(LogicalDatastoreType.class), any(YangInstanceIdentifier.class));
this.deletedRoutes = new ArrayList<>();
this.insertedRoutes = new ArrayList<>();
this.mappingService = new BindingToNormalizedNodeCodec(GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy(), new BindingNormalizedNodeCodecRegistry(StreamWriterGenerator.create(JavassistUtils.forClassPool(ClassPool.getDefault()))));
this.moduleInfoBackedContext = ModuleInfoBackedContext.create();
}
use of org.opendaylight.mdsal.binding.dom.codec.impl.BindingNormalizedNodeCodecRegistry in project controller by opendaylight.
the class BindingTestContext method startBindingToDomMappingService.
public void startBindingToDomMappingService() {
checkState(this.classPool != null, "ClassPool needs to be present");
final DataObjectSerializerGenerator generator = StreamWriterGenerator.create(JavassistUtils.forClassPool(this.classPool));
final BindingNormalizedNodeCodecRegistry codecRegistry = new BindingNormalizedNodeCodecRegistry(generator);
final GeneratedClassLoadingStrategy loading = GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy();
this.codec = new BindingToNormalizedNodeCodec(loading, codecRegistry);
this.mockSchemaService.registerSchemaContextListener(this.codec);
}
Aggregations