Skip navigation links
GemFire XD 1.5.6-rc1

Package com.gemstone.gemfire.cache30

Contains unit tests that form a "compatibility test suite" of sorts for the GemFire 3.0 distributed caching API.

See: Description

Package com.gemstone.gemfire.cache30 Description

Contains unit tests that form a "compatibility test suite" of sorts for the GemFire 3.0 distributed caching API. It was developed using a "clean room" technique in which someone other than the cache API implementation wrote the unit tests. These tests are intended to find bugs in both the implementation and the documentation of the cache API.

In hopes of keeping the tests organized, there is a hierarchy of abstract TestCase classes. Each class in the hierarchy contains tests for a certain class (RegionTestCase, for example) or group of classes (RegionAttributesTestCase, for example).


Below are descriptions of functionality and scenarios that need to be tested by unit tests.

Search Load and Write Unit tests

  1. Create a local region with no loader. Do region.get. Verify that null is returned.
  2. Create a local region with a cache loader that returns a canned value in the load method. Do region.get and verify that you get the canned value
  3. Create a local region with a cache loader that tries to do a netSearch. Do region.get and verify that a cacheLoader exception is thrown and the message. Reads, ``Cannot netSearch on Scope.LOCAL object''
  4. Create a local region with a cache loader and a cache writer. Do a get, verify that the cacheLoader is called. Verify that that changes to the callbackArgument are passed back and onto the cache writer. Verify that the cache writer beforeCreate is called.
  5. Create a local region with a cache loader and a cache writer. Create an entry. Do a get, verify that the cacheLoader is called. Verify that that changes to the callbackArgument are passed back and onto the cache writer. Verify that the cache writer beforeUpdate is called.
  6. Create a local region with a cache writer. Put a value twice. Verify that cacheWriter beforeCreate is called the first time. Verify that cacheWriter.beforeUpdate is called the second time.
  7. Create a local region with no cache writer. Put a value. Verify that put succeeds.
Distributed Region
  1. Create a mirrored distributed region with a local loader. Do a get on a new key. Verify that local load is invoked.
  2. Create a mirrored distributed region with no local loader. Do a get on a new key. Verify that net load is invoked.
  3. Create a distributed region with GLOBAL scope and local loader. Do a get on a new key. Verify that local load is invoked. Manually verify that netSearch was called and returned null.
  4. Create a distributed region with GLOBAL scope and remote loader. Do a get on a new key. Verify that net load is invoked. Manually verify that netSearch was called and returned null.
  5. Create a distributed region with GLOBAL scope and local and remote loader. Do a get on a new key. Verify that local load is invoked. Manually verify that netSearch was called and returned null.
  6. Create a distributed region with GLOBAL scope and local and remote loader. Do a put on the second VM. Do a get on the key that was put into the remote VM. Verify that local load is not invoked. Verify that netSearch was called and returns the expected value.
  7. Create a distributed region with DISTRIBUTED-ACK scope and remote cache writer. Do a create on the local VM. Verify that remote cache writer beforeCreate is invoked.
  8. Create a distributed region with DISTRIBUTED-ACK scope and remote cache writer. Do a put on the local VM. Verify that remote cache writer beforeUpdate is invoked.
  9. Create a distributed region with DISTRIBUTED-ACK scope and remote cache loader. Do a get on the local VM. Verify that remote cache loader is invoked. Have the loader call netSearch. Verify that the remote cache loader returns null.
  10. Create a distributed region with DISTRIBUTED-ACK scope and remote cache writer. Do a destroy on the local VM. Verify that remote cache writer is invoked.
  11. Create a distributed region with DISTRIBUTED-ACK scope and local and remote cache writer. Perform an operation, which triggers cache writer operations. Verify that local cache writer is invoked every time.
Race conditions:
  1. Create a distributed region with DISTRIBUTED-ACK scope and local and remote cache writer ( The test should have 3 VMs in the system). Do a get , which should trigger a netSearch. Randomly kill one of the other 2 VMs. Verify that netSearch returns the value if there is at least one system that can serve up the request.
    • Note: The DUnit framework isn't well-suited for "killing off" VMs. This functionality may have to be tested using a standard hydra test.
  2. Create a distributed region with DISTRIBUTED-ACK scope and remote cache writers (The test should have 3 VMs in the system). Do a put, which should trigger a netWrite. Randomly kill one of the other two VMs. Do this in a loop and verify that the cacheWrite succeeds if there is at least one system that can serve the request within the timeout period.
    • Note: The DUnit framework isn't well-suited for "killing off" VMs. This functionality may have to be tested using a standard hydra test.
Skip navigation links
GemFire XD 1.5.6-rc1

Copyright © 2010-2015 Pivotal Software, Inc. All rights reserved.