Search in sources :

Example 1 with PushSetupAlarm

use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.PushSetupAlarm in project open-smart-grid-platform by OSGP.

the class SetPushSetupAlarmRequestBuilder method build.

public SetPushSetupAlarmRequest build() {
    final SetPushSetupAlarmRequest request = new SetPushSetupAlarmRequest();
    final PushSetupAlarm pushSetupAlarm = new PushSetupAlarm();
    pushSetupAlarm.setHost(this.host);
    pushSetupAlarm.setPort(this.port);
    pushSetupAlarm.getPushObjectList().addAll(this.pushObjectList);
    request.setPushSetupAlarm(pushSetupAlarm);
    return request;
}
Also used : PushSetupAlarm(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.PushSetupAlarm) SetPushSetupAlarmRequest(org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.SetPushSetupAlarmRequest)

Example 2 with PushSetupAlarm

use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.PushSetupAlarm in project open-smart-grid-platform by OSGP.

the class PushSetupAlarmMappingTest method testPushSetupAlarmMapping.

/**
 * Tests if mapping a PushSetupAlarm object succeeds.
 */
@Test
public void testPushSetupAlarmMapping() {
    // build test data
    final PushSetupAlarm pushSetupAlarmOriginal = new PushSetupAlarm();
    pushSetupAlarmOriginal.setHost(HOST);
    pushSetupAlarmOriginal.setPort(PORT);
    pushSetupAlarmOriginal.getPushObjectList().addAll(PUSH_OBJECT_LIST);
    // actual mapping
    final org.opensmartgridplatform.domain.core.valueobjects.smartmetering.PushSetupAlarm pushSetupAlarmMapped = this.configurationMapper.map(pushSetupAlarmOriginal, org.opensmartgridplatform.domain.core.valueobjects.smartmetering.PushSetupAlarm.class);
    assertThat(pushSetupAlarmMapped).isNotNull();
    // port and host are combined into destination. The converter sets default values for the other
    // two variables of a SendDestinationAndMethod.
    assertThat(pushSetupAlarmMapped.getSendDestinationAndMethod().getDestination()).isEqualTo(DESTINATION);
    assertThat(pushSetupAlarmMapped.getSendDestinationAndMethod().getTransportService().name()).isEqualTo(TRANSPORTSERVICETYPE.name());
    assertThat(pushSetupAlarmMapped.getSendDestinationAndMethod().getMessage().name()).isEqualTo(MESSAGETYPE.name());
    // check mapping of PushObjectList
    assertThat(pushSetupAlarmMapped.getPushObjectList()).hasSize(1);
    final CosemObjectDefinition pushObject = pushSetupAlarmMapped.getPushObjectList().get(0);
    assertThat(pushObject.getClassId()).isEqualTo(PUSH_OBJECT_CLASS_ID);
    assertThat(pushObject.getLogicalName()).isEqualToComparingFieldByField(PUSH_OBJECT_OBIS_CODE);
    assertThat(pushObject.getAttributeIndex()).isEqualTo(PUSH_OBJECT_ATTRIBUTE_ID);
    assertThat(pushObject.getDataIndex()).isEqualTo(PUSH_OBJECT_DATA_INDEX);
    // Only SendDestinationAndMethod and PushObjectList are mapped:
    assertThat(pushSetupAlarmMapped.getLogicalName()).isNull();
    assertThat(pushSetupAlarmMapped.getCommunicationWindow()).isNull();
    assertThat(pushSetupAlarmMapped.getNumberOfRetries()).isNull();
    assertThat(pushSetupAlarmMapped.getRandomisationStartInterval()).isNull();
    assertThat(pushSetupAlarmMapped.getRepetitionDelay()).isNull();
}
Also used : PushSetupAlarm(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.PushSetupAlarm) CosemObjectDefinition(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.CosemObjectDefinition) Test(org.junit.jupiter.api.Test)

Aggregations

PushSetupAlarm (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.PushSetupAlarm)2 Test (org.junit.jupiter.api.Test)1 SetPushSetupAlarmRequest (org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.SetPushSetupAlarmRequest)1 CosemObjectDefinition (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.CosemObjectDefinition)1