@Test
public void testAlertCurrentPredicate() throws Exception {

  AlertDefinitionEntity definition = m_definitionDao.findByName(
      m_cluster.getClusterId(), "Alert Definition 0");
  assertNotNull(definition);
  Predicate definitionIdPredicate = null;
  Predicate hdfsPredicate = null;
  Predicate yarnPredicate = null;
  definitionIdPredicate = new PredicateBuilder().property(
      AlertResourceProvider.ALERT_DEFINITION_ID).equals(
      definition.getDefinitionId()).toPredicate();
  AlertCurrentRequest request = new AlertCurrentRequest();
  request.Predicate = definitionIdPredicate;
  List<AlertCurrentEntity> currentAlerts = m_dao.findAll(request);
  assertEquals(1, currentAlerts.size());
  hdfsPredicate = new PredicateBuilder().property(
      AlertResourceProvider.ALERT_SERVICE).equals("HDFS").toPredicate();
  yarnPredicate = new PredicateBuilder().property(
      AlertResourceProvider.ALERT_SERVICE).equals("YARN").toPredicate();
  request.Predicate = yarnPredicate;
  currentAlerts = m_dao.findAll(request);
  assertEquals(5, currentAlerts.size());
  request.Predicate = hdfsPredicate;
  currentAlerts = m_dao.findAll(request);
  assertEquals(0, currentAlerts.size());
}