Search in sources :

Example 1 with DelegatingUserMarshaller

use of org.infinispan.marshall.core.impl.DelegatingUserMarshaller in project infinispan by infinispan.

the class ProtostreamUserMarshallerTest method testProtostreamMarshallerLoaded.

public void testProtostreamMarshallerLoaded() {
    PersistenceMarshaller pm = TestingUtil.extractPersistenceMarshaller(manager(0));
    testIsMarshallableAndPut(pm, new ExampleUserPojo("A Pojo!"), new AnotherExampleUserPojo("And another one!"));
    DelegatingUserMarshaller userMarshaller = (DelegatingUserMarshaller) pm.getUserMarshaller();
    assertTrue(userMarshaller.getDelegate() instanceof ImmutableProtoStreamMarshaller);
}
Also used : ImmutableProtoStreamMarshaller(org.infinispan.commons.marshall.ImmutableProtoStreamMarshaller) DelegatingUserMarshaller(org.infinispan.marshall.core.impl.DelegatingUserMarshaller) PersistenceMarshaller(org.infinispan.marshall.persistence.PersistenceMarshaller)

Example 2 with DelegatingUserMarshaller

use of org.infinispan.marshall.core.impl.DelegatingUserMarshaller in project infinispan by infinispan.

the class MultimapStoreBucketTest method testMultimapWithJavaSerializationMarshaller.

public void testMultimapWithJavaSerializationMarshaller() throws Exception {
    GlobalConfigurationBuilder globalBuilder = new GlobalConfigurationBuilder().nonClusteredDefault();
    globalBuilder.defaultCacheName("test");
    globalBuilder.serialization().marshaller(new JavaSerializationMarshaller()).allowList().addClass(SuperPerson.class.getName());
    ConfigurationBuilder config = new ConfigurationBuilder();
    config.persistence().addStore(DummyInMemoryStoreConfigurationBuilder.class);
    EmbeddedCacheManager cm = TestCacheManagerFactory.createCacheManager(globalBuilder, config);
    MultimapCacheManager<String, Person> multimapCacheManager = EmbeddedMultimapCacheManagerFactory.from(cm);
    MultimapCache<String, Person> multimapCache = multimapCacheManager.get("test");
    multimapCache.put("k1", new SuperPerson());
    PersistenceMarshallerImpl pm = TestingUtil.extractPersistenceMarshaller(cm);
    DelegatingUserMarshaller userMarshaller = (DelegatingUserMarshaller) pm.getUserMarshaller();
    assertTrue(userMarshaller.getDelegate() instanceof JavaSerializationMarshaller);
    assertTrue(pm.getSerializationContext().canMarshall(Bucket.class));
    assertTrue(multimapCache.containsKey("k1").get(1, TimeUnit.SECONDS));
}
Also used : GlobalConfigurationBuilder(org.infinispan.configuration.global.GlobalConfigurationBuilder) ConfigurationBuilder(org.infinispan.configuration.cache.ConfigurationBuilder) GlobalConfigurationBuilder(org.infinispan.configuration.global.GlobalConfigurationBuilder) DummyInMemoryStoreConfigurationBuilder(org.infinispan.persistence.dummy.DummyInMemoryStoreConfigurationBuilder) DelegatingUserMarshaller(org.infinispan.marshall.core.impl.DelegatingUserMarshaller) PersistenceMarshallerImpl(org.infinispan.marshall.persistence.impl.PersistenceMarshallerImpl) EmbeddedCacheManager(org.infinispan.manager.EmbeddedCacheManager) Person(org.infinispan.test.data.Person) JavaSerializationMarshaller(org.infinispan.commons.marshall.JavaSerializationMarshaller)

Example 3 with DelegatingUserMarshaller

use of org.infinispan.marshall.core.impl.DelegatingUserMarshaller in project infinispan by infinispan.

the class MigratorConfigurationTest method testCustomMarshallerLoaded.

public void testCustomMarshallerLoaded() {
    Properties properties = createBaseProperties();
    properties.put(propKey(SOURCE, MARSHALLER, CLASS), GenericJBossMarshaller.class.getName());
    StoreProperties props = new StoreProperties(SOURCE, properties);
    Marshaller marshaller = SerializationConfigUtil.getMarshaller(props);
    assertNotNull(marshaller);
    assertTrue(marshaller instanceof PersistenceMarshaller);
    PersistenceMarshaller pm = (PersistenceMarshaller) marshaller;
    DelegatingUserMarshaller userMarshaller = (DelegatingUserMarshaller) pm.getUserMarshaller();
    AssertJUnit.assertTrue(userMarshaller.getDelegate() instanceof GenericJBossMarshaller);
}
Also used : GenericJBossMarshaller(org.infinispan.jboss.marshalling.commons.GenericJBossMarshaller) Infinispan8Marshaller(org.infinispan.tools.store.migrator.marshaller.infinispan8.Infinispan8Marshaller) Infinispan9Marshaller(org.infinispan.tools.store.migrator.marshaller.infinispan9.Infinispan9Marshaller) GenericJBossMarshaller(org.infinispan.jboss.marshalling.commons.GenericJBossMarshaller) PersistenceMarshaller(org.infinispan.marshall.persistence.PersistenceMarshaller) DelegatingUserMarshaller(org.infinispan.marshall.core.impl.DelegatingUserMarshaller) Marshaller(org.infinispan.commons.marshall.Marshaller) DelegatingUserMarshaller(org.infinispan.marshall.core.impl.DelegatingUserMarshaller) PersistenceMarshaller(org.infinispan.marshall.persistence.PersistenceMarshaller) Properties(java.util.Properties)

Aggregations

DelegatingUserMarshaller (org.infinispan.marshall.core.impl.DelegatingUserMarshaller)3 PersistenceMarshaller (org.infinispan.marshall.persistence.PersistenceMarshaller)2 Properties (java.util.Properties)1 ImmutableProtoStreamMarshaller (org.infinispan.commons.marshall.ImmutableProtoStreamMarshaller)1 JavaSerializationMarshaller (org.infinispan.commons.marshall.JavaSerializationMarshaller)1 Marshaller (org.infinispan.commons.marshall.Marshaller)1 ConfigurationBuilder (org.infinispan.configuration.cache.ConfigurationBuilder)1 GlobalConfigurationBuilder (org.infinispan.configuration.global.GlobalConfigurationBuilder)1 GenericJBossMarshaller (org.infinispan.jboss.marshalling.commons.GenericJBossMarshaller)1 EmbeddedCacheManager (org.infinispan.manager.EmbeddedCacheManager)1 PersistenceMarshallerImpl (org.infinispan.marshall.persistence.impl.PersistenceMarshallerImpl)1 DummyInMemoryStoreConfigurationBuilder (org.infinispan.persistence.dummy.DummyInMemoryStoreConfigurationBuilder)1 Person (org.infinispan.test.data.Person)1 Infinispan8Marshaller (org.infinispan.tools.store.migrator.marshaller.infinispan8.Infinispan8Marshaller)1 Infinispan9Marshaller (org.infinispan.tools.store.migrator.marshaller.infinispan9.Infinispan9Marshaller)1