private void _assertNoDefaultReplicatorConfigs(Configuration configuration) { List<?> peerListenerFactoryConfigurations = configuration.getCacheManagerPeerListenerFactoryConfigurations(); Assert.assertTrue(peerListenerFactoryConfigurations.isEmpty()); List<?> peerProviderFactoryConfigurations = configuration.getCacheManagerPeerProviderFactoryConfiguration(); Assert.assertTrue(peerProviderFactoryConfigurations.isEmpty()); List<CacheConfiguration> cacheConfigurations = _getAllCacheConfigurations(configuration); for (CacheConfiguration cacheConfiguration : cacheConfigurations) { List<FactoryConfiguration<?>> factoryConfigurations = cacheConfiguration.getCacheEventListenerConfigurations(); for (FactoryConfiguration<?> factoryConfiguration : factoryConfigurations) { String fullyQualifiedClassPath = factoryConfiguration.getFullyQualifiedClassPath(); if (fullyQualifiedClassPath.contains("LiferayCacheEventListenerFactory") || fullyQualifiedClassPath.contains("net.sf.ehcache.distribution")) { Assert.fail(); } } } }
private void _assertClusterLinkReplicatorConfigs( Configuration configuration, boolean onlyReplicator) { List<?> peerListenerFactoryConfigurations = configuration.getCacheManagerPeerListenerFactoryConfigurations(); Assert.assertTrue(peerListenerFactoryConfigurations.isEmpty()); List<?> peerProviderFactoryConfigurations = configuration.getCacheManagerPeerProviderFactoryConfiguration(); Assert.assertTrue(peerProviderFactoryConfigurations.isEmpty()); List<CacheConfiguration> cacheConfigurations = _getAllCacheConfigurations(configuration); for (CacheConfiguration cacheConfiguration : cacheConfigurations) { List<FactoryConfiguration<?>> factoryConfigurations = cacheConfiguration.getCacheEventListenerConfigurations(); if (onlyReplicator) { Assert.assertEquals(1, factoryConfigurations.size()); } else { Assert.assertTrue(factoryConfigurations.size() > 1); } boolean exist = false; for (FactoryConfiguration<?> factoryConfiguration : factoryConfigurations) { String fullyQualifiedClassPath = factoryConfiguration.getFullyQualifiedClassPath(); if (fullyQualifiedClassPath.equals( EhcachePortalCacheClusterReplicatorFactory.class.getName())) { Assert.assertEquals( _CACHE_EVENT_LISTENER_PROPERTIES, factoryConfiguration.getProperties()); exist = true; break; } } if (!exist) { Assert.fail(); } } }
@Override public void start() { final Configuration configuration = ConfigurationFactory.parseConfiguration(config.getUrl()); if (jtaPlatform != null) { OgmTransactionManagerLookupDelegate.transactionManager = jtaPlatform.retrieveTransactionManager(); final FactoryConfiguration transactionManagerLookupParameter = new FactoryConfiguration(); transactionManagerLookupParameter.setClass( OgmTransactionManagerLookupDelegate.class.getName()); configuration.addTransactionManagerLookup(transactionManagerLookupParameter); } cacheManager = CacheManager.create(config.getUrl()); entityCache = new Cache<SerializableKey>(cacheManager.getCache(DefaultDatastoreNames.ENTITY_STORE)); associationCache = new Cache<SerializableKey>(cacheManager.getCache(DefaultDatastoreNames.ASSOCIATION_STORE)); identifierCache = new Cache<SerializableKey>(cacheManager.getCache(DefaultDatastoreNames.IDENTIFIER_STORE)); }