use of com.redhat.service.bridge.manager.api.models.requests.ProcessorRequest in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorAPITest method getProcessor.
@Test
@TestSecurity(user = TestConstants.DEFAULT_CUSTOMER_ID)
public void getProcessor() {
BridgeResponse bridgeResponse = createAndDeployBridge();
Response response = TestUtils.addProcessorToBridge(bridgeResponse.getId(), new ProcessorRequest("myProcessor", createKafkaAction()));
assertThat(response.getStatusCode()).isEqualTo(201);
ProcessorResponse pr = response.as(ProcessorResponse.class);
assertThat(pr.getAction().getType()).isEqualTo(KafkaTopicAction.TYPE);
assertThat(pr.getAction().getParameters()).containsEntry(KafkaTopicAction.TOPIC_PARAM, TestConstants.DEFAULT_KAFKA_TOPIC);
ProcessorResponse found = TestUtils.getProcessor(bridgeResponse.getId(), pr.getId()).as(ProcessorResponse.class);
assertThat(found.getId()).isEqualTo(pr.getId());
assertThat(found.getAction().getType()).isEqualTo(KafkaTopicAction.TYPE);
assertThat(found.getAction().getParameters()).containsEntry(KafkaTopicAction.TOPIC_PARAM, TestConstants.DEFAULT_KAFKA_TOPIC);
}
use of com.redhat.service.bridge.manager.api.models.requests.ProcessorRequest in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorAPITest method addProcessorWithNullFiltersToBridge.
@Test
@TestSecurity(user = TestConstants.DEFAULT_CUSTOMER_ID)
public void addProcessorWithNullFiltersToBridge() {
BridgeResponse bridgeResponse = createAndDeployBridge();
Response response = TestUtils.addProcessorToBridge(bridgeResponse.getId(), new ProcessorRequest("myProcessor", createKafkaAction()));
assertThat(response.getStatusCode()).isEqualTo(201);
ProcessorResponse processorResponse = response.as(ProcessorResponse.class);
assertThat(processorResponse.getName()).isEqualTo("myProcessor");
assertThat(processorResponse.getFilters()).isNull();
assertThat(processorResponse.getTransformationTemplate()).isNull();
assertRequestedAction(processorResponse);
}
use of com.redhat.service.bridge.manager.api.models.requests.ProcessorRequest in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorAPITest method addProcessorToBridge_bridgeDoesNotExist.
@Test
@TestSecurity(user = TestConstants.DEFAULT_CUSTOMER_ID)
public void addProcessorToBridge_bridgeDoesNotExist() {
Response response = TestUtils.addProcessorToBridge("foo", new ProcessorRequest("myProcessor", createKafkaAction()));
assertThat(response.getStatusCode()).isEqualTo(404);
}
use of com.redhat.service.bridge.manager.api.models.requests.ProcessorRequest in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ActionParamValidatorContainerTest method isValid_actionWithNullParametersIsNotValid.
@Test
public void isValid_actionWithNullParametersIsNotValid() {
ProcessorRequest p = buildTestRequest();
p.getAction().setParameters(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_unrecognisedActionTypeIsNotValid.
@Test
public void isValid_unrecognisedActionTypeIsNotValid() {
String doesNotExistType = "doesNotExist";
ProcessorRequest p = buildTestRequest();
p.getAction().setType(doesNotExistType);
assertThat(container.isValid(p, validatorContext)).isFalse();
verify(actionProviderFactoryMock).getActionProvider(doesNotExistType);
verify(actionValidatorMock, never()).isValid(any());
verify(validatorContext).disableDefaultConstraintViolation();
verify(validatorContext).buildConstraintViolationWithTemplate(anyString());
verify(validatorContext).addMessageParameter(ActionParamValidatorContainer.TYPE_PARAM, doesNotExistType);
verify(builderMock).addConstraintViolation();
}
Aggregations