use of com.redhat.service.smartevents.manager.api.models.requests.ProcessorRequest in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorAPITest method listProcessorsFilterByStatus.
@Test
@TestSecurity(user = TestConstants.DEFAULT_CUSTOMER_ID)
public void listProcessorsFilterByStatus() {
BridgeResponse bridgeResponse = createAndDeployBridge();
ProcessorResponse p1 = TestUtils.addProcessorToBridge(bridgeResponse.getId(), new ProcessorRequest("myProcessor", TestUtils.createKafkaAction())).as(ProcessorResponse.class);
ProcessorResponse p2 = TestUtils.addProcessorToBridge(bridgeResponse.getId(), new ProcessorRequest("myProcessor2", TestUtils.createKafkaAction())).as(ProcessorResponse.class);
setProcessorStatus(p1.getId(), ACCEPTED);
setProcessorStatus(p2.getId(), READY);
ProcessorListResponse listResponse = TestUtils.listProcessorsFilterByStatus(bridgeResponse.getId(), READY).as(ProcessorListResponse.class);
assertThat(listResponse.getPage()).isZero();
assertThat(listResponse.getSize()).isEqualTo(1L);
assertThat(listResponse.getTotal()).isEqualTo(1L);
assertThat(listResponse.getItems().get(0).getId()).isEqualTo(p2.getId());
}
use of com.redhat.service.smartevents.manager.api.models.requests.ProcessorRequest in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorAPITest method updateProcessorWhenProcessorNotInReadyState.
@Test
@TestSecurity(user = TestConstants.DEFAULT_CUSTOMER_ID)
public void updateProcessorWhenProcessorNotInReadyState() {
Bridge bridge = Fixtures.createBridge();
bridgeDAO.persist(bridge);
Processor processor = Fixtures.createProcessor(bridge, ManagedResourceStatus.PROVISIONING);
processorDAO.persist(processor);
Response response = TestUtils.updateProcessor(bridge.getId(), processor.getId(), new ProcessorRequest(processor.getName(), Collections.emptySet(), null, TestUtils.createKafkaAction()));
assertThat(response.getStatusCode()).isEqualTo(400);
}
use of com.redhat.service.smartevents.manager.api.models.requests.ProcessorRequest in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorGatewayConstraintValidatorTest method isValid_multipleGatewaysIsNotValid.
@Test
void isValid_multipleGatewaysIsNotValid() {
ProcessorRequest p = new ProcessorRequest();
p.setAction(buildTestAction());
p.setSource(buildTestSource());
assertThat(constraintValidator.isValid(p, validatorContextMock)).isFalse();
verify(gatewayConfiguratorMock, never()).getActionValidator(any());
verify(gatewayConfiguratorMock, never()).getSourceValidator(any());
verify(actionValidatorMock, never()).isValid(any());
verify(sourceValidatorMock, never()).isValid(any());
verifyErrorMessage(MULTIPLE_GATEWAY_ERROR);
}
use of com.redhat.service.smartevents.manager.api.models.requests.ProcessorRequest in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorGatewayConstraintValidatorTest method isValid.
@ParameterizedTest
@MethodSource("gateways")
void isValid(Gateway gateway) {
ProcessorRequest p = buildTestRequest(gateway);
assertThat(constraintValidator.isValid(p, validatorContextMock)).isTrue();
verifyGetValidatorCall(gateway, times(1), gateway.getType());
verifyIsValidCall(gateway, times(1));
}
use of com.redhat.service.smartevents.manager.api.models.requests.ProcessorRequest in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorGatewayConstraintValidatorTest method isValid_unrecognisedGatewayTypeIsNotValid.
@ParameterizedTest
@MethodSource("gateways")
void isValid_unrecognisedGatewayTypeIsNotValid(Gateway gateway) {
String doesNotExistType = "doesNotExist";
gateway.setType(doesNotExistType);
ProcessorRequest p = buildTestRequest(gateway);
assertThat(constraintValidator.isValid(p, validatorContextMock)).isFalse();
verifyGetValidatorCall(gateway, times(1), doesNotExistType);
verifyIsValidCall(gateway, never());
verifyErrorMessage(GATEWAY_TYPE_NOT_RECOGNISED_ERROR, gateway, true);
}
Aggregations