diff --git a/NOTICE b/NOTICE index ff9db515b3dfc3db2c2ebcfcd3c8fdb5b24db4f9..d4cf991f144b6528819190e7c7a9882205a234ea 100644 --- a/NOTICE +++ b/NOTICE @@ -121,7 +121,7 @@ The following software have components provided under the terms of this license: - Jackson-dataformat-YAML (from https://github.com/FasterXML/jackson, https://github.com/FasterXML/jackson-dataformats-text) - Jackson-module-parameter-names (from https://repo1.maven.org/maven2/com/fasterxml/jackson/module/jackson-module-parameter-names) - Jakarta Dependency Injection (from https://github.com/eclipse-ee4j/injection-api) -- Jakarta RESTful WS API (from https://github.com/eclipse-ee4j/jaxrs-api, https://repo1.maven.org/maven2/jakarta/ws/rs/jakarta.ws.rs-api) +- Jakarta RESTful WS API (from https://github.com/eclipse-ee4j/jaxrs-api, https://maven.atlassian.com/3rdparty/jakarta/ws/rs/jakarta.ws.rs-api, https://repo1.maven.org/maven2/jakarta/ws/rs/jakarta.ws.rs-api) - Jakarta Validation API (from https://beanvalidation.org) - Java Architecture for XML Binding (from http://jaxb.java.net/, https://repo1.maven.org/maven2/javax/xml/bind/jaxb-api) - Java Native Access (from https://github.com/java-native-access/jna, https://github.com/twall/jna) @@ -357,7 +357,7 @@ The following software have components provided under the terms of this license: - Jakarta Annotations API (from https://projects.eclipse.org/projects/ee4j.ca) - Jakarta JSON Processing API (from https://github.com/eclipse-ee4j/jsonp, https://javaee.github.io/jsonp) - Jakarta Messaging API (from https://projects.eclipse.org/projects/ee4j.jms) -- Jakarta RESTful WS API (from https://github.com/eclipse-ee4j/jaxrs-api, https://repo1.maven.org/maven2/jakarta/ws/rs/jakarta.ws.rs-api) +- Jakarta RESTful WS API (from https://github.com/eclipse-ee4j/jaxrs-api, https://maven.atlassian.com/3rdparty/jakarta/ws/rs/jakarta.ws.rs-api, https://repo1.maven.org/maven2/jakarta/ws/rs/jakarta.ws.rs-api) - Jakarta XML Binding API (from https://repo1.maven.org/maven2/jakarta/xml/bind/jakarta.xml.bind-api, https://repo1.maven.org/maven2/org/jboss/spec/javax/xml/bind/jboss-jaxb-api_2.3_spec) - Kryo (from https://repo1.maven.org/maven2/com/esotericsoftware/kryo) - Lucene Core (from https://repo1.maven.org/maven2/org/apache/lucene/lucene-core) @@ -508,7 +508,7 @@ The following software have components provided under the terms of this license: - Jakarta Dependency Injection (from https://github.com/eclipse-ee4j/injection-api) - Jakarta JSON Processing API (from https://github.com/eclipse-ee4j/jsonp, https://javaee.github.io/jsonp) - Jakarta Messaging API (from https://projects.eclipse.org/projects/ee4j.jms) -- Jakarta RESTful WS API (from https://github.com/eclipse-ee4j/jaxrs-api, https://repo1.maven.org/maven2/jakarta/ws/rs/jakarta.ws.rs-api) +- Jakarta RESTful WS API (from https://github.com/eclipse-ee4j/jaxrs-api, https://maven.atlassian.com/3rdparty/jakarta/ws/rs/jakarta.ws.rs-api, https://repo1.maven.org/maven2/jakarta/ws/rs/jakarta.ws.rs-api) - Jakarta Validation API (from https://beanvalidation.org) - Jakarta XML Binding API (from https://repo1.maven.org/maven2/jakarta/xml/bind/jakarta.xml.bind-api, https://repo1.maven.org/maven2/org/jboss/spec/javax/xml/bind/jboss-jaxb-api_2.3_spec) - OSGi resource locator (from https://repo1.maven.org/maven2/org/glassfish/hk2/osgi-resource-locator) @@ -550,7 +550,7 @@ The following software have components provided under the terms of this license: - Jakarta Dependency Injection (from https://github.com/eclipse-ee4j/injection-api) - Jakarta JSON Processing API (from https://github.com/eclipse-ee4j/jsonp, https://javaee.github.io/jsonp) - Jakarta Messaging API (from https://projects.eclipse.org/projects/ee4j.jms) -- Jakarta RESTful WS API (from https://github.com/eclipse-ee4j/jaxrs-api, https://repo1.maven.org/maven2/jakarta/ws/rs/jakarta.ws.rs-api) +- Jakarta RESTful WS API (from https://github.com/eclipse-ee4j/jaxrs-api, https://maven.atlassian.com/3rdparty/jakarta/ws/rs/jakarta.ws.rs-api, https://repo1.maven.org/maven2/jakarta/ws/rs/jakarta.ws.rs-api) - Jakarta Validation API (from https://beanvalidation.org) - Jakarta XML Binding API (from https://repo1.maven.org/maven2/jakarta/xml/bind/jakarta.xml.bind-api, https://repo1.maven.org/maven2/org/jboss/spec/javax/xml/bind/jboss-jaxb-api_2.3_spec) - Java Architecture for XML Binding (from http://jaxb.java.net/, https://repo1.maven.org/maven2/javax/xml/bind/jaxb-api) @@ -737,7 +737,7 @@ efsl-1.0 ======================================================================== The following software have components provided under the terms of this license: -- Jakarta RESTful WS API (from https://github.com/eclipse-ee4j/jaxrs-api, https://repo1.maven.org/maven2/jakarta/ws/rs/jakarta.ws.rs-api) +- Jakarta RESTful WS API (from https://github.com/eclipse-ee4j/jaxrs-api, https://maven.atlassian.com/3rdparty/jakarta/ws/rs/jakarta.ws.rs-api, https://repo1.maven.org/maven2/jakarta/ws/rs/jakarta.ws.rs-api) ======================================================================== gpl-2.0-classpath diff --git a/search-core/src/main/java/org/opengroup/osdu/search/provider/impl/ScrollCoreQueryServiceImpl.java b/search-core/src/main/java/org/opengroup/osdu/search/provider/impl/ScrollCoreQueryServiceImpl.java index 5e095252cf4a8141ef8a636345e80f60a6699c0f..b6e2b6ae932e5aadaf5072f810b60a45c85e2b6d 100644 --- a/search-core/src/main/java/org/opengroup/osdu/search/provider/impl/ScrollCoreQueryServiceImpl.java +++ b/search-core/src/main/java/org/opengroup/osdu/search/provider/impl/ScrollCoreQueryServiceImpl.java @@ -171,7 +171,7 @@ public class ScrollCoreQueryServiceImpl extends CoreQueryBase implements IScroll List<Map<String, Object>> results = getHitsFromSearchResponse(scrollResponse); queryResponse.setTotalCount(scrollResponse.hits().total().value()); - if (results != null) { + if (!results.isEmpty()) { queryResponse.setResults(results); queryResponse.setCursor( this.refreshCursorCache(scrollResponse.scrollId(), dpsHeaders.getUserEmail())); @@ -192,7 +192,7 @@ public class ScrollCoreQueryServiceImpl extends CoreQueryBase implements IScroll SearchResponse<Map<String, Object>> searchResponse = this.makeSearchRequest(searchRequest, client); List<Map<String, Object>> results = this.getHitsFromSearchResponse(searchResponse); - if (results != null) { + if (!results.isEmpty()) { return CursorQueryResponse.builder() .cursor(refreshCursorCache(searchResponse.scrollId(), dpsHeaders.getUserEmail())) .results(results) diff --git a/search-core/src/test/java/org/opengroup/osdu/search/provider/impl/ScrollCoreQueryServiceImplTest.java b/search-core/src/test/java/org/opengroup/osdu/search/provider/impl/ScrollCoreQueryServiceImplTest.java index 8a3c02dedc1048ed453ac44176fdf2558c269dd6..1efee529bf9491a911a97c79ba138b9e44e3f128 100644 --- a/search-core/src/test/java/org/opengroup/osdu/search/provider/impl/ScrollCoreQueryServiceImplTest.java +++ b/search-core/src/test/java/org/opengroup/osdu/search/provider/impl/ScrollCoreQueryServiceImplTest.java @@ -225,6 +225,7 @@ public class ScrollCoreQueryServiceImplTest { assertEquals(obtainedQueryResponse.getTotalCount(), totalHitsCount); assertEquals(scrollRequest.scrollId(), scrollId); assertEquals(searchRequestCursor, cursor); + assertNull(obtainedQueryResponse.getCursor()); } @Test @@ -260,15 +261,12 @@ public class ScrollCoreQueryServiceImplTest { public void testQueryIndex_whenNoCursorInSearchQueryAndSearchHitsIsEmpty() throws Exception { CursorQueryRequest searchRequest = mock(CursorQueryRequest.class); SearchResponse searchScrollResponse = mock(SearchResponse.class); - TotalHits totalHits = mock(TotalHits.class); List<Hit<Map<String, Object>>> hits = new ArrayList<>(); long totalHitsCount = 0L; doReturn(searchHits).when(searchScrollResponse).hits(); doReturn(hits).when(searchHits).hits(); - doReturn(totalHits).when(searchHits).total(); - doReturn(totalHitsCount).when(totalHits).value(); doReturn(searchScrollResponse).when(client).search(any(SearchRequest.class), eq((Type)Map.class)); when(featureFlag.isFeatureEnabled(POLICY_FEATURE_NAME)).thenReturn(false); @@ -276,6 +274,7 @@ public class ScrollCoreQueryServiceImplTest { assertEquals(obtainedQueryResponse.getResults().size(), 0); assertEquals(obtainedQueryResponse.getTotalCount(), totalHitsCount); + assertNull(obtainedQueryResponse.getCursor()); } @Test(expected = AppException.class) diff --git a/testing/integration-tests/search-test-core/src/main/java/org/opengroup/osdu/common/QueryByCursorBase.java b/testing/integration-tests/search-test-core/src/main/java/org/opengroup/osdu/common/QueryByCursorBase.java index 0295c6de885d4da67f67225cc265a8ee3e058acd..b9be8c09471db1ed9f9a305ae090403108f22973 100644 --- a/testing/integration-tests/search-test-core/src/main/java/org/opengroup/osdu/common/QueryByCursorBase.java +++ b/testing/integration-tests/search-test-core/src/main/java/org/opengroup/osdu/common/QueryByCursorBase.java @@ -2,6 +2,7 @@ package org.opengroup.osdu.common; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import com.google.gson.Gson; import java.util.List; @@ -70,6 +71,9 @@ public class QueryByCursorBase extends TestsBase { ResponseMock response = executeQuery(payload, headers, httpClient.getAccessToken(), ResponseMock.class); assertEquals(200, response.getResponseCode()); assertEquals(resultCount, response.getResults().size()); + if(resultCount == 0){ + assertNull(response.getCursor()); + } } public void i_should_get_response_with_reason_message_and_errors(List<Integer> codes, String type, String msg, diff --git a/testing/integration-tests/search-test-core/src/main/resources/features/querybycursor/singlecluster/QueryByCursor.feature b/testing/integration-tests/search-test-core/src/main/resources/features/querybycursor/singlecluster/QueryByCursor.feature index 3d3fe724922d87169047c60e4c114905a4468247..11ea0ab008a4fb26130a20882cb9344d682ab32f 100644 --- a/testing/integration-tests/search-test-core/src/main/resources/features/querybycursor/singlecluster/QueryByCursor.feature +++ b/testing/integration-tests/search-test-core/src/main/resources/features/querybycursor/singlecluster/QueryByCursor.feature @@ -87,3 +87,11 @@ Feature: Search recursively on cursor with different queries | "tenant1:search<timestamp>:*:*" | None | {"field":["data.OriginalOperator"],"order":["ASC"]} | "tenant1:search<timestamp>:1" | "tenant1:search<timestamp>:2.0.0:3" | | "tenant1:search<timestamp>:*:*" | None | {"field":["id"],"order":["DESC"]} | "tenant1:search<timestamp>:3" | "tenant1:search<timestamp>:1" | | "tenant1:search<timestamp>:*:*" | None | {"field":["namespace","data.Rank"],"order":["ASC","DESC"]} | "tenant1:search<timestamp>:3" | "tenant1:search<timestamp>:2.0.0:1" | + + @default + Scenario Outline: Verify that the query with cursor functions correctly when there is no result + When I send <query> with <kind> + Then I should get in response <final_count> records + Examples: + | kind | query | final_count | + | "tenant1:not-existing-kind<timestamp>:*:*" | None | 0 |