use of com.hazelcast.simulator.test.annotations.Prepare in project hazelcast-simulator by hazelcast.
the class ReadWriteTest 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);
}
for (String key : keys) {
client.add(key, ttl, values[random.nextInt(values.length)]);
}
}
use of com.hazelcast.simulator.test.annotations.Prepare in project hazelcast-simulator by hazelcast.
the class NetworkTest method prepare.
@Prepare
public void prepare() throws Exception {
networkCreateLock.lock();
try {
logger.info("Starting connections: " + (targetInstance.getCluster().getMembers().size() - 1));
for (Member member : targetInstance.getCluster().getMembers()) {
if (member.localMember()) {
continue;
}
Address memberAddress = member.getAddress();
Address targetAddress = new Address(memberAddress.getHost(), memberAddress.getPort() + PORT_OFFSET);
logger.info("Connecting to: " + targetAddress);
connectionManager.getOrConnect(targetAddress);
Connection connection;
for (; ; ) {
connection = connectionManager.getConnection(targetAddress);
if (connection != null) {
break;
}
logger.info("Waiting for connection to: " + targetAddress);
sleepMillis(100);
}
connections.add(connection);
logger.info("Successfully created connection to: " + targetAddress);
}
logger.info("Successfully started all connections");
} finally {
networkCreateLock.unlock();
}
// temporary delay
Thread.sleep(30);
}
use of com.hazelcast.simulator.test.annotations.Prepare in project hazelcast-simulator by hazelcast.
the class SimpleLockTest method prepare.
@Prepare(global = true)
public void prepare() {
for (int i = 0; i < maxAccounts; i++) {
IAtomicLong account = targetInstance.getAtomicLong(name + i);
account.set(INITIAL_VALUE);
}
totalValue = INITIAL_VALUE * maxAccounts;
}
use of com.hazelcast.simulator.test.annotations.Prepare in project hazelcast-simulator by hazelcast.
the class LongStringMapTest 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)];
map.put(key, value);
}
}
use of com.hazelcast.simulator.test.annotations.Prepare in project hazelcast-simulator by hazelcast.
the class LongSerializableCacheTest method prepare.
@Prepare(global = true)
public void prepare() {
Streamer<Long, SerializablePojo> streamer = StreamerFactory.getInstance(cache);
for (long key = 0; key < keyDomain; key++) {
streamer.pushEntry(key, new SerializablePojo());
}
streamer.await();
}
Aggregations