Package com.cumulocity.rest.representation.alarm

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


    }

    @Test
    public void createAlarmWithoutStatus() throws Exception {
        // Given
        AlarmRepresentation alarm = anAlarmRepresentationLike(ALARM_REPRESENTATION)
                .withSource(mo1).withStatus(null).build();

        // Then
        exception.expect(sdkException(UNPROCESSABLE));
View Full Code Here


    }

    @Test
    public void createAlarmsWithoutSeverity() throws Exception {
        // Given
        AlarmRepresentation alarm = anAlarmRepresentationLike(ALARM_REPRESENTATION)
                .withSource(mo1).withSeverity(null).build();

        // Then
        exception.expect(sdkException(UNPROCESSABLE));
View Full Code Here

    }

    @Test
    public void shouldGetAlarmById() throws Exception {
        // Given
        AlarmRepresentation created = alarmApi.create(anAlarmRepresentationLike(ALARM_REPRESENTATION)
                .withStatus("ACTIVE")
                .withSource(mo1).build());

        AlarmRepresentation returned = alarmApi.getAlarm(created.getId());

        assertThat(returned.getStatus(), is("ACTIVE"));
        assertThat(returned.getSource().getId(), is(mo1.getId()));
    }
View Full Code Here

    }

    @Test
    public void shouldReturnTheUpdatedAlarm() throws Exception {
        // Given
        AlarmRepresentation created = alarmApi.create(anAlarmRepresentationLike(ALARM_REPRESENTATION)
                .withStatus("ACTIVE")
                .withSource(mo1).build());

        // When
        AlarmRepresentation alarm = new AlarmRepresentation();
        alarm.setStatus("ACKNOWLEDGED");
        alarm.setId(created.getId());
        AlarmRepresentation updated = alarmApi.updateAlarm(alarm);

        // Then
        assertThat(updated.getStatus(), is("ACKNOWLEDGED"));
        assertThat(updated.getSource().getId(), is(mo1.getId()));
    }
View Full Code Here

    }

    @Test
    public void shouldUpdateAlarm() throws Exception {
        // Given
        AlarmRepresentation created = alarmApi.create(anAlarmRepresentationLike(ALARM_REPRESENTATION)
                .withStatus("ACTIVE")
                .withSource(mo1).build());

        // When
        AlarmRepresentation alarm = new AlarmRepresentation();
        alarm.setStatus("ACKNOWLEDGED");
        alarm.setId(created.getId());
        alarmApi.updateAlarm(alarm);

        // Then
        AlarmRepresentation returned = alarmApi.getAlarm(created.getId());

        assertThat(returned.getStatus(), is("ACKNOWLEDGED"));
        assertThat(returned.getSource().getId(), is(mo1.getId()));
    }
View Full Code Here

TOP

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

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.