Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewritten Rest Client using HttpClient #42

Merged
merged 22 commits into from
Jul 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 19 additions & 40 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -10,9 +10,8 @@ group 'io.github.jopenlibs'
archivesBaseName = 'vault-java-driver'
version '5.4.0'

// This project is actually limited to Java 8 compatibility. See below.
sourceCompatibility = 9
targetCompatibility = 9
sourceCompatibility = 11
targetCompatibility = 11

repositories {
mavenCentral()
@@ -31,46 +30,14 @@ dependencies {
testRuntimeOnly('org.slf4j:slf4j-simple:2.0.3')
}

// Beginning of Java 9 compatibility config
//
// Allowing a library to support Java 9+ modularity, while also maintaining backwards-compatibility for Java 8 users, is WAY more
// tricky than expected! The lines below are adapted from a blog article (https://dzone.com/articles/building-java-6-8-libraries-for-jpms-in-gradle),
// and cause the built classes to support a Java 8 JRE, while also including a module definition suitable for use with Java 9. There are a
// few considerations that come with this:
//
// * You now need JDK 9 or higher to BUILD this library. You can still USE the built artifact as a dependency in a Java 8 project.
// * Although "sourceCompatibility" and "targetCompatability" above are set for Java 9, the "compileJava" settings below will not
// allow you to build with any code changes that are not Java 8 compatible.
// * Unfortunately, IntelliJ (and perhaps other IDE's?) will show syntax highlighting, code completion tips, etc for Java 9. Sorry for
// the inconvenience. In any case, you should not commit changes to source control without confirming that the project builds.
compileJava {
exclude 'module-info.java'

options.compilerArgs = ['--release', '8']
options.compilerArgs = ['--release', targetCompatibility.toString()]
}

tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
}

tasks.register('compileModuleInfoJava', JavaCompile) {
classpath = files()
source = 'src/main/java/module-info.java'
destinationDir = compileJava.destinationDir
options.encoding = compileJava.options.encoding

doFirst {
options.compilerArgs = [
'--release', '9',
'--module-path', compileJava.classpath.asPath,
]
}
}

compileModuleInfoJava.dependsOn compileJava
classes.dependsOn compileModuleInfoJava
// End of Java 9 compatibility config

tasks.register('javadocJar', Jar) {
dependsOn tasks.named("javadoc")
archiveClassifier.set('javadoc')
@@ -115,8 +82,14 @@ tasks.named('test') {
events "passed", "skipped", "failed"
}

reports.html.enabled = false
reports.junitXml.enabled = true
reports {
html {
required = false
}
junitXml {
required = true
}
}
}

def integrationTestTask = tasks.register('integrationTest', Test) {
@@ -127,8 +100,14 @@ def integrationTestTask = tasks.register('integrationTest', Test) {
events "passed", "skipped", "failed"
}

reports.html.enabled = false
reports.junitXml.enabled = true
reports {
html {
required = false
}
junitXml {
required = true
}
}
}

//
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https://services.gradle.org/distributions/gradle-7.6.1-all.zip
distributionUrl=https://services.gradle.org/distributions/gradle-8.2-all.zip
2 changes: 1 addition & 1 deletion src/main/java/io/github/jopenlibs/vault/api/Auth.java
Original file line number Diff line number Diff line change
@@ -439,7 +439,7 @@ public AuthResponse loginByAppID(final String path, final String appId, final St
.toString();
final RestResponse restResponse = new Rest()//NOPMD
.url(config.getAddress() + "/v1/auth/" + path)
.optionalHeader("X-Vault-Namespace", this.nameSpace)
.header("X-Vault-Namespace", this.nameSpace)
.body(requestJson.getBytes(StandardCharsets.UTF_8))
.connectTimeoutSeconds(config.getOpenTimeout())
.readTimeoutSeconds(config.getReadTimeout())
Loading