@Test
public void testTwoModelInstances() throws Exception {
ZooKeeperItf zk1 = ZkUtil.connect("localhost:" + zkClientPort, 15000);
ZooKeeperItf zk2 = ZkUtil.connect("localhost:" + zkClientPort, 15000);
RepositoryModel repositoryModel1 = new RepositoryModelImpl(zk1);
RepositoryModel repositoryModel2 = new RepositoryModelImpl(zk2);
TestListener model1Listener = new TestListener();
assertEquals(1, repositoryModel1.getRepositories(model1Listener).size());
TestListener model2Listener = new TestListener();
assertEquals(1, repositoryModel2.getRepositories(model2Listener).size());
repositoryModel1.create("repo1");
repositoryModel1.create("repo2");
repositoryModel2.create("repo3");
repositoryModel2.create("repo4");
model2Listener.waitForEvents(4);
model1Listener.waitForEvents(4);
assertEquals(5, repositoryModel1.getRepositories().size());
assertEquals(5, repositoryModel2.getRepositories().size());
((RepositoryModelImpl)repositoryModel1).close();
((RepositoryModelImpl)repositoryModel2).close();
zk1.close();