Date: 2025-12-17 Status: Test Stubs Created, Implementation Pending
This document tracks test case implementation for Architecture Decision Records.
| ADR | Test Cases Specified | Test Classes Created | Implementation Status |
|---|---|---|---|
| ADR-001: Transaction Isolation | ✅ Yes | ✅ TransactionIsolationTest | |
| ADR-002: SQL Injection Prevention | ✅ Yes | ✅ SQLInjectionPreventionTest | |
| ADR-003: Slovak Text Search | ✅ Yes | ✅ SlovakLanguageSearchTest | |
| ADR-006: Multi-Tenant Integrity | ✅ Yes | ✅ MultiTenantIntegrityTest |
Test File: com.cloudempiere.searchindex.test/src/.../integration/TransactionIsolationTest.java
| Test Method | Type | ADR Reference | Status |
|---|---|---|---|
testTransactionIsolation() |
Unit | Lines 217 | |
testRollbackScenario() |
Unit | Lines 218 | |
testErrorHandling_IndexFailureDoesntBlockPO() |
Unit | Lines 219 | |
testPOSaveSuccess_AndIndexUpdateSuccess() |
Integration | Lines 221 | |
testPOSaveSuccess_ButIndexUpdateFailure() |
Integration | Lines 222 | |
testPOSaveFailure_IndexUpdateNotTriggered() |
Integration | Lines 223 | |
testConcurrentPOChanges_NoDeadlocks() |
Stress | Lines 225-228 |
- Unit Tests: 3/3 stub created
- Integration Tests: 3/3 stub created
- Stress Tests: 1/1 stub created
- Total Coverage: 7/7 test cases specified in ADR
Test File: com.cloudempiere.searchindex.test/src/.../unit/SQLInjectionPreventionTest.java
| Test Method | Type | ADR Reference | Status |
|---|---|---|---|
testSQLInjection_DropTable_ShouldFail() |
Unit | Phase 1, Lines 278-284 | |
testSQLInjection_UnionAttack_ShouldFail() |
Unit | Validation, Line 354 | |
testSQLInjection_DeleteAttack_ShouldFail() |
Unit | Validation, Line 355 | |
testSQLInjection_CommentInjection_ShouldFail() |
Unit | Validation, Lines 362-363 | |
testSQLInjection_MultipleStatements_ShouldFail() |
Unit | Validation, Line 122 | |
testValidWhereClause_ShouldPass() |
Unit | Phase 1, Lines 286-291 | |
testValidWhereClause_WithLike_ShouldPass() |
Unit | Validation, Line 370 | |
testValidWhereClause_WithIn_ShouldPass() |
Unit | Validation, Line 371 | |
testTableNameValidation_ValidTable_ShouldPass() |
Unit | Layer 2, Lines 155-173 | |
testTableNameValidation_InvalidTable_ShouldFail() |
Unit | Layer 2 | |
testTableNameValidation_InjectionAttempt_ShouldFail() |
Unit | Validation, Lines 357-359 | |
testColumnNameValidation_ValidColumn_ShouldPass() |
Unit | Layer 2, Lines 177-192 | |
testColumnNameValidation_InvalidColumn_ShouldFail() |
Unit | Layer 2 |
- SQL Injection Blocking: 5/5 test cases
- Valid Input Acceptance: 3/3 test cases
- Whitelist Validation: 5/5 test cases
- Total Coverage: 13/13 test cases specified in ADR
These tests require implementation of:
SearchIndexSecurityValidatorclass (ADR-002 Phase 1)validateWhereClause(String)methodvalidateTableName(String, String)methodvalidateColumnName(String, String, String)method
Test File: com.cloudempiere.searchindex.test/src/.../integration/SlovakLanguageSearchTest.java
| Test Method | Type | ADR Reference | Status |
|---|---|---|---|
testSlovakSearchQuality_ExactVsUnaccented() |
Integration | Lines 188-197 | |
testSlovakDiacritics_AllVariants() |
Integration | Lines 18-20 | |
testSlovakVsCzech_Differentiation() |
Integration | Lines 94-96 | |
testPerformanceBenchmark_TSRankVsPosition() |
Performance | Lines 181-186 | |
testScalability_100KRows() |
Performance | Lines 50, 154 | |
testCzechLanguage_DiacriticHandling() |
Integration | Phase 4, Line 327 | |
testPolishLanguage_DiacriticHandling() |
Integration | Phase 4, Line 327 | |
testHungarianLanguage_DiacriticHandling() |
Integration | Phase 4, Line 327 | |
testMultiWeightTsvector_Structure() |
Unit | Lines 118-133, 262-276 | |
testGINIndexUsage_ExplainAnalyze() |
Integration | Phase 3, Line 322 | |
testRegression_ExistingSearchesContinueWorking() |
Regression | Phase 4, Line 328 | |
testSlovakStopWords_Optional() |
Integration | Phase 1, Line 310 | |
testWeightArray_RankingPreferences() |
Unit | Line 141 | |
testIndexSize_AcceptableIncrease() |
Performance | Risks, Line 360 | |
testLanguageDetection_SlovakClient() |
Unit | Phase 2, Line 313 | |
testLanguageDetection_FallbackToEnglish() |
Unit | Phase 2 | |
testSlovakSearch_SpecialCharacters() |
Integration | ADR Context |
- Slovak Language Quality: 3/3 test cases (exact vs unaccented, all diacritics, Slovak vs Czech)
- Performance Benchmarks: 3/3 test cases (TS_RANK vs POSITION, scalability, index size)
- Multi-Language Support: 3/3 test cases (Czech, Polish, Hungarian)
- Technical Validation: 5/5 test cases (tsvector structure, GIN index, weights, language detection)
- Regression: 1/1 test case (existing searches)
- Optional Features: 2/2 test cases (stop words, special characters)
- Total Coverage: 17/17 test cases specified in ADR
These tests require:
- Slovak text search configuration:
sk_unaccent(ADR-003 Phase 1) - Database migration:
build_slovak_tsvector()function - Code changes in
PGTextSearchIndexProvider.java(Lines 94-95, 426-454, 657-669) - Test dataset with Slovak/Czech/Polish/Hungarian product names
- GIN index on
idx_tsvectorcolumn
- Performance: <100ms for 100,000 rows (vs current 50s timeout)
- Scalability: O(log n) using GIN index (vs current O(n × 6t))
- Quality: Exact diacritic matches rank higher than unaccented
- Languages: Support Slovak (sk_SK), Czech (cs_CZ), Polish (pl_PL), Hungarian (hu_HU)
Test File: com.cloudempiere.searchindex.test/src/.../integration/MultiTenantIntegrityTest.java
| Test Method | Type | ADR Reference | Status |
|---|---|---|---|
testMultiTenantIsolation() |
Integration | Lines 288-306 | |
testUniqueConstraintEnforced() |
Integration | Lines 308-318 | |
testMultiClientSearch() |
Integration | Lines 320-351 | |
testUniqueIndexStructure() |
Integration | Lines 475-485 | |
testCrossClientDataLeakage() |
Integration | ADR Context | |
testIndexUpdateIsolation() |
Integration | Phase 4, Lines 260-273 | |
testOriginalBug_ClientBOverwritesClientA() |
Regression | Lines 32-53 |
- Core Isolation Tests: 3/3 test cases
- Regression Tests: 1/1 test case (original bug)
- Additional Validation: 3/3 test cases
- Total Coverage: 7/7 test cases specified in ADR
These tests require:
- Database migration applied (ADR-006 Phase 2)
- UNIQUE constraint:
(ad_client_id, ad_table_id, record_id) - Code fix in
PGTextSearchIndexProvider.java:115
-
ADR-002: SQL Injection Prevention (Highest Priority)
- Implement
SearchIndexSecurityValidator - Implement all 13 test cases
- Run security scan validation
- Implement
-
ADR-006: Multi-Tenant Integrity (Critical)
- Apply database migration
- Implement all 7 test cases
- Run integrity validation
- ADR-001: Transaction Isolation (High Priority)
- Refactor
SearchIndexEventHandler - Implement all 7 test cases
- Run stress tests
- Refactor
# From test fragment directory
cd com.cloudempiere.searchindex.test
# Run all tests
mvn clean test
# Run specific ADR tests
mvn test -Dtest=TransactionIsolationTest
mvn test -Dtest=SQLInjectionPreventionTest
mvn test -Dtest=MultiTenantIntegrityTest- Right-click test class → Run As → JUnit Plug-in Test
- Or use launch config: Run → com.cloudempiere.searchindex.test
- Test framework setup (fragment plugin architecture)
- Test stub classes created for all ADRs
- Test cases documented from ADR specifications
- SearchIndexSecurityValidator implementation (ADR-002)
- Database migration script (ADR-006)
- Event handler refactoring (ADR-001)
- Actual test implementation (all 27 test methods)
| ADR | Test Cases | Implemented | Coverage |
|---|---|---|---|
| ADR-001 | 7 | 0 | 0% |
| ADR-002 | 13 | 0 | 0% |
| ADR-006 | 7 | 0 | 0% |
| Total | 27 | 0 | 0% |
Target: 100% test coverage for all critical ADRs before production deployment
-
Implement ADR-002 (SQL Injection Prevention)
- Create
SearchIndexSecurityValidatorclass - Implement validation methods
- Complete all 13 test cases
- Run security scan
- Create
-
Implement ADR-006 (Multi-Tenant Integrity)
- Apply database migration
- Fix
PGTextSearchIndexProvider.java - Complete all 7 test cases
- Run data integrity checks
-
Implement ADR-001 (Transaction Isolation)
- Refactor
SearchIndexEventHandler - Complete all 7 test cases
- Run stress tests (100+ concurrent operations)
- Refactor
-
Continuous Integration
- Add ADR tests to CI/CD pipeline
- Enforce 100% pass rate before merge
- Monitor test execution time
- ADR-001:
docs/adr/adr-001-transaction-isolation.md - ADR-002:
docs/adr/adr-002-sql-injection-prevention.md - ADR-006:
docs/adr/adr-006-multi-tenant-integrity.md - Test Framework:
CLAUDE.md(Development Standards)
Last Updated: 2025-12-17 Reviewed By: [Pending]