public class ReplicationTest extends NamingTest
This test registers a storage server with a single file, and a second storage server with no files. It then accesses the file a large number of times. By the time all the accesses are complete, the naming server should have issued a command to the second server to copy the file from the first server. The "accesses" are performed by locking the file for shared access.
After testing replication in the manner described above, the test then locks the file for exclusive access. The file should now be deleted from exactly one of the two storage servers.
Modifier and Type | Class and Description |
---|---|
private class |
ReplicationTest.InvalidationStorageServer
Storage server expecting to be (potentially) notified that the file may
be deleted.
|
private class |
ReplicationTest.MirrorStorageServer
Storage server expecting a request to copy the file.
|
Modifier and Type | Field and Description |
---|---|
private static int |
ACCESS_COUNT
Number of shared access requests to make in order to cause the file to
be replicated.
|
private ReplicationTest.InvalidationStorageServer |
hosting_server
Storage server hosting the initial copy of the file.
|
private Storage |
hosting_stub
Stub for the storage server initially hosting the file.
|
private boolean |
invalidated
Indicates that the file has been invalidated.
|
private ReplicationTest.MirrorStorageServer |
mirror_server
Storage server receiving the replicated copy of the file.
|
static java.lang.String |
notice
Test notice.
|
static java.lang.Class[] |
prerequisites
Prerequisites.
|
private Path |
replicate_file
File to be replicated.
|
private boolean |
replicated
Indicates that the file has been replicated.
|
private boolean |
wake_all
Indicates that all waiting threads should terminate.
|
registration_stub, service_stub
Constructor and Description |
---|
ReplicationTest() |
Modifier and Type | Method and Description |
---|---|
protected void |
clean()
Stops the storage servers and wakes any waiting threads.
|
protected void |
initialize()
Starts the two storage servers.
|
protected void |
perform()
Performs the test.
|
cleanupFailure, cleanupSuccess, failure, success, task, task
public static final java.lang.String notice
public static final java.lang.Class[] prerequisites
private ReplicationTest.InvalidationStorageServer hosting_server
private ReplicationTest.MirrorStorageServer mirror_server
private Storage hosting_stub
private final Path replicate_file
private boolean replicated
private boolean invalidated
private boolean wake_all
private static final int ACCESS_COUNT
protected void perform() throws TestFailed
perform
in class Test
TestFailed
protected void initialize() throws TestFailed
initialize
in class NamingTest
TestFailed
- If the naming server cannot be started, or if the
stubs cannot be created.protected void clean()
clean
in class NamingTest