Examples of MessageSet


Examples of etc.aloe.data.MessageSet

     * Test of segment method, of class ThresholdSegmentation.
     */
    @Test
    public void testSegment_byParticipant() {
        System.out.println("segment_byParticipant");
        MessageSet messages = new MessageSet();

        messages.add(new Message(0, new Date(), "Alice", "it's"));
        messages.add(new Message(1, new Date(), "Bob", "cow"));
        messages.add(new Message(2, new Date(), "Alice", "time"));
        messages.add(new Message(3, new Date(), "Bob", "noooooooo"));
        messages.add(new Message(4, new Date(), "Bob", "once"));
        messages.add(new Message(5, new Date(), "Alice", "upon"));
        messages.add(new Message(6, new Date(), "Bob", "a"));
        messages.add(new Message(7, new Date(), "Alice", "time"));

        ThresholdSegmentation instance = new ThresholdSegmentation(30, true);
        SegmentSet segments = instance.segment(messages);

        //Expecting 2 segments, one for each participant
View Full Code Here

Examples of etc.aloe.data.MessageSet

     * Test of segment method, of class ThresholdSegmentation.
     */
    @Test
    public void testSegment_notByParticipant() {
        System.out.println("segment_notByParticipant");
        MessageSet messages = new MessageSet();

        messages.add(new Message(0, new Date(), "Alice", "it's"));
        messages.add(new Message(1, new Date(), "Bob", "cow"));
        messages.add(new Message(2, new Date(), "Alice", "time"));
        messages.add(new Message(3, new Date(), "Bob", "noooooooo"));
        messages.add(new Message(4, new Date(), "Bob", "once"));
        messages.add(new Message(5, new Date(), "Alice", "upon"));
        messages.add(new Message(6, new Date(), "Bob", "a"));
        messages.add(new Message(7, new Date(), "Alice", "time"));

        ThresholdSegmentation instance = new ThresholdSegmentation(30, false);
        SegmentSet segments = instance.segment(messages);

        //Expecting 1 segment
View Full Code Here

Examples of hermes.xml.MessageSet

        log.error(ex.getMessage(), ex);
      }
    }

    if (xmlMessages == null) {
      xmlMessages = new MessageSet();
    }

  }
View Full Code Here

Examples of hermes.xml.MessageSet

    try {
      if (xmlMessages == null) {
        read();
      }

      MessageSet newMessages = xmlSupport.toMessageSet(messages);

      xmlMessages.getEntry().addAll(newMessages.getEntry());

      save();
    } catch (JMSException e) {
      throw e; // Ugh.
    } catch (Exception e) {
View Full Code Here

Examples of hermes.xml.MessageSet

      // ikky but whatever.
     
      if (xmlMessage != null) {
        if (message.getJMSMessageID().equals(xmlMessage.getJMSMessageID())) {
          xmlMessages.getEntry().remove(i) ;
          MessageSet messageSet = xmlSupport.toMessageSet(Arrays.asList(message)) ;
          xmlMessages.getEntry().add(i, messageSet.getEntry().get(0)) ;
        }
      }
    }

    save();
View Full Code Here

Examples of hermes.xml.MessageSet

  }

  @Override
  public void toXML(Collection messages, OutputStream ostream) throws JMSException, IOException {
    try {
      MessageSet messageSet = toMessageSet(messages);
      saveContent(messageSet, ostream);
    } catch (Exception ex) {
      log.error(ex.getMessage(), ex);

      throw new HermesException(ex);
View Full Code Here

Examples of hermes.xml.MessageSet

  @Override
  public String toXML(Collection messages) throws JMSException {
    try {

      StringWriter writer = new StringWriter();
      MessageSet messageSet = toMessageSet(messages);

      saveContent(messageSet, writer);

      return writer.getBuffer().toString();
    } catch (Exception ex) {
View Full Code Here

Examples of hermes.xml.MessageSet

    return rval;
  }

  public MessageSet toMessageSet(Collection messages) throws JMSException {
    try {
      MessageSet messageSet = factory.createMessageSet();

      for (Iterator iter = messages.iterator(); iter.hasNext();) {
        Message jmsMessage = (Message) iter.next();
        Entry entry = factory.createEntry();
        XMLMessage xmlMessage = createXMLMessage(factory, jmsMessage);

        if (xmlMessage instanceof XMLTextMessage) {
          entry.setType(XML_TEXT_MESSAGE);
          entry.setTextMessage((XMLTextMessage) xmlMessage);

        } else if (xmlMessage instanceof XMLMapMessage) {
          entry.setType(XML_MAP_MESSAGE);
          entry.setMapMessage((XMLMapMessage) xmlMessage);

        } else if (xmlMessage instanceof XMLObjectMessage) {
          entry.setType(XML_OBJECT_MESSAGE);
          entry.setObjectMessage((XMLObjectMessage) xmlMessage);
        } else if (xmlMessage instanceof XMLBytesMessage) {
          entry.setType(XML_BYTES_MESSGAE);
          entry.setBytesMessage((XMLBytesMessage) xmlMessage);

        }

        messageSet.getEntry().add(entry);
      }

      return messageSet;
    } catch (Exception ex) {
      log.error(ex.getMessage(), ex);
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.