Home | History | Annotate | Download | only in strprotocol
      1 package org.testng.remote.strprotocol;
      2 
      3 
      4 
      5 
      6 /**
      7  * A generic message to be used with remote listeners.
      8  * It is described by a {@link #m_messageType} and can contain a <code>Map</code>
      9  * or values.
     10  *
     11  * @author <a href='mailto:the_mindstorm[at]evolva[dot]ro'>Alexandru Popescu</a>
     12  */
     13 public class GenericMessage implements IStringMessage {
     14   private static final long serialVersionUID = 1440074281953763545L;
     15 //  protected Map m_properties;
     16   protected final int m_messageType;
     17   private int m_suiteCount;
     18 
     19   private int m_testCount;
     20 
     21   public GenericMessage(final int type) {
     22     m_messageType = type;
     23   }
     24 
     25   public int getSuiteCount() {
     26     return m_suiteCount;
     27   }
     28 
     29   public void setSuiteCount(int suiteCount) {
     30     m_suiteCount = suiteCount;
     31   }
     32 
     33   public int getTestCount() {
     34     return m_testCount;
     35   }
     36 
     37   public void setTestCount(int testCount) {
     38     m_testCount = testCount;
     39   }
     40 
     41   @Override
     42   public String getMessageAsString() {
     43     StringBuffer buf = new StringBuffer();
     44 
     45     buf.append(m_messageType);
     46     buf.append(MessageHelper.DELIMITER).append("testCount").append(getTestCount())
     47         .append(MessageHelper.DELIMITER).append("suiteCount").append(getSuiteCount());
     48 
     49     return buf.toString();
     50   }
     51 
     52   @Override
     53   public String toString() {
     54     return "[GenericMessage suiteCount:" + m_suiteCount + " testCount:" + m_testCount + "]";
     55   }
     56 }
     57