Commit Graph

44 Commits

Author SHA1 Message Date
Oliver Drotbohm
8ea1b1f8e6 GH-611 - Additional modulith packages are now considered for application classes. 2024-05-20 20:03:32 +02:00
Oliver Drotbohm
f8f6e0212a GH-465 - Update copyright headers. 2024-01-17 19:48:17 +01:00
Oliver Drotbohm
dd9efef067 GH-455 - Guard against AutoConfiguration- and EntityScanPackages bean definitions not having any constructor argument defined. 2024-01-16 19:57:34 +01:00
Oliver Drotbohm
f7e508682a GH-430 - Avoid duplicate inclusions of modules in test executions. 2023-12-21 22:24:10 +01:00
Oliver Drotbohm
a7b4f77495 GH-360 - Fix potential UnsupportedOperationException in test bootstrap.
See GH-345 and GH-356 for details.
2023-11-03 20:37:07 +01:00
Oliver Drotbohm
f93bb39648 GH-327 - Move off of Google's Suppliers.memoize(…). 2023-10-16 08:38:43 +02:00
Oliver Drotbohm
941394f2d5 GH-273 - Remove experimental declaration from Scenario. 2023-08-17 17:35:09 +02:00
Oliver Drotbohm
3055212e4b GH-253 - Let @ApplicationModuleTest be meta-annotated with @SpringBootTest.
@ApplicationModuleTest is now meta-annotated with @SpringBootTest. This allows us to remove a couple of declarations that we actually had copied from it (such as the TestContextBootstrapper, the SpringExtension etc.)

The presence of the original annotation allow test-related auto-configuration to inspect @SprignBootTest for particular configuration. For example, we now alias the WebEnvironment to make it configurable for the test execution.
2023-08-03 09:46:42 +02:00
Oliver Drotbohm
5dfffa2244 GH-216 - Forward an ApplicationContext's ExecutorService to Scenario instances by default.
We now register a default customizer on the Scenario instances created to pick up an ExecutorService defined in the ApplicationContext so that customizations made to that are considered in the test execution.
2023-06-23 12:49:06 +02:00
Oliver Drotbohm
516c48dc07 GH-208 - Switch to CopyOnWriteArrayList for DefaultPublishedEvents. 2023-06-23 12:49:06 +02:00
Oliver Drotbohm
6dabfb425b GH-191 - Prevent premature access of ApplicationContext from ParameterResolver implementations.
We now avoid accessing the ApplicationContext from a BeforeAllCallback as this might cause the context initialization before other extensions had time to kick in.
2023-04-30 22:35:14 +02:00
Oliver Drotbohm
0b6dccf334 GH-190 - Introduce @EnableScenarios.
The dedicated annotation allows using Scenario as test parameter in @SpringBootTest-based integration tests, too.

ScenarioParameterResolver now throws a better error message if a TransactionTemplate bean is missing from the ApplicationContext.
2023-04-30 22:35:14 +02:00
Oliver Drotbohm
bb800ba046 GH-185 - Additional simplification of delayed event verification on Scenarios. 2023-04-25 14:34:23 +02:00
Oliver Drotbohm
3a923519f2 GH-185 - Allow verification of events after method invocation stimulus. 2023-04-24 17:31:21 +02:00
Oliver Drotbohm
cd76c96250 GH-165 - Introduce ScenarioCustomizer extension.
We now provide a ScenarioCustomizer that can be used to prepare Scenario instances for test methods with a common customizer. This avoids the need to call ….customize(…) for all Scenarios declared in a test class with the same logic.
2023-04-20 14:15:10 +02:00
Oliver Drotbohm
6d2fdd6fdc GH-173 - Polishing.
@ApplicationModuleTest is now explicitly declared to only be usable on types, documented and inherited.
2023-03-27 17:56:12 +02:00
Oliver Drotbohm
822febd00e GH-173 - Support for @ApplicationModuleTest in JUnit 5 nested test classes.
We now use Spring Test Context's TestContextAnnotationUtils to lookup the @ApplicationModuleTest annotation to eventually bootstrap an ApplicationModules instance. That ensures that we find the annotation on JUnit 5's @Nested classes.
2023-03-27 17:56:04 +02:00
Oliver Drotbohm
ce264aaf96 GH-150 - Scenario now execute stimulus within new transaction.
To make sure that we trigger transactional event listeners from Scenario based integration tests, we trigger stimulus executions using transactions configured to require a new transaction. This makes sure that Scenarios work in integration tests using @Transactional, of course circumventing the default rollback behavior of those transactions. There's no other way to implement this as we *need* to commit a transaction to trigger the delivery of transaction-bound events.

