Package com.cumulocity.rest.representation.measurement

Examples of com.cumulocity.rest.representation.measurement.MeasurementCollectionRepresentation


            MeasurementRepresentation rep = aSampleMeasurement(managedObjects.get(0));
            measurementApi.create(rep);
        }

        // When
        MeasurementCollectionRepresentation measurements = measurementApi.getMeasurements().get();

        // Then
        assertThat(measurements.getMeasurements().size(), is(equalTo(5)));

        // When
        MeasurementCollectionRepresentation page1st = measurementApi.getMeasurements().getPage(measurements, 1);

        // Then
        assertThat(page1st.getMeasurements().size(), is(equalTo(5)));

        // When
        MeasurementCollectionRepresentation page2nd = measurementApi.getMeasurements().getPage(measurements, 2);

        // Then
        assertThat(page2nd.getMeasurements().size(), is(equalTo(5)));

        // When
        MeasurementCollectionRepresentation page3rd = measurementApi.getMeasurements().getPage(measurements, 3);

        // Then
        assertThat(page3rd.getMeasurements().size(), is(equalTo(2)));

        // When
        MeasurementCollectionRepresentation page4th = measurementApi.getMeasurements().getPage(measurements, 4);

        // Then
        assertThat(page4th.getMeasurements().size(), is(equalTo(0)));
    }
View Full Code Here


    // ------------------------------------------------------------------------

    @Then("I should get next page which has current page '(\\d+)' and measurements '(\\d+)'")
    public void iQueryAllByNextPage(int currentPage, int numMeasurements) throws SDKException {
        try {
            MeasurementCollectionRepresentation collectionRepresentation = measurementApi.getMeasurements().getNextPage(collection2);
            assertThat(currentPage, is(equalTo(collectionRepresentation.getPageStatistics().getCurrentPage())));
            assertThat(numMeasurements, is(equalTo(collectionRepresentation.getMeasurements().size())));
        } catch (SDKException ex) {
            status = ex.getHttpStatus();
        }

    }
View Full Code Here

    }

    @Then("I should get previous page which has current page '(\\d+)' and measurements '(\\d+)'")
    public void iQueryAllByPreviousPage(int currentPage, int numMeasurements) throws SDKException {
        try {
            MeasurementCollectionRepresentation collectionRepresentation = measurementApi.getMeasurements().getPreviousPage(collection2);
            assertThat(currentPage, is(equalTo(collectionRepresentation.getPageStatistics().getCurrentPage())));
            assertThat(numMeasurements, is(equalTo(collectionRepresentation.getMeasurements().size())));
        } catch (SDKException ex) {
            status = ex.getHttpStatus();
        }

    }
View Full Code Here

    public void setup() {
        MockitoAnnotations.initMocks(this);

        target = createPagedCollectionResource(restConnector, URL, PAGE_SIZE, MEDIA_TYPE, CLAZZ);

        MeasurementCollectionRepresentation measurementCollectionRepresentation = new MeasurementCollectionRepresentation();
        when(clientResponse.getStatus()).thenReturn(200);
        when(clientResponse.getEntity(MeasurementCollectionRepresentation.class)).thenReturn(measurementCollectionRepresentation);
    }
View Full Code Here

TOP

Related Classes of com.cumulocity.rest.representation.measurement.MeasurementCollectionRepresentation

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.