use of org.infinispan.marshall.protostream.impl.SerializationContextRegistry in project infinispan by infinispan.
the class ProtostreamJsonTranscoderTest method setUp.
@BeforeClass(alwaysRun = true)
public void setUp() {
dataSrc = "{\"_type\":\"Person\", \"name\":\"joe\", \"address\":{\"_type\":\"Address\", \"street\":\"\", \"city\":\"London\", \"zip\":\"0\"}}";
SerializationContext serCtx = ProtobufUtil.newSerializationContext();
serCtx.registerProtoFiles(FileDescriptorSource.fromString("person_definition.proto", PROTO_DEFINITIONS));
SerializationContextRegistry registry = Mockito.mock(SerializationContextRegistry.class);
Mockito.when(registry.getUserCtx()).thenReturn(serCtx);
transcoder = new ProtostreamTranscoder(registry, ProtostreamTranscoder.class.getClassLoader());
supportedMediaTypes = transcoder.getSupportedMediaTypes();
}
use of org.infinispan.marshall.protostream.impl.SerializationContextRegistry in project infinispan by infinispan.
the class ProtostreamTranscoderTest method setUp.
@BeforeClass(alwaysRun = true)
public void setUp() {
dataSrc = " !\"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~";
SerializationContextRegistry registry = Mockito.mock(SerializationContextRegistry.class);
Mockito.when(registry.getUserCtx()).thenReturn(ctx);
transcoder = new ProtostreamTranscoder(registry, ProtostreamTranscoderTest.class.getClassLoader());
supportedMediaTypes = transcoder.getSupportedMediaTypes();
}
use of org.infinispan.marshall.protostream.impl.SerializationContextRegistry in project infinispan by infinispan.
the class MultimapModuleLifecycle method cacheManagerStarting.
@Override
public void cacheManagerStarting(GlobalComponentRegistry gcr, GlobalConfiguration globalConfiguration) {
SerializationContextRegistry ctxRegistry = gcr.getComponent(SerializationContextRegistry.class);
ctxRegistry.addContextInitializer(SerializationContextRegistry.MarshallerType.PERSISTENCE, new PersistenceContextInitializerImpl());
ctxRegistry.addContextInitializer(SerializationContextRegistry.MarshallerType.GLOBAL, new PersistenceContextInitializerImpl());
final Map<Integer, AdvancedExternalizer<?>> externalizerMap = globalConfiguration.serialization().advancedExternalizers();
addAdvancedExternalizer(externalizerMap, PutFunction.EXTERNALIZER);
addAdvancedExternalizer(externalizerMap, RemoveFunction.EXTERNALIZER);
addAdvancedExternalizer(externalizerMap, ContainsFunction.EXTERNALIZER);
addAdvancedExternalizer(externalizerMap, GetFunction.EXTERNALIZER);
}
use of org.infinispan.marshall.protostream.impl.SerializationContextRegistry in project infinispan by infinispan.
the class LifecycleCallbacks method cacheManagerStarting.
@Override
public void cacheManagerStarting(GlobalComponentRegistry gcr, GlobalConfiguration gc) {
ScriptingManagerImpl scriptingManager = new ScriptingManagerImpl();
gcr.registerComponent(scriptingManager, ScriptingManager.class);
SerializationContextRegistry ctxRegistry = gcr.getComponent(SerializationContextRegistry.class);
ctxRegistry.addContextInitializer(SerializationContextRegistry.MarshallerType.PERSISTENCE, new PersistenceContextInitializerImpl());
BasicComponentRegistry bcr = gcr.getComponent(BasicComponentRegistry.class);
InternalCacheRegistry internalCacheRegistry = bcr.getComponent(InternalCacheRegistry.class).wired();
internalCacheRegistry.registerInternalCache(SCRIPT_CACHE, getScriptCacheConfiguration(gc).build(), EnumSet.of(InternalCacheRegistry.Flag.USER, InternalCacheRegistry.Flag.PROTECTED, InternalCacheRegistry.Flag.PERSISTENT, InternalCacheRegistry.Flag.GLOBAL));
}
use of org.infinispan.marshall.protostream.impl.SerializationContextRegistry in project infinispan by infinispan.
the class LifecycleManager method cacheManagerStarting.
@Override
public void cacheManagerStarting(GlobalComponentRegistry gcr, GlobalConfiguration globalCfg) {
SerializationContextRegistry ctxRegistry = gcr.getComponent(SerializationContextRegistry.class);
ctxRegistry.addContextInitializer(SerializationContextRegistry.MarshallerType.PERSISTENCE, new PersistenceContextInitializerImpl());
Map<Integer, AdvancedExternalizer<?>> externalizerMap = globalCfg.serialization().advancedExternalizers();
externalizerMap.put(ExternalizerIds.LUCENE_SORT, new LuceneSortExternalizer());
externalizerMap.put(ExternalizerIds.LUCENE_SORT_FIELD, new LuceneSortFieldExternalizer());
externalizerMap.put(ExternalizerIds.CLUSTERED_QUERY_TOPDOCS, new NodeTopDocs.Externalizer());
externalizerMap.put(ExternalizerIds.LUCENE_TOPDOCS, new LuceneTopDocsExternalizer());
externalizerMap.put(ExternalizerIds.LUCENE_FIELD_SCORE_DOC, new LuceneFieldDocExternalizer());
externalizerMap.put(ExternalizerIds.LUCENE_SCORE_DOC, new LuceneScoreDocExternalizer());
externalizerMap.put(ExternalizerIds.LUCENE_TOPFIELDDOCS, new LuceneTopFieldDocsExternalizer());
externalizerMap.put(ExternalizerIds.INDEX_WORKER, new IndexWorker.Externalizer());
externalizerMap.put(ExternalizerIds.LUCENE_BYTES_REF, new LuceneBytesRefExternalizer());
externalizerMap.put(ExternalizerIds.QUERY_DEFINITION, new QueryDefinition.Externalizer());
externalizerMap.put(ExternalizerIds.CLUSTERED_QUERY_COMMAND_RESPONSE, new QueryResponse.Externalizer());
externalizerMap.put(ExternalizerIds.CLUSTERED_QUERY_OPERATION, new ClusteredQueryOperation.Externalizer());
externalizerMap.put(ExternalizerIds.POJO_TYPE_IDENTIFIER, new PojoRawTypeIdentifierExternalizer());
externalizerMap.put(ExternalizerIds.LUCENE_TOTAL_HITS, new LuceneTotalHitsExternalizer());
}
Aggregations