Search in sources :

Example 1 with FirmwareImageListOptions

use of com.arm.mbed.cloud.sdk.update.model.FirmwareImageListOptions in project mbed-cloud-sdk-java by ARMmbed.

the class UpdateExamples method listFirmwareImages.

/**
 * Lists the first 5 firmware images.
 */
@SuppressWarnings("boxing")
@Example
public void listFirmwareImages() {
    ConnectionOptions config = Configuration.get();
    Update api = new Update(config);
    try {
        // Defining query options.
        FirmwareImageListOptions options = new FirmwareImageListOptions();
        options.setLimit(5);
        // Listing firmware images.
        Paginator<FirmwareImage> images = api.listAllFirmwareImages(options);
        String imageId = null;
        for (FirmwareImage image : images) {
            log("Firmware image", image);
            imageId = image.getId();
        }
        // Getting a specific image
        FirmwareImage image = api.getFirmwareImage(imageId);
        log("Specific firmware image", image);
    } catch (Exception e) {
        logError("last API Metadata", api.getLastApiMetadata());
        fail(e.getMessage());
    }
}
Also used : FirmwareImage(com.arm.mbed.cloud.sdk.update.model.FirmwareImage) ConnectionOptions(com.arm.mbed.cloud.sdk.common.ConnectionOptions) Update(com.arm.mbed.cloud.sdk.Update) FirmwareImageListOptions(com.arm.mbed.cloud.sdk.update.model.FirmwareImageListOptions) MbedCloudException(com.arm.mbed.cloud.sdk.common.MbedCloudException) AbstractExample(utils.AbstractExample) Example(utils.Example)

Example 2 with FirmwareImageListOptions

use of com.arm.mbed.cloud.sdk.update.model.FirmwareImageListOptions in project mbed-cloud-sdk-java by ARMmbed.

the class TestAllListOptions method testFirmwareImageListOptionsClone.

@Test
public void testFirmwareImageListOptionsClone() {
    FirmwareImageListOptions opt1 = new FirmwareImageListOptions();
    opt1.addEqualFilter("field1", Integer.valueOf(3));
    opt1.includeTotalCount();
    opt1.setLimit(Integer.valueOf(2));
    FirmwareImageListOptions opt2 = new FirmwareImageListOptions();
    assertNotEquals(opt2, opt1);
    assertNotSame(opt2, opt1);
    opt2 = opt1.clone();
    assertEquals(opt2, opt1);
    assertNotSame(opt2, opt1);
}
Also used : FirmwareImageListOptions(com.arm.mbed.cloud.sdk.update.model.FirmwareImageListOptions) Test(org.junit.Test)

Aggregations

FirmwareImageListOptions (com.arm.mbed.cloud.sdk.update.model.FirmwareImageListOptions)2 Update (com.arm.mbed.cloud.sdk.Update)1 ConnectionOptions (com.arm.mbed.cloud.sdk.common.ConnectionOptions)1 MbedCloudException (com.arm.mbed.cloud.sdk.common.MbedCloudException)1 FirmwareImage (com.arm.mbed.cloud.sdk.update.model.FirmwareImage)1 Test (org.junit.Test)1 AbstractExample (utils.AbstractExample)1 Example (utils.Example)1