Examples of ZooKeeperMonitor


Examples of org.kiji.schema.layout.impl.ZooKeeperMonitor

  @Test
  public void testLayoutTrackerUpdatesHandlerInResponsetoZKMLayoutChange() throws Exception {
    final KijiURI tableURI = KijiURI.newBuilder().withInstanceName("i").withTableName("t").build();
    final String layout1 = "layout-id-1";
    final String layout2 = "layout-id-2";
    ZooKeeperMonitor zkMonitor =
        new ZooKeeperMonitor(ZooKeeperClient.getZooKeeperClient(getZKAddress()));

    zkMonitor.notifyNewTableLayout(tableURI, Bytes.toBytes(layout1), -1);

    BlockingQueue<String> layoutQueue = Queues.newSynchronousQueue();
    TableLayoutTracker tracker = new TableLayoutTracker(mZKClient, tableURI,
        new QueuingTableLayoutUpdateHandler(layoutQueue));
    try {
      tracker.start();
      Assert.assertEquals(layout1, layoutQueue.poll(5, TimeUnit.SECONDS));

      zkMonitor.notifyNewTableLayout(tableURI, Bytes.toBytes(layout2), -1);
      Assert.assertEquals(layout2, layoutQueue.poll(5, TimeUnit.SECONDS));
    } finally {
      tracker.close();
    }
  }
View Full Code Here

Examples of org.kiji.schema.layout.impl.ZooKeeperMonitor

  public void testZKMLayoutTrackerRespondsToZooKeeperUtilsSetTableLayout() throws Exception {
    final KijiURI tableURI = KijiURI.newBuilder().withInstanceName("i").withTableName("t").build();
    final String layout1 = "layout-id-1";
    final String layout2 = "layout-id-2";

    ZooKeeperMonitor zkMonitor =
        new ZooKeeperMonitor(ZooKeeperClient.getZooKeeperClient(getZKAddress()));

    ZooKeeperUtils.setTableLayout(mZKClient, tableURI, layout1);

    BlockingQueue<byte[]> layoutQueue = Queues.newSynchronousQueue();
    LayoutTracker tracker =
        zkMonitor.newTableLayoutTracker(tableURI, new QueueingLayoutUpdateHandler(layoutQueue));
    try {
      tracker.open();
      Assert.assertEquals(layout1, Bytes.toString(layoutQueue.poll(5, TimeUnit.SECONDS)));

      ZooKeeperUtils.setTableLayout(mZKClient, tableURI, layout2);
View Full Code Here

Examples of org.kiji.schema.layout.impl.ZooKeeperMonitor

    final String layout1 = "layout-id-1";
    final String layout2 = "layout-id-2";

    BlockingQueue<Multimap<String, String>> usersQueue = Queues.newSynchronousQueue();

    ZooKeeperMonitor zkMonitor =
        new ZooKeeperMonitor(ZooKeeperClient.getZooKeeperClient(getZKAddress()));

    UsersTracker tracker =
        ZooKeeperUtils.newTableUsersTracker(mZKClient, tableURI)
        .registerUpdateHandler(new QueueingUsersUpdateHandler(usersQueue));
    try {
      tracker.start();
      Assert.assertEquals(ImmutableSetMultimap.<String, String>of(),
          usersQueue.poll(5, TimeUnit.SECONDS));

      ZooKeeperMonitor.TableUserRegistration userRegistration =
          zkMonitor.newTableUserRegistration(userID, tableURI);

      try {
        userRegistration.updateRegisteredLayout(layout1);
        Assert.assertEquals(ImmutableSetMultimap.of(userID, layout1),
            usersQueue.poll(5, TimeUnit.SECONDS));
View Full Code Here

Examples of org.kiji.schema.layout.impl.ZooKeeperMonitor

    final String layout1 = "layout-id-1";
    final String layout2 = "layout-id-2";

    BlockingQueue<Multimap<String, String>> usersQueue = Queues.newSynchronousQueue();

    ZooKeeperMonitor zkMonitor =
        new ZooKeeperMonitor(ZooKeeperClient.getZooKeeperClient(getZKAddress()));

    ZooKeeperMonitor.UsersTracker tracker =
        zkMonitor.newTableUsersTracker(tableURI,
            new org.kiji.schema.layout.impl.TestZooKeeperMonitor
                .QueueingUsersUpdateHandler(usersQueue));
    try {
      tracker.open();
      Assert.assertEquals(ImmutableSetMultimap.<String, String>of(),
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.