DatastoreService implements IDatastoreService { @Override @Transactional(readOnly = true) public Set<String> getLocalDatastoresByNames(List<String> nameList) { if (nameList == null) { return null; } Set<String> result = new HashSet<String>(); for (String name : nameList) { result.addAll(getAllDatastoresByTypeAndName(DatastoreType.LOCAL, name)); } return result; }  IDatastoreDAO getDsDao(); @Autowired void setDsDao(IDatastoreDAO dsDao); IClusterDAO getClusterDao(); @Autowired void setClusterDao(IClusterDAO clusterDao); IResourceService getResService(); @Autowired void setResService(IResourceService resManager); @Override @Transactional(readOnly = true) Set<String> getAllSharedDatastores(); @Override @Transactional(readOnly = true) Set<String> getSharedDatastoresByNames(List<String> nameList); @Override @Transactional(readOnly = true) Set<String> getLocalDatastoresByNames(List<String> nameList); @Override @Transactional(readOnly = true) Set<String> getAllLocalDatastores(); @Override @Transactional(readOnly = true) Set<String> getDatastoresByName(String name); @Override @Transactional(readOnly = true) Set<String> getDatastoresByNames(List<String> nameList); @Override @Transactional void addDatastores(DatastoreAdd datastore); @Override @Transactional void addDatastores(String name, DatastoreType type, List<String> spec, boolean regex); @Override @Transactional(readOnly = true) Set<String> getAllDatastoreNames(); @Override @Transactional(readOnly = true) DatastoreRead getDatastoreRead(String name); @Override @Transactional(readOnly = true) List<DatastoreRead> getAllDatastoreReads(); @Override @Transactional void deleteDatastore(String name);  }
@Test(groups = { "res-mgmt" }) public void testGetLocalDatastoresByNames() { new Expectations() { { dsDao.findByNameAndType(DatastoreType.LOCAL, anyString); result = dss; } }; datastoreSvc.setDsDao(dsDao); List<String> names = new ArrayList<String>(); names.add("ds01"); Set<String> patterns = datastoreSvc.getLocalDatastoresByNames(names); Assert.assertTrue(patterns.size() == 1); }