Search in sources :

Example 1 with DomainObject

use of com.hazelcast.simulator.tests.map.domain.DomainObject in project hazelcast-simulator by hazelcast.

the class SerializationStrategyTest method createNewDomainObject.

private DomainObject createNewDomainObject(DomainObjectFactory objectFactory, String indexedField) {
    DomainObject o = objectFactory.newInstance();
    o.setKey(randomAlphanumeric(7));
    o.setStringVal(indexedField);
    o.setIntVal(nextInt(0, Integer.MAX_VALUE));
    o.setLongVal(nextLong(0, Long.MAX_VALUE));
    o.setDoubleVal(nextDouble(0.0, Double.MAX_VALUE));
    return o;
}
Also used : DomainObject(com.hazelcast.simulator.tests.map.domain.DomainObject)

Example 2 with DomainObject

use of com.hazelcast.simulator.tests.map.domain.DomainObject 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)

Aggregations

DomainObject (com.hazelcast.simulator.tests.map.domain.DomainObject)2 Prepare (com.hazelcast.simulator.test.annotations.Prepare)1 DomainObjectFactory (com.hazelcast.simulator.tests.map.domain.DomainObjectFactory)1