1   /*
2    * $Id: FileMessageReceiverTestCase.java 7963 2007-08-21 08:53:15Z dirk.olmes $
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  
11  package org.mule.providers.file;
12  
13  import org.mule.impl.endpoint.MuleEndpoint;
14  import org.mule.tck.MuleTestUtils;
15  import org.mule.tck.providers.AbstractMessageReceiverTestCase;
16  import org.mule.umo.UMOComponent;
17  import org.mule.umo.endpoint.UMOEndpoint;
18  import org.mule.umo.provider.UMOMessageReceiver;
19  import org.mule.util.FileUtils;
20  
21  import com.mockobjects.dynamic.Mock;
22  
23  import java.io.File;
24  
25  public class FileMessageReceiverTestCase extends AbstractMessageReceiverTestCase
26  {
27      File read = FileUtils.newFile("testcasedata/read");
28      File move = FileUtils.newFile("testcasedata/move");
29      Mock session = MuleTestUtils.getMockSession();
30  
31      public void testReceiver() throws Exception
32      {
33          // FIX A bit hard testing receive from a unit simple as we need to reg
34          // listener etc.
35          // file endpoint functions tests for this
36      }
37  
38      /*
39       * (non-Javadoc)
40       * 
41       * @see org.mule.tck.providers.AbstractMessageReceiverTestCase#getMessageReceiver()
42       */
43      public UMOMessageReceiver getMessageReceiver() throws Exception
44      {
45          endpoint.getConnector().startConnector();
46          Mock mockComponent = new Mock(UMOComponent.class);
47          read.deleteOnExit();
48          move.deleteOnExit();
49  
50          return new FileMessageReceiver(endpoint.getConnector(), (UMOComponent)mockComponent.proxy(),
51              endpoint, read.getAbsolutePath(), move.getAbsolutePath(), null, 1000);
52      }
53  
54      public UMOEndpoint getEndpoint() throws Exception
55      {
56          return new MuleEndpoint("file://./simple", true);
57      }
58  }