{
// now lets startup the server.
ZookeeperTestServer server = null;
final AtomicReference<ZookeeperSession> sessionRef = new AtomicReference<ZookeeperSession>();
ZookeeperSession session = null;
final AtomicLong processCount = new AtomicLong(0);
Dempsy[] dempsy = new Dempsy[3];
try
{
server = new ZookeeperTestServer();
server.start();
session = new ZookeeperSession("127.0.0.1:" + port,5000) {
@Override
public WatcherProxy makeWatcherProxy(ClusterInfoWatcher w)
{
processCount.incrementAndGet();
return super.makeWatcherProxy(w);
};
};
sessionRef.set(session);
final FullApplication app = new FullApplication();
ApplicationDefinition ad = app.getTopology();
assertEquals(0,processCount.intValue()); // no calls yet
dempsy[0] = getDempsyFor(new ClusterId(FullApplication.class.getSimpleName(),FullApplication.MyAdaptor.class.getSimpleName()),ad);
dempsy[0].setClusterSessionFactory(new ZookeeperSessionFactory("127.0.0.1:" + port,5000));
dempsy[1] = getDempsyFor(new ClusterId(FullApplication.class.getSimpleName(),FullApplication.MyMp.class.getSimpleName()),ad);