Package com.rallydev.rest.request

Examples of com.rallydev.rest.request.QueryRequest.toUrl()


            int receivedRecords = request.getPageSize();
            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


    public void shouldQueryOnePage() throws Exception {
        JsonObject response = buildQueryResponse(5);
        QueryRequest request = new QueryRequest("Defect");
        request.setPageSize(1);
        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());
View Full Code Here

        request.setPageSize(1);
        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 {
View Full Code Here

        request.setPageSize(1);
        request.setLimit(Integer.MAX_VALUE);
        doReturn(new Gson().toJson(response)).when(api.client).doGet(anyString());
        api.query(request);

        String requestUrl = request.toUrl();
        verify(api.client, times(5)).doGet(anyString()); //make sure 5 gets
        verify(api.client).doGet(requestUrl);
        verify(api.client).doGet(requestUrl.replace("start=1", "start=2"));
        verify(api.client).doGet(requestUrl.replace("start=1", "start=3"));
        verify(api.client).doGet(requestUrl.replace("start=1", "start=4"));
View Full Code Here

        request.setPageSize(2);
        request.setLimit(4);
        doReturn(new Gson().toJson(response)).when(api.client).doGet(anyString());
        api.query(request);

        String requestUrl = request.toUrl();

        verify(api.client, times(2)).doGet(anyString()); //make sure 2 gets
        verify(api.client).doGet(requestUrl);
        verify(api.client).doGet(requestUrl.replace("start=1", "start=3"));
    }
View Full Code Here

        request.setLimit(4);
        doReturn(new Gson().toJson(response)).when(api.client).doGet(anyString());
        api.query(request);

        verify(api.client, times(1)).doGet(anyString()); //make sure 1 get
        verify(api.client).doGet(request.toUrl());
    }

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

        request.setStart(5);
        request.setLimit(4);
        doReturn(new Gson().toJson(response)).when(api.client).doGet(anyString());
        api.query(request);

        String requestUrl = request.toUrl();

        verify(api.client, times(4)).doGet(anyString()); //make sure 4 gets
        verify(api.client).doGet(requestUrl);
        verify(api.client).doGet(requestUrl.replace("start=5", "start=6"));
        verify(api.client).doGet(requestUrl.replace("start=5", "start=7"));
View Full Code Here

        request.setStart(5);
        request.setLimit(Integer.MAX_VALUE);
        doReturn(new Gson().toJson(response)).when(api.client).doGet(anyString());
        api.query(request);

        String requestUrl = request.toUrl();

        verify(api.client, times(6)).doGet(anyString()); //make sure 6 gets
        verify(api.client).doGet(requestUrl);
        verify(api.client).doGet(requestUrl.replace("start=5", "start=6"));
        verify(api.client).doGet(requestUrl.replace("start=5", "start=7"));
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.