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

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


    @Before
    public void setUp() throws Exception {
        setupRestAssured();

        Resource resource = new Resource();
        resource.setResourceName(REST_TEST_DUMMY);
        resource.setTypeName("Linux");

        Resource platform =
        given()
            .header(acceptJson)
            .contentType(ContentType.JSON)
            .body(resource)
        .expect()
            .statusCode(201)
            .log().ifError()
        .when()
            .post("/resource/platforms")
        .as(Resource.class);

        _platformId = platform.getResourceId();
        _platformTypeId = platform.getTypeId();

    }
View Full Code Here


    }

    @Test
    public void testCreatePlatform() throws Exception {

        Resource resource = new Resource();
        resource.setResourceName("dummy-test");
        resource.setTypeName("Linux");

        given()
            .header(acceptXml)
            .contentType(ContentType.JSON)
            .body(resource)
View Full Code Here

    }

    @Test
    public void testCreatePlatformJson() throws Exception {

        Resource resource = new Resource();
        resource.setResourceName("dummy-test");
        resource.setTypeName("Linux");

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

    }

    @Test
    public void testCreatePlatformWithBadType() throws Exception {

        Resource resource = new Resource();
        resource.setResourceName("dummy-test");
        resource.setTypeName("myGreatestOS");

        given()
            .header(acceptXml)
            .contentType(ContentType.JSON)
            .body(resource)
View Full Code Here

    }

    @Test
    public void testCreatePlatformAndRemove() throws Exception {

        Resource resource = new Resource();
        resource.setResourceName("dummy-test");
        resource.setTypeName("Linux");

        Response response =
        given()
            .header(acceptXml)
            .contentType(ContentType.JSON)
View Full Code Here

    }

    @Test
    public void testCreateUpdateRemovePlatform() throws Exception {

        Resource resource = new Resource();
        resource.setResourceName("dummy-test");
        resource.setTypeName("Linux");

        Response response =
        given()
            .header(acceptXml)
            .contentType(ContentType.JSON)
            .body(resource)
        .expect()
            .statusCode(201)
            .log().ifError()
        .when()
            .post("/resource/platforms");

        int platformId=0;
        try {
            XmlPath xmlPath = response.xmlPath();
            Node resource1 = xmlPath.get("resource");
            Node platformIdNode =  resource1.get("resourceId");
            platformId = Integer.parseInt(platformIdNode.value());

            // Now update the description
            resource.setDescription("li la lu");
            resource.setLocation("Datacenter 1");
            resource.setResourceName("DummY");

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

    }

    @Test
    public void testCreateUpdateWithLinksRemovePlatform() throws Exception {

        Resource resource = new Resource();
        resource.setResourceName("dummy-test");
        resource.setTypeName("Linux");

        Response response =
        given()
            .header(acceptXml)
            .contentType(ContentType.JSON)
            .body(resource)
        .expect()
            .statusCode(201)
            .log().ifError()
        .when()
            .post("/resource/platforms");

        int platformId=0;
        try {
            XmlPath xmlPath = response.xmlPath();
            Node resource1 = xmlPath.get("resource");
            Node platformIdNode =  resource1.get("resourceId");
            platformId = Integer.parseInt(platformIdNode.value());

            // Now update the description
            resource.setDescription("li la lu");
            resource.setLocation("Datacenter 1");
            resource.setResourceName("DummY");

            /* Now add links -- JSON looks like this:
            "links": [
                  {
                      "operationDefinitions": {
                          "href": "http://localhost:7080/rest/operation/definitions?resourceId=10584"
                      }
                  },
            */

            List<Map> links = new ArrayList<Map>(1);
            Map<String,Map<String,String>> map = new HashMap<String, Map<String,String>>(1);
            Map<String,String> link = new HashMap<String, String>(1);
            link.put("href","http:/abc");
            map.put("self",link);
            links.add(map);
            resource.setLinks(links);


            given()
                .pathParam("id",platformId)
                .body(resource)
View Full Code Here

    }

    @Test
    public void testCreatePlatformUpdateAvailabilityAndRemove() throws Exception {

        Resource resource = new Resource();
        resource.setResourceName("dummy-test");
        resource.setTypeName("Linux");

        Response response =
        given()
            .header(acceptXml)
            .contentType(ContentType.JSON)
View Full Code Here

    }

    @Test
    public void testCreatePlatformWithChildAndRemove() throws Exception {

        Resource platform = new Resource();
        platform.setResourceName("dummy-test");
        platform.setTypeName("Linux");

        Response response =
            with().body(platform)
                .header("Content-Type","application/json")
                .header("Accept","application/json")
            .expect()
                .statusCode(201)
                .log().ifError()
            .when()
                .post("/resource/platforms");

        String platformId = response.jsonPath().getString("resourceId");

        Resource child = new Resource();
        child.setResourceName("test");
        child.setTypeName("CPU");
        child.setPluginName("Platforms");
        child.setParentId(Integer.valueOf(platformId));

        try {

            with()
                .body(child)
View Full Code Here

TOP

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

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.