Search in sources :

Example 1 with StrongCounterConfiguration

use of org.infinispan.counter.configuration.StrongCounterConfiguration in project infinispan by infinispan.

the class ConfigurationTest method assertBoundedStrongCounter.

private void assertBoundedStrongCounter(CounterManagerConfiguration config, String name, long initialValue, long min, long max, long lifespan, Storage storage) {
    for (AbstractCounterConfiguration counterConfig : config.counters().values()) {
        if (counterConfig.name().equals(name)) {
            assertTrue(counterConfig instanceof StrongCounterConfiguration);
            assertEquals(initialValue, counterConfig.initialValue());
            assertEquals(storage, counterConfig.storage());
            assertTrue(((StrongCounterConfiguration) counterConfig).isBound());
            assertEquals(min, ((StrongCounterConfiguration) counterConfig).lowerBound());
            assertEquals(max, ((StrongCounterConfiguration) counterConfig).upperBound());
            assertEquals(lifespan, ((StrongCounterConfiguration) counterConfig).lifespan());
            return;
        }
    }
    fail();
}
Also used : StrongCounterConfiguration(org.infinispan.counter.configuration.StrongCounterConfiguration) AbstractCounterConfiguration(org.infinispan.counter.configuration.AbstractCounterConfiguration)

Example 2 with StrongCounterConfiguration

use of org.infinispan.counter.configuration.StrongCounterConfiguration in project infinispan by infinispan.

the class ConfigurationTest method assertUnboundedStrongCounter.

private void assertUnboundedStrongCounter(CounterManagerConfiguration config) {
    for (AbstractCounterConfiguration counterConfig : config.counters().values()) {
        if (counterConfig.name().equals("unbounded-strong-1")) {
            assertTrue(counterConfig instanceof StrongCounterConfiguration);
            assertEquals(1, counterConfig.initialValue());
            assertEquals(-1, ((StrongCounterConfiguration) counterConfig).lifespan());
            assertEquals(Storage.VOLATILE, counterConfig.storage());
            return;
        }
    }
    fail();
}
Also used : StrongCounterConfiguration(org.infinispan.counter.configuration.StrongCounterConfiguration) AbstractCounterConfiguration(org.infinispan.counter.configuration.AbstractCounterConfiguration)

Aggregations

AbstractCounterConfiguration (org.infinispan.counter.configuration.AbstractCounterConfiguration)2 StrongCounterConfiguration (org.infinispan.counter.configuration.StrongCounterConfiguration)2