@Test public void testFindByClusterHostAndState() { Assert.assertEquals(1, hostVersionDAO.findByClusterHostAndState("test_cluster1", "test_host1", RepositoryVersionState.CURRENT).size()); Assert.assertEquals(0, hostVersionDAO.findByClusterHostAndState("test_cluster1", "test_host1", RepositoryVersionState.INSTALLED).size()); Assert.assertEquals(0, hostVersionDAO.findByClusterHostAndState("test_cluster1", "test_host2", RepositoryVersionState.INSTALLING).size()); Assert.assertEquals(0, hostVersionDAO.findByClusterHostAndState("test_cluster1", "test_host3", RepositoryVersionState.INSTALL_FAILED).size()); addMoreVersions(); Assert.assertEquals(2, hostVersionDAO.findByClusterHostAndState("test_cluster1", "test_host1", RepositoryVersionState.INSTALLED).size()); Assert.assertEquals(2, hostVersionDAO.findByClusterHostAndState("test_cluster1", "test_host2", RepositoryVersionState.INSTALLED).size()); Assert.assertEquals(2, hostVersionDAO.findByClusterHostAndState("test_cluster1", "test_host3", RepositoryVersionState.INSTALLED).size()); Assert.assertEquals(1, hostVersionDAO.findByClusterHostAndState("test_cluster1", "test_host1", RepositoryVersionState.CURRENT).size()); Assert.assertEquals(1, hostVersionDAO.findByClusterHostAndState("test_cluster1", "test_host2", RepositoryVersionState.INSTALLING).size()); Assert.assertEquals(1, hostVersionDAO.findByClusterHostAndState("test_cluster1", "test_host3", RepositoryVersionState.INSTALL_FAILED).size()); }
@RequiresSession public List<HostVersionEntity> findByClusterHostAndState(String clusterName, String hostName, RepositoryVersionState state) { final TypedQuery<HostVersionEntity> query = entityManagerProvider.get() .createNamedQuery("hostVersionByClusterHostnameAndState", HostVersionEntity.class); query.setParameter("clusterName", clusterName); query.setParameter("hostName", hostName); query.setParameter("state", state); return daoUtils.selectList(query); }
HostVersionDAO extends CrudDAO<HostVersionEntity, Long> { @RequiresSession public List<HostVersionEntity> findByClusterHostAndState(String clusterName, String hostName, RepositoryVersionState state) { final TypedQuery<HostVersionEntity> query = entityManagerProvider.get() .createNamedQuery("hostVersionByClusterHostnameAndState", HostVersionEntity.class); query.setParameter("clusterName", clusterName); query.setParameter("hostName", hostName); query.setParameter("state", state); return daoUtils.selectList(query); } }
HostVersionDAO extends CrudDAO<HostVersionEntity, Long> { @RequiresSession public List<HostVersionEntity> findByClusterHostAndState(String clusterName, String hostName, RepositoryVersionState state) { final TypedQuery<HostVersionEntity> query = entityManagerProvider.get() .createNamedQuery("hostVersionByClusterHostnameAndState", HostVersionEntity.class); query.setParameter("clusterName", clusterName); query.setParameter("hostName", hostName); query.setParameter("state", state); return daoUtils.selectList(query); } HostVersionDAO(); }
HostVersionDAO extends CrudDAO<HostVersionEntity, Long> { @RequiresSession public List<HostVersionEntity> findByClusterHostAndState(String clusterName, String hostName, RepositoryVersionState state) { final TypedQuery<HostVersionEntity> query = entityManagerProvider.get() .createNamedQuery("hostVersionByClusterHostnameAndState", HostVersionEntity.class); query.setParameter("clusterName", clusterName); query.setParameter("hostName", hostName); query.setParameter("state", state); return daoUtils.selectList(query); } HostVersionDAO(); @Override @Transactional void create(HostVersionEntity entity); @RequiresSession List<HostVersionEntity> findByClusterStackAndVersion(
      String clusterName, StackId stackId, String version); @RequiresSession List<HostVersionEntity> findByHost(String hostName); @RequiresSession List<HostVersionEntity> findByClusterAndHost(String  clusterName, String hostName); @RequiresSession List<HostVersionEntity> findByClusterHostAndState(String  clusterName, String hostName, RepositoryVersionState state); @RequiresSession List<HostVersionEntity> findByClusterHostAndState(long clusterId, long hostId, RepositoryVersionState state); @RequiresSession HostVersionEntity findByHostAndStateCurrent(String clusterName, String hostName); @RequiresSession HostVersionEntity findByHostAndStateCurrent(long clusterId, long hostId); @RequiresSession HostVersionEntity findByClusterStackVersionAndHost(String clusterName,
      StackId stackId, String version, String hostName); @RequiresSession HostVersionEntity findByClusterStackVersionAndHost(long clusterId, StackId stackId, String version,
                                                            long hostId); @Transactional void removeByHostName(String hostName); @Transactional void updateVersions(RepositoryVersionEntity target, RepositoryVersionEntity current); }
HostVersionDAO extends CrudDAO<HostVersionEntity, Long> { @RequiresSession public List<HostVersionEntity> findByClusterHostAndState(String clusterName, String hostName, RepositoryVersionState state) { final TypedQuery<HostVersionEntity> query = entityManagerProvider.get() .createNamedQuery("hostVersionByClusterHostnameAndState", HostVersionEntity.class); query.setParameter("clusterName", clusterName); query.setParameter("hostName", hostName); query.setParameter("state", state); return daoUtils.selectList(query); } HostVersionDAO(); @Override @Transactional void create(HostVersionEntity entity); @RequiresSession List<HostVersionEntity> findByClusterStackAndVersion(
      String clusterName, StackId stackId, String version); @RequiresSession List<HostVersionEntity> findByHost(String hostName); @RequiresSession List<HostVersionEntity> findByClusterAndHost(String  clusterName, String hostName); @RequiresSession List<HostVersionEntity> findByClusterHostAndState(String  clusterName, String hostName, RepositoryVersionState state); @RequiresSession List<HostVersionEntity> findByClusterHostAndState(long clusterId, long hostId, RepositoryVersionState state); @RequiresSession HostVersionEntity findByHostAndStateCurrent(String clusterName, String hostName); @RequiresSession HostVersionEntity findByHostAndStateCurrent(long clusterId, long hostId); @RequiresSession HostVersionEntity findByClusterStackVersionAndHost(String clusterName,
      StackId stackId, String version, String hostName); @RequiresSession HostVersionEntity findByClusterStackVersionAndHost(long clusterId, StackId stackId, String version,
                                                            long hostId); @Transactional void removeByHostName(String hostName); @Transactional void updateVersions(RepositoryVersionEntity target, RepositoryVersionEntity current);  }