Examples of ChatProperties


Examples of com.calclab.emite.im.chat.ChatProperties

  }

  @Test
  public void shouldAcceptInvitations() {
    final RoomChatChangedTestHandler handler = new RoomChatChangedTestHandler();
    final ChatProperties properties = new ChatProperties(USER);
    manager.addRoomChatChangedHandler(handler);
    final RoomInvitation invitation = new RoomInvitation(uri("friend@host/resource"), uri("room@room.service"), "theReason", properties);
    manager.acceptRoomInvitation(invitation);
    assertEquals(2, handler.getCalledTimes());
    assertEquals(ChangeType.created, handler.getEvent(0).getChangeType());
View Full Code Here

Examples of com.calclab.emite.im.chat.ChatProperties

    eventBus = new SimpleEventBus();
    userURI = uri("user@domain/res");
    roomURI = uri("room@domain/nick");
    session.setLoggedIn(userURI);
    final RoomChatManagerImpl manager = new RoomChatManagerImpl(eventBus, session, new RoomChatSelectionStrategy());
    final ChatProperties properties = new ChatProperties(roomURI, userURI, null);
    room = (RoomChatImpl) manager.openChat(properties, true);
  }
View Full Code Here

Examples of com.calclab.emite.im.chat.ChatProperties

    strategy = new PairChatSelectionStrategy();
  }

  @Test
  public void shouldAssignToSameIfResourceChanged() {
    final ChatProperties chatProperties = new ChatProperties(uri("user@domain"));
    assertTrue(strategy.isAssignable(chatProperties, new ChatProperties(uri("user@domain"))));
    assertTrue(strategy.isAssignable(chatProperties, new ChatProperties(uri("user@domain/res1"))));
    assertTrue(strategy.isAssignable(chatProperties, new ChatProperties(uri("user@domain/res2"))));
  }
View Full Code Here

Examples of com.calclab.emite.im.chat.ChatProperties

  }

  @Test
  public void shouldExtractFromProperty() {
    final Message message = new Message("body", uri("recipient@domain"), uri("sender@domain"));
    final ChatProperties properties = strategy.extractProperties(message);
    assertNotNull(properties);
    assertEquals(uri("sender@domain"), properties.getUri());
  }
View Full Code Here

Examples of com.calclab.emite.im.chat.ChatProperties

    assertEquals(uri("sender@domain"), properties.getUri());
  }

  @Test
  public void shouldInitiateCreationWhenMessageBody() {
    final ChatProperties properties = strategy.extractProperties(new Message("body"));
    assertTrue(properties.shouldCreateNewChat());
  }
View Full Code Here

Examples of com.calclab.emite.im.chat.ChatProperties

  public void shouldNotInitiateCreationIfMessageHasInvitation() {
    final XMLPacket stanza = XMLBuilder.fromXML("<message to='test1@localhost' " + "from='room@conference.localhost' xmlns='jabber:client' "
        + "type='normal'><x xmlns='http://jabber.org/protocol/muc#user'>" + "<invite from='test1@localhost/emite-1291918896669'><reason />"
        + "</invite></x><x jid='room@conference.localhost' " + "xmlns='jabber:x:conference' />"
        + "<body>test1@localhost/emite-1291918896669 invites you to the room room@conference.localhost</body></message>");
    final ChatProperties properties = strategy.extractProperties(new Message(stanza));
    assertFalse(properties.shouldCreateNewChat());
  }
View Full Code Here

Examples of com.calclab.emite.im.chat.ChatProperties

    assertFalse(properties.shouldCreateNewChat());
  }

  @Test
  public void shouldNotInitiateCreationWhenNotBody() {
    final ChatProperties properties = strategy.extractProperties(new Message((String) null));
    assertFalse(properties.shouldCreateNewChat());
  }
View Full Code Here

Examples of com.calclab.emite.im.chat.ChatProperties

  @Before
  public void beforeTests() {
    session.setLoggedIn(USER_URI);
    final PairChatManagerImpl manager = new PairChatManagerImpl(eventBus, session, new PairChatSelectionStrategy());
    final ChatProperties properties = new ChatProperties(CHAT_URI, USER_URI, ChatStatus.ready);
    pairChat = manager.openChat(properties, true);
    pairChat.setThread("theThread");
  }
View Full Code Here

Examples of com.calclab.emite.im.chat.ChatProperties

    return pairChat;
  }

  @Test
  public void shouldBeReadyIfSessionLogedIn() {
    final ChatProperties properties = new ChatProperties(uri("someone@domain"), USER_URI, ChatStatus.ready);
    final PairChat aChat = new PairChat(eventBus,session, properties);
    assertEquals(ChatStatus.ready, aChat.getStatus());
  }
View Full Code Here

Examples of com.calclab.emite.im.chat.ChatProperties

    assertTrue("should receive messages", handler.isCalledOnce());
  }

  @Test
  public void shouldSendNoThreadWhenNotSpecified() {
    final ChatProperties properties = new ChatProperties(CHAT_URI, USER_URI, ChatStatus.locked);
    final PairChat noThreadChat = new PairChat(eventBus, session, properties);
    noThreadChat.setStatus(ChatStatus.ready);
    noThreadChat.send(new Message("the message"));
    session.verifySent("<message from='self@domain/res' to='other@domain/other' " + "type='chat'><body>the message</body></message>");
  }
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.