AppManagerService implements IAppManagerService { @Override @Transactional public void modifyAppManager(AppManagerAdd appManagerAdd) { logger.debug("modify app manager " + appManagerAdd); String name = appManagerAdd.getName(); AppManagerEntity entity = appManagerDAO.findByName(name); entity.setDescription(appManagerAdd.getDescription()); entity.setType(appManagerAdd.getType()); entity.setUrl(appManagerAdd.getUrl()); entity.setUsername(appManagerAdd.getUsername()); entity.setPassword(appManagerAdd.getPassword()); entity.setSslCertificate(appManagerAdd.getSslCertificate()); appManagerDAO.update(entity); logger.debug("successfully modified app manager " + appManagerAdd); }  IAppManagerDAO getAppManagerDAO(); @Autowired void setAppManagerDAO(IAppManagerDAO appManagerDAO); IClusterDAO getClusterDao(); @Autowired void setClusterDao(IClusterDAO clusterDao); @Override @Transactional synchronized void addAppManager(AppManagerAdd appManagerAdd); @Override @Transactional(readOnly = true) AppManagerEntity findAppManagerByName(String name); @Override @Transactional(readOnly = true) AppManagerRead getAppManagerRead(String name); @Override @Transactional(readOnly = true) List<AppManagerRead> getAllAppManagerReads(); @Override @Transactional(readOnly = true) List<AppManagerEntity> findAll(); @Override @Transactional void deleteAppManager(String name); @Override @Transactional void modifyAppManager(AppManagerAdd appManagerAdd);  }
@Test(groups = { "res-mgmt" }) public void testModifyAppManager() { new NonStrictExpectations() { { appManagerDAO.findByName(anyString); result = appMgrEntity; } }; appMgrSvc.setAppManagerDAO(appManagerDAO); AppManagerAdd appMgr = new AppManagerAdd(); appMgr.setType(Constants.AMBARI_PLUGIN_TYPE); appMgr.setUrl("http: appMgrSvc.modifyAppManager(appMgr); new Verifications() { { appManagerDAO.update(withAny(appMgrEntity)); } }; }