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

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


    }

    @Test
    public void testGetAggregateForGroup() throws Exception {

        Group group = new Group(X_TEST_GROUP);

        Response resp =
        given()
                .header(acceptJson)
                .contentType(ContentType.JSON)
                .body(group)
            .expect()
                .statusCode(isOneOf(200,201))
                .log().ifError()
            .when()
                .post("/group");


        Group createdGroup = resp.as(Group.class);


        // Determine location from response
        int groupId = createdGroup.getId();

        try {
            // add the platform
            given()
                .header(acceptJson)
View Full Code Here


    }

    @Test
    public void testGetDataForGroup() throws Exception {

        Group group = new Group(X_TEST_GROUP);

        Response resp =
        given()
                .header(acceptJson)
                .contentType(ContentType.JSON)
                .body(group)
            .expect()
                .statusCode(isOneOf(200,201))
                .log().ifError()
            .when()
                .post("/group");


        Group createdGroup = resp.as(Group.class);


        // Determine location from response
        int groupId = createdGroup.getId();

        try {
            // add the platform
            given()
                .header(acceptJson)
View Full Code Here

    }

    @Test
    public void testGetDataForGroup45Points() throws Exception {

        Group group = new Group(X_TEST_GROUP);

        Response resp =
        given()
                .header(acceptJson)
                .contentType(ContentType.JSON)
                .body(group)
            .expect()
                .statusCode(isOneOf(200,201))
                .log().ifError()
            .when()
                .post("/group");


        Group createdGroup = resp.as(Group.class);


        // Determine location from response
        int groupId = createdGroup.getId();

        try {
            // add the platform
            given()
                .header(acceptJson)
View Full Code Here

    public void testCreateDefinitionForGroup() throws Exception {

        assert _platformTypeId!=0 : "Set up did not run or failed";

        // Create a group
        Group group = new Group("test-group-" + System.currentTimeMillis()/1000);
        group.setCategory("COMPATIBLE");
        group.setResourceTypeId(_platformTypeId);

        String groupUri =
        given()
            .header(acceptJson)
            .contentType(ContentType.JSON)
View Full Code Here

            .get("/group");
    }

    @Test
    public void testCreateGroupAndRemove() throws Exception {
        Group group = new Group(X_TEST_GROUP);

        // create the group
        Response created =
        given()
                .header(acceptJson)
View Full Code Here

    }

    @Test
    public void testCreateGroupTwice() throws Exception {
        Group group = new Group(X_TEST_GROUP);

        // create the group
        Response created =
        given()
            .header(acceptJson)
            .contentType(ContentType.JSON)
            .body(group)
        .expect()
            .statusCode(HttpStatus.SC_CREATED)
            .log().ifError()
        .when()
            .post("/group");

        // Determine location from response
        // and compare id with the found group below
        String location = created.header("Location");
        int createdId = Integer.parseInt(location.substring(location.lastIndexOf("/")+1));

        try {
            Group group2 =
            given()
                .header(acceptJson)
                .contentType(ContentType.JSON)
                .body(group)
            .expect()
                .statusCode(200)
                .log().ifError()
            .when()
                .post("/group")
            .as(Group.class);

            assert group2 != null;
            assert group2.getName().equals(group.getName());
            assert group2.getId() == createdId;
        }

        finally {
        // delete the group again
        given()
View Full Code Here

    }

    @Test
    public void testCreateGroupBadResourceType() throws Exception {
        Group group = new Group(X_TEST_GROUP);
        group.setResourceTypeId(42);

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

    }

    @Test
    public void testCreateGroupNoName() throws Exception {

        Group group = new Group();

        // create the group
        given()
            .body(group)
            .header(acceptJson)
View Full Code Here

            .get("/group/{gid}");
    }

    @Test
    public void testUpdateGroupWithInvalidId() throws Exception {
        Group group = new Group(X_TEST_GROUP);
        given()
            .pathParam("gid",42)
            .header(acceptJson)
            .contentType(ContentType.JSON)
            .body(group)
View Full Code Here

            .put("/group/{gid}");
    }

    @Test
    public void testUpdateGroup() throws Exception {
        Group group = new Group(X_TEST_GROUP);

        // Generate the group
        Response response =
        given()
                .header(acceptJson)
                .contentType(ContentType.JSON)
                .body(group)
            .expect()
                .statusCode(HttpStatus.SC_CREATED)
                .log().ifError()
            .when()
                .post("/group");

        String location = response.header("Location");
        int id = Integer.parseInt(location.substring(location.lastIndexOf("/")+1));

        try {
            group.setName("-x-test-2");
            given()
                .header(acceptJson)
                .contentType(ContentType.JSON)
                .body(group)
                .pathParam("id",id)
View Full Code Here

TOP

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

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.