// Path: instrument-starters/opentracing-spring-cloud-core/src/main/java/io/opentracing/contrib/spring/cloud/ExtensionTags.java
// public class ExtensionTags {
// 
//   private ExtensionTags() {
//   }
// 
//   /**
//    * Tag for {@link Class#getSimpleName()}
//    */
//   public static final StringTag CLASS_TAG = new StringTag("class");
// 
//   /**
//    * Tag for method name
//    */
//   public static final StringTag METHOD_TAG = new StringTag("method");
// }
// 
// Path: instrument-starters/opentracing-spring-cloud-core/src/test/java/io/opentracing/contrib/spring/cloud/MockTracingConfiguration.java
// @Configuration
// @EnableAutoConfiguration
// public class MockTracingConfiguration {
// 
//   @Bean
//   public MockTracer mockTracer() {
//     GlobalTracerTestUtil.resetGlobalTracer();
//     return new MockTracer();
//   }
// 
//   @Bean
//   public RestTemplate restTemplate(RestTemplateBuilder restTemplateBuilder) {
//     return restTemplateBuilder.build();
//   }
// 
//   @Bean
//   public AsyncRestTemplate asyncRestTemplate() {
//     return new AsyncRestTemplate();
//   }
// 
//   public static TestRestTemplate createNotTracedRestTemplate(int port) {
//     return new TestRestTemplate(new RestTemplateBuilder().rootUri("http://localhost:" + port));
//   }
// }
// 
// Path: instrument-starters/opentracing-spring-cloud-core/src/test/java/io/opentracing/contrib/spring/cloud/TestUtils.java
// public class TestUtils {
// 
//   /**
//    * Check if all spans have same traceId.
//    *
//    * @param spans the spans to check
//    */
//   public static void assertSameTraceId(Collection<MockSpan> spans) {
//     if (!spans.isEmpty()) {
//       final long traceId = spans.iterator().next().context().traceId();
//       for (MockSpan span : spans) {
//         Assert.assertEquals(traceId, span.context().traceId());
//       }
//     }
//   }
// }
// 
// Path: instrument-starters/opentracing-spring-cloud-core/src/test/java/io/opentracing/contrib/spring/cloud/scheduled/ScheduledTest.java
// @EnableScheduling
// static class Configuration {
// 
// }
// 
// Path: instrument-starters/opentracing-spring-cloud-core/src/test/java/io/opentracing/contrib/spring/cloud/scheduled/ScheduledTest.java
// @Component
// @EnableScheduling
// static class ScheduledComponent {
// 
//   @Autowired
//   private Tracer tracer;
//   @Autowired
//   private ScheduledAnnotationBeanPostProcessor scheduledAnnotationBeanPostProcessor;
//   @Autowired
//   private BeanFactory beanFactory;
// 
//   @Scheduled(fixedDelay = 1)
//   public void scheduledFoo() {
//     // disable upcoming scheduling
//     scheduledAnnotationBeanPostProcessor
//         .postProcessBeforeDestruction(beanFactory.getBean(ScheduledComponent.class), null);
//     tracer.buildSpan("child").start().finish();
//   }
// }


import static org.awaitility.Awaitility.await;
import static org.junit.Assert.assertEquals;
import io.opentracing.Tracer;
import io.opentracing.contrib.spring.cloud.ExtensionTags;
import io.opentracing.contrib.spring.cloud.MockTracingConfiguration;
import io.opentracing.contrib.spring.cloud.TestUtils;
import io.opentracing.contrib.spring.cloud.scheduled.ScheduledTest.Configuration;
import io.opentracing.contrib.spring.cloud.scheduled.ScheduledTest.ScheduledComponent;
import io.opentracing.mock.MockSpan;
import io.opentracing.mock.MockTracer;
import io.opentracing.tag.Tags;
import java.util.List;
import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor;
import org.springframework.stereotype.Component;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
 * Copyright 2017-2018 The OpenTracing Authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */
package io.opentracing.contrib.spring.cloud.scheduled;



/**
 * @author Pavol Loffay
 */
