use of org.apache.aries.quiesce.manager.QuiesceCallback in project aries by apache.
the class BPQuiesceTest method canQuiesceNoBPBundle.
@Test
public void canQuiesceNoBPBundle() throws Exception {
IMocksControl c = EasyMock.createControl();
BundleContext ctx = c.createMock(BundleContext.class);
Bundle bpBundle = c.createMock(Bundle.class);
Bundle testBundle = c.createMock(Bundle.class);
EasyMock.expect(ctx.getBundle()).andReturn(bpBundle);
BlueprintQuiesceParticipant bqp = new BlueprintQuiesceParticipant(ctx, new BlueprintExtender() {
@Override
protected BlueprintContainerImpl getBlueprintContainerImpl(Bundle bundle) {
return null;
}
});
final Semaphore result = new Semaphore(0);
QuiesceCallback qc = new QuiesceCallback() {
public void bundleQuiesced(Bundle... bundlesQuiesced) {
result.release();
}
};
c.replay();
bqp.quiesce(qc, Arrays.asList(testBundle));
c.verify();
assertTrue(result.tryAcquire(2, TimeUnit.SECONDS));
}
Aggregations