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;
}
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();
}
Aggregations