@Test
  public void testSynchProcessingStrategy() throws Exception {
    sendMessage("vm://testSynch");
    new FlowExecutionListener("synchFlow", muleContext).waitUntilFlowIsComplete();
    file = new File(FILE_PATH);
    String str = FileUtils.readFileToString(file);

    Assert.assertEquals("Part 1Part 2", str);
  }
 public boolean isSatisfied() {
   if (file.exists()) {
     try {
       output = FileUtils.readFileToString(file);
     } catch (IOException e) {
       logger.debug("Could not read from file.");
     }
     return "Part 2Part 1".equals(output);
   } else {
     return false;
   }
 }
Esempio n. 3
0
  public void testStreamingFromFileToTcp() throws Exception {
    String text =
        "\nblah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah "
            + "\nblah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah "
            + "\nblah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah "
            + "\nblah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah\n\n";

    String basepath = muleContext.getConfiguration().getWorkingDirectory() + "/test-data";
    FileUtils.stringToFile(basepath + "/in/foo.txt", text);

    Thread.sleep(3000);

    String result =
        FileUtils.readFileToString(FileUtils.newFile(basepath, "out/foo.txt.processed"), "UTF8");
    assertEquals(text, result);
  }
  @Test
  public void testStreamingFromFileToTcp() throws Exception {
    String text =
        "\nblah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah "
            + "\nblah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah "
            + "\nblah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah "
            + "\nblah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah\n\n";

    String basepath = muleContext.getConfiguration().getWorkingDirectory() + "/test-data";

    FileUtils.stringToFile(basepath + "/in/foo.txt", text);

    File file = FileUtils.newFile(basepath, "out/foo.txt.processed");

    PollingProber pollingProber = new PollingProber(5000, 10);
    pollingProber.check(new FileExists(file));

    String result = FileUtils.readFileToString(file, "UTF8");
    assertEquals(text, result);
  }