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

context source implementation for query entities #1282

Merged
merged 11 commits into from
Dec 18, 2024

Conversation

thomasBousselin
Copy link
Contributor

No description provided.

@github-actions github-actions bot added the feature New feature or request label Dec 12, 2024
Comment on lines +13 to +14
<ID>LongMethod:EntityHandler.kt$EntityHandler$@GetMapping("/{entityId}", produces = [APPLICATION_JSON_VALUE, JSON_LD_CONTENT_TYPE, GEO_JSON_CONTENT_TYPE]) suspend fun getByURI( @RequestHeader httpHeaders: HttpHeaders, @PathVariable entityId: URI, @AllowedParameters( implemented = [ QP.OPTIONS, QP.TYPE, QP.ATTRS, QP.GEOMETRY_PROPERTY, QP.LANG, QP.CONTAINED_BY, QP.JOIN, QP.JOIN_LEVEL, QP.DATASET_ID, ], notImplemented = [QP.FORMAT, QP.PICK, QP.OMIT, QP.ENTITY_MAP, QP.LOCAL, QP.VIA] ) @RequestParam queryParams: MultiValueMap&lt;String, String&gt; ): ResponseEntity&lt;*&gt;</ID>
<ID>LongMethod:EntityHandler.kt$EntityHandler$@GetMapping(produces = [APPLICATION_JSON_VALUE, JSON_LD_CONTENT_TYPE, GEO_JSON_CONTENT_TYPE]) suspend fun getEntities( @RequestHeader httpHeaders: HttpHeaders, @AllowedParameters( implemented = [ QP.OPTIONS, QP.COUNT, QP.OFFSET, QP.LIMIT, QP.ID, QP.TYPE, QP.ID_PATTERN, QP.ATTRS, QP.Q, QP.GEOMETRY, QP.GEOREL, QP.COORDINATES, QP.GEOPROPERTY, QP.GEOMETRY_PROPERTY, QP.LANG, QP.SCOPEQ, QP.CONTAINED_BY, QP.JOIN, QP.JOIN_LEVEL, QP.DATASET_ID, ], notImplemented = [QP.FORMAT, QP.PICK, QP.OMIT, QP.EXPAND_VALUES, QP.CSF, QP.ENTITY_MAP, QP.LOCAL, QP.VIA] ) @RequestParam queryParams: MultiValueMap&lt;String, String&gt; ): ResponseEntity&lt;*&gt;</ID>
Copy link
Contributor Author

@thomasBousselin thomasBousselin Dec 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solution for this is to put csr related calculation into its own layer.
Should i do it in this PR?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it will also be cleaner, the handlers are getting hard to read with all the CSR stuff in them.

preferably in another PR (just after this one is merged)

Copy link
Contributor

github-actions bot commented Dec 12, 2024

Test Results

   69 files  ± 0     69 suites  ±0   1m 20s ⏱️ -11s
1 109 tests +10  1 109 ✅ +10  0 💤 ±0  0 ❌ ±0 
1 148 runs  +10  1 148 ✅ +10  0 💤 ±0  0 ❌ ±0 

Results for commit 9ab1be9. ± Comparison against base commit 22a8d72.

This pull request removes 191 and adds 45 tests. Note that renamed tests count towards both.
                                    { "id":…, withTemporalValues=true, withAudit=false, expectation={
                      "@id": "https://uri…
                      "@type": "@json",
                      …
                    "@value": "/A/B"
                    "@value": "/C/D"
                    "@value": 20
                    "…
                    {
                  "@type": "https://uri.etsi.org/ngsi-ld/DateTime",
…
com.egm.stellio.search.csr.service.ContextSourceCallerTests ‑ queryContextSourceEntities should return a RevalidationFailedWarning when receiving bad payload()
com.egm.stellio.search.csr.service.ContextSourceCallerTests ‑ queryContextSourceEntities should return the count and the entities when the request succeed()
com.egm.stellio.search.csr.service.ContextSourceCallerTests ‑ retrieveContextSourceEntity should return a RevalidationFailedWarning when receiving bad payload()
com.egm.stellio.search.csr.service.ContextSourceCallerTests ‑ retrieveContextSourceEntity should return the entity when the request succeeds()
com.egm.stellio.search.csr.service.ContextSourceRegistrationServiceTests ‑ query on CSR entity idPattern should filter the result()
com.egm.stellio.search.csr.service.ContextSourceRegistrationServiceTests ‑ query on CSR entity types should filter the result()
com.egm.stellio.search.csr.service.ContextSourceUtilsTests ‑ merge entitiesList should add entities with the different ids()
com.egm.stellio.search.csr.service.ContextSourceUtilsTests ‑ merge entitiesList should merge entities with the same id()
com.egm.stellio.search.csr.service.ContextSourceUtilsTests ‑ merge entitiesList should merge using getMergeNewValues and return the received warnings()
com.egm.stellio.search.csr.service.ContextSourceUtilsTests ‑ merge entitiesList should not keep conflicting data from an auxiliary csr()
…

♻️ This comment has been updated with latest results.

@thomasBousselin thomasBousselin marked this pull request as ready for review December 13, 2024 16:29
@bobeal
Copy link
Member

bobeal commented Dec 15, 2024

  • take care of the name of the PR (will be used by default when merging)
  • add missing labels on the PR
  • link it to an issue (create one if it does not exist yet)

@thomasBousselin thomasBousselin changed the title Feature/context source for query entities context source implementation for query entities Dec 16, 2024
@thomasBousselin thomasBousselin linked an issue Dec 16, 2024 that may be closed by this pull request
@thomasBousselin thomasBousselin self-assigned this Dec 16, 2024
@@ -49,22 +105,23 @@ object ContextSourceCaller {
.path(uri.path)
.queryParams(queryParams)
.build()
}.headers { newHeaders ->
httpHeaders.getOrNone(HttpHeaders.LINK).onSome { link -> newHeaders[HttpHeaders.LINK] = link }
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand this change

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous implementation was sending the Link header to the contextSource even if it received a null.
This implementation prevent this.

@thomasBousselin thomasBousselin force-pushed the feature/context-source-for-query-entities branch from c50ee39 to 7d4294a Compare December 17, 2024 17:22
@bobeal bobeal added the csr Relates to context sources (registrations) API label Dec 18, 2024
@bobeal bobeal linked an issue Dec 18, 2024 that may be closed by this pull request
@thomasBousselin thomasBousselin force-pushed the feature/context-source-for-query-entities branch from 7d4294a to 9ab1be9 Compare December 18, 2024 09:07
@thomasBousselin thomasBousselin merged commit 54678fd into develop Dec 18, 2024
11 checks passed
@thomasBousselin thomasBousselin deleted the feature/context-source-for-query-entities branch December 18, 2024 12:37
@github-actions github-actions bot locked and limited conversation to collaborators Dec 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
csr Relates to context sources (registrations) API feature New feature or request ngsild-1.6.1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for Query Entities distributed operation
3 participants