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

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


     }

    @Test
    public void testCreateDraftOperation() throws Exception {

        Operation draft = getADraftOperation(_platformId, discoveryDefinitionId);

        int draftId = draft.getId();

        // check if we can retrieve one single draft

        Operation op = get("/operation/" + draftId).as(Operation.class);
        assert op !=null;
        assert op.equals(draft);

    }
View Full Code Here


    }

    @Test
    public void testCreateAndUpdateDraftOperation() throws Exception {

        Operation draft = getADraftOperation(_platformId, discoveryDefinitionId);

        int draftId = draft.getId();
        draft.getParams().put("detailedDiscovery",true);

        try {
            given()
                .contentType(ContentType.JSON)
                .pathParam("id", draftId)
View Full Code Here

    public void testCatchBadLinkSerialization() throws Exception {

        // Test that when we get Links back in bad format, we
        // correctly bail out.

        Operation draft = getADraftOperation(_platformId, discoveryDefinitionId);

        int draftId = draft.getId();
        draft.getParams().put("detailedDiscovery",true);

        String jsonWithBadLinkSer = //
        "{\n" +
            "    \"id\": " + draftId + ",\n" +
            "    \"name\": \"discovery\",\n" +
View Full Code Here

    @Test
    public void testCreateDraftOperationAndScheduleExecution() throws Exception {

        int platformId = findIdOfARealPlatform();

        Operation draft = getADraftOperation(platformId, discoveryDefinitionId);

        int draftId = draft.getId();

        draft.setReadyToSubmit(true);
        draft.getParams().put("detailedDiscovery", false);

        // update to schedule
        Operation scheduled =
        given()
            .contentType(ContentType.JSON)
            .pathParam("id",draftId)
            .body(draft)
        .expect()
            .statusCode(200)
            .log().ifError()
        .when()
            .put("/operation/{id}")
        .as(Operation.class);

        System.out.println(scheduled.getId());
        String history = findHistoryItem(scheduled);

        String historyId = history.substring(history.lastIndexOf("/")+1);
        try {
            waitAndCheckStatus(platformId, historyId);
View Full Code Here

    @Test
    public void testCreateDraftOperationNoParamsAndScheduleExecution() throws Exception {

        int platformId = findIdOfARealPlatform();

        Operation draft = getADraftOperation(platformId, viewPLDefinitionId);

        int draftId = draft.getId();

        draft.setReadyToSubmit(true);

        // update to schedule
        Operation scheduled =
        given()
            .contentType(ContentType.JSON)
            .pathParam("id",draftId)
            .body(draft)
        .expect()
            .statusCode(200)
            .log().ifError()
        .when()
            .put("/operation/{id}")
        .as(Operation.class);

        System.out.println(scheduled.getId());
        String history = findHistoryItem(scheduled);

        String historyId = history.substring(history.lastIndexOf("/")+1);
        try {
            waitAndCheckStatus(platformId, historyId);
View Full Code Here

        }
    }

    private Operation getADraftOperation(int platformId, int definitionId) {
        Operation draft =
        given()
            .header(acceptJson)
            .pathParam("definitionId", definitionId)
            .queryParam("resourceId",platformId)
        .expect()
            .statusCode(200)
            .log().ifError()
        .when()
            .post("/operation/definition/{definitionId}")
        .as(Operation.class);

        assert draft != null;
        assert draft.getDefinitionId() == definitionId;

        System.out.println("--- Draft created --");
        System.out.flush();

        return draft;
View Full Code Here

    @Test
    public void testOpsScheduleMissingRequiredParam() throws Exception {

        int platformId = findIdOfARealPlatform();

        Operation draft = getADraftOperation(platformId, discoveryDefinitionId);

        int draftId = draft.getId();

        // explicitly remove the param from the draft for
        // the test
        Map<String, Object> params = draft.getParams();
        if (params.containsKey("detailedDiscovery")) {
            params.remove("detailedDiscovery");
        }

        // Update to put the new version in the server
        // We don't want to submit, so the server does not
        // validate and we should get a 200 back
        draft.setReadyToSubmit(false);
        given()
            .contentType(ContentType.JSON)
            .pathParam("id",draftId)
            .body(draft)
        .expect()
            .statusCode(200)
            .log().ifError()
        .when()
            .put("/operation/{id}");


        // update to schedule, lacking the required param
        draft.setReadyToSubmit(true);

        given()
            .contentType(ContentType.JSON)
            .pathParam("id",draftId)
            .body(draft)
View Full Code Here

    @Test
    public void testOpsScheduleRequiredParamWrongDataType() throws Exception {

        int platformId = findIdOfARealPlatform();

        Operation draft = getADraftOperation(platformId, discoveryDefinitionId);

        int draftId = draft.getId();

        draft.getParams().put("detailedDiscovery", 42);
        draft.setReadyToSubmit(true);

        // update to schedule
        given()
            .contentType(ContentType.JSON)
            .pathParam("id",draftId)
View Full Code Here

TOP

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

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.