View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.test.integration.transport.file;
8   
9   import org.mule.module.client.MuleClient;
10  import org.mule.util.FileUtils;
11  
12  import java.io.File;
13  
14  import static org.junit.Assert.assertFalse;
15  
16  public class FileAppendEndpointTestCase extends FileAppendConnectorTestCase
17  {
18  
19      @Override
20      protected String getConfigResources()
21      {
22          return "org/mule/test/integration/providers/file/mule-fileappend-endpoint-config.xml";
23      }    
24  
25      @Override
26      public void testBasic() throws Exception
27      {
28          File myDir = FileUtils.newFile(OUTPUT_DIR);
29  
30          // output directory may not exist before dispatching to the endpoint with invalid
31          // configuration
32          File outputFile = FileUtils.newFile(myDir, OUTPUT_FILE);
33          assertFalse(outputFile.exists());
34          
35          // this should throw java.lang.IllegalArgumentException: Configuring 'outputAppend' on a 
36          // file endpoint is no longer supported. You may configure it on a file connector instead.
37          MuleClient client = new MuleClient(muleContext);
38          client.dispatch("vm://fileappend", "Hello1", null);
39  
40          assertFalse(outputFile.exists());
41      }
42  }