Package org.rhq.core.domain.alert

Examples of org.rhq.core.domain.alert.Alert


        /*
         * some dampening event occurred, handle it accordingly.  if it was positive, check whether this
         * AlertDefinition can fire an alert according to its dampening category rules.  currently, these is no
         * supported dampening event that can fire as the result of a partial condition set match.
         */
        Alert firedAlert = null;

        try {
            boolean fire = false;

            // get the alert definition in preparation for lots of processing on it
View Full Code Here


        md.setUnits(MeasurementUnits.BYTES);
        return md;
    }

    private Alert createAlert(AlertCondition condition) {
        Alert alert = new Alert();
        AlertConditionLog conditionLog = new AlertConditionLog(condition, System.currentTimeMillis());
        alert.addConditionLog(conditionLog);
        return alert;
    }
View Full Code Here

        alertParameters.setSimpleValue(PARAM_VARIABLE_BINDING_PREFIX, TEST_VARIABLE_BINDING_PREFIX);
        alertParameters.setSimpleValue(PARAM_PORT, String.valueOf(getTestPort()));
        snmpSender.setAlertParameters(alertParameters);

        int resourceId = 13004;
        Alert alert = createAlertForResourceWithId(resourceId, "", "", HIGH);
        String exceptionMessage = "Test Error";
        when(resourceManager.getResourceLineage(eq(resourceId))).thenThrow(new RuntimeException(exceptionMessage));

        SenderResult result = snmpSender.send(alert);
View Full Code Here

    private void testSendWithSnmpTrapOid(OID snmpTrapOid) throws InterruptedException {
        int resourceId = 13004;
        String resourceName = "Resource " + resourceId;
        String alertDefinitionName = "Alert Definition " + resourceId;
        AlertPriority alertPriority = HIGH;
        Alert alert = createAlertForResourceWithId(resourceId, resourceName, alertDefinitionName, alertPriority);
        Resource platformResouce = new Resource();
        String platformName = "Platform Resource " + resourceId;
        platformResouce.setName(platformName);

        when(resourceManager.getResourceLineage(eq(resourceId))).thenReturn(
            Arrays.asList(platformResouce, alert.getAlertDefinition().getResource()));
        String alertConditions = "Alert Conditions " + resourceId;
        when(alertManager.prettyPrintAlertConditions(eq(alert), eq(false))).thenReturn(alertConditions);
        String alertUrl = "https://www.rhq.com/alert/" + resourceId;
        when(alertManager.prettyPrintAlertURL(eq(alert))).thenReturn(alertUrl);
View Full Code Here

        resource.setName(resourceName);
        AlertDefinition alertDefinition = new AlertDefinition();
        alertDefinition.setName(alertDefinitionName);
        alertDefinition.setResource(resource);
        alertDefinition.setPriority(alertPriority);
        Alert alert = new Alert();
        alert.setAlertDefinition(alertDefinition);
        return alert;
    }
View Full Code Here

    private static final String FOO_DOT_BAR = "foo.bar";
    private static final String ALERT_BAR = "alert.bar";

    public void testSimpleReplacement() throws Exception {

        Alert al = new Alert();
        AlertTokenReplacer tr = new AlertTokenReplacer(al, null, null);


        String res = tr.replaceToken("test.fix");
        assert res != null;
View Full Code Here

*/
    }

    public void testInvalidTokenString() {

        Alert al = new Alert();
        AlertTokenReplacer tr = new AlertTokenReplacer(al, null, null);


        String res = tr.replaceToken(FOO_BAR);
        assert res != null;
View Full Code Here

    }

    public void testFullTokenSimple() {

        Alert al = new Alert();
        AlertTokenReplacer tr = new AlertTokenReplacer(al, null, null);


        String res = tr.replaceTokens("<%test.fix%>");
        assert res != null;
View Full Code Here

    public void testOperationTokens() {
        Resource r = new Resource(1234);
        AlertDefinition def = new AlertDefinition();
        def.setResource(r);
        Alert al = new Alert(def, System.currentTimeMillis());

        AlertTokenReplacer tr;
        OperationDefinition opDef = new OperationDefinition(123,"helloOps",null,"This is a test",0,"Just testing");
        tr = new AlertTokenReplacer(al,opDef, null);
        String res = tr.replaceTokens("<%operation.id%>");
View Full Code Here

                assertEquals(1, count);

                // find any acked alert
                result = alertManager.findAlertsByCriteria(testData.getSubject(), c);
                assertEquals(1, result.size());
                Alert alert = result.get(0);
                em.refresh(alert);
                assertNotNull(alert.getAcknowledgingSubject());
                assertNotNull(alert.getAcknowledgeTime());
                assertEquals(testData.getSubject().getName(), alert.getAcknowledgingSubject());
                assertTrue("Alert should just have been acknowledged", alert.getAcknowledgeTime() >= testStartTimeStamp);

                // find the acked alert by subject
                c.addFilterAcknowledgingSubject(testData.getSubject().getName());
                c.setStrict(true);
                result = alertManager.findAlertsByCriteria(testData.getSubject(), c);
                assertEquals(1, result.size());
                alert = result.get(0);
                em.refresh(alert);
                assertNotNull(alert.getAcknowledgingSubject());
                assertNotNull(alert.getAcknowledgeTime());
                assertEquals(testData.getSubject().getName(), alert.getAcknowledgingSubject());
                assertTrue("Alert should just have been acknowledged", alert.getAcknowledgeTime() >= testStartTimeStamp);

                // fail to find the acked alert
                c.addFilterUnacknowledgedOnly(Boolean.TRUE);
                c.addFilterAcknowledgingSubject(null);
                result = alertManager.findAlertsByCriteria(testData.getSubject(), c);
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.alert.Alert

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.