dswContext.registerService(serviceNames, serviceObject, serviceProps);
final Server server = control.createMock(Server.class);
control.replay();
CxfPublishHook hook = new CxfPublishHook(dswContext, null) {
@Override
Server createServer(ServiceReference sref, ServiceEndpointDescription sd) {
return server;
}
};
assertNull("Precondition not met", hook.getEndpoints().get(sref));
hook.publishEndpoint(sref);
assertEquals(1, hook.getEndpoints().get(sref).size());
hook.endpoints.put(sref, new ArrayList<EndpointInfo>());
assertEquals("Precondition failed", 0, hook.getEndpoints().get(sref).size());
hook.publishEndpoint(sref);
assertEquals(0, hook.getEndpoints().get(sref).size());
control.verify();
}