Examples of PageStatisticsRepresentation


Examples of com.cumulocity.me.rest.representation.PageStatisticsRepresentation

        putInt(json, PROP_PAGE_SIZE, $(representation).getPageSize());
        return json;
    }

    public Object fromJson(JSONObject json) {
        PageStatisticsRepresentation representation = new PageStatisticsRepresentation();
        representation.setTotalPages(getInt(json, PROP_TOTAL_PAGES));
        representation.setCurrentPage(getInt(json, PROP_CURRENT_PAGE));
        representation.setPageSize(getInt(json, PROP_PAGE_SIZE));
        return representation;
    }
View Full Code Here

Examples of com.cumulocity.me.rest.representation.PageStatisticsRepresentation

        return get(DEFAULT_PAGE_SIZE);
    }

    public BaseCollectionRepresentation get(int pageSize) throws SDKException {
      BaseCollectionRepresentation collectionRepresentaton = (BaseCollectionRepresentation) newCollectionRepresentationInstance();
      collectionRepresentaton.setPageStatistics(new PageStatisticsRepresentation());
        return collectionRepresentaton;
    }
View Full Code Here

Examples of com.cumulocity.rest.representation.PageStatisticsRepresentation

    @Test
    public void shouldGetPageWhenNoParamsPresent() throws SDKException {
        // Given
        TestCollectionRepresentation input = new TestCollectionRepresentation();
        input.setPageStatistics(new PageStatisticsRepresentation(PAGE_SIZE));
        input.setSelf(URL + "/measuremnt/measurments");

        String expectedUrl = input.getSelf() + "?pageSize=" + PAGE_SIZE + "&currentPage=5";
        TestCollectionRepresentation expectedRep = new TestCollectionRepresentation();
        when(restConnector.get(argThat(matchesUrl(expectedUrl)), eq(MEDIA_TYPE), eq(CLAZZ))).thenReturn(expectedRep);
View Full Code Here

Examples of com.cumulocity.rest.representation.PageStatisticsRepresentation

    @Test
    public void shouldGetPageWhenOtherParamsAlreadyPresent() throws SDKException {
        // Given
        TestCollectionRepresentation input = new TestCollectionRepresentation();
        input.setPageStatistics(new PageStatisticsRepresentation(PAGE_SIZE));
        input.setSelf(URL + "/measuremnt/measurments?param1=value1");

        String expectedUrl = input.getSelf() + "&pageSize=" + PAGE_SIZE + "&currentPage=5";
        TestCollectionRepresentation expectedRep = new TestCollectionRepresentation();
        when(restConnector.get(argThat(matchesUrl(expectedUrl)), eq(MEDIA_TYPE), eq(CLAZZ))).thenReturn(expectedRep);
View Full Code Here

Examples of com.cumulocity.rest.representation.PageStatisticsRepresentation

    @Test
    public void shouldGetPageAndReplaceAlreadyPresentPageSizeAndCurrentPageParams() throws SDKException {
        // Given
        TestCollectionRepresentation input = new TestCollectionRepresentation();
        input.setPageStatistics(new PageStatisticsRepresentation(PAGE_SIZE));
        String myUrl = URL + "/measuremnt/measurments?param1=value1&pageSize=123&currentPage=234";
        input.setSelf(myUrl);

        String expectedUrl = URL + "/measuremnt/measurments?param1=value1" + "&pageSize=" + PAGE_SIZE + "&currentPage=6";
        TestCollectionRepresentation expectedRep = new TestCollectionRepresentation();
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.