@Test
 public void testBuildEntityRegionPersonPlusEntityOverridesWithoutCfg() {
   final String person = "com.acme.Person";
   Properties p = createProperties();
   // Third option, no cache defined for entity and overrides for generic entity data type and
   // entity itself.
   p.setProperty("hibernate.cache.infinispan.com.acme.Person.eviction.strategy", "LRU");
   p.setProperty("hibernate.cache.infinispan.com.acme.Person.expiration.lifespan", "60000");
   p.setProperty("hibernate.cache.infinispan.com.acme.Person.expiration.max_idle", "30000");
   p.setProperty("hibernate.cache.infinispan.entity.cfg", "myentity-cache");
   p.setProperty("hibernate.cache.infinispan.entity.eviction.strategy", "FIFO");
   p.setProperty("hibernate.cache.infinispan.entity.eviction.wake_up_interval", "3000");
   p.setProperty("hibernate.cache.infinispan.entity.eviction.max_entries", "10000");
   InfinispanRegionFactory factory = createRegionFactory(p);
   try {
     factory.getCacheManager();
     assertNotNull(factory.getTypeOverrides().get(person));
     assertFalse(factory.getDefinedConfigurations().contains(person));
     EntityRegionImpl region =
         (EntityRegionImpl) factory.buildEntityRegion(person, p, MUTABLE_NON_VERSIONED);
     assertNotNull(factory.getTypeOverrides().get(person));
     assertTrue(factory.getDefinedConfigurations().contains(person));
     AdvancedCache cache = region.getCache();
     Configuration cacheCfg = cache.getCacheConfiguration();
     assertEquals(EvictionStrategy.LRU, cacheCfg.eviction().strategy());
     assertEquals(3000, cacheCfg.expiration().wakeUpInterval());
     assertEquals(10000, cacheCfg.eviction().maxEntries());
     assertEquals(60000, cacheCfg.expiration().lifespan());
     assertEquals(30000, cacheCfg.expiration().maxIdle());
   } finally {
     factory.stop();
   }
 }
 @Test
 public void testBuildDiffCacheNameTimestampsRegion() {
   final String timestamps = "org.hibernate.cache.spi.UpdateTimestampsCache";
   Properties p = createProperties();
   p.setProperty("hibernate.cache.infinispan.timestamps.cfg", "unrecommended-timestamps");
   InfinispanRegionFactory factory = createRegionFactory(p);
   try {
     EmbeddedCacheManager manager = factory.getCacheManager();
     assertFalse(factory.getDefinedConfigurations().contains("timestamp"));
     assertTrue(factory.getDefinedConfigurations().contains("unrecommended-timestamps"));
     assertTrue(
         factory
             .getTypeOverrides()
             .get("timestamps")
             .getCacheName()
             .equals("unrecommended-timestamps"));
     ConfigurationBuilder builder = new ConfigurationBuilder();
     builder.clustering().stateTransfer().fetchInMemoryState(true);
     builder.clustering().cacheMode(CacheMode.REPL_SYNC);
     manager.defineConfiguration("unrecommended-timestamps", builder.build());
     TimestampsRegionImpl region =
         (TimestampsRegionImpl) factory.buildTimestampsRegion(timestamps, p);
     AdvancedCache cache = region.getCache();
     Configuration cacheCfg = cache.getCacheConfiguration();
     assertEquals(EvictionStrategy.NONE, cacheCfg.eviction().strategy());
     assertEquals(CacheMode.REPL_SYNC, cacheCfg.clustering().cacheMode());
     assertFalse(cacheCfg.storeAsBinary().enabled());
     assertFalse(cacheCfg.jmxStatistics().enabled());
   } finally {
     factory.stop();
   }
 }
  @Test
  public void testBuildEntityCollectionRegionOverridesOnly() {
    AdvancedCache cache;
    Properties p = createProperties();
    p.setProperty("hibernate.cache.infinispan.entity.eviction.strategy", "LIRS");
    p.setProperty("hibernate.cache.infinispan.entity.eviction.wake_up_interval", "3000");
    p.setProperty("hibernate.cache.infinispan.entity.eviction.max_entries", "30000");
    p.setProperty("hibernate.cache.infinispan.collection.eviction.strategy", "LRU");
    p.setProperty("hibernate.cache.infinispan.collection.eviction.wake_up_interval", "3500");
    p.setProperty("hibernate.cache.infinispan.collection.eviction.max_entries", "35000");
    InfinispanRegionFactory factory = createRegionFactory(p);
    try {
      factory.getCacheManager();
      EntityRegionImpl region =
          (EntityRegionImpl)
              factory.buildEntityRegion("com.acme.Address", p, MUTABLE_NON_VERSIONED);
      assertNull(factory.getTypeOverrides().get("com.acme.Address"));
      cache = region.getCache();
      Configuration cacheCfg = cache.getCacheConfiguration();
      assertEquals(EvictionStrategy.LIRS, cacheCfg.eviction().strategy());
      assertEquals(3000, cacheCfg.expiration().wakeUpInterval());
      assertEquals(30000, cacheCfg.eviction().maxEntries());
      // Max idle value comes from base XML configuration
      assertEquals(100000, cacheCfg.expiration().maxIdle());

      CollectionRegionImpl collectionRegion =
          (CollectionRegionImpl)
              factory.buildCollectionRegion("com.acme.Person.addresses", p, MUTABLE_NON_VERSIONED);
      assertNull(factory.getTypeOverrides().get("com.acme.Person.addresses"));
      cache = collectionRegion.getCache();
      cacheCfg = cache.getCacheConfiguration();
      assertEquals(EvictionStrategy.LRU, cacheCfg.eviction().strategy());
      assertEquals(3500, cacheCfg.expiration().wakeUpInterval());
      assertEquals(35000, cacheCfg.eviction().maxEntries());
      assertEquals(100000, cacheCfg.expiration().maxIdle());
    } finally {
      factory.stop();
    }
  }
 @Test
 public void testBuildQueryRegionWithCustomRegionName() {
   final String queryRegionName = "myquery";
   Properties p = createProperties();
   p.setProperty("hibernate.cache.infinispan.myquery.cfg", "timestamps-none-eviction");
   p.setProperty("hibernate.cache.infinispan.myquery.eviction.strategy", "LIRS");
   p.setProperty("hibernate.cache.infinispan.myquery.eviction.wake_up_interval", "2222");
   p.setProperty("hibernate.cache.infinispan.myquery.eviction.max_entries", "11111");
   InfinispanRegionFactory factory = createRegionFactory(p);
   try {
     assertTrue(factory.getDefinedConfigurations().contains("local-query"));
     QueryResultsRegionImpl region =
         (QueryResultsRegionImpl) factory.buildQueryResultsRegion(queryRegionName, p);
     assertNotNull(factory.getTypeOverrides().get(queryRegionName));
     assertTrue(factory.getDefinedConfigurations().contains(queryRegionName));
     AdvancedCache cache = region.getCache();
     Configuration cacheCfg = cache.getCacheConfiguration();
     assertEquals(EvictionStrategy.LIRS, cacheCfg.eviction().strategy());
     assertEquals(2222, cacheCfg.expiration().wakeUpInterval());
     assertEquals(11111, cacheCfg.eviction().maxEntries());
   } finally {
     factory.stop();
   }
 }
