private static void assertTemplateConfiguration(ConfigurationBuilderHolder holder, String name) { Configuration configuration = getConfiguration(holder, name); assertNotNull("Configuration " + name + " expected", configuration); assertTrue("Configuration " + name + " should be a template", configuration.isTemplate()); }
private static void assertCacheConfiguration(ConfigurationBuilderHolder holder, String name) { Configuration configuration = getConfiguration(holder, name); assertNotNull("Configuration " + name + " expected", configuration); assertFalse("Configuration " + name + " should not be a template", configuration.isTemplate()); }
@Override protected ConfigurationBuilder getConfigurationBuilder() { ConfigurationBuilder builder = new ConfigurationBuilder(); Configuration templateConfiguration = this.dependencies.getTemplateConfiguration(); if (templateConfiguration != null) { builder.read(templateConfiguration); } Configuration configuration = this.builder.build(); builder.read(configuration); builder.template(configuration.isTemplate()); builder.jmxStatistics().enabled(this.dependencies.getCacheContainer().getCacheManagerConfiguration().globalJmxStatistics().enabled()); TransactionManager tm = this.dependencies.getTransactionManager(); if (tm != null) { builder.transaction().transactionManagerLookup(new TransactionManagerProvider(tm)); } TransactionSynchronizationRegistry tsr = this.dependencies.getTransactionSynchronizationRegistry(); if (tsr != null) { builder.transaction().transactionSynchronizationRegistryLookup(new TransactionSynchronizationRegistryProvider(tsr)); } return builder; } }
@Test public void testDefaultPendingPutsCache() { Properties p = createProperties(); TestRegionFactory factory = createRegionFactory(p); try { Configuration ppConfig = factory.getCacheManager().getCacheConfiguration(DEF_PENDING_PUTS_RESOURCE); assertTrue(ppConfig.isTemplate()); assertFalse(ppConfig.clustering().cacheMode().isClustered()); assertTrue(ppConfig.simpleCache()); assertEquals(TransactionMode.NON_TRANSACTIONAL, ppConfig.transaction().transactionMode()); assertEquals(60000, ppConfig.expiration().maxIdle()); assertFalse(ppConfig.jmxStatistics().enabled()); assertFalse(ppConfig.jmxStatistics().available()); } finally { factory.stop(); } }