Skip to content

test(rest): add ArchUnit tests for SW360 #4046

Open
bibhuti230185 wants to merge 1 commit intoeclipse-sw360:mainfrom
siemens:test/add-archunit-tests-rest
Open

test(rest): add ArchUnit tests for SW360 #4046
bibhuti230185 wants to merge 1 commit intoeclipse-sw360:mainfrom
siemens:test/add-archunit-tests-rest

Conversation

@bibhuti230185
Copy link
Copy Markdown
Contributor

@bibhuti230185 bibhuti230185 commented Apr 7, 2026

Summary

Add comprehensive ArchUnit architecture tests for the SW360 REST resource-server module. These tests enforce architectural patterns, coding standards, and best practices as defined in the SW360 backend instructions.

51 architecture rules across 12 test suites validate:

Test Suite Tests Purpose
Controller Annotation Rules 6 Validates REST controller annotations
Controller-Service Relationship Rules 3 Ensures proper controller-service patterns
Dependency Injection Rules 2 Enforces constructor injection over field injection
Layer Dependency Rules 3 Maintains layer separation
Logging Standard Rules 5 Enforces Log4j2 logging standards
Naming Convention Rules 5 Validates class naming patterns
OpenAPI Documentation Rules 2 Ensures OpenAPI documentation annotations
Package Structure Rules 5 Enforces package organization
Security Annotation Rules 4 Validates security annotations
Spring Framework Rules 7 Enforces Spring best practices
Thrift Service Boundary Rules 3 Prevents bypassing Thrift services
Coding Standard Rules 6 General coding standards

New Dependencies

  • com.tngtech.archunit:archunit-junit5 (test scope) — added to rest/resource-server/pom.xml
  • ArchUnit BOM 1.4.0 managed in root pom.xml

AI Disclosure

This code was generated with assistance from GitHub Copilot (Claude, Anthropic).

Suggest Reviewer

@GMishx

How To Test?

Run the ArchUnit test suite:

# Run all architecture tests
mvn test -pl rest/resource-server -Dtest="*RulesTest"

# Run a specific test suite
mvn test -pl rest/resource-server -Dtest="ControllerAnnotationRulesTest"

All 51 tests should pass. Any architectural violation will produce a descriptive failure message pointing to the offending class and method.

Checklist

Must:

  • All related issues are referenced in commit messages and in PR
  • Code is AI-generated — tool: GitHub Copilot, model: Claude (Anthropic)

@GMishx GMishx added needs code review needs general test This is general testing, meaning that there is no org specific issue to check for labels Apr 7, 2026
@GMishx GMishx self-assigned this Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs code review needs general test This is general testing, meaning that there is no org specific issue to check for

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants