Package net.alteiar.beans.chat

Examples of net.alteiar.beans.chat.Message


  @Test(timeout = 5000)
  public void testChatPrivateSender() {
    final String expectedMessage = "my_message";

    Message msg = new Message(expectedMessage);
    msg.addReceiver(CampaignClient.getInstance().getCurrentPlayer());

    Runnable sendTextMessage = new Runnable() {
      @Override
      public void run() {
        Message msg = new Message(expectedMessage);
        msg.addReceiver(CampaignClient.getInstance().getCurrentPlayer());
        getChat().talk(msg);
      }
    };

    System.out.println("wait for last message 1");
    Message result = getLastMessage(sendTextMessage);

    assertTrue("The message is for us so we can access it",
        result.accept(CampaignClient.getInstance().getCurrentPlayer()));

    sendTextMessage = new Runnable() {
      @Override
      public void run() {
        Message msg = new Message(expectedMessage);
        msg.addReceiver(new Player());
        getChat().talk(msg);
      }
    };

    System.out.println("wait for last message 2");
View Full Code Here


    final String expectedMessage = "my message";

    Runnable sendTextMessage = new Runnable() {
      @Override
      public void run() {
        Message msg = new Message(expectedMessage);
        msg.addReceiver(new Player());
        getChat().talk(MessageFactory.dmMessage(expectedMessage));
      }
    };

    System.out.println("wait for last message 1");
    Message result = getLastMessage(sendTextMessage);

    assertTrue("The message is for us so we can access it",
        result.accept(CampaignClient.getInstance().getCurrentPlayer()));
  }
View Full Code Here

   * @param message
   * @return the new message to be send or null if the macro do action without
   *         sending message
   */
  public Message applyMacro(String message) {
    Message msg = null;
    try {
      msg = applyValidMacro(message);
    } catch (Exception ex) {
      ex.printStackTrace();
      Logger.getLogger(getClass()).error("Error while executing macro ",
View Full Code Here

  public Message applyMacro(String text) {
    String command = extractCommand(text);
    String args = extractText(text);
    Macro macro = macros.get(command);

    Message msg = null;
    if (macro != null) {
      msg = macro.applyMacro(args);
    } else {
      msg = new Message(
          "Commande invalide taper /h ou /help pour plus d'information sur les commandes disponibles");
    }
    return msg;
  }
View Full Code Here

  protected void sendMessage() {
    String message = this.textSend.getText();

    if (message.startsWith("/")) {
      Message msg = macroManager.applyMacro(message);

      if (msg != null) {
        getChat().talk(msg);
      }
    } else {
View Full Code Here

    System.out.println("test message");

    String tgtMsg1 = "**msg1**";
    String tgtMsg2 = "**msg1**";
    String tgtMsg3 = "msg1";
    Message msg1 = new Message(tgtMsg1);
    Message msg2 = new Message(tgtMsg2);
    Message msg3 = new Message(tgtMsg3);

    assertTrue("message should be different with null", !msg1.equals(null));
    assertTrue("message should be different with different object",
        !msg1.equals(""));
    assertTrue("message should be same to itself", msg1.equals(msg1));
    assertTrue("message should be same to another similar message",
        msg1.equals(msg2));
    assertTrue("message should'nt be same to another different message",
        !msg1.equals(msg3));

    assertTrue("message should be same to another similar message", msg1
        .getHtmlFormat().equals(msg2.getHtmlFormat()));
    assertTrue("message should'nt be same to another different message",
        !msg1.getHtmlFormat().equals(msg3.getHtmlFormat()));

    assertEquals("message should be same", msg1.getText(), tgtMsg1);

    System.out.println("test message");
  }
View Full Code Here

    final String expectedMsg = "Salut";

    Runnable sendTextMessage = new Runnable() {
      @Override
      public void run() {
        getChat().talk(new Message(expectedMsg));
      }
    };
    Message msg = getLastMessage(sendTextMessage);

    assertEquals("the message must be the same", expectedMsg, msg.getText());

    ArrayList<Message> allMsgExpected = new ArrayList<Message>();
    allMsgExpected.add(MessageFactory.textMessage(CampaignClient
        .getInstance().getCurrentPlayer(), "my message"));
View Full Code Here

    if (!atLeastOneDieSelected) {
      // TODO : ne pas /crire ceci dans le chat,
      // mais bien dans un pop up window qui sera montr\u00E9
      // uniquement à l'utilisateur.
      CampaignClient.getInstance().getChat()
          .talk(new Message("Aucun d\u00E9 s\u00E9lectionn\u00E9."));
    }
    return atLeastOneDieSelected;
  }
View Full Code Here

TOP

Related Classes of net.alteiar.beans.chat.Message

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.