creaper
creaper copied to clipboard
Remove commands should optionaly remove resources lazily
Since these commands are often used just for cleaning up after tests the lazy remove could be valid use case and the commands should be able to be configured to behave lazily.
Hmm, now that's an interesting idea. We could change all command implementations, and make sure that we don't miss anything in the future. That's not gonna work. Or there could be some global configuration -- I honestly don't like that idea very much, but it also makes a lot of sense (one of Creaper's goals is to help with testing). I'll have to think about that. Or you can provide some highly compelling arguments :-)
BTW the correct word here wouldn't be "lazy" but "lenient". "Lazy" is already used in Creaper in a different context and with a different meaning.
Rather than guaranteed feature I meant common (recommended ?) way how to implement removing commands. See https://github.com/wildfly-extras/creaper/pull/117 discussion.
I meant this issue as a suggestion how to enhance (some) existing commands and how to review upcoming ones.
OK, so we already have a similar convention: builders of the Add*
commands often have a replaceExisting()
method.
I'd suggest that builders of the Remove*
commands would have a method called lenient()
or onlyIfExists()
or ignoreMissing()
or something like that. Then, based on such flag, the command would either call Operations.remove
or Operations.removeIfExists
.
Would you agree with such solution?
I actually like ignoreMissing()
the most, because it's symmetric with replaceExisting()
.
+1
I suggest ifExists()
no problem with ignoreMissing()
Many Remove*
commands don't use builders ATM. Thus we will need to maintain two constructors, one based on Builder and the current one in order to not break API.
Just saying. I am definitely for such option, I would find it handy as well.
I'd prefer adding builders for options like this. The existing constructors would have to be preserved, of course.
I am also for builders for such options, I just wanted to point out the need for preserving current constructors.
Then we are in agreement and the only remaining thing is to find someone who will do it :-)