Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

How to use the framework:

  • Test class has to extend IgniteConfigVariationsAbstractTest or IgniteCacheConfigVariationsAbstractTestextend IgniteConfigVariationsAbstractTest or IgniteCacheConfigVariationsAbstractTest.

  • TestSuite has to be built using ConfigVariationsTestSuiteBuilderusing ConfigVariationsTestSuiteBuilder.

As an example see IgniteCacheBasicConfigVariationsFullApiTestSuite.

...

  1. The following code will test SomeFunctionalityTest with basic set of IgniteConfiguration variations (BinaryMarshaller OptimizedMarshaller and enabled / disabled per class loading), will be used Ignite cluster with 3 nodes, the second started node is client (client with idx=1), each test-method will be run with testedGrid=0 and testedGrid=1 (see testedGrid() method) .

    Code Block
    TestSuite suite = new ConfigVariationsTestSuiteBuilder(
        "Basic Ignite Configuration Variations Some Functionality Test Suite", 
    	SomeFunctionalityTest.class)
        .gridsCount(3)
        .testedNodesCount(2).withClients()
        .build();
  2. The following code will test SomeFunctionalityTestSomeCacheFunctionalityTest with basic set of IgniteConfiguration variations (see above) , will be used Ignite and basic set of CacheConfiguration variations (different cache modes, atomicity modes and memory modes), Ignite cluster with 5 nodes will be used, the second started node is client (with nodeIdx=1) and the third started node is client with near-only cache (with nodeIdx=2), each test-method will be run with testedGrid=0 and testedGrid=,1 and 2 (see see testedGrid() and jcache() method methods) .

    Code Block
    TestSuite suite = new ConfigVariationsTestSuiteBuilder(
        "Basic Cache Configuration Variations Some Cache Functionality Test Suite",
        SomeCacheFunctionalityTest.class)
        .withBasicCacheParams()
        .gridsCount(5).backups(1)
        .testedNodesCount(3).withClients()
        .build();

...

IgniteConfigVariationsAbstractTest has methods key(int i) and value(int i). To run a test scenario in all supported by the framework data modes (Serializable, Externaliazable, plane, mixed and etc. objects), it's enough to write test scenario using these methods to generate different keys and values and to place test scenario inside runInAllDataModes(TestRunnable runnable) method. 

For example to , the following code test cache's put-get scenario in all supported by the framework data modes you can write the following code:

Code Block
public void testPutGet() throws Exception {
    runInAllDataModes(new TestRunnable() {
        @Override public void run() throws Exception {
            IgniteCache cache = jcache();

            Object key = key(1);
            Object val = value(1);
            
            cache.put(key, val);
            
            assertEquals(val, cache.get(key));
        }
    });
}

Implementation information