use of com.hazelcast.simulator.test.annotations.Setup in project hazelcast-simulator by hazelcast.
the class PerformanceICacheTest method setup.
@Setup
public void setup() {
CacheManager cacheManager = createCacheManager(targetInstance);
cache = cacheManager.getCache(name);
}
use of com.hazelcast.simulator.test.annotations.Setup in project hazelcast-simulator by hazelcast.
the class ReadWriteICacheTest method setup.
@Setup
public void setup() {
counters = targetInstance.getList(name + "counters");
RecordingCacheLoader<Integer> loader = new RecordingCacheLoader<Integer>();
loader.loadDelayMs = getDelayMs;
RecordingCacheWriter<Integer, Integer> writer = new RecordingCacheWriter<Integer, Integer>();
writer.writeDelayMs = putDelayMs;
writer.deleteDelayMs = removeDelayMs;
config = new CacheConfig<Integer, Integer>();
config.setReadThrough(true);
config.setWriteThrough(true);
config.setCacheLoaderFactory(FactoryBuilder.factoryOf(loader));
config.setCacheWriterFactory(FactoryBuilder.factoryOf(writer));
CacheManager cacheManager = createCacheManager(targetInstance);
cacheManager.createCache(name, config);
cache = cacheManager.getCache(name);
}
use of com.hazelcast.simulator.test.annotations.Setup in project hazelcast-simulator by hazelcast.
the class StringICacheTest method setup.
@Setup
public void setup() {
CacheManager cacheManager = createCacheManager(targetInstance);
cache = cacheManager.getCache(name);
}
use of com.hazelcast.simulator.test.annotations.Setup in project hazelcast-simulator by hazelcast.
the class TestContainer method registerSetupTask.
private void registerSetupTask() {
List<Method> setupMethods = new AnnotatedMethodRetriever(testClass, Setup.class).withVoidReturnType().withPublicNonStaticModifier().findAll();
List<Callable> callableList = new ArrayList<Callable>(setupMethods.size());
for (Method setupMethod : setupMethods) {
Class[] parameterTypes = setupMethod.getParameterTypes();
Object[] args;
switch(parameterTypes.length) {
case 0:
args = new Object[0];
break;
case 1:
Class<?> parameterType = setupMethod.getParameterTypes()[0];
if (!parameterType.isAssignableFrom(TestContext.class) || parameterType.isAssignableFrom(Object.class)) {
throw new IllegalTestException(format("Method %s.%s() supports arguments of type %s, but found %s", testClass.getSimpleName(), setupMethod, TestContext.class.getName(), parameterType.getName()));
}
args = new Object[] { testContext };
break;
default:
throw new IllegalTestException(format("Setup method '%s' can have at most a single argument", setupMethod));
}
callableList.add(new MethodInvokingCallable(testInstance, setupMethod, args));
}
taskPerPhaseMap.put(SETUP, new CompositeCallable(callableList));
}
use of com.hazelcast.simulator.test.annotations.Setup in project hazelcast-simulator by hazelcast.
the class MapDataIntegrityTest method setup.
@Setup
public void setup() {
integrityMap = targetInstance.getMap(name + "Integrity");
stressMap = targetInstance.getMap(name + "Stress");
integrityThreads = new MapIntegrityThread[mapIntegrityThreadCount];
value = new byte[valueSize];
Random random = new Random();
random.nextBytes(value);
if (mapLoad && isMemberNode(targetInstance)) {
PartitionService partitionService = targetInstance.getPartitionService();
final Set<Partition> partitionSet = partitionService.getPartitions();
for (Partition partition : partitionSet) {
while (partition.getOwner() == null) {
sleepSeconds(1);
}
}
logger.info(format("%s: %d partitions", name, partitionSet.size()));
Member localMember = targetInstance.getCluster().getLocalMember();
for (int i = 0; i < totalIntegrityKeys; i++) {
Partition partition = partitionService.getPartition(i);
if (localMember.equals(partition.getOwner())) {
integrityMap.put(i, value);
}
}
logger.info(format("%s: integrityMap=%s size=%d", name, integrityMap.getName(), integrityMap.size()));
Config config = targetInstance.getConfig();
MapConfig mapConfig = config.getMapConfig(integrityMap.getName());
logger.info(format("%s: %s", name, mapConfig));
}
}
Aggregations