提交 32e9076e 编写于 作者: W WangKai

fix some code style

上级 385263d9
......@@ -299,6 +299,18 @@
<version>${spring-boot.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<version>${powermock.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito2</artifactId>
<version>${powermock.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>
......
language: java
jdk:
- oraclejdk8
before_script:
- echo "MAVEN_OPTS='-Xmx1024m -XX:MaxPermSize=256m'" > ~/.mavenrc
after_success:
- mvn clean cobertura:cobertura coveralls:report
\ No newline at end of file
......@@ -39,13 +39,11 @@
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<version>${powermock.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito2</artifactId>
<version>${powermock.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
......@@ -53,17 +51,6 @@
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<testSource>${java.version}</testSource>
<testTarget>${java.version}</testTarget>
</configuration>
<version>${maven-compiler-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
......@@ -240,22 +227,6 @@
<artifactId>coveralls-maven-plugin</artifactId>
<version>${coveralls-maven-plugin.version}</version>
</plugin>
<!--
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>${maven-gpg-plugin.version}</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
-->
</plugins>
</build>
......
......@@ -21,7 +21,7 @@ import io.opentracing.Tracer;
import io.opentracing.util.GlobalTracer;
import io.shardingjdbc.core.exception.ShardingJdbcException;
import io.shardingjdbc.core.util.EventBusInstance;
import io.shardingjdbc.opentracing.config.ConfigLoader;
import io.shardingjdbc.opentracing.config.ConfigurationLoader;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
......@@ -41,7 +41,7 @@ public final class ShardingJDBCTracer {
if (GlobalTracer.isRegistered()) {
return;
}
String tracerClassName = new ConfigLoader().getTracerClassName();
String tracerClassName = new ConfigurationLoader().getTracerClassName();
try {
init((Tracer) Class.forName(tracerClassName).newInstance());
} catch (final InstantiationException | IllegalAccessException | ClassNotFoundException ex) {
......
......@@ -27,16 +27,16 @@ import lombok.Getter;
* @author gaohongtao
* @author wangkai
*/
public class ConfigLoader {
public class ConfigurationLoader {
private static final ConfigParser[] PARSERS = new ConfigParser[]{new OptsConfigParser()};
private static final ConfigurationParser[] PARSERS = new ConfigurationParser[]{new OpentracingConfigurationParser()};
@Getter
private final String tracerClassName;
public ConfigLoader() {
public ConfigurationLoader() {
String tracerClassName = null;
for (ConfigParser each : PARSERS) {
for (ConfigurationParser each : PARSERS) {
Optional<String> tracerClassOptional = each.parse("tracer.class");
if (tracerClassOptional.isPresent()) {
tracerClassName = tracerClassOptional.get();
......
......@@ -25,7 +25,7 @@ import com.google.common.base.Optional;
* @author gaohongtao
* @author wangkai
*/
interface ConfigParser {
interface ConfigurationParser {
/**
* Parse config item to config value.
......
......@@ -25,7 +25,7 @@ import com.google.common.base.Optional;
* @author gaohongtao
* @author wangkai
*/
public class OptsConfigParser implements ConfigParser {
public class OpentracingConfigurationParser implements ConfigurationParser {
private static final String PREFIX = "shardingjdbc.opentracing";
......
......@@ -5,7 +5,7 @@
* 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
* 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,
......@@ -17,12 +17,12 @@
package io.shardingjdbc.opentracing;
import io.shardingjdbc.opentracing.config.ConfigLoaderTest;
import io.shardingjdbc.opentracing.config.ConfigurationLoaderTest;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@RunWith(Suite.class)
@Suite.SuiteClasses({ConfigLoaderTest.class,
@Suite.SuiteClasses({ConfigurationLoaderTest.class,
ExecuteEventListenerTest.class,
ShardingJDBCTracerTest.class
})
......
......@@ -5,7 +5,7 @@
* 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
* 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,
......@@ -54,7 +54,7 @@ public class ExecuteEventListenerTest {
}
@Before
public void before() throws NoSuchFieldException, IllegalAccessException {
public void before() {
TRACER.reset();
}
......
......@@ -5,7 +5,7 @@
* 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
* 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,
......@@ -21,8 +21,7 @@ import io.opentracing.NoopTracerFactory;
import io.opentracing.Tracer;
import io.opentracing.util.GlobalTracer;
import io.shardingjdbc.core.exception.ShardingJdbcException;
import io.shardingjdbc.opentracing.config.OptsConfigParser;
import org.apache.commons.lang3.builder.ToStringExclude;
import io.shardingjdbc.opentracing.config.OpentracingConfigurationParser;
import org.hamcrest.core.Is;
import org.junit.Before;
import org.junit.Test;
......@@ -40,7 +39,7 @@ import static org.powermock.api.mockito.PowerMockito.mockStatic;
import static org.powermock.api.mockito.PowerMockito.when;
@RunWith(PowerMockRunner.class)
@PrepareForTest(OptsConfigParser.class)
@PrepareForTest(OpentracingConfigurationParser.class)
public class ShardingJDBCTracerTest {
@Before
......
......@@ -5,7 +5,7 @@
* 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
* 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,
......@@ -29,18 +29,18 @@ import static org.powermock.api.mockito.PowerMockito.mockStatic;
import static org.powermock.api.mockito.PowerMockito.when;
@RunWith(PowerMockRunner.class)
@PrepareForTest(OptsConfigParser.class)
public class ConfigLoaderTest {
@PrepareForTest(OpentracingConfigurationParser.class)
public class ConfigurationLoaderTest {
@Before
public void setUp() throws Exception {
public void setUp() {
mockStatic(System.class);
}
@Test
public void assertLoadConfigFromProperty() {
when(System.getProperty("shardingjdbc.opentracing.tracer.class")).thenReturn("com.foo.fooClass");
assertThat(new ConfigLoader().getTracerClassName(), is("com.foo.fooClass"));
assertThat(new ConfigurationLoader().getTracerClassName(), is("com.foo.fooClass"));
}
}
......@@ -5,7 +5,7 @@
* 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
* 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,
......@@ -31,9 +31,7 @@ public class FooTracer implements Tracer {
}
@Override
public <C> void inject(final SpanContext spanContext, final Format<C> format, final C c) {
}
public <C> void inject(final SpanContext spanContext, final Format<C> format, final C c) {}
@Override
public <C> SpanContext extract(final Format<C> format, final C c) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册