org.knowhowlab.osgi.testing icon indicating copy to clipboard operation
org.knowhowlab.osgi.testing copied to clipboard

assertServiceUnavailable(class, timeout) implementation does not wait the specified timeout for the service to go away

Open tonit opened this issue 8 years ago • 4 comments

I think the implementation in

https://github.com/dpishchukhin/org.knowhowlab.osgi.testing/blob/master/org.knowhowlab.osgi.testing.assertions/src/main/java/org/knowhowlab/osgi/testing/assertions/ServiceAssert.java#L455

is incorrect. Instead the call must wait for the specified amount (timeout). If it sees the service to be null once within that timeframe, it should return true. Right now the call returns "false" even though i said that i expect the service goes away within the next 1000ms. E.g. because i just removed a configuration object for a managed factory service.

tonit avatar Jul 21 '16 11:07 tonit

serviceUnavailable assertion checks if a service is not appeared in the registry within defined time, but not the final service status.

you can try assertServiceEvent() for your case to validate that service was unregistered

dpishchukhin avatar Jul 21 '16 12:07 dpishchukhin

well why not have a convenience method for "serviceUnregistered(class,timeout)" to have a simple check that a service disapears within "timout"? sure you can always look at the events. But why bother? isnt this library all about convenience assertions?

tonit avatar Jul 21 '16 12:07 tonit

sure, a new assertion is an option as well.

dpishchukhin avatar Jul 21 '16 12:07 dpishchukhin

i will check ;)

tonit avatar Jul 21 '16 12:07 tonit