Examples of NamespaceEvent


Examples of javanet.staxutils.events.NamespaceEvent

    private List getNamespaces()
    {
        List namespaces = new ArrayList();
        for (int i = 0; i < getNamespaceCount(); i++)
        {
            namespaces.add(new NamespaceEvent(getNamespacePrefix(i), getNamespaceURI(i), getLocation()));
        }
        return namespaces;
    }
View Full Code Here

Examples of org.apache.hadoop.hdfs.notifier.NamespaceEvent

  public void testBasicDispatch() throws Exception {
    DummyServerCore core = new DummyServerCore();
    ServerDispatcher dispatcher = new ServerDispatcher(core);
    long clientId = 1000;
    DummyClientHandler handler = new DummyClientHandler();
    NamespaceEvent event = new NamespaceEvent("/a",
        EventType.FILE_ADDED.getByteValue());
    Set<Long> subscriptions = new HashSet<Long>();
    Thread dispatcherThread = new Thread(dispatcher);
   
    // Add only one client with one subscription
View Full Code Here

Examples of org.apache.hadoop.hdfs.notifier.NamespaceEvent

  public void testDispatchOrder() throws Exception {
    DummyServerCore core = new DummyServerCore();
    ServerDispatcher dispatcher = new ServerDispatcher(core);
    long clientId = 1000;
    DummyClientHandler handler = new DummyClientHandler();
    NamespaceEvent event = new NamespaceEvent("/a",
        EventType.FILE_ADDED.getByteValue());
    NamespaceEvent event2 = new NamespaceEvent("/a/c",
        EventType.FILE_CLOSED.getByteValue());
    Set<Long> subscriptions = new HashSet<Long>();
    Thread dispatcherThread = new Thread(dispatcher);
   
    // Add only one client with one subscription
View Full Code Here

Examples of org.apache.hadoop.hdfs.notifier.NamespaceEvent

  public void testDispatchOrderClientFailing() throws Exception {
    DummyServerCore core = new DummyServerCore();
    ServerDispatcher dispatcher = new ServerDispatcher(core);
    long clientId = 1000;
    DummyClientHandler handler = new DummyClientHandler();
    NamespaceEvent event = new NamespaceEvent("/a",
        EventType.FILE_ADDED.getByteValue());
    NamespaceEvent event2 = new NamespaceEvent("/a/c",
        EventType.FILE_CLOSED.getByteValue());
    Set<Long> subscriptions = new HashSet<Long>();
    Thread dispatcherThread = new Thread(dispatcher);
   
    // Add only one client with one subscription
View Full Code Here

Examples of org.apache.hadoop.hdfs.notifier.NamespaceEvent

    DummyServerCore core = new DummyServerCore();
    ServerDispatcher dispatcher = new ServerDispatcher(core);
    long client1Id = 1000, client2Id = 2000;
    DummyClientHandler handler1 = new DummyClientHandler(),
        handler2 = new DummyClientHandler();
    NamespaceEvent event1 = new NamespaceEvent("/a",
        EventType.FILE_ADDED.getByteValue());
    NamespaceEvent event2 = new NamespaceEvent("/b",
        EventType.FILE_ADDED.getByteValue());
    NamespaceEvent eventCommon = new NamespaceEvent("/c",
        EventType.FILE_ADDED.getByteValue());
    Set<Long> subscriptions = new HashSet<Long>();
    Thread dispatcherThread = new Thread(dispatcher);
   
    // Add only one client with one subscription
View Full Code Here

Examples of org.apache.hadoop.hdfs.notifier.NamespaceEvent

  public void testDispatchFailing() throws Exception {
    DummyServerCore core = new DummyServerCore();
    ServerDispatcher dispatcher = new ServerDispatcher(core);
    long clientId = 1000;
    DummyClientHandler handler = new DummyClientHandler();
    NamespaceEvent event = new NamespaceEvent("/a",
        EventType.FILE_ADDED.getByteValue());
    NamespaceEvent event2 = new NamespaceEvent("/a/c",
        EventType.FILE_CLOSED.getByteValue());
    Set<Long> subscriptions = new HashSet<Long>();
    Thread dispatcherThread = new Thread(dispatcher);
   
    // Add only one client with one subscription
View Full Code Here

Examples of org.apache.hadoop.hdfs.notifier.NamespaceEvent

    history.storeNotification(new NamespaceNotification("/a/b",
        EventType.FILE_ADDED.getByteValue(), 10));
    history.storeNotification(new NamespaceNotification("/a/c",
        EventType.FILE_ADDED.getByteValue(), 11));
    historyNotifications = new LinkedList<NamespaceNotification>();
    history.addNotificationsToQueue(new NamespaceEvent("/a",
        EventType.FILE_ADDED.getByteValue()), 10, historyNotifications);
    Assert.assertEquals(1, historyNotifications.size());
    Assert.assertEquals(11, historyNotifications.peek().txId);
    Assert.assertEquals("/a/c", historyNotifications.peek().path);
   
    // Step 2 - test with FILE_CLOSED
    history.storeNotification(new NamespaceNotification("/a/d",
        EventType.FILE_CLOSED.getByteValue(), 12));
    history.storeNotification(new NamespaceNotification("/a/e",
        EventType.FILE_CLOSED.getByteValue(), 13));
    historyNotifications = new LinkedList<NamespaceNotification>();
    history.addNotificationsToQueue(new NamespaceEvent("/a",
        EventType.FILE_CLOSED.getByteValue()), 12, historyNotifications);
    Assert.assertEquals(1, historyNotifications.size());
    Assert.assertEquals(13, historyNotifications.peek().txId);
    Assert.assertEquals("/a/e", historyNotifications.peek().path);
   
    // test the sub directories
    historyNotifications = new LinkedList<NamespaceNotification>();
    history.addNotificationsToQueue(new NamespaceEvent("/",
        EventType.FILE_ADDED.getByteValue()), 10, historyNotifications);
    Assert.assertEquals(1, historyNotifications.size());
    history.addNotificationsToQueue(new NamespaceEvent("/",
        EventType.FILE_CLOSED.getByteValue()), 10, historyNotifications);
    Assert.assertEquals(3, historyNotifications.size());
   
    core.shutdown();
  }
View Full Code Here

Examples of org.apache.hadoop.hdfs.notifier.NamespaceEvent

    history.storeNotification(new NamespaceNotification("/a/c",
        EventType.FILE_ADDED.getByteValue(), 11));
    historyNotifications = new LinkedList<NamespaceNotification>();
    try {
      Thread.sleep(historyLength - 30);
      history.addNotificationsToQueue(new NamespaceEvent("/a",
          EventType.FILE_ADDED.getByteValue()), 10, historyNotifications);
    } catch (TransactionIdTooOldException e) {
      Assert.fail();
    }
   
View Full Code Here

Examples of org.apache.hadoop.hdfs.notifier.NamespaceEvent

    history.storeNotification(new NamespaceNotification("/a/c",
        EventType.FILE_ADDED.getByteValue(), 11));
    historyNotifications = new LinkedList<NamespaceNotification>();
    try {
      Thread.sleep(historyLength + 50);
      history.addNotificationsToQueue(new NamespaceEvent("/a",
          EventType.FILE_ADDED.getByteValue()), 10, historyNotifications);
      Assert.fail(); // should receive the exception
    } catch (TransactionIdTooOldException e) {}
   
    core.shutdown();
View Full Code Here

Examples of org.apache.hadoop.hdfs.notifier.NamespaceEvent

          EventType.FILE_ADDED.getByteValue(), txId));
    }

    // Part 1 - Get all notifications
    historyNotifications = new LinkedList<NamespaceNotification>();
    history.addNotificationsToQueue(new NamespaceEvent("/a",
        EventType.FILE_ADDED.getByteValue()), 0, historyNotifications);
    Assert.assertEquals(1000, historyNotifications.size());
    for (long txId = 1; txId < txCount; txId ++) {
      NamespaceNotification n = historyNotifications.poll();
      Assert.assertEquals(txId, n.txId);
      Assert.assertEquals("/a/" + txId, n.path);
      Assert.assertEquals(EventType.FILE_ADDED.getByteValue(), n.type);
    }
   
    // Part 2 - Get half of the notifications
    historyNotifications = new LinkedList<NamespaceNotification>();
    history.addNotificationsToQueue(new NamespaceEvent("/a",
        EventType.FILE_ADDED.getByteValue()), 500, historyNotifications);
    Assert.assertEquals(500, historyNotifications.size());
    for (long txId = 501; txId < txCount; txId ++) {
      NamespaceNotification n = historyNotifications.poll();
      Assert.assertEquals(txId, n.txId);
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.