Search in sources :

Example 1 with AfterRun

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

the class TimeStepModel method loadAfterRunMethods.

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

Example 2 with AfterRun

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

the class CardinalityEstimatorTest method afterRun.

@AfterRun
public void afterRun(ThreadState state) {
    // for each worker-thread we store the number of items it has produced for each estimator.
    for (int k = 0; k < estimatorCount; k++) {
        CardinalityEstimator estimator = estimators[k];
        // the number of unique items produced is equal to the iteration. If items 0,10,20 are produced,
        // then iteration is 3.
        long iteration = state.iterations[k];
        expectedCountMap.executeOnKey(estimator.getName(), new IncEntryProcessor(iteration));
    }
}
Also used : CardinalityEstimator(com.hazelcast.cardinality.CardinalityEstimator) AfterRun(com.hazelcast.simulator.test.annotations.AfterRun)

Aggregations

AfterRun (com.hazelcast.simulator.test.annotations.AfterRun)2 CardinalityEstimator (com.hazelcast.cardinality.CardinalityEstimator)1 AnnotatedMethodRetriever (com.hazelcast.simulator.utils.AnnotatedMethodRetriever)1 Method (java.lang.reflect.Method)1