Skip to content

Reusable Execution Context #792

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

sanagaraj-pivotal
Copy link
Contributor

@sanagaraj-pivotal sanagaraj-pivotal commented May 16, 2023

This PR includes some heavy refactoring.

  • It removes all programmatically created instances of ExecutionContext in main code.
  • The ExecutionContext is now a Spring bean with @ExecutionScope
  • execution scope and ends with a successful recipe run
  • TestProjectContext uses Spring and components scan now to create the ProjectConetxtInitializer
  • A new test helper ActionTest was created which allows testing actions that require the ExecutionContext that is now created together with beans to create a ProjectConetxtInitializer instance
  • The execution times of tests might have become even worse as potential too many beans are created when org.springframework.sbm is scanned
  • An ArchUnit test was introduced to flag invalid instance creations of any class implementing ExecutionContext.

sanagaraj-pivotal and others added 24 commits May 10, 2023 10:28
- Learning: Recipe scope is not enough!
  The ExecutionContext might be required during condition evaluation too which happens outside of a recipe-run
- Test would need improvement but sysout shows its working
. Reworking the TestProjectContext to build the context with real Spring beans
…lasses

- ArchUnit test succeeds -> no ExecutionContext creations in main
@fabapp2 fabapp2 marked this pull request as draft May 17, 2023 16:11
fabapp2 added 5 commits May 22, 2023 10:15
…rsing

- ExecutionContext in TestProjectContext is retrieved from ApplicationContext
- SpringBeanProvider has a new method that allows passing replacements for beans
- RewriteExecutionContext delegates to InMemoryExecutionContext now
- Test resources are parsed one by one to not fail on first error
@fabapp2 fabapp2 marked this pull request as ready for review May 26, 2023 13:21
@fabapp2 fabapp2 added type: enhancement New feature or request in: sbm-core labels May 26, 2023
@fabapp2 fabapp2 added this to the v0.14.0 milestone May 26, 2023
@fabapp2 fabapp2 merged commit 0090e2e into spring-projects-experimental:main May 26, 2023
@fabapp2 fabapp2 deleted the 786-reusable-execution-context branch May 26, 2023 14:12
@fabapp2 fabapp2 restored the 786-reusable-execution-context branch May 26, 2023 14:40
fabapp2 added a commit that referenced this pull request May 26, 2023
@fabapp2 fabapp2 linked an issue May 26, 2023 that may be closed by this pull request
1 task
fabapp2 added a commit that referenced this pull request May 26, 2023
* It removes all programmatically created instances of ExecutionContext in main code.
* The ExecutionContext is now a Spring bean with @ExecutionScope
* execution scope and ends with a successful recipe run
* TestProjectContext uses Spring and components scan now to create the ProjectConetxtInitializer
* A new test helper ActionTest was created which allows testing actions that require the ExecutionContext that is now created together with beans to create a ProjectConetxtInitializer instance
* The execution times of tests might have become even worse as potential too many beans are created when org.springframework.sbm is scanned
* An ArchUnit test was introduced to flag invalid instance creations of any class implementing ExecutionContext.

---------

Co-authored-by: Fabian Krüger <[email protected]>
Co-authored-by: Fabian Krüger <[email protected]>
fabapp2 added a commit that referenced this pull request May 26, 2023
* It removes all programmatically created instances of ExecutionContext in main code.
* The ExecutionContext is now a Spring bean with @ExecutionScope
* execution scope and ends with a successful recipe run
* TestProjectContext uses Spring and components scan now to create the ProjectConetxtInitializer
* A new test helper ActionTest was created which allows testing actions that require the ExecutionContext that is now created together with beans to create a ProjectConetxtInitializer instance
* The execution times of tests might have become even worse as potential too many beans are created when org.springframework.sbm is scanned
* An ArchUnit test was introduced to flag invalid instance creations of any class implementing ExecutionContext.

---------

Co-authored-by: Fabian Krüger <[email protected]>
Co-authored-by: Fabian Krüger <[email protected]>
@fabapp2 fabapp2 mentioned this pull request Jul 20, 2023
25 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: sbm-core type: enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Introduce recipe-scoped beans
2 participants