You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For testing purposes, we need an EmbeddedSftpServer.
Description
The EmbeddedSftpServer will be based on the Apache Mina project. It will support only a fraction of what Apache Mina provides, considering that we, for now, only need to make sure that our components under test cut will be able to transfer the files via either Spring SFTP integration or just using JSch directly.
We need to wrap Apache Mina SSHD so that only the SFTP relevant parts of the interface are being exposed.
For access restricted scenarios, the EmbeddedSftpServer should support readonly, write-only, and arbitrary access configurations and interfaces thereof.
The system should also allow the user to clean up between test cases or to prepare the "remote" with (existing) fixtures.
For read-only scenarios, the fixtures must be transferred up front, or the sftp server instance must be configured so that it will point to the correct location in the filesystem, i.e. where the fixtures exist.
For write-only scenarios, the user must be able to retrieve the data from the "remote" in order to assert whether the transferred data matches the expected data.
Arbitrary access scenarios represent the combination of the above.
There will be both a shared library that can be used stand alone and also an env-provider for the junit-env-extension.
Server port, dynamically assigned via the SocketUtils, and host, which should always be localhost, need to be exposed by these interfaces. The user can then configure his or her cut accordingly.
Provisioning Demarcation
For the purpose of demarcation and subsequently parameter injection we will introduce the SftpEnvProvided annotation. The annotation can only be used on @BeforeAll annotated (static) method parameters.
The annotation will allow the user to have multiple instances of the EmbeddedSftpServer, all configured differently, again allowing the user to run multiple different test scenarios, e.g.
@BeforeAll
public [static] void setUp(@SftpEnvProvided(id=""[, rootDirectory="..."][, defaultAccessMode=RW|RO|WO|DENY][, ...]) sftpServer) {}
where the optional rootDirectory can point to either a directory in the filesystem or a class path resource which is a directory.
Verification
For the purpose of verification, the user can switch the embedded sftp server instance's mode to an arbitrary access mode, in order to be able to fetch data from the server, e.g.
Integrating the mina server with class path resources might be a little bit difficult, though, since it uses its own VirtualFileSystem abstraction.
And so on.
All server instances will be reset to their default modes before each test is run.
Integration with file-assertions
Since all data resides locally in either a user specific root folder or a standard temporary root folder, the sftp server interface must provide for a getter for the root directory, returning a Path object, That way, file-assertions can be used to test whether a file exists or whether its content matches the expected content.
Simulating Delivery PickUp and Rejection Scenarios
Feature Request
Summary
For testing purposes, we need an EmbeddedSftpServer.
Description
The EmbeddedSftpServer will be based on the Apache Mina project. It will support only a fraction of what Apache Mina provides, considering that we, for now, only need to make sure that our components under test
cut
will be able to transfer the files via either Spring SFTP integration or just using JSch directly.We need to wrap Apache Mina SSHD so that only the SFTP relevant parts of the interface are being exposed.
For access restricted scenarios, the EmbeddedSftpServer should support readonly, write-only, and arbitrary access configurations and interfaces thereof.
The system should also allow the user to clean up between test cases or to prepare the "
remote
" with (existing) fixtures.For read-only scenarios, the fixtures must be transferred up front, or the sftp server instance must be configured so that it will point to the correct location in the filesystem, i.e. where the fixtures exist.
For write-only scenarios, the user must be able to retrieve the data from the "
remote
" in order to assert whether the transferred data matches the expected data.Arbitrary access scenarios represent the combination of the above.
There will be both a shared library that can be used stand alone and also an env-provider for the junit-env-extension.
Server port, dynamically assigned via the SocketUtils, and host, which should always be
localhost
, need to be exposed by these interfaces. The user can then configure his or hercut
accordingly.Provisioning Demarcation
For the purpose of demarcation and subsequently parameter injection we will introduce the
SftpEnvProvided
annotation. The annotation can only be used on@BeforeAll
annotated (static) method parameters.The annotation will allow the user to have multiple instances of the EmbeddedSftpServer, all configured differently, again allowing the user to run multiple different test scenarios, e.g.
where the optional rootDirectory can point to either a directory in the filesystem or a class path resource which is a directory.
Verification
For the purpose of verification, the user can switch the embedded sftp server instance's mode to an arbitrary access mode, in order to be able to fetch data from the server, e.g.
or when running a failure scenario, where the remote will reject all connection attempts
Integrating the mina server with class path resources might be a little bit difficult, though, since it uses its own VirtualFileSystem abstraction.
And so on.
All server instances will be reset to their default modes before each test is run.
Integration with file-assertions
Since all data resides locally in either a user specific root folder or a standard temporary root folder, the sftp server interface must provide for a getter for the root directory, returning a Path object, That way, file-assertions can be used to test whether a file exists or whether its content matches the expected content.
Simulating Delivery PickUp and Rejection Scenarios
Currently out of scope.
References
The text was updated successfully, but these errors were encountered: