use of org.opensmartgridplatform.oslp.Oslp.Message in project open-smart-grid-platform by OSGP.
the class OslpDeviceSteps method theConfirmRegisterDeviceResponseContains.
/**
* Verify that we have received a confirm register device response over OSLP/OSLP ELSTER
*/
@Then("^the confirm register device response contains$")
public void theConfirmRegisterDeviceResponseContains(final Map<String, String> expectedResponse) {
final Exception e = (Exception) ScenarioContext.current().get("Error");
if (e == null || getString(expectedResponse, PlatformPubliclightingKeys.MESSAGE) == null) {
final Message responseMessage = this.oslpMockServer.waitForResponse();
final Oslp.ConfirmRegisterDeviceResponse response = responseMessage.getConfirmRegisterDeviceResponse();
Assert.assertNotNull(response);
assertThat(response.getStatus().name()).isEqualTo(getString(expectedResponse, PlatformPubliclightingKeys.KEY_STATUS));
} else {
assertThat(e).hasMessage(getString(expectedResponse, PlatformPubliclightingKeys.MESSAGE));
}
}
use of org.opensmartgridplatform.oslp.Oslp.Message in project open-smart-grid-platform by OSGP.
the class OslpDeviceSteps method aGetFirmwareVersionOslpMessageIsSentToSpecificDevice.
/**
* Verify that a get firmware version OSLP message is sent to the specific device.
*
* @param deviceIdentification The device identification expected in the message to the device.
*/
@Then("^a get firmware version \"([^\"]*)\" message is sent to device \"([^\"]*)\" with deviceUid \"([^\"]*)\"$")
public void aGetFirmwareVersionOslpMessageIsSentToSpecificDevice(final String protocol, final String deviceIdentification, final String deviceUid) throws DeviceSimulatorException {
final Message message = this.oslpMockServer.waitForRequest(deviceUid, MessageType.GET_FIRMWARE_VERSION);
assertThat(message).isNotNull();
assertThat(message.hasGetFirmwareVersionRequest()).isTrue();
message.getGetFirmwareVersionRequest();
}
use of org.opensmartgridplatform.oslp.Oslp.Message in project open-smart-grid-platform by OSGP.
the class OslpDeviceSteps method aSetRebootOslpMessageIsSentToSpecificDevice.
/**
* Verify that a set reboot OSLP message is sent to specific device.
*
* @param deviceIdentification The device identification expected in the message to the device.
*/
@Then("^a set reboot \"([^\"]*)\" message is sent to device \"([^\"]*)\" with deviceUid \"([^\"]*)\"$")
public void aSetRebootOslpMessageIsSentToSpecificDevice(final String protocol, final String deviceIdentification, final String deviceUid) throws DeviceSimulatorException {
final Message message = this.oslpMockServer.waitForRequest(deviceUid, MessageType.SET_REBOOT);
assertThat(message).isNotNull();
assertThat(message.hasSetRebootRequest()).isTrue();
}
use of org.opensmartgridplatform.oslp.Oslp.Message in project open-smart-grid-platform by OSGP.
the class OslpDeviceSteps method aGetConfigurationOslpMessageIsSentToSpecificDevice.
/**
* Verify that a get configuration OSLP message is sent to the specific device.
*
* @param protocol The protocol over which the device communicates. - NOT USED -
* @param deviceIdentification The device identification expected in the message to the device. -
* NOT USED -
* @param deviceUid The device Uid expected in the message to the device.
*/
@Then("^a get configuration \"([^\"]*)\" message is sent to device \"([^\"]*)\" with deviceUid \"([^\"]*)\"$")
public void aGetConfigurationOslpMessageIsSentToSpecificDevice(final String protocol, final String deviceIdentification, final String deviceUid) throws DeviceSimulatorException {
final Message message = this.oslpMockServer.waitForRequest(deviceUid, MessageType.GET_CONFIGURATION);
assertThat(message).isNotNull();
assertThat(message.hasGetConfigurationRequest()).isTrue();
}
use of org.opensmartgridplatform.oslp.Oslp.Message in project open-smart-grid-platform by OSGP.
the class OslpDeviceSteps method aResumeScheduleOslpMessageIsSentToDevice.
/**
* Verify that a resume schedule OSLP message is sent to the device.
*
* @param deviceIdentification The device identification expected in the message to the device.
*/
@Then("^a resume schedule \"([^\"]*)\" message is sent to device \"([^\"]*)\"$")
public void aResumeScheduleOslpMessageIsSentToDevice(final String protocol, final String deviceIdentification, final Map<String, String> expectedRequest) throws DeviceSimulatorException {
final Message message = this.oslpMockServer.waitForRequest(this.getDeviceUid(expectedRequest), MessageType.RESUME_SCHEDULE);
assertThat(message).isNotNull();
assertThat(message.hasResumeScheduleRequest()).isTrue();
final ResumeScheduleRequest request = message.getResumeScheduleRequest();
/*
* resumeScheduleRequest { index: "\000" immediate: false }
*/
assertThat(OslpUtils.byteStringToInteger(request.getIndex())).isEqualTo(getInteger(expectedRequest, PlatformPubliclightingKeys.KEY_INDEX));
assertThat(request.getImmediate()).isEqualTo(getBoolean(expectedRequest, PlatformPubliclightingKeys.KEY_ISIMMEDIATE));
}
Aggregations