Search in sources :

Example 11 with Prepare

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

the class LongExternalizableCacheTest method prepare.

@Prepare(global = true)
public void prepare() {
    Streamer<Long, ExternalizablePojo> streamer = StreamerFactory.getInstance(cache);
    for (long key = 0; key < keyDomain; key++) {
        streamer.pushEntry(key, new ExternalizablePojo());
    }
    streamer.await();
}
Also used : ExternalizablePojo(com.hazelcast.simulator.hz.ExternalizablePojo) Prepare(com.hazelcast.simulator.test.annotations.Prepare)

Example 12 with Prepare

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

the class MapTxTest method prepare.

@Prepare
public void prepare() {
    keys = generateIntKeys(keyCount, keyLocality, targetInstance);
    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, byte[]> streamer = StreamerFactory.getInstance(map);
    for (int key : keys) {
        byte[] 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 13 with Prepare

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

the class LockTest method prepare.

@Prepare(global = true)
public void prepare() {
    for (int i = 0; i < lockCount; i++) {
        long key = lockCounter.getAndIncrement();
        targetInstance.getLock(getLockId(key));
        IAtomicLong account = targetInstance.getAtomicLong(getAccountId(key));
        account.set(initialAmount);
    }
}
Also used : IAtomicLong(com.hazelcast.core.IAtomicLong) Prepare(com.hazelcast.simulator.test.annotations.Prepare)

Example 14 with Prepare

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

the class LongStringCacheTest method prepare.

@Prepare(global = true)
public void prepare() {
    Random random = new Random();
    for (long key = 0; key < keyDomain; key++) {
        String value = values[random.nextInt(valueCount)];
        cache.put(key, value);
    }
}
Also used : Random(java.util.Random) Prepare(com.hazelcast.simulator.test.annotations.Prepare)

Example 15 with Prepare

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

the class LongStringCacheTest method prepare.

@Prepare(global = true)
public void prepare() {
    Random random = new Random();
    for (long key = 0; key < keyDomain; key++) {
        String value = values[random.nextInt(valueCount)];
        cache.put(key, value);
    }
}
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