public class CreationTest extends NamingTest
This test starts a naming server and a test storage server. Items checked are:
createFile
and createDirectory
reject bad
arguments such as null
pointers, paths to existing objects,
and paths to objects whose parents do not exist.createDirectory
correctly creates directories on the
naming server.
createFile
correctly creates files on the naming server,
and new files are then created on the connected storage server. The test
does not succeed until the storage server has received the request to
create the file on its local filesystem.
Modifier and Type | Class and Description |
---|---|
private class |
CreationTest.CreationTestStorageServer
Storage server for the creation test.
|
Modifier and Type | Field and Description |
---|---|
private Path |
expect_file
File that the storage server is expecting to be commanded to create by
the naming server.
|
private boolean |
file_created
Indicates that the file
expect_file has been created on the
storage server by command from the naming server. |
static java.lang.String |
notice
Test notice.
|
static java.lang.Class[] |
prerequisites
Prerequisites.
|
private CreationTest.CreationTestStorageServer |
storage_server
Storage server used in the test.
|
private boolean |
wake_all
Indicates that all wait loops should be terminated.
|
registration_stub, service_stub
Constructor and Description |
---|
CreationTest()
Creates the
CreationTest and sets the notice. |
Modifier and Type | Method and Description |
---|---|
protected void |
clean()
Stops all servers used in the test and unblocks any waiting threads.
|
protected void |
initialize()
Starts servers used in the test.
|
protected void |
perform()
Runs all the tests.
|
private void |
testCreateDirectoryArguments()
Checks that the
createDirectory method rejects invalid
arguments. |
private void |
testCreateFileArguments()
Checks that the
createFile method rejects invalid
arguments. |
private void |
testDirectoryCreation(Path directory)
Tests that valid requests to create a directory cause a directory to be
created on the naming server.
|
private void |
testFileCreation(Path file)
Tests that valid requests to create a file cause a file to be created on
the naming server and on the storage server.
|
cleanupFailure, cleanupSuccess, failure, success, task, task
public static final java.lang.String notice
public static final java.lang.Class[] prerequisites
private CreationTest.CreationTestStorageServer storage_server
private Path expect_file
private boolean file_created
expect_file
has been created on the
storage server by command from the naming server.private boolean wake_all
protected void perform() throws TestFailed
perform
in class Test
TestFailed
- If any of the tests fail.private void testFileCreation(Path file) throws TestFailed
file
- The path to the file to be created.TestFailed
- If the file is not created on either the naming or
the storage server.private void testDirectoryCreation(Path directory) throws TestFailed
directory
- Path to the directory.TestFailed
- If the directory is not created.private void testCreateDirectoryArguments() throws TestFailed
createDirectory
method rejects invalid
arguments.TestFailed
- If the test fails.private void testCreateFileArguments() throws TestFailed
createFile
method rejects invalid
arguments.TestFailed
- If the test fails.protected void initialize() throws TestFailed
initialize
in class NamingTest
TestFailed
- If the servers cannot be started.protected void clean()
clean
in class NamingTest