AppManagerService implements IAppManagerService { @Override @Transactional public synchronized void addAppManager(AppManagerAdd appManagerAdd) { logger.debug("add app manager " + appManagerAdd); AppManagerEntity appManagerEntity = new AppManagerEntity(appManagerAdd); try { appManagerDAO.insert(appManagerEntity); } catch (ConstraintViolationException cve) { throw SoftwareManagerCollectorException.DUPLICATE_NAME(appManagerAdd.getName()); } logger.debug("successfully added 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 testAddAppManager() { appMgrSvc.setAppManagerDAO(appManagerDAO); AppManagerAdd appMgr = new AppManagerAdd(); appMgr.setType(Constants.AMBARI_PLUGIN_TYPE); appMgr.setUrl("http: appMgrSvc.addAppManager(appMgr); new Verifications() { { AppManagerEntity entity = new AppManagerEntity(); appManagerDAO.insert(withAny(entity)); } }; }