Search in sources :

Example 81 with CacheFactory

use of org.apache.geode.cache.CacheFactory in project geode by apache.

the class DistributedSystemStatsJUnitTest method setUp.

@SuppressWarnings("deprecation")
@Before
public void setUp() throws Exception {
    final Properties props = new Properties();
    props.setProperty(MCAST_PORT, "0");
    props.setProperty(ENABLE_TIME_STATISTICS, "true");
    props.setProperty(STATISTIC_SAMPLING_ENABLED, "false");
    props.setProperty(STATISTIC_SAMPLE_RATE, "60000");
    props.setProperty(JMX_MANAGER, "true");
    props.setProperty(JMX_MANAGER_START, "true");
    // set JMX_MANAGER_UPDATE_RATE to practically an infinite value, so that
    // LocalManager wont try to run ManagementTask
    props.setProperty(JMX_MANAGER_UPDATE_RATE, "60000");
    props.setProperty(JMX_MANAGER_PORT, "0");
    this.system = (InternalDistributedSystem) DistributedSystem.connect(props);
    assertNotNull(this.system.getStatSampler());
    assertNotNull(this.system.getStatSampler().waitForSampleCollector(TIMEOUT));
    this.cache = new CacheFactory().create();
}
Also used : ConfigurationProperties(org.apache.geode.distributed.ConfigurationProperties) Properties(java.util.Properties) CacheFactory(org.apache.geode.cache.CacheFactory) Before(org.junit.Before)

Example 82 with CacheFactory

use of org.apache.geode.cache.CacheFactory in project geode by apache.

the class IntegratedSecurityCacheLifecycleIntegrationTest method before.

@Before
public void before() {
    securityService = IntegratedSecurityService.getSecurityService();
    securityProps = new Properties();
    securityProps.setProperty(SECURITY_MANAGER, SpySecurityManager.class.getName());
    Properties props = new Properties();
    props.putAll(securityProps);
    props.setProperty(MCAST_PORT, "0");
    props.setProperty(LOCATORS, "");
    cache = new CacheFactory(props).create();
}
Also used : Properties(java.util.Properties) CacheFactory(org.apache.geode.cache.CacheFactory) Before(org.junit.Before)

Example 83 with CacheFactory

use of org.apache.geode.cache.CacheFactory in project geode by apache.

the class ClusterConfigWithEmbededLocatorDUnitTest method testEmbeddedLocator.

@Test
public void testEmbeddedLocator() throws Exception {
    int locatorPort = AvailablePortHelper.getRandomAvailableTCPPort();
    // locator started this way won't have cluster configuration running
    locator.invoke(() -> {
        new CacheFactory().set("name", this.getName() + ".server1").set("mcast-port", "0").set("log-level", "config").set("start-locator", "localhost[" + locatorPort + "]").create();
    });
    // when this server joins the above locator, it won't request the cluster config from the
    // locator
    // since DM.getAllHostedLocatorsWithSharedConfiguration() will return an empty list. This would
    // execute without error
    new CacheFactory().set("name", this.getName() + ".server2").set("mcast-port", "0").set("log-level", "config").set("locators", "localhost[" + locatorPort + "]").create();
}
Also used : CacheFactory(org.apache.geode.cache.CacheFactory) SecurityTest(org.apache.geode.test.junit.categories.SecurityTest) Test(org.junit.Test) DistributedTest(org.apache.geode.test.junit.categories.DistributedTest)

Example 84 with CacheFactory

use of org.apache.geode.cache.CacheFactory in project geode by apache.

the class SortedSetsJUnitTest method setUp.

@BeforeClass
public static void setUp() throws IOException {
    rand = new Random();
    CacheFactory cf = new CacheFactory();
    // cf.set("log-file", "redis.log");
    cf.set(LOG_LEVEL, "error");
    cf.set(MCAST_PORT, "0");
    cf.set(LOCATORS, "");
    cache = cf.create();
    port = AvailablePortHelper.getRandomAvailableTCPPort();
    server = new GeodeRedisServer("localhost", port);
    server.start();
    jedis = new Jedis("localhost", port, 10000000);
}
Also used : Jedis(redis.clients.jedis.Jedis) GeodeRedisServer(org.apache.geode.redis.GeodeRedisServer) CacheFactory(org.apache.geode.cache.CacheFactory) BeforeClass(org.junit.BeforeClass)

Example 85 with CacheFactory

use of org.apache.geode.cache.CacheFactory in project geode by apache.

the class DistTXReleasesOffHeapOnCloseJUnitTest method createCache.

@Override
protected void createCache() {
    Properties props = new Properties();
    props.setProperty(MCAST_PORT, "0");
    props.setProperty(LOCATORS, "");
    props.setProperty(ConfigurationProperties.OFF_HEAP_MEMORY_SIZE, "1m");
    props.put(ConfigurationProperties.DISTRIBUTED_TRANSACTIONS, "true");
    cache = new CacheFactory(props).create();
    CacheTransactionManager txmgr = cache.getCacheTransactionManager();
    assert (txmgr.isDistributed());
}
Also used : ConfigurationProperties(org.apache.geode.distributed.ConfigurationProperties) Properties(java.util.Properties) CacheFactory(org.apache.geode.cache.CacheFactory) CacheTransactionManager(org.apache.geode.cache.CacheTransactionManager)

Aggregations

CacheFactory (org.apache.geode.cache.CacheFactory)125 Properties (java.util.Properties)51 Test (org.junit.Test)51 Cache (org.apache.geode.cache.Cache)44 IntegrationTest (org.apache.geode.test.junit.categories.IntegrationTest)38 ConfigurationProperties (org.apache.geode.distributed.ConfigurationProperties)28 Region (org.apache.geode.cache.Region)21 ClientCacheFactory (org.apache.geode.cache.client.ClientCacheFactory)18 CacheServer (org.apache.geode.cache.server.CacheServer)17 SerializableCallable (org.apache.geode.test.dunit.SerializableCallable)17 File (java.io.File)15 Before (org.junit.Before)14 SerializationTest (org.apache.geode.test.junit.categories.SerializationTest)13 DistributedTest (org.apache.geode.test.junit.categories.DistributedTest)12 ClientCache (org.apache.geode.cache.client.ClientCache)11 Host (org.apache.geode.test.dunit.Host)11 IOException (java.io.IOException)10 AttributesFactory (org.apache.geode.cache.AttributesFactory)10 PdxType (org.apache.geode.pdx.internal.PdxType)9 MyPdxSerializer (com.examples.snapshot.MyPdxSerializer)8