Search in sources :

Example 26 with Prepare

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

the class MapEntryListenerTest method globalPrepare.

@Prepare(global = true)
public void globalPrepare() {
    EventCount initCounter = new EventCount();
    for (int i = 0; i < keyCount; i++) {
        map.put(i, values[i % valueLength]);
        initCounter.addCount.getAndIncrement();
    }
    eventCounts.add(initCounter);
}
Also used : EventCount(com.hazelcast.simulator.tests.map.helpers.EventCount) Prepare(com.hazelcast.simulator.test.annotations.Prepare)

Example 27 with Prepare

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

the class PagingPredicateTest method globalPrepare.

@Prepare(global = true)
public void globalPrepare() {
    if (useIndex) {
        map.addIndex("salary", true);
    }
    Streamer<Integer, Employee> streamer = StreamerFactory.getInstance(map);
    for (int i = 0; i < keyCount; i++) {
        Employee employee = new Employee(i);
        streamer.pushEntry(employee.getId(), employee);
    }
    streamer.await();
}
Also used : Employee(com.hazelcast.simulator.tests.map.helpers.Employee) Prepare(com.hazelcast.simulator.test.annotations.Prepare)

Example 28 with Prepare

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

the class SerializationStrategyTest method prepare.

@Prepare(global = true)
public void prepare() {
    int uniqueStringsCount = itemCount / recordsPerUnique;
    String[] strings = generateUniqueStrings(uniqueStringsCount);
    Streamer<String, DomainObject> streamer = StreamerFactory.getInstance(map);
    DomainObjectFactory objectFactory = DomainObjectFactory.newFactory(strategy);
    for (int i = 0; i < itemCount; i++) {
        String indexedField = strings[RandomUtils.nextInt(0, uniqueStringsCount)];
        DomainObject o = createNewDomainObject(objectFactory, indexedField);
        streamer.pushEntry(o.getKey(), o);
    }
    streamer.await();
}
Also used : DomainObjectFactory(com.hazelcast.simulator.tests.map.domain.DomainObjectFactory) DomainObject(com.hazelcast.simulator.tests.map.domain.DomainObject) Prepare(com.hazelcast.simulator.test.annotations.Prepare)

Example 29 with Prepare

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

the class SlowOperationMapTest method localPrepare.

@Prepare
public void localPrepare() {
    if (isClient) {
        return;
    }
    Random random = new Random();
    for (int key : keys) {
        int value = random.nextInt(Integer.MAX_VALUE);
        map.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