mirror of
https://github.com/apache/sqoop.git
synced 2025-05-21 19:31:13 +08:00
SQOOP-2219: Sqoop2: Skip missing input in DirectoryExistsValidator
(Jarek Jarcec Cecho via Abraham Elmahrek)
This commit is contained in:
parent
1abf38d631
commit
639fdbe0a2
@ -17,6 +17,7 @@
|
||||
*/
|
||||
package org.apache.sqoop.validation.validators;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.sqoop.validation.Status;
|
||||
|
||||
import java.io.File;
|
||||
@ -27,6 +28,10 @@
|
||||
public class DirectoryExistsValidator extends AbstractValidator<String> {
|
||||
@Override
|
||||
public void validate(String filePath) {
|
||||
if(StringUtils.isBlank(filePath)) {
|
||||
return;
|
||||
}
|
||||
|
||||
File file = new File(filePath);
|
||||
|
||||
if(!file.exists()) {
|
||||
|
@ -38,6 +38,19 @@ public void setUp() {
|
||||
assertEquals(0, validator.getMessages().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNull() {
|
||||
validator.validate(null);
|
||||
assertEquals(Status.OK, validator.getStatus());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEmpty() {
|
||||
validator.validate("");
|
||||
assertEquals(Status.OK, validator.getStatus());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testExistingDirectory() {
|
||||
File tmpDir = Files.createTempDir();
|
||||
|
Loading…
Reference in New Issue
Block a user