Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task/travis ci #105

Merged
merged 17 commits into from
Dec 22, 2017
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ branches:

services:
- mongodb
- docker

install:
- npm install

before_install:
- docker pull fiware/orion:latest
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking this in detail, .travis.yml file in the two other main IOTAs (UL and JSON) they aren't deploying Orion in before_install:

https://github.com/telefonicaid/iotagent-json/blob/master/.travis.yml#L21
https://github.com/telefonicaid/iotagent-ul/blob/master/.travis.yml#L21

So, why in the case of IOTA LWM2M is different?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason is that tests for IOTA LWM2M are not really unit tests since the responses from the Orion CB are not mocked. Instead, an instance of the CB must be deployed and the tests are executed against it.
I guess that we should open a new issue in order to mock CB in the unit tests of IOTA LWM2M.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue created at #106. NTC with regards this PR.

- docker run -d --net host -l orion fiware/orion:latest
- npm install -g grunt-cli

dist: precise
4 changes: 3 additions & 1 deletion CHANGES_NEXT_RELEASE
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
- Update Howtos with the last changes of the IoT Agent library (#48).
- Add test cases to check first observation of a value (#54).
- Update to master branch of IoTAgent Library and LWM2M Library 0.5.0.
- FEATURE update node version to 4.8.4
- FEATURE update node version to 4.8.4
- Unit tests are executed as part of Travis CI.
- npm-shrinkwrap file is updated (#99 and #100)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if I'm understanging correctly... You mean that updating npm-shrinkwrap was the solution for issue #99 and #100?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's correct. Since the npm-shrinkwrap was not updated, actually still the old version of https://github.com/telefonicaid/iotagent-node-lib was used causing these bugs.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We typically don't mention updates of npm-shrinkwrap file in CNR, but this case I think is a good idea, given doing so is fixing issues.

(I understand that #99 and #100 are about bugs in the provisioning API, otherwise my suggestion would be wrong. Please, check)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 9ccd486

15 changes: 8 additions & 7 deletions lib/ngsiHandlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ function selectRealName(extractedName, device, callback) {
* @param {String} type Type of the entity.
* @param {Array} attributes List of attributes of the entity to be updated (including type and value).
*/
function ngsiUpdateHandler(id, type, attributes, callback) {
function ngsiUpdateHandler(id, type, service, subservice, attributes, callback) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR incluces changes in program code, along with tests. Anything worth to mention in CHANGES_NEXT_RELEASE (i.e. some bug being fixed in the process of fixing the tests) or only trivial changes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 0de8f25


var name = id.substring(0, id.indexOf(':'));

logger.debug(context, 'Handling device data update from the northbound for device [%s] of type [%s]', id, type);
Expand All @@ -161,12 +162,12 @@ function ngsiUpdateHandler(id, type, attributes, callback) {
name = id;
}

iotAgentLib.getDeviceByName(id, function(error, ngsiDevice) {
iotAgentLib.getDeviceByName(id, service, subservice, function(error, ngsiDevice) {
if (error) {
callback(error);
} else {
async.waterfall([
async.apply(iotAgentLib.getDeviceByName, id),
async.apply(iotAgentLib.getDeviceByName, id, service, subservice),
async.apply(selectRealName, name),
lwm2mLib.getRegistry().getByName,
apply(updateDevice, ngsiDevice)
Expand All @@ -176,7 +177,7 @@ function ngsiUpdateHandler(id, type, attributes, callback) {

}

function ngsiExecuteHandler(id, type, attributes, callback) {
function ngsiExecuteHandler(id, type, service, subservice, attributes, callback) {
var name = id.substring(0, id.indexOf(':'));

logger.debug(context, 'Handling device command execution from the northbound for device [%s] of type [%s]',
Expand Down Expand Up @@ -215,7 +216,7 @@ function ngsiExecuteHandler(id, type, attributes, callback) {
);
}

iotAgentLib.getDeviceByName(id, function(error, ngsiDevice) {
iotAgentLib.getDeviceByName(id, service, subservice, function(error, ngsiDevice) {
if (error) {
callback(error);
} else {
Expand All @@ -237,7 +238,7 @@ function ngsiExecuteHandler(id, type, attributes, callback) {
* @param {String} type Type of the entity.
* @param {Array} attributes List of attributes to read.
*/
function ngsiQueryHandler(id, type, attributes, callback) {
function ngsiQueryHandler(id, type, service, subservice, attributes, callback) {
var name = id.substring(0, id.indexOf(':'));

logger.debug(context, 'Handling device data query from the northbound for device [%s] of type [%s]', id, type);
Expand Down Expand Up @@ -291,7 +292,7 @@ function ngsiQueryHandler(id, type, attributes, callback) {
name = id;
}

iotAgentLib.getDeviceByName(id, function(error, ngsiDevice) {
iotAgentLib.getDeviceByName(id, service, subservice, function(error, ngsiDevice) {
if (error) {
callback(error);
} else {
Expand Down
2 changes: 1 addition & 1 deletion lib/services/lwm2mHandlers/registration.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ function mapConfig(device, configuration, callback) {
subservice: configuration.subservice,
lazy: configuration.lazy,
attributes: configuration.attributes,
commands: configuration.commands,
internalId: device.id
};

Expand Down Expand Up @@ -271,7 +272,6 @@ function registrationHandler(endpoint, lifetime, version, binding, payload, call
logger.debug(context, 'Handling registration of the device');

function handleIncomingRegistrationRequest(error, lwm2mDevice, configuration) {

if (error) {
callback(error);
} else {
Expand Down
Loading