Skip to content

Merge release/6.6.1 into master #1668

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

Merged
merged 18 commits into from
May 31, 2024
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
31 changes: 16 additions & 15 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ def getJava(){
return "/home/builder/java/jdk-17.0.2"
}else if(env.JAVA_VERSION=="JAVA11"){
return "/home/builder/java/jdk-11.0.2"
}else{
}else if(env.JAVA_VERSION=="JAVA21"){
return "/home/builder/java/jdk-21.0.1"
}else{
return "/home/builder/java/openjdk-1.8.0-262"
}
}
Expand Down Expand Up @@ -195,19 +197,18 @@ pipeline{
}
}

// Can't run these as all the Optic Update tests fail now (as expected) on 11.1.0.
// stage('regressions-11.1.0') {
// when {
// allOf {
// branch 'develop'
// expression {return params.regressions}
// }
// }
// steps {
// runAllTests('Release', '11.1.0', false)
// junit '**/build/**/TEST*.xml'
// }
// }
stage('regressions-11.2.0') {
when {
allOf {
branch 'develop'
expression {return params.regressions}
}
}
steps {
runAllTests('Release', '11.2.0', false)
junit '**/build/**/TEST*.xml'
}
}

stage('regressions-11') {
when {
Expand Down Expand Up @@ -247,7 +248,7 @@ pipeline{
junit '**/build/**/TEST*.xml'
}
}

stage('regressions-10.0') {
when {
allOf {
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=6.6.0
version=6.6.1
describedName=MarkLogic Java Client API
publishUrl=file:../marklogic-java/releases

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
6 changes: 6 additions & 0 deletions marklogic-client-api-functionaltests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ dependencies {
implementation "org.jdom:jdom2:2.0.6.1"
implementation "com.marklogic:ml-app-deployer:4.6.1"

if (JavaVersion.current().isJava9Compatible()) {
implementation 'javax.xml.bind:jaxb-api:2.3.1'
implementation 'org.glassfish.jaxb:jaxb-runtime:2.3.8'
implementation 'org.glassfish.jaxb:jaxb-core:2.3.0.1'
}

testImplementation 'ch.qos.logback:logback-classic:1.3.14'
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.1'
testImplementation 'org.xmlunit:xmlunit-legacy:2.9.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -445,10 +445,7 @@ public void testNegativePointInvalidValue() throws Exception {
result = e.getMessage();
}

String expectedResult = markLogicVersion.getMajor() <= 11 ?
"<search:warning id=\"SEARCH-IGNOREDQTEXT\">[Invalid text, cannot parse geospatial point from '12,A'.]</search:warning>" :
"arg2 is not of type xs:double";

String expectedResult = "<search:warning id=\"SEARCH-IGNOREDQTEXT\">[Invalid text, cannot parse geospatial point from '12,A'.]</search:warning>";
assertTrue(result.contains(expectedResult), "Unexpected result: " + result);
}

Expand Down Expand Up @@ -626,14 +623,8 @@ public void testNegativePointInvalidValue_ChildConstraint() throws Exception {
result = ex.getMessage();
}

String expectedResult = markLogicVersion.getMajor() <= 11 ?
"<search:warning id=\"SEARCH-IGNOREDQTEXT\">[Invalid text, cannot parse geospatial point from '12,A'.]</search:warning>" :
"arg2 is not of type xs:double";

assertTrue(
result.contains(expectedResult),
"Unexpected result: " + result
);
String expectedResult = "<search:warning id=\"SEARCH-IGNOREDQTEXT\">[Invalid text, cannot parse geospatial point from '12,A'.]</search:warning>";
assertTrue(result.contains(expectedResult), "Unexpected result: " + result);
}

@Test
Expand Down Expand Up @@ -820,10 +811,7 @@ public void testNegativePointInvalidValue_GeoElementConstraint() throws Exceptio
result = e.getMessage();
}

String expectedResult = markLogicVersion.getMajor() <= 11 ?
"<search:warning id=\"SEARCH-IGNOREDQTEXT\">[Invalid text, cannot parse geospatial point from '12,A'.]</search:warning>" :
"arg2 is not of type xs:double";

String expectedResult = "<search:warning id=\"SEARCH-IGNOREDQTEXT\">[Invalid text, cannot parse geospatial point from '12,A'.]</search:warning>";
assertTrue(result.contains(expectedResult), "Unexpected result: " + result);
}

