use of org.apache.geode.internal.cache.RegionEntry in project geode by apache.
the class MemoryIndexStoreJUnitTest method testClear.
@Test
public void testClear() throws Exception {
RegionEntry mockEntry1 = mockEntries[0];
RegionEntry mockEntry2 = mockEntries[1];
store.addMapping("1", mockEntry1);
store.addMapping("1", mockEntry2);
store.clear();
assertEquals(0, numObjectsInStore(store));
}
use of org.apache.geode.internal.cache.RegionEntry in project geode by apache.
the class MemoryIndexStoreJUnitTest method testDescendingIteratorReturnsExpectedOrderOfEntries.
@Test
public void testDescendingIteratorReturnsExpectedOrderOfEntries() throws Exception {
RegionEntry mockEntry1 = mockEntries[0];
RegionEntry mockEntry2 = mockEntries[1];
store.addMapping("1", mockEntry1);
store.addMapping("2", mockEntry2);
Iterator iteratorFirst = store.descendingIterator(null);
assertEquals(2, numObjectsIterated(iteratorFirst));
Iterator iterator = store.descendingIterator(null);
iterator.hasNext();
assertEquals(mockEntry2, ((MemoryIndexStore.MemoryIndexStoreEntry) iterator.next()).getRegionEntry());
iterator.hasNext();
assertEquals(mockEntry1, ((MemoryIndexStore.MemoryIndexStoreEntry) iterator.next()).getRegionEntry());
}
use of org.apache.geode.internal.cache.RegionEntry in project geode by apache.
the class MemoryIndexStoreJUnitTest method testGetReturnsExpectedIteratorValue.
@Test
public void testGetReturnsExpectedIteratorValue() throws Exception {
RegionEntry mockEntry1 = mockEntries[0];
RegionEntry mockEntry2 = mockEntries[1];
store.addMapping("1", mockEntry1);
store.addMapping("2", mockEntry2);
assertEquals(1, numObjectsIterated(store.get("1")));
}
use of org.apache.geode.internal.cache.RegionEntry in project geode by apache.
the class MemoryIndexStoreJUnitTest method testGetReturnsExpectedIteratorWithMultipleValues.
@Test
public void testGetReturnsExpectedIteratorWithMultipleValues() throws Exception {
RegionEntry mockEntry1 = mockEntries[0];
RegionEntry mockEntry2 = mockEntries[1];
RegionEntry mockEntry3 = mockEntries[2];
RegionEntry mockEntry4 = mockEntries[3];
store.addMapping("1", mockEntry1);
store.addMapping("1", mockEntry2);
store.addMapping("1", mockEntry3);
store.addMapping("2", mockEntry4);
assertEquals(3, numObjectsIterated(store.get("1")));
assertEquals(4, numObjectsInStore(store));
}
use of org.apache.geode.internal.cache.RegionEntry in project geode by apache.
the class MultiVMRegionTestCase method versionTestGIISendsTombstones.
/*
* This test creates a server cache in vm0 and a peer cache in vm1. It then tests to see if GII
* transferred tombstones to vm1 like it's supposed to. A client cache is created in vm2 and the
* same sort of check is performed for register-interest.
*/
public void versionTestGIISendsTombstones() throws Exception {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
VM vm2 = host.getVM(2);
final int serverPort = AvailablePortHelper.getRandomAvailableTCPPort();
// create replicated regions in VM 0 and 1, then perform concurrent ops
// on the same key while creating the region in VM2. Afterward make
// sure that all three regions are consistent
final String name = this.getUniqueName() + "-CC";
SerializableRunnable createRegion = new SerializableRunnable("Create Region") {
@Override
public void run() {
try {
RegionFactory f = getCache().createRegionFactory(getRegionAttributes());
CCRegion = (LocalRegion) f.create(name);
if (VM.getCurrentVMNum() == 0) {
CacheServer bridge = CCRegion.getCache().addCacheServer();
bridge.setPort(serverPort);
try {
bridge.start();
} catch (IOException ex) {
fail("While creating bridge", ex);
}
}
} catch (CacheException ex) {
fail("While creating region", ex);
}
}
};
SerializableRunnable asserter = new SerializableRunnable("ensure tombstone has been received") {
@Override
public void run() {
RegionEntry entry = CCRegion.getRegionEntry("object2");
assertTrue(entry != null);
assertTrue(entry.isTombstone());
}
};
vm0.invoke(createRegion);
vm0.invoke(new SerializableRunnable("create some tombstones") {
@Override
public void run() {
CCRegion.put("object1", "value1");
CCRegion.put("object2", "value2");
CCRegion.put("object3", "value3");
CCRegion.destroy("object2");
}
});
try {
vm0.invoke(asserter);
vm1.invoke(createRegion);
vm1.invoke(asserter);
// vm2.invoke(createClientCache);
// vm2.invoke(asserter);
} finally {
disconnectAllFromDS();
}
}
Aggregations