Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * $Id: SftpCantCreateTempDirectoryTestCase.java 23824 2012-02-06 17:47:44Z evangelinamrm $
  * --------------------------------------------------------------------------------------
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
  *
  * 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.assertTrue;
Tests that files are not deleted if the temp directory can't be created
    private static final int EXCEPTION_TIMEOUT = 3000;
    private static String INBOUND_ENDPOINT_NAME = "inboundEndpoint";
    public SftpCantCreateTempDirectoryTestCase(ConfigVariant variantString configResources)
    {
        super(variantconfigResources);
    }
    @Parameters
    public static Collection<Object[]> parameters()
    {
        return Arrays.asList(new Object[][]{
            {."dataintegrity/sftp-dataintegrity-common-with-tempdir-config-service.xml"},
            {."dataintegrity/sftp-dataintegrity-common-with-tempdir-config-flow.xml"}});
    }
    public void before() throws Exception
    {
        super.before();
    }
    // Commented because it's failing even though the test is excluded
    //@After
    public void after() throws Exception
    {
        Runtime.getRuntime().exec(new String[]{"chmod""777"});
        .disconnect();
    }

    
No write access on the outbound directory and thus the TEMP directory cant be created. The source file should still exist
    @Test
    public void testCantCreateTempDirectory() throws Exception
    {
        MuleClient muleClient = new MuleClient();
        Runtime.getRuntime().exec(new String[]{"chmod""320"});
        final CountDownLatch exceptionLatch = new CountDownLatch(1);
        .registerListener(new LatchDownExceptionListener(exceptionLatch));
        muleClient.dispatch("sftp://localhost:" + .getNumber() + "/" + ,
            );
        assertTrue(exceptionLatch.await(.));
    }
New to GrepCode? Check out our FAQ X