1   /*
2    * $Id: FileToTcpStreamingTestCase.java 11343 2008-03-13 10:58:26Z tcarlson $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  package org.mule.test.integration.streaming;
11  
12  
13  import org.mule.tck.FunctionalTestCase;
14  import org.mule.util.FileUtils;
15  
16  public class FileToTcpStreamingTestCase extends FunctionalTestCase
17  {
18      // @Override
19      protected void doTearDown() throws Exception
20      {
21          FileUtils.deleteDirectory(FileUtils.newFile(muleContext.getConfiguration().getWorkingDirectory() + "/test-data"));
22      }
23  
24      // @Override
25      protected String getConfigResources()
26      {
27          return "org/mule/test/integration/streaming/file-to-tcp-streaming.xml";
28      }
29  
30      public void testStreamingFromFileToTcp() throws Exception
31      {
32          String text = "\nblah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah " +
33                  "\nblah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah " +
34                  "\nblah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah " +
35                  "\nblah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah\n\n";
36  
37          String basepath = muleContext.getConfiguration().getWorkingDirectory() + "/test-data";
38          FileUtils.stringToFile(basepath + "/in/foo.txt", text);
39  
40          Thread.sleep(3000);
41  
42          String result = FileUtils.readFileToString(FileUtils.newFile(basepath, "out/foo.txt.processed"), "UTF8");
43          assertEquals(text, result);
44      }
45  }