[#89] Initial approach to the integration tests

- Fixed the tests
- Updated surefire
- Added integration tests (for the moment ignored)
- Fixed wrong surefire setup
This commit is contained in:
Marcin Grzejszczak
2016-01-08 19:08:34 +01:00
parent 7c54ad9e66
commit 9a8dc17d8c
29 changed files with 661 additions and 138 deletions

View File

@@ -16,20 +16,20 @@
package org.springframework.cloud.sleuth.instrument;
import java.util.concurrent.Callable;
import lombok.EqualsAndHashCode;
import lombok.Value;
import org.springframework.cloud.sleuth.Trace;
import org.springframework.cloud.sleuth.TraceManager;
import lombok.EqualsAndHashCode;
import lombok.Value;
import java.util.concurrent.Callable;
/**
* @author Spencer Gibb
*/
@Value
@EqualsAndHashCode(callSuper = false)
public class TraceCallable<V> extends TraceDelegate<Callable<V>>implements Callable<V> {
public class TraceCallable<V> extends TraceDelegate<Callable<V>> implements Callable<V> {
public TraceCallable(TraceManager traceManager, Callable<V> delegate) {
super(traceManager, delegate);

View File

@@ -27,7 +27,7 @@ import lombok.Value;
*/
@Value
@EqualsAndHashCode(callSuper = false)
public class TraceRunnable extends TraceDelegate<Runnable>implements Runnable {
public class TraceRunnable extends TraceDelegate<Runnable> implements Runnable {
public TraceRunnable(TraceManager traceManager, Runnable delegate) {
super(traceManager, delegate);

View File

@@ -16,13 +16,13 @@
package org.springframework.cloud.sleuth.instrument.hystrix;
import org.springframework.cloud.sleuth.Span;
import org.springframework.cloud.sleuth.Trace;
import org.springframework.cloud.sleuth.TraceManager;
import com.netflix.hystrix.HystrixCommand;
import com.netflix.hystrix.HystrixCommandGroupKey;
import com.netflix.hystrix.HystrixThreadPoolKey;
import org.springframework.cloud.sleuth.Span;
import org.springframework.cloud.sleuth.Trace;
import org.springframework.cloud.sleuth.TraceManager;
import org.springframework.cloud.sleuth.trace.TraceContextHolder;
/**
* Abstraction over {@code HystrixCommand} that wraps command execution with Trace setting
@@ -71,6 +71,7 @@ public abstract class TraceCommand<R> extends HystrixCommand<R> {
@Override
protected R run() throws Exception {
enforceThatHystrixThreadIsNotPolutedByPreviousTraces();
Trace trace = this.traceManager.startSpan(getCommandKey().name(), parentSpan);
try {
return doRun();
@@ -79,5 +80,10 @@ public abstract class TraceCommand<R> extends HystrixCommand<R> {
}
}
// TODO: Do more analysis why this is nor removed properly
private void enforceThatHystrixThreadIsNotPolutedByPreviousTraces() {
TraceContextHolder.removeCurrentTrace();
}
public abstract R doRun() throws Exception;
}