Expand Down Expand Up @@ -1012,10 +1000,7 @@ public void testNegativePointInvalidValue_GeoElemPairConstraint() throws Excepti
result = e.getMessage();
}

String expectedResult = markLogicVersion.getMajor() <= 11 ?
"<search:warning id=\"SEARCH-IGNOREDQTEXT\">[Invalid text, cannot parse geospatial point from '-12,A'.]</search:warning>" :
"arg2 is not of type xs:double";

String expectedResult = "<search:warning id=\"SEARCH-IGNOREDQTEXT\">[Invalid text, cannot parse geospatial point from '-12,A'.]</search:warning>";
assertTrue(result.contains(expectedResult), "Unexpected result: " + result);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2213,10 +2213,7 @@ public void testFromSqlUnionSelectOrderbyLimitOffset() {
.orderBy(op.desc("id"))
.limit(3)
.offset(1)
// This is no longer working on MarkLogic 12 nightly. Neither op.col("name") works now op.schemaCol("opticFunctionalTest.detail.name").
// We get an error of "Invalid arguments: expression column myName with undefined expression".
//.select(p.as("myName", p.col("name")))
;
.select(op.as("myName", op.col("name")));

JacksonHandle jacksonHandle = new JacksonHandle();
jacksonHandle.setMimetype("application/json");
Expand All @@ -2225,8 +2222,8 @@ public void testFromSqlUnionSelectOrderbyLimitOffset() {
JsonNode rows = result.path("rows");

assertEquals(2, rows.size());
assertEquals("Detail 5", rows.path(0).path("opticFunctionalTest.detail.name").path("value").asText());
assertEquals("Detail 4", rows.path(1).path("opticFunctionalTest.detail.name").path("value").asText());
assertEquals("Detail 5", rows.path(0).path("myName").path("value").asText());
assertEquals("Detail 4", rows.path(1).path("myName").path("value").asText());
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import org.slf4j.LoggerFactory;

import java.io.File;
import java.io.IOException;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
Expand Down Expand Up @@ -189,10 +188,9 @@ public void jobReport() throws Exception {
}

@Test
public void testNullQdef() throws IOException, InterruptedException {
public void testNullQdef() {
System.out.println("In testNullQdef method");
JsonNode node = null;
JacksonHandle jacksonHandle = null;

WriteBatcher wbatcher = dmManager.newWriteBatcher().withBatchSize(32).withThreadCount(20);
try {
Expand All @@ -203,19 +201,7 @@ public void testNullQdef() throws IOException, InterruptedException {
}

try {
wbatcher.add("/nulldoc", jacksonHandle);
fail("Exception was not thrown, when it should have been");
} catch (IllegalArgumentException e) {
assertTrue(e.getMessage().equals("contentHandle must not be null"));
}

QueryManager queryMgr = dbClient.newQueryManager();
StringQueryDefinition querydef = queryMgr.newStringDefinition();

querydef = null;

try {
QueryBatcher batcher = dmManager.newQueryBatcher(querydef).withBatchSize(32).withThreadCount(20);
dmManager.newQueryBatcher((StringQueryDefinition) null).withBatchSize(32).withThreadCount(20);
fail("Exception was not thrown, when it should have been");
} catch (IllegalArgumentException e) {
assertTrue(e.getMessage().equals("query must not be null"));
Expand Down
50 changes: 4 additions & 46 deletions marklogic-client-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

plugins {
id 'maven-publish'
id 'distribution'
}

group = 'com.marklogic'
Expand Down Expand Up @@ -81,7 +80,7 @@ jar {
)
}
task sourcesJar(type: Jar) {
classifier = 'sources'
archiveClassifier = 'sources'
exclude ('property', '*.xsd', '*.xjb')
from sourceSets.main.allSource
}
Expand Down Expand Up @@ -109,9 +108,9 @@ javadoc {
}
}

task javadocJar (type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier = 'javadoc'
from javadoc.destinationDir
}

Node pomCustomizations = new NodeBuilder(). project {
Expand Down Expand Up @@ -180,47 +179,6 @@ publishing {
}
}

distZip {
archiveFileName = "$project.name-$rootProject.version-with-dependencies.zip"
dependsOn javadoc
}

distributions {
main {
contents {
from("..") {
include("NOTICE.TXT")
}
from("src/main/resources") {
include ("Readme.txt")
include ("LICENSE.txt")
}
into ("example") {
from ("../examples/src/main/resources") {
include ("data/**")
include ("scripts/**")
include ("Example.properties")
}
from ("../examples/src/main/resources/example") {
include ("README.txt")
}
from ("../examples/src/main/java/") {
include ("com/marklogic/client/example/cookbook/*.java")
include ("com/marklogic/client/example/handle/*.java")
include ("com/marklogic/client/example/extension/*.java")
}
}
into ("doc/api") {
from ("build/docs/javadoc")
}
into("lib") {
from jar
from(project.configurations.runtimeClasspath)
}
}
}
}

task printClassPath() {
doLast {
println sourceSets.main.runtimeClasspath.asPath+':'+sourceSets.test.runtimeClasspath.asPath
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,16 @@

import com.marklogic.client.DatabaseClient;
import com.marklogic.client.datamovement.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean;

public abstract class BatcherImpl implements Batcher {

private final Logger logger = LoggerFactory.getLogger(getClass());

private String jobName = "unnamed";
private String jobId = null;
private int batchSize = 100;
Expand All @@ -31,6 +36,7 @@ public abstract class BatcherImpl implements Batcher {
private JobTicket jobTicket;
private Calendar jobStartTime;
private Calendar jobEndTime;

private final AtomicBoolean stopped = new AtomicBoolean(false);
private final AtomicBoolean started = new AtomicBoolean(false);

Expand Down Expand Up @@ -136,19 +142,32 @@ void setJobEndTime() {
this.jobEndTime = Calendar.getInstance();
}

AtomicBoolean getStarted() {
return this.started;
}
@Override
public boolean isStarted() {
return started.get();
}

@Override
public boolean isStopped() {
return stopped.get();
}
AtomicBoolean getStopped() {
return this.stopped;

final void setStartedToTrue() {
logger.info("Setting 'started' to true.");
this.started.set(true);
}

final void setStoppedToTrue() {
logger.info("Setting 'stopped' to true.");
this.stopped.set(true);
}

final boolean isStoppedTrue() {
// This method is necessary as calling "isStopped()" results in different behavior in QueryBatcherImpl, where
// that method has been overridden to inspect the thread pool status instead. It's not clear why that was done,
// so this preserves the existing behavior where the value of `stopped` is check in multiple places (it would seem
// that in all of those places, calling "isStopped()" would be preferable).
return this.stopped.get() == true;
}

protected DataMovementManagerImpl getMoveMgr() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,14 @@ public JobReport getJobReport(JobTicket ticket) {
@Override
public void stopJob(JobTicket ticket) {
if ( ticket == null ) throw new IllegalArgumentException("ticket must not be null");
logger.info("Stopping {} job with ID: {}", ticket.getJobType(), ticket.getJobId());
service.stopJob(ticket, activeJobs);
}

@Override
public void stopJob(Batcher batcher) {
if ( batcher == null ) throw new IllegalArgumentException("batcher must not be null");
logger.info("Stopping batcher; job name: {}; job ID: {}", batcher.getJobName(), batcher.getJobId());
service.stopJob(batcher, activeJobs);
}

Expand Down
Loading