Package com.cumulocity.rest.representation.inventory

Examples of com.cumulocity.rest.representation.inventory.ManagedObjectRepresentation


//    Background:
//    Given I have a platform and a tenant
//    And I have '3' managed objects
//    And I create all
        for (int i = 0; i < 3; ++i) {
            ManagedObjectRepresentation mo = platform.getInventoryApi().create(aSampleMo().withName("MO" + i).build());
            managedObjects.add(mo);
        }
    }
View Full Code Here


    }

    @When("I query all measurements by source '(\\d+)'")
    public void iQueryAllBySource(int index) throws SDKException {
        try {
            ManagedObjectRepresentation source = managedObjects.get(index);
            MeasurementFilter filter = new MeasurementFilter().bySource(source);
            collection1 = measurementApi.getMeasurementsByFilter(filter).get();
        } catch (SDKException ex) {
            status = ex.getHttpStatus();
        }
View Full Code Here

    }

    @When("I query all measurements by source '(\\d+)' and time from '([^']*)' and time to '([^']*)'")
    public void iQueryAllBySourceAndTime(int index, String from, String to) throws SDKException {
        try {
            ManagedObjectRepresentation source = managedObjects.get(index);
            Date fromDate = DateConverter.string2Date(from);
            Date toDate = DateConverter.string2Date(to);
            MeasurementFilter filter = new MeasurementFilter().byDate(fromDate, toDate).bySource(source);
            collection1 = measurementApi.getMeasurementsByFilter(filter).get();
        } catch (SDKException ex) {
View Full Code Here

    @When("I query all measurements by source '(\\d+)' and fragment type '([^']*)'")
    public void iQueryAllBySourceAndType(int index, String fragmentType) throws SDKException, ClassNotFoundException {
        try {
            Class<?> fragmentClass = Class.forName(fragmentType);
            ManagedObjectRepresentation source = managedObjects.get(index);
            MeasurementFilter filter = new MeasurementFilter().byFragmentType(fragmentClass).bySource(source);
            collection1 = measurementApi.getMeasurementsByFilter(filter).get();
        } catch (SDKException ex) {
            status = ex.getHttpStatus();
        }
View Full Code Here

    @When("I query all measurements by source '(\\d+)' and fragment type '([^']*)' and time from '([^']*)' and time to '([^']*)'")
    public void iQueryAllBySourceTypeAndTime(int index, String fragmentType, String from, String to)
            throws SDKException, ClassNotFoundException {
        try {
            Class<?> fragmentClass = Class.forName(fragmentType);
            ManagedObjectRepresentation source = managedObjects.get(index);
            Date fromDate = DateConverter.string2Date(from);
            Date toDate = DateConverter.string2Date(to);
            MeasurementFilter filter = new MeasurementFilter().bySource(source).byDate(fromDate, toDate).byFragmentType(fragmentClass);
            collection1 = measurementApi.getMeasurementsByFilter(filter).get();
        } catch (SDKException ex) {
View Full Code Here

    }

    @Test
    public void shouldReturnAllCreatedAlarms() throws Exception {
        // Given
        ManagedObjectRepresentation source = mo1;
       
        for (int i = 0; i<10 ; i++) {
            alarmApi.create(aSampleAlarm(source));
        }

        int resultNumber = 0;
        Iterable<AlarmRepresentation> pager = alarmApi.getAlarmsByFilter(new AlarmFilter().bySource(source.getId())).get().allPages();
        for (AlarmRepresentation alarm : pager) {
            resultNumber++;
        }

        assertThat(resultNumber, is(10));
View Full Code Here

    }
   
    @Test
    public void shouldReturnAllCreatedAsyncAlarms() throws Exception {
        // Given
        ManagedObjectRepresentation source = mo1;
       
        for (int i = 0; i<10 ; i++) {
            alarmApi.createAsync(aSampleAlarm(source)).get();
        }

        int resultNumber = 0;
        Iterable<AlarmRepresentation> pager = alarmApi.getAlarmsByFilter(new AlarmFilter().bySource(source.getId())).get().allPages();
        for (AlarmRepresentation alarm : pager) {
            resultNumber++;
        }

        assertThat(resultNumber, is(10));
View Full Code Here

        result2 = new ArrayList<AuditRecordRepresentation>();

//    Given I have '3' managed objects
//    And I create all
        for (int i = 0; i < 3; ++i) {
            ManagedObjectRepresentation mo = platform.getInventoryApi().create(aSampleMo().withName("MO" + i).build());
            managedObjects.add(mo);
        }
    }
View Full Code Here

    }

    @Test
    public void createManagedObject() throws Exception {
        // Given
        ManagedObjectRepresentation rep = aSampleMo().build();

        // When
        ManagedObjectRepresentation created = inventory.create(rep);

        // Then
        assertNotNull(created.getId());
        assertNotNull(created.getSelf());
        assertThat(created, not(sameInstance(rep)));
    }
View Full Code Here

    @Test
    public void createManagedObjectWithoutResponseBody() throws Exception {
        // Given
        platform.setRequireResponseBody(false);
        ManagedObjectRepresentation rep = aSampleMo().build();

        // When
        ManagedObjectRepresentation created = inventory.create(rep);

        // Then
        assertNotNull(created.getId());
        assertNull(created.getSelf());
        assertThat(created, sameInstance(rep));
    }
View Full Code Here

TOP

Related Classes of com.cumulocity.rest.representation.inventory.ManagedObjectRepresentation

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.