Package org.cipango.kaleo.presence.watcherinfo.WatcherDocument

Examples of org.cipango.kaleo.presence.watcherinfo.WatcherDocument.Watcher


    winfoSession.sendResponse(Response.OK, tx); // 8
    watcherinfo = getWatcherinfo(notify);
    assertEquals(1, watcherinfo.getVersion().intValue());
    watcherList = watcherinfo.getWatcherListArray(0);
    assertEquals(1, watcherList.sizeOfWatcherArray());
    Watcher watcher = watcherList.getWatcherArray(0);
    assertEquals(Event.SUBSCRIBE, watcher.getEvent());
    assertEquals(getAliceUri(), watcher.getStringValue());
    assertEquals(Status.ACTIVE, watcher.getStatus());
   
   
    tx = presenceSession.waitForNotify(); // 9
    presenceSession.sendResponse(Response.OK, tx); // 10
   
   
    subscribe = presenceSession.newSubsequentSubscribe(0); // 11
    presenceSession.sendRequest(subscribe, Response.OK); // 12
   
    tx = winfoSession.waitForNotify(); // 13
    notify = tx.getRequest();
    // System.out.println(notify);
    winfoSession.sendResponse(Response.OK, tx); // 14
    watcherinfo = getWatcherinfo(notify);
    assertEquals(2, watcherinfo.getVersion().intValue());
    watcherList = watcherinfo.getWatcherListArray(0);
    assertEquals(1, watcherList.sizeOfWatcherArray());
    watcher = watcherList.getWatcherArray(0);
    assertEquals(Event.TIMEOUT, watcher.getEvent());
    assertEquals(getAliceUri(), watcher.getStringValue());
    assertEquals(Status.TERMINATED, watcher.getStatus());
   
    tx = presenceSession.waitForNotify(); // 15
    presenceSession.sendResponse(Response.OK, tx); // 16
   
    subscribe = winfoSession.newSubsequentSubscribe(0); // 17
View Full Code Here


    assertEquals(1, watcherinfo.getWatcherListArray().length);
    WatcherList watcherList = watcherinfo.getWatcherListArray(0);
    assertEquals(getBobUri(), watcherList.getResource());
    assertEquals(PresenceEventPackage.NAME, watcherList.getPackage());
    assertEquals(1, watcherList.getWatcherArray().length);
    Watcher watcher = watcherList.getWatcherArray(0);
    assertEquals(Event.SUBSCRIBE, watcher.getEvent());
    assertEquals(getAliceUri(), watcher.getStringValue());
    assertEquals(Status.ACTIVE, watcher.getStatus());
   
   
    subscribe = presenceSession.newSubsequentSubscribe(0); // 9
    presenceSession.sendRequest(subscribe, Response.OK); // 10
       
View Full Code Here

    assertEquals(1, watcherinfo.getWatcherListArray().length);
    WatcherList watcherList = watcherinfo.getWatcherListArray(0);
    assertEquals(getBobUri(), watcherList.getResource());
    assertEquals(PresenceEventPackage.NAME, watcherList.getPackage());
    assertEquals(1, watcherList.getWatcherArray().length);
    Watcher watcher = watcherList.getWatcherArray(0);
    assertEquals(Event.SUBSCRIBE, watcher.getEvent());
    assertEquals(getAliceUri(), watcher.getStringValue());
    assertEquals(Status.ACTIVE, watcher.getStatus());
   
   
    HttpClient httpClient = new HttpClient();
    PutMethod put = new PutMethod(getHttpXcapUri() + BOB_PRES_RULES_URI); // 11
   
    InputStream is = WatcherInfoTest.class.getResourceAsStream("/xcap-root/pres-rules/users/put/elementPoliteBlock.xml");
    RequestEntity entity = new InputStreamRequestEntity(is, "application/xcap-el+xml");
    put.setRequestEntity(entity);
   
    int result = httpClient.executeMethod(put);
    assertEquals(200, result); // 12
    put.releaseConnection();
   
    tx = presenceSession.waitForNotify(); // 13
    //System.out.println("11:\n" + tx.getRequest());
    presenceSession.sendResponse(Response.OK, tx); // 14
    presence = getPresence(tx.getRequest());
    assertEquals(Basic.CLOSED, presence.getTupleArray()[0].getStatus().getBasic());
   
    tx = winfoSession.waitForNotify(); // 15
    notify = tx.getRequest();
    winfoSession.sendResponse(Response.OK, tx); // 16
    System.out.println(notify);
    subState = (SubscriptionStateHeader) notify.getHeader(SubscriptionStateHeader.NAME);
    assertEquals(SubscriptionStateHeader.ACTIVE.toLowerCase(), subState.getState().toLowerCase());
    assertEquals(WatcherInfoEventPackage.NAME, ((EventHeader) notify.getHeader(EventHeader.NAME)).getEventType());
    watcherinfo = getWatcherinfo(notify);
    assertEquals(1, watcherinfo.getVersion().intValue());
    assertEquals(Watcherinfo.State.FULL, watcherinfo.getState());
    assertEquals(1, watcherinfo.getWatcherListArray().length);
    watcherList = watcherinfo.getWatcherListArray(0);
    assertEquals(getBobUri(), watcherList.getResource());
    assertEquals(PresenceEventPackage.NAME, watcherList.getPackage());
    assertEquals(1, watcherList.getWatcherArray().length);
    watcher = watcherList.getWatcherArray(0);
    assertEquals(Event.SUBSCRIBE, watcher.getEvent());
    assertEquals(getAliceUri(), watcher.getStringValue());
    assertEquals(Status.ACTIVE, watcher.getStatus());
     
   
    subscribe = winfoSession.newSubsequentSubscribe(0); // 17
    winfoSession.sendRequest(subscribe, Response.OK); // 18
       
