Skip to content

Commit

Permalink
Getter setter for twin fields (#1566)
Browse files Browse the repository at this point in the history
* Added getter/setter for missing Twin fields

Added getter/setter for missing Twin fields reported by customer (reported using Ava: 2206170060000042)
Also updated unit test::  testQueryTwins() to validate the fields.

* updated data type for cloudToDeviceMessageCount

updated data type for cloudToDeviceMessageCount from String to Integer

* Update Twin.java

* Update Twin.java

* Update QueryClientTests.java
  • Loading branch information
tmahmood-microsoft authored Jul 1, 2022
1 parent 5341675 commit c087bcc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,12 @@ public void testQueryTwins() throws IOException, IotHubException, InterruptedExc
assertNotNull(twinList.get(0).getStatus());
assertNotNull(twinList.get(0).getConnectionState());
assertNotNull(twinList.get(0).getLastActivityTime());
assertNotNull(twinList.get(0).getCloudToDeviceMessageCount());

assertNotNull(twinList.get(1).getStatus());
assertNotNull(twinList.get(1).getConnectionState());
assertNotNull(twinList.get(1).getLastActivityTime());
assertNotNull(twinList.get(0).getCloudToDeviceMessageCount());

}
finally
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class Twin

@Getter
@Setter
private String cloudToDeviceMessageCount;
private Integer cloudToDeviceMessageCount;

@Getter
@Setter(AccessLevel.PACKAGE)
Expand Down Expand Up @@ -277,7 +277,6 @@ public String toString()
.append(String.join(",", this.parentScopes))
.append("\n");
}

if (this.status != null)
{
thisDevice.append("Status: ").append(this.status.toString()).append("\n");
Expand All @@ -300,7 +299,7 @@ public String toString()

if (this.cloudToDeviceMessageCount != null)
{
thisDevice.append("CloudToDeviceMessageCount:").append(this.cloudToDeviceMessageCount).append("\n");
thisDevice.append("CloudToDeviceMessageCount:").append(this.cloudToDeviceMessageCount.toString()).append("\n");
}

thisDevice.append(tagsToString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ public class TwinState
@SerializedName(CLOUD_TO_DEVICE_MESSAGE_COUNT)
@Getter
@Setter
private String cloudToDeviceMessageCount = null;
private Integer cloudToDeviceMessageCount = null;

/**
* Datetime of last time the device authenticated, received, or sent a message.
Expand Down

0 comments on commit c087bcc

Please sign in to comment.