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

Adding a context source layer #1308

Closed
wants to merge 3 commits into from

Conversation

thomasBousselin
Copy link
Contributor

No description provided.

import java.net.URI

@Service
class EntityCompactionService(
Copy link
Contributor Author

@thomasBousselin thomasBousselin Jan 8, 2025

Choose a reason for hiding this comment

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

I choose "compaction" name for the layer and for the class name, because i can't just take the logic from the context sources i also have to do the task associated with the compaction.

I am open to other name suggestion.

Copy link
Member

Choose a reason for hiding this comment

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

Compaction, definitely not. Compaction is JSON-LD compaction, nothing else.

That being said, I think you have extracted too much and the responsibilities become unclear (and too wide).

Instead, I would say that the web handler:

  • call a service that will match the CSR, call ContextSourceCaller to get the remote entities and return the result with the warning, the entities, ...
  • call entityQueryService to get the local entities
  • call ContextSourceUtils to merge the entities

Comment on lines +17 to +21
// // DO NOT REVIEW WIP
// // DO NOT REVIEW WIP
// // DO NOT REVIEW WIP
// // DO NOT REVIEW WIP
// // DO NOT REVIEW WIP
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comming soon 😃 ...

}
""".trimIndent()
)
}

@Test
fun `get entity by id should correctly filter the asked attributes`() = runTest {
Copy link
Contributor Author

@thomasBousselin thomasBousselin Jan 8, 2025

Choose a reason for hiding this comment

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

This test will be migrated in entityCompactionServiceTest.

@@ -480,342 +422,47 @@ class EntityHandlerTests {
)
}

@Test
fun `get entity by id should return 404 if the entity has none of the requested attributes`() {
Copy link
Contributor Author

@thomasBousselin thomasBousselin Jan 8, 2025

Choose a reason for hiding this comment

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

This test will be migrated in entityCompactionServiceTest.

.jsonPath("$.createdAt").doesNotExist()
.jsonPath("$.modifiedAt").doesNotExist()
}

@Test
fun `get entity by id should correctly serialize properties of type DateTime and display sysAttrs asked`() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am still looking if this test make sense in entityCompactionServiceTest.

}

@Test
fun `get entity by id should correctly serialize multi-attribute property having more than one instance`() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am still looking if this test make sense in entityCompactionServiceTest.

}

@Test
fun `get entity by id should correctly serialize multi-attribute relationship having one instance`() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am still looking if this test make sense in entityCompactionServiceTest.

}

@Test
fun `get entity by id should correctly serialize multi-attribute relationship having more than one instance`() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am still looking if this test make sense in entityCompactionServiceTest.


@Test
fun `get entity by id should return the warnings sent by the CSRs and update the CSRs statuses`() {
Copy link
Contributor Author

@thomasBousselin thomasBousselin Jan 8, 2025

Choose a reason for hiding this comment

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

This test will be migrated in entityCompactionServiceTest.

@@ -1258,42 +820,31 @@ class EntityHandlerTests {
}

@Test
fun `get entities should return the warnings sent by the CSRs and update the CSRs statuses`() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This test will be migrated in entityCompactionServiceTest.

@thomasBousselin thomasBousselin force-pushed the refacto/context-source-layer branch from 8b6d74b to e6fdb2c Compare January 8, 2025 15:36
Copy link
Contributor

github-actions bot commented Jan 8, 2025

Test Results

1 files   -    69  1 suites   - 69   0s ⏱️ - 1m 24s
1 tests  - 1 137  1 ✅  - 1 137  0 💤 ±0  0 ❌ ±0 
1 runs   - 1 176  1 ✅  - 1 176  0 💤 ±0  0 ❌ ±0 

Results for commit 92c2d73. ± Comparison against base commit e88ba43.

This pull request removes 1291 tests.
                           …, 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",
…

♻️ This comment has been updated with latest results.

@github-actions github-actions bot locked and limited conversation to collaborators Jan 9, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants