// Job list should start out empty.
List<String> jobs = storage.list();
assertEquals(0, jobs.size());
// Create a job that displays the version.
JobData data = new JobData(new SqoopOptions(), new VersionTool());
storage.create("versionJob", data);
jobs = storage.list();
assertEquals(1, jobs.size());
assertEquals("versionJob", jobs.get(0));
// Try to create that same job name again. This should fail.
try {
storage.create("versionJob", data);
fail("Expected IOException; this job already exists.");
} catch (IOException ioe) {
// This is expected; continue operation.
}
jobs = storage.list();
assertEquals(1, jobs.size());
// Restore our job, check that it exists.
JobData outData = storage.read("versionJob");
assertEquals(new VersionTool().getToolName(),
outData.getSqoopTool().getToolName());
// Try to restore a job that doesn't exist. Watch it fail.
try {
storage.read("DoesNotExist");