use of org.infinispan.marshall.persistence.impl.PersistenceMarshallerImpl 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));
}
Aggregations