Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * $Id: AbstractSftpDataIntegrityTestCase.java 23812 2012-02-03 13:17:37Z asequeira $
  * --------------------------------------------------------------------------------------
  * 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.assertFalse;
import static org.junit.Assert.assertTrue;
    protected static final String TEMP_DIR = "uploading";
    public AbstractSftpDataIntegrityTestCase(ConfigVariant variantString configResources)
    {
        super(variantconfigResources);
    }
    protected void verifyInAndOutFiles(MuleClient muleClient,
                                       String inboundEndpointName,
                                       String outboundEndpointName,
                                       boolean shouldInboundFileStillExist,
                                       boolean shouldOutboundFileExistthrows IOException
    {
        SftpClient sftpClientInbound = getSftpClient(muleClientinboundEndpointName);
        SftpClient sftpClientOutbound = getSftpClient(muleClientoutboundEndpointName);
        try
        {
            ImmutableEndpoint inboundEndpoint = (ImmutableEndpointmuleClient.getProperty(inboundEndpointName);
            ImmutableEndpoint outboundEndpoint = (ImmutableEndpointmuleClient.getProperty(outboundEndpointName);
            if (shouldInboundFileStillExist)
            {
                assertTrue("The inbound file should still exist",
                    super.verifyFileExists(sftpClientInboundinboundEndpoint.getEndpointURI(), ));
            }
            else
            {
                assertFalse("The inbound file should have been deleted",
                    super.verifyFileExists(sftpClientInboundinboundEndpoint.getEndpointURI(), ));
            }
            if (shouldOutboundFileExist)
            {
                assertTrue("The outbound file should exist",
                    super.verifyFileExists(sftpClientOutboundoutboundEndpoint.getEndpointURI(), ));
            }
            else
            {
                assertFalse("The outbound file should have been deleted",
                    super.verifyFileExists(sftpClientOutboundoutboundEndpoint.getEndpointURI(), ));
            }
        }
        finally
        {
            sftpClientInbound.disconnect();
            sftpClientOutbound.disconnect();
        }
    }
New to GrepCode? Check out our FAQ X