Skip to content

Commit

Permalink
Rewrite tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jihor authored and jihor committed Sep 30, 2016
1 parent c728b91 commit ecb65a8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public void testMisconfigurableClient() throws Exception {

@Test
public void testClientWithDefaultRetries() throws Exception {
countingAspect.counter.reset();
countingAspect.counter.set(0);
try {
greetingService.getOneOffGreetingWithTimeout("Doe", "John");
Assert.fail("TTransportException Expected");
Expand All @@ -93,7 +93,7 @@ public void testClientWithDefaultRetries() throws Exception {

@Test
public void testClientWithMultipleRetries() throws Exception {
countingAspect.counter.reset();
countingAspect.counter.set(0);
try {
greetingService.getRetriableGreetingWithTimeout("Doe", "John");
Assert.fail("TTransportException Expected");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;

import java.util.concurrent.atomic.LongAdder;
import java.util.concurrent.atomic.AtomicInteger;

/**
* @author jihor ([email protected])
* Created on 2016-09-30
*/
@Aspect
public class CountingAspect {
public LongAdder counter = new LongAdder();
public AtomicInteger counter = new AtomicInteger(0);

@Pointcut("execution(* org.springframework.cloud.client.loadbalancer.LoadBalancerClient.choose(..))")
private void loadBalancerServerChoice() {}

@Before("loadBalancerServerChoice()")
public void before(){
counter.increment();
counter.incrementAndGet();
}
}

0 comments on commit ecb65a8

Please sign in to comment.