[Iotcon] Add NotSupportedError to initialize() 30/262230/5
authorPawel Wasowski <p.wasowski2@samsung.com>
Wed, 4 Aug 2021 16:16:42 +0000 (18:16 +0200)
committerPawel Wasowski <p.wasowski2@samsung.com>
Fri, 20 Aug 2021 15:31:47 +0000 (17:31 +0200)
ACR: TWDAPI-279

[Verification] After disabling iotcon support in
/etc/config/model-config.xml, tizen.iotcon.initialize() throws
NotSupportedError, as expected.
Auto tct-iotcon-tizen-tests pass rate: 100% (with the iotcon support
enabled in model-config.xml)
No tct-iotcon-tizen-tests are run when the iotcon support is disabled
in model-config.xml

Change-Id: I41be8376bcc1bca5b919daa0a5d0a9651b14d335
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
src/iotcon/iotcon_api.js

index 954068d..2d3ee8d 100644 (file)
@@ -1439,6 +1439,15 @@ function Iotcon() {
 }
 
 Iotcon.prototype.initialize = function() {
+    var kIotconFeature = 'http://tizen.org/feature/iot.ocf';
+
+    if (!tizen.systeminfo.getCapability(kIotconFeature)) {
+        throw new WebAPIException(
+            'NotSupportedError',
+            'The feature "' + kIotconFeature + '" is not supported'
+        );
+    }
+
     var args = validator.validateArgs(arguments, [
         {
             name: 'filePath',