paulcwarren / spring-content

Cloud-Native Storage and Enterprise Content Services (ECMS) for Spring
https://paulcwarren.github.io/spring-content/
Apache License 2.0
270 stars 65 forks source link

Send events when creating entities in multipart post #2070

Closed rschev closed 1 month ago

rschev commented 1 month ago

Spring content creates entities when using multipart post. However, it didn't send events for onBeforeCreate and onAfterCreate, so when you have custom validation you would bypass it with the multipart.

paulcwarren commented 1 month ago

I am always in two minds about how to test these things. I see you made the test single-threaded to ensure no other tests are publishing events at the same time. This always makes me a little sad but I dont really see a good way to test under multi-threaded conditions so ¯_(ツ)_/¯ I guess

paulcwarren commented 1 month ago

Thanks much @rschev

rschev commented 1 month ago

Yeah, setting it to single-threaded seemed like the simplest way to accomplish this. I suppose I could've also tried to check that the list of events at least contained one with a value unique for that test, and ignored the other events.