コード例 #1
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);
  }
コード例 #2
0
  @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);
  }