Search in sources :

Example 1 with ConfigParameter

use of org.apache.ignite.testframework.configvariations.ConfigParameter in project ignite by apache.

the class ParametersTest method testEnumVariationsWithNull.

/**
 * @throws Exception If failed.
 */
@SuppressWarnings("unchecked")
public void testEnumVariationsWithNull() throws Exception {
    ConfigParameter<CacheConfiguration>[] cfgParam = Parameters.enumParameters(true, "setCacheMode", CacheMode.class);
    assertEquals(CacheMode.values().length + 1, cfgParam.length);
    cfgParam[0] = null;
    Set<CacheMode> set = new HashSet<>();
    for (int i = 1; i < cfgParam.length; i++) {
        ConfigParameter<CacheConfiguration> modeApplier = cfgParam[i];
        CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
        modeApplier.apply(cfg);
        CacheMode mode = cfg.getCacheMode();
        set.add(mode);
        System.out.println(">>> " + mode);
    }
    assertEquals(CacheMode.values().length, set.size());
}
Also used : ConfigParameter(org.apache.ignite.testframework.configvariations.ConfigParameter) CacheMode(org.apache.ignite.cache.CacheMode) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) HashSet(java.util.HashSet)

Example 2 with ConfigParameter

use of org.apache.ignite.testframework.configvariations.ConfigParameter in project ignite by apache.

the class ParametersTest method testEnumVariations.

/**
 * @throws Exception If failed.
 */
public void testEnumVariations() throws Exception {
    ConfigParameter<CacheConfiguration>[] modes = Parameters.enumParameters("setCacheMode", CacheMode.class);
    assertEquals(CacheMode.values().length, modes.length);
    Set<CacheMode> res = new HashSet<>();
    for (ConfigParameter<CacheConfiguration> modeApplier : modes) {
        CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
        modeApplier.apply(cfg);
        CacheMode mode = cfg.getCacheMode();
        res.add(mode);
        System.out.println(">>> " + mode);
    }
    assertEquals(modes.length, res.size());
}
Also used : ConfigParameter(org.apache.ignite.testframework.configvariations.ConfigParameter) CacheMode(org.apache.ignite.cache.CacheMode) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) HashSet(java.util.HashSet)

Aggregations

HashSet (java.util.HashSet)2 CacheMode (org.apache.ignite.cache.CacheMode)2 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)2 ConfigParameter (org.apache.ignite.testframework.configvariations.ConfigParameter)2