use of com.redhat.service.bridge.manager.api.models.requests.ProcessorRequest in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ActionParamValidatorContainerTest method isValid_nullActionIsNotValid.
@Test
public void isValid_nullActionIsNotValid() {
ProcessorRequest p = buildTestRequest();
p.setAction(null);
assertThat(container.isValid(p, validatorContext)).isFalse();
verify(actionProviderFactoryMock, never()).getActionProvider(any());
verify(actionValidatorMock, never()).isValid(any());
}
use of com.redhat.service.bridge.manager.api.models.requests.ProcessorRequest in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ActionParamValidatorContainerTest method isValid_messageFromActionValidatorAddedOnFailure.
@Test
public void isValid_messageFromActionValidatorAddedOnFailure() {
String testErrorMessage = "This is a test error message returned from action validator";
when(actionValidatorMock.isValid(any())).thenReturn(ValidationResult.invalid(testErrorMessage));
ProcessorRequest p = buildTestRequest();
assertThat(container.isValid(p, validatorContext)).isFalse();
verify(actionProviderFactoryMock).getActionProvider(TEST_ACTION_TYPE);
verify(actionValidatorMock).isValid(any());
ArgumentCaptor<String> messageCap = ArgumentCaptor.forClass(String.class);
verify(validatorContext).disableDefaultConstraintViolation();
verify(validatorContext).buildConstraintViolationWithTemplate(messageCap.capture());
verify(builderMock).addConstraintViolation();
assertThat(messageCap.getValue()).isEqualTo(testErrorMessage);
}
use of com.redhat.service.bridge.manager.api.models.requests.ProcessorRequest in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ActionParamValidatorContainerTest method isValid_actionWithEmptyParamsIsValid.
@Test
public void isValid_actionWithEmptyParamsIsValid() {
ProcessorRequest p = buildTestRequest();
p.getAction().getParameters().clear();
assertThat(container.isValid(p, validatorContext)).isTrue();
verify(actionProviderFactoryMock).getActionProvider(TEST_ACTION_TYPE);
verify(actionValidatorMock).isValid(any());
}
use of com.redhat.service.bridge.manager.api.models.requests.ProcessorRequest in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class SendToBridgeActionTransformerTest method testActionWithUnavailableBridgeId.
@Test
void testActionWithUnavailableBridgeId() {
BaseAction inputAction = actionWithBridgeId(UNAVAILABLE_BRIDGE_ID);
ProcessorRequest inputRequest = requestWithAction(inputAction);
assertThatExceptionOfType(BridgeLifecycleException.class).isThrownBy(() -> transformer.transform(inputRequest.getAction(), bridge.getId(), TEST_CUSTOMER_ID, ""));
}
use of com.redhat.service.bridge.manager.api.models.requests.ProcessorRequest in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class SendToBridgeActionTransformerTest method testActionWithUnknownBridgeId.
@Test
void testActionWithUnknownBridgeId() {
BaseAction inputAction = actionWithBridgeId(UNKNOWN_BRIDGE_ID);
ProcessorRequest inputRequest = requestWithAction(inputAction);
assertThatExceptionOfType(ItemNotFoundException.class).isThrownBy(() -> transformer.transform(inputRequest.getAction(), bridge.getId(), TEST_CUSTOMER_ID, ""));
}
Aggregations