use of com.redhat.service.smartevents.manager.models.Processor in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorDAOTest method findByBridgeIdAndCustomerId_pageOffset.
@Test
public void findByBridgeIdAndCustomerId_pageOffset() {
Bridge b = createBridge();
Processor p = createProcessor(b, "foo");
Processor p1 = createProcessor(b, "bar");
ListResult<Processor> listResult = processorDAO.findByBridgeIdAndCustomerId(b.getId(), TestConstants.DEFAULT_CUSTOMER_ID, new QueryProcessorResourceInfo(1, 1));
assertThat(listResult.getPage()).isEqualTo(1L);
assertThat(listResult.getSize()).isEqualTo(1L);
assertThat(listResult.getTotal()).isEqualTo(2L);
assertThat(listResult.getItems().get(0).getId()).isEqualTo(p1.getId());
}
use of com.redhat.service.smartevents.manager.models.Processor in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorDAOTest method findByIdBridgeIdAndCustomerId_doesNotExist.
@Test
public void findByIdBridgeIdAndCustomerId_doesNotExist() {
Bridge b = createBridge();
createProcessor(b, "foo");
Processor found = processorDAO.findByIdBridgeIdAndCustomerId(b.getId(), "doesntExist", b.getCustomerId());
assertThat(found).isNull();
}
use of com.redhat.service.smartevents.manager.models.Processor in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorDAOTest method testGetProcessorsFilterByStatusAndType.
@Test
@Transactional
void testGetProcessorsFilterByStatusAndType() {
Bridge b = createBridge();
Processor p = createProcessor(b, "foo", SOURCE);
createProcessor(b, "bar");
p.setStatus(READY);
processorDAO.persist(p);
ListResult<Processor> results = processorDAO.findByBridgeIdAndCustomerId(b.getId(), b.getCustomerId(), new QueryProcessorResourceInfo(0, 100, filter().by(p.getStatus()).by(p.getType()).build()));
assertThat(results.getPage()).isZero();
assertThat(results.getSize()).isEqualTo(1L);
assertThat(results.getTotal()).isEqualTo(1L);
assertThat(results.getItems().get(0).getId()).isEqualTo(p.getId());
}
use of com.redhat.service.smartevents.manager.models.Processor in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorDAOTest method testGetProcessorsFilterByMoreStatuses.
@Test
@Transactional
public void testGetProcessorsFilterByMoreStatuses() {
Bridge b = createBridge();
Processor p1 = createProcessor(b, "foo");
p1.setStatus(ACCEPTED);
processorDAO.persist(p1);
Processor p2 = createProcessor(b, "bar");
p2.setStatus(READY);
processorDAO.persist(p2);
ListResult<Processor> results = processorDAO.findByBridgeIdAndCustomerId(b.getId(), b.getCustomerId(), new QueryProcessorResourceInfo(0, 100, filter().by(ACCEPTED).by(READY).build()));
assertThat(results.getPage()).isZero();
assertThat(results.getSize()).isEqualTo(2L);
assertThat(results.getTotal()).isEqualTo(2L);
assertThat(results.getItems().get(0).getId()).isEqualTo(p2.getId());
assertThat(results.getItems().get(1).getId()).isEqualTo(p1.getId());
}
use of com.redhat.service.smartevents.manager.models.Processor in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorDAOTest method findByBridgeIdAndName.
@Test
public void findByBridgeIdAndName() {
Bridge b = createBridge();
Processor p = createProcessor(b, "foo");
Processor byBridgeIdAndName = processorDAO.findByBridgeIdAndName(b.getId(), p.getName());
assertThat(byBridgeIdAndName).isNotNull();
assertThat(byBridgeIdAndName.getName()).isEqualTo(p.getName());
assertThat(byBridgeIdAndName.getBridge().getId()).isEqualTo(b.getId());
}
Aggregations