use of org.apache.nifi.components.ValidationResult in project nifi by apache.
the class TestJettyWebSocketServer method testValidationRequiredProperties.
@Test
public void testValidationRequiredProperties() throws Exception {
final JettyWebSocketServer service = new JettyWebSocketServer();
final ControllerServiceTestContext context = new ControllerServiceTestContext(service, "service-id");
service.initialize(context.getInitializationContext());
final Collection<ValidationResult> results = service.validate(context.getValidationContext());
assertEquals(1, results.size());
final ValidationResult result = results.iterator().next();
assertEquals(JettyWebSocketServer.LISTEN_PORT.getDisplayName(), result.getSubject());
}
use of org.apache.nifi.components.ValidationResult in project nifi by apache.
the class TestCSVValidators method testSingleCharTab.
@Test
public void testSingleCharTab() {
CSVValidators.SingleCharacterValidator validator = new CSVValidators.SingleCharacterValidator();
ValidationContext mockContext = Mockito.mock(ValidationContext.class);
ValidationResult result = validator.validate("EscapeChar", "\\t", mockContext);
assertTrue(result.isValid());
}
use of org.apache.nifi.components.ValidationResult in project nifi by apache.
the class TestCSVValidators method testUnescapedSingleCharGoodChar.
@Test
public void testUnescapedSingleCharGoodChar() {
Validator validator = CSVValidators.UNESCAPED_SINGLE_CHAR_VALIDATOR;
ValidationContext mockContext = Mockito.mock(ValidationContext.class);
ValidationResult result = validator.validate("Delimiter", ",", mockContext);
assertTrue(result.isValid());
}
use of org.apache.nifi.components.ValidationResult in project nifi by apache.
the class TestCSVValidators method testUnescapedSingleCharUnicodeChar.
@Test
public void testUnescapedSingleCharUnicodeChar() {
Validator validator = CSVValidators.UNESCAPED_SINGLE_CHAR_VALIDATOR;
ValidationContext mockContext = Mockito.mock(ValidationContext.class);
ValidationResult result = validator.validate("Delimiter", "\\u0001", mockContext);
assertTrue(result.isValid());
}
use of org.apache.nifi.components.ValidationResult in project nifi by apache.
the class TestCSVValidators method testSingleCharIllegalChar.
@Test
public void testSingleCharIllegalChar() {
CSVValidators.SingleCharacterValidator validator = new CSVValidators.SingleCharacterValidator();
ValidationContext mockContext = Mockito.mock(ValidationContext.class);
ValidationResult result = validator.validate("EscapeChar", "\\r", mockContext);
assertEquals("\\r is not a valid character for this property", result.getExplanation());
assertFalse(result.isValid());
}
Aggregations