use of com.hazelcast.test.bounce.BounceMemberRule in project hazelcast by hazelcast.
the class AbstractHazelcastClassRunner method withBefores.
// Override withBefores to accommodate spawning the member bouncing thread after @Before's have been executed and before @Test
// when MemberBounceRule is in use
@Override
protected Statement withBefores(FrameworkMethod method, Object target, Statement statement) {
List<FrameworkMethod> befores = getTestClass().getAnnotatedMethods(Before.class);
List<TestRule> testRules = getTestRules(target);
Statement nextStatement = statement;
if (!testRules.isEmpty()) {
for (TestRule rule : testRules) {
if (rule instanceof BounceMemberRule) {
nextStatement = ((BounceMemberRule) rule).startBouncing(statement);
}
}
}
return befores.isEmpty() ? nextStatement : new RunBefores(nextStatement, befores, target);
}
use of com.hazelcast.test.bounce.BounceMemberRule in project hazelcast by hazelcast.
the class AbstractHazelcastClassRunner method withAfters.
@Override
protected Statement withAfters(FrameworkMethod method, Object target, Statement statement) {
List<FrameworkMethod> afters = getTestClass().getAnnotatedMethods(After.class);
Statement nextStatement = statement;
List<TestRule> testRules = getTestRules(target);
if (!testRules.isEmpty()) {
for (TestRule rule : testRules) {
if (rule instanceof BounceMemberRule) {
nextStatement = ((BounceMemberRule) rule).stopBouncing(statement);
}
}
}
if (THREAD_DUMP_ON_FAILURE) {
return new ThreadDumpAwareRunAfters(method, nextStatement, afters, target);
}
if (afters.isEmpty()) {
return nextStatement;
} else {
return new RunAfters(nextStatement, afters, target);
}
}
Aggregations