From 32361f114c7b2b232b3667742fe87ce853065aab Mon Sep 17 00:00:00 2001 From: Hemanth Madala Date: Tue, 3 Nov 2026 11:36:38 +0530 Subject: [PATCH] MLE-33564 Fix the 5 fixable disabled tests BulkReadWriteTest (testA_BulkLoad, testB_BulkRead, testC_BulkSearch): - Load cities_above_300K.txt in @BeforeAll so the tests no longer depend on running in method-name order; testA_BulkLoad now verifies the loaded count. - Removed @Disabled. TestBiTemporal (testPeriodRangeQuerySingleAxisBasedOnALNContains, testPeriodRangeQueryMultiplesAxesBasedOnALNContains): - Query periods are now derived by offsets from the valid times the test writes, and are built in UTC rather than the JVM default timezone, which made the tests fail whenever the JVM was not running in UTC. - Removed @Disabled. MLE-33564 Update copyright year to 2026 in BulkReadWriteTest The Validate Copyright Headers check requires modified files to carry the current year. Revert "MLE-33564 Temporarily pin PR build to MarkLogic 12.2.20261005" This reverts commit 493a518d0d97f9399bbc3dcfeb1f8589833a4f31. Co-Authored-By: Copilot <223556219+Copilot@users.noreply.github.com> --- .../client/functionaltest/TestBiTemporal.java | 47 ++++++++++++------- .../client/test/BulkReadWriteTest.java | 20 +++++--- 2 files changed, 42 insertions(+), 25 deletions(-) diff --git a/marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/functionaltest/TestBiTemporal.java b/marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/functionaltest/TestBiTemporal.java index 1fdfe67d66..39c0fa0781 100644 --- a/marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/functionaltest/TestBiTemporal.java +++ b/marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/functionaltest/TestBiTemporal.java @@ -55,6 +55,13 @@ class TestBiTemporal extends BasicJavaClientREST { private final static String validStartERIName = "javaValidStartERI"; private final static String validEndERIName = "javaValidEndERI"; + // Valid periods written by insertJSONSingleDocument and updateJSONSingleDocument. Query periods in the + // ALN_CONTAINS tests are derived from these via offsets instead of being separate hardcoded dates. + private final static String initialValidStart = "2001-01-01T00:00:00"; + private final static String initialValidEnd = "2011-12-31T23:59:59"; + private final static String updatedValidStart = "2003-01-01T00:00:00"; + private final static String updatedValidEnd = "2008-12-31T23:59:59"; + private final static String axisSystemName = "javaERISystemAxis"; private final static String axisValidName = "javaERIValidAxis"; @@ -458,7 +465,7 @@ public void insertJSONSingleDocument(String temporalCollection, String docId, System.out.println("Inside insertJSONSingleDocument"); JacksonDatabindHandle handle = getJSONDocumentHandle( - "2001-01-01T00:00:00", "2011-12-31T23:59:59", "999 Skyway Park - JSON", + initialValidStart, initialValidEnd, "999 Skyway Park - JSON", docId); JSONDocumentManager docMgr = writerClient.newJSONDocumentManager(); @@ -547,7 +554,7 @@ public void updateJSONSingleDocument(String temporalCollection, String docId, // Update the temporal document JacksonDatabindHandle handle = getJSONDocumentHandle( - "2003-01-01T00:00:00", "2008-12-31T23:59:59", + updatedValidStart, updatedValidEnd, "1999 Skyway Park - Updated - JSON", docId); JSONDocumentManager docMgr = writerClient.newJSONDocumentManager(); @@ -2079,8 +2086,6 @@ public void testTransactionRollback() throws Exception { @Test // Test Period Range Query using ALN_CONTAINS. We use a single axis during // query - @Disabled("Started failing on October 18th, 2024 on MarkLogic 10, 11, and 12, suggesting that the test is " + - "brittle and likely affected by some date/time constraint.") public void testPeriodRangeQuerySingleAxisBasedOnALNContains() throws Exception { System.out.println("Inside testPeriodRangeQuerySingleAxisBasedOnALNContains"); @@ -2104,8 +2109,9 @@ public void testPeriodRangeQuerySingleAxisBasedOnALNContains() StructuredQueryDefinition termQuery = sqb.collection(docId); StructuredQueryBuilder.Axis validAxis = sqb.axis(axisValidName); - Calendar start1 = DatatypeConverter.parseDateTime("2001-01-01T00:00:01"); - Calendar end1 = DatatypeConverter.parseDateTime("2011-12-31T23:59:58"); + // Query period sits 1 second inside the written valid period, so the written document contains it. + Calendar start1 = utcValidTime(initialValidStart, 1); + Calendar end1 = utcValidTime(initialValidEnd, -1); StructuredQueryBuilder.Period period1 = sqb.period(start1, end1); StructuredQueryDefinition periodQuery = sqb .and(termQuery, sqb.temporalPeriodRange(validAxis, @@ -2169,8 +2175,8 @@ public void testPeriodRangeQuerySingleAxisBasedOnALNContains() System.out.println("validEndDate = " + validEndDate); assertTrue( - (validStartDate.equals("2001-01-01T00:00:00") && validEndDate - .equals("2011-12-31T23:59:59"))); + (validStartDate.equals(initialValidStart) && validEndDate + .equals(initialValidEnd))); } } @@ -2184,8 +2190,6 @@ public void testPeriodRangeQuerySingleAxisBasedOnALNContains() // the results will be an OR of the result of each of the query done for every // axis // across every period - @Disabled("Started failing on October 18th, 2024 on MarkLogic 10, 11, and 12, suggesting that the test is " + - "brittle and likely affected by some date/time constraint.") public void testPeriodRangeQueryMultiplesAxesBasedOnALNContains() throws Exception { System.out.println("Inside testPeriodRangeQueryMultiplesAxesBasedOnALNContains"); @@ -2207,13 +2211,13 @@ public void testPeriodRangeQueryMultiplesAxesBasedOnALNContains() StructuredQueryDefinition termQuery = sqb.collection(docId); StructuredQueryBuilder.Axis validAxis1 = sqb.axis(axisValidName); - Calendar start1 = DatatypeConverter.parseDateTime("2001-01-01T00:00:01"); - Calendar end1 = DatatypeConverter.parseDateTime("2011-12-31T23:59:58"); + Calendar start1 = utcValidTime(initialValidStart, 1); + Calendar end1 = utcValidTime(initialValidEnd, -1); StructuredQueryBuilder.Period period1 = sqb.period(start1, end1); StructuredQueryBuilder.Axis validAxis2 = sqb.axis(axisValidName); - Calendar start2 = DatatypeConverter.parseDateTime("2003-01-01T00:00:01"); - Calendar end2 = DatatypeConverter.parseDateTime("2008-12-31T23:59:58"); + Calendar start2 = utcValidTime(updatedValidStart, 1); + Calendar end2 = utcValidTime(updatedValidEnd, -1); StructuredQueryBuilder.Period period2 = sqb.period(start2, end2); StructuredQueryBuilder.Axis[] axes = new StructuredQueryBuilder.Axis[] { @@ -2273,11 +2277,11 @@ public void testPeriodRangeQueryMultiplesAxesBasedOnALNContains() System.out.println("validEndDate = " + validEndDate); assertTrue( - (validStartDate.equals("2001-01-01T00:00:00") || validStartDate - .equals("2003-01-01T00:00:00"))); + (validStartDate.equals(initialValidStart) || validStartDate + .equals(updatedValidStart))); assertTrue( - (validEndDate.equals("2011-12-31T23:59:59") || validEndDate - .equals("2008-12-31T23:59:59"))); + (validEndDate.equals(initialValidEnd) || validEndDate + .equals(updatedValidEnd))); } } @@ -2285,6 +2289,13 @@ public void testPeriodRangeQueryMultiplesAxesBasedOnALNContains() assertEquals(2, count); } + // Parsed as UTC so that the query period does not depend on the JVM's default timezone. + private static Calendar utcValidTime(String validTime, int offsetSeconds) { + Calendar calendar = DatatypeConverter.parseDateTime(validTime + "Z"); + calendar.add(Calendar.SECOND, offsetSeconds); + return calendar; + } + @Test // Test Period Compare Query using ALN_CONTAINS as the operator public void testPeriodCompareQueryBasedOnALNContains() diff --git a/marklogic-client-api/src/test/java/com/marklogic/client/test/BulkReadWriteTest.java b/marklogic-client-api/src/test/java/com/marklogic/client/test/BulkReadWriteTest.java index bcfa515328..5d09ace871 100644 --- a/marklogic-client-api/src/test/java/com/marklogic/client/test/BulkReadWriteTest.java +++ b/marklogic-client-api/src/test/java/com/marklogic/client/test/BulkReadWriteTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2025 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved. + * Copyright (c) 2010-2026 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved. */ package com.marklogic.client.test; @@ -37,11 +37,14 @@ public class BulkReadWriteTest { static final int RECORDS_EXPECTED = 1363; @BeforeAll - public static void beforeClass() throws JAXBException { + public static void beforeClass() throws Exception { Common.connect(); DatabaseClientFactory.getHandleRegistry().register( JAXBHandle.newFactory(City.class) ); + // Loaded once up front so that no test depends on another test having run first. + cleanUp(); + loadCities(new BulkCityWriter()); } @AfterAll public static void afterClass() { @@ -116,13 +119,17 @@ static void loadCities(CityWriter cityWriter) throws Exception { } - @Disabled @Test - public void testA_BulkLoad() throws IOException, Exception { - loadCities(new BulkCityWriter()); + public void testA_BulkLoad() { + DocumentPage page = Common.client.newXMLDocumentManager() + .search(new StructuredQueryBuilder().directory(false, DIRECTORY), 1); + try { + assertEquals( RECORDS_EXPECTED, page.getTotalSize()); + } finally { + page.close(); + } } - @Disabled @Test public void testB_BulkRead() { XMLDocumentManager docMgr = Common.client.newXMLDocumentManager(); @@ -179,7 +186,6 @@ public void testB_BulkRead() { assertTrue( exceptionThrown); } - @Disabled @Test public void testC_BulkSearch() { XMLDocumentManager docMgr = Common.client.newXMLDocumentManager();