public AlertDefinitionEntity createAlertDefinition(long clusterId)
      throws Exception {
    AlertDefinitionEntity definition = new AlertDefinitionEntity();
    definition.setDefinitionName("Alert Definition "
        + System.currentTimeMillis());
    definition.setServiceName("AMBARI");
    definition.setComponentName(null);
    definition.setClusterId(clusterId);
    definition.setHash(UUID.randomUUID().toString());
    definition.setScheduleInterval(60);
    definition.setScope(Scope.SERVICE);
    definition.setSource("{\"type\" : \"SCRIPT\"}");
    definition.setSourceType(SourceType.SCRIPT);

    alertDefinitionDAO.create(definition);
    return alertDefinitionDAO.findById(definition.getDefinitionId());
  }
Creates an alert definition.

@param clusterId
@return
@throws Exception
ambari-server/src/test/java/org/apache/ambari/server/orm/OrmTestHelper.java