public class StubRetrievalTest extends NamingTest
getStorage
method returns the
correct storage server stubs.
Items checked are:
getStorage
rejects bad arguments such as null
,
non-existent files, and paths to directories.getStorage
returns stubs for storage servers that are
indeed hosting the file being requested.Modifier and Type | Field and Description |
---|---|
private Path |
file1 |
private Path |
file2 |
private Path |
file3 |
private Path |
file4 |
static java.lang.String |
notice
Test notice.
|
static java.lang.Class[] |
prerequisites
Prerequisites.
|
private TestStorageServer |
server1
First registering storage server.
|
private Storage |
server1_stub
First storage server stub.
|
private TestStorageServer |
server2
Second registering storage server.
|
private Storage |
server2_stub
Second storage server stub.
|
registration_stub, service_stub
Constructor and Description |
---|
StubRetrievalTest()
Creates the
StubRetrievalTest and sets the notice. |
Modifier and Type | Method and Description |
---|---|
private void |
checkArguments()
Checks that the
getStorage method rejects bad arguments. |
private void |
checkStub(Path path,
Storage expected_stub)
Checks that the naming server returns the correct storage server stub
for the given file.
|
protected void |
clean()
Stops all servers used in the test.
|
protected void |
initialize()
Starts servers used in the test.
|
protected void |
perform()
Performs the tests.
|
cleanupFailure, cleanupSuccess, failure, success, task, task
public static final java.lang.String notice
public static final java.lang.Class[] prerequisites
private TestStorageServer server1
private TestStorageServer server2
private Storage server1_stub
private Storage server2_stub
private final Path file1
private final Path file2
private final Path file3
private final Path file4
public StubRetrievalTest()
StubRetrievalTest
and sets the notice.protected void perform() throws TestFailed
perform
in class Test
TestFailed
- If any of the tests fail.private void checkStub(Path path, Storage expected_stub) throws TestFailed
path
- The file for which the stub is to be requested.expected_stub
- The stub expected to be received.TestFailed
- If the stub cannot be retrieved, or if the stub
retrieved is not the stub expected.private void checkArguments() throws TestFailed
getStorage
method rejects bad arguments.TestFailed
- If the test fails.protected void initialize() throws TestFailed
initialize
in class NamingTest
TestFailed
- If any of the servers cannot be started.protected void clean()
clean
in class NamingTest