@Test
public void test20updateService() throws Exception {

	XXServiceDao xServiceDao = Mockito.mock(XXServiceDao.class);
	XXService xService = Mockito.mock(XXService.class);
	XXServiceConfigMapDao xServiceConfigMapDao = Mockito
			.mock(XXServiceConfigMapDao.class);
	XXServiceConfigDefDao xServiceConfigDefDao = Mockito
			.mock(XXServiceConfigDefDao.class);
	XXUserDao xUserDao = Mockito.mock(XXUserDao.class);
       	XXServiceResourceDao xServiceResourceDao = Mockito.mock(XXServiceResourceDao.class);
	RangerService rangerService = rangerService();
	Map<String, Object> options = null;
	String name = "fdfdfds";
	List<XXTrxLog> trxLogList = new ArrayList<XXTrxLog>();
	XXTrxLog xTrxLogObj = new XXTrxLog();
	xTrxLogObj.setAction("create");
	xTrxLogObj.setAddedByUserId(Id);
	xTrxLogObj.setAttributeName("User Role");
	xTrxLogObj.setCreateTime(new Date());
	xTrxLogObj.setId(Id);
	xTrxLogObj.setNewValue("admin");
	xTrxLogObj.setObjectClassType(0);
	xTrxLogObj.setObjectId(1L);
	xTrxLogObj.setParentObjectClassType(0);
	xTrxLogObj.setParentObjectId(Id);
	trxLogList.add(xTrxLogObj);
	Mockito.when(daoManager.getXXService()).thenReturn(xServiceDao);
	Mockito.when(xServiceDao.getById(Id)).thenReturn(xService);
	Mockito.when(daoManager.getXXService()).thenReturn(xServiceDao);
	List<XXServiceConfigDef> xServiceConfigDefList = new ArrayList<XXServiceConfigDef>();
	XXServiceConfigDef serviceConfigDefObj = new XXServiceConfigDef();
	serviceConfigDefObj.setId(Id);
	xServiceConfigDefList.add(serviceConfigDefObj);
	Mockito.when(daoManager.getXXServiceConfigDef()).thenReturn(
			xServiceConfigDefDao);
	Mockito.when(daoManager.getXXServiceResource()).thenReturn(xServiceResourceDao);
	Mockito.when(xServiceResourceDao.countTaggedResourcesInServiceId(xService.getId())).thenReturn(0L);
	Mockito.when(svcService.update(rangerService))
			.thenReturn(rangerService);
	Mockito.when(daoManager.getXXService()).thenReturn(xServiceDao);
	Mockito.when(xServiceDao.getById(Id)).thenReturn(xService);
	List<XXServiceConfigMap> xConfMapList = new ArrayList<XXServiceConfigMap>();
	XXServiceConfigMap xConfMap = new XXServiceConfigMap();
	xConfMap.setAddedByUserId(null);
	xConfMap.setConfigkey(name);
	xConfMap.setConfigvalue(name);
	xConfMap.setCreateTime(new Date());
	xConfMap.setServiceId(null);
	xConfMap.setUpdatedByUserId(null);
	xConfMap.setUpdateTime(new Date());
	xConfMapList.add(xConfMap);
	Mockito.when(daoManager.getXXServiceConfigMap()).thenReturn(
			xServiceConfigMapDao);
	Mockito.when(xServiceConfigMapDao.findByServiceId(Id)).thenReturn(
			xConfMapList);
	Mockito.when(daoManager.getXXServiceConfigMap()).thenReturn(
			xServiceConfigMapDao);
	Mockito.when(xServiceConfigMapDao.remove(xConfMap)).thenReturn(true);
	Mockito.when(daoManager.getXXServiceConfigMap()).thenReturn(
			xServiceConfigMapDao);
	Mockito.when(daoManager.getXXUser()).thenReturn(xUserDao);
	Mockito.when(
			rangerAuditFields.populateAuditFields(
					Mockito.isA(XXServiceConfigMap.class),
					Mockito.isA(XXService.class))).thenReturn(xConfMap);
	Mockito.when(svcService.getPopulatedViewObject(xService)).thenReturn(
			rangerService);
	RangerService dbRangerService = serviceDBStore
			.updateService(rangerService, options);
	Assert.assertNotNull(dbRangerService);
	Assert.assertEquals(dbRangerService, rangerService);
	Assert.assertEquals(dbRangerService.getId(), rangerService.getId());
	Assert.assertEquals(dbRangerService.getName(), rangerService.getName());
	Assert.assertEquals(dbRangerService.getCreatedBy(),
			rangerService.getCreatedBy());
	Assert.assertEquals(dbRangerService.getDescription(),
			rangerService.getDescription());
	Assert.assertEquals(dbRangerService.getType(), rangerService.getType());
	Assert.assertEquals(dbRangerService.getVersion(),
			rangerService.getVersion());
	Mockito.verify(daoManager).getXXUser();
}