-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
201 additions
and
2 deletions.
There are no files selected for viewing
4 changes: 3 additions & 1 deletion
4
...-client/src/main/java/com/commercetools/http/apachehttp/ApacheHttpClientSolutionInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
...s-apachehttp-client/src/test/java/com/commercetools/http/apachehttp/SolutionInfoTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
package com.commercetools.http.apachehttp; | ||
|
||
import org.assertj.core.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class SolutionInfoTest { | ||
@Test | ||
public void version() { | ||
String version = new ApacheHttpClientSolutionInfo().getVersion(); | ||
|
||
Assertions.assertThat(version).isEqualTo("5.4.1"); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...tp-client/src/main/java/com/commercetools/http/asynchttp/AsyncHttpClientSolutionInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
package com.commercetools.http.asynchttp; | ||
|
||
import io.vrap.rmf.base.client.SolutionInfo; | ||
import io.vrap.rmf.base.client.VersionLoader; | ||
|
||
public class AsyncHttpClientSolutionInfo extends SolutionInfo { | ||
|
||
public AsyncHttpClientSolutionInfo() { | ||
setName("AsyncHttpAsyncClient"); | ||
setVersion(VersionLoader.loadVersionInfo("org.asynchttpclient", "async-http-client", "pom.properties", | ||
"version", this.getClass().getClassLoader())); | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...ync-http-client/src/main/resources/META-INF/services/io.vrap.rmf.base.client.SolutionInfo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
com.commercetools.http.asynchttp.AsyncHttpClientSolutionInfo |
16 changes: 16 additions & 0 deletions
16
...nc-http-client/src/test/java/com/commercetools/http/asynchttpclient/SolutionInfoTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
package com.commercetools.http.asynchttpclient; | ||
|
||
import com.commercetools.http.asynchttp.AsyncHttpClientSolutionInfo; | ||
|
||
import org.assertj.core.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class SolutionInfoTest { | ||
@Test | ||
public void version() { | ||
String version = new AsyncHttpClientSolutionInfo().getVersion(); | ||
|
||
Assertions.assertThat(version).isEqualTo("2.12.3"); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...et-client/src/main/java/com/commercetools/http/javanet/JavaNetHttpClientSolutionInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
package com.commercetools.http.javanet; | ||
|
||
import io.vrap.rmf.base.client.SolutionInfo; | ||
|
||
import org.apache.commons.lang3.SystemUtils; | ||
|
||
public class JavaNetHttpClientSolutionInfo extends SolutionInfo { | ||
|
||
public JavaNetHttpClientSolutionInfo() { | ||
setName("JavaNetHttpClient"); | ||
setVersion(SystemUtils.JAVA_RUNTIME_VERSION); | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...-javanet-client/src/main/resources/META-INF/services/io.vrap.rmf.base.client.SolutionInfo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
com.commercetools.http.javanet.JavaNetHttpClientSolutionInfo |
14 changes: 14 additions & 0 deletions
14
...cetools-javanet-client/src/test/java/com/commercetools/http/javanet/SolutionInfoTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
package com.commercetools.http.javanet; | ||
|
||
import org.assertj.core.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class SolutionInfoTest { | ||
@Test | ||
public void version() { | ||
String version = new JavaNetHttpClientSolutionInfo().getVersion(); | ||
|
||
Assertions.assertThat(version).isNotEmpty(); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...okhttp-client3/src/main/java/com/commercetools/http/okhttp3/OkHttpClientSolutionInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
package com.commercetools.http.okhttp3; | ||
|
||
import io.vrap.rmf.base.client.SolutionInfo; | ||
import io.vrap.rmf.base.client.VersionLoader; | ||
|
||
public class OkHttpClientSolutionInfo extends SolutionInfo { | ||
|
||
public OkHttpClientSolutionInfo() { | ||
setName("OkHttpClient"); | ||
setVersion(VersionLoader.loadVersionInfo("com.squareup.okhttp3", "okhttp", "pom.properties", "version", | ||
this.getClass().getClassLoader())); | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...-okhttp-client3/src/main/resources/META-INF/services/io.vrap.rmf.base.client.SolutionInfo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
com.commercetools.http.okhttp3.OkHttpClientSolutionInfo |
14 changes: 14 additions & 0 deletions
14
...cetools-okhttp-client3/src/test/java/com/commercetools/http/okhttp3/SolutionInfoTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
package com.commercetools.http.okhttp3; | ||
|
||
import org.assertj.core.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class SolutionInfoTest { | ||
@Test | ||
public void version() { | ||
String version = new OkHttpClientSolutionInfo().getVersion(); | ||
|
||
Assertions.assertThat(version).isEqualTo("3.14.9"); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...okhttp-client4/src/main/java/com/commercetools/http/okhttp4/OkHttpClientSolutionInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
package com.commercetools.http.okhttp4; | ||
|
||
import io.vrap.rmf.base.client.SolutionInfo; | ||
|
||
import okhttp3.OkHttp; | ||
|
||
public class OkHttpClientSolutionInfo extends SolutionInfo { | ||
|
||
public OkHttpClientSolutionInfo() { | ||
setName("OkHttpClient"); | ||
setVersion(OkHttp.VERSION); | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...-okhttp-client4/src/main/resources/META-INF/services/io.vrap.rmf.base.client.SolutionInfo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
com.commercetools.http.okhttp4.OkHttpClientSolutionInfo |
14 changes: 14 additions & 0 deletions
14
...cetools-okhttp-client4/src/test/java/com/commercetools/http/okhttp4/SolutionInfoTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
package com.commercetools.http.okhttp4; | ||
|
||
import org.assertj.core.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class SolutionInfoTest { | ||
@Test | ||
public void version() { | ||
String version = new OkHttpClientSolutionInfo().getVersion(); | ||
|
||
Assertions.assertThat(version).isEqualTo("3.14.9"); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...rnetty-client/src/main/java/com/commercetools/http/netty/NettyHttpClientSolutionInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
package com.commercetools.http.netty; | ||
|
||
import io.vrap.rmf.base.client.SolutionInfo; | ||
|
||
import reactor.netty.http.client.HttpClient; | ||
|
||
public class NettyHttpClientSolutionInfo extends SolutionInfo { | ||
|
||
public NettyHttpClientSolutionInfo() { | ||
setName("NettyHttpClient"); | ||
setVersion(HttpClient.class.getPackage().getImplementationVersion()); | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...tornetty-client/src/main/resources/META-INF/services/io.vrap.rmf.base.client.SolutionInfo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
com.commercetools.http.netty.NettyHttpClientSolutionInfo |
14 changes: 14 additions & 0 deletions
14
...ools-reactornetty-client/src/test/java/com/commercetools/http/netty/SolutionInfoTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
package com.commercetools.http.netty; | ||
|
||
import org.assertj.core.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class SolutionInfoTest { | ||
@Test | ||
public void version() { | ||
String version = new NettyHttpClientSolutionInfo().getVersion(); | ||
|
||
Assertions.assertThat(version).isEqualTo("1.1.19"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
rmf/rmf-java-base/src/main/java/io/vrap/rmf/base/client/VersionLoader.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
|
||
package io.vrap.rmf.base.client; | ||
|
||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.util.Optional; | ||
import java.util.Properties; | ||
|
||
public class VersionLoader { | ||
|
||
public static String loadVersionInfo(final String groupId, final String artifactId, final String versionFile, | ||
final String versionProperty, final ClassLoader classLoader) { | ||
Properties loadedProps = null; | ||
try { | ||
try (final InputStream is = classLoader | ||
.getResourceAsStream("META-INF/maven/" + groupId + "/" + artifactId + "/" + versionFile)) { | ||
if (is != null) { | ||
final Properties props = new Properties(); | ||
props.load(is); | ||
loadedProps = props; | ||
} | ||
} | ||
} | ||
catch (final IOException ignored) { | ||
} | ||
|
||
if (loadedProps != null) { | ||
return Optional.ofNullable(loadedProps.get(versionProperty)).map(Object::toString).orElse(null); | ||
} | ||
|
||
return null; | ||
} | ||
} |