@Test public void getDeploymentsWithStatus() { setupSeveralDeploymentsAndApplications(); List<Deployment> deploymentsRUNNING = deploymentDAO.getDeploymentsWithStatus("RUNNING"); assertEquals(3, deploymentsRUNNING.size()); List<Deployment> deploymentsDELETED = deploymentDAO.getDeploymentsWithStatus("DELETED"); assertEquals(1, deploymentsDELETED.size()); List<Deployment> deploymentsXXX = deploymentDAO.getDeploymentsWithStatus("XXX"); assertEquals(0, deploymentsXXX.size()); }
@Override public List<Deployment> getDeploymentsWithStatus(String status) { Query query = entityManager.createQuery("SELECT d FROM Deployment d WHERE d.status = :status"); query.setParameter("status", status); @SuppressWarnings("unchecked") List<Deployment> deployments = query.getResultList(); return deployments; }
DeploymentDAOJpa implements DeploymentDAO { @Override public List<Deployment> getDeploymentsWithStatus(String status) { Query query = entityManager.createQuery("SELECT d FROM Deployment d WHERE d.status = :status"); query.setParameter("status", status); @SuppressWarnings("unchecked") List<Deployment> deployments = query.getResultList(); return deployments; } }
DeploymentDAOJpa implements DeploymentDAO { @Override public List<Deployment> getDeploymentsWithStatus(String status) { Query query = entityManager.createQuery("SELECT d FROM Deployment d WHERE d.status = :status"); query.setParameter("status", status); @SuppressWarnings("unchecked") List<Deployment> deployments = query.getResultList(); return deployments; }  }
DeploymentDAOJpa implements DeploymentDAO { @Override public List<Deployment> getDeploymentsWithStatus(String status) { Query query = entityManager.createQuery("SELECT d FROM Deployment d WHERE d.status = :status"); query.setParameter("status", status); @SuppressWarnings("unchecked") List<Deployment> deployments = query.getResultList(); return deployments; }  @PersistenceContext (unitName = "applicationManagerDB") void setEntityManager(EntityManager entityManager); EntityManager getEntityManager(); @Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) Deployment getById(int id); @Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) List<Deployment> getAll(); @Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) boolean save(Deployment deployment); @Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) boolean update(Deployment deployment); @Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) boolean delete(Deployment deployment); @Override List<Deployment> getDeploymentsForApplicationWithStatus(Application application, String status); @Override Deployment getDeployment(String deploymentName); @Override List<Deployment> getDeploymentsWithStatus(String status); }
DeploymentDAOJpa implements DeploymentDAO { @Override public List<Deployment> getDeploymentsWithStatus(String status) { Query query = entityManager.createQuery("SELECT d FROM Deployment d WHERE d.status = :status"); query.setParameter("status", status); @SuppressWarnings("unchecked") List<Deployment> deployments = query.getResultList(); return deployments; }  @PersistenceContext (unitName = "applicationManagerDB") void setEntityManager(EntityManager entityManager); EntityManager getEntityManager(); @Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) Deployment getById(int id); @Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) List<Deployment> getAll(); @Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) boolean save(Deployment deployment); @Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) boolean update(Deployment deployment); @Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) boolean delete(Deployment deployment); @Override List<Deployment> getDeploymentsForApplicationWithStatus(Application application, String status); @Override Deployment getDeployment(String deploymentName); @Override List<Deployment> getDeploymentsWithStatus(String status);  }