use of com.redhat.service.smartevents.manager.models.Bridge in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorDAOTest method testGetProcessorsFilterByName.
@Test
void testGetProcessorsFilterByName() {
Bridge b = createBridge();
Processor p = createProcessor(b, "foo");
createProcessor(b, "bar");
ListResult<Processor> results = processorDAO.findByBridgeIdAndCustomerId(b.getId(), b.getCustomerId(), new QueryProcessorResourceInfo(0, 100, filter().by(p.getName()).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.Bridge in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorDAOTest method testGetProcessorsFilterByNameAndType.
@Test
void testGetProcessorsFilterByNameAndType() {
Bridge b = createBridge();
Processor p = createProcessor(b, "foo", SOURCE);
createProcessor(b, "bar");
ListResult<Processor> results = processorDAO.findByBridgeIdAndCustomerId(b.getId(), b.getCustomerId(), new QueryProcessorResourceInfo(0, 100, filter().by(p.getName()).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.Bridge in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorDAOTest method createBridge.
private Bridge createBridge() {
Bridge b = new Bridge();
b.setName(TestConstants.DEFAULT_BRIDGE_NAME);
b.setCustomerId(TestConstants.DEFAULT_CUSTOMER_ID);
b.setOrganisationId(TestConstants.DEFAULT_CUSTOMER_ID);
b.setOwner(TestConstants.DEFAULT_USER_NAME);
b.setStatus(ManagedResourceStatus.READY);
b.setSubmittedAt(ZonedDateTime.now());
b.setPublishedAt(ZonedDateTime.now());
b.setShardId(TestConstants.SHARD_ID);
b.setDefinition(new BridgeDefinition());
bridgeDAO.persist(b);
return b;
}
use of com.redhat.service.smartevents.manager.models.Bridge in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorDAOTest method findProcessorsToBeDeployedOrDelete.
@Test
@Transactional
public void findProcessorsToBeDeployedOrDelete() {
Bridge b = createBridge();
// To be provisioned
Processor p = createProcessor(b, "foo");
p.setStatus(ManagedResourceStatus.PREPARING);
p.setDependencyStatus(ManagedResourceStatus.READY);
processorDAO.getEntityManager().merge(p);
// Already provisioned
Processor q = createProcessor(b, "bob");
q.setStatus(ManagedResourceStatus.READY);
q.setDependencyStatus(ManagedResourceStatus.READY);
processorDAO.getEntityManager().merge(q);
// To be de-provisioned
Processor r = createProcessor(b, "frank");
r.setStatus(ManagedResourceStatus.DEPROVISION);
r.setDependencyStatus(ManagedResourceStatus.DELETED);
processorDAO.getEntityManager().merge(r);
List<Processor> processors = processorDAO.findByShardIdWithReadyDependencies(TestConstants.SHARD_ID);
assertThat(processors).hasSize(2);
processors.forEach((px) -> assertThat(px.getName()).isIn("foo", "frank"));
}
use of com.redhat.service.smartevents.manager.models.Bridge in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorDAOTest method findByBridgeIdAndCustomerId_noProcessors.
@Test
public void findByBridgeIdAndCustomerId_noProcessors() {
Bridge b = createBridge();
ListResult<Processor> listResult = processorDAO.findByBridgeIdAndCustomerId(b.getId(), TestConstants.DEFAULT_CUSTOMER_ID, new QueryProcessorResourceInfo(0, 100));
assertThat(listResult.getPage()).isZero();
assertThat(listResult.getSize()).isZero();
assertThat(listResult.getTotal()).isZero();
}
Aggregations