use of com.microsoft.azure.sdk.iot.device.MessageType in project azure-iot-sdk-java by Azure.
the class IotHubTransportMessageTest method getRequestIdGetsTheRequestId.
/*
**Tests_SRS_IOTHUBTRANSPORTMESSAGE_12_007: [**The function shall return the value of the request id either set by the setter or the default (null) if unset so far.**]**
*/
@Test
public void getRequestIdGetsTheRequestId() {
// arrange
String requestIdStr = "abcdefg";
byte[] data = new byte[1];
MessageType messageType = MessageType.DEVICE_TWIN;
IotHubTransportMessage iotHubTransportMessage = new IotHubTransportMessage(data, messageType);
iotHubTransportMessage.setRequestId(requestIdStr);
// act
String requestId = iotHubTransportMessage.getRequestId();
// assert
assertEquals(requestIdStr, requestId);
}
use of com.microsoft.azure.sdk.iot.device.MessageType in project azure-iot-sdk-java by Azure.
the class IotHubTransportMessageTest method getStatusGetsTheStatus.
/*
**Tests_SRS_IOTHUBTRANSPORTMESSAGE_12_009: [**The function shall return the value of the status either set by the setter or the default (null) if unset so far.**]**
*/
@Test
public void getStatusGetsTheStatus() {
// arrange
String StatusStr = "abcdefg";
byte[] data = new byte[1];
MessageType messageType = MessageType.DEVICE_TWIN;
IotHubTransportMessage iotHubTransportMessage = new IotHubTransportMessage(data, messageType);
iotHubTransportMessage.setStatus(StatusStr);
// act
String Status = iotHubTransportMessage.getStatus();
// assert
assertEquals(StatusStr, Status);
}
use of com.microsoft.azure.sdk.iot.device.MessageType in project azure-iot-sdk-java by Azure.
the class IotHubTransportMessageTest method getMethodNameGetsTheMethodName.
/*
**Tests_SRS_IOTHUBTRANSPORTMESSAGE_12_014: [**The function shall return the methodName either set by the setter or the default (null) if unset so far.**]**
*/
@Test
public void getMethodNameGetsTheMethodName() {
// arrange
String methodNameStr = "abcdefg";
byte[] data = new byte[1];
MessageType messageType = MessageType.DEVICE_TWIN;
IotHubTransportMessage iotHubTransportMessage = new IotHubTransportMessage(data, messageType);
iotHubTransportMessage.setMethodName(methodNameStr);
// act
String methodName = iotHubTransportMessage.getMethodName();
// assert
assertEquals(methodNameStr, methodName);
}
use of com.microsoft.azure.sdk.iot.device.MessageType in project azure-iot-sdk-java by Azure.
the class IotHubTransportMessageTest method constructorWithByteArraySetsMessageType.
/*
**Tests_SRS_IOTHUBTRANSPORTMESSAGE_12_003: [**The constructor shall set the messageType to the given value by calling the super with the given value.**]**
**Tests_SRS_IOTHUBTRANSPORTMESSAGE_12_015: [**The constructor shall initialize version, requestId and status to null.**]**
**Tests_SRS_IOTHUBTRANSPORTMESSAGE_12_016: [**The constructor shall initialize operationType to UNKNOWN**]**
*/
@Test
public void constructorWithByteArraySetsMessageType() {
// arrange
byte[] data = new byte[1];
MessageType messageType = MessageType.DEVICE_TWIN;
// act
IotHubTransportMessage iotHubTransportMessage = new IotHubTransportMessage(data, messageType);
// assert
assertEquals(messageType, iotHubTransportMessage.getMessageType());
assertNull(iotHubTransportMessage.getVersion());
assertNull(iotHubTransportMessage.getRequestId());
assertNull(iotHubTransportMessage.getStatus());
assertEquals(DEVICE_OPERATION_UNKNOWN, iotHubTransportMessage.getDeviceOperationType());
}
use of com.microsoft.azure.sdk.iot.device.MessageType in project azure-iot-sdk-java by Azure.
the class IotHubTransportMessageTest method setMethodNameSetsTheMethodName.
/*
**Tests_SRS_IOTHUBTRANSPORTMESSAGE_12_013: [**The function shall set the methodName.**]**
*/
@Test
public void setMethodNameSetsTheMethodName() {
// arrange
String methodNameStr = "abcdefg";
byte[] data = new byte[1];
MessageType messageType = MessageType.DEVICE_TWIN;
IotHubTransportMessage iotHubTransportMessage = new IotHubTransportMessage(data, messageType);
// act
iotHubTransportMessage.setMethodName(methodNameStr);
// assert
assertEquals(methodNameStr, iotHubTransportMessage.getMethodName());
}
Aggregations