Each decorator now bundles its schema prereqs alongside its code via DecoratorPrereq (additive CREATE-IF-NOT-EXISTS) and ReshapeStep (non-idempotent reshape gated on a detectSql probe). applyDecoratorMigrations<Decorators...>(table, probe, exec, recorder) walks the listed decorators at startup, runs every PREREQ, runs every reshape step whose probe returns false. Database-agnostic — consumer wires probe/exec to their DbClient. SCHEMA_MIGRATIONS_TABLE_SQL is provided for observability; the detect-probe is the source of truth. TemporalRepository ships add_valid_from / add_valid_until / drop_unique_entity_id / composite_unique (UNIQUE(entity_id, valid_until) so close-then-insert can run in a deferred-FK transaction). AuditLogRepository ships the audit_log CREATE TABLE. ScopeGuardRepository ships nothing — exposes empty PREREQ + zero-length RESHAPE_STEPS so it can be listed in applyDecoratorMigrations alongside the schema-touching decorators without SFINAE. Closes #12 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
47 lines
2.4 KiB
CMake
47 lines
2.4 KiB
CMake
# Minimal test harness for oatpp-authkit.
|
|
#
|
|
# Adds plain executable tests linked against the INTERFACE library and oatpp.
|
|
# No third-party test framework — assertions use <cassert> and a tiny REQUIRE
|
|
# macro so the suite stays portable and dependency-free.
|
|
|
|
find_package(oatpp REQUIRED)
|
|
|
|
add_executable(test_negotiation test_negotiation.cpp)
|
|
target_link_libraries(test_negotiation PRIVATE oatpp::authkit oatpp::oatpp)
|
|
add_test(NAME negotiation COMMAND test_negotiation)
|
|
|
|
add_executable(test_body_size_limit test_body_size_limit.cpp)
|
|
target_link_libraries(test_body_size_limit PRIVATE oatpp::authkit oatpp::oatpp)
|
|
add_test(NAME body_size_limit COMMAND test_body_size_limit)
|
|
|
|
add_executable(test_security_headers test_security_headers.cpp)
|
|
target_link_libraries(test_security_headers PRIVATE oatpp::authkit oatpp::oatpp)
|
|
add_test(NAME security_headers COMMAND test_security_headers)
|
|
|
|
add_executable(test_json_serialization test_json_serialization.cpp)
|
|
target_link_libraries(test_json_serialization PRIVATE oatpp::authkit oatpp::oatpp)
|
|
add_test(NAME json_serialization COMMAND test_json_serialization)
|
|
|
|
add_executable(test_repository_interface test_repository_interface.cpp)
|
|
target_link_libraries(test_repository_interface PRIVATE oatpp::authkit oatpp::oatpp)
|
|
add_test(NAME repository_interface COMMAND test_repository_interface)
|
|
|
|
add_executable(test_repository_decorators test_repository_decorators.cpp)
|
|
target_link_libraries(test_repository_decorators PRIVATE oatpp::authkit oatpp::oatpp)
|
|
add_test(NAME repository_decorators COMMAND test_repository_decorators)
|
|
|
|
add_executable(test_queryable test_queryable.cpp)
|
|
target_link_libraries(test_queryable PRIVATE oatpp::authkit oatpp::oatpp)
|
|
add_test(NAME queryable COMMAND test_queryable)
|
|
|
|
add_executable(test_temporal_field_traits test_temporal_field_traits.cpp)
|
|
target_link_libraries(test_temporal_field_traits PRIVATE oatpp::authkit oatpp::oatpp)
|
|
add_test(NAME temporal_field_traits COMMAND test_temporal_field_traits)
|
|
|
|
add_executable(test_audit_log_repository test_audit_log_repository.cpp)
|
|
target_link_libraries(test_audit_log_repository PRIVATE oatpp::authkit oatpp::oatpp)
|
|
add_test(NAME audit_log_repository COMMAND test_audit_log_repository)
|
|
|
|
add_executable(test_decorator_migrations test_decorator_migrations.cpp)
|
|
target_link_libraries(test_decorator_migrations PRIVATE oatpp::authkit oatpp::oatpp)
|
|
add_test(NAME decorator_migrations COMMAND test_decorator_migrations)
|