use of com.redhat.service.bridge.manager.models.Bridge in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorServiceTest method getProcessors_noProcessorsOnBridge.
@Test
public void getProcessors_noProcessorsOnBridge() {
Bridge b = createPersistBridge(ManagedResourceStatus.READY);
ListResult<Processor> results = processorService.getProcessors(b.getId(), TestConstants.DEFAULT_CUSTOMER_ID, new QueryInfo(0, 100));
assertThat(results.getPage()).isZero();
assertThat(results.getSize()).isZero();
assertThat(results.getTotal()).isZero();
}
use of com.redhat.service.bridge.manager.models.Bridge in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorServiceTest method toResponse.
@Test
public void toResponse() {
Bridge b = Fixtures.createBridge();
Processor p = Fixtures.createProcessor(b, "foo", ManagedResourceStatus.READY);
BaseAction action = Fixtures.createKafkaAction();
ProcessorDefinition definition = new ProcessorDefinition(Collections.emptySet(), "", action);
p.setDefinition(definitionToJsonNode(definition));
ProcessorResponse r = processorService.toResponse(p);
assertThat(r).isNotNull();
assertThat(r.getHref()).isEqualTo(APIConstants.USER_API_BASE_PATH + b.getId() + "/processors/" + p.getId());
assertThat(r.getName()).isEqualTo(p.getName());
assertThat(r.getStatus()).isEqualTo(p.getStatus());
assertThat(r.getId()).isEqualTo(p.getId());
assertThat(r.getSubmittedAt()).isEqualTo(p.getSubmittedAt());
assertThat(r.getPublishedAt()).isEqualTo(p.getPublishedAt());
assertThat(r.getKind()).isEqualTo("Processor");
assertThat(r.getTransformationTemplate()).isEmpty();
assertThat(r.getAction().getType()).isEqualTo(KafkaTopicAction.TYPE);
}
use of com.redhat.service.bridge.manager.models.Bridge in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorServiceTest method getProcessors.
@Test
public void getProcessors() {
Bridge b = createPersistBridge(ManagedResourceStatus.READY);
ProcessorRequest r = new ProcessorRequest("My Processor", createKafkaAction());
Processor processor = processorService.createProcessor(b.getId(), b.getCustomerId(), r);
await().atMost(5, SECONDS).untilAsserted(() -> {
Processor p = processorDAO.findById(processor.getId());
assertThat(p).isNotNull();
assertThat(p.getDependencyStatus()).isEqualTo(ManagedResourceStatus.READY);
});
ListResult<Processor> results = processorService.getProcessors(b.getId(), TestConstants.DEFAULT_CUSTOMER_ID, new QueryInfo(0, 100));
assertThat(results.getPage()).isZero();
assertThat(results.getSize()).isEqualTo(1L);
assertThat(results.getTotal()).isEqualTo(1L);
assertThat(results.getItems().get(0).getId()).isEqualTo(processor.getId());
}
use of com.redhat.service.bridge.manager.models.Bridge in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorServiceTest method createProcessor.
@Test
public void createProcessor() {
Bridge b = createPersistBridge(ManagedResourceStatus.READY);
ProcessorRequest r = new ProcessorRequest("My Processor", null, "{}", createKafkaAction());
Processor processor = processorService.createProcessor(b.getId(), b.getCustomerId(), r);
await().atMost(5, SECONDS).untilAsserted(() -> {
Processor p = processorDAO.findById(processor.getId());
assertThat(p).isNotNull();
assertThat(p.getDependencyStatus()).isEqualTo(ManagedResourceStatus.READY);
});
assertThat(processor.getBridge().getId()).isEqualTo(b.getId());
assertThat(processor.getName()).isEqualTo(r.getName());
assertThat(processor.getStatus()).isEqualTo(ManagedResourceStatus.ACCEPTED);
assertThat(processor.getSubmittedAt()).isNotNull();
assertThat(processor.getDefinition()).isNotNull();
ProcessorDefinition definition = jsonNodeToDefinition(processor.getDefinition());
assertThat(definition.getTransformationTemplate()).isEqualTo("{}");
}
use of com.redhat.service.bridge.manager.models.Bridge in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorServiceTest method getProcessor_bridgeDoesNotExist.
@Test
public void getProcessor_bridgeDoesNotExist() {
Bridge b = createPersistBridge(ManagedResourceStatus.READY);
ProcessorRequest r = new ProcessorRequest("My Processor", createKafkaAction());
Processor processor = processorService.createProcessor(b.getId(), b.getCustomerId(), r);
await().atMost(5, SECONDS).untilAsserted(() -> {
Processor p = processorDAO.findById(processor.getId());
assertThat(p).isNotNull();
assertThat(p.getDependencyStatus()).isEqualTo(ManagedResourceStatus.READY);
});
assertThatExceptionOfType(ItemNotFoundException.class).isThrownBy(() -> processorService.getProcessor(processor.getId(), "doesNotExist", b.getCustomerId()));
}
Aggregations