use of software.amazon.awssdk.services.iotsitewise.model.GetAssetPropertyValueResponse in project aws-iot-greengrass-edge-connector-for-kinesis-video-stream by awslabs.
the class SiteWiseClientTest method testGetAssetPropertyValue.
/**
******GetAssetHierarchiesIdList API tests**********
*/
@Test
public void testGetAssetPropertyValue() {
// when
when(ioTSiteWiseClient.getAssetPropertyValue((GetAssetPropertyValueRequest) any())).thenReturn(getAssetPropertyValueResponse);
// then
GetAssetPropertyValueResponse response = siteWiseClient.getAssetPropertyValue(SITE_WISE_ASSET_ID, SITE_WISE_PROPERTY_ID);
// verify
assertEquals(response.propertyValue().value().stringValue(), SITE_WISE_PROPERTY_VALUE);
}
use of software.amazon.awssdk.services.iotsitewise.model.GetAssetPropertyValueResponse in project aws-iot-greengrass-edge-connector-for-kinesis-video-stream by awslabs.
the class SiteWiseManager method buildEdgeConnectorForKVSConfiguration.
private EdgeConnectorForKVSConfiguration buildEdgeConnectorForKVSConfiguration(String cameraSiteWiseAssetId) throws IllegalAccessException {
DescribeAssetResponse assetResponse = siteWiseClient.describeAsset(cameraSiteWiseAssetId);
EdgeConnectorForKVSConfiguration edgeConnectorForKVSConfiguration = new EdgeConnectorForKVSConfiguration();
edgeConnectorForKVSConfiguration.setSiteWiseAssetId(cameraSiteWiseAssetId);
for (AssetProperty assetProperty : assetResponse.assetProperties()) {
GetAssetPropertyValueResponse result;
Field[] fields = edgeConnectorForKVSConfiguration.getClass().getDeclaredFields();
for (Field field : fields) {
if (field.getName().equalsIgnoreCase(assetProperty.name())) {
result = siteWiseClient.getAssetPropertyValue(cameraSiteWiseAssetId, assetProperty.id());
if (result != null && result.propertyValue() != null) {
if (field.getType() == String.class) {
field.set(edgeConnectorForKVSConfiguration, result.propertyValue().value().stringValue());
break;
} else if (field.getType() == Integer.TYPE || field.getType() == Integer.class) {
field.set(edgeConnectorForKVSConfiguration, result.propertyValue().value().integerValue());
break;
}
}
}
}
if (assetProperty.name().equalsIgnoreCase(Constants.SITE_WISE_VIDEO_UPLOADED_TIME_RANGE_MEASUREMENT_NAME)) {
edgeConnectorForKVSConfiguration.setVideoUploadedTimeRangePropertyId(assetProperty.id());
}
if (assetProperty.name().equalsIgnoreCase(Constants.SITE_WISE_VIDEO_RECORDED_TIME_RANGE_MEASUREMENT_NAME)) {
edgeConnectorForKVSConfiguration.setVideoRecordedTimeRangePropertyId(assetProperty.id());
}
if (assetProperty.name().equalsIgnoreCase(Constants.SITE_WISE_CACHED_VIDEO_AGE_OUT_ON_EDGE_MEASUREMENT_NAME)) {
edgeConnectorForKVSConfiguration.setCachedVideoAgeOutOnEdgePropertyId(assetProperty.id());
}
if (assetProperty.name().equalsIgnoreCase(Constants.SITE_WISE_VIDEO_UPLOAD_REQUEST_MEASUREMENT_NAME)) {
if (assetProperty.notification().state() == PropertyNotificationState.ENABLED) {
edgeConnectorForKVSConfiguration.setVideoUploadRequestMqttTopic(assetProperty.notification().topic());
} else {
log.warn("Video Upload Request MQTT Notification Disabled for Asset Id " + cameraSiteWiseAssetId);
}
}
}
return edgeConnectorForKVSConfiguration;
}
Aggregations