use of com.redhat.service.bridge.manager.api.models.responses.ProcessorResponse in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorAPITest method getProcessor_bridgeDoesNotExist.
@Test
@TestSecurity(user = TestConstants.DEFAULT_CUSTOMER_ID)
public void getProcessor_bridgeDoesNotExist() {
BridgeResponse bridgeResponse = createAndDeployBridge();
ProcessorResponse response = TestUtils.addProcessorToBridge(bridgeResponse.getId(), new ProcessorRequest("myProcessor", createKafkaAction())).as(ProcessorResponse.class);
Response found = TestUtils.getProcessor("doesNotExist", response.getId());
assertThat(found.getStatusCode()).isEqualTo(404);
}
use of com.redhat.service.bridge.manager.api.models.responses.ProcessorResponse in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorSteps method addProcessorToBridgeWithBody.
@When("^add a Processor to the Bridge \"([^\"]*)\" with body:$")
public void addProcessorToBridgeWithBody(String testBridgeName, String processorRequestJson) {
BridgeContext bridgeContext = context.getBridge(testBridgeName);
JsonObject json = new JsonObject(processorRequestJson);
String processorName = json.getString("name");
ProcessorResponse response;
try (InputStream resourceStream = new ByteArrayInputStream(processorRequestJson.getBytes(StandardCharsets.UTF_8))) {
response = ProcessorResource.createProcessor(context.getManagerToken(), bridgeContext.getId(), resourceStream);
} catch (IOException e) {
throw new RuntimeException("Error with inputstream", e);
}
bridgeContext.newProcessor(processorName, response.getId());
assertThat(response.getName()).isEqualTo(processorName);
assertThat(response.getKind()).isEqualTo("Processor");
assertThat(response.getHref()).isNotNull();
assertThat(response.getStatus()).isEqualTo(ManagedResourceStatus.ACCEPTED);
}
use of com.redhat.service.bridge.manager.api.models.responses.ProcessorResponse in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorServiceImpl method toResponse.
@Override
public ProcessorResponse toResponse(Processor processor) {
ProcessorResponse processorResponse = new ProcessorResponse();
processorResponse.setId(processor.getId());
processorResponse.setName(processor.getName());
processorResponse.setStatus(processor.getStatus());
processorResponse.setPublishedAt(processor.getPublishedAt());
processorResponse.setSubmittedAt(processor.getSubmittedAt());
if (processor.getDefinition() != null) {
ProcessorDefinition definition = jsonNodeToDefinition(processor.getDefinition());
processorResponse.setFilters(definition.getFilters());
processorResponse.setTransformationTemplate(definition.getTransformationTemplate());
processorResponse.setAction(definition.getRequestedAction());
}
if (processor.getBridge() != null) {
processorResponse.setHref(APIConstants.USER_API_BASE_PATH + processor.getBridge().getId() + "/processors/" + processor.getId());
}
return processorResponse;
}
Aggregations