Fixed a bug in the handling of Scenario.stimulus(Supplier<T>) as for this, the Supplier handed into the method had not been executed transactionally at all.
2023-02-26 20:26:53 +01:00
Oliver Drotbohm
1f6c888e28 GH-136 - Polish Javadoc. 2023-02-23 23:11:46 +01:00
Oliver Drotbohm
bb466f99e9 GH-136 - API polishing for Scenario.
Move the registration of cleanup callbacks to the intermediate When type to avoid overloads of Scenario.stimulate(…). Also, to prevent multiple lambda-style parameters for ….stimulate(…) as they don't distinguish nice on the declaration side. Removed the varargs from ….publish(…) methods and wait for the actual request to add support for preparing, in transaction callbacks (potentially to be introduced as ….prepare(…) method).

The default acceptance criteria for state change expectations now also considers a boolean true as concluding method result.
2023-02-23 22:14:20 +01:00
Oliver Drotbohm
707d27e335 GH-136 - Simple suppliers need to be executed transactionally in Scenario. 2023-02-20 20:03:09 +01:00
Oliver Drotbohm
52fdc221a1 GH-136 - Introduce Scenario as application module integration test API.
See the Javadoc of Scenario for details.
2023-02-20 16:04:10 +01:00
Oliver Drotbohm
71f928f5b0 GH-130 - Polishing.
Organized imports.
2023-02-03 11:09:07 +01:00
Oliver Drotbohm
6616aaaffa GH-116 - PublishedEvents now sees events from asynchronous event listeners as well.
The ApplicationListener we deploy to capture events published  during a test method execution now uses an InheritableThreadLocal so that events published on threads spawned from the main test execution thread also end up in the PublishedEvents instance prepared for the test method.

Also, the registration of that particular event listener avoids duplicate registrations by inspecting the application context in use for the test method execution for an already registered listener, falling back to registering one.
2023-01-13 16:13:34 +01:00
Oliver Drotbohm
5c34886907 GH-114 - Rename ….modulith.model to ….modulith.core. 2023-01-12 16:34:07 +01:00
Oliver Drotbohm
0d009f06c9 GH-111 - Package and publish Javadoc.
A lot of Javadoc polish. Not done yet.
2023-01-12 16:20:20 +01:00
Oliver Drotbohm
9ce6bf23ae GH-14 - Remove Lombok from production sources.
Polished a lot of Javadoc.
2023-01-12 01:05:35 +01:00
Oliver Drotbohm
30203ecca8 GH-104 - Polish log output for test execution.
Also added ApplicationModules.toString().
2023-01-05 10:21:42 +01:00
Oliver Drotbohm
a7e033172b GH-102 - ApplicationModules now allows traversing modules in topological order.
We now optionally integrate with the JGraphT library to calculate the topological order of modules based on their dependency structure. That order is then exposed in ApplicationModules' iteration and via ….getComparator().

Renamed FormattableJavaClass to FormattableType and allow it to be created from a plain Class as well.
2023-01-05 10:21:36 +01:00
Oliver Drotbohm
3b1bde5c36 GH-100 - Polishing. 2023-01-03 08:50:27 +01:00
Oliver Drotbohm
5d285e0e03 GH-100 - Introduce AssertablePublishedEvents.
In case AssertJ is on the classpath, test cases using the PublishedEventsExtension (for example, implicitly activated via @ApplicationModuleTest) can get an AssertablePublishedEvents injected into the method. In contrast to the original PublishedEvents, that one acts as AssertProvider so that it can be used in assertThat(…).… expressions to verify application events published.