예제 #5
0
 private void writeCommonCacheAttributesElements(
     XMLExtendedStreamWriter writer, String name, Configuration configuration)
     throws XMLStreamException {
   writer.writeAttribute(Attribute.NAME, name);
   configuration
       .jmxStatistics()
       .attributes()
       .write(writer, JMXStatisticsConfiguration.ENABLED, Attribute.STATISTICS);
   if (configuration.deadlockDetection().enabled()) {
     writer.writeAttribute(
         Attribute.SPIN_DURATION, Long.toString(configuration.deadlockDetection().spinDuration()));
   }
   configuration.unsafe().attributes().write(writer);
   writeBackup(writer, configuration);
   configuration.sites().backupFor().attributes().write(writer, Element.BACKUP_FOR.getLocalName());
   configuration.locking().attributes().write(writer, Element.LOCKING.getLocalName());
   writeTransaction(writer, configuration);
   configuration.eviction().attributes().write(writer, Element.EVICTION.getLocalName());
   configuration.expiration().attributes().write(writer, Element.EXPIRATION.getLocalName());
   if (configuration.compatibility().enabled())
     configuration
         .compatibility()
         .attributes()
         .write(writer, Element.COMPATIBILITY.getLocalName());
   if (configuration.storeAsBinary().enabled())
     configuration
         .storeAsBinary()
         .attributes()
         .write(writer, Element.STORE_AS_BINARY.getLocalName());
   writePersistence(writer, configuration);
   configuration.versioning().attributes().write(writer, Element.VERSIONING.getLocalName());
   writeDataContainer(writer, configuration);
   writeIndexing(writer, configuration);
   writeCustomInterceptors(writer, configuration);
   writeSecurity(writer, configuration);
   if (configuration.clustering().cacheMode().needsStateTransfer()) {
     configuration
         .clustering()
         .stateTransfer()
         .attributes()
         .write(writer, Element.STATE_TRANSFER.getLocalName());
   }
   configuration
       .clustering()
       .partitionHandling()
       .attributes()
       .write(writer, Element.PARTITION_HANDLING.getLocalName());
 }
 @Test
 public void testBuildDefaultTimestampsRegion() {
   final String timestamps = "org.hibernate.cache.spi.UpdateTimestampsCache";
   Properties p = createProperties();
   InfinispanRegionFactory factory = createRegionFactory(p);
   try {
     assertTrue(factory.getDefinedConfigurations().contains("timestamps"));
     assertTrue(factory.getTypeOverrides().get("timestamps").getCacheName().equals("timestamps"));
     TimestampsRegionImpl region =
         (TimestampsRegionImpl) factory.buildTimestampsRegion(timestamps, p);
     AdvancedCache cache = region.getCache();
     Configuration cacheCfg = cache.getCacheConfiguration();
     assertEquals(EvictionStrategy.NONE, cacheCfg.eviction().strategy());
     assertEquals(CacheMode.REPL_ASYNC, cacheCfg.clustering().cacheMode());
     assertFalse(cacheCfg.jmxStatistics().enabled());
   } finally {
     factory.stop();
   }
 }
  private void assertNamedCacheFile(EmbeddedCacheManager cm) {
    final GlobalConfiguration gc = cm.getCacheManagerConfiguration();

    assert gc.asyncListenerExecutor().factory() instanceof DefaultExecutorFactory;
    assert gc.asyncListenerExecutor().properties().getProperty("maxThreads").equals("5");
    assert gc.asyncListenerExecutor()
        .properties()
        .getProperty("threadNamePrefix")
        .equals("AsyncListenerThread");

    assert gc.asyncTransportExecutor().factory() instanceof DefaultExecutorFactory;
    assert gc.asyncTransportExecutor().properties().getProperty("maxThreads").equals("25");
    assert gc.asyncTransportExecutor()
        .properties()
        .getProperty("threadNamePrefix")
        .equals("AsyncSerializationThread");

    assert gc.evictionScheduledExecutor().factory() instanceof DefaultScheduledExecutorFactory;
    assert gc.evictionScheduledExecutor()
        .properties()
        .getProperty("threadNamePrefix")
        .equals("EvictionThread");

    assert gc.replicationQueueScheduledExecutor().factory()
        instanceof DefaultScheduledExecutorFactory;
    assert gc.replicationQueueScheduledExecutor()
        .properties()
        .getProperty("threadNamePrefix")
        .equals("ReplicationQueueThread");

    assert gc.transport().transport() instanceof JGroupsTransport;
    assert gc.transport().clusterName().equals("infinispan-cluster");
    assert gc.transport().nodeName().equals("Jalapeno");
    assert gc.transport().distributedSyncTimeout() == 50000;

    assert gc.shutdown().hookBehavior().equals(ShutdownHookBehavior.REGISTER);

    assert gc.serialization().marshaller() instanceof VersionAwareMarshaller;
    assert gc.serialization().version() == Version.getVersionShort("1.0");
    final Map<Integer, AdvancedExternalizer<?>> externalizers =
        gc.serialization().advancedExternalizers();
    assert externalizers.size() == 3;
    assert externalizers.get(1234) instanceof AdvancedExternalizerTest.IdViaConfigObj.Externalizer;
    assert externalizers.get(5678)
        instanceof AdvancedExternalizerTest.IdViaAnnotationObj.Externalizer;
    assert externalizers.get(3456) instanceof AdvancedExternalizerTest.IdViaBothObj.Externalizer;

    Configuration defaultCfg = cm.getDefaultCacheConfiguration();

    assert defaultCfg.locking().lockAcquisitionTimeout() == 1000;
    assert defaultCfg.locking().concurrencyLevel() == 100;
    assert defaultCfg.locking().isolationLevel() == IsolationLevel.READ_COMMITTED;

    Configuration c = cm.getCacheConfiguration("transactional");
    assert !c.clustering().cacheMode().isClustered();
    assert c.transaction().transactionManagerLookup() instanceof GenericTransactionManagerLookup;
    assert c.transaction().useEagerLocking();
    assert c.transaction().eagerLockingSingleNode();
    assert !c.transaction().syncRollbackPhase();

    c = cm.getCacheConfiguration("transactional2");
    assert c.transaction().transactionManagerLookup() instanceof Lookup;
    assert c.transaction().cacheStopTimeout() == 10000;
    assert c.transaction().lockingMode().equals(LockingMode.PESSIMISTIC);
    assert !c.transaction().autoCommit();

    c = cm.getCacheConfiguration("syncRepl");

    assert c.clustering().cacheMode() == CacheMode.REPL_SYNC;
    assert !c.clustering().stateRetrieval().fetchInMemoryState();
    assert c.clustering().sync().replTimeout() == 15000;

    c = cm.getCacheConfiguration("asyncRepl");

    assert c.clustering().cacheMode() == CacheMode.REPL_ASYNC;
    assert !c.clustering().async().useReplQueue();
    assert !c.clustering().async().asyncMarshalling();
    assert !c.clustering().stateRetrieval().fetchInMemoryState();

    c = cm.getCacheConfiguration("asyncReplQueue");

    assert c.clustering().cacheMode() == CacheMode.REPL_ASYNC;
    assert c.clustering().async().useReplQueue();
    assert !c.clustering().async().asyncMarshalling();
    assert !c.clustering().stateRetrieval().fetchInMemoryState();

    c = cm.getCacheConfiguration("txSyncRepl");

    assert c.transaction().transactionManagerLookup() instanceof GenericTransactionManagerLookup;
    assert c.clustering().cacheMode() == CacheMode.REPL_SYNC;
    assert !c.clustering().stateRetrieval().fetchInMemoryState();
    assert c.clustering().sync().replTimeout() == 15000;

    c = cm.getCacheConfiguration("overriding");

    assert c.clustering().cacheMode() == CacheMode.LOCAL;
    assert c.locking().lockAcquisitionTimeout() == 20000;
    assert c.locking().concurrencyLevel() == 1000;
    assert c.locking().isolationLevel() == IsolationLevel.REPEATABLE_READ;
    assert !c.storeAsBinary().enabled();

    c = cm.getCacheConfiguration("storeAsBinary");
    assert c.storeAsBinary().enabled();

    c = cm.getCacheConfiguration("withLoader");
    assert c.loaders().preload();
    assert !c.loaders().passivation();
    assert !c.loaders().shared();
    assert c.loaders().cacheLoaders().size() == 1;

    FileCacheStoreConfiguration loaderCfg =
        (FileCacheStoreConfiguration) c.loaders().cacheLoaders().get(0);

    assert loaderCfg.fetchPersistentState();
    assert loaderCfg.ignoreModifications();
    assert loaderCfg.purgeOnStartup();
    assert loaderCfg.location().equals("/tmp/FileCacheStore-Location");
    assert loaderCfg.fsyncMode() == FileCacheStoreConfigurationBuilder.FsyncMode.PERIODIC;
    assert loaderCfg.fsyncInterval() == 2000;
    assert loaderCfg.singletonStore().pushStateTimeout() == 20000;
    assert loaderCfg.singletonStore().pushStateWhenCoordinator();
    assert loaderCfg.async().threadPoolSize() == 5;
    assert loaderCfg.async().flushLockTimeout() == 15000;
    assert loaderCfg.async().enabled();
    assert loaderCfg.async().modificationQueueSize() == 700;

    c = cm.getCacheConfiguration("withLoaderDefaults");
    loaderCfg = (FileCacheStoreConfiguration) c.loaders().cacheLoaders().get(0);
    assert loaderCfg.location().equals("/tmp/Another-FileCacheStore-Location");
    assert loaderCfg.fsyncMode() == FileCacheStoreConfigurationBuilder.FsyncMode.DEFAULT;

    c = cm.getCacheConfiguration("withouthJmxEnabled");
    assert !c.jmxStatistics().enabled();
    assert gc.globalJmxStatistics().enabled();
    assert gc.globalJmxStatistics().allowDuplicateDomains();
    assert gc.globalJmxStatistics().domain().equals("funky_domain");
    assert gc.globalJmxStatistics().mbeanServerLookup() instanceof PerThreadMBeanServerLookup;

    c = cm.getCacheConfiguration("dist");
    assert c.clustering().cacheMode() == CacheMode.DIST_SYNC;
    assert c.clustering().l1().lifespan() == 600000;
    assert c.clustering().hash().rehashRpcTimeout() == 120000;
    assert c.clustering().stateTransfer().timeout() == 120000;
    assert c.clustering().hash().consistentHash() instanceof TopologyAwareConsistentHash;
    assert c.clustering().hash().numOwners() == 3;
    assert c.clustering().l1().enabled();

    c = cm.getCacheConfiguration("groups");
    assert c.clustering().hash().groups().enabled();
    assert c.clustering().hash().groups().groupers().size() == 1;
    assert c.clustering().hash().groups().groupers().get(0).getKeyType().equals(String.class);

    c = cm.getCacheConfiguration("chunkSize");
    assert c.clustering().stateTransfer().fetchInMemoryState();
    assert c.clustering().stateTransfer().timeout() == 120000;
    assert c.clustering().stateTransfer().chunkSize() == 1000;

    c = cm.getCacheConfiguration("cacheWithCustomInterceptors");
    assert !c.customInterceptors().interceptors().isEmpty();
    assert c.customInterceptors().interceptors().size() == 5;

    c = cm.getCacheConfiguration("evictionCache");
    assert c.eviction().maxEntries() == 5000;
    assert c.eviction().strategy().equals(EvictionStrategy.FIFO);
    assert c.expiration().lifespan() == 60000;
    assert c.expiration().maxIdle() == 1000;
    assert c.eviction().threadPolicy() == EvictionThreadPolicy.PIGGYBACK;
    assert c.expiration().wakeUpInterval() == 500;

    c = cm.getCacheConfiguration("withDeadlockDetection");
    assert c.deadlockDetection().enabled();
    assert c.deadlockDetection().spinDuration() == 1221;
    assert c.clustering().cacheMode() == CacheMode.DIST_SYNC;

    c = cm.getCacheConfiguration("storeKeyValueBinary");
    assert c.storeAsBinary().enabled();
    assert c.storeAsBinary().storeKeysAsBinary();
    assert !c.storeAsBinary().storeValuesAsBinary();
  }
 @Test
 public void testEvictionMaxEntries() {
   Configuration configuration = new ConfigurationBuilder().eviction().maxEntries(20).build();
   Assert.assertEquals(configuration.eviction().maxEntries(), 20);
 }
  @Test
  public void testBuildEntityCollectionRegionsPersonPlusEntityCollectionOverrides() {
    final String person = "com.acme.Person";
    final String address = "com.acme.Address";
    final String car = "com.acme.Car";
    final String addresses = "com.acme.Person.addresses";
    final String parts = "com.acme.Car.parts";
    Properties p = createProperties();
    // First option, cache defined for entity and overrides for generic entity data type and entity
    // itself.
    p.setProperty("hibernate.cache.infinispan.com.acme.Person.cfg", "person-cache");
    p.setProperty("hibernate.cache.infinispan.com.acme.Person.eviction.strategy", "LRU");
    p.setProperty("hibernate.cache.infinispan.com.acme.Person.eviction.wake_up_interval", "2000");
    p.setProperty("hibernate.cache.infinispan.com.acme.Person.eviction.max_entries", "5000");
    p.setProperty("hibernate.cache.infinispan.com.acme.Person.expiration.lifespan", "60000");
    p.setProperty("hibernate.cache.infinispan.com.acme.Person.expiration.max_idle", "30000");
    p.setProperty("hibernate.cache.infinispan.entity.cfg", "myentity-cache");
    p.setProperty("hibernate.cache.infinispan.entity.eviction.strategy", "LIRS");
    p.setProperty("hibernate.cache.infinispan.entity.eviction.wake_up_interval", "3000");
    p.setProperty("hibernate.cache.infinispan.entity.eviction.max_entries", "20000");
    p.setProperty("hibernate.cache.infinispan.com.acme.Person.addresses.cfg", "addresses-cache");
    p.setProperty("hibernate.cache.infinispan.com.acme.Person.addresses.eviction.strategy", "LIRS");
    p.setProperty(
        "hibernate.cache.infinispan.com.acme.Person.addresses.eviction.wake_up_interval", "2500");
    p.setProperty(
        "hibernate.cache.infinispan.com.acme.Person.addresses.eviction.max_entries", "5500");
    p.setProperty(
        "hibernate.cache.infinispan.com.acme.Person.addresses.expiration.lifespan", "65000");
    p.setProperty(
        "hibernate.cache.infinispan.com.acme.Person.addresses.expiration.max_idle", "35000");
    p.setProperty("hibernate.cache.infinispan.collection.cfg", "mycollection-cache");
    p.setProperty("hibernate.cache.infinispan.collection.eviction.strategy", "LRU");
    p.setProperty("hibernate.cache.infinispan.collection.eviction.wake_up_interval", "3500");
    p.setProperty("hibernate.cache.infinispan.collection.eviction.max_entries", "25000");
    InfinispanRegionFactory factory = createRegionFactory(p);
    try {
      EmbeddedCacheManager manager = factory.getCacheManager();
      assertFalse(manager.getCacheManagerConfiguration().globalJmxStatistics().enabled());
      assertNotNull(factory.getTypeOverrides().get(person));
      assertFalse(factory.getDefinedConfigurations().contains(person));
      assertNotNull(factory.getTypeOverrides().get(addresses));
      assertFalse(factory.getDefinedConfigurations().contains(addresses));
      AdvancedCache cache;

      EntityRegionImpl region =
          (EntityRegionImpl) factory.buildEntityRegion(person, p, MUTABLE_NON_VERSIONED);
      assertNotNull(factory.getTypeOverrides().get(person));
      assertTrue(factory.getDefinedConfigurations().contains(person));
      assertNull(factory.getTypeOverrides().get(address));
      cache = region.getCache();
      Configuration cacheCfg = cache.getCacheConfiguration();
      assertEquals(EvictionStrategy.LRU, cacheCfg.eviction().strategy());
      assertEquals(2000, cacheCfg.expiration().wakeUpInterval());
      assertEquals(5000, cacheCfg.eviction().maxEntries());
      assertEquals(60000, cacheCfg.expiration().lifespan());
      assertEquals(30000, cacheCfg.expiration().maxIdle());
      assertFalse(cacheCfg.jmxStatistics().enabled());

      region = (EntityRegionImpl) factory.buildEntityRegion(address, p, MUTABLE_NON_VERSIONED);
      assertNotNull(factory.getTypeOverrides().get(person));
      assertTrue(factory.getDefinedConfigurations().contains(person));
      assertNull(factory.getTypeOverrides().get(address));
      cache = region.getCache();
      cacheCfg = cache.getCacheConfiguration();
      assertEquals(EvictionStrategy.LIRS, cacheCfg.eviction().strategy());
      assertEquals(3000, cacheCfg.expiration().wakeUpInterval());
      assertEquals(20000, cacheCfg.eviction().maxEntries());
      assertFalse(cacheCfg.jmxStatistics().enabled());

      region = (EntityRegionImpl) factory.buildEntityRegion(car, p, MUTABLE_NON_VERSIONED);
      assertNotNull(factory.getTypeOverrides().get(person));
      assertTrue(factory.getDefinedConfigurations().contains(person));
      assertNull(factory.getTypeOverrides().get(address));
      cache = region.getCache();
      cacheCfg = cache.getCacheConfiguration();
      assertEquals(EvictionStrategy.LIRS, cacheCfg.eviction().strategy());
      assertEquals(3000, cacheCfg.expiration().wakeUpInterval());
      assertEquals(20000, cacheCfg.eviction().maxEntries());
      assertFalse(cacheCfg.jmxStatistics().enabled());

      CollectionRegionImpl collectionRegion =
          (CollectionRegionImpl) factory.buildCollectionRegion(addresses, p, MUTABLE_NON_VERSIONED);
      assertNotNull(factory.getTypeOverrides().get(addresses));
      assertTrue(factory.getDefinedConfigurations().contains(person));
      assertNull(factory.getTypeOverrides().get(parts));
      cache = collectionRegion.getCache();
      cacheCfg = cache.getCacheConfiguration();
      assertEquals(EvictionStrategy.LIRS, cacheCfg.eviction().strategy());
      assertEquals(2500, cacheCfg.expiration().wakeUpInterval());
      assertEquals(5500, cacheCfg.eviction().maxEntries());
      assertEquals(65000, cacheCfg.expiration().lifespan());
      assertEquals(35000, cacheCfg.expiration().maxIdle());
      assertFalse(cacheCfg.jmxStatistics().enabled());

      collectionRegion =
          (CollectionRegionImpl) factory.buildCollectionRegion(parts, p, MUTABLE_NON_VERSIONED);
      assertNotNull(factory.getTypeOverrides().get(addresses));
      assertTrue(factory.getDefinedConfigurations().contains(addresses));
      assertNull(factory.getTypeOverrides().get(parts));
      cache = collectionRegion.getCache();
      cacheCfg = cache.getCacheConfiguration();
      assertEquals(EvictionStrategy.LRU, cacheCfg.eviction().strategy());
      assertEquals(3500, cacheCfg.expiration().wakeUpInterval());
      assertEquals(25000, cacheCfg.eviction().maxEntries());
      assertFalse(cacheCfg.jmxStatistics().enabled());

      collectionRegion =
          (CollectionRegionImpl) factory.buildCollectionRegion(parts, p, MUTABLE_NON_VERSIONED);
      assertNotNull(factory.getTypeOverrides().get(addresses));
      assertTrue(factory.getDefinedConfigurations().contains(addresses));
      assertNull(factory.getTypeOverrides().get(parts));
      cache = collectionRegion.getCache();
      cacheCfg = cache.getCacheConfiguration();
      assertEquals(EvictionStrategy.LRU, cacheCfg.eviction().strategy());
      assertEquals(3500, cacheCfg.expiration().wakeUpInterval());
      assertEquals(25000, cacheCfg.eviction().maxEntries());
      assertFalse(cacheCfg.jmxStatistics().enabled());
    } finally {
      factory.stop();
    }
  }