Search in sources :

Example 6 with SerializationContextRegistry

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();
}
Also used : SerializationContext(org.infinispan.protostream.SerializationContext) SerializationContextRegistry(org.infinispan.marshall.protostream.impl.SerializationContextRegistry) ProtostreamTranscoder(org.infinispan.encoding.ProtostreamTranscoder) BeforeClass(org.testng.annotations.BeforeClass)

Example 7 with SerializationContextRegistry

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();
}
Also used : SerializationContextRegistry(org.infinispan.marshall.protostream.impl.SerializationContextRegistry) ProtostreamTranscoder(org.infinispan.encoding.ProtostreamTranscoder) BeforeClass(org.testng.annotations.BeforeClass)

Example 8 with SerializationContextRegistry

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);
}
Also used : SerializationContextRegistry(org.infinispan.marshall.protostream.impl.SerializationContextRegistry) AdvancedExternalizer(org.infinispan.commons.marshall.AdvancedExternalizer)

Example 9 with SerializationContextRegistry

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));
}
Also used : SerializationContextRegistry(org.infinispan.marshall.protostream.impl.SerializationContextRegistry) BasicComponentRegistry(org.infinispan.factories.impl.BasicComponentRegistry) InternalCacheRegistry(org.infinispan.registry.InternalCacheRegistry)

Example 10 with SerializationContextRegistry

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());
}
Also used : LuceneBytesRefExternalizer(org.infinispan.query.impl.externalizers.LuceneBytesRefExternalizer) LuceneScoreDocExternalizer(org.infinispan.query.impl.externalizers.LuceneScoreDocExternalizer) LuceneSortFieldExternalizer(org.infinispan.query.impl.externalizers.LuceneSortFieldExternalizer) PojoRawTypeIdentifierExternalizer(org.infinispan.query.impl.externalizers.PojoRawTypeIdentifierExternalizer) LuceneSortExternalizer(org.infinispan.query.impl.externalizers.LuceneSortExternalizer) LuceneTopDocsExternalizer(org.infinispan.query.impl.externalizers.LuceneTopDocsExternalizer) SerializationContextRegistry(org.infinispan.marshall.protostream.impl.SerializationContextRegistry) ClusteredQueryOperation(org.infinispan.query.clustered.ClusteredQueryOperation) NodeTopDocs(org.infinispan.query.clustered.NodeTopDocs) LuceneFieldDocExternalizer(org.infinispan.query.impl.externalizers.LuceneFieldDocExternalizer) LuceneTopFieldDocsExternalizer(org.infinispan.query.impl.externalizers.LuceneTopFieldDocsExternalizer) QueryResponse(org.infinispan.query.clustered.QueryResponse) LuceneTotalHitsExternalizer(org.infinispan.query.impl.externalizers.LuceneTotalHitsExternalizer) IndexWorker(org.infinispan.query.impl.massindex.IndexWorker) AdvancedExternalizer(org.infinispan.commons.marshall.AdvancedExternalizer)

Aggregations

SerializationContextRegistry (org.infinispan.marshall.protostream.impl.SerializationContextRegistry)15 AdvancedExternalizer (org.infinispan.commons.marshall.AdvancedExternalizer)6 EmbeddedCacheManager (org.infinispan.manager.EmbeddedCacheManager)5 BasicComponentRegistry (org.infinispan.factories.impl.BasicComponentRegistry)3 InternalCacheRegistry (org.infinispan.registry.InternalCacheRegistry)3 ClassAllowList (org.infinispan.commons.configuration.ClassAllowList)2 ProtostreamTranscoder (org.infinispan.encoding.ProtostreamTranscoder)2 BeforeClass (org.testng.annotations.BeforeClass)2 Transcoder (org.infinispan.commons.dataconversion.Transcoder)1 JavaSerializationMarshaller (org.infinispan.commons.marshall.JavaSerializationMarshaller)1 SingletonExternalizer (org.infinispan.commons.marshall.SingletonExternalizer)1 SuppliedExternalizer (org.infinispan.commons.marshall.SuppliedExternalizer)1 CounterManagerConfiguration (org.infinispan.counter.configuration.CounterManagerConfiguration)1 PersistenceContextInitializerImpl (org.infinispan.counter.impl.persistence.PersistenceContextInitializerImpl)1 TwoStepTranscoder (org.infinispan.encoding.impl.TwoStepTranscoder)1 GetAndPut (org.infinispan.jcache.embedded.functions.GetAndPut)1 GetAndReplace (org.infinispan.jcache.embedded.functions.GetAndReplace)1 Invoke (org.infinispan.jcache.embedded.functions.Invoke)1 MutableEntrySnapshot (org.infinispan.jcache.embedded.functions.MutableEntrySnapshot)1 Put (org.infinispan.jcache.embedded.functions.Put)1