Package com.cumulocity.rest.representation.measurement

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


    @Test
    public void getMeasurementCollectionByDefaultPageSettings() throws Exception {
        // Given
        for (int i = 0; i < 12; i++) {
            MeasurementRepresentation rep = aSampleMeasurement(managedObjects.get(0));
            measurementApi.create(rep);
        }

        // When
        MeasurementCollectionRepresentation measurements = measurementApi.getMeasurements().get();
View Full Code Here


        // Then
        assertThat(page4th.getMeasurements().size(), is(equalTo(0)));
    }

    private MeasurementRepresentation aSampleMeasurement(ManagedObjectRepresentation source) {
        MeasurementRepresentation rep = new MeasurementRepresentation();
        rep.setTime(new Date());
        rep.setType("com.type1");
        rep.setSource(source);

        rep.set(new FragmentOne());
        return rep;
    }
View Full Code Here

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

    @Given("I have '(\\d+)' measurements of type '([^']*)' for the managed object")
    public void iHaveMeasurements(int n, String type) {
        for (int i = 0; i < n; i++) {
            MeasurementRepresentation rep = new MeasurementRepresentation();
            rep.setType(type);
            rep.setTime(new Date());
            rep.setSource(managedObjects.get(0));
            input.add(rep);
        }
    }
View Full Code Here

    @Given("I have '(\\d+)' measurements with fragment type '([^']*)' for the managed object")
    public void iHaveMeasurementsWithFragments(int n, String fragmentType)
            throws ClassNotFoundException, InstantiationException, IllegalAccessException {
        for (int i = 0; i < n; i++) {
            MeasurementRepresentation rep = new MeasurementRepresentation();
            rep.setTime(new Date());
            rep.setType("com.type1");
            rep.setSource(managedObjects.get(0));

            // Set fragment
            Class<?> cls = Class.forName(fragmentType);
            Object fragment = cls.newInstance();
            rep.set(fragment);

            input.add(rep);
        }
    }
View Full Code Here

    }

    @Given("I have '(\\d+)' measurements for the source '(\\d+)' the managed object")
    public void iHaveMeasurementsForSource(int n, int index) throws ClassNotFoundException, InstantiationException, IllegalAccessException {
        for (int i = 0; i < n; i++) {
            MeasurementRepresentation rep = new MeasurementRepresentation();
            rep.setTime(new Date());
            rep.setType("com.type1");
            rep.setSource(managedObjects.get(index));
            input.add(rep);
        }
    }
View Full Code Here

        }
    }

    @Given("I have a measurement of type '([^']*)' and no time value for the managed object")
    public void iHaveAMeasurementWithNoTime(String type) {
        MeasurementRepresentation rep = new MeasurementRepresentation();
        rep.setType(type);
        rep.setSource(managedObjects.get(0));
        input.add(rep);
    }
View Full Code Here

    }

    @Given("I have a measurement with time '([^']*)' with fragment type '([^']*)' and for '(\\d+)' managed object")
    public void iHaveAMeasurementWithTypeAndTime(String time, String fragmentType, int index)
            throws ClassNotFoundException, InstantiationException, IllegalAccessException {
        MeasurementRepresentation rep = new MeasurementRepresentation();
        rep.setType("com.type1");
        rep.setTime(DateConverter.string2Date(time));
        rep.setSource(managedObjects.get(index));

        // Set fragment
        Class<?> cls = Class.forName(fragmentType);
        Object fragment = cls.newInstance();
        rep.set(fragment);

        input.add(rep);
    }
View Full Code Here

        for (MeasurementRepresentation rep : result1) {
            map.put(rep.getId(), rep);
        }

        for (MeasurementRepresentation rep : collection1.getMeasurements()) {
            MeasurementRepresentation orig = map.get(rep.getId());
            assertThat(orig, is(notNullValue()));
        }
    }
View Full Code Here

    public void shouldReturnMeasurementRep() throws SDKException {
        // Given
        String gidValue = "123";
        GId gid = new GId(gidValue);

        MeasurementRepresentation meas = new MeasurementRepresentation();
        when(
                restConnector.get(MEASUREMENT_COLLECTION_URL + "/" + gidValue, MeasurementMediaType.MEASUREMENT,
                        MeasurementRepresentation.class)).thenReturn(meas);

        //when
        MeasurementRepresentation result = measurementApi.getMeasurement(gid);

        //then
        assertThat(result, sameInstance(meas));
    }
View Full Code Here

    @Test
    public void shouldDeleteMeasurementRep() throws SDKException {
        // Given
        String gidValue = "123";
        GId gid = new GId(gidValue);
        MeasurementRepresentation meas = new MeasurementRepresentation();
        meas.setId(gid);

        //when
        measurementApi.deleteMeasurement(meas);

        //then
View Full Code Here

TOP

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

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.