public class ReplicationTest extends StorageTest
copy
method.
The test starts two storage servers and a test naming server. It then checks
properties of the copy
method.
Properties checked are:
copy
rejects null
for any of its
arguments.copy
rejects source directories and non-existent source
files.copy
correctly creates new destination files and their
parent directories.copy
correctly replaces existing destination files.Modifier and Type | Field and Description |
---|---|
private Path |
create_path
File to be copied.
|
static java.lang.String |
notice
Test notice.
|
static java.lang.Class[] |
prerequisites
Prerequisites.
|
private Path |
replace_path
File to be copied.
|
private TemporaryDirectory |
second_directory
Second temporary directory for the second (source) storage server.
|
private StorageServer |
second_server
Second (source) storage server.
|
private Storage |
second_stub
Client service interface for the second storage server.
|
client_stub, command_stub, directory, naming_server, naming_stub
Constructor and Description |
---|
ReplicationTest()
Creates the
ReplicationTest object. |
Modifier and Type | Method and Description |
---|---|
protected void |
clean()
Stops all servers and removes all temporary directories.
|
protected void |
initialize()
Initializes the test.
|
protected void |
perform()
Tests the copy method.
|
private void |
testBadValues()
Tests that the
copy method rejects bad arguments such as
null . |
private void |
testCreation()
Checks that the
copy method correctly creates new files. |
private void |
testReplacement()
Checks that the
copy method correctly replaces existing
files. |
cleanupFailure, cleanupSuccess, failure, success, task, task
public static final java.lang.String notice
public static final java.lang.Class[] prerequisites
private TemporaryDirectory second_directory
private StorageServer second_server
private Storage second_stub
private final Path replace_path
private final Path create_path
protected void perform() throws TestFailed
perform
in class Test
TestFailed
- If any of the tests fail.private void testCreation() throws TestFailed
copy
method correctly creates new files.TestFailed
- If the test fails.private void testReplacement() throws TestFailed
copy
method correctly replaces existing
files.TestFailed
- If the test fails.private void testBadValues() throws TestFailed
copy
method rejects bad arguments such as
null
.TestFailed
- If any of the tests fail.protected void initialize() throws TestFailed
This implementation calls the superclass implementation, and additionally creates a second temporary directory and starts a second storage server.
initialize
in class StorageTest
TestFailed
- If initialization fails.protected void clean()
This implementation stops the second storage server and removes its temporary directory, in addition to calling the superclass implementation.
clean
in class StorageTest