Search in sources :

Example 21 with Prepare

use of com.hazelcast.simulator.test.annotations.Prepare in project hazelcast-simulator by hazelcast.

the class IntBytesICacheCircuitBreakerTest method prepare.

@Prepare
public void prepare() {
    Random random = new Random();
    values = new byte[valueCount][];
    for (int i = 0; i < values.length; i++) {
        int delta = valueMaxSize - valueMinSize;
        int length = delta == 0 ? valueMinSize : valueMinSize + random.nextInt(delta);
        values[i] = generateByteArray(random, length);
    }
    Streamer<Integer, Object> streamer = StreamerFactory.getInstance(cache);
    for (int key : keys) {
        streamer.pushEntry(key, values[random.nextInt(values.length)]);
    }
    streamer.await();
}
Also used : Random(java.util.Random) Prepare(com.hazelcast.simulator.test.annotations.Prepare)

Example 22 with Prepare

use of com.hazelcast.simulator.test.annotations.Prepare in project hazelcast-simulator by hazelcast.

the class AllKeySetTest method prepare.

@Prepare(global = true)
public void prepare() {
    Streamer<String, String> streamer = StreamerFactory.getInstance(map);
    for (int i = 0; i < entryCount; i++) {
        String key = generateString(keyLength);
        String value = generateString(valueLength);
        streamer.pushEntry(key, value);
    }
    streamer.await();
}
Also used : GeneratorUtils.generateString(com.hazelcast.simulator.utils.GeneratorUtils.generateString) Prepare(com.hazelcast.simulator.test.annotations.Prepare)

Example 23 with Prepare

use of com.hazelcast.simulator.test.annotations.Prepare in project hazelcast-simulator by hazelcast.

the class IntIntMapTest method prepare.

@Prepare(global = false)
public void prepare() {
    waitClusterSize(logger, targetInstance, minNumberOfMembers);
    keys = generateIntKeys(keyCount, keyLocality, targetInstance);
    Streamer<Integer, Integer> streamer = StreamerFactory.getInstance(map);
    Random random = new Random();
    for (int key : keys) {
        int value = random.nextInt(Integer.MAX_VALUE);
        streamer.pushEntry(key, value);
    }
    streamer.await();
}
Also used : Random(java.util.Random) Prepare(com.hazelcast.simulator.test.annotations.Prepare)

Example 24 with Prepare

use of com.hazelcast.simulator.test.annotations.Prepare in project hazelcast-simulator by hazelcast.

the class StringICacheTest method prepare.

@Prepare
public void prepare() {
    waitClusterSize(logger, targetInstance, minNumberOfMembers);
    keys = generateStringKeys(keyCount, keyLength, keyLocality, targetInstance);
    if (valueLength > -1) {
        minValueLength = valueLength;
        maxValueLength = valueLength;
    }
    values = generateStrings(valueCount, minValueLength, maxValueLength);
    Random random = new Random();
    Streamer<String, String> streamer = StreamerFactory.getInstance(cache);
    for (String key : keys) {
        String value = values[random.nextInt(valueCount)];
        streamer.pushEntry(key, value);
    }
    streamer.await();
}
Also used : Random(java.util.Random) Prepare(com.hazelcast.simulator.test.annotations.Prepare)

Example 25 with Prepare

use of com.hazelcast.simulator.test.annotations.Prepare in project hazelcast-simulator by hazelcast.

the class IntByteMapTest method prepare.

@Prepare
public void prepare() {
    Random random = new Random();
    values = new byte[valueCount][];
    for (int i = 0; i < values.length; i++) {
        int delta = maxSize - minSize;
        int length = delta == 0 ? minSize : minSize + random.nextInt(delta);
        values[i] = generateByteArray(random, length);
    }
    Streamer<Integer, Object> streamer = StreamerFactory.getInstance(map);
    for (int key : keys) {
        streamer.pushEntry(key, values[random.nextInt(values.length)]);
    }
    streamer.await();
}
Also used : Random(java.util.Random) Prepare(com.hazelcast.simulator.test.annotations.Prepare)

Aggregations

Prepare (com.hazelcast.simulator.test.annotations.Prepare)29 Random (java.util.Random)17 GeneratorUtils.generateString (com.hazelcast.simulator.utils.GeneratorUtils.generateString)4 IAtomicLong (com.hazelcast.core.IAtomicLong)2 HashMap (java.util.HashMap)2 JsonObject (com.couchbase.client.java.document.json.JsonObject)1 Member (com.hazelcast.core.Member)1 Address (com.hazelcast.nio.Address)1 Connection (com.hazelcast.nio.Connection)1 ExternalizablePojo (com.hazelcast.simulator.hz.ExternalizablePojo)1 SerializablePojo (com.hazelcast.simulator.hz.SerializablePojo)1 DomainObject (com.hazelcast.simulator.tests.map.domain.DomainObject)1 DomainObjectFactory (com.hazelcast.simulator.tests.map.domain.DomainObjectFactory)1 ComplexDomainObject (com.hazelcast.simulator.tests.map.helpers.ComplexDomainObject)1 DataSerializableEmployee (com.hazelcast.simulator.tests.map.helpers.DataSerializableEmployee)1 Employee (com.hazelcast.simulator.tests.map.helpers.Employee)1 EventCount (com.hazelcast.simulator.tests.map.helpers.EventCount)1 TreeMap (java.util.TreeMap)1