// Path: instrument-starters/opentracing-spring-cloud-jdbc-starter/src/test/java/io/opentracing/contrib/spring/cloud/jdbc/MockTracingConfiguration.java
// @Configuration
// @EnableAutoConfiguration
// public class MockTracingConfiguration {
// 
//   @Bean
//   public MockTracer mockTracer() {
//     GlobalTracerTestUtil.resetGlobalTracer();
//     return new MockTracer();
//   }
// }


import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import io.opentracing.contrib.spring.cloud.jdbc.MockTracingConfiguration;
import io.opentracing.mock.MockSpan;
import io.opentracing.mock.MockTracer;
import io.opentracing.tag.Tags;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.junit4.SpringRunner;
/**
 * 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.jdbc.data;



@RunWith(SpringRunner.class)
@SpringBootTest(classes = {MockTracingConfiguration.class},
    webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
    properties = {"opentracing.spring.web.client.enabled=false"})
@AutoConfigureTestDatabase
public class SpringDataTracingTest {

  @Autowired
  private TestEntityRepository testEntityRepository;

  @Autowired
  private MockTracer mockTracer;

  @Autowired
  private TestRestTemplate testRestTemplate;

  @Before
  public void clearGlobalTracer() {
    mockTracer.reset();
  }

  @Test
  public void jpaTest() {
// Path: instrument-starters/opentracing-spring-cloud-jdbc-starter/src/test/java/io/opentracing/contrib/spring/cloud/jdbc/MockTracingConfiguration.java
// @Configuration
// @EnableAutoConfiguration
// public class MockTracingConfiguration {
// 
//   @Bean
//   public MockTracer mockTracer() {
//     GlobalTracerTestUtil.resetGlobalTracer();
//     return new MockTracer();
//   }
// }


// Path: instrument-starters/opentracing-spring-cloud-jdbc-starter/src/test/java/io/opentracing/contrib/spring/cloud/jdbc/data/SpringDataTracingTest.java
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import io.opentracing.contrib.spring.cloud.jdbc.MockTracingConfiguration;
import io.opentracing.mock.MockSpan;
import io.opentracing.mock.MockTracer;
import io.opentracing.tag.Tags;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.junit4.SpringRunner;

/**
 * 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.jdbc.data;



@RunWith(SpringRunner.class)
@SpringBootTest(classes = {MockTracingConfiguration.class},
    webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
    properties = {"opentracing.spring.web.client.enabled=false"})
@AutoConfigureTestDatabase
public class SpringDataTracingTest {

  @Autowired
  private TestEntityRepository testEntityRepository;

  @Autowired
  private MockTracer mockTracer;

  @Autowired
  private TestRestTemplate testRestTemplate;

  @Before
  public void clearGlobalTracer() {
    mockTracer.reset();
  }

  @Test
  public void jpaTest() {
    TestEntity entity = testEntityRepository.save(new TestEntity());