Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  * $Id: 22475 2011-07-20 14:30:04Z justin.calleja $
  * --------------------------------------------------------------------------------------
  * Copyright (c) MuleSoft, Inc.  All rights reserved.
  * The software in this package is published under the terms of the CPAL v1.0
  * license, a copy of which has been included with this distribution in the
  * LICENSE.txt file.
package org.mule.transport.sftp.dataintegrity;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
Verify that the original file is not lost if the outbound directory doesn't exist
    private static final String OUTBOUND_ENDPOINT_NAME = "outboundEndpoint";
    private static final String INBOUND_ENDPOINT_NAME = "inboundEndpoint";
    public SftpNoWriteAccessToOutboundDirectoryTestCase(ConfigVariant variantString configResources)
    public static Collection<Object[]> parameters()
        return Arrays.asList(new Object[][]{
    protected void doSetUp() throws Exception
        // Delete the in & outbound directories

No write access on the outbound directory. The source file should still exist
    public void testNoWriteAccessToOutboundDirectory() throws Exception
        MuleClient muleClient = new MuleClient();
        SftpClient sftpClient = getSftpClient(muleClient);
            // change the chmod to "dr-x------" on the outbound-directory
            remoteChmod(muleClientsftpClient, 00500);
            // Send an file to the SFTP server, which the inbound-outboundEndpoint
            // then can pick up
                ), "sftp""service");
            assertTrue("expected DispatchException, but got : " + exception.getClass().toString(),
                exception instanceof DispatchException);
            assertTrue("expected IOException, but got : " + exception.getCause().getClass().toString(),
                exception.getCause() instanceof IOException);
            assertEquals("Permission denied"exception.getCause().getMessage());
New to GrepCode? Check out our FAQ X