@Test public void testFindByClusterStackAndVersion() { Assert.assertEquals(3, hostVersionDAO.findByClusterStackAndVersion("test_cluster1", HDP_22_STACK, repoVersion_2200).size()); Assert.assertEquals(3, hostVersionDAO.findAll().size()); addMoreVersions(); Assert.assertEquals(3, hostVersionDAO.findByClusterStackAndVersion("test_cluster1", HDP_22_STACK, repoVersion_2201).size()); Assert.assertEquals(3, hostVersionDAO.findByClusterStackAndVersion("test_cluster1", HDP_22_STACK, repoVersion_2202).size()); Assert.assertEquals(9, hostVersionDAO.findAll().size()); }
@RequiresSession public List<HostVersionEntity> findByClusterStackAndVersion( String clusterName, StackId stackId, String version) { final TypedQuery<HostVersionEntity> query = entityManagerProvider.get().createNamedQuery("hostVersionByClusterAndStackAndVersion", HostVersionEntity.class); query.setParameter("clusterName", clusterName); query.setParameter("stackName", stackId.getStackName()); query.setParameter("stackVersion", stackId.getStackVersion()); query.setParameter("version", version); return daoUtils.selectList(query); }
HostVersionDAO extends CrudDAO<HostVersionEntity, Long> { @RequiresSession public List<HostVersionEntity> findByClusterStackAndVersion( String clusterName, StackId stackId, String version) { final TypedQuery<HostVersionEntity> query = entityManagerProvider.get().createNamedQuery("hostVersionByClusterAndStackAndVersion", HostVersionEntity.class); query.setParameter("clusterName", clusterName); query.setParameter("stackName", stackId.getStackName()); query.setParameter("stackVersion", stackId.getStackVersion()); query.setParameter("version", version); return daoUtils.selectList(query); } }
HostVersionDAO extends CrudDAO<HostVersionEntity, Long> { @RequiresSession public List<HostVersionEntity> findByClusterStackAndVersion( String clusterName, StackId stackId, String version) { final TypedQuery<HostVersionEntity> query = entityManagerProvider.get().createNamedQuery("hostVersionByClusterAndStackAndVersion", HostVersionEntity.class); query.setParameter("clusterName", clusterName); query.setParameter("stackName", stackId.getStackName()); query.setParameter("stackVersion", stackId.getStackVersion()); query.setParameter("version", version); return daoUtils.selectList(query); } HostVersionDAO(); }
HostVersionDAO extends CrudDAO<HostVersionEntity, Long> { @RequiresSession public List<HostVersionEntity> findByClusterStackAndVersion( String clusterName, StackId stackId, String version) { final TypedQuery<HostVersionEntity> query = entityManagerProvider.get().createNamedQuery("hostVersionByClusterAndStackAndVersion", HostVersionEntity.class); query.setParameter("clusterName", clusterName); query.setParameter("stackName", stackId.getStackName()); query.setParameter("stackVersion", stackId.getStackVersion()); query.setParameter("version", version); 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> findByClusterStackAndVersion( String clusterName, StackId stackId, String version) { final TypedQuery<HostVersionEntity> query = entityManagerProvider.get().createNamedQuery("hostVersionByClusterAndStackAndVersion", HostVersionEntity.class); query.setParameter("clusterName", clusterName); query.setParameter("stackName", stackId.getStackName()); query.setParameter("stackVersion", stackId.getStackVersion()); query.setParameter("version", version); 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);  }