Search in sources :

Example 86 with DistributedSystem

use of org.apache.geode.distributed.DistributedSystem in project geode by apache.

the class Bug36995DUnitTest method createCache.

private void createCache(Properties props) throws Exception {
    DistributedSystem ds = getSystem(props);
    ds.disconnect();
    ds = getSystem(props);
    assertNotNull(ds);
    cache = CacheFactory.create(ds);
    assertNotNull(cache);
}
Also used : DistributedSystem(org.apache.geode.distributed.DistributedSystem)

Example 87 with DistributedSystem

use of org.apache.geode.distributed.DistributedSystem in project geode by apache.

the class CacheServerTestUtil method createClientCache.

private void createClientCache(Properties props, ClientCacheFactory ccf) throws Exception {
    DistributedSystem ds = getSystem(props);
    assertNotNull(ds);
    ds.disconnect();
    ClientCache cc = ccf.create();
    setSystem(props, cc.getDistributedSystem());
    cache = (Cache) cc;
    assertNotNull(cache);
    expected = IgnoredException.addIgnoredException("java.net.ConnectionException||java.net.SocketException");
}
Also used : ClientCache(org.apache.geode.cache.client.ClientCache) DistributedSystem(org.apache.geode.distributed.DistributedSystem)

Example 88 with DistributedSystem

use of org.apache.geode.distributed.DistributedSystem in project geode by apache.

the class HAStartupAndFailoverDUnitTest method createCache.

private void createCache(Properties props) throws Exception {
    DistributedSystem ds = getSystem(props);
    assertNotNull(ds);
    ds.disconnect();
    ds = getSystem(props);
    cache = CacheFactory.create(ds);
    assertNotNull(cache);
}
Also used : DistributedSystem(org.apache.geode.distributed.DistributedSystem)

Example 89 with DistributedSystem

use of org.apache.geode.distributed.DistributedSystem in project geode by apache.

the class EventIDVerificationDUnitTest method createCache.

private void createCache(Properties props) throws Exception {
    DistributedSystem ds = getSystem(props);
    ds.disconnect();
    ds = getSystem(props);
    assertNotNull(ds);
    cache = CacheFactory.create(ds);
    assertNotNull(cache);
}
Also used : DistributedSystem(org.apache.geode.distributed.DistributedSystem)

Example 90 with DistributedSystem

use of org.apache.geode.distributed.DistributedSystem in project geode by apache.

the class LonerDMJUnitTest method testLonerWithStats.

@Test
public void testLonerWithStats() throws CacheException {
    long start;
    long end;
    DistributedSystem ds = null;
    Cache c = null;
    Properties cfg = new Properties();
    cfg.setProperty(MCAST_PORT, "0");
    cfg.setProperty(LOCATORS, "");
    cfg.setProperty(STATISTIC_SAMPLING_ENABLED, "true");
    cfg.setProperty(STATISTIC_ARCHIVE_FILE, "lonerStats.gfs");
    cfg.setProperty(ENABLE_NETWORK_PARTITION_DETECTION, "false");
    for (int i = 0; i < 1; i++) {
        start = System.currentTimeMillis();
        ds = DistributedSystem.connect(cfg);
        end = System.currentTimeMillis();
        System.out.println("ds.connect took    " + (end - start) + " ms");
        try {
            start = System.currentTimeMillis();
            c = CacheFactory.create(ds);
            end = System.currentTimeMillis();
            System.out.println("Cache create took " + (end - start) + " ms");
            try {
                AttributesFactory af = new AttributesFactory();
                af.setScope(Scope.GLOBAL);
                Region r = c.createRegion("loner", af.create());
                r.put("key1", "value1");
                r.get("key1");
                r.get("key2");
                r.invalidate("key1");
                r.destroy("key1");
                r.destroyRegion();
            } finally {
                {
                    start = System.currentTimeMillis();
                    c.close();
                    end = System.currentTimeMillis();
                    System.out.println("Cache close took " + (end - start) + " ms");
                }
            }
        } finally {
            if (ds != null) {
                start = System.currentTimeMillis();
                ds.disconnect();
                end = System.currentTimeMillis();
                System.out.println("ds.disconnect took " + (end - start) + " ms");
            }
            ds = null;
        }
    }
}
Also used : ConfigurationProperties(org.apache.geode.distributed.ConfigurationProperties) Properties(java.util.Properties) DistributedSystem(org.apache.geode.distributed.DistributedSystem) InternalDistributedSystem(org.apache.geode.distributed.internal.InternalDistributedSystem) Test(org.junit.Test) IntegrationTest(org.apache.geode.test.junit.categories.IntegrationTest)

Aggregations

DistributedSystem (org.apache.geode.distributed.DistributedSystem)250 Properties (java.util.Properties)102 InternalDistributedSystem (org.apache.geode.distributed.internal.InternalDistributedSystem)65 ConfigurationProperties (org.apache.geode.distributed.ConfigurationProperties)61 Test (org.junit.Test)59 Cache (org.apache.geode.cache.Cache)55 AttributesFactory (org.apache.geode.cache.AttributesFactory)34 IntegrationTest (org.apache.geode.test.junit.categories.IntegrationTest)30 Region (org.apache.geode.cache.Region)24 IOException (java.io.IOException)20 CacheServer (org.apache.geode.cache.server.CacheServer)20 DistributedTest (org.apache.geode.test.junit.categories.DistributedTest)20 InternalCache (org.apache.geode.internal.cache.InternalCache)16 IgnoredException (org.apache.geode.test.dunit.IgnoredException)16 ArrayList (java.util.ArrayList)15 LogWriter (org.apache.geode.LogWriter)15 DistributedMember (org.apache.geode.distributed.DistributedMember)15 LocalRegion (org.apache.geode.internal.cache.LocalRegion)15 RegionAttributes (org.apache.geode.cache.RegionAttributes)14 Pool (org.apache.geode.cache.client.Pool)14