Search in sources :

Example 1 with BeforeRun

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

the class TimeStepModel method loadBeforeRunMethods.

private void loadBeforeRunMethods() {
    List<Method> methods = new AnnotatedMethodRetriever(testClass, BeforeRun.class).findAll();
    validateModifiers(methods);
    validateBeforeAndAfterRunArguments(BeforeRun.class.getSimpleName(), methods);
    for (Method method : methods) {
        BeforeRun beforeRun = method.getAnnotation(BeforeRun.class);
        String executionGroupName = beforeRun.executionGroup();
        ensureExecutionGroupIsIdentifier(method, executionGroupName);
        ExecutionGroup executionGroup = executionGroups.get(executionGroupName);
        if (executionGroup == null) {
            if (executionGroupName.equals("")) {
                throw new IllegalTestException("@BeforeRun " + method + " is part of default executionGroup," + " but no timeStep methods for that executionGroup exist ");
            } else {
                throw new IllegalTestException("@BeforeRun " + method + " is part of executionGroup [" + executionGroupName + "], but no timeStep methods for that executionGroup exist ");
            }
        }
        executionGroup.beforeRunMethods.add(method);
    }
}
Also used : BeforeRun(com.hazelcast.simulator.test.annotations.BeforeRun) Method(java.lang.reflect.Method) AnnotatedMethodRetriever(com.hazelcast.simulator.utils.AnnotatedMethodRetriever)

Aggregations

BeforeRun (com.hazelcast.simulator.test.annotations.BeforeRun)1 AnnotatedMethodRetriever (com.hazelcast.simulator.utils.AnnotatedMethodRetriever)1 Method (java.lang.reflect.Method)1