From 7fb3636b89242575885f39152264c31113e1aebc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferm=C3=ADn=20Gal=C3=A1n=20M=C3=A1rquez?= Date: Fri, 7 Jul 2023 11:46:00 +0200 Subject: [PATCH 1/7] REMOVE operations no longer supported by Orion in orionUrls.js --- lib/plugins/orionUrls.js | 62 ++++------------------------------------ 1 file changed, 5 insertions(+), 57 deletions(-) diff --git a/lib/plugins/orionUrls.js b/lib/plugins/orionUrls.js index f5a7caac..50ebf5e0 100644 --- a/lib/plugins/orionUrls.js +++ b/lib/plugins/orionUrls.js @@ -34,64 +34,12 @@ * this table will fail). */ module.exports = [ - /* Standard NGSI operations */ + /* Legacy NGSI operations (to be removed soon) */ + /* Note POST /(v1|ngsi10)/updateContext is not included here, as it is processed in an special way in orionPlugin.js */ ['POST', /\/(v1|ngsi10)\/querycontext$/, 'read'], - ['POST', /\/(v1|ngsi10)\/subscribecontext$/, 'subscribe'], - ['POST', /\/(v1|ngsi10)\/updatecontextsubscription$/, 'subscribe'], - ['POST', /\/(v1|ngsi10)\/unsubscribecontext$/, 'subscribe'], - ['POST', /\/(v1\/registry|ngsi9)\/registercontext$/, 'register'], - ['POST', /\/(v1\/registry|ngsi9)\/discovercontextavailability$/, 'discover'], - ['POST', /\/v1\/contexttypes$/, 'read'], - - - /* "Classic" NGSI9 operations */ - ['GET', /^\/(ngsi9|v1\/registry)\/contextentities\/.+\/attributes$/, 'N/A'], - ['POST', /^\/(ngsi9|v1\/registry)\/contextentities\/.+\/attributes$/, 'N/A'], - ['GET', /^\/(ngsi9|v1\/registry)\/contextentities\/.+\/attributes\/.+/, 'discover'], - ['POST', /^\/(ngsi9|v1\/registry)\/contextentities\/.+\/attributes\/.+/, 'register'], - ['GET', /^\/(ngsi9|v1\/registry)\/contextentities\/.+\/attributeDomains\/.+/, 'discover'], - ['POST', /^\/(ngsi9|v1\/registry)\/contextentities\/.+\/attributeDomains\/.+/, 'register'], - ['GET', /^\/(ngsi9|v1\/registry)\/contextentities\/.+/, 'discover'], - ['POST', /^\/(ngsi9|v1\/registry)\/contextentities\/.+/, 'register'], - ['GET', /^\/(ngsi9|v1\/registry)\/contextentitytypes\/.+\/attributes$/, 'N/A'], - ['POST', /^\/(ngsi9|v1\/registry)\/contextentitytypes\/.+\/attributes$/, 'N/A'], - ['GET', /^\/(ngsi9|v1\/registry)\/contextentitytypes\/.+\/attributes\/.+/, 'discover'], - ['POST', /^\/(ngsi9|v1\/registry)\/contextentitytypes\/.+\/attributes\/.+/, 'register'], - ['GET', /^\/(ngsi9|v1\/registry)\/contextentitytypes\/.+\/attributeDomains\/.+/, 'discover'], - ['POST', /^\/(ngsi9|v1\/registry)\/contextentitytypes\/.+\/attributeDomains\/.+/, 'register'], - ['GET', /^\/(ngsi9|v1\/registry)\/contextentitytypes\/.+/, 'discover'], - ['POST', /^\/(ngsi9|v1\/registry)\/contextentitytypes\/.+/, 'register'], - /* "Classic" NGSI10 operations */ - ['GET', /^\/(ngsi10|v1)\/contextentities\/.+\/attributes$/, 'N/A'], - ['PUT', /^\/(ngsi10|v1)\/contextentities\/.+\/attributes$/, 'N/A'], - ['POST', /^\/(ngsi10|v1)\/contextentities\/.+\/attributes$/, 'N/A'], - ['DELETE', /^\/(ngsi10|v1)\/contextentities\/.+\/attributes$/, 'N/A'], - ['GET', /^\/(ngsi10|v1)\/contextentities\/.+\/attributes\/.+/, 'read'], - ['POST', /^\/(ngsi10|v1)\/contextentities\/.+\/attributes\/.+/, 'create'], - ['PUT', /^\/(ngsi10|v1)\/contextentities\/.+\/attributes\/.+/, 'update'], - ['DELETE', /^\/(ngsi10|v1)\/contextentities\/.+\/attributes\/.+/, 'delete'], - ['GET', /^\/(ngsi10|v1)\/contextentities\/.+\/attributes\/.+\/.+/, 'read'], - ['PUT', /^\/(ngsi10|v1)\/contextentities\/.+\/attributes\/.+\/.+/, 'update'], - ['DELETE', /^\/(ngsi10|v1)\/contextentities\/.+\/attributes\/.+\/.+/, 'delete'], - ['GET', /^\/(ngsi10|v1)\/contextentities\/.+\/attributeDomains\/.+/, 'read'], - ['GET', /^\/(ngsi10|v1)\/contextentities\/.+/, 'read'], - ['PUT', /^\/(ngsi10|v1)\/contextentities\/.+/, 'update'], - ['POST', /^\/(ngsi10|v1)\/contextentities\/.+/, 'create'], - ['DELETE', /^\/(ngsi10|v1)\/contextentities\/.+/, 'delete'], - ['GET', /^\/(ngsi10|v1)\/contextentitytypes\/.+\/attributes$/, 'N/A'], - ['GET', /^\/(ngsi10|v1)\/contextentitytypes\/.+\/attributes\/.+/, 'read'], - ['GET', /^\/(ngsi10|v1)\/contextentitytypes\/.+/, 'read'], - ['GET', /^\/(ngsi10|v1)\/contextentitytypes\/.+\/attributeDomains\/.+/, 'read'], - ['POST', /^\/(ngsi10|v1)\/contextsubscriptions$/, 'subscribe'], - ['PUT', /^\/(ngsi10|v1)\/contextsubscriptions\/.+/, 'subscribe'], - ['DELETE', /^\/(ngsi10|v1)\/contextsubscriptions\/.+/, 'subscribe'], - /* New operations in v1/ (note that they don't use the "ngsi10" alternative in the pattern) */ - ['GET', /^\/v1\/contextentities/, 'read'], - ['POST', /^\/v1\/contextentities/, 'create'], - ['GET', /^\/v1\/contextsubscriptions/, 'read'], - ['GET', /^\/v1\/contextsubscriptions\/.+/, 'read'], - ['GET', /^\/v1\/contexttypes/, 'read'], - ['GET', /^\/v1\/contexttypes\/.+/, 'read'], + ['GET', /^\/v1\/contextentities\/.+\/attributes\/.+/, 'read'], + ['PUT', /^\/v1\/contextentities\/.+/, 'update'], + ['DELETE', /^\/v1\/contextentities\/.+/, 'delete'], /* V2 Operations */ ['POST', /^\/v2\/op\/query$/, 'read'], From 91934f858159cef99eb6c80b41648b94480973e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferm=C3=ADn=20Gal=C3=A1n=20M=C3=A1rquez?= Date: Fri, 7 Jul 2023 11:46:45 +0200 Subject: [PATCH 2/7] ADD entry to Changelog --- CHANGES_NEXT_RELEASE | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES_NEXT_RELEASE b/CHANGES_NEXT_RELEASE index adaaa526..4b5410e8 100644 --- a/CHANGES_NEXT_RELEASE +++ b/CHANGES_NEXT_RELEASE @@ -1 +1,2 @@ +- Remove: operations no longer supported in CB API (aligned with Orion 3.10.1) - Upgrade NodeJS version from 14-slim to 16-slim in Dockerfile From 0f6734fa61550f4c26f7755c7b3b7ce5bbef50f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferm=C3=ADn=20Gal=C3=A1n=20M=C3=A1rquez?= Date: Fri, 7 Jul 2023 11:49:41 +0200 Subject: [PATCH 3/7] FIX lint --- lib/plugins/orionUrls.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/plugins/orionUrls.js b/lib/plugins/orionUrls.js index 50ebf5e0..58e374ad 100644 --- a/lib/plugins/orionUrls.js +++ b/lib/plugins/orionUrls.js @@ -35,7 +35,8 @@ */ module.exports = [ /* Legacy NGSI operations (to be removed soon) */ - /* Note POST /(v1|ngsi10)/updateContext is not included here, as it is processed in an special way in orionPlugin.js */ + /* Note POST /(v1|ngsi10)/updateContext is not included here, + /* as it is processed in an special way in orionPlugin.js */ ['POST', /\/(v1|ngsi10)\/querycontext$/, 'read'], ['GET', /^\/v1\/contextentities\/.+\/attributes\/.+/, 'read'], ['PUT', /^\/v1\/contextentities\/.+/, 'update'], From 8eae40bde6059a8dd58cb6cfba9f131905c2ff4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferm=C3=ADn=20Gal=C3=A1n=20M=C3=A1rquez?= Date: Fri, 7 Jul 2023 11:54:02 +0200 Subject: [PATCH 4/7] REMOVE operations in extract_cb_convenience_test.js --- test/unit/extract_cb_convenience_test.js | 99 ------------------------ 1 file changed, 99 deletions(-) diff --git a/test/unit/extract_cb_convenience_test.js b/test/unit/extract_cb_convenience_test.js index f4ad2cbd..9b1db1d2 100644 --- a/test/unit/extract_cb_convenience_test.js +++ b/test/unit/extract_cb_convenience_test.js @@ -35,105 +35,6 @@ var serverMocks = require('../tools/serverMocks'), convenienceOperations; convenienceOperations = [ - /* "Classic" NGSI9 operations */ - ['GET', '/ngsi9/contextEntities/TestedEntityId001', 'discover'], - ['GET', '/ngsi9/contextEntities/type/TestedType01/id/TestedEntityId001', 'discover'], - ['POST', '/ngsi9/contextEntities/TestedEntityId001', 'register'], - ['POST', '/ngsi9/contextEntities/type/TestedType01/id/TestedEntityId001', 'register'], - ['GET', '/ngsi9/contextEntities/TestedEntityId001/attributes', 'N/A'], - ['GET', '/ngsi9/contextEntities/type/TestedType01/id/TestedEntityId001/attributes', 'N/A'], - ['POST', '/ngsi9/contextEntities/TestedEntityId001/attributes', 'N/A'], - ['POST', '/ngsi9/contextEntities/type/TestedType01/id/TestedEntityId001/attributes', 'N/A'], - ['GET', '/ngsi9/contextEntities/TestedEntityId001/attributes/TestedAttributeName001', 'discover'], - ['GET', '/ngsi9/contextEntities/type/TestedType01/id/TestedEntityId001/attributes/TestedAttributeName001', - 'discover'], - ['POST', '/ngsi9/contextEntities/TestedEntityId001/attributes/TestedAttributeName001', 'register'], - ['POST', '/ngsi9/contextEntities/type/TestedType01/id/TestedEntityId001/attributes/TestedAttributeName001', - 'register'], - ['GET', '/ngsi9/contextEntities/TestedEntityId001/attributeDomains/TestedDomainName001', 'discover'], - ['GET', '/ngsi9/contextEntities/type/TestedType01/id/TestedEntityId001/attributeDomains/TestedDomainName001', - 'discover'], - ['POST', '/ngsi9/contextEntities/TestedEntityId001/attributeDomains/TestedDomainName001', 'register'], - ['POST', '/ngsi9/contextEntities/type/TestedType01/id/TestedEntityId001/attributeDomains/TestedDomainName001', - 'register'], - ['GET', '/ngsi9/contextEntityTypes/TestedTypeName001', 'discover'], - ['POST', '/ngsi9/contextEntityTypes/TestedTypeName001', 'register'], - ['GET', '/ngsi9/contextEntityTypes/TestedTypeName001/attributes', 'N/A'], - ['POST', '/ngsi9/contextEntityTypes/TestedTypeName001/attributes', 'N/A'], - ['GET', '/ngsi9/contextEntityTypes/TestedTypeName001/attributes/TestedAttributeName001', 'discover'], - ['POST', '/ngsi9/contextEntityTypes/TestedTypeName001/attributes/TestedAttributeName001', 'register'], - ['GET', '/ngsi9/contextEntityTypes/TestedTypeName001/attributeDomains/TestedDomainName001', 'discover'], - ['POST', '/ngsi9/contextEntityTypes/TestedTypeName001/attributeDomains/TestedDomainName001', 'register'], - - /* "Classic" NGSI10 operations */ - ['GET', '/ngsi10/contextEntities/TestedEntityId002', 'read'], - ['GET', '/ngsi10/contextEntities/type/TestedType01/id/TestedEntityId002', 'read'], - ['PUT', '/ngsi10/contextEntities/TestedEntityId002', 'update'], - ['PUT', '/ngsi10/contextEntities/type/TestedType01/id/TestedEntityId002', 'update'], - ['POST', '/ngsi10/contextEntities/TestedEntityId002', 'create'], - ['POST', '/ngsi10/contextEntities/type/TestedType01/id/TestedEntityId002', 'create'], - ['DELETE', '/ngsi10/contextEntities/TestedEntityId002', 'delete'], - ['DELETE', '/ngsi10/contextEntities/type/TestedType01/id/TestedEntityId002', 'delete'], - ['GET', '/ngsi10/contextEntities/TestedEntityId002/attributes', 'N/A'], - ['GET', '/ngsi10/contextEntities/type/TestedType01/id/TestedEntityId002/attributes', 'N/A'], - ['PUT', '/ngsi10/contextEntities/TestedEntityId002/attributes', 'N/A'], - ['PUT', '/ngsi10/contextEntities/type/TestedType01/id/TestedEntityId002/attributes', 'N/A'], - ['POST', '/ngsi10/contextEntities/TestedEntityId002/attributes', 'N/A'], - ['POST', '/ngsi10/contextEntities/type/TestedType01/id/TestedEntityId002/attributes', 'N/A'], - ['DELETE', '/ngsi10/contextEntities/TestedEntityId002/attributes', 'N/A'], - ['DELETE', '/ngsi10/contextEntities/type/TestedType01/id/TestedEntityId002/attributes', 'N/A'], - ['GET', '/ngsi10/contextEntities/TestedEntityId002/attributes/TestedAttributeName001', 'read'], - ['GET', '/ngsi10/contextEntities/type/TestedType01/id/TestedEntityId002/attributes/TestedAttributeName001', - 'read'], - ['POST', '/ngsi10/contextEntities/TestedEntityId002/attributes/TestedAttributeName001', 'create'], - ['POST', '/ngsi10/contextEntities/type/TestedType01/id/TestedEntityId002/attributes/TestedAttributeName001', - 'create'], - ['PUT', '/ngsi10/contextEntities/TestedEntityId002/attributes/TestedAttributeName001', 'update'], - ['PUT', '/ngsi10/contextEntities/type/TestedType01/id/TestedEntityId002/attributes/TestedAttributeName001', - 'update'], - ['DELETE', '/ngsi10/contextEntities/TestedEntityId002/attributes/TestedAttributeName001', 'delete'], - ['DELETE', '/ngsi10/contextEntities/type/TestedType01/id/TestedEntityId002/attributes/TestedAttributeName001', - 'delete'], - ['GET', '/ngsi10/contextEntities/TestedEntityId002/attributes/TestedAttributeName001/TestedValueID001', 'read'], - ['GET', '/ngsi10/contextEntities/type/TestedType01/id/TestedEntityId002/attributes/TestedAttributeName001' + - '/TestedValueID001', 'read'], - ['PUT', '/ngsi10/contextEntities/TestedEntityId002/attributes/TestedAttributeName001/TestedValueID001', 'update'], - ['PUT', '/ngsi10/contextEntities/type/TestedType01/id/TestedEntityId002/attributes/TestedAttributeName001' + - '/TestedValueID001', 'update'], - ['DELETE', '/ngsi10/contextEntities/TestedEntityId002/attributes/TestedAttributeName001/TestedValueID001', - 'delete'], - ['DELETE', '/ngsi10/contextEntities/type/TestedType01/id/TestedEntityId002/attributes/TestedAttributeName001' + - '/TestedValueID001', 'delete'], - ['GET', '/ngsi10/contextEntities/TestedEntityId002/attributeDomains/TestedDomainName001', 'read'], - ['GET', '/ngsi10/contextEntities/type/TestedType01/id/TestedEntityId002/attributeDomains/TestedDomainName001', - 'read'], - ['GET', '/ngsi10/contextEntityTypes/TestedTypeName001', 'read'], - ['GET', '/v1/contextEntities/{EntityID}', 'read'], - ['GET', '/ngsi10/contextEntityTypes/TestedTypeName001/attributes', 'N/A'], - ['GET', '/ngsi10/contextEntityTypes/TestedTypeName001/attributes/TestedAttributeName001', 'read'], - ['GET', '/ngsi10/contextEntityTypes/TestedTypeName001/attributeDomains/TestedDomainName001', 'read'], - ['POST', '/ngsi10/contextSubscriptions', 'subscribe'], - ['PUT', '/ngsi10/contextSubscriptions/TestedSubscriptionID001', 'subscribe'], - ['DELETE', '/ngsi10/contextSubscriptions/TestedSubscriptionID001', 'subscribe'], - - /* Testing a subset of "classic" operations in v1/ prefix (we don't need to be exahustive) */ - ['PUT', '/v1/contextSubscriptions/TestedSubscriptionID001', 'subscribe'], - ['DELETE', '/v1/contextSubscriptions/TestedSubscriptionID001', 'subscribe'], - ['PUT', '/v1/contextSubscriptions/TestedSubscriptionID001', 'subscribe'], - ['GET', '/v1/registry/contextEntityTypes/TestedTypeName001', 'discover'], - ['POST', '/v1/registry/contextEntityTypes/TestedTypeName001', 'register'], - - /* New operations in v1/ */ - ['GET', '/v1/contextEntities', 'read'], - ['POST', '/v1/contextEntities', 'create'], - ['GET', '/v1/contextSubscriptions', 'read'], - ['GET', '/v1/contextSubscriptions/sub001', 'read'], - ['GET', '/v1/contextTypes', 'read'], - ['GET', '/v1/contextTypes/typeOfEntity001', 'read'], - - /* NGSI Operations with query params */ - ['GET', '/v1/contextSubscriptions?details=on&limit=15&offset=0', 'read'], - /* V2 Operations */ ['GET', '/v2', 'read'], ['GET', '/v2/entities', 'read'], From 6374d857ec026ffba8e8f6315577eb7501e2f98d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferm=C3=ADn=20Gal=C3=A1n=20M=C3=A1rquez?= Date: Fri, 7 Jul 2023 11:56:00 +0200 Subject: [PATCH 5/7] REMOVE operations and XML cases in extract_csb_actions_test.js --- test/unit/extract_csb_actions_test.js | 183 -------------------------- 1 file changed, 183 deletions(-) diff --git a/test/unit/extract_csb_actions_test.js b/test/unit/extract_csb_actions_test.js index 561e35fa..3907a422 100644 --- a/test/unit/extract_csb_actions_test.js +++ b/test/unit/extract_csb_actions_test.js @@ -111,11 +111,6 @@ describe('Extract Context Broker action from request', function() { var standardOperation = [ ['/NGSI10/queryContext', 'read'], - ['/ngsi10/subscribeContext', 'subscribe'], - ['/ngsi10/updateContextSubscription', 'subscribe'], - ['/ngsi10/unsubscribeContext', 'subscribe'], - ['/ngsi9/registerContext', 'register'], - ['/ngsi9/discoverContextAvailability', 'discover'], ['/v2/op/query', 'read'], ['/v1/queryContext', 'read'], ['/v1/contextTypes', 'read'], @@ -255,67 +250,6 @@ describe('Extract Context Broker action from request', function() { it('should add the action attribute with value "delete" to the request', testAction('delete', options)); }); - describe('When a create action arrives with XML payload', function() { - var options = { - uri: 'http://localhost:' + config.resource.proxy.port + '/NGSI10/updateContext', - method: 'POST', - headers: { - 'Content-Type': 'application/xml', - 'Accept': 'application/xml', - 'fiware-service': 'SmartValencia', - 'fiware-servicepath': 'Electricidad', - 'X-Auth-Token': 'UAidNA9uQJiIVYSCg0IQ8Q' - }, - body: utils.readExampleFile('./test/orionRequests/entityCreation.xml', true) - }; - - beforeEach(function(done) { - serverMocks.mockPath('/NGSI10/queryContext', mockApp, done); - }); - - it('should add the action attribute with value "create" to the request', testAction('create', options)); - }); - - describe('When a update action arrives with XML payload', function() { - var options = { - uri: 'http://localhost:' + config.resource.proxy.port + '/NGSI10/updateContext', - method: 'POST', - headers: { - 'Content-Type': 'application/xml', - 'Accept': 'application/xml', - 'fiware-service': 'SmartValencia', - 'fiware-servicepath': 'Electricidad', - 'X-Auth-Token': 'UAidNA9uQJiIVYSCg0IQ8Q' - }, - body: utils.readExampleFile('./test/orionRequests/entityUpdate.xml', true) - }; - - beforeEach(function(done) { - serverMocks.mockPath('/NGSI10/queryContext', mockApp, done); - }); - - it('should add the action attribute with value "update" to the request', testAction('update', options)); - }); - describe('When a delete action arrives with XML payload', function() { - var options = { - uri: 'http://localhost:' + config.resource.proxy.port + '/NGSI10/updateContext', - method: 'POST', - headers: { - 'Content-Type': 'application/xml', - 'Accept': 'application/xml', - 'fiware-service': 'SmartValencia', - 'fiware-servicepath': 'Electricidad', - 'X-Auth-Token': 'UAidNA9uQJiIVYSCg0IQ8Q' - }, - body: utils.readExampleFile('./test/orionRequests/entityDelete.xml', true) - }; - - beforeEach(function(done) { - serverMocks.mockPath('/NGSI10/queryContext', mockApp, done); - }); - - it('should add the action attribute with value "delete" to the request', testAction('delete', options)); - }); describe('When a update action arrives with JSON payload without the \'updateAction\' attribute', function() { var options = { @@ -344,32 +278,6 @@ describe('Extract Context Broker action from request', function() { }); }); - describe('When a update action arrives with XML payload without the \'updateAction\' attribute', function() { - var options = { - uri: 'http://localhost:' + config.resource.proxy.port + '/NGSI10/updateContext', - method: 'POST', - headers: { - 'Content-Type': 'application/xml', - 'Accept': 'application/xml', - 'fiware-service': 'SmartValencia', - 'fiware-servicepath': 'Electricidad', - 'X-Auth-Token': 'UAidNA9uQJiIVYSCg0IQ8Q' - }, - body: utils.readExampleFile('./test/orionErrorRequests/entityUpdateNoAttribute.xml', true) - }; - - beforeEach(function(done) { - serverMocks.mockPath('/NGSI10/queryContext', mockApp, done); - }); - - it('should reject the request with an Unauthorized code', function(done) { - request(options, function(error, response, body) { - response.statusCode.should.equal(400); - done(); - }); - }); - }); - describe('When a update action arrives with a URL that it\'s not recognized by the system', function() { var options = { uri: 'http://localhost:' + config.resource.proxy.port + '/NGSI10/falsePath', @@ -421,31 +329,6 @@ describe('Extract Context Broker action from request', function() { }); }); }); - describe('When an update action comes with an unknown action in an XML format', function() { - var options = { - uri: 'http://localhost:' + config.resource.proxy.port + '/NGSI10/updateContext', - method: 'POST', - headers: { - 'Content-Type': 'application/xml', - 'Accept': 'application/xml', - 'fiware-service': 'SmartValencia', - 'fiware-servicepath': 'Electricidad', - 'X-Auth-Token': 'UAidNA9uQJiIVYSCg0IQ8Q' - }, - body: utils.readExampleFile('./test/orionErrorRequests/entityUnknownOperation.xml', true) - }; - - beforeEach(function(done) { - serverMocks.mockPath('/NGSI10/queryContext', mockApp, done); - }); - - it('should reject the request with a 400', function(done) { - request(options, function(error, response, body) { - response.statusCode.should.equal(400); - done(); - }); - }); - }); describe('When a request arrives with an unknown body type', function() { var options = { @@ -473,32 +356,6 @@ describe('Extract Context Broker action from request', function() { }); }); - describe('When a request arrives with an XML body with a wrong syntax', function() { - var options = { - uri: 'http://localhost:' + config.resource.proxy.port + '/NGSI10/updateContext', - method: 'POST', - headers: { - 'Content-Type': 'application/xml', - 'Accept': 'application/xml', - 'fiware-service': 'SmartValencia', - 'fiware-servicepath': 'Electricidad', - 'X-Auth-Token': 'UAidNA9uQJiIVYSCg0IQ8Q' - }, - body: utils.readExampleFile('./test/orionErrorRequests/entitySyntaxError.xml', true) - }; - - beforeEach(function(done) { - serverMocks.mockPath('/NGSI10/queryContext', mockApp, done); - }); - - it('should reject the request with a 400 error', function(done) { - request(options, function(error, response, body) { - response.statusCode.should.equal(400); - done(); - }); - }); - }); - describe('When a request arrives with a JSON body with a wrong syntax', function() { var options = { uri: 'http://localhost:' + config.resource.proxy.port + '/NGSI10/updateContext', @@ -525,46 +382,6 @@ describe('Extract Context Broker action from request', function() { }); }); - describe('When a request arrives with a valid XML payload to the proxy', function() { - var options = { - uri: 'http://localhost:' + config.resource.proxy.port + '/NGSI10/updateContext', - method: 'POST', - headers: { - 'Content-Type': 'application/xml', - 'Accept': 'application/xml', - 'fiware-service': 'SmartValencia', - 'fiware-servicepath': 'Electricidad', - 'X-Auth-Token': 'UAidNA9uQJiIVYSCg0IQ8Q' - }, - body: utils.readExampleFile('./test/orionRequests/entityUpdate.xml', true) - }; - - beforeEach(function(done) { - async.series([ - async.apply(serverMocks.mockPath, '/v3/role_assignments', mockOAuthApp), - async.apply(serverMocks.mockPath, '/v3/auth/tokens', mockOAuthApp), - async.apply(serverMocks.mockPath, '/v3/projects', mockOAuthApp), - async.apply(serverMocks.mockPath, '/pdp/v3', mockAccessApp), - async.apply(serverMocks.mockPath, '/NGSI10/updateContext', mockApp) - ], done); - }); - - it('should proxy the request to the target URL', function(done) { - var mockExecuted = false; - - mockApp.handler = function(req, res) { - req.rawBody.replace(/\n/g, '').should.match(/.*<\/updateContextRequest>/); - mockExecuted = true; - res.status(200).json({}); - }; - - request(options, function(error, response, body) { - mockExecuted.should.equal(true); - done(); - }); - }); - }); - describe('When a request arrives with a valid JSON payload to the proxy', function() { var options = { uri: 'http://localhost:' + config.resource.proxy.port + '/NGSI10/updateContext', From 4d6ce0a91ca0265621cccc8963bbfc409f46c337 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferm=C3=ADn=20Gal=C3=A1n=20M=C3=A1rquez?= Date: Fri, 7 Jul 2023 11:59:30 +0200 Subject: [PATCH 6/7] FIX remove operations in extract_csb_actions_test.js --- test/unit/extract_csb_actions_test.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/test/unit/extract_csb_actions_test.js b/test/unit/extract_csb_actions_test.js index 3907a422..e0ee79c5 100644 --- a/test/unit/extract_csb_actions_test.js +++ b/test/unit/extract_csb_actions_test.js @@ -112,13 +112,7 @@ describe('Extract Context Broker action from request', function() { var standardOperation = [ ['/NGSI10/queryContext', 'read'], ['/v2/op/query', 'read'], - ['/v1/queryContext', 'read'], - ['/v1/contextTypes', 'read'], - ['/v1/subscribeContext', 'subscribe'], - ['/v1/updateContextSubscription', 'subscribe'], - ['/v1/unsubscribeContext', 'subscribe'], - ['/v1/registry/registerContext', 'register'], - ['/v1/registry/discoverContextAvailability', 'discover'] + ['/v1/queryContext', 'read'] ]; function testStandardOperation(url, action) { From 464e9ec07e1e6e1410d2dcb168c64a722593449e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferm=C3=ADn=20Gal=C3=A1n=20M=C3=A1rquez?= Date: Fri, 7 Jul 2023 12:08:46 +0200 Subject: [PATCH 7/7] FIX op in querystring_test.js --- test/unit/querystring_test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/unit/querystring_test.js b/test/unit/querystring_test.js index dc2712fe..76f33edf 100644 --- a/test/unit/querystring_test.js +++ b/test/unit/querystring_test.js @@ -94,7 +94,7 @@ describe('Proxy querystring behavior', function() { describe('When a request to the CB arrives to the proxy with a querystring', function() { var options = { - uri: 'http://localhost:' + config.resource.proxy.port + '/v1/contextEntities', + uri: 'http://localhost:' + config.resource.proxy.port + '/v2/entities', method: 'GET', headers: { 'Accept': 'application/json', @@ -112,7 +112,7 @@ describe('Proxy querystring behavior', function() { beforeEach(function(done) { async.series([ async.apply(serverMocks.mockPath, '/pdp/v3', mockAccessApp), - async.apply(serverMocks.mockPath, '/v1/contextentities', mockTargetApp) + async.apply(serverMocks.mockPath, '/v2/entities', mockTargetApp) ], done); });