예제 #1
0
  private List<IMessageContext> generateMockMessageContext(int start, int count, Customer cust)
      throws Exception {
    final String indexFilePrefix = "INDEX";
    final String contentFilePrefix = "CONTENT";
    int time = (int) new Date().getTime();

    List<IMessageContext> arr = new ArrayList<IMessageContext>();
    for (int x = 0; x < count; x++) {
      File indexFile = new File(m_tmpDir, indexFilePrefix + x + ".ftp");
      File contentFile = new File(m_tmpDir, contentFilePrefix + x + ".ftp");
      if (!indexFile.exists()) {
        assertTrue("Failed to create index file.", indexFile.createNewFile());
      }
      if (!contentFile.exists()) {
        assertTrue("Failed to create content file.", contentFile.createNewFile());
      }

      IMessageContext mock = new MessageContext(indexFile, contentFile);
      Envelope lope = new Envelope();
      lope.setMessageID("booga" + x + new Date().getTime());
      lope.setReceivedDate(new Date());
      lope.setSentDate(new Date());
      lope.setSize(10);
      lope.setCompressedSize(5);
      lope.setSubject("Test");
      lope.setRecipients("bleh");
      lope.setSftpTimeMS(100);
      lope.setSender("test2");
      mock.setEnvelope(lope);
      mock.setResolvedRecipients(new ArrayList<ReplicatedRecipient>());
      mock.setCustomer(cust);
      mock.setPartition(m_part);
      mock.setInternalId(start + 1 + x);
      arr.add(mock);
    }
    return arr;
  }