Search in sources :

Example 11 with ClientCacheCreation

use of org.apache.geode.internal.cache.xmlcache.ClientCacheCreation in project geode by apache.

the class CacheXml66DUnitTest method testTXManagerOnClientCache.

@Test
public void testTXManagerOnClientCache() throws Exception {
    ClientCacheCreation cc = new ClientCacheCreation();
    // CacheCreation cc = new CacheCreation();
    CacheTransactionManagerCreation txMgrCreation = new CacheTransactionManagerCreation();
    txMgrCreation.addListener(new TestTXListener());
    cc.addCacheTransactionManagerCreation(txMgrCreation);
    testXml(cc);
    Cache c = getCache();
    assertTrue(c instanceof ClientCache);
    c.loadCacheXml(generate(cc));
    ClientCache clientC = (ClientCache) c;
    CacheTransactionManager mgr = clientC.getCacheTransactionManager();
    assertNotNull(mgr);
    assertTrue(mgr.getListeners()[0] instanceof TestTXListener);
}
Also used : CacheTransactionManagerCreation(org.apache.geode.internal.cache.xmlcache.CacheTransactionManagerCreation) ClientCacheCreation(org.apache.geode.internal.cache.xmlcache.ClientCacheCreation) ClientCache(org.apache.geode.cache.client.ClientCache) Cache(org.apache.geode.cache.Cache) ClientCache(org.apache.geode.cache.client.ClientCache) CacheTransactionManager(org.apache.geode.cache.CacheTransactionManager) Test(org.junit.Test)

Example 12 with ClientCacheCreation

use of org.apache.geode.internal.cache.xmlcache.ClientCacheCreation in project geode by apache.

the class CacheXml66DUnitTest method testNoTXWriterOnClient.

@Test
public void testNoTXWriterOnClient() throws Exception {
    // test writer is not created
    ClientCacheCreation cc = new ClientCacheCreation();
    CacheTransactionManagerCreation txMgrCreation = new CacheTransactionManagerCreation();
    txMgrCreation.setWriter(new TestTransactionWriter());
    cc.addCacheTransactionManagerCreation(txMgrCreation);
    IgnoredException expectedException = IgnoredException.addIgnoredException(LocalizedStrings.TXManager_NO_WRITER_ON_CLIENT.toLocalizedString());
    try {
        testXml(cc);
        fail("expected exception not thrown");
    } catch (IllegalStateException e) {
    } finally {
        expectedException.remove();
    }
}
Also used : CacheTransactionManagerCreation(org.apache.geode.internal.cache.xmlcache.CacheTransactionManagerCreation) ClientCacheCreation(org.apache.geode.internal.cache.xmlcache.ClientCacheCreation) IgnoredException(org.apache.geode.test.dunit.IgnoredException) Test(org.junit.Test)

Example 13 with ClientCacheCreation

use of org.apache.geode.internal.cache.xmlcache.ClientCacheCreation in project geode by apache.

the class CacheXml66DUnitTest method testCACHING_PROXY_HEAP_LRU.

@Test
public void testCACHING_PROXY_HEAP_LRU() throws Exception {
    ClientCacheCreation cache = new ClientCacheCreation();
    RegionCreation root = (RegionCreation) cache.createRegion("cproxylru", "CACHING_PROXY_HEAP_LRU");
    testXml(cache);
    GemFireCacheImpl c = (GemFireCacheImpl) getCache();
    assertEquals(true, c.isClient());
    Region r = c.getRegion("cproxylru");
    assertNotNull(r);
    RegionAttributes ra = r.getAttributes();
    assertEquals(DataPolicy.NORMAL, ra.getDataPolicy());
    assertEquals(Scope.LOCAL, ra.getScope());
    assertEquals("DEFAULT", ra.getPoolName());
    assertEquals(EvictionAttributes.createLRUHeapAttributes(), ra.getEvictionAttributes());
    assertEquals(LocalRegion.DEFAULT_HEAPLRU_EVICTION_HEAP_PERCENTAGE, c.getResourceManager().getEvictionHeapPercentage(), 0);
}
Also used : RegionAttributes(org.apache.geode.cache.RegionAttributes) ClientCacheCreation(org.apache.geode.internal.cache.xmlcache.ClientCacheCreation) GemFireCacheImpl(org.apache.geode.internal.cache.GemFireCacheImpl) LocalRegion(org.apache.geode.internal.cache.LocalRegion) PartitionedRegion(org.apache.geode.internal.cache.PartitionedRegion) Region(org.apache.geode.cache.Region) DistributedRegion(org.apache.geode.internal.cache.DistributedRegion) RegionCreation(org.apache.geode.internal.cache.xmlcache.RegionCreation) Test(org.junit.Test)

Aggregations

ClientCacheCreation (org.apache.geode.internal.cache.xmlcache.ClientCacheCreation)13 Test (org.junit.Test)12 GemFireCacheImpl (org.apache.geode.internal.cache.GemFireCacheImpl)10 Region (org.apache.geode.cache.Region)9 RegionAttributes (org.apache.geode.cache.RegionAttributes)9 DistributedRegion (org.apache.geode.internal.cache.DistributedRegion)9 LocalRegion (org.apache.geode.internal.cache.LocalRegion)9 PartitionedRegion (org.apache.geode.internal.cache.PartitionedRegion)9 RegionCreation (org.apache.geode.internal.cache.xmlcache.RegionCreation)9 Cache (org.apache.geode.cache.Cache)2 CacheTransactionManagerCreation (org.apache.geode.internal.cache.xmlcache.CacheTransactionManagerCreation)2 File (java.io.File)1 FileWriter (java.io.FileWriter)1 PrintWriter (java.io.PrintWriter)1 StringWriter (java.io.StringWriter)1 CacheTransactionManager (org.apache.geode.cache.CacheTransactionManager)1 ClientCache (org.apache.geode.cache.client.ClientCache)1 ClientRegionShortcut (org.apache.geode.cache.client.ClientRegionShortcut)1 IgnoredException (org.apache.geode.test.dunit.IgnoredException)1