aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGabriel Schulhof <gabriel.schulhof@intel.com>2016-04-21 22:29:55 +0300
committerGabriel Schulhof <gabriel.schulhof@intel.com>2016-05-03 13:39:52 +0000
commitc996aebbe43038abfe071562e3d62afe5b69daac (patch)
treef193d3992ce44e3d4174f99075e2de0abfa0cc1c
parent390866274386fe4d62ad8aa9a27a8c9f049b1cad (diff)
All: Update to iotivity 1.1.01.1.0-1
Change-Id: Ie8815ac9399b03cf7a687e438ede4cfc8625a263 Signed-off-by: Gabriel Schulhof <gabriel.schulhof@intel.com> Reviewed-on: https://gerrit.iotivity.org/gerrit/8031
-rw-r--r--README.md10
-rw-r--r--js/high-level-server-example.js2
-rw-r--r--lib/OicClient.js59
-rw-r--r--lib/OicDevice.js34
-rw-r--r--lib/OicServer.js8
-rw-r--r--lib/StorageHandler.js2
-rw-r--r--octbstack.pc.in2
-rw-r--r--package.json2
-rw-r--r--src/common.h15
-rw-r--r--src/functions/oc-random.cc8
-rw-r--r--src/structures/oc-device-info.cc51
-rw-r--r--src/structures/oc-payload.cc24
-rw-r--r--src/structures/oc-sid.cc10
-rw-r--r--src/structures/oc-sid.h6
-rw-r--r--tests/getresult.js44
-rw-r--r--tests/tests/API Create Delete/server.js4
-rw-r--r--tests/tests/API Device Information/client.js21
-rw-r--r--tests/tests/API Device Information/server.js27
-rw-r--r--tests/tests/Resource Operations.js2
19 files changed, 193 insertions, 138 deletions
diff --git a/README.md b/README.md
index ca21e82..0ede7b8 100644
--- a/README.md
+++ b/README.md
@@ -35,7 +35,7 @@ var device = require( "iotivity-node" )();
will give you an instance of OicDevice as described in the JS API spec.
### In more detail:
-iotivity-node depends on [iotivity][] proper. It has been tested against [1.0.1][] on Linux. iotivity depends on development headers for libuuid and boost.
+iotivity-node depends on [iotivity][] proper. It has been tested against [1.1.0][] on Linux. iotivity depends on development headers for libuuid and boost.
iotivity-node requires a compiler that implements the C++11 standard.
@@ -107,10 +107,10 @@ Make sure no firewall is running (or one is properly configured to allow iotivit
[iotivity]: http://iotivity.org/
[node]: https://nodejs.org/
-[1.0.1]: https://gerrit.iotivity.org/gerrit/gitweb?p=iotivity.git;a=tree;hb=1.0.1
-[snapshot]: https://gerrit.iotivity.org/gerrit/gitweb?p=iotivity.git;a=snapshot;h=1.0.1;sf=tgz
+[1.1.0]: https://gerrit.iotivity.org/gerrit/gitweb?p=iotivity.git;a=tree;hb=1.1.0
+[snapshot]: https://gerrit.iotivity.org/gerrit/gitweb?p=iotivity.git;a=snapshot;h=1.1.0;sf=tgz
[scons]: http://www.scons.org/
-[install.sh]: https://raw.githubusercontent.com/otcshare/iotivity-node/1.0.1-1/install.sh
-[octbstack.pc.in]: https://raw.githubusercontent.com/otcshare/iotivity-node/1.0.1-1/octbstack.pc.in
+[install.sh]: https://raw.githubusercontent.com/otcshare/iotivity-node/1.1.0-1/install.sh
+[octbstack.pc.in]: https://raw.githubusercontent.com/otcshare/iotivity-node/1.1.0-1/octbstack.pc.in
[iotivity wiki]: https://wiki.iotivity.org/faq_s
[video]: https://www.youtube.com/watch?v=95VTB_qgYfw
diff --git a/js/high-level-server-example.js b/js/high-level-server-example.js
index 96c2f1f..c6265ef 100644
--- a/js/high-level-server-example.js
+++ b/js/high-level-server-example.js
@@ -42,7 +42,7 @@ sensor.on( "change", function( newData ) {
}
if ( observerCount > 0 ) {
- device.notify( lightResource ).catch( function( error ) {
+ device.notify( lightResource ).catch( function( error ) {
if ( error.message === "notify: There are no observers" ) {
observerCount = 0;
}
diff --git a/lib/OicClient.js b/lib/OicClient.js
index 6544901..8005bfd 100644
--- a/lib/OicClient.js
+++ b/lib/OicClient.js
@@ -239,7 +239,7 @@ _.extend( devicePrototype, {
// providing the value we pass to fulfill()
answer = options.createAnswer ?
options.createAnswer.call( this, handle, response ) :
- undefined;
+ undefined;
fulfill.apply( this, answer !== undefined ? [ answer ] : [] );
} else {
reject( this._errorFromResponse( response,
@@ -377,27 +377,27 @@ _.extend( devicePrototype, {
iotivity.OCPayloadType.PAYLOAD_TYPE_PRESENCE ) {
switch ( response.payload.trigger ) {
- case iotivity.OCPresenceTrigger.OC_PRESENCE_TRIGGER_CREATE:
- this._addDevice( deviceId, { uuid: deviceId }, response.devAddr );
- this.findResources( { deviceId: deviceId } );
- break;
-
- case iotivity.OCPresenceTrigger.OC_PRESENCE_TRIGGER_DELETE:
- delete this._devices[ deviceId ];
- for ( index in this._resources ) {
- if ( this._resources[ index ].id.deviceId === deviceId ) {
- this._resources[ index ].dispatchEvent( "delete", {
- type: "delete"
- } );
- delete this._resources[ index ];
- }
+ case iotivity.OCPresenceTrigger.OC_PRESENCE_TRIGGER_CREATE:
+ this._addDevice( deviceId, { uuid: deviceId }, response.devAddr );
+ this.findResources( { deviceId: deviceId } );
+ break;
+
+ case iotivity.OCPresenceTrigger.OC_PRESENCE_TRIGGER_DELETE:
+ delete this._devices[ deviceId ];
+ for ( index in this._resources ) {
+ if ( this._resources[ index ].id.deviceId === deviceId ) {
+ this._resources[ index ].dispatchEvent( "delete", {
+ type: "delete"
+ } );
+ delete this._resources[ index ];
}
- break;
+ }
+ break;
- default:
+ default:
- // FIXME: What is OC_PRESENCE_TRIGGER_CHANGE?
- break;
+ // FIXME: What is OC_PRESENCE_TRIGGER_CHANGE?
+ break;
}
}
@@ -417,12 +417,11 @@ _.extend( devicePrototype, {
resourceId: { deviceId: id, path: "/oic/d" },
method: "OC_REST_GET",
createAnswer: function createAnswerForGetDeviceInfo( handle, response ) {
- var payload = utils.payloadToObject( response.payload.values );
this._devices[ id ] = _.extend( this._devices[ id ] || {}, {
info: {
uuid: id,
- name: payload.n,
- coreSpecVersion: payload.lcv
+ name: response.payload.deviceName,
+ coreSpecVersion: response.payload.specVersion
}
} );
return this._devices[ id ].info;
@@ -436,14 +435,16 @@ _.extend( devicePrototype, {
resourceId: { deviceId: id, path: "/oic/p" },
method: "OC_REST_GET",
createAnswer: function createAnswerForGetPlatformInfo( handle, response ) {
- var result = utils.payloadToObject( response.payload.values );
return {
- id: result.pi,
- manufacturerName: result.mnmn,
- manufactureDate: result.mndt,
- platformVersion: result.mnpv,
- firmwareVersion: result.mnfv,
- supportUrl: result.mnsl
+ id: response.payload.info.platformID,
+ osVersion: response.payload.info.operatingSystemVersion,
+ model: response.payload.info.modelNumber,
+ manufacturerName: response.payload.info.manufacturerName,
+ manufacturerUrl: response.payload.info.manufacturerUrl,
+ manufactureDate: new Date( response.payload.info.dateOfManufacture ),
+ platformVersion: response.payload.info.platformVersion,
+ firmwareVersion: response.payload.info.firmwareVersion,
+ supportUrl: response.payload.info.supportUrl
};
}
} );
diff --git a/lib/OicDevice.js b/lib/OicDevice.js
index 15233dc..77d2c3e 100644
--- a/lib/OicDevice.js
+++ b/lib/OicDevice.js
@@ -77,7 +77,7 @@ _.extend( utils.makeEventEmitter( OicDevice ).prototype, {
},
_setDeviceInfo: function( info ) {
- var result = iotivity.OCSetDeviceInfo( { deviceName: info.name } );
+ var result = iotivity.OCSetDeviceInfo( { deviceName: info.name, types: [] } );
if ( result !== iotivity.OCStackResult.OC_STACK_OK ) {
throw _.extend( new Error( "Set device info failed" ), {
result: result
@@ -95,21 +95,21 @@ _.extend( utils.makeEventEmitter( OicDevice ).prototype, {
_setPlatformInfo: function( info ) {
var result = iotivity.OCSetPlatformInfo( _.extend( {
- // Required fields
- platformID: info.id,
- manufacturerName: ( function validateManufacturerName( name ) {
- if ( typeof name !== "string" || !name ) {
- throw new Error( "manufacturer name must be a non-empty string" );
- }
- if ( name.length > iotivity.MAX_MANUFACTURER_NAME_LENGTH ) {
- throw new Error( "manufacturer name length must not exceed " +
- iotivity.MAX_MANUFACTURER_NAME_LENGTH + " characters" );
- }
- return name;
- } )( info.manufacturerName )
-
- // NOTE: systemTime and hardwareVersion are absent from the spec
- },
+ // Required fields
+ platformID: info.id,
+ manufacturerName: ( function validateManufacturerName( name ) {
+ if ( typeof name !== "string" || !name ) {
+ throw new Error( "manufacturer name must be a non-empty string" );
+ }
+ if ( name.length > iotivity.MAX_MANUFACTURER_NAME_LENGTH ) {
+ throw new Error( "manufacturer name length must not exceed " +
+ iotivity.MAX_MANUFACTURER_NAME_LENGTH + " characters" );
+ }
+ return name;
+ } )( info.manufacturerName )
+
+ // NOTE: systemTime and hardwareVersion are absent from the spec
+ },
// Optional fields
typeof info.manufacturerUrl === "string" && info.manufacturerUrl ?
@@ -119,7 +119,7 @@ _.extend( utils.makeEventEmitter( OicDevice ).prototype, {
iotivity.MAX_MANUFACTURER_URL_LENGTH + " characters" );
}
return url;
- } )( info.manufacturerUrl ) } : {},
+ } )( info.manufacturerUrl ) } : {},
typeof info.model === "string" && info.model ?
{ modelNumber: info.model } : {},
typeof info.platformVersion === "string" && info.platformVersion ?
diff --git a/lib/OicServer.js b/lib/OicServer.js
index 619bf0e..7c81e96 100644
--- a/lib/OicServer.js
+++ b/lib/OicServer.js
@@ -131,10 +131,10 @@ _.extend( devicePrototype, {
oicReq._resourceHandle = request.resource;
oicReq.requestId = request.requestHandle;
oicReq.target = resource || this._resources[ deviceId + ":" + url ] || {
- id: {
- deviceId: deviceId,
- path: url
- }
+ id: {
+ deviceId: deviceId,
+ path: url
+ }
};
if ( flag & iotivity.OCEntityHandlerFlag.OC_REQUEST_FLAG ) {
diff --git a/lib/StorageHandler.js b/lib/StorageHandler.js
index 511c3f3..e6168e3 100644
--- a/lib/StorageHandler.js
+++ b/lib/StorageHandler.js
@@ -66,6 +66,8 @@ _.extend( StorageHandler.prototype, {
var fd,
absolutePath = path.join( this._directory, filename );
+ mode = mode.replace( /b/g, "" );
+
// If the requested file does not exist, create it and fill it with basic info
try {
fd = fs.openSync( absolutePath, "wx" );
diff --git a/octbstack.pc.in b/octbstack.pc.in
index a7fbfba..32334c8 100644
--- a/octbstack.pc.in
+++ b/octbstack.pc.in
@@ -4,6 +4,6 @@ includedir=@INCLUDEDIR@
Name: liboctbstack
Description: iotivity CSDK
-Version: 1.0.1
+Version: 1.1.0
Libs: -L${libdir} -Wl,-rpath ${libdir} -loctbstack @PLATFORM_LIBS@
Cflags: -I${includedir}/@OCTB_STACK_INCLUDEDIR@ -I${includedir}/@OCTB_RANDOM_INCLUDEDIR@ -I${includedir}/@OCTB_CCOMMON_INCLUDEDIR@ -DTCP_ADAPTER -DROUTING_EP
diff --git a/package.json b/package.json
index e615ab7..2dd6749 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "iotivity-node",
- "version": "1.0.1-1",
+ "version": "1.1.0-1",
"description": "IoTivity bindings",
"repository": "https://github.com/otcshare/iotivity-node/",
"license": "Apache-2.0",
diff --git a/src/common.h b/src/common.h
index f5b2187..5e26547 100644
--- a/src/common.h
+++ b/src/common.h
@@ -96,4 +96,19 @@
failReturn); \
destination.memberName = (destinationType)memberName->accessor();
+#define ADD_STRING_ARRAY(destination, source, memberName) \
+ do { \
+ int counter; \
+ OCStringLL *item; \
+ for (item = (source)->memberName, counter = 0; item; \
+ item = item->next, counter++) \
+ ; \
+ Local<Array> jsArray = Nan::New<Array>(counter); \
+ for (item = (source)->memberName, counter = 0; item; \
+ item = item->next, counter++) { \
+ Nan::Set(jsArray, counter, Nan::New(item->value).ToLocalChecked()); \
+ } \
+ Nan::Set((destination), Nan::New(#memberName).ToLocalChecked(), jsArray); \
+ } while (0)
+
#endif /* __IOTIVITY_NODE_FUNCTIONS_INTERNAL_H__ */
diff --git a/src/functions/oc-random.cc b/src/functions/oc-random.cc
index 320a32b..7f63e82 100644
--- a/src/functions/oc-random.cc
+++ b/src/functions/oc-random.cc
@@ -30,14 +30,14 @@ NAN_METHOD(bind_OCConvertUuidToString) {
VALIDATE_ARGUMENT_TYPE(info, 1, IsObject);
OCRandomUuidResult result;
- uint8_t sid[UUID_SIZE] = {0};
+ char sid[UUID_SIZE] = {0};
char stringSid[UUID_STRING_SIZE] = "";
if (!c_SID(Local<Array>::Cast(info[0]), sid)) {
return;
}
- result = OCConvertUuidToString(sid, stringSid);
+ result = OCConvertUuidToString((const uint8_t *)sid, stringSid);
Local<Object> receptacle = Local<Object>::Cast(info[1]);
@@ -73,8 +73,8 @@ NAN_METHOD(bind_OCGenerateUuid) {
Nan::ThrowRangeError("Array is not of length UUID_SIZE");
return;
}
- uint8_t cDestination[UUID_SIZE] = {0};
- OCRandomUuidResult result = OCGenerateUuid(cDestination);
+ char cDestination[UUID_SIZE] = {0};
+ OCRandomUuidResult result = OCGenerateUuid((uint8_t *)cDestination);
fillJSSid(destination, cDestination);
info.GetReturnValue().Set(Nan::New(result));
}
diff --git a/src/structures/oc-device-info.cc b/src/structures/oc-device-info.cc
index ad94bd0..222b5aa 100644
--- a/src/structures/oc-device-info.cc
+++ b/src/structures/oc-device-info.cc
@@ -29,18 +29,65 @@ v8::Local<v8::Object> js_OCDeviceInfo(OCDeviceInfo *info) {
Local<Object> returnValue = Nan::New<Object>();
SET_STRING_IF_NOT_NULL(returnValue, info, deviceName);
+ ADD_STRING_ARRAY(returnValue, info, types);
return returnValue;
}
-void c_OCDeviceInfoFreeMembers(OCDeviceInfo *info) { free(info->deviceName); }
+void c_OCDeviceInfoFreeMembers(OCDeviceInfo *info) {
+ OCStringLL *item, *nextItem;
+
+ free(info->deviceName);
+ for (item = info->types; item;) {
+ nextItem = item->next;
+ free(item->value);
+ free(item);
+ item = nextItem;
+ }
+}
bool c_OCDeviceInfo(Local<Object> deviceInfo, OCDeviceInfo *info) {
- OCDeviceInfo local = {0};
+ OCDeviceInfo local = {0, 0};
+ OCStringLL *newType = 0;
VALIDATE_AND_ASSIGN_STRING(&local, deviceName, deviceInfo,
c_OCDeviceInfoFreeMembers, false);
+ // Make sure the "types" property is an array
+ Local<Value> typesValue =
+ Nan::Get(deviceInfo, Nan::New("types").ToLocalChecked()).ToLocalChecked();
+ VALIDATE_VALUE_TYPE_OR_FREE(typesValue, IsArray, "device info types list",
+ false, &local, c_OCDeviceInfoFreeMembers);
+ Local<Array> jsTypes = Local<Array>::Cast(typesValue);
+ size_t index, length = jsTypes->Length();
+
+ for (index = 0; index < length; index++) {
+ // Make sure an individual type is a string
+ Local<Value> itemValue = Nan::Get(jsTypes, index).ToLocalChecked();
+ VALIDATE_VALUE_TYPE_OR_FREE(itemValue, IsString,
+ "device info types list item", false, &local,
+ c_OCDeviceInfoFreeMembers);
+
+ // Copy the string to the C linked list
+ newType = new OCStringLL;
+ if (newType) {
+ newType->next = local.types;
+ local.types = newType;
+ newType->value = strdup((const char *)*(String::Utf8Value(itemValue)));
+ if (newType->value) {
+ // If copying succeeds we move on to the next type in the list
+ continue;
+ }
+ }
+
+ // If copying fails we bail
+ Nan::ThrowError("Failed to allocate device info types list item");
+ c_OCDeviceInfoFreeMembers(&local);
+ return false;
+ }
+
+ // If we've successfully created the structure, we transfer it to the
+ // passed-in structure
*info = local;
return true;
}
diff --git a/src/structures/oc-payload.cc b/src/structures/oc-payload.cc
index e083e18..f587ebb 100644
--- a/src/structures/oc-payload.cc
+++ b/src/structures/oc-payload.cc
@@ -21,6 +21,7 @@
#include "string-primitive.h"
#include "oc-platform-info.h"
#include "oc-device-info.h"
+#include "handles.h"
extern "C" {
#include <string.h>
@@ -194,21 +195,6 @@ static Local<Object> js_OCRepPayload(OCRepPayload *payload) {
return returnValue;
}
-#define ADD_STRING_ARRAY(returnValue, payload, memberName) \
- do { \
- int counter; \
- OCStringLL *item; \
- for (item = (payload)->memberName, counter = 0; item; \
- item = item->next, counter++) \
- ; \
- Local<Array> jsArray = Nan::New<Array>(counter); \
- for (item = (payload)->memberName, counter = 0; item; \
- item = item->next, counter++) { \
- Nan::Set(jsArray, counter, Nan::New(item->value).ToLocalChecked()); \
- } \
- Nan::Set((returnValue), Nan::New(#memberName).ToLocalChecked(), jsArray); \
- } while (0)
-
static Local<Object> js_OCResourcePayload(OCResourcePayload *payload) {
Local<Object> returnValue = Nan::New<Object>();
@@ -291,8 +277,6 @@ static Local<Object> js_OCDiscoveryPayload(OCDiscoveryPayload *payload) {
}
ADD_STRUCTURE_ARRAY(returnValue, payload, resources, OCResourcePayload);
- ADD_STRUCTURE_ARRAY(returnValue, payload, collectionResources,
- OCResourceCollectionPayload);
return returnValue;
}
@@ -348,7 +332,11 @@ static Local<Object> js_OCSecurityPayload(OCSecurityPayload *payload) {
Nan::Set(returnValue, Nan::New("type").ToLocalChecked(),
Nan::New(payload->base.type));
- SET_STRING_IF_NOT_NULL(returnValue, payload, securityData);
+ if (payload->securityData) {
+ Nan::Set(returnValue, Nan::New("securityData").ToLocalChecked(),
+ jsArrayFromBytes((unsigned char *)(payload->securityData),
+ payload->payloadSize));
+ }
return returnValue;
}
diff --git a/src/structures/oc-sid.cc b/src/structures/oc-sid.cc
index c0e9ac4..76aa834 100644
--- a/src/structures/oc-sid.cc
+++ b/src/structures/oc-sid.cc
@@ -25,14 +25,14 @@ extern "C" {
using namespace v8;
-void fillJSSid(Local<Array> jsSid, uint8_t *sid) {
+void fillJSSid(Local<Array> jsSid, char *sid) {
int index;
for (index = 0; index < UUID_SIZE; index++) {
jsSid->Set(index, Nan::New(sid[index]));
}
}
-Local<Array> js_SID(uint8_t *sid) {
+Local<Array> js_SID(char *sid) {
Local<Array> returnValue = Nan::New<Array>(UUID_SIZE);
fillJSSid(returnValue, sid);
@@ -40,9 +40,9 @@ Local<Array> js_SID(uint8_t *sid) {
return returnValue;
}
-bool c_SID(Local<Array> jsSid, uint8_t *sid) {
+bool c_SID(Local<Array> jsSid, char *sid) {
int index;
- uint8_t result[UUID_SIZE];
+ char result[UUID_SIZE];
if (jsSid->Length() > UUID_SIZE) {
Nan::ThrowRangeError("SID length must be UUID_SIZE");
@@ -55,6 +55,6 @@ bool c_SID(Local<Array> jsSid, uint8_t *sid) {
result[index] = oneByte->Uint32Value();
}
- memcpy(sid, result, UUID_SIZE * sizeof(uint8_t));
+ memcpy(sid, result, UUID_SIZE * sizeof(char));
return true;
}
diff --git a/src/structures/oc-sid.h b/src/structures/oc-sid.h
index 3085a21..e6f2e97 100644
--- a/src/structures/oc-sid.h
+++ b/src/structures/oc-sid.h
@@ -19,8 +19,8 @@
#include <v8.h>
-void fillJSSid(v8::Local<v8::Array> jsSid, uint8_t *sid);
-v8::Local<v8::Array> js_SID(uint8_t *sid);
-bool c_SID(v8::Local<v8::Array> jsSid, uint8_t *sid);
+void fillJSSid(v8::Local<v8::Array> jsSid, char *sid);
+v8::Local<v8::Array> js_SID(char *sid);
+bool c_SID(v8::Local<v8::Array> jsSid, char *sid);
#endif /* __IOTIVITY_NODE_OCSID_H__ */
diff --git a/tests/getresult.js b/tests/getresult.js
index 9041073..135f612 100644
--- a/tests/getresult.js
+++ b/tests/getresult.js
@@ -10,30 +10,30 @@ var date = new Date(),
test = {},
testInfo = {};
-exports.getTestResult = function( status, success, failure ) {
+exports.getTestResult = function( status, success, failure ) {
- if ( status.result ) {
- success = "PASS";
- } else if ( !status.result ) {
- failure = "FAIL";
- }
+if ( status.result ) {
+ success = "PASS";
+} else if ( !status.result ) {
+ failure = "FAIL";
+}
- testInfo = {
- "message": ( status.runtime + ": " + status.message ),
- "result": ( status.result ? success : failure ),
- "runtime": ( date.toLocaleTimeString() )
- };
+testInfo = {
+ "message": ( status.runtime + ": " + status.message ),
+ "result": ( status.result ? success : failure ),
+ "runtime": ( date.toLocaleTimeString() )
+};
- if ( setList.indexOf( status.name ) > -1 && ( "results" in test ) ) {
- test.results.push( testInfo );
- caseList.push( test );
- } else {
- setList.push( status.name );
- test = { "test": status.name, "results": [ testInfo ] };
- caseList.push( test );
- allList.push( test );
- }
+if ( setList.indexOf( status.name ) > -1 && ( "results" in test ) ) {
+ test.results.push( testInfo );
+ caseList.push( test );
+} else {
+ setList.push( status.name );
+ test = { "test": status.name, "results": [ testInfo ] };
+ caseList.push( test );
+ allList.push( test );
+}
- data = JSON.stringify( { "output": allList }, null, 4 );
- fs.writeFileSync( jsonFilename, data );
+data = JSON.stringify( { "output": allList }, null, 4 );
+fs.writeFileSync( jsonFilename, data );
};
diff --git a/tests/tests/API Create Delete/server.js b/tests/tests/API Create Delete/server.js
index 3a39fa9..65a6b27 100644
--- a/tests/tests/API Create Delete/server.js
+++ b/tests/tests/API Create Delete/server.js
@@ -61,9 +61,7 @@ async.series( [
resourceTypes: [ "core.light" ],
interfaces: [ "oic.if.baseline" ],
properties: {
- someKey: "someValue",
- "if": "oic.if.baseline",
- "rt": "core.light"
+ someKey: "someValue"
}
}, "Server: Resource signature is as expected" );
device.registerResource( request.res ).then(
diff --git a/tests/tests/API Device Information/client.js b/tests/tests/API Device Information/client.js
index 27e2ea4..28c933b 100644
--- a/tests/tests/API Device Information/client.js
+++ b/tests/tests/API Device Information/client.js
@@ -48,15 +48,18 @@ new Promise( function findTheDeviceId( fulfill, reject ) {
// Convert the manufactureDate to a timestamp for unambiguous comparison
utils.assert( "deepEqual", _.extend( platformInfo, {
- manufactureDate: new Date( platformInfo.manufactureDate ).getTime()
- } ), {
- id: deviceId,
- manufacturerName: "Random",
- manufactureDate: 1299752880000,
- platformVersion: "platformVersion " + uuid,
- firmwareVersion: "firmwareVersion " + uuid,
- supportUrl: "supportUrl:" + uuid
- }, "Client: The retrieved platform information is as expected" );
+ manufactureDate: new Date( platformInfo.manufactureDate ).getTime()
+ } ), {
+ id: "platform " + uuid,
+ manufacturerName: "Random",
+ manufactureDate: 1299752880000,
+ manufacturerUrl: "http://example.com/",
+ model: "model " + uuid,
+ osVersion: "osVersion " + uuid,
+ platformVersion: "platformVersion " + uuid,
+ firmwareVersion: "firmwareVersion " + uuid,
+ supportUrl: "supportUrl:" + uuid
+ }, "Client: The retrieved platform information is as expected" );
} );
} ).then(
function testIsDone() {
diff --git a/tests/tests/API Device Information/server.js b/tests/tests/API Device Information/server.js
index 647094c..d6ffef9 100644
--- a/tests/tests/API Device Information/server.js
+++ b/tests/tests/API Device Information/server.js
@@ -18,15 +18,16 @@ var oic = require( "../../../index" )( "server" );
var uuid = process.argv[ 2 ];
var theError = null;
var defaultPlatformInfo = {
- osVersion: "osVersion " + uuid,
- model: "model " + uuid,
- manufacturerName: "manufacturerName " + uuid,
- manufacturerUrl: "manufacturerUrl:" + uuid + "/something/very/long/to/make/sure/it/breaks",
- manufactureDate: new Date( 1299752880000 ),
- platformVersion: "platformVersion " + uuid,
- firmwareVersion: "firmwareVersion " + uuid,
- supportUrl: "supportUrl:" + uuid
- };
+ id: "platform " + uuid,
+ osVersion: "osVersion " + uuid,
+ model: "model " + uuid,
+ manufacturerName: "manufacturerName " + uuid,
+ manufacturerUrl: "manufacturerUrl:" + uuid + "/something/very/long/to/make/sure/it/breaks",
+ manufactureDate: new Date( 1299752880000 ),
+ platformVersion: "platformVersion " + uuid,
+ firmwareVersion: "firmwareVersion " + uuid,
+ supportUrl: "supportUrl:" + uuid
+};
var theResource;
console.log( JSON.stringify( { assertionCount: 4 } ) );
@@ -54,7 +55,7 @@ try {
}
utils.assert( "strictEqual", theError.message.substr( 0, 40 ),
"manufacturer name length must not exceed",
- "Server: Setting the platform info failed because of the manufacturer name's length" );
+ "Server: Setting the platform info failed because of the manufacturer name's length" );
defaultPlatformInfo.manufacturerName = "Random";
@@ -77,9 +78,9 @@ try {
theError = anError;
}
utils.assert( "strictEqual", theError ? {
- message: theError.message,
- result: theError.result
- } : null,
+ message: theError.message,
+ result: theError.result
+} : null,
null,
"Server: Setting the platform info succeeded" );
diff --git a/tests/tests/Resource Operations.js b/tests/tests/Resource Operations.js
index 1e78ddb..34d5ea5 100644
--- a/tests/tests/Resource Operations.js
+++ b/tests/tests/Resource Operations.js
@@ -33,7 +33,7 @@ result = iotivity.OCInit( null, 0, iotivity.OCMode.OC_SERVER );
testUtils.stackOKOrDie( "OCInit", result );
// Set device info
-result = iotivity.OCSetDeviceInfo( { deviceName: "resource-operations-" + uuid } );
+result = iotivity.OCSetDeviceInfo( { deviceName: "resource-operations-" + uuid, types: [] } );
testUtils.stackOKOrDie( "OCSetDeviceInfo", result );
// Set platform info