Issue Details (XML | Word | Printable)

Key: SFTP-24
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Magnus Larsson
Reporter: Magnus Larsson
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
SFTP Transport Project

Add assert methods to test-baseclass to simplify assertions of files-existence

Created: 13/Jan/10 11:33 AM   Updated: 13/Jan/10 11:41 AM
Component/s: Test
Affects Version/s: 2.2.1-RC1
Fix Version/s: 2.2.1-RC2

Time Tracking:
Not Specified

Labels:
User impact: Medium
Similar Issues:


 Description  « Hide
One very important aspect of writing tests for the sftp-connector is to assert that the expected files exist in the expected places after a test, specifically after a negative test...

To standardize and simplify this type of test code it is suggested to add a set of assert methods in the test baseclass. AbstractSftpTestCase.



 All   Comments   Work Log   Change History   Transitions   FishEye      Sort Order: Ascending order - Click to sort in descending order
Magnus Larsson added a comment - 13/Jan/10 11:41 AM
The following methods has been added
  • protected void recursiveDeleteInLocalFilesystem(File parent) {
  • protected void assertNoFilesInLocalFilesystem(String path) throws IOException {
  • protected void assertNoFilesInEndpoint(MuleClient muleClient, String endpointName) throws IOException {
  • protected void assertNoFilesInEndpoint(MuleClient muleClient, String endpointName, String subDirectory) throws IOException {
  • protected void assertFilesInLocalFilesystem(String path, String expectedFile) throws IOException {
  • protected void assertFilesInLocalFilesystem(String path, String[] expectedFiles) throws IOException {
  • protected void assertFilesInEndpoint(MuleClient muleClient, String endpointName, String expectedFile) throws IOException {
  • protected void assertFilesInEndpoint(MuleClient muleClient, String endpointName, String[] expectedFiles) throws IOException {
  • protected void assertFilesInEndpoint(MuleClient muleClient, String endpointName, String subDirectory, String expectedFile) throws IOException {
  • protected void assertFilesInEndpoint(MuleClient muleClient, String endpointName, String subDirectory, String[] expectedFiles) throws IOException {

See JavaDoc for details, note however that the expected file/files can contain reg-exp's, i.e. "file-.+" for a filename that starts with "file-".

See SftpArchiveFunctionalTestCase.java for exmaples on usage of the new methods.