Package com.cumulocity.rest.representation.alarm

Examples of com.cumulocity.rest.representation.alarm.AlarmCollectionRepresentation


        // Given
        alarmApi.create(aSampleAlarm(mo1));

        // When
        AlarmFilter filter = new AlarmFilter().bySource(mo3);
        AlarmCollectionRepresentation bySource = alarmApi.getAlarmsByFilter(filter).get();

        // Then
        List<AlarmRepresentation> alarms = bySource.getAlarms();
        assertThat(alarms.size(), is(equalTo(0)));
    }
View Full Code Here


        alarmApi.create(aSampleAlarm(mo1));
        alarmApi.create(aSampleAlarm(mo1));

        // When
        AlarmFilter filter = new AlarmFilter().bySource(mo1);
        AlarmCollectionRepresentation bySource = alarmApi.getAlarmsByFilter(filter).get();

        // Then
        List<AlarmRepresentation> alarms = bySource.getAlarms();
        assertThat(alarms.size(), is(equalTo(2)));
    }
View Full Code Here

        alarmApi.create(aSampleAlarm(mo1));
        alarmApi.create(aSampleAlarm(mo2));

        // When
        AlarmFilter filter = new AlarmFilter().bySource(mo1);
        AlarmCollectionRepresentation bySource = alarmApi.getAlarmsByFilter(filter).get();

        // Then
        List<AlarmRepresentation> alarms = bySource.getAlarms();
        assertThat(alarms.size(), is(equalTo(1)));
        assertThat(alarms.get(0).getSource().getId(), is(mo1.getId()));
    }
View Full Code Here

                .withStatus("ACKNOWLEDGED")
                .withSource(mo1).build());

        // When
        AlarmFilter acknowledgedFilter = new AlarmFilter().byStatus(CumulocityAlarmStatuses.valueOf("ACKNOWLEDGED"));
        AlarmCollectionRepresentation acknowledgedAlarms = alarmApi.getAlarmsByFilter(acknowledgedFilter).get();

        // Then
        List<AlarmRepresentation> alarms = acknowledgedAlarms.getAlarms();
        assertThat(alarms.size(), is(equalTo(1)));
        assertThat(alarms.get(0).getStatus(), is("ACKNOWLEDGED"));
    }
View Full Code Here

                .withStatus("ACKNOWLEDGED")
                .withSource(mo2).build());

        // When
        AlarmFilter acknowledgedFilter = new AlarmFilter().byStatus(CumulocityAlarmStatuses.valueOf("ACKNOWLEDGED")).bySource(mo1);
        AlarmCollectionRepresentation acknowledgedAlarms = alarmApi.getAlarmsByFilter(acknowledgedFilter).get();

        // Then
        List<AlarmRepresentation> alarms = acknowledgedAlarms.getAlarms();
        assertThat(alarms.size(), is(equalTo(1)));
        assertThat(alarms.get(0).getStatus(), is("ACKNOWLEDGED"));
        assertThat(alarms.get(0).getSource().getId(), is(mo1.getId()));
    }
View Full Code Here

    @Before
    public void setup() throws Exception {
        MockitoAnnotations.initMocks(this);

        AlarmCollectionRepresentation alarmCollectionRepresentation = new AlarmCollectionRepresentation();
        alarmCollectionRepresentation.setSelf(ALARM_COLLECTION_URL);
        alarmsApiRepresentation.setAlarms(alarmCollectionRepresentation);

        alarmApi = new AlarmApiImpl(restConnector, urlProcessor, alarmsApiRepresentation, DEFAULT_PAGE_SIZE);
    }
View Full Code Here

TOP

Related Classes of com.cumulocity.rest.representation.alarm.AlarmCollectionRepresentation

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.