View Full Code Here

    assertEquals(1, watcherinfo.getWatcherListArray().length);
    WatcherList watcherList = watcherinfo.getWatcherListArray(0);
    assertEquals(getAliceUri(), watcherList.getResource());
    assertEquals(PresenceEventPackage.NAME, watcherList.getPackage());
    assertEquals(1, watcherList.getWatcherArray().length);
    Watcher watcher = watcherList.getWatcherArray(0);
    assertEquals(Event.TIMEOUT, watcher.getEvent());
    assertEquals(getBobUri(), watcher.getStringValue());
    assertEquals(Status.WAITING, watcher.getStatus())
   
   
    HttpClient httpClient = new HttpClient();
    PutMethod put = new PutMethod(getHttpXcapUri() + ALICE_PRES_RULES_URI); // 11
   
View Full Code Here

    if (presentity != null)
    {
      List<Subscription> subscriptions = presentity.getSubscriptions();
      for (Subscription subscription : subscriptions)
      {
        Watcher watcher = list.addNewWatcher();
        watcher.setStringValue(subscription.getUri());
        watcher.setId(subscription.getId());
        watcher.setStatus(getStatus(subscription.getState()));
        watcher.setEvent(getEvent(subscription.getReason()));
      }
    }
   
    // TODO set watchers
    _state = new State(WatcherInfoEventPackage.WATCHERINFO, _content);
View Full Code Here

  private void modifyWatcher(Subscription subscription)
  {
    WatcherList list = _content.getWatcherinfo().getWatcherListArray(0);
    for (int i = 0; i < list.getWatcherArray().length; i++)
    {
      Watcher watcher = list.getWatcherArray(i);
      if (watcher.getStringValue().equals(subscription.getUri()))
      {
        watcher.setStatus(getStatus(subscription.getState()));
        watcher.setEvent(getEvent(subscription.getReason()));
        return;
      }
    }
    Watcher watcher = list.addNewWatcher();
    watcher.setStringValue(subscription.getUri());
    watcher.setId(subscription.getId());
    watcher.setStatus(getStatus(subscription.getState()));
    watcher.setEvent(getEvent(subscription.getReason()));
  }
View Full Code Here

    if (newState == Subscription.State.TERMINATED)
    {
      WatcherList list = _content.getWatcherinfo().getWatcherListArray(0);
      for (int i = 0; i < list.getWatcherArray().length; i++)
      {
        Watcher watcher = list.getWatcherArray(i);
        if (watcher.getStringValue().equals(subscription.getUri()))
        {
          list.removeWatcher(i);
          break;
        }
      }
View Full Code Here

      Watcherinfo watcherinfo = ((WatcherinfoDocument) resource.getState().getContent()).getWatcherinfo();
      WatcherList watcherList = watcherinfo.getWatcherListArray(0);
      if (_nbNotif == 1)
      {
        assertEquals(1, watcherList.getWatcherArray().length);
        Watcher watcher1 = watcherList.getWatcherArray(0);
        assertEquals(SUBSCRIBER_AOR, watcher1.getStringValue());
        assertEquals(Event.SUBSCRIBE, watcher1.getEvent());
        assertEquals(Status.PENDING, watcher1.getStatus());
      }
      else if (_nbNotif == 2)
      {
        assertEquals(1, watcherList.getWatcherArray().length);
        Watcher watcher1 = watcherList.getWatcherArray(0);
        assertEquals(SUBSCRIBER_AOR, watcher1.getStringValue());
        assertEquals(Event.APPROVED, watcher1.getEvent());
        assertEquals(Status.ACTIVE, watcher1.getStatus());
      }
      else if (_nbNotif == 3)
      {
        assertEquals(1, watcherList.getWatcherArray().length);
        Watcher watcher1 = watcherList.getWatcherArray(0);
        assertEquals(SUBSCRIBER_AOR, watcher1.getStringValue());
        assertEquals(Event.TIMEOUT, watcher1.getEvent());
        assertEquals(Status.TERMINATED, watcher1.getStatus());
      }
      else
      {
        fail("Unexpected notification: " + _nbNotif + "\n" + watcherinfo);
      }
View Full Code Here

TOP

Related Classes of org.cipango.kaleo.presence.watcherinfo.WatcherDocument.Watcher

Copyright © 2018 www.massapicom. 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.