Skip to content

1273 get thumbnail attechment shell - #198

Open
mm-omdi wants to merge 74 commits into
developfrom
1273-get-thumbnail-attechment-shell
Open

1273 get thumbnail attechment shell#198
mm-omdi wants to merge 74 commits into
developfrom
1273-get-thumbnail-attechment-shell

Conversation

@mm-omdi

@mm-omdi mm-omdi commented Aug 7, 2026

Copy link
Copy Markdown

This pull request introduces and tests the new "Get Thumbnail By Id" API endpoint for the AAS Repository, which allows clients to retrieve the thumbnail image for a given Asset Administration Shell (AAS) by its identifier. The changes include the addition of example API requests, new unit and integration tests, and necessary dependency injections to support streaming thumbnail files.

Key changes include:

API Additions

  • Added three example request files (Get Thumbnail By Id.bru) for different products in the API collection, demonstrating how to call the new thumbnail endpoint with various AAS identifiers. [1] [2] [3]

Integration and Unit Testing

  • Added comprehensive integration tests in AasRepositoryControllerTests.cs to verify:
    • Successful retrieval of a thumbnail as a stream with correct content type and bytes.
    • Proper handling of missing thumbnails (returns 404).
  • Added unit tests in AasRepositoryControllerTests.cs, AasRepositoryHandlerTests.cs, and AasRepositoryServiceTests.cs to ensure:
    • The handler and service correctly return file streams or throw exceptions as appropriate.
    • The service supports HTTP-based thumbnails and throws for unsupported schemes. [1] [2] [3]

Dependency Injection and Mocks

  • Injected and mocked IFileAttachmentStreamProvider in test setups to support streaming thumbnail files in tests. [1] [2] [3] [4]
  • Updated handler and service constructors to accept additional dependencies, such as IHttpContextAccessor and configuration options for file attachment size. [1] [2]

Minor Improvements

  • Added necessary using statements for new dependencies and fixed file headers. [1] [2] [3] [4] [5]

These changes ensure the new thumbnail retrieval endpoint is robustly covered by tests and ready for integration.

mm-kgi and others added 30 commits July 2, 2026 09:43
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Refactor the return statement in `SubmodelRepositoryService.cs` to use the C# 8.0 range operator for improved collection handling.

Add comprehensive unit tests in `GetAllSubmodelsControllerTests.cs` to cover various scenarios for the `GetAllSubmodelsAsync` method, including handling of query parameters, paging, and exception cases. Utilize `NSubstitute` for mocking and `Xunit` for test structuring.
…th semaphore and add configuration for concurrent operations limit
Introduce `_templateManagementOptions` in `SubmodelRepositoryServiceTests` to configure `TemplateManagementConfig` with a `ServiceInstance` and `ConcurrentOperationsLimit`. Update the constructor of `SubmodelRepositoryService` to include the new parameter. Add necessary using directives for configuration and options handling.
…tAllSubmodelsAsync functionality and improve request handling
…SubmodelTemplateAsync for improved query handling
…cluding adjustments to semaphore release and data structure initialization.
mm-omdi and others added 22 commits August 3, 2026 11:59
…ginServices for better dependency management; add FileSizeExceededException and InvalidFileUrlException for improved error handling; update appsettings.json to configure max file attachment size.
…ttachmentAsync method; improve null handling for submodel ID; enhance file size validation logic in SubmodelRepositoryService; adjust HTTP client configuration for plugins.
…load endpoint; improve response descriptions; correct max file attachment size in configuration files.
- Implemented tests for FileAttachmentStreamProvider to verify response headers and content stream reading.
- Added tests for MaxLengthStream to ensure it correctly enforces maximum byte limits and throws exceptions when exceeded.
- Refactored SubmodelRepositoryHandler to streamline file attachment retrieval logic.
- Updated FileSizeExceededException and InvalidFileUrlException to simplify constructors and messages.
- Introduced MaxLengthStream class to limit stream reading to a specified byte size.
- Modified SubmodelRepositoryService to enhance file URL validation and response handling.
- Updated JSON test data to remove Google Docs viewer URLs in favor of direct file URLs.
- Adjusted SQL load script to reflect changes in document URL handling.
… invalid file element types and empty file URLs.
…treamline thumbnail retrieval and validation
…erface and FileContentProvider class; update SubmodelRepositoryService to use new provider; add unit tests for MaxLengthStream and FileContentProvider.
…r; update exception classes by removing unnecessary comments and whitespace.
…mResult, FileAttachmentResult, and FileContentResponse classes; refactor SubmodelRepositoryService and related components; update exception handling for file size limits; remove obsolete exceptions.
…ControllerTests and SubmodelRepositoryHandlerTests to use new FileContentResponse and LimitedFileStreamResult; adjust assertions and exception handling for improved clarity and accuracy.
…od to return FileStreamResult instead of LimitedFileStreamResult; modify related unit tests for consistency and clarity.
Renamed FileStreamResult to FileContentStreamResult and updated all references, including controller logic and tests, to ensure consistent handling of file attachments with the new result type.
…SuccessStatusCode with explicit check for success status and throw InternalDataProcessingException on failure.
Replaces direct HTTP streaming with IFileContentProvider and FileAttachmentResult abstractions. Controller now uses FileContentStreamResult with OpenTelemetry tracing. Improves error handling for invalid URLs and removes obsolete code and dependencies. Updates usings for consistency.
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

mm-omdi added 4 commits August 7, 2026 12:29
…ovider with IFileContentProvider and update related methods
…viders with Shared.Providers and update related services
…ean up file content provider by removing unused content type variable
…sts: update expected content type to application/octet-stream and streamline file content retrieval
@sonarqubecloud

sonarqubecloud Bot commented Aug 7, 2026

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

Test & Coverage Report

Test Results Summary

Metric Count
✅ Passed 1599
❌ Failed 0
⏭️ Skipped 0

View Detailed Test Results


Code Coverage

Unit Tests Coverage

Package Line Rate Branch Rate Complexity Health
AAS.TwinEngine.DataEngine 91% 78% 2234
Summary 91% (3602 / 3955) 78% (1472 / 1893) 2234

Minimum allowed line rate is 80%

Module Tests Coverage

Package Line Rate Branch Rate Complexity Health
AAS.TwinEngine.DataEngine 61% 43% 2234
Summary 61% (2406 / 3955) 43% (806 / 1893) 2234

@mm-omdi
mm-omdi marked this pull request as ready for review August 7, 2026 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants