Skip to content

Commit

Permalink
Upgrade 3.0.0-SNAPSHOT (#92)
Browse files Browse the repository at this point in the history
* upgrade 2.3.0-SNAPSHOT

* upgrade jdk version

* compatible with springboot 2.x

* upgrade version

* change jdk version

* fix something

* compatible spring 2.0

* upgrade jdk version

* fix as review

* avoid test case npe
  • Loading branch information
QilongZhang authored and glmapper committed Oct 31, 2018
1 parent c595c9a commit ffbd140
Show file tree
Hide file tree
Showing 33 changed files with 61 additions and 151 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ language: java
sudo: false

jdk:
- openjdk7
- openjdk8

install:

Expand Down
10 changes: 5 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
<parent>
<groupId>com.alipay.sofa</groupId>
<artifactId>sofaboot-dependencies</artifactId>
<version>2.5.1</version>
<version>3.0.0-SNAPSHOT</version>
</parent>

<artifactId>tracer-all-parent</artifactId>
<version>2.2.2</version>
<version>3.0.0-SNAPSHOT</version>
<packaging>pom</packaging>

<name>tracer-all-parent</name>
Expand All @@ -32,9 +32,9 @@

<properties>
<opentracing.version>0.22.0</opentracing.version>
<sofa.tracer.version>2.2.2</sofa.tracer.version>
<java.compiler.source.version>1.6</java.compiler.source.version>
<java.compiler.target.version>1.6</java.compiler.target.version>
<sofa.tracer.version>3.0.0-SNAPSHOT</sofa.tracer.version>
<java.compiler.source.version>1.8</java.compiler.source.version>
<java.compiler.target.version>1.8</java.compiler.target.version>
<jmh.version>1.9.3</jmh.version>
<project.encoding>UTF-8</project.encoding>
<main.user.dir>${user.dir}</main.user.dir>
Expand Down
2 changes: 1 addition & 1 deletion sofa-tracer-plugins/sofa-tracer-datasource-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>tracer-all-parent</artifactId>
<groupId>com.alipay.sofa</groupId>
<version>2.2.2</version>
<version>3.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion sofa-tracer-plugins/sofa-tracer-httpclient-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>tracer-all-parent</artifactId>
<groupId>com.alipay.sofa</groupId>
<version>2.2.2</version>
<version>3.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.embedded.LocalServerPort;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

Expand Down
2 changes: 1 addition & 1 deletion sofa-tracer-plugins/sofa-tracer-springmvc-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>tracer-all-parent</artifactId>
<groupId>com.alipay.sofa</groupId>
<version>2.2.2</version>
<version>3.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
4 changes: 2 additions & 2 deletions tracer-all/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
<parent>
<artifactId>tracer-all-parent</artifactId>
<groupId>com.alipay.sofa</groupId>
<version>2.2.2</version>
<version>3.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>tracer-all</artifactId>
<version>2.2.2</version>
<version>3.0.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>SOFATracer in one without SOFABoot starter</name>
Expand Down
2 changes: 1 addition & 1 deletion tracer-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>tracer-all-parent</artifactId>
<groupId>com.alipay.sofa</groupId>
<version>2.2.2</version>
<version>3.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.function.Predicate;
import java.util.stream.Stream;

import static org.junit.Assert.assertEquals;

Expand All @@ -52,7 +55,11 @@ public abstract class AbstractTestBase {
*/
@BeforeClass
public static void beforeClass() {
for (File file : customFileLog("").listFiles()) {
File[] traceFiles = customFileLog("").listFiles();
if (traceFiles == null) {
return;
}
for (File file : traceFiles) {
if (file.getPath().contains("tracer-self.log") || file.getPath().contains("sync.log")
|| file.getPath().contains("rpc-profile.log")
|| file.getPath().contains("middleware_error.log")) {
Expand Down
2 changes: 1 addition & 1 deletion tracer-extensions/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>tracer-all-parent</artifactId>
<groupId>com.alipay.sofa</groupId>
<version>2.2.2</version>
<version>3.0.0-SNAPSHOT</version>
</parent>

<artifactId>tracer-extensions</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion tracer-samples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.alipay.sofa</groupId>
<artifactId>tracer-all-parent</artifactId>
<version>2.2.2</version>
<version>3.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion tracer-samples/tracer-sample-with-h2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<parent>
<groupId>com.alipay.sofa</groupId>
<artifactId>sofaboot-dependencies</artifactId>
<version>${sofa.boot.version}</version>
<version>3.0.0-SNAPSHOT</version>
</parent>
```
这里的 ${sofa.boot.version} 指定具体的 SOFABoot 版本,参考[发布历史](https://github.com/alipay/sofa-build/releases)
Expand Down
2 changes: 1 addition & 1 deletion tracer-samples/tracer-sample-with-h2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>sofa-tracer-samples</artifactId>
<groupId>com.alipay.sofa</groupId>
<version>2.2.2</version>
<version>3.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
8 changes: 4 additions & 4 deletions tracer-samples/tracer-sample-with-httpclient/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<parent>
<groupId>com.alipay.sofa</groupId>
<artifactId>sofaboot-dependencies</artifactId>
<version>${sofa.boot.version}</version>
<version>3.0.0-SNAPSHOT</version>
</parent>
```
这里的 ${sofa.boot.version} 指定具体的 SOFABoot 版本,参考[发布历史](https://github.com/alipay/sofa-build/releases)
Expand All @@ -39,7 +39,7 @@
<dependency>
<groupId>com.alipay.sofa</groupId>
<artifactId>tracer-sofa-boot-starter</artifactId>
<version>2.2.2</version>
<version>3.0.0-SNAPSHOT</version>
</dependency>
```

Expand All @@ -62,12 +62,12 @@ logging.path=./logs
<dependency>
<groupId>com.alipay.sofa</groupId>
<artifactId>tracer-sofa-boot-starter</artifactId>
<version>2.2.2</version>
<version>3.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.alipay.sofa</groupId>
<artifactId>sofa-tracer-httpclient-plugin</artifactId>
<version>2.2.2</version>
<version>3.0.0-SNAPSHOT</version>
</dependency>
<!-- HttpClient Dependency -->
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion tracer-samples/tracer-sample-with-httpclient/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>sofa-tracer-samples</artifactId>
<groupId>com.alipay.sofa</groupId>
<version>2.2.2</version>
<version>3.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion tracer-samples/tracer-sample-with-slf4j/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<parent>
<groupId>com.alipay.sofa</groupId>
<artifactId>sofaboot-dependencies</artifactId>
<version>${sofa.boot.version}</version>
<version>3.0.0-SNAPSHOT</version>
</parent>
```
这里的 ${sofa.boot.version} 指定具体的 SOFABoot 版本,参考[发布历史](https://github.com/alipay/sofa-build/releases)
Expand Down
2 changes: 1 addition & 1 deletion tracer-samples/tracer-sample-with-slf4j/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.alipay.sofa</groupId>
<artifactId>sofa-tracer-samples</artifactId>
<version>2.2.2</version>
<version>3.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion tracer-samples/tracer-sample-with-sofarpc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<parent>
<groupId>com.alipay.sofa</groupId>
<artifactId>sofaboot-dependencies</artifactId>
<version>${sofa.boot.version}</version>
<version>3.0.0-SNAPSHOT</version>
</parent>
```
这里的 ${sofa.boot.version} 指定具体的 SOFABoot 版本,参考[发布历史](https://github.com/alipay/sofa-build/releases)
Expand Down
2 changes: 1 addition & 1 deletion tracer-samples/tracer-sample-with-sofarpc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.alipay.sofa</groupId>
<artifactId>sofa-tracer-samples</artifactId>
<version>2.2.2</version>
<version>3.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion tracer-samples/tracer-sample-with-springmvc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<parent>
<groupId>com.alipay.sofa</groupId>
<artifactId>sofaboot-dependencies</artifactId>
<version>${sofa.boot.version}</version>
<version>3.0.0-SNAPSHOT</version>
</parent>
```
这里的 ${sofa.boot.version} 指定具体的 SOFABoot 版本,参考[发布历史](https://github.com/alipay/sofa-build/releases)
Expand Down
2 changes: 1 addition & 1 deletion tracer-samples/tracer-sample-with-springmvc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.alipay.sofa</groupId>
<artifactId>sofa-tracer-samples</artifactId>
<version>2.2.2</version>
<version>3.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion tracer-samples/tracer-sample-with-zipkin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<parent>
<groupId>com.alipay.sofa</groupId>
<artifactId>sofaboot-dependencies</artifactId>
<version>${sofa.boot.version}</version>
<version>3.0.0-SNAPSHOT</version>
</parent>
```
这里的 ${sofa.boot.version} 指定具体的 SOFABoot 版本,参考[发布历史](https://github.com/alipay/sofa-build/releases)
Expand Down
2 changes: 1 addition & 1 deletion tracer-samples/tracer-sample-with-zipkin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.alipay.sofa</groupId>
<artifactId>sofa-tracer-samples</artifactId>
<version>2.2.2</version>
<version>3.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion tracer-sofa-boot-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>tracer-all-parent</artifactId>
<groupId>com.alipay.sofa</groupId>
<version>2.2.2</version>
<version>3.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion tracer-sofa-boot-starter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>tracer-all-parent</artifactId>
<groupId>com.alipay.sofa</groupId>
<version>2.2.2</version>
<version>3.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@
*/
package com.alipay.sofa.tracer.boot.listener;

import com.alipay.common.tracer.core.configuration.SofaTracerConfiguration;
import com.alipay.common.tracer.core.utils.StringUtils;
import com.alipay.sofa.tracer.boot.properties.SofaTracerProperties;
import org.springframework.boot.bind.PropertiesConfigurationFactory;
import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.bind.Bindable;
import org.springframework.boot.context.properties.bind.Binder;
import org.springframework.context.ApplicationListener;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.core.convert.support.DefaultConversionService;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.util.Assert;
import org.springframework.validation.BindException;

import com.alipay.common.tracer.core.configuration.SofaTracerConfiguration;
import com.alipay.common.tracer.core.utils.StringUtils;
import com.alipay.sofa.tracer.boot.properties.SofaTracerProperties;

/**
* Parse SOFATracer Configuration in early stage.
Expand Down Expand Up @@ -56,27 +56,14 @@ public void onApplicationEvent(ApplicationEnvironmentPreparedEvent event) {
System.setProperty("logging.path", loggingPath);
}

// static binding
SofaTracerProperties tempTarget = new SofaTracerProperties();
PropertiesConfigurationFactory<SofaTracerProperties> binder = new PropertiesConfigurationFactory<SofaTracerProperties>(
tempTarget);
ConfigurationProperties configurationPropertiesAnnotation = this
.getConfigurationPropertiesAnnotation(tempTarget);
if (configurationPropertiesAnnotation != null
&& StringUtils.isNotBlank(configurationPropertiesAnnotation.prefix())) {
//consider compatible Spring Boot 1.5.X and 2.x
binder.setIgnoreInvalidFields(configurationPropertiesAnnotation.ignoreInvalidFields());
binder.setIgnoreUnknownFields(configurationPropertiesAnnotation.ignoreUnknownFields());
binder.setTargetName(configurationPropertiesAnnotation.prefix());
} else {
binder.setTargetName(SofaTracerProperties.SOFA_TRACER_CONFIGURATION_PREFIX);
}
binder.setConversionService(new DefaultConversionService());
binder.setPropertySources(environment.getPropertySources());
try {
binder.bindPropertiesToTarget();
} catch (BindException ex) {
throw new IllegalStateException("Cannot bind to SofaTracerProperties", ex);
}
ConfigurationProperties configurationProperties = AnnotationUtils.findAnnotation(
SofaTracerProperties.class, ConfigurationProperties.class);
Binder binder = Binder.get(environment);
Bindable bindable = Bindable.of(SofaTracerProperties.class).withExistingValue(tempTarget)
.withAnnotations(configurationProperties);
binder.bind(SofaTracerProperties.SOFA_TRACER_CONFIGURATION_PREFIX, bindable);

//properties convert to tracer
SofaTracerConfiguration.setProperty(
Expand Down Expand Up @@ -104,9 +91,4 @@ public void onApplicationEvent(ApplicationEnvironmentPreparedEvent event) {
public int getOrder() {
return HIGHEST_PRECEDENCE + 20;
}

private ConfigurationProperties getConfigurationPropertiesAnnotation(Object targetObject) {
return AnnotationUtils.findAnnotation(targetObject.getClass(),
ConfigurationProperties.class);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.embedded.LocalServerPort;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

Expand Down
Loading

0 comments on commit ffbd140

Please sign in to comment.