use of com.hazelcast.simulator.test.annotations.TimeStep in project hazelcast-simulator by hazelcast.
the class MapPredicateTest method predicateBuilder.
@TimeStep(prob = 0.2)
public void predicateBuilder(ThreadState state) {
long startMs = System.currentTimeMillis();
int age = state.randomInt(Employee.MAX_AGE);
String name = Employee.getRandomName();
// TODO: Still broken because it relies on reflection which is dog slow, so we need an explicit AgeNamePredicate
EntryObject entryObject = new PredicateBuilder().getEntryObject();
Predicate agePredicate = entryObject.get("age").lessThan(age);
Predicate ageNamePredicate = entryObject.get("name").equal(name).and(agePredicate);
Collection<Employee> employees = map.values(ageNamePredicate);
for (Employee emp : employees) {
String assertMessage = format(baseAssertMessage, emp, ageNamePredicate);
assertTrue(assertMessage, emp.getAge() < age);
assertTrue(assertMessage, emp.getName().equals(name));
}
state.operationCounter.predicateBuilderCount++;
updateStats(state, startMs);
}
use of com.hazelcast.simulator.test.annotations.TimeStep in project hazelcast-simulator by hazelcast.
the class MapReduceTest method modifyMapEntry.
@TimeStep(prob = 0.25)
public void modifyMapEntry(ThreadState state) {
Employee employee = map.get(state.randomInt(keyCount));
employee.randomizeProperties();
map.put(employee.getId(), employee);
state.operationCounter.modifyMapEntry++;
}
use of com.hazelcast.simulator.test.annotations.TimeStep in project hazelcast-simulator by hazelcast.
the class SerializationStrategyTest method getByStringIndex.
@TimeStep(prob = 1)
public void getByStringIndex(ThreadState state) {
String string = state.getUniqueString();
Predicate predicate = Predicates.equal("stringVal", string);
Set<Map.Entry<String, DomainObject>> entries = map.entrySet(predicate);
throttlingLogger.log(Level.INFO, "GetByStringIndex: " + entries.size() + " entries");
}
use of com.hazelcast.simulator.test.annotations.TimeStep in project hazelcast-simulator by hazelcast.
the class MangleICacheTest method closeCache.
@TimeStep(prob = 0.1)
public void closeCache(ThreadState state) {
int cacheNumber = state.randomInt(maxCaches);
Cache cache = state.getCacheIfExists(cacheNumber);
try {
if (cache != null) {
cache.close();
state.counter.cacheClose++;
}
} catch (CacheException e) {
state.counter.cacheCloseException++;
} catch (IllegalStateException e) {
state.counter.cacheCloseException++;
}
}
use of com.hazelcast.simulator.test.annotations.TimeStep in project hazelcast-simulator by hazelcast.
the class ListenerICacheTest method putExpiry.
@TimeStep(prob = 0)
public void putExpiry(ThreadState state) {
int expiryDuration = state.randomInt(maxExpiryDurationMs);
ExpiryPolicy expiryPolicy = new CreatedExpiryPolicy(new Duration(MILLISECONDS, expiryDuration));
int key = state.randomInt(keyCount);
cache.put(key, state.randomLong(), expiryPolicy);
state.putExpiry++;
}
Aggregations