@SuppressWarnings("rawtypes") @Test public void testPublishingReplica() throws Exception { assertTrue(context.containsBean("pub")); RegionFactoryBean fb = context.getBean("&pub", RegionFactoryBean.class); assertTrue(fb instanceof ReplicatedRegionFactoryBean); assertEquals(Scope.DISTRIBUTED_ACK, TestUtils.readField("scope", fb)); assertEquals("publisher", TestUtils.readField("name", fb)); RegionAttributes attrs = TestUtils.readField("attributes", fb); assertFalse(attrs.getPublisher()); }
@SuppressWarnings("rawtypes") @Test public void testComplexReplica() throws Exception { assertTrue(context.containsBean("complex")); RegionFactoryBean fb = context.getBean("&complex", RegionFactoryBean.class); CacheListener[] listeners = TestUtils.readField("cacheListeners", fb); assertFalse(ObjectUtils.isEmpty(listeners)); assertEquals(2, listeners.length); assertSame(listeners[0], context.getBean("c-listener")); assertSame(context.getBean("c-loader"), TestUtils.readField("cacheLoader", fb)); assertSame(context.getBean("c-writer"), TestUtils.readField("cacheWriter", fb)); }
@SuppressWarnings("rawtypes") @Test public void testRegionLookup() throws Exception { Cache cache = context.getBean(Cache.class); Region existing = cache.createRegionFactory().create("existing"); assertTrue(context.containsBean("lookup")); RegionLookupFactoryBean lfb = context.getBean("&lookup", RegionLookupFactoryBean.class); assertEquals("existing", TestUtils.readField("name", lfb)); assertEquals(existing, context.getBean("lookup")); }