use of com.redhat.service.bridge.manager.models.Processor in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorDAOTest method findProcessorsToBeDeployedOrDeleteWithConnectors.
@Test
@Transactional
public void findProcessorsToBeDeployedOrDeleteWithConnectors() {
Bridge b = createBridge();
// To be provisioned
Processor withProvisionedConnectors = createProcessor(b, "withProvisionedConnectors");
withProvisionedConnectors.setStatus(ManagedResourceStatus.ACCEPTED);
withProvisionedConnectors.setDependencyStatus(ManagedResourceStatus.READY);
processorDAO.getEntityManager().merge(withProvisionedConnectors);
ConnectorEntity provisionedConnector = Fixtures.createConnector(withProvisionedConnectors, "connectorProvisioned", ManagedResourceStatus.READY, "");
processorDAO.getEntityManager().merge(provisionedConnector);
// Not to be provisioned as Connector is not ready
Processor nonProvisioned = createProcessor(b, "withUnprovisionedConnector");
nonProvisioned.setStatus(ManagedResourceStatus.ACCEPTED);
nonProvisioned.setDependencyStatus(ManagedResourceStatus.PROVISIONING);
processorDAO.getEntityManager().merge(nonProvisioned);
ConnectorEntity nonProvisionedConnector = Fixtures.createConnector(nonProvisioned, "nonProvisionedConnector", ManagedResourceStatus.READY, "");
processorDAO.getEntityManager().merge(nonProvisionedConnector);
// Not to be de-provisioned as there's a connector yet to be deleted
Processor toBeDeleted = createProcessor(b, "notToBeDeletedYet");
toBeDeleted.setStatus(ManagedResourceStatus.DEPROVISION);
toBeDeleted.setDependencyStatus(ManagedResourceStatus.READY);
processorDAO.getEntityManager().merge(nonProvisioned);
ConnectorEntity toBeDeletedConnector = Fixtures.createConnector(toBeDeleted, "toBeDeletedConnector", ManagedResourceStatus.ACCEPTED, "");
processorDAO.getEntityManager().merge(toBeDeletedConnector);
List<Processor> processors = processorDAO.findByShardIdWithReadyDependencies(TestConstants.SHARD_ID);
assertThat(processors.stream().map(Processor::getName)).contains("withProvisionedConnectors");
}
use of com.redhat.service.bridge.manager.models.Processor in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorDAOTest method findByBridgeIdAndCustomerId.
@Test
public void findByBridgeIdAndCustomerId() {
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 QueryInfo(0, 100));
assertThat(listResult.getPage()).isZero();
assertThat(listResult.getSize()).isEqualTo(2L);
assertThat(listResult.getTotal()).isEqualTo(2L);
listResult.getItems().forEach((px) -> assertThat(px.getId()).isIn(p.getId(), p1.getId()));
}
use of com.redhat.service.bridge.manager.models.Processor in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorDAOTest method testCountByBridgeIdAndCustomerId.
@Test
public void testCountByBridgeIdAndCustomerId() {
Bridge b = createBridge();
Processor p = createProcessor(b, "foo");
Processor p1 = createProcessor(b, "bar");
Long result = processorDAO.countByBridgeIdAndCustomerId(b.getId(), TestConstants.DEFAULT_CUSTOMER_ID);
assertThat(result).isEqualTo(2L);
}
use of com.redhat.service.bridge.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 QueryInfo(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.bridge.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("doesntExist", b.getId(), b.getCustomerId());
assertThat(found).isNull();
}
Aggregations