Polished API in PublishedEvents for a more consistent experience.
2023-01-03 02:44:01 +01:00
Oliver Drotbohm
4e13fbf7f8 GH-99 - Extend license headers to 2023. 2023-01-02 18:12:29 +01:00
Oliver Drotbohm
c1fc3032b7 GH-87 - Expose module structure as actuator endpoint.
Introduce Spring Modulith Actuator module to expose the application module structure as Spring Boot actuator. This required a Spring Modulith Runtime module to be extracted from the Spring Modulith Observability one. The former now contains the auto-configured ApplicationRuntime and ApplicationModulesRuntime bean instances to be able to bootstrap a ApplicationModules asynchronously on application startup. The actuator module then contains a Spring Boot @Endpoint implementation consuming the ApplicationModules to render JSON describing the application module structure.
2022-12-23 10:56:47 +01:00
Oliver Drotbohm
02881539b6 GH-77 - Avoid exposing TestUtils to user applications.
Moved TestUtils from spring-modulith-test to spring-modulith-integration-test as it's only used there and doesn't need to be exposed to user applications.
2022-11-24 22:35:32 +01:00
Oliver Drotbohm
b402f00c77 GH-77 - Upgrade to Spring Boot 3.0.
Adapt to API changes in Micrometer and Spring Boot's test context loader API now exposing a checked ContextLoadException to signal failures during ApplicationContext bootstraps.
2022-11-24 22:31:49 +01:00
Oliver Drotbohm
55b16857f3 GH-69 - Switch to Stream.toList(). 2022-11-11 18:49:03 +01:00
Oliver Drotbohm
d96263fe30 GH-11, GH-66, GH-67, GH-68 - Improve module canvas.
Overhauled the module canvas in various ways. By default, we now skip "empty" rows. In other words, if we do not find any published events for example, we skip the entire row. CanvasOptions.revealEmptyRows() can be used to keep those empty rows around. We now also expose all value types and Spring bean references.

Refactored the dependency lookup APIs on ApplicationModule. Both DependencyType and DependencyDepth are now top-level types. Also, ApplicationModuleDependency and ApplicationModuleDependencies were introduced as explicit types. In the course of that, ApplicationModule.getDependencies(…) has got its return type changed from List<ApplicationModule> to ApplicationModuleDependencies. The internal ModuleDependency type has been renamed to QualifiedDependency.
2022-11-11 18:33:03 +01:00
Oliver Drotbohm
b9d46173f7 GH-56 - ModuleTestAutoConfiguration is now autoconfiguration of highest precedence.
Also, keep autoconfiguration packages as String array to avoid ClassCastExceptions when the bean definition's constructor arguments are inspected manually (like in AutoConfigurationPackages.addBasePackages(…).
2022-10-24 14:13:53 +02:00
Oliver Drotbohm
2430dc90e2 GH-46 - Bootstrap dependencies must only contain DependencyType.USES_COMPONENT. 2022-10-21 11:11:24 +02:00
Oliver Drotbohm
82c18fe509 GH-9 - Rename core, public abstractions from Module to ApplicationModule.
Remove obsolete @since tags and deprecations.
2022-07-19 15:34:44 +02:00
Oliver Drotbohm
8ba6c11e3d GH-1 - Consistent license years and HTTPS URLs. 2022-07-19 15:04:52 +02:00
Oliver Drotbohm
48ea08ae59 GH-1 - Consistent author names. 2022-07-19 15:02:00 +02:00
Oliver Drotbohm
b2425d024a GH-1 - Polishing.
Fix import order after package renames.
2022-07-08 09:35:55 +02:00
Björn Kieling
417e215993 GH-1 - Update Maven artifact coordinates, package and directory structure.
Original pull request: GH-7.
2022-07-07 20:41:59 +02:00