Search in sources :

Example 1 with DataSerializableEmployee

use of com.hazelcast.simulator.tests.map.helpers.DataSerializableEmployee in project hazelcast-simulator by hazelcast.

the class SqlPredicateTest method prepare.

@Prepare(global = true)
public void prepare() {
    Random random = new Random();
    Streamer<String, DataSerializableEmployee> streamer = StreamerFactory.getInstance(map);
    for (int i = 0; i < keyCount; i++) {
        String key = generateString(keyLength);
        DataSerializableEmployee value = generateRandomEmployee(random);
        streamer.pushEntry(key, value);
    }
    streamer.await();
    logger.info("Map size is: " + map.size());
    logger.info("Map localKeySet size is: " + map.localKeySet().size());
}
Also used : Random(java.util.Random) GeneratorUtils.generateString(com.hazelcast.simulator.utils.GeneratorUtils.generateString) DataSerializableEmployee(com.hazelcast.simulator.tests.map.helpers.DataSerializableEmployee) Prepare(com.hazelcast.simulator.test.annotations.Prepare)

Example 2 with DataSerializableEmployee

use of com.hazelcast.simulator.tests.map.helpers.DataSerializableEmployee in project hazelcast-simulator by hazelcast.

the class SqlPredicateTest method generateRandomEmployee.

private DataSerializableEmployee generateRandomEmployee(Random random) {
    int id = random.nextInt();
    String name = NAMES[random.nextInt(NAMES.length)];
    int age = random.nextInt(maxAge);
    boolean active = random.nextBoolean();
    double salary = random.nextDouble() * maxSalary;
    return new DataSerializableEmployee(id, name, age, active, salary);
}
Also used : GeneratorUtils.generateString(com.hazelcast.simulator.utils.GeneratorUtils.generateString) DataSerializableEmployee(com.hazelcast.simulator.tests.map.helpers.DataSerializableEmployee)

Aggregations

DataSerializableEmployee (com.hazelcast.simulator.tests.map.helpers.DataSerializableEmployee)2 GeneratorUtils.generateString (com.hazelcast.simulator.utils.GeneratorUtils.generateString)2 Prepare (com.hazelcast.simulator.test.annotations.Prepare)1 Random (java.util.Random)1