use of org.infinispan.manager.DefaultCacheManager in project camel by apache.
the class InfinispanLocalAggregationRepository method doStart.
@Override
protected void doStart() throws Exception {
if (maximumRedeliveries < 0) {
throw new IllegalArgumentException("Maximum redelivery retries must be zero or a positive integer.");
}
if (recoveryInterval < 0) {
throw new IllegalArgumentException("Recovery interval must be zero or a positive integer.");
}
if (ObjectHelper.isEmpty(configuration)) {
manager = new DefaultCacheManager();
manager.start();
} else {
manager = new DefaultCacheManager(configuration);
manager.start();
}
if (ObjectHelper.isEmpty(cacheName)) {
cache = manager.getCache();
} else {
cache = manager.getCache(cacheName);
}
}
use of org.infinispan.manager.DefaultCacheManager in project camel by apache.
the class InfinispanConfigurationTestIT method embeddedCacheWithFlagsTest.
@Test
public void embeddedCacheWithFlagsTest() throws Exception {
InfinispanConfiguration configuration = new InfinispanConfiguration();
configuration.setHost("localhost");
configuration.setCacheName("misc_cache");
configuration.setCacheContainer(new DefaultCacheManager(true));
configuration.setFlags(org.infinispan.context.Flag.SKIP_CACHE_LOAD, org.infinispan.context.Flag.SKIP_CACHE_STORE);
InfinispanManager manager = new InfinispanManager(configuration);
manager.start();
BasicCache<Object, Object> cache = manager.getCache();
assertNotNull(cache);
assertTrue(cache instanceof DecoratedCache);
DecoratedCache<Object, Object> decoratedCache = (DecoratedCache<Object, Object>) cache;
assertTrue(decoratedCache.getFlags().contains(org.infinispan.context.Flag.SKIP_CACHE_LOAD));
assertTrue(decoratedCache.getFlags().contains(org.infinispan.context.Flag.SKIP_CACHE_STORE));
manager.getCacheContainer().stop();
manager.stop();
}
use of org.infinispan.manager.DefaultCacheManager in project hibernate-orm by hibernate.
the class InfinispanRegionFactoryTestCase method testTimestampValidation.
@Test(expected = CacheException.class)
public void testTimestampValidation() {
final String timestamps = "org.hibernate.cache.spi.UpdateTimestampsCache";
Properties p = createProperties();
InputStream configStream = FileLookupFactory.newInstance().lookupFile(InfinispanRegionFactory.DEF_INFINISPAN_CONFIG_RESOURCE, getClass().getClassLoader());
ConfigurationBuilderHolder cbh = new ParserRegistry().parse(configStream);
DefaultCacheManager manager = new DefaultCacheManager(cbh, true);
ConfigurationBuilder builder = new ConfigurationBuilder();
builder.clustering().cacheMode(CacheMode.INVALIDATION_SYNC);
manager.defineConfiguration(DEF_TIMESTAMPS_RESOURCE, builder.build());
try {
InfinispanRegionFactory factory = createRegionFactory(manager, p, null);
factory.start(CacheTestUtil.sfOptionsForStart(), p);
TimestampsRegionImpl region = (TimestampsRegionImpl) factory.buildTimestampsRegion(timestamps, p);
fail("Should have failed saying that invalidation is not allowed for timestamp caches.");
} finally {
TestingUtil.killCacheManagers(manager);
}
}
use of org.infinispan.manager.DefaultCacheManager in project hibernate-orm by hibernate.
the class JndiRegionFactoryTest method afterStandardServiceRegistryBuilt.
@Override
protected void afterStandardServiceRegistryBuilt(StandardServiceRegistry ssr) {
if (bindToJndi) {
try {
// Create an in-memory jndi
namingServer = new SingletonNamingServer();
namingMain = new Main();
namingMain.setInstallGlobalService(true);
namingMain.setPort(-1);
namingMain.start();
props = new Properties();
props.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
props.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
final String cfgFileName = (String) ssr.getService(ConfigurationService.class).getSettings().get(InfinispanRegionFactory.INFINISPAN_CONFIG_RESOURCE_PROP);
manager = new DefaultCacheManager(cfgFileName == null ? InfinispanRegionFactory.DEF_INFINISPAN_CONFIG_RESOURCE : cfgFileName, false);
Context ctx = new InitialContext(props);
bind(JNDI_NAME, manager, EmbeddedCacheManager.class, ctx);
} catch (Exception e) {
throw new RuntimeException("Failure to set up JNDI", e);
}
}
}
use of org.infinispan.manager.DefaultCacheManager in project indy by Commonjava.
the class ContentControllerTest method setupClass.
@BeforeClass
public static void setupClass() {
cacheManager = new DefaultCacheManager(new ConfigurationBuilder().simpleCache(true).build());
contentMetadata = cacheManager.getCache("content-metadata", true);
}
Aggregations