public abstract class AbstractSftpTestCase extends AbstractServiceAndFlowTestCase
Modifier and Type | Class and Description |
---|---|
class |
AbstractSftpTestCase.DispatchParameters
Helper class for dynamic assignment of parameters to the method
dispatchAndWaitForDelivery() Only inboundEndpoint and outboundEndpoint are
mandatory, the rest of the parameters are optional.
|
AbstractServiceAndFlowTestCase.ConfigVariant
Modifier and Type | Field and Description |
---|---|
protected static String |
FILENAME |
protected static String |
INBOUND_ENDPOINT_DIR |
protected static Map<String,Object> |
MESSAGE_PROPERTIES |
protected static String |
OUTBOUND_ENDPOINT_DIR |
DynamicPort |
port |
protected SftpClient |
sftpClient |
protected SftpServer |
sftpServer |
configResources, variant
callbackCalled, CLASSNAME_ANNOTATIONS_CONFIG_BUILDER, IGNORED_DOT_MULE_DIRS, LOCK_TIMEOUT, muleContext, RECEIVE_TIMEOUT, TEST_MESSAGE, TEST_PAYLOAD, WORKING_DIRECTORY_SYSTEM_PROPERTY_KEY, workingDirectory
DEFAULT_TEST_TIMEOUT_SECS, globalTimeout, logger, name, TEST_TIMEOUT_SYSTEM_PROPERTY, TESTING_MODE_PROPERTY_NAME
Constructor and Description |
---|
AbstractSftpTestCase(AbstractServiceAndFlowTestCase.ConfigVariant variant,
String configResources) |
Modifier and Type | Method and Description |
---|---|
protected void |
assertFilesInEndpoint(String endpointName,
String expectedFile)
Asserts that only the expectedFile is found on the path that the
endpointName use, where filenames can be expressed as a regular
expression.
|
protected void |
assertFilesInEndpoint(String endpointName,
String[] expectedFiles)
Asserts that only the expectedFiles are found on the path that the
endpointName use, where filenames can be expressed as a regular
expression.
|
protected void |
assertFilesInEndpoint(String endpointName,
String subDirectory,
String expectedFile)
Asserts that only the expectedFile is found on the sub directory
subDirectory under the path that endpointName use, where
filenames can be expressed as a regular expression.
|
protected void |
assertFilesInEndpoint(String endpointName,
String subDirectory,
String[] expectedFiles)
Asserts that only the expectedFiles are found on the sub directory
subDirectory under the path that endpointName use, where
filenames can be expressed as a regular expression.
|
protected void |
assertFilesInLocalFilesystem(String path,
String expectedFile)
Asserts that only the expectedFile is found on the path path,
where filenames can be expressed as a regular expression.
|
protected void |
assertFilesInLocalFilesystem(String path,
String[] expectedFiles)
Asserts that only the expectedFiles are found on the path path,
where filenames can be expressed as a regular expression.
|
protected void |
assertNoFilesInEndpoint(String endpointName)
Asserts that no files are found on the path that the endpointName use.
|
protected void |
assertNoFilesInEndpoint(String endpointName,
String subDirectory)
Asserts that no files are found on the sub directory subDirectory under
the path that endpointName use.
|
protected void |
assertNoFilesInLocalFilesystem(String path)
Asserts that there are no files found on the path path.
|
void |
checkConnectors()
Check that all of the connectors are running.
|
protected void |
createRemoteDirectory(String endpointName,
String directoryName)
Creates the directoryName under the endpoint path
|
protected void |
dispatchAndWaitForDelivery(AbstractSftpTestCase.DispatchParameters p)
Helper method for initiating a test and wait for the test to complete.
|
protected Exception |
dispatchAndWaitForException(AbstractSftpTestCase.DispatchParameters p,
String expectedFailingConnector) |
protected Exception |
dispatchAndWaitForException(AbstractSftpTestCase.DispatchParameters p,
String expectedFailingConnector,
String serviceName)
Helper method for initiating a test and wait for an exception to be caught by
the sftp-connector.
|
protected void |
doSetUpBeforeMuleContextCreation() |
protected void |
executeBaseAssertionsAfterCall(int sendSize,
int receivedSize)
To be overridden by the test-classes if required
|
protected void |
executeBaseAssertionsBeforeCall()
To be overridden by the test-classes if required
|
protected void |
executeBaseTest(String inputEndpointName,
String sendUrl,
String filename,
int size,
String receivingTestComponentName,
long timeout)
Base method for executing tests...
|
protected void |
executeBaseTest(String inputEndpointName,
String sendUrl,
String filename,
int size,
String receivingTestComponentName,
long timeout,
String expectedFailingConnector) |
protected void |
executeBaseTest(String inputEndpointName,
String sendUrl,
String filename,
int size,
String receivingTestComponentName,
long timeout,
String expectedFailingConnector,
String serviceName)
Base method for executing tests...
|
protected String |
getAddressByEndpoint(String endpointName) |
protected ImmutableEndpoint |
getImmutableEndpoint(String endpointName) |
protected String |
getPathByEndpoint(SftpClient client,
String endpointName) |
protected SftpClient |
getSftpClient(String endpointName)
Returns a SftpClient that is logged in to the sftp server that the endpoint is
configured against.
|
protected SftpClient |
getSftpClient(String host,
int clientPort,
String user,
String password)
Returns a SftpClient that is logged in to the sftp server that the endpoint is
configured against.
|
protected EndpointURI |
getUriByEndpointName(String endpointName) |
protected void |
initEndpointDirectories(String[] serviceNames,
String[] endpointNames)
Initiates a list of sftp-endpoint-directories.
|
protected void |
initEndpointDirectory(String endpointName)
Ensures that the directory exists and is writable by deleting the directory
and then recreate it.
|
protected void |
recursiveDelete(SftpClient client,
String endpointName,
String relativePath)
Deletes a directory with all its files and sub-directories.
|
protected void |
recursiveDeleteInLocalFilesystem(File parent) |
protected void |
remoteChmod(SftpClient client,
String endpointName,
int permissions) |
protected boolean |
startServerOnStartUp() |
protected void |
startSftpServerAndClient() |
protected void |
stopSftpServerAndClient() |
protected boolean |
verifyFileExists(SftpClient client,
EndpointURI endpointURI,
String file)
Checks if the file exists on the server
|
protected boolean |
verifyFileExists(SftpClient client,
String path,
String file) |
doSetUp, doSetUpForFlow, doSetUpForService, getConfigFile, getConfigFiles, getTestHeader
clearFlowAssertions, getBuilder, getComponent, getComponent, getConfigResources, getFlowConstruct, getFunctionalTestComponent, getSubFlow, loadResource, loadResourceAsString, lookupFlowConstruct, runFlow, runFlow, runFlow, runFlowAndExpect, runFlowAndExpectProperty, runFlowNonBlocking, runFlowNonBlocking, runFlowNonBlocking, runFlowWithPayloadAndExpect, runSchedulersOnce, stopFlowConstruct, stopFlowSchedulers, testFlow, testFlow, testFlowNonBlocking, testFlowNonBlocking
addBuilders, configureMuleContext, createMuleContext, createObject, createObject, disposeContext, disposeContextPerTest, doTearDown, doTearDownAfterMuleContextDispose, getConfigurationResources, getFileInsideWorkingDirectory, getNonBlockingResponse, getNonBlockingTestEventUsingFlow, getSensingNullMessageProcessor, getStartUpProperties, getTestConnector, getTestEvent, getTestEvent, getTestEvent, getTestEvent, getTestEvent, getTestEvent, getTestEvent, getTestEvent, getTestEventContext, getTestEventContext, getTestEventUsingFlow, getTestInboundEndpoint, getTestInboundEndpoint, getTestInboundEndpoint, getTestInboundEndpoint, getTestInboundEndpoint, getTestMuleMessage, getTestMuleMessage, getTestOutboundEndpoint, getTestOutboundEndpoint, getTestOutboundEndpoint, getTestOutboundEndpoint, getTestOutboundEndpoint, getTestService, getTestService, getTestService, getTestSession, getTestTransactedInboundEndpoint, getTestTransformer, getTriggerableMessageSource, getTriggerableMessageSource, getWorkingDirectory, initialiseObject, isDisposeContextPerClass, isGracefulShutdown, isStartContext, setDisposeContextPerClass, setStartContext, setUpMuleContext
clearExcludedFlag, clearRequestContext, clearTestCaseName, createTestTimeoutRule, dumpFilteredThreadsInTest, getTestTimeoutSecs, getTimeoutSystemProperty, initializeMuleTest, isDisabledInThisEnvironment, isDisabledInThisEnvironment, isExcluded, isFailOnTimeout, isOffline, isTestIncludedInExclusionFile, takeTestCaseName
protected static String INBOUND_ENDPOINT_DIR
protected static String OUTBOUND_ENDPOINT_DIR
protected static final String FILENAME
public DynamicPort port
protected SftpServer sftpServer
protected SftpClient sftpClient
public AbstractSftpTestCase(AbstractServiceAndFlowTestCase.ConfigVariant variant, String configResources)
protected void recursiveDelete(SftpClient client, String endpointName, String relativePath) throws IOException
endpointName
- relativePath
- IOException
protected void createRemoteDirectory(String endpointName, String directoryName) throws IOException
IOException
protected EndpointURI getUriByEndpointName(String endpointName) throws IOException
IOException
protected String getAddressByEndpoint(String endpointName)
protected String getPathByEndpoint(SftpClient client, String endpointName)
protected SftpClient getSftpClient(String endpointName) throws IOException
IOException
protected SftpClient getSftpClient(String host, int clientPort, String user, String password) throws IOException
IOException
protected boolean verifyFileExists(SftpClient client, EndpointURI endpointURI, String file) throws IOException
IOException
protected boolean verifyFileExists(SftpClient client, String path, String file) throws IOException
IOException
protected void executeBaseTest(String inputEndpointName, String sendUrl, String filename, int size, String receivingTestComponentName, long timeout) throws Exception
Exception
protected void executeBaseTest(String inputEndpointName, String sendUrl, String filename, int size, String receivingTestComponentName, long timeout, String expectedFailingConnector) throws Exception
Exception
protected void executeBaseTest(String inputEndpointName, String sendUrl, String filename, int size, String receivingTestComponentName, long timeout, String expectedFailingConnector, String serviceName) throws Exception
Exception
protected void executeBaseAssertionsBeforeCall()
protected void executeBaseAssertionsAfterCall(int sendSize, int receivedSize)
protected ImmutableEndpoint getImmutableEndpoint(String endpointName) throws IOException
IOException
protected void remoteChmod(SftpClient client, String endpointName, int permissions) throws com.jcraft.jsch.SftpException
com.jcraft.jsch.SftpException
protected void initEndpointDirectories(String[] serviceNames, String[] endpointNames) throws Exception
serviceNames
- endpointNames
- Exception
protected void initEndpointDirectory(String endpointName) throws MuleException, IOException, com.jcraft.jsch.SftpException
endpointName
- MuleException
IOException
com.jcraft.jsch.SftpException
protected void dispatchAndWaitForDelivery(AbstractSftpTestCase.DispatchParameters p)
p
- where inboundEndpoint and outboundEndpoint are mandatory, @see
DispatchParameters for details.protected Exception dispatchAndWaitForException(AbstractSftpTestCase.DispatchParameters p, String expectedFailingConnector)
protected Exception dispatchAndWaitForException(AbstractSftpTestCase.DispatchParameters p, String expectedFailingConnector, String serviceName)
p
- where sftpConnector and inboundEndpoint are mandatory, @see
DispatchParameters for details.protected void recursiveDeleteInLocalFilesystem(File parent) throws IOException
IOException
protected void assertNoFilesInLocalFilesystem(String path) throws IOException
path
- The path in the local filesystem to checkIOException
- Exceptionprotected void assertNoFilesInEndpoint(String endpointName) throws IOException
endpointName
- The endpoint nameIOException
- Exceptionprotected void assertNoFilesInEndpoint(String endpointName, String subDirectory) throws IOException
endpointName
- The endpoint namesubDirectory
- The sub directoryIOException
- Exceptionprotected void assertFilesInLocalFilesystem(String path, String expectedFile) throws IOException
path
- The path in the local filesystem to checkexpectedFile
- Expected fileIOException
- Exceptionprotected void assertFilesInLocalFilesystem(String path, String[] expectedFiles) throws IOException
path
- The path in the local filesystem to checkexpectedFiles
- Expected filesIOException
- Exceptionprotected void assertFilesInEndpoint(String endpointName, String expectedFile) throws IOException
endpointName
- The endpoint nameexpectedFile
- Expected fileIOException
- Exceptionprotected void assertFilesInEndpoint(String endpointName, String[] expectedFiles) throws IOException
endpointName
- The endpoint nameexpectedFiles
- Expected filesIOException
- Exceptionprotected void assertFilesInEndpoint(String endpointName, String subDirectory, String expectedFile) throws IOException
endpointName
- The endpoint namesubDirectory
- The sub directoryexpectedFile
- Expected filesIOException
- Exceptionprotected void assertFilesInEndpoint(String endpointName, String subDirectory, String[] expectedFiles) throws IOException
endpointName
- The endpoint namesubDirectory
- The sub directoryexpectedFiles
- Expected filesIOException
- Exceptionpublic void checkConnectors()
protected void doSetUpBeforeMuleContextCreation() throws Exception
doSetUpBeforeMuleContextCreation
in class AbstractMuleContextTestCase
Exception
protected boolean startServerOnStartUp()
protected void startSftpServerAndClient() throws IOException
IOException
Copyright © 2003–2016 MuleSoft, Inc.. All rights reserved.