Package com.github.restdriver.serverdriver.http.response

Examples of com.github.restdriver.serverdriver.http.response.Response


        assertThat(response, hasStatusCode(400));
    }
   
    @Test
    public void testGetAlertsInvalidItems() {
        Response response = get(alerts("1").withParam("items", "-1"));
        assertThat(response, hasStatusCode(400));
    }
View Full Code Here


public class ChecksAT {
   
    @Test
    public void testGetChecksReturnsOk() {
        Response response = get(checks());
        assertThat(response, hasStatusCode(200));
        assertThat(response.asJson(), hasJsonPath("$.values", hasSize(0)));
    }
View Full Code Here

        assertThat(response.asJson(), hasJsonPath("$.values", hasSize(0)));
    }
   
    @Test
    public void testGetChecksReturnsResultsOk() {
        Response createResponse = createCheck("{ }");
        Response response = get(checks());
        assertThat(response, hasStatusCode(200));
        assertThat(response.asJson(), hasJsonPath("$.values", hasSize(1)));
        deleteLocation(createResponse.getHeader("Location").getValue());
    }
View Full Code Here

        deleteLocation(createResponse.getHeader("Location").getValue());
    }
   
    @Test
    public void testGetChecksByErrorStateReturnsOk() {
        Response createResponse = createCheck("{ \"state\" : \"ERROR\" }");
        Response response = get(checks().withParam("state", "ERROR"));
        assertThat(response, hasStatusCode(200));
        assertThat(response.asJson(), hasJsonPath("$.values", hasSize(1)));
        deleteLocation(createResponse.getHeader("Location").getValue());
    }
View Full Code Here

        deleteLocation(createResponse.getHeader("Location").getValue());
    }
   
    @Test
    public void testGetChecksByWarnStateReturnsOk() {
        Response createResponse = createCheck("{ \"state\" : \"WARN\" }");
        Response response = get(checks().withParam("state", "WARN"));
        assertThat(response, hasStatusCode(200));
        assertThat(response.asJson(), hasJsonPath("$.values", hasSize(1)));
        deleteLocation(createResponse.getHeader("Location").getValue());
    }
View Full Code Here

        deleteLocation(createResponse.getHeader("Location").getValue());
    }
   
    @Test
    public void testCreateCheckReturnsCreated() {
        Response response = createCheck("{ }");
        assertThat(response, hasStatusCode(201));
        deleteLocation(response.getHeader("Location").getValue());
    }
View Full Code Here

        deleteLocation(response.getHeader("Location").getValue());
    }
   
    @Test
    public void testCreateCheckWithErrorState() {
        Response response = createCheck("{ \"state\" : \"ERROR\" }");
        assertThat(response, hasStatusCode(201));
        String location = response.getHeader("Location").getValue();
        assertThat(get(location).asJson(), hasJsonPath("$.state", is("ERROR")));
        deleteLocation(location);
    }
View Full Code Here

        deleteLocation(location);
    }

    @Test
    public void testCreateCheckWithSubscriptionIncluded() {
        Response response = createCheck("{ \"name\": \"test\", \"warn\": 1.0, \"error\": 0, " +
                "\"subscriptions\": [ { \"target\": \"nobody@test.com\", \"type\":\"EMAIL\" } ] }");
        assertThat(response, hasStatusCode(201));
        String location = response.getHeader("Location").getValue();
        assertThat(get(location).asJson(), hasJsonPath("$.subscriptions", hasSize(1)));
        deleteLocation(location);
    }
View Full Code Here

        deleteLocation(location);
    }
   
    @Test
    public void testUpdateHandlesNullLastCheckDate() {
        Response response = createCheck("{ \"name\": \"test\", \"warn\": 1.0, \"error\": 2.0 }");
        assertThat(response, hasStatusCode(201));
        String location = response.getHeader("Location").getValue();
        assertThat(put(location, body(get(location).asText(), "application/json")), hasStatusCode(200));
        deleteLocation(location);
    }
View Full Code Here

    @Test
    public void testShouldGetOneCheckByIsolatedNamePattern() {
        Set<String> locations =  createStubChecksForPatternMatching();

        Response response = get(checks().withParam("fields", "name").withParam("regexes", "patternName1"));
        assertThat(response, hasStatusCode(200));
        JsonNode responseJson = response.asJson();
        assertThat(responseJson, hasJsonPath("$.values", hasSize(1)));

        cleanupChecks(locations);
    }
View Full Code Here

TOP

Related Classes of com.github.restdriver.serverdriver.http.response.Response

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.