Package org.rhq.modules.integrationTests.restApi.d

Examples of org.rhq.modules.integrationTests.restApi.d.AlertDefinition


    @Test
    public void testCreateDeleteBasicAlertDefinitionNoneDampening() throws Exception {

        int definitionId=0;
        try {
            AlertDefinition alertDefinition = new AlertDefinition();
            alertDefinition.setName("-x-test-definition");
            alertDefinition.setEnabled(false);
            alertDefinition.setPriority("LOW");
            alertDefinition.setDampeningCategory("NONE");

            AlertDefinition result =
            given()
                .header(acceptJson)
                .contentType(ContentType.JSON)
                .body(alertDefinition)
                .queryParam("resourceId",_platformId)
            .expect()
                .statusCode(201)
                .body("dampeningCategory",is("NONE"))
                .body("dampeningCount",is(0))
                .body("dampeningPeriod",is(0))
            .when()
                .post("/alert/definitions")
            .as(AlertDefinition.class);

            definitionId = result.getId();

        } finally {
            cleanupDefinition(definitionId);
        }
    }
View Full Code Here


    @Test
    public void testCreateDeleteBasicAlertDefinitionWithBadSender() throws Exception {

        int definitionId=0;
        try {
            AlertDefinition alertDefinition = new AlertDefinition();
            alertDefinition.setName("-x-test-definition");
            alertDefinition.setEnabled(false);
            alertDefinition.setPriority("LOW");
            alertDefinition.setDampeningCategory("NONE");

            AlertNotification notification = new AlertNotification("Invalid sender name");
            alertDefinition.getNotifications().add(notification);

            given()
                .header(acceptJson)
                .contentType(ContentType.JSON)
                .body(alertDefinition)
View Full Code Here

    @Test
    public void testCreateDeleteBasicAlertDefinitionWithBadRecoveryId() throws Exception {

        int definitionId=0;
        try {
            AlertDefinition alertDefinition = new AlertDefinition();
            alertDefinition.setName("-x-test-definition");
            alertDefinition.setEnabled(false);
            alertDefinition.setPriority("LOW");
            alertDefinition.setDampeningCategory("NONE");
            alertDefinition.setRecoveryId(13);

            given()
                .header(acceptJson)
                .contentType(ContentType.JSON)
                .body(alertDefinition)
View Full Code Here

    }

    @Test
    public void testCreateDeleteBasicAlertDefinitionBadDampeningCategory() throws Exception {

        AlertDefinition alertDefinition = new AlertDefinition();
        alertDefinition.setName("-x-test-definition");
        alertDefinition.setEnabled(false);
        alertDefinition.setPriority("LOW");
        alertDefinition.setDampeningCategory("Hulla");

        given()
            .header(acceptJson)
            .contentType(ContentType.JSON)
            .body(alertDefinition)
View Full Code Here

    @Test
    public void testCreateDeleteBasicAlertDefinition3of5Dampening() throws Exception {

        int definitionId=0;
        try {
            AlertDefinition alertDefinition = new AlertDefinition();
            alertDefinition.setName("-x-test-definition");
            alertDefinition.setEnabled(false);
            alertDefinition.setPriority("LOW");
            alertDefinition.setDampeningCategory("PARTIAL_COUNT");
            alertDefinition.setDampeningCount(3);
            alertDefinition.setDampeningPeriod(5);

            AlertDefinition result =
            given()
                .header(acceptJson)
                .contentType(ContentType.JSON)
                .body(alertDefinition)
                .queryParam("resourceId",_platformId)
            .expect()
                .statusCode(201)
                .body("dampeningCategory",is("PARTIAL_COUNT"))
                .body("dampeningCount",is(3))
                .body("dampeningPeriod",is(5))
            .when()
                .post("/alert/definitions")
            .as(AlertDefinition.class);

            definitionId = result.getId();

        } finally {
            cleanupDefinition(definitionId);
        }
    }
View Full Code Here

    @Test
    public void testCreateDeleteBasicAlertDefinitionOncein3MinDampening() throws Exception {

        int definitionId=0;
        try {
            AlertDefinition alertDefinition = new AlertDefinition();
            alertDefinition.setName("-x-test-definition");
            alertDefinition.setEnabled(false);
            alertDefinition.setPriority("LOW");
            alertDefinition.setDampeningCategory("DURATION_COUNT");
            alertDefinition.setDampeningCount(1);
            alertDefinition.setDampeningPeriod(3);
            alertDefinition.setDampeningUnit("minutes");

            AlertDefinition result =
            given()
                .header(acceptJson)
                .contentType(ContentType.JSON)
                .body(alertDefinition)
                .queryParam("resourceId", _platformId)
            .expect()
                .statusCode(201)
                .body("dampeningCategory", is("DURATION_COUNT"))
                .body("dampeningCount", is(1))
                .body("dampeningPeriod", is(3))
                .body("dampeningUnit", is("MINUTES"))
            .when()
                .post("/alert/definitions")
            .as(AlertDefinition.class);

            definitionId = result.getId();

        } finally {
            cleanupDefinition(definitionId);
        }
    }
View Full Code Here

            AlertCondition alertCondition = new AlertCondition("AVAILABILITY", "AVAIL_GOES_UP");
            addConditionToDefinition(definitionId, alertCondition);

            // Retrieve the definition with the added condition
            AlertDefinition updatedDefinition =
            given()
                .pathParam("id",definitionId)
                .queryParam("full",true)
            .expect()
                .statusCode(200)
                .log().everything()
            .when()
                .get("/alert/definition/{id}")
                .as(AlertDefinition.class);

            int size = updatedDefinition.getConditions().size();
            assert size ==1 : "Did not find 1 condition, but " + size;
        }

        finally {
            // delete the definition again
View Full Code Here

            AlertCondition alertCondition = new AlertCondition("AVAIL_DURATION", "AVAIL_DURATION_NOT_UP");
            alertCondition.setOption("300"); // duration in seconds
            addConditionToDefinition(definitionId, alertCondition);

            // Retrieve the definition with the added condition
            AlertDefinition updatedDefinition =
            given()
                .pathParam("id",definitionId)
                .queryParam("full",true)
            .expect()
                .statusCode(200)
                .log().everything()
            .when()
                .get("/alert/definition/{id}")
                .as(AlertDefinition.class);

            int size = updatedDefinition.getConditions().size();
            assert size ==1 : "Did not find 1 condition, but " + size;
        }

        finally {
            // delete the definition again
View Full Code Here

            AlertCondition alertCondition = new AlertCondition("EVENT", "DEBUG");
            alertCondition.setOption(".*lala.*"); // RegEx to match
            addConditionToDefinition(definitionId, alertCondition);

            // Retrieve the definition with the added condition
            AlertDefinition updatedDefinition =
            given()
                .pathParam("id",definitionId)
                .queryParam("full",true)
            .expect()
                .statusCode(200)
                .log().everything()
            .when()
                .get("/alert/definition/{id}")
                .as(AlertDefinition.class);

            int size = updatedDefinition.getConditions().size();
            assert size ==1 : "Did not find 1 condition, but " + size;
        }

        finally {
            // delete the definition again
View Full Code Here

            alertCondition.setMeasurementDefinition(metricDefinitionId);

            addConditionToDefinition(definitionId, alertCondition);

            // Retrieve the definition with the added condition
            AlertDefinition updatedDefinition =
            given()
                .pathParam("id",definitionId)
                .queryParam("full",true)
            .expect()
                .statusCode(200)
                .log().everything()
            .when()
                .get("/alert/definition/{id}")
                .as(AlertDefinition.class);

            int size = updatedDefinition.getConditions().size();
            assert size ==1 : "Did not find 1 condition, but " + size;
        }

        finally {
            // delete the definition again
View Full Code Here

TOP

Related Classes of org.rhq.modules.integrationTests.restApi.d.AlertDefinition

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.