Skip to content

Commit

Permalink
Remove CB insert of initial device on provisioning command
Browse files Browse the repository at this point in the history
  • Loading branch information
jason-fox committed Sep 20, 2023
1 parent 2a8cdf7 commit 7f97fae
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 56 deletions.
4 changes: 0 additions & 4 deletions test/unit/ngsi-ld/lazyAndCommands/merge-patch-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,6 @@ describe('NGSI-LD - Merge-Patch functionalities', function () {
let handlerCalled = 0;

iotAgentLib.setMergePatchHandler(function (id, type, service, subservice, attributes, callback) {
console.error('======');
console.error(id, type, service, subservice, attributes, callback);
console.error('======');

id.should.equal('urn:ngsi-ld:' + device3.type + ':' + device3.id);
type.should.equal(device3.type);
attributes[0].name.should.equal('position');
Expand Down
11 changes: 1 addition & 10 deletions test/unit/ngsi-ld/provisioning/device-registration_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,19 +109,10 @@ describe('NGSI-LD - IoT Agent Device Registration', function () {
describe('When a new device is connected to the IoT Agent', function () {
beforeEach(function (done) {
nock.cleanAll();

// This mock does not check the payload since the aim of the test is not to verify
// device provisioning functionality. Appropriate verification is done in tests under
// provisioning folder
contextBrokerMock = nock('http://192.168.1.1:1026')
.matchHeader('fiware-service', 'smartgondor')
.post('/ngsi-ld/v1/entityOperations/upsert/')
.reply(204);

const nockBody = utils.readExampleFile(
'./test/unit/ngsi-ld/examples/contextAvailabilityRequests/registerIoTAgent1.json'
);
contextBrokerMock
contextBrokerMock = nock('http://192.168.1.1:1026')
.matchHeader('fiware-service', 'smartgondor')
.post('/ngsi-ld/v1/csourceRegistrations/', nockBody)
.reply(201, null, { Location: '/ngsi-ld/v1/csourceRegistrations/6319a7f5254b05844116584d' });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,6 @@ describe('NGSI-LD - IoT Agent Device Update Registration', function () {
.post('/ngsi-ld/v1/csourceRegistrations/')
.reply(201, null, { Location: '/ngsi-ld/v1/csourceRegistrations/6319a7f5254b05844116584d' });

// This mock does not check the payload since the aim of the test is not to verify
// device provisioning functionality. Appropriate verification is done in tests under
// provisioning folder
contextBrokerMock
.matchHeader('fiware-service', 'smartgondor')
.post('/ngsi-ld/v1/entityOperations/upsert/')
.reply(204);

iotAgentLib.activate(iotAgentConfig, function (error) {
iotAgentLib.register(device1, function (error) {
done();
Expand Down
34 changes: 0 additions & 34 deletions test/unit/ngsi-ld/provisioning/singleConfigurationMode-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,6 @@ describe('NGSI-LD - Provisioning API: Single service mode', function () {
.post('/ngsi-ld/v1/csourceRegistrations/')
.reply(201, null, { Location: '/ngsi-ld/v1/csourceRegistrations/6319a7f5254b05844116584d' });

// This mock does not check the payload since the aim of the test is not to verify
// device provisioning functionality. Appropriate verification is done in tests under
// provisioning folder
contextBrokerMock
.matchHeader('fiware-service', 'testservice')
.post('/ngsi-ld/v1/entityOperations/upsert/')
.reply(204);

request(groupCreation, function (error) {
request(deviceCreation, function (error, response, body) {
done();
Expand Down Expand Up @@ -183,27 +175,11 @@ describe('NGSI-LD - Provisioning API: Single service mode', function () {
.post('/ngsi-ld/v1/csourceRegistrations/')
.reply(201, null, { Location: '/ngsi-ld/v1/csourceRegistrations/6319a7f5254b05844116584d' });

// This mock does not check the payload since the aim of the test is not to verify
// device provisioning functionality. Appropriate verification is done in tests under
// provisioning folder
contextBrokerMock
.matchHeader('fiware-service', 'testservice')
.post('/ngsi-ld/v1/entityOperations/upsert/')
.reply(204);

contextBrokerMock = nock('http://192.168.1.1:1026')
.matchHeader('fiware-service', 'AlternateService')
.post('/ngsi-ld/v1/csourceRegistrations/')
.reply(201, null, { Location: '/ngsi-ld/v1/csourceRegistrations/6319a7f5254b05844116584d' });

// This mock does not check the payload since the aim of the test is not to verify
// device provisioning functionality. Appropriate verification is done in tests under
// provisioning folder
contextBrokerMock
.matchHeader('fiware-service', 'AlternateService')
.post('/ngsi-ld/v1/entityOperations/upsert/')
.reply(204);

request(groupCreation, function (error) {
request(deviceCreation, function (error, response, body) {
request(alternativeGroupCreation, function (error, response, body) {
Expand Down Expand Up @@ -280,16 +256,6 @@ describe('NGSI-LD - Provisioning API: Single service mode', function () {
)
.reply(201, null, { Location: '/ngsi-ld/v1/csourceRegistrations/6319a7f5254b05844116584d' });

contextBrokerMock
.matchHeader('fiware-service', 'testservice')
.post(
'/ngsi-ld/v1/entityOperations/upsert/',
utils.readExampleFile(
'./test/unit/ngsi-ld/examples/contextRequests/createProvisionedDeviceWithGroupAndStatic.json'
)
)
.reply(204);

request(groupCreation, done);
});

Expand Down

0 comments on commit 7f97fae

Please sign in to comment.