@Test
public void testImportJobValidation() {
ImportJobConfiguration configuration;
Validation validation;
// Empty form is not allowed
configuration = new ImportJobConfiguration();
validation = validator.validateJob(MJob.Type.IMPORT, configuration);
assertEquals(Status.UNACCEPTABLE, validation.getStatus());
assertTrue(validation.getMessages().containsKey(new Validation.FormInput("output.outputDirectory")));
// Explicitly setting extractors and loaders
configuration = new ImportJobConfiguration();
configuration.output.outputDirectory = "/czech/republic";
configuration.throttling.extractors = 3;
configuration.throttling.loaders = 3;
validation = validator.validateJob(MJob.Type.IMPORT, configuration);
assertEquals(Status.FINE, validation.getStatus());
assertEquals(0, validation.getMessages().size());
// Negative and zero values for extractors and loaders
configuration = new ImportJobConfiguration();
configuration.output.outputDirectory = "/czech/republic";
configuration.throttling.extractors = 0;
configuration.throttling.loaders = -1;
validation = validator.validateJob(MJob.Type.IMPORT, configuration);
assertEquals(Status.UNACCEPTABLE, validation.getStatus());
assertTrue(validation.getMessages().containsKey(new Validation.FormInput("throttling.extractors")));
assertTrue(validation.getMessages().containsKey(new Validation.FormInput("throttling.loaders")));
}