use of com.microsoft.azure.sdk.iot.deps.twin.DeviceCapabilities in project azure-iot-sdk-java by Azure.
the class DeviceCapabilitiesTest method getIotEdgeSucceed.
/* Tests_SRS_CONFIGURATIONINFO_28_002: [The getStatus shall return the stored `status` content.] */
@Test
public void getIotEdgeSucceed() {
// arrange
Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().disableHtmlEscaping().create();
DeviceCapabilities result = gson.fromJson(DEVICECAPABILITIES_SAMPLE, DeviceCapabilities.class);
// act - assert
assertEquals(false, result.isIotEdge());
}
use of com.microsoft.azure.sdk.iot.deps.twin.DeviceCapabilities in project azure-iot-sdk-java by Azure.
the class DeviceCapabilitiesTest method setIotEdgeSucceed.
/* Tests_SRS_CONFIGURATIONINFO_28_001: [The setStatus shall replace the `status` by the provided one.] */
@Test
public void setIotEdgeSucceed() {
// arrange
Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().disableHtmlEscaping().create();
DeviceCapabilities result = gson.fromJson(DEVICECAPABILITIES_SAMPLE, DeviceCapabilities.class);
// act
result.setIotEdge(true);
// assert
assertEquals(true, Deencapsulation.getField(result, "iotEdge"));
}
use of com.microsoft.azure.sdk.iot.deps.twin.DeviceCapabilities in project azure-iot-sdk-java by Azure.
the class ProvisioningServiceClientTests method createdEnrollmentGroupMatchesSentEnrollmentGroup.
@Test
public void createdEnrollmentGroupMatchesSentEnrollmentGroup() throws ProvisioningServiceClientException {
String groupId = testPrefix + UUID.randomUUID();
Attestation attestation = new SymmetricKeyAttestation("", "");
EnrollmentGroup enrollment = new EnrollmentGroup(groupId, attestation);
enrollment.setAllocationPolicy(AllocationPolicy.CUSTOM);
CustomAllocationDefinition customAllocationDefinition = new CustomAllocationDefinition();
customAllocationDefinition.setApiVersion("2018-09-01-preview");
customAllocationDefinition.setWebhookUrl(customAllocationWebhookUrl);
enrollment.setCustomAllocationDefinition(customAllocationDefinition);
ReprovisionPolicy reprovisionPolicy = new ReprovisionPolicy();
reprovisionPolicy.setUpdateHubAssignment(true);
reprovisionPolicy.setMigrateDeviceData(true);
enrollment.setReprovisionPolicy(reprovisionPolicy);
DeviceCapabilities capabilities = new DeviceCapabilities();
capabilities.setIotEdge(true);
enrollment.setCapabilities(capabilities);
EnrollmentGroup returnedEnrollment = provisioningServiceClient.createOrUpdateEnrollmentGroup(enrollment);
assertEquals(enrollment.getEnrollmentGroupId(), returnedEnrollment.getEnrollmentGroupId());
assertEquals(enrollment.getReprovisionPolicy().getMigrateDeviceData(), returnedEnrollment.getReprovisionPolicy().getMigrateDeviceData());
assertEquals(enrollment.getReprovisionPolicy().getUpdateHubAssignment(), returnedEnrollment.getReprovisionPolicy().getUpdateHubAssignment());
assertEquals(enrollment.getCapabilities().isIotEdge(), returnedEnrollment.getCapabilities().isIotEdge());
assertEquals(enrollment.getAttestation().getClass(), returnedEnrollment.getAttestation().getClass());
assertEquals(enrollment.getAllocationPolicy(), returnedEnrollment.getAllocationPolicy());
assertEquals(enrollment.getCustomAllocationDefinition().getApiVersion(), returnedEnrollment.getCustomAllocationDefinition().getApiVersion());
}
use of com.microsoft.azure.sdk.iot.deps.twin.DeviceCapabilities in project azure-iot-sdk-java by Azure.
the class ProvisioningServiceClientTests method createdIndividualEnrollmentMatchesSentIndividualEnrollment.
@Test
public void createdIndividualEnrollmentMatchesSentIndividualEnrollment() throws ProvisioningServiceClientException {
String registrationId = testPrefix + UUID.randomUUID();
Attestation attestation = new SymmetricKeyAttestation("", "");
IndividualEnrollment enrollment = new IndividualEnrollment(registrationId, attestation);
enrollment.setAllocationPolicy(AllocationPolicy.GEOLATENCY);
ReprovisionPolicy reprovisionPolicy = new ReprovisionPolicy();
reprovisionPolicy.setUpdateHubAssignment(true);
reprovisionPolicy.setMigrateDeviceData(true);
enrollment.setReprovisionPolicy(reprovisionPolicy);
DeviceCapabilities capabilities = new DeviceCapabilities();
capabilities.setIotEdge(true);
enrollment.setCapabilities(capabilities);
IndividualEnrollment returnedEnrollment = provisioningServiceClient.createOrUpdateIndividualEnrollment(enrollment);
assertEquals(enrollment.getRegistrationId(), returnedEnrollment.getRegistrationId());
assertEquals(enrollment.getReprovisionPolicy().getMigrateDeviceData(), returnedEnrollment.getReprovisionPolicy().getMigrateDeviceData());
assertEquals(enrollment.getReprovisionPolicy().getUpdateHubAssignment(), returnedEnrollment.getReprovisionPolicy().getUpdateHubAssignment());
assertEquals(enrollment.getCapabilities().isIotEdge(), returnedEnrollment.getCapabilities().isIotEdge());
assertEquals(enrollment.getAttestation().getClass(), returnedEnrollment.getAttestation().getClass());
assertEquals(enrollment.getAllocationPolicy(), returnedEnrollment.getAllocationPolicy());
}
use of com.microsoft.azure.sdk.iot.deps.twin.DeviceCapabilities in project azure-iot-sdk-java by Azure.
the class ProvisioningTests method groupEnrollmentReprovisioningCanKeepTwin.
@Test
@StandardTierHubOnlyTest
public void groupEnrollmentReprovisioningCanKeepTwin() throws Exception {
ReprovisionPolicy reprovisionPolicy = new ReprovisionPolicy();
reprovisionPolicy.setMigrateDeviceData(true);
reprovisionPolicy.setUpdateHubAssignment(true);
DeviceCapabilities deviceCapabilities = new DeviceCapabilities();
deviceCapabilities.setIotEdge(true);
reprovisioningFlow(EnrollmentType.GROUP, null, reprovisionPolicy, null, getStartingHubs(), getHubsToReprovisionTo(), deviceCapabilities);
}
Aggregations