Skip to content
Merged
Show file tree
Hide file tree
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
11 changes: 4 additions & 7 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
@Library('shared-libraries') _

def getJava(){
if(env.JAVA_VERSION=="JAVA17"){
return "/home/builder/java/jdk-17.0.2"
}else if(env.JAVA_VERSION=="JAVA11"){
return "/home/builder/java/jdk-11.0.2"
}else if(env.JAVA_VERSION=="JAVA21"){
if (env.JAVA_VERSION == "JAVA21") {
return "/home/builder/java/jdk-21.0.1"
}else{
return "/home/builder/java/openjdk-1.8.0-262"
} else {
return "/home/builder/java/jdk-17.0.2"
}
}

Expand All @@ -26,6 +22,7 @@ def setupDockerMarkLogic(String image){
MARKLOGIC_IMAGE='''+image+''' MARKLOGIC_LOGS_VOLUME=marklogicLogs docker compose up -d --build
echo "Waiting for MarkLogic server to initialize."
sleep 60s
export JAVA_HOME=$JAVA_HOME_DIR
export GRADLE_USER_HOME=$WORKSPACE/$GRADLE_DIR
export PATH=$GRADLE_USER_HOME:$JAVA_HOME/bin:$PATH
./gradlew mlTestConnections
Expand Down
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ subprojects {
options.compilerArgs += ["-Xlint:unchecked", "-Xlint:deprecation"]
}

// To ensure that the Java Client continues to support Java 8, both source and target compatibility are set to 1.8.
java {
sourceCompatibility = 1.8
targetCompatibility = 1.8
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}

configurations {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
group=com.marklogic
version=7.3-SNAPSHOT
version=8.0-SNAPSHOT
describedName=MarkLogic Java Client API
publishUrl=file:../marklogic-java/releases

Expand Down
4 changes: 2 additions & 2 deletions marklogic-client-api-functionaltests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dependencies {
testImplementation 'org.skyscreamer:jsonassert:1.5.3'
testImplementation 'org.slf4j:slf4j-api:2.0.17'
testImplementation 'commons-io:commons-io:2.17.0'
testImplementation 'com.squareup.okhttp3:okhttp:4.12.0'
testImplementation 'com.squareup.okhttp3:okhttp:5.1.0'
testImplementation "com.fasterxml.jackson.core:jackson-core:${jacksonVersion}"
testImplementation "com.fasterxml.jackson.core:jackson-databind:${jacksonVersion}"
testImplementation "org.jdom:jdom2:2.0.6.1"
Expand All @@ -32,7 +32,7 @@ dependencies {
exclude module: "commons-lang3"
}

testImplementation 'ch.qos.logback:logback-classic:1.3.15'
testImplementation 'ch.qos.logback:logback-classic:1.5.18'
testImplementation 'org.junit.jupiter:junit-jupiter:5.13.4'
testImplementation 'org.xmlunit:xmlunit-legacy:2.10.0'

Expand Down
10 changes: 5 additions & 5 deletions marklogic-client-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ dependencies {
api "jakarta.xml.bind:jakarta.xml.bind-api:3.0.1"
implementation "org.glassfish.jaxb:jaxb-runtime:3.0.2"

implementation 'com.squareup.okhttp3:okhttp:4.12.0'
implementation 'com.squareup.okhttp3:logging-interceptor:4.12.0'
implementation 'io.github.rburgst:okhttp-digest:2.7'
implementation 'com.squareup.okhttp3:okhttp:5.1.0'
implementation 'com.squareup.okhttp3:logging-interceptor:5.1.0'
implementation 'io.github.rburgst:okhttp-digest:3.1.1'

// We tried upgrading to the org.eclipse.angus:angus-mail dependency, but we ran into significant performance issues
// with using the Java Client eval call in our Spark connector. Example - an eval() call for getting 50k URIs would
Expand Down Expand Up @@ -57,10 +57,10 @@ dependencies {
// Starting with mockito 5.x, Java 11 is required, so sticking with 4.x as we have to support Java 8.
testImplementation "org.mockito:mockito-core:4.11.0"
testImplementation "org.mockito:mockito-inline:4.11.0"
testImplementation "com.squareup.okhttp3:mockwebserver:4.12.0"
testImplementation "com.squareup.okhttp3:mockwebserver3:5.1.0"

testImplementation "com.fasterxml.jackson.dataformat:jackson-dataformat-xml:${jacksonVersion}"
testImplementation 'ch.qos.logback:logback-classic:1.3.15'
testImplementation 'ch.qos.logback:logback-classic:1.5.18'

// Using this to avoid a schema validation issue with the regular xercesImpl
testImplementation 'org.opengis.cite.xerces:xercesImpl-xsd11:2.12-beta-r1667115'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,23 @@
package com.marklogic.client.impl.okhttp;

import com.marklogic.client.DatabaseClientFactory;
import mockwebserver3.MockWebServer;
import okhttp3.Request;
import okhttp3.mockwebserver.MockWebServer;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;

public class OAuthAuthenticationConfigurerTest {
class OAuthAuthenticationConfigurerTest {

@Test
void test() {
DatabaseClientFactory.OAuthContext authContext = new DatabaseClientFactory.OAuthContext("abc123");
Request request = new Request.Builder().url(new MockWebServer().url("/url-doesnt-matter")).build();
void test() throws Exception {
try (MockWebServer server = new MockWebServer()) {
server.start();
Request request = new Request.Builder().url(server.url("/url-doesnt-matter")).build();

Request authenticatedRequest = new OAuthAuthenticationConfigurer().makeAuthenticatedRequest(request, authContext);
assertEquals("Bearer abc123", authenticatedRequest.header("Authorization"));
DatabaseClientFactory.OAuthContext authContext = new DatabaseClientFactory.OAuthContext("abc123");
Request authenticatedRequest = new OAuthAuthenticationConfigurer().makeAuthenticatedRequest(request, authContext);
assertEquals("Bearer abc123", authenticatedRequest.header("Authorization"));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
package com.marklogic.client.impl.okhttp;

import com.marklogic.client.ext.helper.LoggingObject;
import mockwebserver3.MockResponse;
import mockwebserver3.MockWebServer;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.mockwebserver.MockResponse;
import okhttp3.mockwebserver.MockWebServer;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

Expand All @@ -23,15 +24,17 @@
* Uses OkHttp's MockWebServer to completely mock a MarkLogic instance so that we can control what response codes are
* returned and processed by TokenAuthenticationInterceptor.
*/
public class TokenAuthenticationInterceptorTest extends LoggingObject {
class TokenAuthenticationInterceptorTest extends LoggingObject {

private MockWebServer mockWebServer;
private FakeTokenGenerator fakeTokenGenerator;
private OkHttpClient okHttpClient;

@BeforeEach
void beforeEach() {
void beforeEach() throws IOException {
mockWebServer = new MockWebServer();
mockWebServer.start();

fakeTokenGenerator = new FakeTokenGenerator();

ProgressDataCloudAuthenticationConfigurer.TokenAuthenticationInterceptor interceptor =
Expand All @@ -43,6 +46,11 @@ void beforeEach() {
okHttpClient = new OkHttpClient.Builder().addInterceptor(interceptor).build();
}

@AfterEach
void tearDown() {
mockWebServer.close();
}

@Test
void receive401() {
enqueueResponseCodes(200, 200, 401, 200);
Expand Down Expand Up @@ -110,7 +118,7 @@ void multipleThreads() throws Exception {
*/
private void enqueueResponseCodes(int... codes) {
for (int code : codes) {
mockWebServer.enqueue(new MockResponse().setResponseCode(code));
mockWebServer.enqueue(new MockResponse.Builder().code(code).build());
}
}

Expand Down
4 changes: 2 additions & 2 deletions ml-development-tools/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ publishing {
}

compileKotlin {
kotlinOptions.jvmTarget = '1.8'
kotlinOptions.jvmTarget = '17'
}
compileTestKotlin {
kotlinOptions.jvmTarget = '1.8'
kotlinOptions.jvmTarget = '17'
}

tasks.register("generateTests", JavaExec) {
Expand Down