internalClient.subscribeToDesiredProperties(deviceUnderTest.dCDeviceForTwin.getDesiredProp()); Thread.sleep(DELAY_BETWEEN_OPERATIONS);
@Test public void testSubscribeToDesiredPropertiesSequentially() throws IOException, InterruptedException, IotHubException { // arrange deviceUnderTest.sCDeviceForTwin.clearTwin(); deviceUnderTest.dCDeviceForTwin.getDesiredProp().clear(); for (int i = 0; i < MAX_PROPERTIES_TO_TEST; i++) { PropertyState propertyState = new PropertyState(); propertyState.callBackTriggered = false; propertyState.property = new Property(PROPERTY_KEY + i, PROPERTY_VALUE); deviceUnderTest.dCDeviceForTwin.propertyStateList[i] = propertyState; deviceUnderTest.dCDeviceForTwin.setDesiredPropertyCallback(propertyState.property, deviceUnderTest.dCDeviceForTwin, propertyState); } // act internalClient.subscribeToDesiredProperties(deviceUnderTest.dCDeviceForTwin.getDesiredProp()); Thread.sleep(DELAY_BETWEEN_OPERATIONS); for (int i = 0; i < MAX_PROPERTIES_TO_TEST; i++) { Set<com.microsoft.azure.sdk.iot.service.devicetwin.Pair> desiredProperties = new HashSet<>(); desiredProperties.add(new com.microsoft.azure.sdk.iot.service.devicetwin.Pair(PROPERTY_KEY + i, PROPERTY_VALUE_UPDATE + UUID.randomUUID())); deviceUnderTest.sCDeviceForTwin.setDesiredProperties(desiredProperties); sCDeviceTwin.updateTwin(deviceUnderTest.sCDeviceForTwin); Thread.sleep(DELAY_BETWEEN_OPERATIONS); } // assert waitAndVerifyTwinStatusBecomesSuccess(); waitAndVerifyDesiredPropertyCallback(PROPERTY_VALUE_UPDATE, false); }
internalClient.subscribeToDesiredProperties(deviceUnderTest.dCDeviceForTwin.getDesiredProp()); Thread.sleep(DELAY_BETWEEN_OPERATIONS);