	@SuppressWarnings("unchecked")
	@Test		
	public void deleteDataSourceTest() throws Exception {		

		final DBDataSource datasourceCondition = new DBDataSource();		
		datasourceCondition.setOwner(uttestuser);		
		datasourceCondition.setName(uttestdatasource1);		
		datasourceCondition.setType("druid");		
		datasourceCondition.setEndpoint("http://endpoint.test.com");		
		datasourceCondition.setCreateTime(new Date());		
				
		final DBDataSource datasourceCondition2 = new DBDataSource();		
		datasourceCondition2.setOwner(uttestuser);		
		datasourceCondition2.setName(uttestdatasource2);		
		datasourceCondition2.setType("druid");		
		datasourceCondition2.setEndpoint("http://endpoint.test.com");		
		datasourceCondition2.setCreateTime(new Date());		
				
		RDBMS db = Mockito.mock(RDBMS.class);				
		when(db.query(Matchers.anyString(),Matchers.eq(ImmutableMap.of("name", uttestdatasource1)), Matchers.eq(-1),Matchers.any(DBDataSourceMapper.class)))		
		.thenReturn(Lists.<DBDataSource>newArrayList(datasourceCondition));		
		when(db.query(Matchers.anyString(),Matchers.eq(ImmutableMap.of("name", uttestdatasource2)), Matchers.eq(-1),Matchers.any(DBDataSourceMapper.class)))		
		.thenReturn(Lists.<DBDataSource>newArrayList(datasourceCondition2));		
				
		when(db.update(Mockito.anyString(), Matchers.anyMap()))		
		.thenReturn(1);		
		when(db.delete(Mockito.anyString(), Matchers.eq(ImmutableMap.of("name",uttestdatasource1))))		
		.thenReturn(1);		
		when(db.delete(Mockito.anyString(), Matchers.eq(ImmutableMap.of("name",uttestdatasource2))))		
		.thenReturn(1);		
		DataSourceService datasourceService = new DataSourceService();		
		BaseDBService<?> ds=(BaseDBService<?>)ReflectFieldUtil.getField(datasourceService, "datasourceService");		
		BaseDBService<?> rs=(BaseDBService<?>)ReflectFieldUtil.getField(datasourceService, "rightGroupService");		
		ReflectFieldUtil.setField(BaseDBService.class,ds, "db", db);		
		ReflectFieldUtil.setField(BaseDBService.class,rs, "db", db);		
		
		long id = datasourceService.deleteDataSource(uttestdatasource1);		
		Assert.assertTrue(id > 0);		
				
		datasourceService.deleteDataSources(Lists.newArrayList(		
				uttestdatasource1,uttestdatasource2));		
		Assert.assertTrue(id > 0);		
				
	}