From 214f5bec188129f84c78f70266efc5d36073f515 Mon Sep 17 00:00:00 2001 From: Sergei Malafeev Date: Mon, 4 Jun 2018 12:03:47 +0800 Subject: [PATCH 1/2] add coveralls Signed-off-by: Sergei Malafeev --- .travis.yml | 3 +++ README.md | 4 +++- pom.xml | 25 ++++++++++++++++++++++++- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6cf9d51..d4d278e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,6 +29,9 @@ branches: except: - /^[0-9]/ +after_success: + - mvn jacoco:report coveralls:report + env: global: # Ex. travis encrypt BINTRAY_USER=your_github_account diff --git a/README.md b/README.md index 698e6de..62d87ae 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Build Status][ci-img]][ci] [![Released Version][maven-img]][maven] +[![Build Status][ci-img]][ci] [![Coverage Status][cov-img]][cov] [![Released Version][maven-img]][maven] # OpenTracing JDBC Instrumentation OpenTracing instrumentation for JDBC. @@ -84,5 +84,7 @@ E.g. `Class.forName("com.mysql.jdbc.Driver");` [ci-img]: https://travis-ci.org/opentracing-contrib/java-jdbc.svg?branch=master [ci]: https://travis-ci.org/opentracing-contrib/java-jdbc +[cov-img]: https://coveralls.io/repos/github/opentracing-contrib/java-jdbc/badge.svg?branch=master +[cov]: https://coveralls.io/github/opentracing-contrib/java-jdbc?branch=master [maven-img]: https://img.shields.io/maven-central/v/io.opentracing.contrib/opentracing-jdbc.svg [maven]: http://search.maven.org/#search%7Cga%7C1%7Cio.opentracing.contrib%20opentracing-jdbc diff --git a/pom.xml b/pom.xml index 18174eb..4afd9c7 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,9 @@ the License. --> - + 4.0.0 io.opentracing.contrib opentracing-jdbc @@ -60,6 +62,8 @@ UTF-8 0.31.0 + 4.3.0 + 0.8.1 @@ -174,6 +178,7 @@ mvnw mvnw.cmd .mvn/wrapper/maven-wrapper.properties + .coveralls.yml @@ -185,6 +190,24 @@ + + org.eluder.coveralls + coveralls-maven-plugin + ${coveralls-maven-plugin.version} + + + org.jacoco + jacoco-maven-plugin + ${jacoco-maven-plugin.version} + + + prepare-agent + + prepare-agent + + + + From d6b2944c05b1a6c250a1399c078520fb64f9d9f9 Mon Sep 17 00:00:00 2001 From: Sergei Malafeev Date: Mon, 4 Jun 2018 12:21:56 +0800 Subject: [PATCH 2/2] reformat, optimize imports Signed-off-by: Sergei Malafeev --- .../java/io/opentracing/contrib/jdbc/HibernateTest.java | 9 ++++++--- .../java/io/opentracing/contrib/jdbc/SpringTest.java | 9 +++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/test/java/io/opentracing/contrib/jdbc/HibernateTest.java b/src/test/java/io/opentracing/contrib/jdbc/HibernateTest.java index 9687ad0..30e1cc3 100644 --- a/src/test/java/io/opentracing/contrib/jdbc/HibernateTest.java +++ b/src/test/java/io/opentracing/contrib/jdbc/HibernateTest.java @@ -230,7 +230,8 @@ public void hibernate_with_parent_and_active_span_only() { @Test public void hibernate_with_ignored_statement() { - SessionFactory sessionFactory = createSessionFactory(false, Arrays.asList("insert into Employee (id) values (?)")); + SessionFactory sessionFactory = createSessionFactory(false, + Arrays.asList("insert into Employee (id) values (?)")); Session session = sessionFactory.openSession(); Employee employee = new Employee(); @@ -264,14 +265,16 @@ private SessionFactory createSessionFactory(boolean traceWithActiveSpanOnly) { return createSessionFactory(traceWithActiveSpanOnly, new ArrayList()); } - private SessionFactory createSessionFactory(boolean traceWithActiveSpanOnly, List ignored) { + private SessionFactory createSessionFactory(boolean traceWithActiveSpanOnly, + List ignored) { String ignoredForTrace = TestUtil.buildIgnoredString(ignored); Configuration configuration = new Configuration(); configuration.addAnnotatedClass(Employee.class); configuration.setProperty("hibernate.connection.driver_class", "io.opentracing.contrib.jdbc.TracingDriver"); configuration.setProperty("hibernate.connection.url", - "jdbc:tracing:h2:mem:hibernate?" + ignoredForTrace + "traceWithActiveSpanOnly=" + traceWithActiveSpanOnly); + "jdbc:tracing:h2:mem:hibernate?" + ignoredForTrace + "traceWithActiveSpanOnly=" + + traceWithActiveSpanOnly); configuration.setProperty("hibernate.connection.username", "sa"); configuration.setProperty("hibernate.connection.password", ""); configuration.setProperty("hibernate.dialect", "org.hibernate.dialect.H2Dialect"); diff --git a/src/test/java/io/opentracing/contrib/jdbc/SpringTest.java b/src/test/java/io/opentracing/contrib/jdbc/SpringTest.java index f40125c..709eed0 100644 --- a/src/test/java/io/opentracing/contrib/jdbc/SpringTest.java +++ b/src/test/java/io/opentracing/contrib/jdbc/SpringTest.java @@ -29,10 +29,7 @@ import java.sql.SQLException; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; -import java.util.HashSet; import java.util.List; -import java.util.Set; import org.apache.commons.dbcp2.BasicDataSource; import org.junit.Before; import org.junit.BeforeClass; @@ -169,8 +166,8 @@ public void spring_with_parent_and_active_span_only() throws Exception { @Test public void spring_with_ignored_statement() throws Exception { BasicDataSource dataSource = getDataSource(false, Arrays.asList( - "CREATE TABLE ignored (id INTEGER, TEST VARCHAR)", - "INSERT INTO ignored (id, \\\"TEST\\\") VALUES (1, 'value')" + "CREATE TABLE ignored (id INTEGER, TEST VARCHAR)", + "INSERT INTO ignored (id, \\\"TEST\\\") VALUES (1, 'value')" )); JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); @@ -196,7 +193,7 @@ private BasicDataSource getDataSource(boolean traceWithActiveSpanOnly, List