@Test
  public void testNoAggregateCalculationOnSoftAlert() throws Exception {
    AlertDefinition aggregateDefinition = getAggregateAlertDefinition();
    AlertCurrentEntity currentEntityMock = EasyMock.createNiceMock(AlertCurrentEntity.class);
    AlertHistoryEntity historyEntityMock = EasyMock.createNiceMock(AlertHistoryEntity.class);

    EasyMock.expect(currentEntityMock.getAlertHistory()).andReturn(historyEntityMock).atLeastOnce();
    EasyMock.expect(currentEntityMock.getFirmness()).andReturn(AlertFirmness.SOFT).atLeastOnce();

    EasyMock.expect(m_aggregateMapping.getAggregateDefinition(EasyMock.anyLong(),
        EasyMock.eq("mock-alert"))).andReturn(aggregateDefinition).atLeastOnce();

    AlertSummaryDTO summaryDTO = new AlertSummaryDTO(5, 0, 0, 0, 0);
    EasyMock.expect(m_alertsDao.findAggregateCounts(EasyMock.anyLong(),
        EasyMock.eq("mock-aggregate-alert"))).andReturn(summaryDTO).atLeastOnce();

    EasyMock.replay(m_alertsDao, m_aggregateMapping, currentEntityMock);

    // check that we're starting at 0
    Assert.assertEquals(0, m_listener.getAlertEventReceivedCount(AlertReceivedEvent.class));

    // trigger an alert which would normally trigger the aggregate, except that
    // the alert will be SOFT and should not cause a recalculation
    Alert alert = new Alert("mock-alert", null, null, null, null, null);
    AlertAggregateListener aggregateListener = m_injector.getInstance(AlertAggregateListener.class);
    AlertStateChangeEvent event = new AlertStateChangeEvent(0, alert, currentEntityMock, null,
        AlertFirmness.HARD);
    aggregateListener.onAlertStateChangeEvent(event);

    // ensure that the aggregate listener did not trigger an alert in response
    // to the SOFT alert
    Assert.assertEquals(0, m_listener.getAlertEventReceivedCount(AlertReceivedEvent.class));
  }
Tests that the {@link AlertAggregateListener} disregards
{@link AlertFirmness#SOFT} alerts.

@throws Exception
ambari-server/src/test/java/org/apache/ambari/server/state/alerts/AggregateAlertListenerTest.java