@SpringBootTest(
    webEnvironment = WebEnvironment.RANDOM_PORT,
    classes = {
        MockTracingConfiguration.class,
// Path: instrument-starters/opentracing-spring-cloud-core/src/main/java/io/opentracing/contrib/spring/cloud/ExtensionTags.java
// public class ExtensionTags {
// 
//   private ExtensionTags() {
//   }
// 
//   /**
//    * Tag for {@link Class#getSimpleName()}
//    */
//   public static final StringTag CLASS_TAG = new StringTag("class");
// 
//   /**
//    * Tag for method name
//    */
//   public static final StringTag METHOD_TAG = new StringTag("method");
// }
// 
// Path: instrument-starters/opentracing-spring-cloud-core/src/test/java/io/opentracing/contrib/spring/cloud/MockTracingConfiguration.java
// @Configuration
// @EnableAutoConfiguration
// public class MockTracingConfiguration {
// 
//   @Bean
//   public MockTracer mockTracer() {
//     GlobalTracerTestUtil.resetGlobalTracer();
//     return new MockTracer();
//   }
// 
//   @Bean
//   public RestTemplate restTemplate(RestTemplateBuilder restTemplateBuilder) {
//     return restTemplateBuilder.build();
//   }
// 
//   @Bean
//   public AsyncRestTemplate asyncRestTemplate() {
//     return new AsyncRestTemplate();
//   }
// 
//   public static TestRestTemplate createNotTracedRestTemplate(int port) {
//     return new TestRestTemplate(new RestTemplateBuilder().rootUri("http://localhost:" + port));
//   }
// }
// 
// Path: instrument-starters/opentracing-spring-cloud-core/src/test/java/io/opentracing/contrib/spring/cloud/TestUtils.java
// public class TestUtils {
// 
//   /**
//    * Check if all spans have same traceId.
//    *
//    * @param spans the spans to check
//    */
//   public static void assertSameTraceId(Collection<MockSpan> spans) {
//     if (!spans.isEmpty()) {
//       final long traceId = spans.iterator().next().context().traceId();
//       for (MockSpan span : spans) {
//         Assert.assertEquals(traceId, span.context().traceId());
//       }
//     }
//   }
// }
// 
// Path: instrument-starters/opentracing-spring-cloud-core/src/test/java/io/opentracing/contrib/spring/cloud/scheduled/ScheduledTest.java
// @EnableScheduling
// static class Configuration {
// 
// }
// 
// Path: instrument-starters/opentracing-spring-cloud-core/src/test/java/io/opentracing/contrib/spring/cloud/scheduled/ScheduledTest.java
// @Component
// @EnableScheduling
// static class ScheduledComponent {
// 
//   @Autowired
//   private Tracer tracer;
//   @Autowired
//   private ScheduledAnnotationBeanPostProcessor scheduledAnnotationBeanPostProcessor;
//   @Autowired
//   private BeanFactory beanFactory;
// 
//   @Scheduled(fixedDelay = 1)
//   public void scheduledFoo() {
//     // disable upcoming scheduling
//     scheduledAnnotationBeanPostProcessor
//         .postProcessBeforeDestruction(beanFactory.getBean(ScheduledComponent.class), null);
//     tracer.buildSpan("child").start().finish();
//   }
// }


// Path: instrument-starters/opentracing-spring-cloud-core/src/test/java/io/opentracing/contrib/spring/cloud/scheduled/ScheduledTest.java
import static org.awaitility.Awaitility.await;
import static org.junit.Assert.assertEquals;
import io.opentracing.Tracer;
import io.opentracing.contrib.spring.cloud.ExtensionTags;
import io.opentracing.contrib.spring.cloud.MockTracingConfiguration;
import io.opentracing.contrib.spring.cloud.TestUtils;
import io.opentracing.contrib.spring.cloud.scheduled.ScheduledTest.Configuration;
import io.opentracing.contrib.spring.cloud.scheduled.ScheduledTest.ScheduledComponent;
import io.opentracing.mock.MockSpan;
import io.opentracing.mock.MockTracer;
import io.opentracing.tag.Tags;
import java.util.List;
import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor;
import org.springframework.stereotype.Component;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

/**
 * Copyright 2017-2018 The OpenTracing Authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */
package io.opentracing.contrib.spring.cloud.scheduled;



/**
 * @author Pavol Loffay
 */
@SpringBootTest(
    webEnvironment = WebEnvironment.RANDOM_PORT,
    classes = {
        MockTracingConfiguration.class,
        Configuration.class,