diff --git a/server/applicationPattern/applicationPattern/onfModel/services/LogicalTerminationPointServices.test.js b/server/applicationPattern/applicationPattern/onfModel/services/LogicalTerminationPointServices.test.js index 5a1dd22e..8d72acbe 100644 --- a/server/applicationPattern/applicationPattern/onfModel/services/LogicalTerminationPointServices.test.js +++ b/server/applicationPattern/applicationPattern/onfModel/services/LogicalTerminationPointServices.test.js @@ -9,11 +9,13 @@ const ForwardingConstruct = require('../models/ForwardingConstruct'); const TcpClientInterface = require('../models/layerProtocols/TcpClientInterface'); const OperationClientInterface = require("../models/layerProtocols/OperationClientInterface"); const HttpClientInterface = require("../models/layerProtocols/HttpClientInterface"); +const fileOperation = require('../../databaseDriver/JSONDriver'); jest.mock('../models/ControlConstruct'); jest.mock('../models/LogicalTerminationPoint'); jest.mock('../models/ForwardingDomain'); jest.mock('../models/ForwardingConstruct'); +jest.mock('../../databaseDriver/JSONDriver'); const fc = { "uuid": "ol-2-0-1-op-fc-bm-010", @@ -130,6 +132,7 @@ const individualServicesOperationsMapping = beforeEach(() => { jest.spyOn(ControlConstruct, 'getUuidAsync').mockReturnValue('ol-2-0-1'); jest.spyOn(ControlConstruct, 'addLogicalTerminationPointAsync').mockReturnValue(true); + jest.spyOn(fileOperation, 'writeToDatabaseAsync').mockImplementation(() => true); }); describe("createOrUpdateApplicationLtpsAsync", () => { diff --git a/server/applicationPattern/applicationPattern/services/AuthorizingService.test.js b/server/applicationPattern/applicationPattern/services/AuthorizingService.test.js index 1a030a80..873f673e 100644 --- a/server/applicationPattern/applicationPattern/services/AuthorizingService.test.js +++ b/server/applicationPattern/applicationPattern/services/AuthorizingService.test.js @@ -31,7 +31,7 @@ let httpRequestHeader = { "customer-journey": "unknown", "operation-key": "Not yet defined.", "originator": "RegistryOffice", - "trace-indicator": 1, + "trace-indicator": "1", "user": "dana" }; @@ -57,7 +57,8 @@ test("isAuthorized -- response true", async () => { "ol-2-0-1-op-c-bm-alt-1-0-0-005", "POST", expect.objectContaining(httpRequestHeader), - expect.objectContaining(httpRequestBody) + expect.objectContaining(httpRequestBody), + undefined ); expect(res).toStrictEqual({"isAuthorized": true}); }); @@ -87,7 +88,8 @@ test("isAuthorized -- authorization error", async () => { "ol-2-0-1-op-c-bm-alt-1-0-0-005", "POST", expect.objectContaining(httpRequestHeader), - expect.objectContaining(httpRequestBody) + expect.objectContaining(httpRequestBody), + undefined ); expect(res).toStrictEqual({"isAuthorized": false}); }); diff --git a/server/applicationPattern/applicationPattern/services/ExecutionAndTraceService.test.js b/server/applicationPattern/applicationPattern/services/ExecutionAndTraceService.test.js index 1bc597b9..7b0d1ff4 100644 --- a/server/applicationPattern/applicationPattern/services/ExecutionAndTraceService.test.js +++ b/server/applicationPattern/applicationPattern/services/ExecutionAndTraceService.test.js @@ -28,7 +28,7 @@ let httpRequestHeader = { "customer-journey": "unknown", "operation-key": "Not yet defined.", "originator": "RegistryOffice", - "trace-indicator": 1, + "trace-indicator": "1", "user": "dana" }; @@ -61,7 +61,7 @@ test("recordServiceRequest -- response true, detailedLogging false", async () => "ol-2-0-1-op-c-bm-alt-1-0-0-005", "POST", expect.objectContaining(httpRequestHeader), - httpRequestBody + expect.objectContaining(httpRequestBody) ); expect(res).toBeTruthy(); }); @@ -119,7 +119,7 @@ test("recordServiceRequestFromClient -- response true, detailedLogging false", a "ol-2-0-1-op-c-bm-alt-1-0-0-005", "POST", expect.objectContaining(httpRequestHeader), - httpRequestBody + expect.objectContaining(httpRequestBody) ); expect(res).toBeTruthy(); }); diff --git a/server/applicationPattern/applicationPattern/services/OamLogService.test.js b/server/applicationPattern/applicationPattern/services/OamLogService.test.js index 83637a0d..7345483b 100644 --- a/server/applicationPattern/applicationPattern/services/OamLogService.test.js +++ b/server/applicationPattern/applicationPattern/services/OamLogService.test.js @@ -4,6 +4,7 @@ const HttpServerInterface = require('../onfModel/models/layerProtocols/HttpServe const RequestBuilder = require('../rest/client/RequestBuilder'); const ForwardingDomain = require('../onfModel/models/ForwardingDomain'); + jest.mock('../onfModel/models/ForwardingDomain'); jest.mock('../onfModel/models/layerProtocols/OperationClientInterface'); jest.mock('../onfModel/models/layerProtocols/HttpServerInterface'); @@ -42,8 +43,9 @@ test("recordOamRequest -- response true", async () => { "customer-journey": "unknown", "operation-key": "Not yet defined.", "originator": "RegistryOffice", - "trace-indicator": 1, - "user": "dana" + "trace-indicator": "1", + "user": "dana", + "x-correlator": expect.any(String) }; let httpRequestBody = { "application-name": "RegistryOffice", @@ -52,11 +54,12 @@ test("recordOamRequest -- response true", async () => { "resource": "{ testbody: foo }", "response-code": "200", "stringified-body": "{}", - "user-name": "dana", + "timestamp": expect.any(String), + "user-name": "dana" }; expect(RequestBuilder.BuildAndTriggerRestRequest).toHaveBeenCalledWith( "ol-2-0-1-op-c-bm-alt-1-0-0-005", - "POST", + "POST", expect.objectContaining(httpRequestHeader), expect.objectContaining(httpRequestBody) ); diff --git a/server/applicationPattern/package-lock.json b/server/applicationPattern/package-lock.json index 269f88d4..d182e574 100644 --- a/server/applicationPattern/package-lock.json +++ b/server/applicationPattern/package-lock.json @@ -1,12 +1,12 @@ { "name": "onf-core-model-ap", - "version": "2.0.2-alpha.1", + "version": "2.1.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "onf-core-model-ap", - "version": "2.0.2-alpha.1", + "version": "2.1.1", "license": "Apache-2.0", "dependencies": { "@elastic/elasticsearch": "~7.17.0", diff --git a/server/applicationPattern/package.json b/server/applicationPattern/package.json index 5a04e07a..bac3ea5d 100644 --- a/server/applicationPattern/package.json +++ b/server/applicationPattern/package.json @@ -1,6 +1,6 @@ { "name": "onf-core-model-ap", - "version": "2.1.1-beta.1", + "version": "2.1.1", "description": "onf core model application pattern", "main": "index.js", "scripts": { diff --git a/server/basicServices/basicServices/BasicServicesService.js b/server/basicServices/basicServices/BasicServicesService.js index 14a833d8..c6585a94 100644 --- a/server/basicServices/basicServices/BasicServicesService.js +++ b/server/basicServices/basicServices/BasicServicesService.js @@ -228,17 +228,17 @@ exports.embedYourself = async function (body, user, xCorrelator, traceIndicator, let oldReleaseAddress = body["old-release-address"]; let oldReleaseProtocol = body["old-release-protocol"]; let oldReleasePort = body["old-release-port"]; - if (JSON.stringify(oldReleaseAddress) != JSON.stringify(existingpreceedingApplicationAddress)) { + if (oldReleaseAddress!=undefined && JSON.stringify(oldReleaseAddress) != JSON.stringify(existingpreceedingApplicationAddress)) { isORAddressUpdated = await tcpClientInterface.setRemoteAddressAsync( preceedingApplicationClientUuidStack.tcpClientUuid, oldReleaseAddress); } - if (oldReleasePort != existingpreceedingApplicationPort) { + if (oldReleasePort!=undefined && oldReleasePort != existingpreceedingApplicationPort) { isORPortUpdated = await tcpClientInterface.setRemotePortAsync( preceedingApplicationClientUuidStack.tcpClientUuid, oldReleasePort); } - if (oldReleaseProtocol != existingpreceedingApplicationProtocol) { + if (oldReleaseProtocol!=undefined && oldReleaseProtocol != existingpreceedingApplicationProtocol) { isORProtocolUpdated = await tcpClientInterface.setRemoteProtocolAsync( preceedingApplicationClientUuidStack.tcpClientUuid, oldReleaseProtocol); @@ -1404,7 +1404,7 @@ async function processInvariantSubscription(subscribingApplicationName, subscrib let forwardingAutomationInputList = await prepareForwardingAutomation.updateLtpToALT( ltpConfigurationList ); - ForwardingAutomationService.automateForwardingConstructAsync( + await ForwardingAutomationService.automateForwardingConstructAsync( operationServerName, forwardingAutomationInputList, user, diff --git a/server/basicServices/package.json b/server/basicServices/package.json index 258c0078..fabbd4ee 100644 --- a/server/basicServices/package.json +++ b/server/basicServices/package.json @@ -1,6 +1,6 @@ { "name": "onf-core-model-ap-bs", - "version": "2.1.1-beta.1", + "version": "2.1.1", "description": "onf core model application pattern", "main": "index.js", "scripts": { @@ -14,7 +14,7 @@ "js-yaml": "^3.3.0", "moment": "^2.29.1", "node-statsd": "^0.1.1", - "onf-core-model-ap": "2.1.1-beta.1", + "onf-core-model-ap": "2.1.1", "openbackhaul-oas3-tools": "2.3.1-alpha.3", "randexp": "^0.5.3", "response-time": "^2.3.2"