Search in sources :

Example 1 with AdminGetDeviceResult

use of com.amazonaws.services.cognitoidentityprovider.model.AdminGetDeviceResult in project aws-sdk-android by aws-amplify.

the class AWSMobileClientTest method checkDeviceAttribute.

/**
 * Utility function that calls admin API to check the certain device attribute values.
 *
 * @param deviceKey the device that holds the attributes to be checked
 * @param username the user that has the device
 * @param attributeName the name of the attribute that will be checked
 * @param attributeValue the value the named attribute should be set to when checked
 */
private void checkDeviceAttribute(final String deviceKey, final String username, final String attributeName, final String attributeValue) {
    final AdminGetDeviceRequest adminGetDeviceRequest = new AdminGetDeviceRequest().withDeviceKey(deviceKey).withUsername(username).withUserPoolId(userPoolId);
    final AdminGetDeviceResult adminGetDeviceResult = getUserpoolLL().adminGetDevice(adminGetDeviceRequest);
    final List<AttributeType> deviceAttributes = adminGetDeviceResult.getDevice().getDeviceAttributes();
    for (AttributeType attributeType : deviceAttributes) {
        if (attributeType.getName().equals(attributeName)) {
            assertEquals(attributeValue, attributeType.getValue());
            return;
        }
    }
}
Also used : AdminGetDeviceResult(com.amazonaws.services.cognitoidentityprovider.model.AdminGetDeviceResult) AdminGetDeviceRequest(com.amazonaws.services.cognitoidentityprovider.model.AdminGetDeviceRequest) AttributeType(com.amazonaws.services.cognitoidentityprovider.model.AttributeType)

Aggregations

AdminGetDeviceRequest (com.amazonaws.services.cognitoidentityprovider.model.AdminGetDeviceRequest)1 AdminGetDeviceResult (com.amazonaws.services.cognitoidentityprovider.model.AdminGetDeviceResult)1 AttributeType (com.amazonaws.services.cognitoidentityprovider.model.AttributeType)1