use of org.apache.geode.cache.CacheFactory in project geode by apache.
the class SnapshotPerformanceDUnitTest method createCache.
private void createCache() throws Exception {
SerializableCallable setup = new SerializableCallable() {
@Override
public Object call() throws Exception {
CacheFactory cf = new CacheFactory().setPdxSerializer(new MyPdxSerializer());
getCache(cf);
return null;
}
};
SnapshotDUnitTest.forEachVm(setup, true);
}
use of org.apache.geode.cache.CacheFactory in project geode by apache.
the class SnapshotTestCase method setUp.
@Before
public void setUp() throws Exception {
store = new File("store-" + Math.abs(new Random().nextInt()));
store.mkdir();
snaps = new File("snapshots-" + Math.abs(new Random().nextInt()));
snaps.mkdir();
rgen = new RegionGenerator();
CacheFactory cf = new CacheFactory().set(MCAST_PORT, "0").set(LOG_LEVEL, "error");
cache = cf.create();
ds = cache.createDiskStoreFactory().setMaxOplogSize(1).setDiskDirs(new File[] { store }).create("snapshotTest");
}
use of org.apache.geode.cache.CacheFactory in project geode by apache.
the class OffHeapValidationJUnitTest method createCache.
protected GemFireCacheImpl createCache() {
Properties props = new Properties();
props.setProperty(LOCATORS, "");
props.setProperty(MCAST_PORT, "0");
props.setProperty(ConfigurationProperties.OFF_HEAP_MEMORY_SIZE, getOffHeapMemorySize());
GemFireCacheImpl result = (GemFireCacheImpl) new CacheFactory(props).create();
return result;
}
use of org.apache.geode.cache.CacheFactory in project geode by apache.
the class XmlUtilsAddNewNodeJUnitTest method beforeClass.
@BeforeClass
public static void beforeClass() {
cache = new CacheFactory().set(MCAST_PORT, "0").create();
xPathContext.addNamespace(CacheXml.PREFIX, CacheXml.GEODE_NAMESPACE);
xPathContext.addNamespace(TEST_PREFIX, TEST_NAMESPACE);
}
use of org.apache.geode.cache.CacheFactory in project geode by apache.
the class IntegrationJUnitTest method testMemcachedBindAddress.
@Test
public void testMemcachedBindAddress() throws Exception {
Properties props = new Properties();
final int port = AvailablePortHelper.getRandomAvailableTCPPort();
props.setProperty(MEMCACHED_PORT, port + "");
props.setProperty(MEMCACHED_BIND_ADDRESS, "127.0.0.1");
props.put(MCAST_PORT, "0");
CacheFactory cf = new CacheFactory(props);
Cache cache = cf.create();
MemcachedClient client = new MemcachedClient(new InetSocketAddress("127.0.0.1", port));
Future<Boolean> f = client.add("key", 10, "myStringValue");
assertTrue(f.get());
Future<Boolean> f1 = client.add("key1", 10, "myStringValue1");
assertTrue(f1.get());
assertEquals("myStringValue", client.get("key"));
assertEquals("myStringValue1", client.get("key1"));
assertNull(client.get("nonExistentkey"));
cache.close();
}
Aggregations