use of com.microsoft.azure.sdk.iot.service.devicetwin.QueryOptions in project azure-iot-sdk-java by Azure.
the class QueryOptionsTest method getContinuationTokenSuccess.
// Tests_SRS_QUERYOPTIONS_34_002: [This function shall return the saved continuation token.]
@Test
public void getContinuationTokenSuccess() {
// arrange
String expectedContinuationToken = "someToken";
QueryOptions options = new QueryOptions();
Deencapsulation.setField(options, "continuationToken", expectedContinuationToken);
// act
String actualContinuationToken = options.getContinuationToken();
// assert
assertEquals(expectedContinuationToken, actualContinuationToken);
}
use of com.microsoft.azure.sdk.iot.service.devicetwin.QueryOptions in project azure-iot-sdk-java by Azure.
the class QueryOptionsTest method getPageSizeSuccess.
// Tests_SRS_QUERYOPTIONS_34_003: [This function shall return the saved page size.]
@Test
public void getPageSizeSuccess() {
// arrange
Integer expectedPageSize = 758;
QueryOptions options = new QueryOptions();
Deencapsulation.setField(options, "pageSize", expectedPageSize);
// act
Integer actualPageSize = options.getPageSize();
// assert
assertEquals(expectedPageSize, actualPageSize);
}
use of com.microsoft.azure.sdk.iot.service.devicetwin.QueryOptions in project azure-iot-sdk-java by Azure.
the class QueryTwinTests method queryCollectionCanReturnEmptyQueryResults.
@Test
@StandardTierHubOnlyTest
@ContinuousIntegrationTest
public void queryCollectionCanReturnEmptyQueryResults() throws IOException, IotHubException {
String fullQuery = "select * from devices where deviceId='nonexistantdevice'";
DeviceTwin twinClient = new DeviceTwin(iotHubConnectionString, DeviceTwinClientOptions.builder().httpReadTimeout(HTTP_READ_TIMEOUT).build());
QueryCollection twinQuery = twinClient.queryTwinCollection(fullQuery);
QueryOptions options = new QueryOptions();
QueryCollectionResponse<DeviceTwinDevice> response = twinClient.next(twinQuery, options);
assertNull(response.getContinuationToken());
assertTrue(response.getCollection().isEmpty());
}
use of com.microsoft.azure.sdk.iot.service.devicetwin.QueryOptions in project azure-iot-sdk-java by Azure.
the class DeviceTwinTest method getNextDeviceTwinCollectionWithOptionsThrowsForNullQueryCollection.
// Tests_SRS_DEVICETWIN_34_076: [If the provided deviceTwinQueryCollection is null, an IllegalArgumentException shall be thrown.]
@Test(expected = IllegalArgumentException.class)
public void getNextDeviceTwinCollectionWithOptionsThrowsForNullQueryCollection() throws IOException, IotHubException {
// arrange
DeviceTwin deviceTwin = new DeviceTwin(STANDARD_CONNECTIONSTRING);
// act
deviceTwin.next(null, new QueryOptions());
}
use of com.microsoft.azure.sdk.iot.service.devicetwin.QueryOptions in project azure-iot-sdk-java by Azure.
the class QueryOptionsTest method setContinuationTokenSuccess.
// Tests_SRS_QUERYOPTIONS_34_006: [This function shall save the provided continuation token string.]
@Test
public void setContinuationTokenSuccess() {
// arrange
String expectedContinuationToken = "someToken";
QueryOptions options = new QueryOptions();
// act
options.setContinuationToken(expectedContinuationToken);
// assert
String actualContinuationToken = Deencapsulation.getField(options, "continuationToken");
assertEquals(expectedContinuationToken, actualContinuationToken);
}
Aggregations