Search in sources :

Example 6 with ValidationResult

use of com.redhat.service.bridge.actions.ValidationResult in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class SlackActionValidatorTest method assertIsValid.

private void assertIsValid(BaseAction action) {
    ValidationResult validationResult = validator.isValid(action);
    assertThat(validationResult.isValid()).isTrue();
}
Also used : ValidationResult(com.redhat.service.bridge.actions.ValidationResult)

Example 7 with ValidationResult

use of com.redhat.service.bridge.actions.ValidationResult in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class SendToBridgeActionValidatorTest method assertIsValid.

private void assertIsValid(BaseAction action) {
    ValidationResult validationResult = validator.isValid(action);
    assertThat(validationResult.isValid()).isTrue();
}
Also used : ValidationResult(com.redhat.service.bridge.actions.ValidationResult)

Example 8 with ValidationResult

use of com.redhat.service.bridge.actions.ValidationResult in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class SendToBridgeActionValidatorTest method assertIsInvalid.

private void assertIsInvalid(BaseAction action, String errorMessage) {
    ValidationResult validationResult = validator.isValid(action);
    assertThat(validationResult.isValid()).isFalse();
    if (errorMessage == null) {
        assertThat(validationResult.getMessage()).isNull();
    } else {
        assertThat(validationResult.getMessage()).startsWith(errorMessage);
    }
}
Also used : ValidationResult(com.redhat.service.bridge.actions.ValidationResult)

Example 9 with ValidationResult

use of com.redhat.service.bridge.actions.ValidationResult in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class KafkaTopicActionValidatorTest method isValid_emptyTopicStringIsNotValid.

@Test
public void isValid_emptyTopicStringIsNotValid() {
    ProcessorDTO processor = createProcessorWithActionForTopic("myTopic");
    processor.getDefinition().getResolvedAction().getParameters().put(KafkaTopicAction.TOPIC_PARAM, "");
    ValidationResult validationResult = validator.isValid(processor.getDefinition().getResolvedAction());
    assertThat(validationResult.isValid()).isFalse();
    assertThat(validationResult.getMessage()).isEqualTo(KafkaTopicActionValidator.INVALID_TOPIC_PARAM_MESSAGE);
}
Also used : ProcessorDTO(com.redhat.service.bridge.infra.models.dto.ProcessorDTO) ValidationResult(com.redhat.service.bridge.actions.ValidationResult) Test(org.junit.jupiter.api.Test) QuarkusTest(io.quarkus.test.junit.QuarkusTest)

Aggregations

ValidationResult (com.redhat.service.bridge.actions.ValidationResult)9 BaseAction (com.redhat.service.bridge.infra.models.actions.BaseAction)3 ProcessorDTO (com.redhat.service.bridge.infra.models.dto.ProcessorDTO)2 QuarkusTest (io.quarkus.test.junit.QuarkusTest)2 Test (org.junit.jupiter.api.Test)2 ActionProvider (com.redhat.service.bridge.actions.ActionProvider)1 ActionProviderException (com.redhat.service.bridge.infra.exceptions.definitions.user.ActionProviderException)1 HibernateConstraintValidatorContext (org.hibernate.validator.constraintvalidation.HibernateConstraintValidatorContext)1