Search in sources :

Example 1 with Run

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

the class MapTransactionContextConflictTest method run.

@Run
public void run() {
    ThreadSpawner spawner = new ThreadSpawner(name);
    for (int i = 0; i < threadCount; i++) {
        spawner.spawn(new Worker());
    }
    spawner.awaitCompletion();
}
Also used : ThreadSpawner(com.hazelcast.simulator.utils.ThreadSpawner) Run(com.hazelcast.simulator.test.annotations.Run)

Example 2 with Run

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

the class MapDataIntegrityTest method run.

@Run
public void run() {
    ThreadSpawner spawner = new ThreadSpawner(name);
    for (int i = 0; i < mapIntegrityThreadCount; i++) {
        integrityThreads[i] = new MapIntegrityThread();
        spawner.spawn(integrityThreads[i]);
    }
    for (int i = 0; i < stressThreadCount; i++) {
        spawner.spawn(new StressThread());
    }
    spawner.awaitCompletion();
}
Also used : ThreadSpawner(com.hazelcast.simulator.utils.ThreadSpawner) Run(com.hazelcast.simulator.test.annotations.Run)

Example 3 with Run

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

the class QueueTest method run.

@Run
public void run() {
    ThreadSpawner spawner = new ThreadSpawner(name);
    for (int queueIndex = 0; queueIndex < queueLength; queueIndex++) {
        for (int i = 0; i < threadsPerQueue; i++) {
            spawner.spawn(new Worker(queueIndex));
        }
    }
    spawner.awaitCompletion();
}
Also used : ThreadSpawner(com.hazelcast.simulator.utils.ThreadSpawner) Run(com.hazelcast.simulator.test.annotations.Run)

Example 4 with Run

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

the class GrowingMapTest method run.

@Run
public void run() {
    ThreadSpawner spawner = new ThreadSpawner(name);
    for (int i = 0; i < threadCount; i++) {
        spawner.spawn(new Worker());
    }
    spawner.awaitCompletion();
}
Also used : ThreadSpawner(com.hazelcast.simulator.utils.ThreadSpawner) Run(com.hazelcast.simulator.test.annotations.Run)

Example 5 with Run

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

the class TestContainer method loadRunStrategy.

private RunStrategy loadRunStrategy() {
    try {
        List<String> runAnnotations = new LinkedList<String>();
        RunStrategy runStrategy = null;
        Method runMethod = new AnnotatedMethodRetriever(testClass, Run.class).withoutArgs().withVoidReturnType().withPublicNonStaticModifier().find();
        if (runMethod != null) {
            runAnnotations.add(Run.class.getName());
            runStrategy = new PrimordialRunStrategy(testInstance, runMethod);
        }
        List<Method> timeStepMethods = new AnnotatedMethodRetriever(testClass, TimeStep.class).findAll();
        if (!timeStepMethods.isEmpty()) {
            runAnnotations.add(TimeStep.class.getName());
            runStrategy = new TimeStepRunStrategy(this);
        }
        if (runAnnotations.size() == 0) {
            throw new IllegalTestException("Test is missing a run strategy, it must contain one of the following annotations: " + asList(Run.class.getName(), TimeStep.class.getName()));
        } else if (runAnnotations.size() > 1) {
            throw new IllegalTestException("Test has more than one run strategy, found the following annotations: " + runAnnotations);
        } else {
            return runStrategy;
        }
    } catch (IllegalTestException e) {
        throw rethrow(e);
    } catch (Exception e) {
        throw new IllegalTestException(format("Error loading run strategy in %s: [%s] %s", testClass.getName(), e.getClass().getSimpleName(), e.getMessage()), e);
    }
}
Also used : Run(com.hazelcast.simulator.test.annotations.Run) Method(java.lang.reflect.Method) LinkedList(java.util.LinkedList) AnnotatedMethodRetriever(com.hazelcast.simulator.utils.AnnotatedMethodRetriever) InvocationTargetException(java.lang.reflect.InvocationTargetException) TimeStep(com.hazelcast.simulator.test.annotations.TimeStep)

Aggregations

Run (com.hazelcast.simulator.test.annotations.Run)6 ThreadSpawner (com.hazelcast.simulator.utils.ThreadSpawner)5 TimeStep (com.hazelcast.simulator.test.annotations.TimeStep)1 AnnotatedMethodRetriever (com.hazelcast.simulator.utils.AnnotatedMethodRetriever)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Method (java.lang.reflect.Method)1 LinkedList (java.util.LinkedList)1