ResourcePoolService implements IResourcePoolService { @Override @Transactional public List<ResourcePoolRead> getAllResourcePoolForRest() { logger.debug("get all resource pools."); List<ResourcePoolRead> rps = new ArrayList<ResourcePoolRead>(); List<VcResourcePoolEntity> entities = rpDao.findAllOrderByClusterName(); for (VcResourcePoolEntity entity : entities) { ResourcePoolRead read = entity.toRest(); rps.add(read); } return rps; }  IResourcePoolDAO getRpDao(); @Autowired void setRpDao(IResourcePoolDAO rpDao); IClusterDAO getClusterDao(); @Autowired void setClusterDao(IClusterDAO clusterDao); IResourceService getResService(); @Autowired void setResService(IResourceService resSvc); @Override List<VcCluster> getAllVcResourcePool(); @Override synchronized void addResourcePool(String rpName,
         String vcClusterName, String vcResourcePool); @Override List<VcCluster> getVcResourcePoolByName(String name); @Override List<VcCluster> getVcResourcePoolByNameList(String[] names); @Override Set<String> getAllRPNames(); @Override @Transactional List<ResourcePoolRead> getAllResourcePoolForRest(); @Override @Transactional ResourcePoolRead getResourcePoolForRest(final String rpName); @Override @Transactional synchronized void deleteResourcePool(final String rpName); @Override boolean isDeployedUnderCluster(final String clusterName,
         final String vcRPName); synchronized List<String> addAutoResourcePools(
         List<VcCluster> vcClusters, boolean ignoreDuplicate); @Override synchronized void updateResourcePool(String rpName,
         String vcClusterName, String vcResourcePool);  }
@Test(groups = { "res-mgmt", "dependsOnVC", "dependsOnDB"}) public void testgetAllResourcePoolForRest() { new Expectations() { { List<VcResourcePoolEntity> rpEntities = new ArrayList<VcResourcePoolEntity>(); VcResourcePoolEntity rpEntity = new VcResourcePoolEntity(); rpEntity.setName("defaultRP"); rpEntity.setVcCluster("cluster-ws"); rpEntity.setVcResourcePool("jarred"); rpEntities.add(rpEntity); rpDao.findAllOrderByClusterName(); result = rpEntities; } }; rpSvc.setRpDao(rpDao); List<ResourcePoolRead> rps = rpSvc.getAllResourcePoolForRest(); Assert.assertNotNull(rps); Assert.assertEquals(rps.size(), 1); }