Package com.rallydev.rest.response

Examples of com.rallydev.rest.response.QueryResponse.wasSuccessful()


        doReturn(new Gson().toJson(response)).when(api.client).doGet(request.toUrl());
        QueryResponse queryResponse = api.query(request);

        verify(api.client, times(1)).doGet(anyString());
        verify(api.client).doGet(request.toUrl());
        Assert.assertTrue(queryResponse.wasSuccessful());
        assertEquals(queryResponse.getTotalResultCount(), 5);
    }

    public void shouldQueryAllPages() throws Exception {
        JsonObject response = buildQueryResponse(5);
View Full Code Here


     * @return the resulting {@link QueryResponse}
     * @throws IOException if an error occurs during the query.
     */
    public QueryResponse query(QueryRequest request) throws IOException {
        QueryResponse queryResponse = new QueryResponse(client.doGet(request.toUrl()));
        if (queryResponse.wasSuccessful()) {
            int receivedRecords = request.getPageSize();
            while (receivedRecords < request.getLimit() &&
                    (receivedRecords + request.getStart() - 1) < queryResponse.getTotalResultCount()) {
                QueryRequest pageRequest = request.clone();
                pageRequest.setStart(receivedRecords + request.getStart());
View Full Code Here

            while (receivedRecords < request.getLimit() &&
                    (receivedRecords + request.getStart() - 1) < queryResponse.getTotalResultCount()) {
                QueryRequest pageRequest = request.clone();
                pageRequest.setStart(receivedRecords + request.getStart());
                QueryResponse pageResponse = new QueryResponse(client.doGet(pageRequest.toUrl()));
                if (pageResponse.wasSuccessful()) {
                    JsonArray results = queryResponse.getResults();
                    results.addAll(pageResponse.getResults());
                    receivedRecords += pageRequest.getPageSize();
                }
            }
View Full Code Here

            //Return up to 5, 1 per page
            defects.setPageSize(1);
            defects.setLimit(5);

            QueryResponse queryResponse = restApi.query(defects);
            if (queryResponse.wasSuccessful()) {
                System.out.println(String.format("\nTotal results: %d", queryResponse.getTotalResultCount()));
                System.out.println("Top 5:");
                for (JsonElement result : queryResponse.getResults()) {
                    JsonObject defect = result.getAsJsonObject();
                    System.out.println(String.format("\t%s - %s: Priority=%s, State=%s",
View Full Code Here

            //Query the defects collection
            QueryRequest defectRequest = new QueryRequest(defectInfo);
            defectRequest.setFetch(new Fetch("FormattedID", "Name", "State", "Priority"));

            QueryResponse queryResponse = restApi.query(defectRequest);
            if (queryResponse.wasSuccessful()) {
                for (JsonElement result : queryResponse.getResults()) {
                    JsonObject defect = result.getAsJsonObject();
                    System.out.println(String.format("\t%s - %s: Priority=%s, State=%s",
                            defect.get("FormattedID").getAsString(),
                            defect.get("Name").getAsString(),
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.