How to use startWda method in Appium Xcuitest Driver

Best JavaScript code snippet using appium-xcuitest-driver

ClientSideTargetResolution.qunit.js

Source:ClientSideTargetResolution.qunit.js Github

copy

Full Screen

1/​/​ Copyright (c) 2009-2017 SAP SE, All Rights Reserved2/​**3 * @fileOverview QUnit tests for sap.ushell.services.ClientSideTargetResolution4 */​5sap.ui.require([6 "sap/​ushell/​services/​ClientSideTargetResolution",7 "sap/​ushell/​services/​_ClientSideTargetResolution/​InboundIndex",8 "sap/​ushell/​services/​_ClientSideTargetResolution/​InboundProvider",9 "sap/​ushell/​services/​_ClientSideTargetResolution/​VirtualInbounds",10 "sap/​ushell/​services/​_ClientSideTargetResolution/​Search",11 "sap/​ushell/​services/​_ClientSideTargetResolution/​Utils",12 "sap/​ushell/​services/​AppConfiguration",13 "sap/​ushell/​test/​utils",14 "sap/​ushell/​utils",15 "sap/​ushell/​services/​URLParsing",16 "sap/​ui/​thirdparty/​URI",17 "sap/​base/​util/​ObjectPath",18 "sap/​ushell/​TechnicalParameters",19 "sap/​ushell/​test/​services/​_ClientSideTargetResolution/​ClientSideTargetResolution.resolveHashFragment",20 "sap/​ushell/​test/​services/​_ClientSideTargetResolution/​TestHelper"21], function (22 ClientSideTargetResolution,23 oInboundIndex,24 InboundProvider,25 VirtualInbounds,26 oSearch,27 oCSTRUtils,28 oAppConfiguration,29 testUtils,30 utils,31 URLParsing,32 URI,33 ObjectPath,34 TechnicalParameters,35 fnExecuteResolveHashFragment,36 oTestHelper37) {38 "use strict";39 /​* global QUnit, module, test, ok, equal, deepEqual, strictEqual, sinon, asyncTest, start */​40 var oURLParsing = new URLParsing();41 var mkInt = function (sIntent) {42 return oURLParsing.parseShellHash(sIntent);43 };44 jQuery.sap.require("sap.ushell.services.Container");45 /​*eslint max-nested-callbacks: [1, 4]*/​46 /​/​ lookup of all count parameters47 var O_COUNT_PARAMETERS = {48 "countDefaultedParams": true,49 "countFreeInboundParams": true,50 "countMatchingFilterParams": true,51 "countMatchingParams": true,52 "countMatchingRequiredParams": true,53 "countPotentiallyMatchingParams": true54 },55 I_DEBUG = jQuery.sap.log.Level.DEBUG,56 I_TRACE = jQuery.sap.log.Level.TRACE;57 /​*58 * Checks whether the expected warnings and errors were logged on the59 * console, taking the expectations from the given test fixture, which60 * should be defined as follows:61 *62 * {63 *64 * ... rest of the fixture...65 *66 * expectedWarningCalls: [67 * [ /​/​ arguments of the first call68 * "1stArg",69 * "2ndArg",70 * "3rdArg"71 * ],72 * ... more items if more calls are expected73 * ],74 * expectedErrorCalls: [] /​/​ 0 calls to jQuery.sap.log.error expected75 * }76 *77 * NOTE:78 * - If the given fixture does not specify the 'expectedWarningCalls' and79 * 'expectedErrorCalls' keys, no test will be executed.80 * - jQuery.sap.log.error and jQuery.sap.log.warning should have been81 * already stubbed before this function is called.82 */​83 function testExpectedErrorAndWarningCalls (oFixture) {84 if (oFixture.hasOwnProperty("expectedErrorCalls")) {85 var aExpectedErrorCalls = (oFixture.expectedErrorCalls || []);86 strictEqual(87 jQuery.sap.log.error.callCount,88 aExpectedErrorCalls.length,89 "jQuery.sap.log.error was called the expected number of times"90 );91 if (aExpectedErrorCalls.length > 0) {92 deepEqual(93 jQuery.sap.log.error.args,94 aExpectedErrorCalls,95 "jQuery.sap.log.error logged the expected errors"96 );97 }98 }99 if (oFixture.hasOwnProperty("expectedWarningCalls")) {100 var aExpectedWarningCalls = (oFixture.expectedWarningCalls || []);101 strictEqual(102 jQuery.sap.log.warning.callCount,103 aExpectedWarningCalls.length,104 "jQuery.sap.log.warning was called the expected number of times"105 );106 if (aExpectedWarningCalls.length > 0) {107 deepEqual(108 jQuery.sap.log.warning.args,109 aExpectedWarningCalls,110 "jQuery.sap.log.warning logged the expected warnings"111 );112 }113 }114 }115 /​*116 * Removes the count* parameters from each match result (output of117 * getMatchingInbounds) and the priority string.118 *119 * Returns the filtered result (that may contain shallow copies of120 * objects/​arrays).121 */​122 function removeCountsAndSortString (vMatchResults) {123 var bIsObject = jQuery.isPlainObject(vMatchResults);124 var aMatchResults = bIsObject ? [vMatchResults] : vMatchResults,125 aMutatedMatchResults = aMatchResults.map(function (oMatchResult) {126 return JSON.parse(JSON.stringify(oMatchResult, function (sKey, vVal) {127 return O_COUNT_PARAMETERS.hasOwnProperty(sKey) || sKey === "priorityString" ? undefined : vVal;128 }));129 });130 return bIsObject ? aMutatedMatchResults[0] : aMutatedMatchResults;131 }132 /​*133 * A factory to create a test ClientSideTargetResolution service with134 * inbounds and configuration as needed.135 *136 * Can be called like:137 * createService(); /​/​ no inbounds, mocked adapter, undefined configuration138 * createService({139 * inbounds: [ ... ] /​/​ arbitrary inbounds140 * });141 * createService({142 * adapter: { ... } /​/​ arbitrary fake adapter143 * });144 * createService({145 * configuration: { ... } /​/​ arbitrary service configuration146 * });147 */​148 function createService (oArgs) {149 var oConfiguration = (oArgs || {}).configuration;150 var aInbounds = (oArgs || {}).inbounds || [];151 var oAdapter = (oArgs || {}).adapter;152 if (!oAdapter) {153 /​/​ create fake adapter154 oAdapter = {155 getInbounds: sinon.stub().returns(156 new jQuery.Deferred().resolve(aInbounds).promise()157 )158 };159 }160 var oUshellConfig = testUtils.overrideObject({}, {161 "/​services/​ClientSideTargetResolution": oConfiguration162 });163 testUtils.resetConfigChannel(oUshellConfig);164 return new ClientSideTargetResolution(165 oAdapter,166 null,167 null,168 oConfiguration169 );170 }171 /​*172 * Tests that _getMatchingInbounds was called with the expected173 * bExcludeTileInbounds argument if called at all.174 */​175 function testExcludeTileIntentArgument (oCstrService, bExpectedExcludeTileInbounds) {176 var iCalledTimes = oCstrService._getMatchingInbounds.callCount;177 if (iCalledTimes > 0) {178 /​/​ getLinks may return preventively in some cases... but if179 /​/​ it's called we need to check these:180 strictEqual(iCalledTimes, 1, "_getMatchingInbounds was called 1 time");181 strictEqual(oCstrService._getMatchingInbounds.getCall(0).args.length, 3, "_getMatchingInbounds was called with three arguments");182 deepEqual(183 oCstrService._getMatchingInbounds.getCall(0).args[2],184 { bExcludeTileInbounds: bExpectedExcludeTileInbounds },185 "_getMatchingInbounds was called with a 'true' third argument (bExcludeTileInbounds)"186 );187 }188 }189 module("sap.ushell.services.ClientSideTargetResolution", {190 setup: function () {191 return sap.ushell.bootstrap("local").then(function () {192 /​/​ assume there is no open application in tests193 oAppConfiguration.setCurrentApplication(null);194 });195 },196 /​**197 * This method is called after each test. Add every restoration code here.198 */​199 teardown: function () {200 testUtils.restoreSpies(201 oCSTRUtils.isDebugEnabled,202 oSearch.match,203 oSearch.matchOne,204 oAppConfiguration.getCurrentApplication,205 utils.Error,206 utils.getFormFactor,207 utils.getLocalStorage,208 sap.ushell.Container.getService,209 sap.ushell.Container.getUser,210 sap.ui.getCore,211 jQuery.sap.getObject,212 jQuery.sap.log.warning,213 jQuery.sap.log.error,214 jQuery.sap.log.debug,215 jQuery.sap.log.getLevel,216 InboundProvider.prototype.getInbounds,217 VirtualInbounds.isVirtualInbound218 );219 delete sap.ushell.Container;220 }221 });222 test("getServiceClientSideTargetResolution: returns something different than undefined", function () {223 var oClientSideTargetResolution = sap.ushell.Container.getService("ClientSideTargetResolution");224 ok(oClientSideTargetResolution !== undefined);225 });226 test("getServiceClientSideTargetResolution: returns something different than undefined", function () {227 var oClientSideTargetResolution = sap.ushell.Container.getService("ClientSideTargetResolution");228 ok(oClientSideTargetResolution !== undefined);229 });230 [231 /​*232 * Test for _extractInboundFilter233 */​234 {235 testDescription: "natural result",236 input: "ABC-def?SO=AA",237 result: [238 {239 semanticObject: "ABC",240 action: "def"241 }242 ]243 },244 {245 testDescription: "flawed input",246 input: "Customer-processReceivablesCollectionSegment=EUR_TOOL&Customer=C0001&IsHeadOfficeView=true#Shell-home",247 result: undefined248 },249 {250 testDescription: "natural result no segmented access",251 noSegment: true,252 input: "ABC-defo?SO=AA",253 result: undefined254 }255 ].forEach(function (oFixture) {256 test("_extractInboundFilter when " + oFixture.testDescription, function () {257 var aRes,258 oSrvc,259 oFakeAdapter;260 if (oFixture.noSegment) {261 oFakeAdapter = null;262 } else {263 oFakeAdapter = {264 getInbounds: function () {},265 hasSegmentedAccess: true266 };267 }268 oSrvc = createService({269 adapter: oFakeAdapter270 });271 aRes = oSrvc._extractInboundFilter(oFixture.input);272 deepEqual(aRes, oFixture.result, "correct result");273 });274 });275 /​/​ test the parameter sap-ui-tech-hint=WDA|UI5|GUI which, given276 /​/​ an otherwise identical targetmapping, selects the one which has the given technology.277 var iInb = {278 semanticObject: "SO",279 action: "action",280 signature: {281 parameters: {}282 },283 resolutionResult: {}284 };285 var iInbDefault = {286 semanticObject: "SO",287 action: "action",288 signature: {289 parameters: { "sap-ui-tech-hint": { defaultValue: { value: "XXX" }}}290 },291 resolutionResult: {}292 };293 var iInbDefaultOtherPar = {294 semanticObject: "SO",295 action: "action",296 signature: {297 parameters: {298 "sap-ui-tech-hint": { defaultValue: { value: "XXX" }},299 "demo2": { defaultValue: { value: "XXX" }}300 }301 },302 resolutionResult: {}303 };304 function addTech (oObj, sTech) {305 var copy = jQuery.extend(true, {}, oObj);306 copy.resolutionResult["sap.ui"] = {};307 copy.resolutionResult["sap.ui"].technology = sTech;308 return copy;309 }310 [311 {312 testDescription: "all else equal, tech hint is used WDA->WDA",313 aInbounds: ["GUI", "WDA", "UI5", undefined].map(function (el) {314 return addTech(iInb, el);315 }),316 sIntent: "SO-action?sap-ui-tech-hint=WDA",317 expectedResultTech: "WDA"318 },319 {320 testDescription: "all else equal, no tech hint, 'best technology' UI5->WDA->GUI",321 aInbounds: ["GUI", "UI5", "WDA", undefined].map(function (el) { return addTech(iInb, el); }),322 sIntent: "SO-action",323 expectedResultTech: "UI5"324 },325 {326 testDescription: "all else equal, no tech hint, 'best technology' UI5->WDA->GUI , UI5 not present",327 aInbounds: ["GUI", "WDA", undefined].map(function (el) { return addTech(iInb, el); }),328 sIntent: "SO-action",329 expectedResultTech: "WDA"330 },331 {332 testDescription: "all else equal, no tech hint, 'best technology' UI5->WDA->GUI , default on WDA Intent",333 aInbounds: [addTech(iInbDefault, "WDA")].concat(["GUI", "UI5", undefined].map(function (el) { return addTech(iInb, el); })),334 sIntent: "SO-action?sap-ui-tech-hint=GUI",335 expectedResultTech: "GUI"336 },337 {338 testDescription: "all else equal, no tech hint, 'best technology' UI5->WDA->GUI , DefaultInOther",339 aInbounds: [addTech(iInbDefaultOtherPar, "WDA")].concat(["GUI", "WDA", undefined].map(function (el) { return addTech(iInb, el); })),340 sIntent: "SO-action?sap-ui-tech-hint=GUI",341 expectedResultTech: "GUI"342 },343 {344 testDescription: "all else equal, no tech hint, 'best technology' UI5->WDA->GUI , DefaultInOther no hint",345 aInbounds: [addTech(iInbDefaultOtherPar, "WDA")].concat(["GUI", "WDA", undefined].map(function (el) { return addTech(iInb, el); })),346 sIntent: "SO-action",347 expectedResultTech: "WDA"348 }349 ].forEach(function (oFixture) {350 asyncTest("matchingTarget sap-ui-tech-hint " + oFixture.testDescription, function () {351 var oSrvc = createService();352 var oShellHash = mkInt("#" + oFixture.sIntent);353 oShellHash.formFactor = "desktop";354 var oIndex = oInboundIndex.createIndex(oFixture.aInbounds);355 oSrvc._getMatchingInbounds(oShellHash, oIndex)356 .done(function (oMatchingTargets) {357 if (oFixture.expectedResultTech) {358 equal(oMatchingTargets[0].inbound.resolutionResult["sap.ui"].technology, oFixture.expectedResultTech, "correct result technology");359 }360 })361 .fail(function (sError) {362 ok(false, "promise was rejected");363 })364 .always(function () {365 start();366 });367 });368 });369 [370 /​*371 * _getMatchingInbounds: checks match results are sorted as expected"372 */​373 {374 testDescription: "one inbound matches",375 aFakeMatchResults: [376 /​/​ NOTE: not actual Inbound structure. We only use 'matches' and num377 /​/​ is random, used only for report purposes.378 { num: 36, matches: true, inbound: { resolutionResult: { applicationType: "Something" }}}379 ],380 expectedInbounds: [0] /​/​ zero-based index in aFakeInbounds381 },382 {383 testDescription: "no inbound matches",384 aFakeMatchResults: [385 ],386 expectedInbounds: []387 },388 {389 testDescription: "multiple inbound match, longer names win",390 aFakeMatchResults: [391 /​/​ NOTE: applicationType determines the order here392 { num: 33, matches: true, inbound: { resolutionResult: { applicationType: "Something" }}},393 { num: 36, matches: true, inbound: { resolutionResult: { applicationType: "SomethingExt" }}}394 ],395 expectedInbounds: [1, 0]396 },397 {398 testDescription: "multiple inbound match, reverse alphabetical order in tie-breaker",399 aFakeMatchResults: [400 /​/​ NOTE: applicationType determines the order here401 { num: 33, matches: true, inbound: { resolutionResult: { applicationType: "A" }}},402 { num: 36, matches: true, inbound: { resolutionResult: { applicationType: "B" }}}403 ],404 expectedInbounds: [1, 0] /​/​ -> B then A405 },406 {407 testDescription: "priority is specified",408 aFakeMatchResults: [409 { num: 18, matches: true, priorityString: "B", inbound: { resolutionResult: {} } },410 { num: 31, matches: true, priorityString: "CD", inbound: { resolutionResult: {} } },411 { num: 33, matches: true, priorityString: "CZ", inbound: { resolutionResult: {} } },412 { num: 41, matches: true, priorityString: "A", inbound: { resolutionResult: {} } },413 { num: 44, matches: true, priorityString: "C", inbound: { resolutionResult: {} } },414 { num: 46, matches: true, priorityString: "CE", inbound: { resolutionResult: {} } }415 ],416 expectedInbounds: [2, 5, 1, 4, 0, 3]417 },418 {419 testDescription: "priority is specified",420 aFakeMatchResults: [421 { num: 44, matches: true, priorityString: "C", inbound: { resolutionResult: {} } },422 { num: 31, matches: true, priorityString: "CD", inbound: { resolutionResult: {} } },423 { num: 41, matches: true, priorityString: "A", inbound: { resolutionResult: {} } },424 { num: 46, matches: true, priorityString: "CE", inbound: { resolutionResult: {} } },425 { num: 18, matches: true, priorityString: "B", inbound: { resolutionResult: {} } },426 { num: 33, matches: true, priorityString: "CZ", inbound: { resolutionResult: {} } }427 ],428 expectedInbounds: [5, 3, 1, 0, 4, 2]429 },430 {431 testDescription: "priority is with numbers",432 aFakeMatchResults: [433 { num: 44, matches: true, priorityString: "101", inbound: { resolutionResult: {} } },434 { num: 31, matches: true, priorityString: "000", inbound: { resolutionResult: {} } },435 { num: 41, matches: true, priorityString: "120", inbound: { resolutionResult: {} } },436 { num: 46, matches: true, priorityString: "999", inbound: { resolutionResult: {} } },437 { num: 18, matches: true, priorityString: "010", inbound: { resolutionResult: {} } },438 { num: 33, matches: true, priorityString: "001", inbound: { resolutionResult: {} } }439 ],440 expectedInbounds: [3, 2, 0, 4, 5, 1]441 },442 {443 testDescription: "realistic sort strings sorted with expected priority",444 aFakeMatchResults: [445 { num: 33, matches: true, priorityString: "x MTCH=003 MREQ=003 NFIL=002 NDEF=001 POT=004 RFRE=999", inbound: { resolutionResult: {} } },446 { num: 18, matches: true, priorityString: "x MTCH=003 MREQ=003 NFIL=002 NDEF=001 POT=100 RFRE=999", inbound: { resolutionResult: {} } }447 ],448 expectedInbounds: [1, 0]449 }450 ].forEach(function (oFixture) {451 asyncTest("_getMatchingInbounds: matching inbounds are returned in priority when " + oFixture.testDescription, function () {452 /​/​ Return fake adapter with inbounds in the fixture453 var oSrvc = createService(),454 aExpectedMatchingTargets = oFixture.expectedInbounds.map(function (iIdx) {455 return oFixture.aFakeMatchResults[iIdx];456 });457 var oIndex = {458 /​/​ values don't matter for this test (match is stubbed anyway)459 getSegment: sinon.stub().returns([]),460 getAllInbounds: sinon.stub().returns([])461 };462 sinon.stub(oSearch, "match").returns(Promise.resolve({463 matchResults: oFixture.aFakeMatchResults,464 missingReferences: {}465 }));466 /​/​ Act467 oSrvc._getMatchingInbounds({} /​* any parameter ok for the test*/​, oIndex).done(function (aMatchingInbounds) {468 /​/​ Assert469 strictEqual(Object.prototype.toString.call(aMatchingInbounds), "[object Array]", "an array was returned");470 deepEqual(aMatchingInbounds, aExpectedMatchingTargets,471 "inbounds that matched were returned in the promise");472 }).fail(function () {473 ok(false, "promise was resolved");474 }).always(function () {475 start();476 });477 });478 });479 [480 /​*481 * General tests for _getMatchingInbounds482 *483 * testDescription: {string}:484 * describes the test case (not what the test should do!).485 *486 * oParsedShellHash: {object}:487 * the parsed intent488 *489 * aInbounds: {object}490 * inbounds to match against491 *492 * mockedUserDefaultValues: {object}493 * any mocked known user default value494 *495 * expected: {object[]} or {number[]}496 * - when {object[]}:497 * array of *matching results*. This is checked 1:1498 * with deepEqual.499 *500 * - when {number[]}:501 * array of 0-based indices into aInbounds. In this case the502 * test will deepEqual only the "inbound" entry in the503 * matching result object.504 *505 * NOTE: this test does not check for the sort string or count506 * parameters. Use test for sort string instead.507 */​508 {509 testDescription: "generic semantic object specified in intent",510 oParsedShellHash: {511 "semanticObject": undefined,512 "action": "action",513 "params": {514 "currency": ["EUR"]515 }516 },517 aInbounds: [518 {519 semanticObject: "ObjectA",520 action: "action",521 signature: { parameters: {522 currency: { required: true, filter: { value: "EUR" } }523 }},524 resolutionResult: { text: "Currency manager", ui5ComponentName: "Currency.ComponentA", url: "/​url/​to/​currency", applicationType: "URL", additionalInformation: "SAPUI5.Component=Currency.Component" }525 },526 {527 semanticObject: "ObjectB",528 action: "action",529 signature: { parameters: {530 currency: { required: true, filter: { value: "EUR" } },531 user: { required: false, defaultValue: { value: "TEST" } }532 }},533 resolutionResult: { text: "Currency manager", ui5ComponentName: "Currency.ComponentB", url: "/​url/​to/​currency", applicationType: "URL", additionalInformation: "SAPUI5.Component=Currency.Component" }534 }535 ],536 mockedUserDefaultValues: {},537 expected: [1, 0]538 },539 {540 testDescription: "generic action specified in intent",541 oParsedShellHash: {542 "semanticObject": "Object",543 "action": undefined,544 "params": {545 "currency": ["EUR"]546 }547 },548 aInbounds: [549 {550 semanticObject: "Object",551 action: "actionA",552 signature: { parameters: {553 currency: { required: true, filter: { value: "EUR" } }554 }},555 resolutionResult: { text: "Currency manager", ui5ComponentName: "Currency.ComponentA", url: "/​url/​to/​currency", applicationType: "URL", additionalInformation: "SAPUI5.Component=Currency.Component" }556 },557 {558 semanticObject: "Object",559 action: "actionB",560 signature: { parameters: {561 currency: { required: true, filter: { value: "EUR" } },562 user: { required: false, defaultValue: { value: "TEST" } }563 }},564 resolutionResult: { text: "Currency manager", ui5ComponentName: "Currency.ComponentB", url: "/​url/​to/​currency", applicationType: "URL", additionalInformation: "SAPUI5.Component=Currency.Component" }565 }566 ],567 mockedUserDefaultValues: {},568 expected: [1, 0]569 },570 {571 testDescription: "* specified in intent semantic object",572 oParsedShellHash: {573 "semanticObject": "*", /​/​ treated as a literal "*"574 "action": undefined,575 "params": {576 "currency": ["EUR"]577 }578 },579 aInbounds: [580 {581 semanticObject: "*",582 action: "action",583 signature: { parameters: {584 currency: { required: true, filter: { value: "EUR" } }585 }},586 resolutionResult: { text: "Currency manager", ui5ComponentName: "Currency.ComponentA", url: "/​url/​to/​currency", applicationType: "URL", additionalInformation: "SAPUI5.Component=Currency.Component" }587 },588 {589 semanticObject: "Object",590 action: "action",591 signature: { parameters: {592 currency: { required: true, filter: { value: "EUR" } },593 user: { required: false, defaultValue: { value: "TEST" } }594 }},595 resolutionResult: { text: "Currency manager", ui5ComponentName: "Currency.ComponentB", url: "/​url/​to/​currency", applicationType: "URL", additionalInformation: "SAPUI5.Component=Currency.Component" }596 }597 ],598 mockedUserDefaultValues: {},599 expected: [0]600 },601 {602 testDescription: "* specified in intent action",603 oParsedShellHash: {604 "semanticObject": undefined,605 "action": "*",606 "params": {607 "currency": ["EUR"]608 }609 },610 aInbounds: [611 {612 semanticObject: "Object",613 action: "action",614 signature: { parameters: {615 currency: { required: true, filter: { value: "EUR" } }616 }},617 resolutionResult: { text: "Currency manager", ui5ComponentName: "Currency.ComponentA", url: "/​url/​to/​currency", applicationType: "URL", additionalInformation: "SAPUI5.Component=Currency.Component" }618 },619 {620 semanticObject: "Object",621 action: "*",622 signature: { parameters: {623 currency: { required: true, filter: { value: "EUR" } },624 user: { required: false, defaultValue: { value: "TEST" } }625 }},626 resolutionResult: { text: "Currency manager", ui5ComponentName: "Currency.ComponentB", url: "/​url/​to/​currency", applicationType: "URL", additionalInformation: "SAPUI5.Component=Currency.Component" }627 }628 ],629 mockedUserDefaultValues: {},630 expected: [1]631 },632 {633 testDescription: "a filter reference is specified",634 oParsedShellHash: {635 "semanticObject": "Object",636"action": "action",637 "params": {638 "currency": ["EUR"]639 }640 },641 aInbounds: [642 {643 semanticObject: "Object",644action: "action",645 signature: { parameters: {646 currency: { required: true, filter: { format: "reference", value: "UserDefault.currency" } }647 }},648 title: "Currency manager",649 resolutionResult: { text: "Currency manager", ui5ComponentName: "Currency.Component", url: "/​url/​to/​currency", applicationType: "URL", additionalInformation: "SAPUI5.Component=Currency.Component" }650 }651 ],652 mockedUserDefaultValues: { "currency": "EUR" },653 expected: [{654 "genericSO": false,655 "intentParamsPlusAllDefaults": {656 "currency": [ "EUR" ]657 },658 "defaultedParamNames": [],659 "matches": true,660 "parsedIntent": {661 "semanticObject": "Object",662 "action": "action",663 "params": {664 "currency": ["EUR"]665 }666 },667 "matchesVirtualInbound": false,668 "inbound": {669 "title": "Currency manager",670 "action": "action",671 "semanticObject": "Object",672 "signature": {673 "parameters": {674 currency: { required: true, filter: { format: "reference", value: "UserDefault.currency" } }675 }676 },677 "resolutionResult": { text: "Currency manager", ui5ComponentName: "Currency.Component", url: "/​url/​to/​currency", applicationType: "URL", additionalInformation: "SAPUI5.Component=Currency.Component" }678 },679 "resolutionResult": { } /​/​ title not propagated in early resolution result680 }]681 },682 {683 testDescription: "user default service provides non-matching parameter",684 oParsedShellHash: {685 "semanticObject": "Object",686"action": "action",687 "params": {688 "currency": ["EUR"]689 }690 },691 aInbounds: [692 {693 semanticObject: "Object",694action: "action",695 signature: { parameters: {696 currency: { required: true, filter: { format: "reference", value: "UserDefault.currency" } }697 }},698 resolutionResult: { text: "Currency manager", ui5ComponentName: "Currency.Component", url: "/​url/​to/​currency", applicationType: "URL", additionalInformation: "SAPUI5.Component=Currency.Component" }699 }700 ],701 mockedUserDefaultValues: { "currency": "GBP" }, /​/​ NOTE: GBP does not match filter702 expected: []703 },704 {705 testDescription: "user default service cannot provide a default value for filter reference",706 oParsedShellHash: {707 "semanticObject": "Object",708"action": "action",709 "params": {710 "currency": ["EUR"]711 }712 },713 aInbounds: [714 {715 semanticObject: "Object",716action: "action",717 signature: { parameters: {718 currency: { required: true, filter: { format: "reference", value: "UserDefault.currency" } }719 }},720 resolutionResult: { text: "Currency manager", ui5ComponentName: "Currency.Component", url: "/​url/​to/​currency", applicationType: "URL", additionalInformation: "SAPUI5.Component=Currency.Component" }721 }722 ],723 mockedUserDefaultValues: { "other": "uselessValue" },724 expected: []725 },726 {727 testDescription: "default reference value is provided by UserDefaultParameters service",728 oParsedShellHash: {729 "semanticObject": "Object",730"action": "action",731 "params": {}732 },733 aInbounds: [734 {735 semanticObject: "Object",736action: "action",737 signature: { parameters: {738 currency: { required: false, defaultValue: { format: "reference", value: "UserDefault.currency" } }739 }},740 resolutionResult: { text: "Currency manager", ui5ComponentName: "Currency.Component", url: "/​url/​to/​currency", applicationType: "URL", additionalInformation: "SAPUI5.Component=Currency.Component" }741 }742 ],743 mockedUserDefaultValues: { "currency": "EUR" },744 expected: [{745 "genericSO": false,746 "intentParamsPlusAllDefaults": {747 currency: ["EUR"]748 },749 "defaultedParamNames": ["currency"],750 "matches": true,751 "parsedIntent": {752 "semanticObject": "Object",753"action": "action",754 "params": {}755 },756 "matchesVirtualInbound": false,757 "resolutionResult": { }, /​/​ no title propagated yet in Early resolution result758 "inbound": {759 "action": "action",760 "resolutionResult": { "additionalInformation": "SAPUI5.Component=Currency.Component", "applicationType": "URL", "text": "Currency manager", "ui5ComponentName": "Currency.Component", "url": "/​url/​to/​currency" },761 "semanticObject": "Object",762 "signature": {763 "parameters": {764 "currency": { required: false, defaultValue: { format: "reference", value: "UserDefault.currency" } }765 }766 }767 }768 }]769 },770 {771 testDescription: "unknown default reference",772 oParsedShellHash: {773 "semanticObject": "Object",774"action": "action",775 "params": {} /​/​ note, no parameter given776 },777 aInbounds: [778 {779 semanticObject: "Object",780action: "action",781 signature: { parameters: {782 currency: { required: false, defaultValue: { format: "reference", value: "UserDefault.currency" } }783 }},784 resolutionResult: { text: "Currency manager", ui5ComponentName: "Currency.Component", url: "/​url/​to/​currency", applicationType: "URL", additionalInformation: "SAPUI5.Component=Currency.Component" }785 }786 ],787 mockedUserDefaultValues: { /​* no known values */​ },788 expected: [{789 "genericSO": false,790 "intentParamsPlusAllDefaults": {}, /​/​ no default parameter791 "matches": true,792 "matchesVirtualInbound": false,793 "defaultedParamNames": [],794 "resolutionResult": {}, /​/​ no title propagated yet in Early resolution result795 "parsedIntent": {796 "semanticObject": "Object",797"action": "action",798 "params": {}799 },800 "inbound": {801 "action": "action",802 "resolutionResult": { "additionalInformation": "SAPUI5.Component=Currency.Component", "applicationType": "URL", "text": "Currency manager", "ui5ComponentName": "Currency.Component", "url": "/​url/​to/​currency" },803 "semanticObject": "Object",804 "signature": {805 "parameters": {806 "currency": { required: false, defaultValue: { format: "reference", value: "UserDefault.currency" } }807 }808 }809 }810 }]811 },812 {813 testDescription: "a default reference and a filter reference are known",814 oParsedShellHash: {815 "semanticObject": "Currency",816"action": "app",817 "params": {}818 },819 aInbounds: [820 {821 semanticObject: "*",822action: "app",823 signature: { parameters: {824 mode: {825 required: false,826 defaultValue: { format: "reference", value: "UserDefault.mode" },827 filter: { format: "reference", value: "UserDefault.currencyAppMode" }828 }829 }},830 resolutionResult: {831 text: "Currency manager",832 ui5ComponentName: "Currency.Component",833 url: "/​url/​to/​currency",834 applicationType: "URL",835 additionalInformation: "SAPUI5.Component=Currency.Component"836 }837 },838 {839 semanticObject: "*",840action: "app",841 signature: { parameters: {842 mode: {843 required: false,844 defaultValue: { format: "reference", value: "UserDefault.mode" },845 filter: { format: "reference", value: "UserDefault.carsAppMode" }846 }847 }},848 resolutionResult: {849 text: "Cars manager",850 ui5ComponentName: "Cars.Component",851 url: "/​url/​to/​cars",852 applicationType: "URL",853 additionalInformation: "SAPUI5.Component=Cars.Component"854 }855 }856 ],857 mockedUserDefaultValues: {858 "mode": "desktop", /​/​ user specific preference859 "currencyAppMode": "desktop",860 "carsAppMode": "mobile"861 },862 expected: [{863 "genericSO": true,864 "intentParamsPlusAllDefaults": {865 "mode": ["desktop"]866 },867 "defaultedParamNames": ["mode"],868 "matches": true,869 "matchesVirtualInbound": false,870 "resolutionResult": { },871 "parsedIntent": {872 "semanticObject": "Currency",873"action": "app",874 "params": {}875 },876 "inbound": {877 "action": "app",878 "resolutionResult": { "additionalInformation": "SAPUI5.Component=Currency.Component", "applicationType": "URL", "text": "Currency manager", "ui5ComponentName": "Currency.Component", "url": "/​url/​to/​currency" },879 "semanticObject": "*",880 "signature": {881 "parameters": {882 "mode": {883 "required": false,884 "defaultValue": { format: "reference", value: "UserDefault.mode" },885 "filter": { format: "reference", value: "UserDefault.currencyAppMode" }886 }887 }888 }889 }890 }]891 },892 {893 testDescription: "sap-ushell-defaultedParameterNames is specified",894 oParsedShellHash: {895 "semanticObject": "Currency",896"action": "app",897 "params": {898 "sap-ushell-defaultedParameterNames": ["will", "be", "ignored"]899 }900 },901 aInbounds: [902 {903 semanticObject: "Currency",904action: "app",905 signature: {906 parameters: {},907 additionalParameters: "allowed"908 },909 resolutionResult: {910 text: "Currency manager",911 ui5ComponentName: "Currency.Component",912 url: "/​url/​to/​currency",913 applicationType: "URL",914 additionalInformation: "SAPUI5.Component=Currency.Component"915 }916 }917 ],918 mockedUserDefaultValues: {},919 expected: [{920 "defaultedParamNames": [], /​/​ NOTE: no sap- param!921 "genericSO": false,922 "intentParamsPlusAllDefaults": {},923 "matches": true,924 "matchesVirtualInbound": false,925 "resolutionResult": { },926 "parsedIntent": {927 "action": "app",928 "params": {929 "sap-ushell-defaultedParameterNames": [ "will", "be", "ignored" ]930 },931 "semanticObject": "Currency"932 },933 "inbound": {934 "action": "app",935 "resolutionResult": {936 "additionalInformation": "SAPUI5.Component=Currency.Component",937 "applicationType": "URL",938 "text": "Currency manager",939 "ui5ComponentName": "Currency.Component",940 "url": "/​url/​to/​currency"941 },942 "semanticObject": "Currency",943 "signature": {944 "additionalParameters": "allowed",945 "parameters": {}946 }947 }948 }]949 },950 {951 testDescription: "one inbound default parameter is in the intent",952 oParsedShellHash: {953 "semanticObject": "Currency",954"action": "app",955 "params": {956 "intentParam1": ["ipv1"],957 "overlappingParam3": ["ipv2"]958 }959 },960 aInbounds: [961 {962 semanticObject: "Currency",963action: "app",964 signature: {965 parameters: {966 "defaultParam1": { required: false, defaultValue: { value: "dv1" } },967 "defaultParam2": { required: false, defaultValue: { value: "dv2" } },968 "overlappingParam3": { required: false, defaultValue: { value: "dv3" } }969 },970 additionalParameters: "allowed"971 },972 resolutionResult: {973 text: "Currency manager",974 ui5ComponentName: "Currency.Component",975 url: "/​url/​to/​currency",976 applicationType: "URL",977 additionalInformation: "SAPUI5.Component=Currency.Component"978 }979 }980 ],981 mockedUserDefaultValues: {},982 expected: [{983 "defaultedParamNames": [984 "defaultParam1",985 "defaultParam2"986 ],987 "genericSO": false,988 "intentParamsPlusAllDefaults": {989 "defaultParam1": [990 "dv1"991 ],992 "defaultParam2": [993 "dv2"994 ],995 "intentParam1": [996 "ipv1"997 ],998 "overlappingParam3": [999 "ipv2"1000 ]1001 },1002 "matches": true,1003 "matchesVirtualInbound": false,1004 "resolutionResult": { },1005 "parsedIntent": {1006 "action": "app",1007 "params": {1008 "intentParam1": [1009 "ipv1"1010 ],1011 "overlappingParam3": [1012 "ipv2"1013 ]1014 },1015 "semanticObject": "Currency"1016 },1017 "inbound": {1018 "action": "app",1019 "resolutionResult": {1020 "additionalInformation": "SAPUI5.Component=Currency.Component",1021 "applicationType": "URL",1022 "text": "Currency manager",1023 "ui5ComponentName": "Currency.Component",1024 "url": "/​url/​to/​currency"1025 },1026 "semanticObject": "Currency",1027 "signature": {1028 "additionalParameters": "allowed",1029 "parameters": {1030 "defaultParam1": { required: false, defaultValue: { value: "dv1" } },1031 "defaultParam2": { required: false, defaultValue: { value: "dv2" } },1032 "overlappingParam3": { required: false, defaultValue: { value: "dv3" } }1033 }1034 }1035 }1036 }]1037 },1038 {1039 /​*1040 * Inbounds with more defaulted parameters are a better fit1041 * if nothing required had matched.1042 */​1043 testDescription: "intent matches no filters and multiple inbounds with same SO-action are defined",1044 oParsedShellHash: {1045 "semanticObject": "Object",1046 "action": "action",1047 "params": {1048 "additionalParameter": "hello"1049 }1050 },1051 aInbounds: [1052 { /​/​ #0 : this should not match because of the filter on company code1053 semanticObject: "Object",1054action: "action",1055 signature: {1056 additionalParameters: "allowed",1057 parameters: {1058 CompanyCode: {1059 required: true,1060 filter: {1061 format: "plain",1062 value: "1000"1063 }1064 },1065 "sap-app-id": {1066 required: false,1067 defaultValue: {1068 format: "plain",1069 value: "COMPANY1000"1070 }1071 }1072 }1073 },1074 resolutionResult: { } /​/​ doesn't really matter1075 },1076 { /​/​ Priority: x MTCH=000 MREQ=000 NFIL=000 NDEF=001 POT=001 RFRE=9991077 semanticObject: "Object",1078action: "action",1079 signature: {1080 additionalParameters: "allowed",1081 parameters: {1082 default1: {1083 required: false,1084 defaultValue: { format: "plain", value: "1000" }1085 }1086 }1087 },1088 resolutionResult: { }1089 },1090 { /​/​ Priority: x MTCH=000 MREQ=000 NFIL=000 NDEF=002 POT=001 RFRE=9991091 semanticObject: "Object",1092action: "action",1093 signature: {1094 additionalParameters: "allowed",1095 parameters: {1096 default1: {1097 required: false,1098 defaultValue: { format: "plain", value: "1000" }1099 },1100 default2: { /​/​ extra default parameter -> more complex1101 required: false,1102 defaultValue: { format: "plain", value: "1000" }1103 }1104 }1105 },1106 resolutionResult: { }1107 },1108 { /​/​ Priority: x MTCH=000 MREQ=000 NFIL=000 NDEF=000 POT=001 RFRE=9991109 semanticObject: "Object",1110action: "action",1111 signature: {1112 additionalParameters: "allowed",1113 parameters: { }1114 }, /​/​ no signature parameters -> simple.1115 resolutionResult: { }1116 }1117 ],1118 mockedUserDefaultValues: {},1119 expected: [2, 1, 3]1120 },1121 {1122 /​*1123 * Test matching with sap-priority1124 */​1125 testDescription: "intent matches no filters and multiple inbounds with same SO-action are defined and sap-priority",1126 oParsedShellHash: {1127 "semanticObject": "Object",1128 "action": "action",1129 "params": {1130 "additionalParameter": "hello"1131 }1132 },1133 aInbounds: [1134 { /​/​ #0 : this should not match because of the filter on company code1135 semanticObject: "Object",1136action: "action",1137 signature: {1138 additionalParameters: "allowed",1139 parameters: {1140 CompanyCode: {1141 required: true,1142 filter: {1143 format: "plain",1144 value: "1000"1145 }1146 },1147 "sap-app-id": {1148 required: false,1149 defaultValue: {1150 format: "plain",1151 value: "COMPANY1000"1152 }1153 }1154 }1155 },1156 resolutionResult: { } /​/​ doesn't really matter1157 },1158 { /​/​ #1 : this matches and comes before negative inbounds with negative sap-priority1159 semanticObject: "Object",1160action: "action",1161 signature: {1162 additionalParameters: "allowed",1163 parameters: {1164 default1: {1165 required: false,1166 defaultValue: { format: "plain", value: "1000" }1167 }1168 }1169 },1170 resolutionResult: { }1171 },1172 { /​/​ #2 : this matches and should come last, but sap-priority is specified so it comes first1173 semanticObject: "Object",1174action: "action",1175 signature: {1176 additionalParameters: "allowed",1177 parameters: {1178 default1: {1179 required: false,1180 defaultValue: { format: "plain", value: "1000" }1181 },1182 "sap-priority": {1183 defaultValue: { format: "plain", value: "50" }1184 },1185 default2: { /​/​ extra default parameter -> more complex1186 required: false,1187 defaultValue: { format: "plain", value: "1000" }1188 }1189 }1190 },1191 resolutionResult: { }1192 },1193 { /​/​ #3 : this comes last because of negative sap priority1194 semanticObject: "Object",1195action: "action",1196 signature: {1197 additionalParameters: "allowed",1198 parameters: {1199 "sap-priority": {1200 defaultValue: { format: "plain", value: "-50" }1201 }1202 }1203 }, /​/​ no signature parameters -> simple.1204 resolutionResult: { }1205 }1206 ],1207 mockedUserDefaultValues: {},1208 expected: [1209 2, /​/​ sap-priority: 501210 1, /​/​ no sap priority1211 3 /​/​ sap-priority: -501212 ]1213 },1214 {1215 /​*1216 * Here we test that the most detailed inbound that suits1217 * the filter is chosen among less detailed/​complex ones. In this1218 * case the "sap-app-id" contributes to the complexity of the1219 * inbound which is then prioritized.1220 */​1221 testDescription: "intent matches a filter and multiple inbounds with same SO-action are defined",1222 oParsedShellHash: {1223 "semanticObject": "Object",1224 "action": "action",1225 "params": {1226 "CompanyCode": ["1000"]1227 }1228 },1229 aInbounds: [1230 { /​/​ #01231 semanticObject: "Object",1232action: "action",1233 signature: {1234 parameters: {1235 CompanyCode: {1236 required: true,1237 filter: {1238 format: "plain",1239 value: "1000" /​/​ Company code matches this filter1240 }1241 },1242 "sap-app-id": { /​/​ higher complexity, inbound will be prioritized1243 required: false,1244 defaultValue: {1245 format: "plain",1246 value: "COMPANY1000"1247 }1248 }1249 }1250 },1251 resolutionResult: { } /​/​ doesn't really matter1252 },1253 { /​/​ #11254 semanticObject: "Object",1255action: "action",1256 signature: {1257 parameters: {1258 CompanyCode: {1259 required: true,1260 filter: {1261 format: "plain",1262 value: "1000" /​/​ Company code matches this filter, but this inbound is less complex to be prioritized1263 }1264 }1265 }1266 },1267 resolutionResult: { } /​/​ doesn't really matter1268 },1269 { /​/​ #21270 semanticObject: "Object",1271action: "action",1272 signature: {1273 parameters: {1274 CompanyCode: {1275 required: true,1276 filter: {1277 format: "plain",1278 value: "2000"1279 }1280 },1281 "sap-app-id": {1282 required: false,1283 defaultValue: {1284 format: "plain",1285 value: "COMPANY2000"1286 }1287 }1288 }1289 },1290 resolutionResult: { } /​/​ doesn't really matter1291 }1292 ],1293 mockedUserDefaultValues: {},1294 expected: [0, 1]1295 },1296 {1297 testDescription: "required parameter in inbounds without value or defaultValue",1298 oParsedShellHash: {1299 "semanticObject": "Object",1300"action": "action",1301 "params": {1302 "currency": ["EUR"]1303 }1304 },1305 aInbounds: [1306 {1307 semanticObject: "Object",1308action: "action",1309 signature: { parameters: {1310 currency: { required: true }1311 }},1312 resolutionResult: { text: "Currency manager"1313 /​/​ ui5ComponentName: "Currency.Component",1314 /​/​ url: "/​url/​to/​currency",1315 /​/​ applicationType: "URL",1316 /​/​ additionalInformation: "SAPUI5.Component=Currency.Component"1317 }1318 }1319 ],1320 mockedUserDefaultValues: {},1321 expected: [0]1322 },1323 {1324 testDescription: "no additional parameters are allowed and inbound signatures indicates non-required parameter",1325 oParsedShellHash: {1326 "semanticObject": "Object",1327"action": "action",1328 "params": {} /​/​ no parameter specified1329 },1330 aInbounds: [1331 {1332 semanticObject: "Object",1333action: "action",1334 signature: {1335 parameters: {1336 flag: {} /​/​ short notation for required: false1337 },1338 additionalParameters: "notallowed"1339 },1340 resolutionResult: {1341 text: "Currency manager",1342 ui5ComponentName: "Currency.Component",1343 url: "/​url/​to/​currency",1344 applicationType: "URL",1345 additionalInformation: "SAPUI5.Component=Currency.Component"1346 }1347 }1348 ],1349 mockedUserDefaultValues: {},1350 expected: [{1351 "defaultedParamNames": [],1352 "genericSO": false,1353 "intentParamsPlusAllDefaults": {},1354 "matches": true,1355 "matchesVirtualInbound": false,1356 "resolutionResult": { },1357 "parsedIntent": {1358 "action": "action",1359 "params": {},1360 "semanticObject": "Object"1361 },1362 "inbound": {1363 "action": "action",1364 "resolutionResult": {1365 "additionalInformation": "SAPUI5.Component=Currency.Component",1366 "applicationType": "URL",1367 "text": "Currency manager",1368 "ui5ComponentName": "Currency.Component",1369 "url": "/​url/​to/​currency"1370 },1371 "semanticObject": "Object",1372 "signature": {1373 "additionalParameters": "notallowed",1374 "parameters": {1375 "flag": {}1376 }1377 }1378 }1379 }]1380 },1381 {1382 testDescription: " defaulted parameters are mapped to same target A->ANew & B renameTo ANew, both defaulted",1383 oParsedShellHash: {1384 "semanticObject": "Object",1385"action": "action",1386 "params": { }1387 },1388 aInbounds: [1389 {1390 semanticObject: "Object",1391action: "action",1392 signature: {1393 parameters: {1394 "A": { "renameTo": "ANew", "defaultValue": { "value": "ADefaulted" } },1395 "B": { "renameTo": "ANew", "defaultValue": { "value": "BDefaulted" }1396 }1397 },1398 additionalParameters: "allowed"1399 },1400 resolutionResult: {1401 text: "Currency manager",1402 ui5ComponentName: "Currency.Component",1403 url: "/​url/​to/​currency",1404 applicationType: "URL",1405 additionalInformation: "SAPUI5.Component=Currency.Component"1406 }1407 }1408 ],1409 mockedUserDefaultValues: {},1410 expected: [{1411 "defaultedParamNames": [ "A", "B" ],1412 "genericSO": false,1413 "intentParamsPlusAllDefaults": {1414 "A": [1415 "ADefaulted"1416 ],1417 "B": [1418 "BDefaulted"1419 ]1420 },1421 "matches": true,1422 "matchesVirtualInbound": false,1423 "resolutionResult": { },1424 "parsedIntent": {1425 "action": "action",1426 "params": {},1427 "semanticObject": "Object"1428 },1429 "inbound": {1430 "action": "action",1431 "resolutionResult": {1432 "additionalInformation": "SAPUI5.Component=Currency.Component",1433 "applicationType": "URL",1434 "text": "Currency manager",1435 "ui5ComponentName": "Currency.Component",1436 "url": "/​url/​to/​currency"1437 },1438 "semanticObject": "Object",1439 "signature": {1440 parameters: {1441 "A": { "renameTo": "ANew", "defaultValue": { "value": "ADefaulted" } },1442 "B": { "renameTo": "ANew", "defaultValue": { "value": "BDefaulted" }1443 }1444 },1445 additionalParameters: "allowed"1446 }1447 }1448 }]1449 },1450 {1451 testDescription: " defaulted parameters are mapped to same target A->ANew & B renameTo ANew, B defaulted, A supplied",1452 oParsedShellHash: {1453 "semanticObject": "Object",1454"action": "action",1455 "params": { "A": [ "Avalue"] }1456 },1457 aInbounds: [1458 {1459 semanticObject: "Object",1460action: "action",1461 signature: {1462 parameters: {1463 "A": { "renameTo": "ANew"},1464 "B": { "renameTo": "ANew",1465 "defaultValue": { "value": "BDefaulted" }1466 }1467 },1468 additionalParameters: "allowed"1469 },1470 resolutionResult: {1471 text: "Currency manager",1472 ui5ComponentName: "Currency.Component",1473 url: "/​url/​to/​currency",1474 applicationType: "URL",1475 additionalInformation: "SAPUI5.Component=Currency.Component"1476 }1477 }1478 ],1479 mockedUserDefaultValues: {},1480 expected: [{1481 "defaultedParamNames": [],1482 "genericSO": false,1483 "intentParamsPlusAllDefaults": {1484 "A": [1485 "Avalue"1486 ]1487 /​/​ B Not present!1488 },1489 "matches": true,1490 "matchesVirtualInbound": false,1491 "resolutionResult": { },1492 "parsedIntent": {1493 "action": "action",1494 "params": {1495 "A": [1496 "Avalue"1497 ]1498 },1499 "semanticObject": "Object"1500 },1501 "inbound": {1502 "action": "action",1503 "resolutionResult": {1504 "additionalInformation": "SAPUI5.Component=Currency.Component",1505 "applicationType": "URL",1506 "text": "Currency manager",1507 "ui5ComponentName": "Currency.Component",1508 "url": "/​url/​to/​currency"1509 },1510 "semanticObject": "Object",1511 "signature": {1512 parameters: {1513 "A": { "renameTo": "ANew"},1514 "B": { "renameTo": "ANew",1515 "defaultValue": { "value": "BDefaulted" }1516 }1517 },1518 additionalParameters: "allowed"1519 }1520 }1521 }]1522 },1523 {1524 testDescription: "matching tile inbound + bExcludeTileInbounds=false parameter is given",1525 oParsedShellHash: { "semanticObject": "Action", "action": "toNewsTile", "params": {} },1526 bExcludeTileInbounds: false,1527 aInbounds: [1528 { /​/​ a tile inbound1529 "semanticObject": "Action",1530 "action": "toNewsTile",1531 "title": "News",1532 "resolutionResult": { },1533 "deviceTypes": { "desktop": true, "tablet": true, "phone": true },1534 "signature": {1535 "parameters": {},1536 "additionalParameters": "allowed"1537 },1538 "tileResolutionResult": {1539 "isCustomTile": true /​/​ filters out the inbound1540 /​/​ ... plus irrelevant data for this test...1541 }1542 }1543 ],1544 mockedUserDefaultValues: {},1545 expected: [1546 { /​/​ the same tile inbound1547 "parsedIntent": {1548 "action": "toNewsTile",1549 "params": {},1550 "semanticObject": "Action"1551 },1552 "inbound": {1553 "semanticObject": "Action",1554 "action": "toNewsTile",1555 "title": "News",1556 "resolutionResult": { },1557 "deviceTypes": { "desktop": true, "tablet": true, "phone": true },1558 "signature": {1559 "parameters": {},1560 "additionalParameters": "allowed"1561 },1562 "tileResolutionResult": {1563 "isCustomTile": true /​/​ filters out the inbound1564 }1565 },1566 "resolutionResult": {},1567 "defaultedParamNames": [],1568 "genericSO": false,1569 "intentParamsPlusAllDefaults": {},1570 "matches": true,1571 "matchesVirtualInbound": false1572 }1573 ]1574 },1575 {1576 testDescription: "matching tile inbound + bExcludeTileInbounds=true parameter is given",1577 oParsedShellHash: { "semanticObject": "Action", "action": "toNewsTile", "params": {} },1578 bExcludeTileInbounds: true,1579 aInbounds: [1580 { /​/​ a tile inbound1581 "semanticObject": "Action",1582 "action": "toNewsTile",1583 "title": "News",1584 "resolutionResult": { },1585 "deviceTypes": { "desktop": true, "tablet": true, "phone": true },1586 "signature": {1587 "parameters": {},1588 "additionalParameters": "allowed"1589 },1590 "tileResolutionResult": {1591 "isCustomTile": true /​/​ filters out the inbound1592 /​/​ ... plus irrelevant data for this test...1593 }1594 }1595 ],1596 mockedUserDefaultValues: {},1597 expected: []1598 }1599 ].forEach(function (oFixture) {1600 asyncTest("_getMatchingInbounds: works as expected when " + oFixture.testDescription, function () {1601 var oSrvc = createService(),1602 fnRealGetService = sap.ushell.Container.getService;1603 /​/​ Mock User Defaults service1604 sinon.stub(sap.ushell.Container, "getService", function (sServiceName) {1605 if (sServiceName === "UserDefaultParameters") {1606 return { /​/​ a fake UserDefaultParameters service1607 getValue: function (sValueName) {1608 return new jQuery.Deferred().resolve({1609 value: oFixture.mockedUserDefaultValues[sValueName]1610 }).promise();1611 }1612 };1613 }1614 /​/​ else1615 return fnRealGetService(sServiceName);1616 });1617 var oIndex = oInboundIndex.createIndex(oFixture.aInbounds);1618 oSrvc._getMatchingInbounds(oFixture.oParsedShellHash, oIndex, { bExcludeTileInbounds: oFixture.bExcludeTileInbounds })1619 .done(function (aMatchingResults) {1620 ok(true, "promise was resolved");1621 if (!jQuery.isEmptyObject(oFixture.mockedUserDefaultValues)) {1622 ok(sap.ushell.Container.getService.calledWith("UserDefaultParameters"), "the UserDefaultParameters service was invoked");1623 }1624 /​*1625 * This test allows to compare inbounds by ids if1626 * integers are specified in the expectation.1627 */​1628 if (oFixture.expected.every(function (vArrayItem) {1629 return typeof vArrayItem === "number";1630 })) {1631 /​/​ compare only inbound results1632 var aExpectedInbounds = oFixture.expected.map(function (iResultNumber) {1633 return oFixture.aInbounds[iResultNumber];1634 }),1635 aGotInbounds = aMatchingResults.map(function (oMatchResult) {1636 return oMatchResult.inbound;1637 });1638 deepEqual(aGotInbounds, aExpectedInbounds, "match results reference expected inbounds");1639 } else {1640 /​/​ compare full result but ignore property originalInbound1641 deepEqual(removeCountsAndSortString(aMatchingResults),1642 oFixture.expected, "got expected matching results");1643 }1644 })1645 .fail(function () {1646 ok(false, "promise was resolved");1647 })1648 .always(function () {1649 start();1650 });1651 });1652 });1653 [1654 {1655 testDescription: "one inbound matches",1656 oIntent: mkInt("#Action-toappnavsample"),1657 aFakeInbounds: [1658 oTestHelper.createInbound("#Action-toappnavsample")1659 ],1660 expectedLogHeader: [1661 /​\[REPORT #1\] Matching Intent 'Action-toappnavsample' to inbounds/​,1662 /​form factor: <any>/​1663 ],1664 expectedLogBody: [1665 /​#Action-toappnavsample{<no params><\?>}/​,1666 /​No need to resolve references/​,1667 /​rematch was skipped/​,1668 /​Nothing to sort/​1669 ]1670 },1671 {1672 testDescription: "no inbounds match",1673 oIntent: mkInt("#Action-toappnavsample"),1674 aFakeInbounds: [1675 /​/​ nothing1676 ],1677 expectedLogHeader: [1678 /​\[REPORT #1\] Matching Intent 'Action-toappnavsample' to inbounds/​,1679 /​form factor: <any>/​1680 ],1681 expectedLogBody: [1682 /​No inbound was matched/​,1683 /​No need to resolve references/​,1684 /​rematch was skipped/​,1685 /​Nothing to sort/​1686 ]1687 },1688 {1689 testDescription: "two inbounds with the same name match",1690 oIntent: mkInt("#Action-toappnavsample"),1691 aFakeInbounds: [1692 oTestHelper.createInbound("#Action-toappnavsample{[default1:[value1]]}"),1693 oTestHelper.createInbound("#Action-toappnavsample{[default2:[value2]]}")1694 ],1695 expectedLogHeader: [1696 /​\[REPORT #1\] Matching Intent 'Action-toappnavsample' to inbounds/​,1697 /​form factor: <any>/​1698 ],1699 expectedLogBody: [1700 /​#Action-toappnavsample{\[default1:\[value1\]\]<o>}\n/​,1701 /​#Action-toappnavsample{\[default2:\[value2\]\]<o>}\n/​,1702 /​No need to resolve references/​,1703 /​rematch was skipped \(no references to resolve\)/​,1704 /​Sorted inbounds as follows:/​,1705 /​#Action-toappnavsample{\[default1:\[value1\]\]<o>}.*\n.*#Action-toappnavsample{\[default2:\[value2\]\]<o>}/​1706 ]1707 },1708 {1709 testDescription: "inbounds with sap priority are reported",1710 oIntent: mkInt("#Action-toappnavsample"),1711 aFakeInbounds: [1712 oTestHelper.createInbound("#Action-toappnavsample{[default1:[value1]],[sap-priority:[5]]}"),1713 oTestHelper.createInbound("#Action-toappnavsample{[default2:[value2]],[sap-priority:[10]]}")1714 ],1715 expectedLogHeader: [1716 /​\[REPORT #1\] Matching Intent 'Action-toappnavsample' to inbounds/​,1717 /​form factor: <any>/​1718 ],1719 expectedLogBody: [1720 /​Sorted inbounds as follows:/​,1721 /​\* 1 \* sap-priority: '10'([\s\S])+\* 1 \* sap-priority: '5'/​1722 ]1723 },1724 {1725 testDescription: "an inbound with references is resolved",1726 oIntent: mkInt("#Action-toappnavsample"),1727 aFakeInbounds: [1728 oTestHelper.createInbound("#Action-toappnavsample{[p1:[@paramName@]]}")1729 ],1730 expectedLogHeader: [1731 /​\[REPORT #1\] Matching Intent 'Action-toappnavsample' to inbounds/​,1732 /​form factor: <any>/​1733 ],1734 expectedLogBody: [1735 /​#Action-toappnavsample{\[p1:\[@paramName@\]\]<o>}\n/​,1736 /​Must resolve the following references:[\s\S]*paramName/​,1737 /​resolved references with the following values:[\s\S]*paramName: 'paramNameValue'/​1738 ]1739 },1740 {1741 testDescription: "two inbounds with references are matched, but only one is rematched",1742 oIntent: mkInt("#Action-toappnavsample?id=aValue"),1743 aFakeInbounds: [1744 oTestHelper.createInbound("#Action-toappnavsample{id:@a@}"), /​/​ id resolves to aValue (see test)1745 oTestHelper.createInbound("#Action-toappnavsample{id:@b@}") /​/​ id resolves to bValue (see test)1746 ],1747 expectedLogHeader: [1748 /​\[REPORT #1\] Matching Intent 'Action-toappnavsample[?]id=aValue' to inbounds/​,1749 /​form factor: <any>/​1750 ],1751 expectedLogBody: [1752 new RegExp([1753 "STAGE2: Resolve references",1754 "--------------------------",1755 "@ Must resolve the following references:",1756 " . a",1757 " . b",1758 ". resolved references with the following values:",1759 " . a: 'aValue'",1760 " . b: 'bValue'"1761 ].join("\n")),1762 new RegExp([1763 "STAGE3: Rematch with references",1764 "-------------------------------",1765 "The following inbounds re-matched:",1766 " . #Action-toappnavsample{id:@a@<o>}"1767 ].join("\n")),1768 new RegExp([1769 "STAGE4: Sort matched targets",1770 "----------------------------",1771 "Nothing to sort"1772 ].join("\n"))1773 ]1774 },1775 {1776 testDescription: "an inbound with reference is matched, but no inbounds are rematched",1777 oIntent: mkInt("#Action-toappnavsample?id=aValue"),1778 aFakeInbounds: [1779 oTestHelper.createInbound("#Action-toappnavsample{id:@b@}") /​/​ id resolves to bValue (see test)1780 ],1781 expectedLogHeader: [1782 /​\[REPORT #1\] Matching Intent 'Action-toappnavsample[?]id=aValue' to inbounds/​,1783 /​form factor: <any>/​1784 ],1785 expectedLogBody: [1786 new RegExp([1787 "STAGE2: Resolve references",1788 "--------------------------",1789 "@ Must resolve the following references:",1790 " . b",1791 ". resolved references with the following values:",1792 " . b: 'bValue'"1793 ].join("\n")),1794 new RegExp([1795 "STAGE3: Rematch with references",1796 "-------------------------------",1797 "- No inbounds re-matched"1798 ].join("\n")),1799 new RegExp([1800 "STAGE4: Sort matched targets",1801 "----------------------------",1802 "Nothing to sort"1803 ].join("\n"))1804 ]1805 }1806 ].forEach(function (oFixture) {1807 asyncTest("_getMatchingInbounds: reports inbound search correctly when " + oFixture.testDescription, function () {1808 var oSrvc = createService();1809 /​/​ Stub ReferenceResolver1810 var fnGetServiceOrig = sap.ushell.Container.getService;1811 sap.ushell.Container.getService = function (sServiceName) {1812 if (sServiceName === "ReferenceResolver") {1813 return {1814 resolveReferences: function (aRefs) {1815 return new jQuery.Deferred().resolve(aRefs.reduce(function (oResolvedRefs, sNextRef) {1816 oResolvedRefs[sNextRef] = sNextRef + "Value";1817 return oResolvedRefs;1818 }, {})).promise();1819 }1820 };1821 }1822 return fnGetServiceOrig.call(sap.ushell.Container, sServiceName);1823 };1824 /​/​ Check logging expectations via LogMock1825 sinon.stub(jQuery.sap.log, "debug");1826 sinon.stub(jQuery.sap.log, "error");1827 sinon.stub(jQuery.sap.log, "warning");1828 /​/​ getLevel called by CSTR/​Logger to determine logging is enabled1829 var oIndex = oInboundIndex.createIndex(oFixture.aFakeInbounds);1830 sinon.stub(oCSTRUtils, "isDebugEnabled").returns(true);1831 oSrvc._getMatchingInbounds(oFixture.oIntent, oIndex, oFixture.oConstraints)1832 .done(function (aMatchingResults) {1833 ok(true, "_getMatchingInbounds promise was resolved");1834 strictEqual(jQuery.sap.log.error.callCount, 0, "jQuery.sap.log.error was called 0 times");1835 strictEqual(jQuery.sap.log.warning.callCount, 0, "jQuery.sap.log.warning was called 0 times");1836 strictEqual(jQuery.sap.log.debug.callCount, 1, "jQuery.sap.log.debug was called 1 time");1837 /​/​ check that each regexp matches the call argument of debug1838 oFixture.expectedLogHeader.forEach(function (rLog) {1839 var sLogHeader = jQuery.sap.log.debug.getCall(0).args[0];1840 var bMatches = !!sLogHeader.match(rLog);1841 ok(bMatches, rLog.toString() + " was found in the log call." + (1842 bMatches ? "" : "Log header was: " + sLogHeader.replace(/​\n/​g, "\u21a9") /​/​ 21a9 enter key symbol1843 ));1844 });1845 oFixture.expectedLogBody.forEach(function (rLog) {1846 var sLogBody = jQuery.sap.log.debug.getCall(0).args[1];1847 var bMatches = !!sLogBody.match(rLog);1848 ok(bMatches, rLog.toString() + " was found in the log call." + (1849 bMatches ? "" : "Log body was: " + sLogBody.replace(/​\n/​g, "\u21a9") /​/​ 21a9 enter key symbol1850 ));1851 });1852 })1853 .fail(function () {1854 ok(false, "_getMatchingInbounds promise was resolved");1855 })1856 .always(function () {1857 start();1858 });1859 });1860 });1861 asyncTest("_resolveHashFragment: promise is rejected when navigation target cannot be resolved client side", function () {1862 sinon.stub(jQuery.sap.log, "error");1863 sinon.stub(jQuery.sap.log, "warning");1864 var oSrvc = createService();1865 /​/​ return empty -> cannot resolve matching targets1866 sinon.stub(oSrvc, "_getMatchingInbounds").returns(new jQuery.Deferred().resolve([]).promise());1867 oSrvc._resolveHashFragment("#hash-fragment", function () {} /​*fallback*/​)1868 .done(function () {1869 ok(false, "Promise was rejected");1870 })1871 .fail(function (sErrorMsg) {1872 ok(true, "Promise was rejected");1873 strictEqual(jQuery.sap.log.warning.getCalls().length, 1, "jQuery.sap.log.warning was called once");1874 strictEqual(jQuery.sap.log.error.getCalls().length, 0, "jQuery.sap.log.error was not called");1875 strictEqual(sErrorMsg, "Could not resolve navigation target", "Rejected with expected message");1876 })1877 .always(function () {1878 start();1879 });1880 });1881 asyncTest("_resolveHashFragment: promise is rejected when _getMatchingInbounds rejects", function () {1882 sinon.stub(jQuery.sap.log, "error");1883 sinon.stub(jQuery.sap.log, "warning");1884 var oSrvc = createService();1885 /​/​ rejects1886 sinon.stub(oSrvc, "_getMatchingInbounds").returns(new jQuery.Deferred().reject("Deliberate failure"));1887 oSrvc._resolveHashFragment("#hash-fragment", function () {} /​*fallback*/​)1888 .done(function () {1889 ok(false, "Promise was rejected");1890 })1891 .fail(function (sErrorMsg) {1892 ok(true, "Promise was rejected");1893 strictEqual(jQuery.sap.log.warning.getCalls().length, 0, "jQuery.sap.log.warning was not called");1894 strictEqual(jQuery.sap.log.error.getCalls().length, 1, "jQuery.sap.log.error was called once");1895 strictEqual(sErrorMsg, "Deliberate failure", "Rejected with expected message");1896 })1897 .always(function () {1898 start();1899 });1900 });1901 [1902 {1903 testDescription: "generic semantic object is passed",1904 sIntent: "#*-action"1905 },1906 {1907 testDescription: "empty semantic object is passed",1908 sIntent: "#-action"1909 },1910 {1911 testDescription: "* is passed in action",1912 sIntent: "#Object-*"1913 },1914 {1915 testDescription: "blank is passed in semantic object",1916 sCurrentFormFactor: "mobile",1917 sIntent: "# -*"1918 },1919 {1920 testDescription: "many blanks are passed in semantic object",1921 sCurrentFormFactor: "mobile",1922 sIntent: "# -*"1923 }1924 ].forEach(function (oFixture) {1925 asyncTest("_resolveHashFragment: rejects promise when " + oFixture.testDescription, function () {1926 var oSrvc = createService();1927 sinon.stub(jQuery.sap.log, "error");1928 /​/​ returns the default parameter names after resolution1929 sinon.stub(oSrvc, "_getMatchingInbounds").returns(1930 new jQuery.Deferred().resolve({1931 resolutionResult: {} /​/​ causes _resolveHashFragment promise to be resolved (in case test fails)1932 }).promise()1933 );1934 sinon.stub(utils, "getFormFactor").returns("desktop");1935 oSrvc._resolveHashFragment(oFixture.sIntent)1936 .done(function (oResolutionResult) {1937 ok(false, "promise was rejected");1938 })1939 .fail(function () {1940 ok(true, "promise was rejected");1941 strictEqual(jQuery.sap.log.error.getCalls().length, 1, "jQuery.sap.log.error was called once");1942 ok(jQuery.sap.log.error.getCall(0).args[0].indexOf("Could not parse shell hash") === 0,1943 "logged 'Could not parse shell hash ...'");1944 })1945 .always(function () {1946 start();1947 });1948 });1949 });1950 [1951 {1952 testName: "no inbounds are defined",1953 inbounds: [],1954 expectedParameters: { simple: {}, extended: {}}1955 },1956 {1957 testName: "inbounds contain non-overlapping user default placeholders",1958 inbounds: [1959 { semanticObject: "SomeObject",1960action: "action1",1961 signature: {1962 additionalParameters: "allowed",1963 parameters: {1964 "noUserDefault1": { filter: { value: "Some Value1" }, required: false },1965 "withUserDefault1": { filter: { value: "UserDefault.value1", format: "reference" }, required: true },1966 "withUserDefault2": { filter: { value: "UserDefault.value2", format: "reference" }, required: false },1967 "noUserDefault2": { filter: { value: "Some Value2" }, required: false },1968 "withUserDefault3": { filter: { value: "UserDefault.value3", format: "reference" }, required: true }1969 }1970 }1971 },1972 { semanticObject: "SomeObject2",1973action: "action2",1974 signature: {1975 additionalParameters: "allowed",1976 parameters: {1977 "noUserDefault3": { filter: { value: "Another Value1" }, required: false },1978 "withUserDefault4": { filter: { value: "UserDefault.value4", format: "reference" }, required: true },1979 "withUserDefault5": { filter: { value: "UserDefault.value5", format: "reference" }, required: false },1980 "noUserDefault4": { filter: { value: "Another Value2" }, required: false },1981 "withUserDefault6": { filter: { value: "UserDefault.value6", format: "reference" }, required: true }1982 }1983 }1984 }1985 ],1986 expectedParameters: {1987 simple: {"value1": {},1988"value2": {},1989"value3": {},1990"value4": {},1991 "value5": {},1992 "value6": {}},1993 extended: {}1994 }1995 },1996 {1997 testName: "inbounds contain other types of defaults",1998 inbounds: [1999 { semanticObject: "SomeObject",2000action: "action1",2001 signature: {2002 additionalParameters: "allowed",2003 parameters: {2004 "noUserDefault1": { filter: { value: "Some Value1" }, required: false },2005 "withUserDefault1": { filter: { value: "UserDefault.value1", format: "reference" }, required: true },2006 "withUserDefault2": { filter: { value: "MachineDefault.value2", format: "reference" }, required: false },2007 "noUserDefault2": { filter: { value: "Some Value2" }, required: false },2008 "withUserDefault3": { filter: { value: "UserDefault.value3", format: "reference" }, required: true }2009 }2010 }2011 },2012 { semanticObject: "SomeObject2",2013action: "action2",2014 signature: {2015 additionalParameters: "allowed",2016 parameters: {2017 "noUserDefault3": { filter: { value: "Another Value1" }, required: false },2018 "withUserDefault4": { filter: { value: "UserDefault.value4", format: "reference" }, required: true },2019 "withUserDefault5": { filter: { value: "SapDefault.value5", format: "reference" }, required: false },2020 "noUserDefault4": { filter: { value: "Another Value2" }, required: false },2021 "withUserDefault6": { filter: { value: "UserDefault.value6", format: "reference" }, required: true }2022 }2023 }2024 }2025 ],2026 expectedParameters: { simple: {"value1": {}, "value3": {}, "value4": {}, "value6": {}}, extended: {}}2027 },2028 {2029 testName: "inbounds contain overlapping user default placeholders",2030 inbounds: [2031 { semanticObject: "SomeObject",2032action: "action1",2033 signature: {2034 additionalParameters: "allowed",2035 parameters: {2036 "noUserDefault1": { filter: { value: "Some Value1" }, required: false },2037 "withUserDefault1": { filter: { value: "UserDefault.value1", format: "reference" }, required: false },2038 "withUserDefault2": { filter: { value: "UserDefault.value3", format: "reference" }, required: false },2039 "noUserDefault2": { filter: { value: "Some Value2" }, required: false },2040 "withUserDefault3": { filter: { value: "UserDefault.value2", format: "reference" }, required: false }2041 }2042 }2043 },2044 { semanticObject: "SomeObject2",2045action: "action2",2046 signature: {2047 additionalParameters: "allowed",2048 parameters: {2049 "noUserDefault3": { filter: { value: "Another Value1" }, required: false },2050 "withUserDefault4": { filter: { value: "UserDefault.value1", format: "reference" }, required: false },2051 "withUserDefault5": { filter: { value: "UserDefault.value2", format: "reference" }, required: false },2052 "noUserDefault4": { filter: { value: "Another Value2" }, required: false },2053 "withUserDefault6": { filter: { value: "UserDefault.value4", format: "reference" }, required: false }2054 }2055 }2056 }2057 ],2058 expectedParameters: { simple: {"value1": {}, "value2": {}, "value3": {}, "value4": {}}, extended: {}}2059 },2060 {2061 testName: "inbounds contain no user default placeholders",2062 inbounds: [2063 { semanticObject: "SomeObject",2064action: "action1",2065 signature: {2066 additionalParameters: "allowed",2067 parameters: {2068 "noUserDefault1": { filter: { value: "Some Value1" }, required: false },2069 "noUserDefault2": { filter: { value: "Some Value2" }, required: false }2070 }2071 }2072 },2073 { semanticObject: "SomeObject2",2074action: "action2",2075 signature: {2076 additionalParameters: "allowed",2077 parameters: {2078 "noUserDefault3": { filter: { value: "Another Value1" }, required: false },2079 "noUserDefault4": { filter: { value: "Another Value2" }, required: false }2080 }2081 }2082 }2083 ],2084 expectedParameters: { simple: {}, extended: {}}2085 },2086 {2087 testName: "inbounds contain a mix of filter values and user default values",2088 inbounds: [2089 { semanticObject: "SomeObject",2090action: "action1",2091 signature: {2092 additionalParameters: "allowed",2093 parameters: {2094 "noUserDefault1": { defaultValue: { value: "UserDefault.value1", format: "reference" }, required: false },2095 "noUserDefault2": { filter: { value: "UserDefault.value2", format: "reference" }, required: false }2096 }2097 }2098 },2099 { semanticObject: "SomeObject2",2100action: "action2",2101 signature: {2102 additionalParameters: "allowed",2103 parameters: {2104 "noUserDefault3": { filter: { value: "UserDefault.value3", format: "reference" }, required: false },2105 "noUserDefault4": { defaultValue: { value: "UserDefault.value4", format: "reference" }, required: false }2106 }2107 }2108 }2109 ],2110 expectedParameters: { simple: { "value1": {}, "value2": {}, "value3": {}, "value4": {}}, extended: {} }2111 }2112 ].forEach(function (oFixture) {2113 asyncTest("getUserDefaultParameterNames: returns default parameter names when " + oFixture.testName, function () {2114 var oSrvc = createService({2115 inbounds: oFixture.inbounds2116 }),2117 oParameterNamesPromise = oSrvc.getUserDefaultParameterNames();2118 if (typeof oParameterNamesPromise.done !== "function") {2119 ok(false, "getUserDefaultParameterNames returned a promise");2120 start();2121 return;2122 }2123 oParameterNamesPromise.done(function (oGotParameterNames) {2124 deepEqual(oGotParameterNames, oFixture.expectedParameters, "obtained expected parameter names");2125 }).always(function () {2126 start();2127 });2128 });2129 });2130 asyncTest("getUserDefaultParameterNames: rejects promise when private method throws", function () {2131 var oSrvc = createService(),2132 oParameterNamesPromise;2133 sinon.stub(oSrvc, "_getUserDefaultParameterNames").throws("deliberate exception");2134 oParameterNamesPromise = oSrvc.getUserDefaultParameterNames();2135 oParameterNamesPromise2136 .done(function (oGotParameterNames) {2137 ok(false, "promise was rejected");2138 })2139 .fail(function (sErrorMessage) {2140 ok(true, "promise was rejected");2141 strictEqual(sErrorMessage, "Cannot get user default parameters from inbounds: deliberate exception", "obtained expected error message");2142 })2143 .always(function () {2144 start();2145 });2146 });2147 [2148 {2149 testName: "no inbounds are defined",2150 inbounds: [],2151 expectedParameters: { simple: {}, extended: {}}2152 },2153 {2154 testName: "inbounds contain overlapping extended, not extended",2155 inbounds: [2156 { semanticObject: "SomeObject",2157action: "action1",2158 signature: {2159 additionalParameters: "allowed",2160 parameters: {2161 "noUserDefault1": { filter: { value: "Some Value1" }, required: false },2162 "withUserDefault1": { filter: { value: "UserDefault.extended.value1", format: "reference" }, required: true },2163 "withUserDefault2": { filter: { value: "UserDefault.extended.value2", format: "reference" }, required: false },2164 "noUserDefault2": { filter: { value: "Some Value2" }, required: false },2165 "withUserDefault3": { filter: { value: "UserDefault.value3", format: "reference" }, required: true }2166 }2167 }2168 },2169 { semanticObject: "SomeObject2",2170action: "action2",2171 signature: {2172 additionalParameters: "allowed",2173 parameters: {2174 "noUserDefault3": { filter: { value: "Another Value1" }, required: false },2175 "withUserDefault4": { filter: { value: "UserDefault.value1", format: "reference" }, required: true },2176 "withUserDefault5": { filter: { value: "UserDefault.value2", format: "reference" }, required: false },2177 "noUserDefault4": { filter: { value: "Another Value2" }, required: false },2178 "withUserDefault6": { filter: { value: "UserDefault.value6", format: "reference" }, required: true }2179 }2180 }2181 }2182 ],2183 expectedParameters: { simple: {"value1": {}, "value2": {}, "value3": {}, "value6": {}}, extended: {"value1": {}, "value2": {}}}2184 },2185 {2186 testName: "inbounds contain other types of defaults",2187 inbounds: [2188 { semanticObject: "SomeObject",2189action: "action1",2190 signature: {2191 additionalParameters: "allowed",2192 parameters: {2193 "noUserDefault1": { filter: { value: "UserDefault.extended.valuex" }, required: false },2194 "withUserDefault1": { filter: { value: "UserDefault.extended.value1", format: "reference" }, required: true },2195 "withUserDefault2": { filter: { value: "MachineDefault.value2", format: "reference" }, required: false },2196 "noUserDefault2": { filter: { value: "Some Value2" }, required: false },2197 "withUserDefault3": { filter: { value: "UserDefault.value3", format: "reference" }, required: true }2198 }2199 }2200 },2201 { semanticObject: "SomeObject2",2202action: "action2",2203 signature: {2204 additionalParameters: "allowed",2205 parameters: {2206 "noUserDefault3": { filter: { value: "Another Value1" }, required: false },2207 "withUserDefault4": { filter: { value: "UserDefault.value4", format: "reference" }, required: true },2208 "withUserDefault5": { filter: { value: "SapDefault.value5", format: "reference" }, required: false },2209 "noUserDefault4": { filter: { value: "Another Value2" }, required: false },2210 "withUserDefault6": { filter: { value: "UserDefault.value6", format: "reference" }, required: true }2211 }2212 }2213 }2214 ],2215 expectedParameters: { simple: {"value3": {}, "value4": {}, "value6": {}}, extended: {"value1": {}}}2216 },2217 {2218 testName: "inbounds contain overlapping user default placeholders",2219 inbounds: [2220 { semanticObject: "SomeObject",2221action: "action1",2222 signature: {2223 additionalParameters: "allowed",2224 parameters: {2225 "noUserDefault1": { filter: { value: "Some Value1" }, required: false },2226 "withUserDefault1": { filter: { value: "UserDefault.extended.value1", format: "reference" }, required: false },2227 "withUserDefault2": { filter: { value: "UserDefault.extended.value3", format: "reference" }, required: false },2228 "noUserDefault2": { filter: { value: "Some Value2" }, required: false },2229 "withUserDefault3": { filter: { value: "UserDefault.extended.value2", format: "reference" }, required: false }2230 }2231 }2232 },2233 { semanticObject: "SomeObject2",2234action: "action2",2235 signature: {2236 additionalParameters: "allowed",2237 parameters: {2238 "noUserDefault3": { filter: { value: "Another Value1" }, required: false },2239 "withUserDefault4": { filter: { value: "UserDefault.extended.value1", format: "reference" }, required: false },2240 "withUserDefault5": { filter: { value: "UserDefault.extended.value2", format: "reference" }, required: false },2241 "noUserDefault4": { filter: { value: "Another Value2" }, required: false },2242 "withUserDefault6": { filter: { value: "UserDefault.extended.value4", format: "reference" }, required: false }2243 }2244 }2245 }2246 ],2247 expectedParameters: { simple: {}, extended: {"value1": {}, "value2": {}, "value3": {}, "value4": {}}}2248 },2249 {2250 testName: "inbounds contain no user default placeholders",2251 inbounds: [2252 { semanticObject: "SomeObject",2253action: "action1",2254 signature: {2255 additionalParameters: "allowed",2256 parameters: {2257 "noUserDefault1": { filter: { value: "Some Value1" }, required: false },2258 "noUserDefault2": { filter: { value: "Some Value2" }, required: false }2259 }2260 }2261 },2262 { semanticObject: "SomeObject2",2263action: "action2",2264 signature: {2265 additionalParameters: "allowed",2266 parameters: {2267 "noUserDefault3": { filter: { value: "Another Value1" }, required: false },2268 "noUserDefault4": { filter: { value: "Another Value2" }, required: false }2269 }2270 }2271 }2272 ],2273 expectedParameters: {simple: {}, extended: {}}2274 },2275 {2276 testName: "inbounds contain a mix of filter values and user default values",2277 inbounds: [2278 { semanticObject: "SomeObject",2279action: "action1",2280 signature: {2281 additionalParameters: "allowed",2282 parameters: {2283 "noUserDefault1": { defaultValue: { value: "UserDefault.extended.value1", format: "reference" }, required: false },2284 "noUserDefault2": { filter: { value: "UserDefault.value2", format: "reference" }, required: false }2285 }2286 }2287 },2288 { semanticObject: "SomeObject2",2289action: "action2",2290 signature: {2291 additionalParameters: "allowed",2292 parameters: {2293 "noUserDefault3": { filter: { value: "UserDefault.value3", format: "reference" }, required: false },2294 "noUserDefault4": { defaultValue: { value: "UserDefault.extended.value4", format: "reference" }, required: false }2295 }2296 }2297 }2298 ],2299 expectedParameters: {simple: {"value2": {}, "value3": {}}, extended: {"value1": {}, "value4": {}}}2300 }2301 ].forEach(function (oFixture) {2302 asyncTest("getUserDefaultParameterNames: (Extended) returns extended default parameter names when " + oFixture.testName, function () {2303 var oSrvc = createService({2304 inbounds: oFixture.inbounds2305 }),2306 oInboundListPromise = oSrvc.getUserDefaultParameterNames();2307 if (typeof oInboundListPromise.done !== "function") {2308 ok(false, "getUserDefaultParameterNames returned a promise");2309 start();2310 return;2311 }2312 oInboundListPromise.done(function (aObtainedInbounds) {2313 deepEqual(aObtainedInbounds, oFixture.expectedParameters, "obtained expected parameter names");2314 }).always(function () {2315 start();2316 });2317 });2318 });2319 [2320 {2321 testDescription: "legacy parameter is provided",2322 sSemanticObject: "Object",2323 mBusinessParams: { "country": ["IT"] },2324 bIgnoreFormFactor: true,2325 bLegacySortParameter: true, /​/​ legacy sort parameter2326 sCurrentFormFactor: "desktop",2327 aMockedResolutionResults: [2328 {2329 "matches": true,2330 "resolutionResult": { "additionalInformation": "SAPUI5.Component=Currency.Component", "applicationType": "URL", "text": "Currency manager", "ui5ComponentName": "Currency.Component", "url": "/​url/​to/​currency?mode=desktop" },2331 "inbound": {2332 "title": "Currency manager",2333 "subTitle": "sub Title",2334 "shortTitle": "short Title",2335 "icon": "sap-icon:/​/​Fiori2/​F0018",2336 "semanticObject": "Object",2337"action": "ZZZ",2338 "resolutionResult": { "_original": { "text": "Currency manager" }, "additionalInformation": "SAPUI5.Component=Currency.Component", "applicationType": "URL", "text": "Currency manager (ignored text)", "ui5ComponentName": "Currency.Component", "url": "/​url/​to/​currency" },2339 "signature": { "parameters": { }, "additionalParameters": "ignored" }2340 }2341 },2342 { /​/​ simulate this result to have higher priority2343 "matches": true,2344 "resolutionResult": { "additionalInformation": "SAPUI5.Component=Currency.Component", "applicationType": "URL", "text": "Currency manager", "ui5ComponentName": "Currency.Component", "url": "/​url/​to/​currency?mode=desktop" },2345 "inbound": {2346 "title": "Currency manager",2347 "subTitle": "sub Title",2348 "shortTitle": "short Title",2349 "icon": "sap-icon:/​/​Fiori2/​F0018",2350 "semanticObject": "Object",2351"action": "bbb",2352 "resolutionResult": { "_original": { "text": "Currency manager" }, "additionalInformation": "SAPUI5.Component=Currency.Component", "applicationType": "URL", "text": "Currency manager (ignored text)", "ui5ComponentName": "Currency.Component", "url": "/​url/​to/​currency" },2353 "signature": { "parameters": {2354 "country": {2355 required: true2356 }2357 }}2358 }2359 },2360 {2361 "matches": true,2362 "resolutionResult": { "additionalInformation": "SAPUI5.Component=Currency.Component", "applicationType": "URL", "text": "Currency manager", "ui5ComponentName": "Currency.Component", "url": "/​url/​to/​currency?mode=desktop" },2363 "inbound": {2364 "title": "Currency manager",2365 "subTitle": "sub Title",2366 "shortTitle": "short Title",2367 "icon": "sap-icon:/​/​Fiori2/​F0018",2368 "semanticObject": "Object",2369"action": "aaa",2370 "resolutionResult": { "_original": { "text": "Currency manager" }, "additionalInformation": "SAPUI5.Component=Currency.Component", "applicationType": "URL", "text": "Currency manager (ignored text)", "ui5ComponentName": "Currency.Component", "url": "/​url/​to/​currency" },2371 "signature": { "parameters": { }, "additionalParameters": "ignored" }2372 }2373 }2374 ],2375 expectedSemanticObjectLinks: [2376 { "intent": "#Object-ZZZ",2377 "text": "Currency manager",2378 "icon": "sap-icon:/​/​Fiori2/​F0018",2379 "subTitle": "sub Title",2380 "shortTitle": "short Title" },2381 { "intent": "#Object-aaa",2382 "text": "Currency manager",2383 "icon": "sap-icon:/​/​Fiori2/​F0018",2384 "subTitle": "sub Title",2385 "shortTitle": "short Title"},2386 { "intent": "#Object-bbb?country=IT",2387 "text": "Currency manager",2388 "icon": "sap-icon:/​/​Fiori2/​F0018",2389 "subTitle": "sub Title",2390 "shortTitle": "short Title"}2391 ],2392 expectedWarningCalls: [2393 [2394 "the parameter 'sortResultOnTexts' was experimantal and is no longer supported",2395 "getLinks results will be sorted by 'intent'",2396 "sap.ushell.services.ClientsideTargetResolution"2397 ]2398 ]2399 },2400 {2401 testDescription: "alphabetical order on priority is expected in result",2402 sSemanticObject: "Object",2403 mBusinessParams: { "country": ["IT"] },2404 bIgnoreFormFactor: true,2405 sSortResultsBy: "priority",2406 sCurrentFormFactor: "desktop",2407 aMockedResolutionResults: [2408 { /​/​ simulate this result to have higher priority2409 "matches": true,2410 "resolutionResult": { "additionalInformation": "SAPUI5.Component=Currency.Component", "applicationType": "URL", "text": "Currency manager", "ui5ComponentName": "Currency.Component", "url": "/​url/​to/​currency?mode=desktop" },2411 "inbound": {2412 "title": "Currency manager",2413 "subTitle": "sub Title",2414 "shortTitle": "short Title",2415 "icon": "sap-icon:/​/​Fiori2/​F0018",2416 "semanticObject": "Object",2417"action": "bbb",2418 "resolutionResult": { "_original": { "text": "Currency manager" }, "additionalInformation": "SAPUI5.Component=Currency.Component", "applicationType": "URL", "text": "Currency manager (ignored text)", "ui5ComponentName": "Currency.Component", "url": "/​url/​to/​currency" },2419 "signature": { "parameters": {2420 "country": {2421 required: true2422 }2423 }}2424 }2425 },2426 {2427 "matches": true,2428 "resolutionResult": { "additionalInformation": "SAPUI5.Component=Currency.Component", "applicationType": "URL", "text": "Currency manager", "ui5ComponentName": "Currency.Component", "url": "/​url/​to/​currency?mode=desktop" },2429 "inbound": {2430 "title": "Currency manager",2431 "subTitle": "sub Title",2432 "shortTitle": "short Title",2433 "icon": "sap-icon:/​/​Fiori2/​F0018",2434 "semanticObject": "Object",2435"action": "ccc",2436 "resolutionResult": { "_original": { "text": "Currency manager" }, "additionalInformation": "SAPUI5.Component=Currency.Component", "applicationType": "URL", "text": "Currency manager (ignored text)", "ui5ComponentName": "Currency.Component", "url": "/​url/​to/​currency" },2437 "signature": { "parameters": { }, "additionalParameters": "ignored" }2438 }2439 },2440 {2441 "matches": true,2442 "resolutionResult": { "additionalInformation": "SAPUI5.Component=Currency.Component", "applicationType": "URL", "text": "Currency manager", "ui5ComponentName": "Currency.Component", "url": "/​url/​to/​currency?mode=desktop" },2443 "inbound": {2444 "title": "Currency manager",2445 "subTitle": "sub Title",2446 "shortTitle": "short Title",2447 "icon": "sap-icon:/​/​Fiori2/​F0018",2448 "semanticObject": "Object",2449"action": "aaa",2450 "resolutionResult": { "_original": { "text": "Currency manager" }, "additionalInformation": "SAPUI5.Component=Currency.Component", "applicationType": "URL", "text": "Currency manager (ignored text)", "ui5ComponentName": "Currency.Component", "url": "/​url/​to/​currency" },2451 "signature": { "parameters": { }, "additionalParameters": "ignored" }2452 }2453 }2454 ],2455 expectedSemanticObjectLinks: [2456 { "intent": "#Object-bbb?country=IT",2457 "text": "Currency manager",2458 "icon": "sap-icon:/​/​Fiori2/​F0018",2459 "subTitle": "sub Title",2460 "shortTitle": "short Title"},2461 { "intent": "#Object-ccc",2462 "text": "Currency manager",2463 "icon": "sap-icon:/​/​Fiori2/​F0018",2464 "subTitle": "sub Title",2465 "shortTitle": "short Title"},2466 { "intent": "#Object-aaa",2467 "text": "Currency manager",2468 "icon": "sap-icon:/​/​Fiori2/​F0018",2469 "subTitle": "sub Title",2470 "shortTitle": "short Title" }2471 ]2472 },2473 {2474 testDescription: "alphabetical order on intents is expected in result",2475 sSemanticObject: "Object",2476 mBusinessParams: { "country": ["IT"] },2477 bIgnoreFormFactor: true,2478 sCurrentFormFactor: "desktop",2479 aMockedResolutionResults: [2480 { /​/​ simulate this result to have higher priority2481 "matches": true,2482 "resolutionResult": { "additionalInformation": "SAPUI5.Component=Currency.Component", "applicationType": "URL", "text": "Currency manager", "ui5ComponentName": "Currency.Component", "url": "/​url/​to/​currency?mode=desktop" },2483 "inbound": {2484 "title": "Currency manager",2485 "subTitle": "sub Title",2486 "shortTitle": "short Title",2487 "icon": "sap-icon:/​/​Fiori2/​F0018",2488 "semanticObject": "Object",2489"action": "bbb",2490 "resolutionResult": { "_original": { "text": "Currency manager" }, "additionalInformation": "SAPUI5.Component=Currency.Component", "applicationType": "URL", "text": "Currency manager (ignored text)", "ui5ComponentName": "Currency.Component", "url": "/​url/​to/​currency" },2491 "signature": { "parameters": {2492 "country": {2493 required: true2494 }2495 }}2496 }2497 },2498 {2499 "matches": true,2500 "resolutionResult": { "additionalInformation": "SAPUI5.Component=Currency.Component", "applicationType": "URL", "text": "Currency manager", "ui5ComponentName": "Currency.Component", "url": "/​url/​to/​currency?mode=desktop" },2501 "inbound": {2502 "title": "Currency manager",2503 "subTitle": "sub Title",2504 "shortTitle": "short Title",2505 "icon": "sap-icon:/​/​Fiori2/​F0018",2506 "semanticObject": "Object",2507"action": "ccc",2508 "resolutionResult": { "_original": { "text": "Currency manager" }, "additionalInformation": "SAPUI5.Component=Currency.Component", "applicationType": "URL", "text": "Currency manager (ignored text)", "ui5ComponentName": "Currency.Component", "url": "/​url/​to/​currency" },2509 "signature": { "parameters": { }, "additionalParameters": "ignored" }2510 }2511 },2512 {2513 "matches": true,2514 "resolutionResult": { "additionalInformation": "SAPUI5.Component=Currency.Component", "applicationType": "URL", "text": "Currency manager", "ui5ComponentName": "Currency.Component", "url": "/​url/​to/​currency?mode=desktop" },2515 "inbound": {2516 "title": "Currency manager",2517 "subTitle": "sub Title",2518 "shortTitle": "short Title",2519 "icon": "sap-icon:/​/​Fiori2/​F0018",2520 "semanticObject": "Object",2521"action": "aaa",2522 "resolutionResult": { "_original": { "text": "Currency manager" }, "additionalInformation": "SAPUI5.Component=Currency.Component", "applicationType": "URL", "text": "Currency manager (ignored text)", "ui5ComponentName": "Currency.Component", "url": "/​url/​to/​currency" },2523 "signature": { "parameters": { }, "additionalParameters": "ignored" }2524 }2525 }2526 ],2527 expectedSemanticObjectLinks: [2528 { "intent": "#Object-aaa",2529 "text": "Currency manager",2530 "icon": "sap-icon:/​/​Fiori2/​F0018",2531 "subTitle": "sub Title",2532 "shortTitle": "short Title"2533 },2534 { "intent": "#Object-bbb?country=IT",2535 "text": "Currency manager",2536 "icon": "sap-icon:/​/​Fiori2/​F0018",2537 "subTitle": "sub Title",2538 "shortTitle": "short Title"},2539 { "intent": "#Object-ccc",2540 "text": "Currency manager",2541 "icon": "sap-icon:/​/​Fiori2/​F0018",2542 "subTitle": "sub Title",2543 "shortTitle": "short Title"}2544 ],2545 expectedWarningCalls: [2546 [2547 "Passing positional arguments to getLinks is deprecated",2548 "Please use nominal arguments instead",2549 "sap.ushell.services.ClientSideTargetResolution"2550 ]2551 ]2552 },2553 {2554 testDescription: "alphabetical order on texts is expected in result",2555 sSemanticObject: "Object",2556 mBusinessParams: { "country": ["IT"] },2557 bIgnoreFormFactor: true,2558 sSortResultsBy: "text",2559 sCurrentFormFactor: "desktop",2560 aMockedResolutionResults: [2561 { /​/​ simulate this result to have higher priority2562 "matches": true,2563 "resolutionResult": { "additionalInformation": "SAPUI5.Component=Currency.Component", "applicationType": "URL", "text": "Currency manager", "ui5ComponentName": "Currency.Component", "url": "/​url/​to/​currency?mode=desktop" },2564 "inbound": {2565 "title": "Currency managerC",2566 "shortTitle": "short Title",2567 "subTitle": "sub Title",2568 "icon": "sap-icon:/​/​Fiori2/​F0018",2569 "semanticObject": "Object",2570"action": "aaa",2571 "resolutionResult": { "_original": { "text": "Currency manager" }, "additionalInformation": "SAPUI5.Component=Currency.Component", "applicationType": "URL", "text": "Currency manager (ignored text)", "ui5ComponentName": "Currency.Component", "url": "/​url/​to/​currency" },2572 "signature": { "parameters": {2573 "country": {2574 required: true2575 }2576 }}2577 }2578 },2579 {2580 "matches": true,2581 "resolutionResult": { "additionalInformation": "SAPUI5.Component=Currency.Component", "applicationType": "URL", "text": "Currency manager", "ui5ComponentName": "Currency.Component", "url": "/​url/​to/​currency?mode=desktop" },2582 "inbound": {2583 "title": "Currency managerA",2584 "shortTitle": "short Title",2585 "subTitle": "sub Title",2586 "icon": "sap-icon:/​/​Fiori2/​F0018",2587 "semanticObject": "Object",2588"action": "bbb",2589 "resolutionResult": { "_original": { "text": "Currency manager" }, "additionalInformation": "SAPUI5.Component=Currency.Component", "applicationType": "URL", "text": "Currency manager (ignored text)", "ui5ComponentName": "Currency.Component", "url": "/​url/​to/​currency" },2590 "signature": { "parameters": { }, "additionalParameters": "ignored" }2591 }2592 },2593 {2594 "matches": true,2595 "resolutionResult": { "additionalInformation": "SAPUI5.Component=Currency.Component", "applicationType": "URL", "text": "Currency manager", "ui5ComponentName": "Currency.Component", "url": "/​url/​to/​currency?mode=desktop" },2596 "inbound": {2597 "title": "Currency managerB",2598 "shortTitle": "short Title",2599 "subTitle": "sub Title",2600 "icon": "sap-icon:/​/​Fiori2/​F0018",2601 "semanticObject": "Object",2602"action": "ccc",2603 "resolutionResult": { "_original": { "text": "Currency manager" }, "additionalInformation": "SAPUI5.Component=Currency.Component", "applicationType": "URL", "text": "Currency manager (ignored text)", "ui5ComponentName": "Currency.Component", "url": "/​url/​to/​currency" },2604 "signature": { "parameters": { }, "additionalParameters": "ignored" }2605 }2606 }2607 ],2608 expectedSemanticObjectLinks: [2609 { "intent": "#Object-bbb",2610 "text": "Currency managerA",2611 "icon": "sap-icon:/​/​Fiori2/​F0018",2612 "subTitle": "sub Title",2613 "shortTitle": "short Title"},2614 { "intent": "#Object-ccc",2615 "text": "Currency managerB",2616 "icon": "sap-icon:/​/​Fiori2/​F0018",2617 "subTitle": "sub Title",2618 "shortTitle": "short Title" },2619 { "intent": "#Object-aaa?country=IT",2620 "text": "Currency managerC",2621 "icon": "sap-icon:/​/​Fiori2/​F0018",2622 "subTitle": "sub Title",2623 "shortTitle": "short Title" }2624 ]2625 },2626 {2627 /​/​ multiple inbounds are filtered in this case as the URL looks the same2628 testDescription: "multiple inbounds that look identical are matched",2629 sSemanticObject: "Action",2630 mBusinessParams: {},2631 bIgnoreFormFactor: true,2632 sCurrentFormFactor: "desktop",2633 aMockedResolutionResults: [2634 {2635 "matches": true,2636 "resolutionResult": { "additionalInformation": "SAPUI5.Component=Currency.Component", "applicationType": "URL", "text": "Currency manager", "ui5ComponentName": "Currency.Component", "url": "/​url/​to/​currency?mode=desktop" },2637 "inbound": {2638 "title": "Currency manager",2639 "shortTitle": "short Title",2640 "subTitle": "sub Title",2641 "icon": "sap-icon:/​/​Fiori2/​F0018",2642 "semanticObject": "Action",2643"action": "actionX",2644 "resolutionResult": { "additionalInformation": "SAPUI5.Component=Currency.Component", "applicationType": "URL", "text": "Currency manager (ignored text)", "ui5ComponentName": "Currency.Component", "url": "/​url/​to/​currency" },2645 "signature": {2646 "parameters": {2647 "mode": {2648 "required": false,2649 "defaultValue": { value: "DefaultValue1" } /​/​ ignored in result2650 }2651 }2652 }2653 }2654 },2655 {2656 "matches": true,2657 "resolutionResult": { "additionalInformation": "SAPUI5.Component=Currency.Component", "applicationType": "URL", "text": "Currency manager", "ui5ComponentName": "Currency.Component", "url": "/​url/​to/​currency?mode=desktop" },2658 "inbound": {2659 "title": "Currency manager",2660 "subTitle": "sub Title",2661 "shortTitle": "short Title",2662 "icon": "sap-icon:/​/​Fiori2/​F0018",2663 "semanticObject": "Action",2664"action": "actionX",2665 "resolutionResult": { "additionalInformation": "SAPUI5.Component=Currency.Component", "applicationType": "URL", "text": "Currency manager (ignored text)", "ui5ComponentName": "Currency.Component", "url": "/​url/​to/​currency" },2666 "signature": {2667 "parameters": { } /​/​ this inbound has not parameter2668 }2669 }2670 }2671 ],2672 expectedSemanticObjectLinks: [2673 { "intent": "#Action-actionX", /​/​ note "?" removed from parameter2674 "text": "Currency manager",2675 "icon": "sap-icon:/​/​Fiori2/​F0018",2676 "subTitle": "sub Title",2677 "shortTitle": "short Title"}2678 ],2679 expectedWarningCalls: [2680 [2681 "Passing positional arguments to getLinks is deprecated",2682 "Please use nominal arguments instead",2683 "sap.ushell.services.ClientSideTargetResolution"2684 ]2685 ]2686 },2687 {2688 testDescription: "matching target exists and business parameters are specified",2689 sSemanticObject: "Action",2690 mBusinessParams: { "ParamName1": "value", "ParamName2": ["value1", "value2"] }, /​/​ NOTE: parameters provided2691 bIgnoreFormFactor: true,2692 sCurrentFormFactor: "desktop",2693 aMockedResolutionResults: [{2694 /​/​ ignore certain fields not needed for the test2695 "matches": true,2696 "resolutionResult": {2697 "additionalInformation": "SAPUI5.Component=Currency.Component",2698 "applicationType": "URL",2699 "text": "Currency manager",2700 "ui5ComponentName": "Currency.Component",2701 "url": "/​url/​to/​currency?mode=desktop"2702 },2703 "inbound": {2704 "title": "Currency manager",2705 "icon": "sap-icon:/​/​Fiori2/​F0018",2706 "shortTitle": "short Title",2707 "subTitle": "sub Title",2708 "semanticObject": "Action",2709"action": "action1",2710 "resolutionResult": {2711 "additionalInformation": "SAPUI5.Component=Currency.Component",2712 "applicationType": "URL",2713 "text": "Currency manager (ignored text)", /​/​ ignored2714 "ui5ComponentName": "Currency.Component",2715 "url": "/​url/​to/​currency"2716 },2717 "signature": {2718 "additionalParameters": "ignored",2719 "parameters": {2720 "mode": {2721 "required": false,2722 "defaultValue": { value: "DefaultValue" } /​/​ ignored in result2723 }2724 }2725 }2726 }2727 }],2728 expectedSemanticObjectLinks: [2729 { "intent": "#Action-action1", /​/​ only return intent parameters that are mentioned in Inbound2730 "text": "Currency manager",2731 "icon": "sap-icon:/​/​Fiori2/​F0018",2732 "subTitle": "sub Title",2733 "shortTitle": "short Title"}2734 ],2735 expectedWarningCalls: [2736 [2737 "Passing positional arguments to getLinks is deprecated",2738 "Please use nominal arguments instead",2739 "sap.ushell.services.ClientSideTargetResolution"2740 ]2741 ]2742 },2743 {2744 testDescription: "matching target has default parameter that overlaps with intent parameter",2745 sSemanticObject: "Action",2746 mBusinessParams: { "ParamName1": "value", "ParamName2": ["value1", "value2"] }, /​/​ NOTE: parameters provided2747 bIgnoreFormFactor: true,2748 sCurrentFormFactor: "desktop",2749 aMockedResolutionResults: [{2750 /​/​ ignore certain fields not needed for the test2751 "matches": true,2752 "resolutionResult": {2753 "additionalInformation": "SAPUI5.Component=Currency.Component",2754 "applicationType": "URL",2755 "text": "Currency manager",2756 "ui5ComponentName": "Currency.Component",2757 "url": "/​url/​to/​currency?mode=desktop"2758 },2759 "inbound": {2760 "title": "Currency manager",2761 "shortTitle": "short Title",2762 "subTitle": "sub Title",2763 "icon": "sap-icon:/​/​Fiori2/​F0018",2764 "semanticObject": "Action",2765"action": "action1",2766 "resolutionResult": {2767 "additionalInformation": "SAPUI5.Component=Currency.Component",2768 "applicationType": "URL",2769 "text": "Currency manager (ignored text)", /​/​ ignored2770 "ui5ComponentName": "Currency.Component",2771 "url": "/​url/​to/​currency"2772 },2773 "signature": {2774 "additionalParameters": "ignored",2775 "parameters": {2776 "ParamName1": {2777 "required": false,2778 "defaultValue": { value: "DefaultValue" }2779 }2780 }2781 }2782 }2783 }],2784 expectedSemanticObjectLinks: [2785 { "intent": "#Action-action1?ParamName1=value", /​/​ only ParamName1 is mentioned in Inbound2786 "text": "Currency manager",2787 "icon": "sap-icon:/​/​Fiori2/​F0018",2788 "subTitle": "sub Title",2789 "shortTitle": "short Title" }2790 ],2791 expectedWarningCalls: [2792 [2793 "Passing positional arguments to getLinks is deprecated",2794 "Please use nominal arguments instead",2795 "sap.ushell.services.ClientSideTargetResolution"2796 ]2797 ]2798 },2799 {2800 testDescription: "sap-system parameter specified in intent",2801 sSemanticObject: "Action",2802 mBusinessParams: { "sap-system": ["CC2"] },2803 bIgnoreFormFactor: true,2804 sCurrentFormFactor: "desktop",2805 aMockedResolutionResults: [{2806 /​/​ ignore certain fields not needed for the test2807 "matches": true,2808 "resolutionResult": {2809 "additionalInformation": "SAPUI5.Component=Currency.Component",2810 "applicationType": "URL",2811 "text": "Currency manager",2812 "ui5ComponentName": "Currency.Component",2813 "url": "/​url/​to/​currency?mode=desktop"2814 },2815 "inbound": {2816 "semanticObject": "Action",2817"action": "action1",2818 "title": "Currency manager",2819 "icon": "sap-icon:/​/​Fiori2/​F0018",2820 "shortTitle": "short Title",2821 "subTitle": "sub Title",2822 "resolutionResult": {2823 "additionalInformation": "SAPUI5.Component=Currency.Component",2824 "applicationType": "URL",2825 "text": "Currency manager (ignored text)", /​/​ ignored2826 "ui5ComponentName": "Currency.Component",2827 "url": "/​url/​to/​currency"2828 },2829 "signature": {2830 "additionalParameters": "ignored",2831 "parameters": {2832 "ParamName1": {2833 "required": false,2834 "defaultValue": { value: "DefaultValue" }2835 }2836 }2837 }2838 }2839 }],2840 expectedSemanticObjectLinks: [2841 { "intent": "#Action-action1?sap-system=CC2",2842 "text": "Currency manager",2843 "icon": "sap-icon:/​/​Fiori2/​F0018",2844 "subTitle": "sub Title",2845 "shortTitle": "short Title" }2846 ],2847 expectedWarningCalls: [2848 [2849 "Passing positional arguments to getLinks is deprecated",2850 "Please use nominal arguments instead",2851 "sap.ushell.services.ClientSideTargetResolution"2852 ]2853 ]2854 },2855 {2856 testDescription: "sap-system and other parameters specified in intent (additionalParameters: allowed)",2857 sSemanticObject: "Action",2858 mBusinessParams: {2859 "sap-system": ["CC2"],2860 "paramName1": ["paramValue1"],2861 "paramName2": ["paramValue2"]2862 },2863 bIgnoreFormFactor: true,2864 sCurrentFormFactor: "desktop",2865 aMockedResolutionResults: [{2866 /​/​ ignore certain fields not needed for the test2867 "matches": true,2868 "resolutionResult": {2869 "additionalInformation": "SAPUI5.Component=Currency.Component",2870 "applicationType": "URL",2871 "text": "Currency manager",2872 "ui5ComponentName": "Currency.Component",2873 "url": "/​url/​to/​currency?mode=desktop"2874 },2875 "inbound": {2876 "semanticObject": "Action",2877"action": "action1",2878 "title": "Currency manager",2879 "shortTitle": "short Title",2880 "subTitle": "sub Title",2881 "icon": "sap-icon:/​/​Fiori2/​F0018",2882 "resolutionResult": {2883 "additionalInformation": "SAPUI5.Component=Currency.Component",2884 "applicationType": "URL",2885 "text": "Currency manager (ignored text)", /​/​ ignored2886 "ui5ComponentName": "Currency.Component",2887 "url": "/​url/​to/​currency"2888 },2889 "signature": {2890 "additionalParameters": "allowed", /​/​ non overlapping parameters added to result2891 "parameters": {2892 "paramName1": {2893 "required": false,2894 "defaultValue": { value: "DefaultValue" }2895 }2896 }2897 }2898 }2899 }],2900 expectedSemanticObjectLinks: [2901 { "intent": "#Action-action1?paramName1=paramValue1&paramName2=paramValue2&sap-system=CC2",2902 "text": "Currency manager",2903 "icon": "sap-icon:/​/​Fiori2/​F0018",2904 "subTitle": "sub Title",2905 "shortTitle": "short Title" }2906 ],2907 expectedWarningCalls: [2908 [2909 "Passing positional arguments to getLinks is deprecated",2910 "Please use nominal arguments instead",2911 "sap.ushell.services.ClientSideTargetResolution"2912 ]2913 ]2914 },2915 {2916 testDescription: "sap-system and other parameters specified in intent (additionalParameters: ignored)",2917 sSemanticObject: "Action",2918 mBusinessParams: {2919 "sap-system": ["CC2"],2920 "paramName1": ["paramValue1"],2921 "paramName2": ["paramValue2"]2922 },2923 bIgnoreFormFactor: true,2924 sCurrentFormFactor: "desktop",2925 aMockedResolutionResults: [{2926 /​/​ ignore certain fields not needed for the test2927 "matches": true,2928 "resolutionResult": {2929 "additionalInformation": "SAPUI5.Component=Currency.Component",2930 "applicationType": "URL",2931 "text": "Currency manager",2932 "ui5ComponentName": "Currency.Component",2933 "url": "/​url/​to/​currency?mode=desktop"2934 },2935 "inbound": {2936 "title": "Currency manager",2937 "icon": "sap-icon:/​/​Fiori2/​F0018",2938 "subTitle": "sub Title",2939 "shortTitle": "short Title",2940 "semanticObject": "Action",2941"action": "action1",2942 "resolutionResult": {2943 "additionalInformation": "SAPUI5.Component=Currency.Component",2944 "applicationType": "URL",2945 "text": "Currency manager (ignored text)", /​/​ ignored2946 "ui5ComponentName": "Currency.Component",2947 "url": "/​url/​to/​currency"2948 },2949 "signature": {2950 "additionalParameters": "ignored",2951 "parameters": {2952 "paramName1": {2953 "required": false,2954 "defaultValue": { value: "DefaultValue" }2955 }2956 }2957 }2958 }2959 }],2960 expectedSemanticObjectLinks: [2961 { "intent": "#Action-action1?paramName1=paramValue1&sap-system=CC2",2962 "text": "Currency manager",2963 "icon": "sap-icon:/​/​Fiori2/​F0018",2964 "subTitle": "sub Title",2965 "shortTitle": "short Title" }2966 ],2967 expectedWarningCalls: [2968 [2969 "Passing positional arguments to getLinks is deprecated",2970 "Please use nominal arguments instead",2971 "sap.ushell.services.ClientSideTargetResolution"2972 ]2973 ]2974 },2975 {2976 testDescription: "matching target has required parameter that overlaps with intent parameter",2977 sSemanticObject: "Action",2978 mBusinessParams: { "ParamName1": "value", "ParamName2": ["value1", "value2"] }, /​/​ NOTE: parameters provided2979 bIgnoreFormFactor: true,2980 sCurrentFormFactor: "desktop",2981 aMockedResolutionResults: [{2982 /​/​ ignore certain fields not needed for the test2983 "matches": true,2984 "resolutionResult": {2985 "additionalInformation": "SAPUI5.Component=Currency.Component",2986 "applicationType": "URL",2987 "text": "Currency manager",2988 "ui5ComponentName": "Currency.Component",2989 "url": "/​url/​to/​currency?mode=desktop"2990 },2991 "inbound": {2992 "title": "Currency manager",2993 "subTitle": "sub Title",2994 "shortTitle": "short Title",2995 "icon": "sap-icon:/​/​Fiori2/​F0018",2996 "semanticObject": "Action",2997"action": "action1",2998 "resolutionResult": {2999 "additionalInformation": "SAPUI5.Component=Currency.Component",3000 "applicationType": "URL",3001 "text": "Currency manager (ignored text)", /​/​ ignored3002 "ui5ComponentName": "Currency.Component",3003 "url": "/​url/​to/​currency"3004 },3005 "signature": {3006 "additionalParameters": "ignored",3007 "parameters": {3008 "ParamName2": {3009 "required": true3010 }3011 }3012 }3013 }3014 }],3015 expectedSemanticObjectLinks: [3016 { "intent": "#Action-action1?ParamName2=value1&ParamName2=value2", /​/​ only ParamName2 is mentioned in Inbound3017 "text": "Currency manager",3018 "icon": "sap-icon:/​/​Fiori2/​F0018",3019 "subTitle": "sub Title",3020 "shortTitle": "short Title" }3021 ],3022 expectedWarningCalls: [3023 [3024 "Passing positional arguments to getLinks is deprecated",3025 "Please use nominal arguments instead",3026 "sap.ushell.services.ClientSideTargetResolution"3027 ]3028 ]3029 },3030 {3031 testDescription: "function called with * semantic object",3032 sSemanticObject: "*",3033 mBusinessParams: { "ParamName1": "value", "ParamName2": ["value1", "value2"] }, /​/​ NOTE: parameters provided3034 bIgnoreFormFactor: true,3035 sCurrentFormFactor: "desktop",3036 aMockedResolutionResults: [{ /​/​ a inbound with generic semantic object3037 "matches": true,3038 "resolutionResult": {3039 "additionalInformation": "SAPUI5.Component=Currency.Component",3040 "applicationType": "URL",3041 "text": "Currency manager",3042 "ui5ComponentName": "Currency.Component",3043 "url": "/​url/​to/​currency?mode=desktop"3044 },3045 "inbound": {3046 "title": "Currency manager",3047 "subTitle": "sub Title",3048 "shortTitle": "short Title",3049 "icon": "sap-icon:/​/​Fiori2/​F0018",3050 "semanticObject": "*",3051 "action": "action",3052 "resolutionResult": {3053 "additionalInformation": "SAPUI5.Component=Currency.Component",3054 "applicationType": "URL",3055 "text": "Currency manager (ignored text)", /​/​ ignored3056 "ui5ComponentName": "Currency.Component",3057 "url": "/​url/​to/​currency"3058 },3059 "signature": {3060 "parameters": {3061 "mode": {3062 "required": false,3063 "defaultValue": { value: "DefaultValue" } /​/​ ignored in result3064 }3065 }3066 }3067 }3068 }],3069 expectedSemanticObjectLinks: [], /​/​ Inbound should be filtered out3070 expectedWarningCalls: [3071 [3072 "Passing positional arguments to getLinks is deprecated",3073 "Please use nominal arguments instead",3074 "sap.ushell.services.ClientSideTargetResolution"3075 ]3076 ]3077 },3078 {3079 testDescription: "function called with empty string semantic object",3080 sSemanticObject: "", /​/​ should match all3081 mBusinessParams: { "ParamName1": "value", "ParamName2": ["value1", "value2"] }, /​/​ NOTE: parameters provided3082 bIgnoreFormFactor: true,3083 sCurrentFormFactor: "desktop",3084 aMockedResolutionResults: [{ /​/​ a inbound with generic semantic object3085 "matches": true,3086 "resolutionResult": {3087 "additionalInformation": "SAPUI5.Component=Currency.Component",3088 "applicationType": "URL",3089 "text": "Currency manager",3090 "ui5ComponentName": "Currency.Component",3091 "url": "/​url/​to/​currency?mode=desktop"3092 },3093 "inbound": {3094 "title": "Currency manager",3095 "subTitle": "sub Title",3096 "shortTitle": "short Title",3097 "icon": "sap-icon:/​/​Fiori2/​F0018",3098 "semanticObject": "*",3099 "action": "action",3100 "resolutionResult": {3101 "additionalInformation": "SAPUI5.Component=Currency.Component",3102 "applicationType": "URL",3103 "text": "Currency manager (ignored text)", /​/​ ignored3104 "ui5ComponentName": "Currency.Component",3105 "url": "/​url/​to/​currency"3106 },3107 "signature": {3108 "parameters": {3109 "mode": {3110 "required": false,3111 "defaultValue": { value: "DefaultValue" } /​/​ ignored in result3112 }3113 }3114 }3115 }3116 }],3117 expectedSemanticObjectLinks: [], /​/​ Inbound should be filtered out3118 expectedWarningCalls: [3119 [3120 "Passing positional arguments to getLinks is deprecated",3121 "Please use nominal arguments instead",3122 "sap.ushell.services.ClientSideTargetResolution"3123 ]3124 ]3125 },3126 {3127 testDescription: "hideIntentLink is set to true",3128 sSemanticObject: "Object",3129 mBusinessParams: {},3130 bIgnoreFormFactor: true,3131 sCurrentFormFactor: "desktop",3132 aMockedResolutionResults: [3133 { /​/​ has no hideIntentLink3134 "matches": true,3135 "resolutionResult": {3136 "additionalInformation": "SAPUI5.Component=Currency.Component",3137 "applicationType": "URL",3138 "text": "Currency manager A",3139 "ui5ComponentName": "Currency.Component",3140 "url": "/​url/​to/​currency?mode=desktop"3141 },3142 "inbound": {3143 /​/​ NOTE: no hideIntentLink set3144 "title": "Currency manager A",3145 "subTitle": "sub Title",3146 "shortTitle": "short Title",3147 "icon": "sap-icon:/​/​Fiori2/​F0018",3148 "semanticObject": "Object",3149 "action": "actionA",3150 "resolutionResult": {3151 "additionalInformation": "SAPUI5.Component=Currency.Component",3152 "applicationType": "URL",3153 "text": "Currency manager A",3154 "ui5ComponentName": "Currency.Component",3155 "url": "/​url/​to/​currency"3156 },3157 "signature": { "parameters": { } }3158 }3159 },3160 { /​/​ same as the previous inbound but with hideIntentLink set3161 "matches": true,3162 "resolutionResult": {3163 "additionalInformation": "SAPUI5.Component=Currency.Component",3164 "applicationType": "URL",3165 "text": "Currency manager B",3166 "ui5ComponentName": "Currency.Component",3167 "url": "/​url/​to/​currency?mode=desktop"3168 },3169 "inbound": {3170 "hideIntentLink": true, /​/​ NOTE: this should be hidden in the result!3171 "title": "Currency manager B",3172 "subTitle": "sub Title",3173 "shortTitle": "short Title",3174 "semanticObject": "Object",3175 "action": "actionB",3176 "resolutionResult": {3177 "additionalInformation": "SAPUI5.Component=Currency.Component",3178 "applicationType": "URL",3179 "text": "Currency manager B",3180 "ui5ComponentName": "Currency.Component",3181 "url": "/​url/​to/​currency"3182 },3183 "signature": { "parameters": { } }3184 }3185 }3186 ],3187 expectedSemanticObjectLinks: [3188 {3189 "intent": "#Object-actionA",3190 "text": "Currency manager A",3191 "icon": "sap-icon:/​/​Fiori2/​F0018",3192 "subTitle": "sub Title",3193 "shortTitle": "short Title"3194 }3195 ],3196 expectedWarningCalls: [3197 [3198 "Passing positional arguments to getLinks is deprecated",3199 "Please use nominal arguments instead",3200 "sap.ushell.services.ClientSideTargetResolution"3201 ]3202 ]3203 },3204 {3205 testDescription: "app state is provided as member",3206 sSemanticObject: "Object",3207 mBusinessParams: { "ab": 1},3208 sAppStateKey: "AS12345",3209 bIgnoreFormFactor: true,3210 sCurrentFormFactor: "desktop",3211 aMockedResolutionResults: [3212 { /​/​ has no hideIntentLink3213 "matches": true,3214 "resolutionResult": {3215 "additionalInformation": "SAPUI5.Component=Currency.Component",3216 "applicationType": "URL",3217 "text": "Currency manager A",3218 "ui5ComponentName": "Currency.Component",3219 "url": "/​url/​to/​currency?mode=desktop"3220 },3221 "inbound": {3222 /​/​ NOTE: no hideIntentLink set3223 "title": "Currency manager A",3224 "shortTitle": "short Title",3225 "subTitle": "sub Title",3226 "icon": "sap-icon:/​/​Fiori2/​F0018",3227 "semanticObject": "Object",3228 "action": "actionA",3229 "resolutionResult": {3230 "additionalInformation": "SAPUI5.Component=Currency.Component",3231 "applicationType": "URL",3232 "text": "Currency manager A",3233 "ui5ComponentName": "Currency.Component",3234 "url": "/​url/​to/​currency"3235 },3236 "signature": { "parameters": { "ab": { required: true } } }3237 }3238 }3239 ],3240 expectedSemanticObjectLinks: [3241 {3242 "intent": "#Object-actionA?ab=1&sap-xapp-state=AS12345",3243 "text": "Currency manager A",3244 "icon": "sap-icon:/​/​Fiori2/​F0018",3245 "subTitle": "sub Title",3246 "shortTitle": "short Title"3247 }3248 ],3249 expectedWarningCalls: [3250 [3251 "Passing positional arguments to getLinks is deprecated",3252 "Please use nominal arguments instead",3253 "sap.ushell.services.ClientSideTargetResolution"3254 ]3255 ]3256 }3257 ].forEach(function (oFixture) {3258 asyncTest("getLinks: returns expected inbounds when " + oFixture.testDescription, function () {3259 var oSrvc = createService();3260 sinon.stub(jQuery.sap.log, "warning");3261 sinon.stub(jQuery.sap.log, "error");3262 /​/​ Mock form factor3263 sinon.stub(utils, "getFormFactor").returns(oFixture.sCurrentFormFactor);3264 /​/​ Mock getMatchingInbounds3265 sinon.stub(oSrvc, "_getMatchingInbounds").returns(3266 new jQuery.Deferred().resolve(oFixture.aMockedResolutionResults).promise()3267 );3268 if (oFixture.hasOwnProperty("sAction")) {3269 /​/​ test 1.38.0+ behavior3270 oSrvc.getLinks({3271 semanticObject: oFixture.sSemanticObject,3272 action: oFixture.sAction,3273 params: oFixture.mBusinessParams,3274 appStateKey: oFixture.sAppStateKey,3275 ignoreFormFactor: oFixture.bIgnoreFormFactor3276 }).done(function (aResultSemanticObjectLinks) {3277 /​/​ Assert3278 ok(true, "promise was resolved");3279 deepEqual(aResultSemanticObjectLinks, oFixture.expectedSemanticObjectLinks, "got expected array of semantic object links");3280 testExcludeTileIntentArgument(oSrvc, true);3281 })3282 .fail(function () {3283 /​/​ Assert3284 ok(false, "promise was rejected");3285 })3286 .always(function () {3287 testExpectedErrorAndWarningCalls(oFixture);3288 start();3289 });3290 } else if (oFixture.sSortResultsBy || oFixture.bLegacySortParameter) {3291 /​/​ test internal flag for sorting result on texts3292 var oGetLinksCallArgs = {3293 semanticObject: oFixture.sSemanticObject,3294 params: oFixture.mBusinessParams,3295 appStateKey: oFixture.sAppStateKey,3296 ignoreFormFactor: oFixture.bIgnoreFormFactor3297 };3298 if (oFixture.sSortResultsBy) {3299 oGetLinksCallArgs.sortResultsBy = oFixture.sSortResultsBy;3300 }3301 if (oFixture.bLegacySortParameter) {3302 oGetLinksCallArgs.sortResultOnTexts = oFixture.bLegacySortParameter;3303 }3304 oSrvc.getLinks(oGetLinksCallArgs)3305 .done(function (aResultSemanticObjectLinks) {3306 /​/​ Assert3307 ok(true, "promise was resolved");3308 deepEqual(aResultSemanticObjectLinks, oFixture.expectedSemanticObjectLinks, "got expected array of semantic object links");3309 testExcludeTileIntentArgument(oSrvc, true);3310 })3311 .fail(function () {3312 /​/​ Assert3313 ok(false, "promise was rejected");3314 })3315 .always(function () {3316 testExpectedErrorAndWarningCalls(oFixture);3317 start();3318 });3319 } else {3320 /​/​ test old style call and the new style call return the same results3321 var mBusinessParamsAmended = jQuery.extend(true, {}, oFixture.mBusinessParams);3322 if (oFixture.sAppStateKey) {3323 mBusinessParamsAmended["sap-xapp-state"] = [ oFixture.sAppStateKey ];3324 }3325 oSrvc.getLinks(oFixture.sSemanticObject, mBusinessParamsAmended, oFixture.bIgnoreFormFactor)3326 .done(function (aResultSemanticObjectLinksOld) {3327 ok(true, "positional parameters call promise was resolved");3328 testExcludeTileIntentArgument(oSrvc, true);3329 oSrvc._getMatchingInbounds.reset(); /​/​ testExcludeTileIntentArgument called later again3330 oSrvc.getLinks({3331 semanticObject: oFixture.sSemanticObject,3332 params: oFixture.mBusinessParams,3333 appStateKey: oFixture.sAppStateKey,3334 ignoreFormFactor: oFixture.bIgnoreFormFactor3335 }).done(function (aResultSemanticObjectLinksNew) {3336 ok(true, "nominal parameters call promise was resolved");3337 testExcludeTileIntentArgument(oSrvc, true);3338 deepEqual(aResultSemanticObjectLinksNew, aResultSemanticObjectLinksOld,3339 "the new call with nominal parameters returns the same result as the call with positional parameters");3340 deepEqual(aResultSemanticObjectLinksNew, oFixture.expectedSemanticObjectLinks,3341 "the new call with positional parameters returns the expected results");3342 deepEqual(aResultSemanticObjectLinksOld, oFixture.expectedSemanticObjectLinks,3343 "the old call with positional parameters returns the expected results");3344 }).fail(function () {3345 ok(false, "nominal parameters call promise was resolved");3346 }).always(function () {3347 testExpectedErrorAndWarningCalls(oFixture);3348 });3349 })3350 .fail(function () {3351 /​/​ Assert3352 ok(false, "positional parameters call promise was resolved");3353 })3354 .always(function () {3355 start();3356 });3357 }3358 });3359 });3360 /​/​ Test getLinks( ... ) called with 'tags' constraints3361 QUnit.test("getLinks: propagates the tags argument to _getLinks, then to _getMatchingInbounds", function (assert) {3362 var fnDone = assert.async();3363 var oCSTRService = createService();3364 sinon.spy(oCSTRService, "_getLinks");3365 sinon.stub(oCSTRService, "_getMatchingInbounds").returns(jQuery.when([ ]));3366 oCSTRService.getLinks({3367 semanticObject: "Action",3368 tags: [3369 "tag-A",3370 "tag-B",3371 "tag-C"3372 ] })3373 .then(function () {3374 assert.ok(oCSTRService._getLinks.calledOnce, "Calling getLinks consequently calls _getLinks internally");3375 assert.deepEqual(oCSTRService._getLinks.getCall(0).args[0].tags, [3376 "tag-A",3377 "tag-B",3378 "tag-C"3379 ], "_getLinks is called with tags");3380 assert.ok(oCSTRService._getMatchingInbounds.calledOnce, "Calling getLinks consequently calls _getMatchingInbounds internally");3381 assert.deepEqual(oCSTRService._getMatchingInbounds.getCall(0).args[2].tags, [3382 "tag-A",3383 "tag-B",3384 "tag-C"3385 ], "_getMatchingInbounds is called with tags");3386 })3387 .then(function () {3388 oCSTRService._getLinks.restore();3389 oCSTRService._getMatchingInbounds.restore();3390 return;3391 })3392 .then(fnDone, fnDone);3393 });3394 (function () {3395 var oBaseInboundGUI = {3396 "semanticObject": "GUI",3397 "action": "display",3398 "title": "Change Actual Assessment Cycle G/​L",3399 "icon": "sap-icon:/​/​Fiori2/​F0021",3400 "resolutionResult": {3401 "sap.gui": {3402 "_version": "1.2.0",3403 "transaction": "FAGLGA12"3404 },3405 "applicationType": "TR",3406 "systemAlias": "",3407 "text": "Change Actual Assessment Cycle G/​L"3408 },3409 "deviceTypes": {3410 "desktop": true,3411 "tablet": false,3412 "phone": false3413 },3414 "signature": {3415 "additionalParameters": "ignored",3416 "parameters": {}3417 },3418 "tileResolutionResult": {3419 "title": "Change Actual Assessment Cycle G/​L",3420 "icon": "sap-icon:/​/​Fiori2/​F0021",3421 "tileComponentLoadInfo": "#Shell-staticTile",3422 "technicalInformation": "FAGLGA12",3423 "isCustomTile": false3424 }3425 };3426 var oBaseInboundWDA = {3427 "semanticObject": "WDA",3428 "action": "display",3429 "title": "Statistical Key Figures",3430 "info": "Accessible",3431 "icon": "sap-icon:/​/​Fiori2/​F0021",3432 "subTitle": "Actuals",3433 "resolutionResult": {3434 "sap.wda": {3435 "_version": "1.2.0",3436 "applicationId": "FIS_FPM_OVP_STKEYFIGITEMCO",3437 "configId": "FIS_FPM_OVP_STKEYFIGITEMCO"3438 },3439 "applicationType": "WDA",3440 "systemAlias": "",3441 "systemAliasSemantics": "apply",3442 "text": "Statistical Key Figures"3443 },3444 "deviceTypes": { "desktop": true, "tablet": false, "phone": false },3445 "signature": {3446 "additionalParameters": "allowed",3447 "parameters": {}3448 },3449 "tileResolutionResult": {3450 "title": "Statistical Key Figures",3451 "subTitle": "Actuals",3452 "icon": "sap-icon:/​/​Fiori2/​F0021",3453 "info": "Accessible",3454 "tileComponentLoadInfo": "#Shell-staticTile",3455 "description": "Accessible",3456 "technicalInformation": "FIS_FPM_OVP_STKEYFIGITEMCO",3457 "isCustomTile": false3458 }3459 };3460 var oBaseInboundUI5 = {3461 "semanticObject": "SemanticObject",3462 "action": "action",3463 "title": "Title",3464 "resolutionResult": {3465 "applicationType": "SAPUI5",3466 "additionalInformation": "SAPUI5.Component=sap.ushell.demo.Inbound",3467 "text": "Text",3468 "ui5ComponentName": "sap.ushell.demo.Inbound",3469 "applicationDependencies": {3470 "name": "sap.ushell.demo.Inbound",3471 "self": {3472 "name": "sap.ushell.demo.Inbound"3473 }3474 },3475 "url": "/​sap/​bc/​ui5_demokit/​test-resources/​sap/​ushell/​demoapps/​AppNavSample",3476 "systemAlias": ""3477 },3478 "deviceTypes": {3479 "desktop": true,3480 "tablet": true,3481 "phone": true3482 },3483 "signature": {3484 "additionalParameters": "allowed",3485 "parameters": {}3486 }3487 };3488 var oTestInbounds = {3489 "wda": jQuery.extend(true, {}, oBaseInboundWDA),3490 "gui": jQuery.extend(true, {}, oBaseInboundGUI),3491 "basic": jQuery.extend(true, {}, oBaseInboundUI5, {3492 semanticObject: "Object",3493 action: "action",3494 tileResolutionResult: {3495 "key": "valueBasic", /​/​ any tileResolutionResult3496 navigationMode: "embedded",3497 startupParameters: {}3498 }3499 }),3500 "with_required_parameter_filter_value": jQuery.extend(true, {}, oBaseInboundUI5, {3501 semanticObject: "Object",3502 action: "withParameters",3503 tileResolutionResult: {3504 "key": "valueRequired",3505 navigationMode: "embedded",3506 startupParameters: {3507 "P1": ["V1"]3508 }3509 },3510 signature: {3511 "additionalParameters": "notallowed",3512 "parameters": {3513 "P1": {3514 required: true,3515 filter: { value: "V1" }3516 },3517 "PTOBERENAMED": {3518 renameTo: "IWASRENAMED"3519 }3520 }3521 }3522 }),3523 "with_required_parameter_filter_valueAndRename": jQuery.extend(true, {}, oBaseInboundUI5, {3524 semanticObject: "Object",3525 action: "withParameters",3526 tileResolutionResult: {3527 "key": "valueRequired",3528 navigationMode: "embedded",3529 startupParameters: {3530 "P1": ["V1"],3531 "IWASRENAMED": ["V2"]3532 }3533 },3534 signature: {3535 "additionalParameters": "notallowed",3536 "parameters": {3537 "P1": {3538 required: true,3539 filter: { value: "V1" }3540 },3541 "PTOBERENAMED": {3542 renameTo: "IWASRENAMED"3543 }3544 }3545 }3546 })3547 };3548 [3549 {3550 testType: "success", /​/​ the scenario under test3551 testDescription: "no parameters inbound with tileResolutionResult section is provided",3552 sIntent: "#Object-action",3553 aInbounds: [oTestInbounds.basic],3554 expectedResolutionResult: oTestInbounds.basic.tileResolutionResult3555 },3556 {3557 testType: "success",3558 testDescription: "inbound with parameters and tileResolutionResult section is provided",3559 sIntent: "#Object-withParameters?P1=V1",3560 aInbounds: [3561 oTestInbounds.basic,3562 oTestInbounds.with_required_parameter_filter_value3563 ],3564 expectedResolutionResult: oTestInbounds.with_required_parameter_filter_value.tileResolutionResult3565 },3566 {3567 testType: "success",3568 testDescription: "inbound with parameters and tileResolutionResult section is provided an rename to parameter is provided",3569 sIntent: "#Object-withParameters?P1=V1&PTOBERENAMED=V2",3570 aInbounds: [3571 oTestInbounds.basic,3572 oTestInbounds.with_required_parameter_filter_value3573 ],3574 expectedResolutionResult: oTestInbounds.with_required_parameter_filter_valueAndRename.tileResolutionResult3575 },3576 {3577 testType: "success",3578 testDescription: "wda target is provided",3579 sIntent: "#WDA-display",3580 aInbounds: [3581 oTestInbounds.wda3582 ],3583 expectedResolutionResult: jQuery.extend(true, {3584 navigationMode: "newWindowThenEmbedded",3585 startupParameters: undefined3586 }, oTestInbounds.wda.tileResolutionResult)3587 },3588 {3589 testType: "success",3590 testDescription: "gui target is provided",3591 sIntent: "#GUI-display",3592 aInbounds: [3593 oTestInbounds.gui3594 ],3595 expectedResolutionResult: jQuery.extend(true, {3596 navigationMode: "newWindowThenEmbedded",3597 startupParameters: undefined3598 }, oTestInbounds.gui.tileResolutionResult)3599 },3600 {3601 testType: "failure",3602 testDescription: "invalid shell hash passed",3603 sIntent: "#ObjectwithParameters?P1=V1",3604 aInbounds: [],3605 expectedRejectMessage: "Cannot parse shell hash",3606 expectedErrorCallArgs: [3607 "Could not parse shell hash '#ObjectwithParameters?P1=V1'",3608 "please specify a valid shell hash",3609 "sap.ushell.services.ClientSideTargetResolution"3610 ]3611 },3612 {3613 testType: "failure",3614 testDescription: "_getMatchingInbounds fails",3615 testSimulateFailingGetMatchingInbounds: true,3616 sIntent: "#Object-action",3617 aInbounds: [],3618 expectedRejectMessage: "Deliberate failure",3619 expectedErrorCallArgs: [3620 "Could not resolve #Object-action",3621 "_getMatchingInbounds promise rejected with: Deliberate failure",3622 "sap.ushell.services.ClientSideTargetResolution"3623 ]3624 },3625 {3626 testType: "failure",3627 testDescription: "there are no matching targets",3628 sIntent: "#Object-action",3629 aInbounds: [], /​/​ deliberately provide empty inbounds here3630 expectedRejectMessage: "No matching targets found",3631 expectedWarningCallArgs: [3632 "Could not resolve #Object-action",3633 "no matching targets were found",3634 "sap.ushell.services.ClientSideTargetResolution"3635 ]3636 }3637 ].forEach(function (oFixture) {3638 asyncTest("resolveTileIntent resolves as expected when " + oFixture.testDescription, function () {3639 var aFixtureInboundsClone = oFixture.aInbounds.map(function (oInbound) {3640 return jQuery.extend(true, {}, oInbound);3641 });3642 var oSrvc = createService({3643 adapter: {3644 hasSegmentedAccess: false,3645 resolveSystemAlias: function (sSystemAlias) {3646 if (sSystemAlias === "") {3647 return new jQuery.Deferred().resolve(oTestHelper.getLocalSystemAlias()).promise();3648 }3649 throw new Error("Test does not mock resolving other system aliases than the local system alias");3650 },3651 getInbounds: sinon.stub().returns(new jQuery.Deferred().resolve(oFixture.aInbounds).promise())3652 }3653 });3654 if (oFixture.testSimulateFailingGetMatchingInbounds) {3655 sinon.stub(oSrvc, "_getMatchingInbounds").returns(3656 new jQuery.Deferred().reject("Deliberate failure").promise()3657 );3658 }3659 var oMockedServices = { /​/​ NOTE: any service that is not in this object is not allowed3660 AppState: true,3661 URLParsing: true,3662 ShellNavigation: {3663 compactParams: function () { return new jQuery.Deferred().resolve({}).promise(); }3664 },3665 UserInfo: {3666 getUser: sinon.stub().returns({3667 getLanguage: sinon.stub().returns("DE"),3668 getContentDensity: sinon.stub().returns("cozy")3669 })3670 }3671 };3672 var fnGetServiceOrig = sap.ushell.Container.getService;3673 sinon.stub(sap.ushell.Container, "getService", function (sName) {3674 if (!oMockedServices.hasOwnProperty(sName)) {3675 ok(false, "Test is not accessing " + sName);3676 }3677 /​/​ return the result of the real service call3678 if (oMockedServices[sName] === true) {3679 return fnGetServiceOrig.call(sap.ushell.Container, sName);3680 }3681 /​/​ return mocked service3682 return oMockedServices[sName];3683 });3684 sinon.stub(jQuery.sap.log, "warning");3685 sinon.stub(jQuery.sap.log, "error");3686 oSrvc.resolveTileIntent(oFixture.sIntent)3687 .done(function (oResolvedTileIntent) {3688 if (oFixture.testType === "failure") {3689 ok(false, "promise was rejected");3690 } else {3691 ok(true, "promise was resolved");3692 deepEqual(oResolvedTileIntent, oFixture.expectedResolutionResult,3693 "obtained the expected resolution result");3694 }3695 })3696 .fail(function (sError) {3697 if (oFixture.testType === "failure") {3698 ok(true, "promise was rejected");3699 strictEqual(sError, oFixture.expectedRejectMessage,3700 "obtained the expected error message");3701 /​/​ warnings3702 if (!oFixture.expectedWarningCallArgs) {3703 strictEqual(jQuery.sap.log.warning.getCalls().length, 0,3704 "jQuery.sap.log.warning was not called");3705 } else {3706 strictEqual(jQuery.sap.log.warning.getCalls().length, 1,3707 "jQuery.sap.log.warning was called 1 time");3708 deepEqual(3709 jQuery.sap.log.warning.getCall(0).args,3710 oFixture.expectedWarningCallArgs,3711 "jQuery.sap.log.warning was called with the expected arguments"3712 );3713 }3714 /​/​ errors3715 if (!oFixture.expectedErrorCallArgs) {3716 strictEqual(jQuery.sap.log.error.getCalls().length, 0,3717 "jQuery.sap.log.error was not called");3718 } else {3719 strictEqual(jQuery.sap.log.error.getCalls().length, 1,3720 "jQuery.sap.log.error was called 1 time");3721 deepEqual(3722 jQuery.sap.log.error.getCall(0).args,3723 oFixture.expectedErrorCallArgs,3724 "jQuery.sap.log.error was called with the expected arguments"3725 );3726 }3727 } else {3728 ok(false, "promise was resolved without " + sError);3729 }3730 })3731 .always(function () {3732 deepEqual(oFixture.aInbounds, aFixtureInboundsClone,3733 "inbounds provided by getInbounds are not modified by resolveTileIntent");3734 start();3735 });3736 });3737 });3738 })();3739/​/​##3740(function () {3741 /​*3742 * Complete test for getLinks3743 */​3744 var oTestInbounds = {3745 "ui5InboundWithEmptyURL": {3746 "semanticObject": "Action",3747 "action": "toui5nourl",3748 "id": "Action-toui5nourl~6r8",3749 "title": "UI5 Target without URL",3750 "subTitle": "sub Title",3751 "shortTitle": "short Title",3752 "icon": "sap-icon:/​/​Fiori2/​F0018",3753 "resolutionResult": {3754 "applicationType": "SAPUI5",3755 "additionalInformation": "SAPUI5.Component=sap.ushell.demo.AppNavSample",3756 "text": "No URL",3757 "ui5ComponentName": "sap.ushell.demo.AppNavSample",3758 "applicationDependencies": {3759 "name": "sap.ushell.demo.AppNavSample",3760 "self": {3761 "name": "sap.ushell.demo.AppNavSample"3762 }3763 },3764 "url": "", /​/​ NOTE: no URL!3765 "systemAlias": ""3766 },3767 "deviceTypes": {3768 "desktop": true,3769 "tablet": true,3770 "phone": true3771 },3772 "signature": {3773 "additionalParameters": "allowed",3774 "parameters": {}3775 },3776 "compactSignature": "<no params><+>"3777 },3778 "noParamsNoAdditionalAllowed": {3779 "semanticObject": "Action",3780 "action": "toappnavsample",3781 "id": "Action-toappnavsample~6r8",3782 "title": "App Navigation Sample 1",3783 "subTitle": "sub Title",3784 "shortTitle": "short Title",3785 "icon": "sap-icon:/​/​Fiori2/​F0018",3786 "resolutionResult": {3787 "applicationType": "SAPUI5",3788 "additionalInformation": "SAPUI5.Component=sap.ushell.demo.AppNavSample",3789 "text": "App Navigation Sample 1",3790 "ui5ComponentName": "sap.ushell.demo.AppNavSample",3791 "applicationDependencies": {3792 "name": "sap.ushell.demo.AppNavSample",3793 "self": {3794 "name": "sap.ushell.demo.AppNavSample"3795 }3796 },3797 "url": "/​sap/​bc/​ui5_demokit/​test-resources/​sap/​ushell/​demoapps/​AppNavSample",3798 "systemAlias": ""3799 },3800 "deviceTypes": {3801 "desktop": true,3802 "tablet": true,3803 "phone": true3804 },3805 "signature": {3806 "additionalParameters": "ignored",3807 "parameters": {}3808 },3809 "compactSignature": "<no params><+>"3810 },3811 "noParamsAdditionalAllowed": {3812 "semanticObject": "Action",3813 "action": "toappnavsample",3814 "id": "Action-toappnavsample~6r8",3815 "title": "App Navigation Sample 1",3816 "subTitle": "sub Title",3817 "shortTitle": "short Title",3818 "icon": "sap-icon:/​/​Fiori2/​F0018",3819 "resolutionResult": {3820 "applicationType": "SAPUI5",3821 "additionalInformation": "SAPUI5.Component=sap.ushell.demo.AppNavSample",3822 "text": "App Navigation Sample 1",3823 "ui5ComponentName": "sap.ushell.demo.AppNavSample",3824 "applicationDependencies": {3825 "name": "sap.ushell.demo.AppNavSample",3826 "self": {3827 "name": "sap.ushell.demo.AppNavSample"3828 }3829 },3830 "url": "/​sap/​bc/​ui5_demokit/​test-resources/​sap/​ushell/​demoapps/​AppNavSample",3831 "systemAlias": ""3832 },3833 "deviceTypes": {3834 "desktop": true,3835 "tablet": true,3836 "phone": true3837 },3838 "signature": {3839 "additionalParameters": "allowed",3840 "parameters": {}3841 },3842 "compactSignature": "<no params><+>"3843 },3844 "requiredParamWithDefaultRenamed": {3845 "semanticObject": "Action",3846 "action": "parameterRename",3847 "id": "Action-parameterRename~67xE",3848 "title": "Parameter Rename",3849 "subTitle": "sub Title",3850 "shortTitle": "short Title",3851 "icon": "Parameter Rename icon",3852 "resolutionResult": {3853 "applicationType": "SAPUI5",3854 "additionalInformation": "SAPUI5.Component=sap.ushell.demo.ReceiveParametersTestApp",3855 "text": "Display received parameters (Case 3, Collision)",3856 "ui5ComponentName": "sap.ushell.demo.ReceiveParametersTestApp",3857 "applicationDependencies": {3858 "name": "sap.ushell.demo.ReceiveParametersTestApp",3859 "self": {3860 "name": "sap.ushell.demo.ReceiveParametersTestApp"3861 }3862 },3863 "url": "/​sap/​bc/​ui5_demokit/​test-resources/​sap/​ushell/​demoapps/​ReceiveParametersTestApp",3864 "systemAlias": ""3865 },3866 "deviceTypes": {3867 "desktop": true,3868 "tablet": true,3869 "phone": true3870 },3871 "signature": {3872 "additionalParameters": "allowed",3873 "parameters": {3874 "PREQ": {3875 "required": true3876 },3877 "P1": {3878 "renameTo": "P2New",3879 "required": false3880 },3881 "P2": {3882 "renameTo": "P2New",3883 "required": false3884 }3885 }3886 },3887 "compactSignature": "Case:3;[Description:[P1-> P2New; P2-> P2New]];[P1:];[P2:]<+>"3888 },3889 "noParamsAllowed": {3890 "semanticObject": "Action",3891 "action": "noparametersAllowed",3892 "id": "Action-parameterRename~67xE",3893 "title": "No parameters allowed",3894 "subTitle": "sub Title",3895 "shortTitle": "short Title",3896 "icon": "No parameters allowed icon",3897 "resolutionResult": {3898 "applicationType": "SAPUI5",3899 "additionalInformation": "SAPUI5.Component=sap.ushell.demo.ReceiveParametersTestApp",3900 "text": "Display received parameters (Case 3, Collision)",3901 "ui5ComponentName": "sap.ushell.demo.ReceiveParametersTestApp",3902 "applicationDependencies": {3903 "name": "sap.ushell.demo.ReceiveParametersTestApp",3904 "self": {3905 "name": "sap.ushell.demo.ReceiveParametersTestApp"3906 }3907 },3908 "url": "/​sap/​bc/​ui5_demokit/​test-resources/​sap/​ushell/​demoapps/​ReceiveParametersTestApp",3909 "systemAlias": ""3910 },3911 "deviceTypes": {3912 "desktop": true,3913 "tablet": true,3914 "phone": true3915 },3916 "signature": {3917 "additionalParameters": "notallowed",3918 "parameters": {}3919 },3920 "compactSignature": "Case:3;[Description:[P1-> P2New; P2-> P2New]];[P1:];[P2:]<+>"3921 },3922 "ignoredParamsAndDefaultParameter": {3923 "semanticObject": "Object",3924 "action": "ignoredParameters",3925 "id": "Action-parameterRename~67xE",3926 "title": "No parameters allowed",3927 "subTitle": "sub Title",3928 "shortTitle": "short Title",3929 "icon": "No parameters allowed icon",3930 "resolutionResult": {3931 "applicationType": "SAPUI5",3932 "additionalInformation": "SAPUI5.Component=sap.ushell.demo.ReceiveParametersTestApp",3933 "text": "Ignored parameters",3934 "ui5ComponentName": "sap.ushell.demo.ReceiveParametersTestApp",3935 "applicationDependencies": {3936 "name": "sap.ushell.demo.ReceiveParametersTestApp",3937 "self": {3938 "name": "sap.ushell.demo.ReceiveParametersTestApp"3939 }3940 },3941 "url": "/​sap/​bc/​ui5_demokit/​test-resources/​sap/​ushell/​demoapps/​ReceiveParametersTestApp",3942 "systemAlias": ""3943 },3944 "deviceTypes": {3945 "desktop": true,3946 "tablet": true,3947 "phone": true3948 },3949 "signature": {3950 "additionalParameters": "ignored",3951 "parameters": {3952 "P1": {3953 "required": false,3954 "defaultValue": {3955 format: "plain",3956 value: "DEFV"3957 }3958 }3959 }3960 },3961 "compactSignature": "Case:3;[Description:[P1-> P2New; P2-> P2New]];[P1:];[P2:]<+>"3962 },3963 "starAction": {3964 "semanticObject": "ActionStar",3965 "action": "*", /​/​ <- should be never returned in a getLinks call!3966 "id": "Star-*~683P",3967 "title": "Target Mapping with * as action",3968 "subTitle": "sub Title",3969 "shortTitle": "short Title",3970 "icon": "icon with * as action",3971 "resolutionResult": {3972 "applicationType": "URL",3973 "additionalInformation": "",3974 "text": "StarAction",3975 "url": "http:/​/​www.google.com",3976 "systemAlias": ""3977 },3978 "deviceTypes": {3979 "desktop": true,3980 "tablet": true,3981 "phone": true3982 },3983 "signature": {3984 "additionalParameters": "allowed",3985 "parameters": {}3986 },3987 "compactSignature": "<no params><+>"3988 },3989 "starSemanticObject": {3990 "semanticObject": "*", /​/​ <- should be never returned in a getLinks call!3991 "action": "starSemanticObject",3992 "id": "Star-*~683P",3993 "title": "Target Mapping with * as semanticObject",3994 "subTitle": "sub Title",3995 "shortTitle": "short Title",3996 "icon": "icon with * as semanticObject",3997 "resolutionResult": {3998 "applicationType": "URL",3999 "additionalInformation": "",4000 "text": "StarAction",4001 "url": "http:/​/​www.google.com",4002 "systemAlias": ""4003 },4004 "deviceTypes": {4005 "desktop": true,4006 "tablet": true,4007 "phone": true4008 },4009 "signature": {4010 "additionalParameters": "allowed",4011 "parameters": {}4012 },4013 "compactSignature": "<no params><+>"4014 },4015 "twoDefaultParametersAdditionalAllowed": {4016 "semanticObject": "Object",4017 "action": "twoDefaultParameters",4018 "title": "Two Default Parameters",4019 "subTitle": "sub Title",4020 "shortTitle": "short Title",4021 "icon": "Two Default Parameters icon",4022 "resolutionResult": { /​* doesn't matter */​ },4023 "deviceTypes": { "desktop": true, "tablet": true, "phone": true },4024 "signature": {4025 "additionalParameters": "allowed",4026 "parameters": {4027 "P1": { defaultValue: { value: "V1" } },4028 "P2": { defaultValue: { value: "V2" } }4029 }4030 }4031 },4032 "threeDefaultParametersAdditionalAllowed": {4033 "semanticObject": "Object",4034 "action": "threeDefaultParameters",4035 "title": "Three Default Parameters",4036 "subTitle": "sub Title",4037 "shortTitle": "short Title",4038 "icon": "Three Default Parameters icon",4039 "resolutionResult": { /​* doesn't matter */​ },4040 "deviceTypes": { "desktop": true, "tablet": true, "phone": true },4041 "signature": {4042 "additionalParameters": "allowed",4043 "parameters": {4044 "P1": { defaultValue: { value: "V1" } },4045 "P2": { defaultValue: { value: "V2" } },4046 "P3": { defaultValue: { value: "V3" } }4047 }4048 }4049 },4050 "appWithUI5": {4051 "semanticObject": "PickTechnology",4052 "action": "pickTech",4053 "id": "PickTechnology",4054 "title": "Pick Technology (UI5)",4055 "subTitle": "sub Title",4056 "shortTitle": "short Title",4057 "icon": "Pick Technology (UI5) icon",4058 "resolutionResult": {4059 "applicationType": "SAPUI5",4060 "additionalInformation": "SAPUI5.Component=sap.ushell.demo.ReceiveParametersTestApp",4061 "text": "Ignored parameters",4062 "ui5ComponentName": "sap.ushell.demo.ReceiveParametersTestApp",4063 "applicationDependencies": {4064 "name": "sap.ushell.demo.ReceiveParametersTestApp",4065 "self": {4066 "name": "sap.ushell.demo.ReceiveParametersTestApp"4067 }4068 },4069 "url": "/​sap/​bc/​ui5_demokit/​test-resources/​sap/​ushell/​demoapps/​ReceiveParametersTestApp",4070 "systemAlias": "",4071 "sap.ui": {4072 "technology": "UI5"4073 }4074 },4075 "deviceTypes": {4076 "desktop": true,4077 "tablet": true,4078 "phone": true4079 },4080 "signature": {4081 "additionalParameters": "ignored",4082 "parameters": {4083 "P1": {4084 "required": false,4085 "defaultValue": {4086 format: "plain",4087 value: "DEFV"4088 }4089 }4090 }4091 },4092 "compactSignature": "Case:3;[Description:[P1-> P2New; P2-> P2New]];[P1:];[P2:]<+>"4093 },4094 "appWithWDA": {4095 "semanticObject": "PickTechnology",4096 "action": "pickTech",4097 "id": "PickTechnology",4098 "title": "Pick Technology (WDA)",4099 "subTitle": "sub Title",4100 "shortTitle": "short Title",4101 "icon": "Pick Technology (WDA) icon",4102 "resolutionResult": {4103 "applicationType": "WDA",4104 "additionalInformation": "",4105 "text": "Ignored parameters",4106 "applicationDependencies": {},4107 "url": "/​sap/​bc/​nwbc/​somewhereametersTestApp",4108 "systemAlias": "",4109 "sap.ui": {4110 "technology": "WDA"4111 }4112 },4113 "deviceTypes": {4114 "desktop": true,4115 "tablet": true,4116 "phone": true4117 },4118 "signature": {4119 "additionalParameters": "ignored",4120 "parameters": {4121 "P1": {4122 "required": false,4123 "defaultValue": {4124 format: "plain",4125 value: "DEFV"4126 }4127 }4128 }4129 },4130 "compactSignature": "Case:3;[Description:[P1-> P2New; P2-> P2New]];[P1:];[P2:]<+>"4131 }4132 };4133 [4134 { testDescription: "UI5 inbound with empty URL is provided",4135 aInbounds: [4136 oTestInbounds.ui5InboundWithEmptyURL4137 ],4138 aCallArgs: [{4139 semanticObject: "Action",4140 action: "toui5nourl"4141 }],4142 expectedResult: [{4143 "intent": "#Action-toui5nourl",4144 "text": "UI5 Target without URL",4145 "icon": "sap-icon:/​/​Fiori2/​F0018",4146 "subTitle": "sub Title",4147 "shortTitle": "short Title"4148 }]4149 },4150 {4151 testDescription: "semantic object and action provided",4152 aInbounds: [4153 oTestInbounds.noParamsAdditionalAllowed,4154 oTestInbounds.requiredParamWithDefaultRenamed,4155 oTestInbounds.noParamsAllowed,4156 oTestInbounds.ignoredParamsAndDefaultParameter,4157 oTestInbounds.starAction,4158 oTestInbounds.starSemanticObject4159 ],4160 aCallArgs: [{4161 semanticObject: "Action",4162 action: "toappnavsample"4163 }],4164 expectedResult: [{4165 "intent": "#Action-toappnavsample",4166 "text": "App Navigation Sample 1",4167 "icon": "sap-icon:/​/​Fiori2/​F0018",4168 "subTitle": "sub Title",4169 "shortTitle": "short Title"4170 }]4171 },4172 {4173 testDescription: "only parameters are provided",4174 aInbounds: [4175 oTestInbounds.noParamsAdditionalAllowed,4176 oTestInbounds.requiredParamWithDefaultRenamed,4177 oTestInbounds.noParamsAllowed,4178 oTestInbounds.ignoredParamsAndDefaultParameter,4179 oTestInbounds.starAction,4180 oTestInbounds.starSemanticObject4181 ],4182 aCallArgs: [{4183 /​/​ if CrossApplicationNavigation#getLinks was called, the4184 /​/​ presence of action is guaranteed.4185 action: undefined,4186 params: {4187 "PREQ": "valA",4188 "P1": ["val1"],4189 "P2": ["val2"]4190 }4191 }],4192 expectedResult: [{4193 "intent": "#Action-parameterRename?P1=val1&P2=val2&PREQ=valA",4194 "text": "Parameter Rename",4195 "icon": "Parameter Rename icon",4196 "subTitle": "sub Title",4197 "shortTitle": "short Title"4198 }, {4199 "intent": "#Action-toappnavsample?P1=val1&P2=val2&PREQ=valA",4200 "text": "App Navigation Sample 1",4201 "icon": "sap-icon:/​/​Fiori2/​F0018",4202 "subTitle": "sub Title",4203 "shortTitle": "short Title"4204 }, {4205 "intent": "#Object-ignoredParameters?P1=val1",4206 "text": "No parameters allowed",4207 "icon": "No parameters allowed icon",4208 "subTitle": "sub Title",4209 "shortTitle": "short Title"4210 }]4211 },4212 {4213 testDescription: "no arguments are provided",4214 aInbounds: [4215 oTestInbounds.noParamsAdditionalAllowed,4216 oTestInbounds.requiredParamWithDefaultRenamed,4217 oTestInbounds.noParamsAllowed,4218 oTestInbounds.ignoredParamsAndDefaultParameter,4219 oTestInbounds.starAction,4220 oTestInbounds.starSemanticObject4221 ],4222 aCallArgs: [{4223 /​/​ if CrossApplicationNavigation#getLinks was called, the4224 /​/​ presence of action is guaranteed.4225 action: undefined4226 }],4227 expectedResult: [{4228 "intent": "#Action-noparametersAllowed",4229 "text": "No parameters allowed",4230 "icon": "No parameters allowed icon",4231 "subTitle": "sub Title",4232 "shortTitle": "short Title"4233 }, {4234 "intent": "#Action-toappnavsample",4235 "text": "App Navigation Sample 1",4236 "icon": "sap-icon:/​/​Fiori2/​F0018",4237 "subTitle": "sub Title",4238 "shortTitle": "short Title"4239 }, {4240 "intent": "#Object-ignoredParameters",4241 "text": "No parameters allowed",4242 "icon": "No parameters allowed icon",4243 "subTitle": "sub Title",4244 "shortTitle": "short Title"4245 }]4246 },4247 {4248 testDescription: "only semantic object is provided",4249 aInbounds: [4250 oTestInbounds.noParamsAdditionalAllowed,4251 oTestInbounds.requiredParamWithDefaultRenamed,4252 oTestInbounds.noParamsAllowed,4253 oTestInbounds.ignoredParamsAndDefaultParameter,4254 oTestInbounds.starAction,4255 oTestInbounds.starSemanticObject4256 ],4257 aCallArgs: [{4258 /​/​ if CrossApplicationNavigation#getLinks was called, the4259 /​/​ presence of action is guaranteed.4260 action: undefined,4261 semanticObject: "Object"4262 }],4263 expectedResult: [{4264 "intent": "#Object-ignoredParameters",4265 "text": "No parameters allowed",4266 "icon": "No parameters allowed icon",4267 "subTitle": "sub Title",4268 "shortTitle": "short Title"4269 }, {4270 "intent": "#Object-starSemanticObject",4271 "text": "Target Mapping with * as semanticObject",4272 "icon": "icon with * as semanticObject",4273 "subTitle": "sub Title",4274 "shortTitle": "short Title"4275 }]4276 },4277 {4278 testDescription: "only action is provided",4279 aInbounds: [4280 oTestInbounds.noParamsAdditionalAllowed,4281 oTestInbounds.requiredParamWithDefaultRenamed,4282 oTestInbounds.noParamsAllowed,4283 oTestInbounds.ignoredParamsAndDefaultParameter,4284 oTestInbounds.starAction,4285 oTestInbounds.starSemanticObject4286 ],4287 aCallArgs: [{4288 action: "toappnavsample"4289 }],4290 expectedResult: [{4291 "intent": "#Action-toappnavsample",4292 "text": "App Navigation Sample 1",4293 "icon": "sap-icon:/​/​Fiori2/​F0018",4294 "subTitle": "sub Title",4295 "shortTitle": "short Title"4296 }]4297 },4298 {4299 testDescription: "semantic object and parameters are provided",4300 aInbounds: [4301 oTestInbounds.noParamsAdditionalAllowed,4302 oTestInbounds.requiredParamWithDefaultRenamed,4303 oTestInbounds.noParamsAllowed,4304 oTestInbounds.ignoredParamsAndDefaultParameter,4305 oTestInbounds.starAction,4306 oTestInbounds.starSemanticObject4307 ],4308 aCallArgs: [{4309 /​/​ if CrossApplicationNavigation#getLinks was called, the4310 /​/​ presence of action is guaranteed.4311 action: undefined,4312 semanticObject: "Object",4313 params: {4314 "P1": "VDEFINED1"4315 }4316 }],4317 expectedResult: [{4318 "intent": "#Object-ignoredParameters?P1=VDEFINED1",4319 "text": "No parameters allowed",4320 "icon": "No parameters allowed icon",4321 "subTitle": "sub Title",4322 "shortTitle": "short Title"4323 }, {4324 "intent": "#Object-starSemanticObject?P1=VDEFINED1",4325 "text": "Target Mapping with * as semanticObject",4326 "icon": "icon with * as semanticObject",4327 "subTitle": "sub Title",4328 "shortTitle": "short Title"4329 }]4330 },4331 {4332 testDescription: "a '*' semantic object is provided",4333 aInbounds: [4334 oTestInbounds.noParamsAdditionalAllowed,4335 oTestInbounds.requiredParamWithDefaultRenamed,4336 oTestInbounds.noParamsAllowed,4337 oTestInbounds.ignoredParamsAndDefaultParameter,4338 oTestInbounds.starAction,4339 oTestInbounds.starSemanticObject4340 ],4341 aCallArgs: [{4342 /​/​ if CrossApplicationNavigation#getLinks was called, the4343 /​/​ presence of action is guaranteed.4344 action: undefined,4345 semanticObject: "*"4346 }],4347 expectedResult: []4348 },4349 {4350 testDescription: "a '*' action is provided",4351 aInbounds: [4352 oTestInbounds.noParamsAdditionalAllowed,4353 oTestInbounds.requiredParamWithDefaultRenamed,4354 oTestInbounds.noParamsAllowed,4355 oTestInbounds.ignoredParamsAndDefaultParameter,4356 oTestInbounds.starAction,4357 oTestInbounds.starSemanticObject4358 ],4359 aCallArgs: [{4360 action: "*"4361 }],4362 expectedResult: []4363 },4364 {4365 testDescription: "withAtLeastOneUsedParam enabled, inbounds with default values provided, one common parameter in intent",4366 aInbounds: [4367 oTestInbounds.twoDefaultParametersAdditionalAllowed, /​/​ has P1 and P2 params4368 oTestInbounds.threeDefaultParametersAdditionalAllowed /​/​ has P1, P2, P3 params4369 ],4370 aCallArgs: [{4371 /​/​ if CrossApplicationNavigation#getLinks was called, the4372 /​/​ presence of action is guaranteed.4373 action: undefined,4374 withAtLeastOneUsedParam: true,4375 params: {4376 "P2": ["OURV2"]4377 }4378 }],4379 expectedResult: [{ /​/​ both are returned because they share P24380 "intent": "#Object-threeDefaultParameters?P2=OURV2",4381 "text": "Three Default Parameters",4382 "icon": "Three Default Parameters icon",4383 "subTitle": "sub Title",4384 "shortTitle": "short Title"4385 }, {4386 "intent": "#Object-twoDefaultParameters?P2=OURV2",4387 "text": "Two Default Parameters",4388 "icon": "Two Default Parameters icon",4389 "subTitle": "sub Title",4390 "shortTitle": "short Title"4391 }]4392 },4393 {4394 testDescription: "withAtLeastOneUsedParam enabled and inbound with no parameters provided",4395 aInbounds: [4396 oTestInbounds.noParamsAdditionalAllowed4397 ],4398 aCallArgs: [{4399 /​/​ if CrossApplicationNavigation#getLinks was called, the4400 /​/​ presence of action is guaranteed.4401 action: undefined,4402 withAtLeastOneUsedParam: true,4403 params: {4404 "P1": ["OURV1"]4405 }4406 }],4407 expectedResult: [{4408 "intent": "#Action-toappnavsample?P1=OURV1",4409 "text": "App Navigation Sample 1",4410 "icon": "sap-icon:/​/​Fiori2/​F0018",4411 "subTitle": "sub Title",4412 "shortTitle": "short Title"4413 }]4414 },4415 {4416 testDescription: "withAtLeastOneUsedParam enabled and inbound with no parameters (and ignored additional parameters) provided",4417 aInbounds: [4418 oTestInbounds.noParamsNoAdditionalAllowed4419 ],4420 aCallArgs: [{4421 /​/​ if CrossApplicationNavigation#getLinks was called, the4422 /​/​ presence of action is guaranteed.4423 action: undefined,4424 withAtLeastOneUsedParam: true,4425 params: {4426 "P1": ["OURV1"]4427 }4428 }],4429 expectedResult: []4430 },4431 {4432 testDescription: "withAtLeastOneUsedParam disabled and inbound with no parameters (and ignored additional parameters) provided",4433 aInbounds: [4434 oTestInbounds.noParamsNoAdditionalAllowed4435 ],4436 aCallArgs: [{4437 /​/​ if CrossApplicationNavigation#getLinks was called, the4438 /​/​ presence of action is guaranteed.4439 action: undefined,4440 withAtLeastOneUsedParam: false,4441 params: {4442 "P1": ["OURV1"]4443 }4444 }],4445 expectedResult: [{4446 "intent": "#Action-toappnavsample",4447 "text": "App Navigation Sample 1",4448 "icon": "sap-icon:/​/​Fiori2/​F0018",4449 "subTitle": "sub Title",4450 "shortTitle": "short Title"4451 }]4452 },4453 {4454 testDescription: "withAtLeastOneUsedParam enabled, sap- parameter provided, and inbound with two parameters (others allowed) provided",4455 aInbounds: [4456 oTestInbounds.twoDefaultParametersAdditionalAllowed, /​/​ has P1 and P2 params4457 oTestInbounds.threeDefaultParametersAdditionalAllowed /​/​ has P1, P2, P3 params4458 ],4459 aCallArgs: [{4460 /​/​ if CrossApplicationNavigation#getLinks was called, the4461 /​/​ presence of action is guaranteed.4462 action: undefined,4463 withAtLeastOneUsedParam: true,4464 params: {4465 "sap-param": ["OURV1"] /​/​ sap- params don't count4466 }4467 }],4468 expectedResult: []4469 },4470 {4471 testDescription: "semantic object and tech hint GUI as filter provided",4472 aInbounds: [4473 oTestInbounds.noParamsAdditionalAllowed,4474 oTestInbounds.requiredParamWithDefaultRenamed,4475 oTestInbounds.appWithUI5,4476 oTestInbounds.appWithWDA4477 ],4478 aCallArgs: [{4479 /​/​ if CrossApplicationNavigation#getLinks was called, the4480 /​/​ presence of action is guaranteed.4481 action: undefined,4482 semanticObject: "PickTechnology",4483 treatTechHintAsFilter: false,4484 params: {4485 "sap-ui-tech-hint": ["GUI"]4486 }4487 }],4488 expectedResult: [{4489 "intent": "#PickTechnology-pickTech?sap-ui-tech-hint=GUI",4490 "text": "Pick Technology (UI5)",4491 "icon": "Pick Technology (UI5) icon",4492 "subTitle": "sub Title",4493 "shortTitle": "short Title"4494 }]4495 },4496 {4497 testDescription: "semantic object and tech hint as filter WDA provided",4498 aInbounds: [4499 oTestInbounds.noParamsAdditionalAllowed,4500 oTestInbounds.requiredParamWithDefaultRenamed,4501 oTestInbounds.noParamsAllowed,4502 oTestInbounds.ignoredParamsAndDefaultParameter,4503 oTestInbounds.appWithUI5,4504 oTestInbounds.appWithWDA4505 ],4506 aCallArgs: [{4507 /​/​ if CrossApplicationNavigation#getLinks was called, the4508 /​/​ presence of action is guaranteed.4509 action: undefined,4510 semanticObject: "PickTechnology",4511 treatTechHintAsFilter: true,4512 params: {4513 "sap-ui-tech-hint": ["WDA"]4514 }4515 }],4516 expectedResult: [{4517 "intent": "#PickTechnology-pickTech?sap-ui-tech-hint=WDA",4518 "text": "Pick Technology (WDA)",4519 "icon": "Pick Technology (WDA) icon",4520 "subTitle": "sub Title",4521 "shortTitle": "short Title"4522 }]4523 },4524 {4525 testDescription: "semantic object and tech hint treatTechHintAsFilter GUI (not present)",4526 aInbounds: [4527 oTestInbounds.noParamsAdditionalAllowed,4528 oTestInbounds.requiredParamWithDefaultRenamed,4529 oTestInbounds.noParamsAllowed,4530 oTestInbounds.ignoredParamsAndDefaultParameter,4531 oTestInbounds.appWithUI5,4532 oTestInbounds.appWithWDA4533 ],4534 aCallArgs: [{4535 /​/​ if CrossApplicationNavigation#getLinks was called, the4536 /​/​ presence of action is guaranteed.4537 action: undefined,4538 semanticObject: "PickTechnology",4539 treatTechHintAsFilter: true,4540 params: {4541 "sap-ui-tech-hint": ["GUI"]4542 }4543 }],4544 expectedResult: [4545 ]4546 },4547 {4548 testDescription: "semantic object and tech hint treatTechHintAsFilter GUI (not present)",4549 aInbounds: [4550 oTestInbounds.noParamsAdditionalAllowed,4551 oTestInbounds.requiredParamWithDefaultRenamed,4552 oTestInbounds.noParamsAllowed,4553 oTestInbounds.ignoredParamsAndDefaultParameter,4554 oTestInbounds.appWithUI5,4555 oTestInbounds.appWithWDA4556 ],4557 aCallArgs: [{4558 /​/​ if CrossApplicationNavigation#getLinks was called, the4559 /​/​ presence of action is guaranteed.4560 action: undefined,4561 semanticObject: "PickTechnology",4562 params: {4563 "sap-ui-tech-hint": ["GUI"]4564 }4565 }],4566 expectedResult: [{4567 "intent": "#PickTechnology-pickTech?sap-ui-tech-hint=GUI",4568 "text": "Pick Technology (UI5)",4569 "icon": "Pick Technology (UI5) icon",4570 "subTitle": "sub Title",4571 "shortTitle": "short Title"4572 }]4573 },4574 {4575 testDescription: "2 'superior' tags are specified",4576 aInbounds: [4577 oTestHelper.createInbound("#SO-act1{<no params><o>}"),4578 oTestHelper.createInbound("#SO-act2{[sap-tag:[superior]]<o>}"),4579 oTestHelper.createInbound("#SO-act3{[sap-tag:[tag-B]]<o>}"), {4580 "semanticObject": "SO",4581 "action": "act4",4582 "signature": {4583 "parameters": {4584 "sap-tag": {4585 "defaultValue": {4586 "value": "superior"4587 },4588 "required": false4589 }4590 },4591 "additionalParameters": "ignored"4592 }4593 }4594 ],4595 aCallArgs: [ {4596 semanticObject: "SO",4597 params: { },4598 tags: [ "superior" ]4599 } ],4600 expectedResult: [4601 {4602 intent: "#SO-act2",4603 text: undefined,4604 tags: ["superior"]4605 },4606 {4607 intent: "#SO-act4",4608 text: undefined,4609 tags: ["superior"]4610 }4611 ]4612 },4613 {4614 /​/​ at the moment we don't support multiple tags, we may do in the future.4615 testDescription: "'superior,something' is specified",4616 aInbounds: [4617 {4618 "semanticObject": "SO",4619 "action": "act4",4620 "signature": {4621 "parameters": {4622 "sap-tag": {4623 "defaultValue": {4624 "value": "superior,superior"4625 },4626 "required": false4627 }4628 },4629 "additionalParameters": "ignored"4630 }4631 }4632 ],4633 aCallArgs: [ {4634 semanticObject: "SO",4635 params: { },4636 tags: [ "superior" ]4637 } ],4638 expectedResult: [ ]4639 },4640 {4641 /​/​ at the moment we don't support multiple tags, we may do in the future.4642 testDescription: "'superior,something' is specified",4643 aInbounds: [4644 oTestHelper.createInbound("#SO-act1{<no params><o>}"),4645 oTestHelper.createInbound("#SO-act2{sap-tag:superior<o>}"), {4646 "semanticObject": "SO",4647 "action": "act4",4648 "signature": {4649 "parameters": {4650 "sap-tag": {4651 "filter": {4652 "value": "superior"4653 },4654 "required": false4655 }4656 },4657 "additionalParameters": "ignored"4658 }4659 }4660 ],4661 aCallArgs: [ {4662 semanticObject: "SO",4663 params: { },4664 tags: [ "superior" ]4665 } ],4666 expectedResult: [ ]4667 },4668 {4669 testDescription: "'required' parameter requested",4670 aInbounds: [4671 oTestHelper.createInbound("#Object-action{[p1:v1]<o>}") /​/​ p1 is a default parameter.4672 ],4673 aCallArgs: [{4674 semanticObject: "Object",4675 params: {4676 p1: "v1"4677 },4678 paramsOptions: [4679 { name: "p1", options: { required: true } }4680 ]4681 }],4682 expectedResult: [] /​/​ ... therefore no results are returned4683 },4684 {4685 testDescription: "'required' parameter requested, but matching target exists",4686 aInbounds: [4687 oTestHelper.createInbound("#Object-action{<no params><+>}", null, { title: "A" }), /​/​ matches4688 oTestHelper.createInbound("#Object-action{[p1:[v1]<+>]}", null, { title: "B" }) /​/​ matches with higher priority4689 ],4690 aCallArgs: [{4691 semanticObject: "Object",4692 params: {4693 p1: "v1"4694 },4695 paramsOptions: [4696 { name: "p1", options: { required: true } }4697 ]4698 }],4699 /​/​ ... B would match if the 'required' option was not4700 /​/​ specified, but we expect nothing is returned in this case.4701 /​/​4702 /​/​ Explanation: suppose inbound "A" is returned.4703 /​/​4704 /​/​ The returned link would look like:4705 /​/​ {4706 /​/​ text: "A",4707 /​/​ intent: "#Object-action?p1=v1"4708 /​/​ }4709 /​/​4710 /​/​ 1. now user sees a link that has a label "A" on the UI4711 /​/​ (e.g., in a smart table control).4712 /​/​ 2. User clicks on the "A" link4713 /​/​ 3. CSTR#getMatchingTargets matches target "B"4714 /​/​ 4. User is navigated to "B" instead of "A" as expected4715 /​/​4716 expectedResult: []4717 }4718 ].forEach(function (oFixture) {4719 asyncTest("getLinks works as expected when " + oFixture.testDescription, function () {4720 var oSrvc = createService({4721 inbounds: oFixture.aInbounds4722 }),4723 oAllowedRequireServices = {4724 URLParsing: true4725 };4726 var fnGetServiceOrig = sap.ushell.Container.getService;4727 sinon.stub(sap.ushell.Container, "getService", function (sName) {4728 if (!oAllowedRequireServices[sName]) {4729 ok(false, "Test is not accessing " + sName);4730 }4731 return fnGetServiceOrig.bind(sap.ushell.Container)(sName);4732 });4733 oSrvc.getLinks.apply(oSrvc, oFixture.aCallArgs)4734 .done(function (aSemanticObjectLinks) {4735 ok(true, "promise is resolved");4736 deepEqual(aSemanticObjectLinks, oFixture.expectedResult,4737 "obtained the expected result");4738 })4739 .fail(function (sErrorMessage) {4740 ok(false, "promise is resolved without " + sErrorMessage);4741 })4742 .always(function () {4743 start();4744 });4745 });4746 });4747})();4748 [4749 {4750 testDescription: "3 Semantic objects in inbounds",4751 aSemanticObjectsInInbounds: [4752 "Action", "Shell", "Object"4753 ],4754 expectedResult: [4755 "Action", "Object", "Shell" /​/​ returned in lexicographical order4756 ]4757 },4758 {4759 testDescription: "wildcard semantic object in inbounds",4760 aSemanticObjectsInInbounds: [4761 "Action", "*", "Shell", "Object"4762 ],4763 expectedResult: [4764 "Action", "Object", "Shell" /​/​ "*" is ignored4765 ]4766 },4767 {4768 testDescription: "empty list of semantic objects is provided",4769 aSemanticObjectsInInbounds: [],4770 expectedResult: []4771 },4772 {4773 testDescription: "undefined semantic object and empty semantic objects",4774 aSemanticObjectsInInbounds: [undefined, ""],4775 expectedResult: []4776 },4777 {4778 testDescription: "duplicated semantic object in inbounds",4779 aSemanticObjectsInInbounds: ["Shell", "Dup", "action", "Dup"],4780 expectedResult: ["Dup", "Shell", "action"]4781 }4782 ].forEach(function (oFixture) {4783 asyncTest("getDistinctSemanticObjects returns the expected result when " + oFixture.testDescription, function () {4784 /​/​ Arrange4785 var aInbounds = oFixture.aSemanticObjectsInInbounds.map(function (sSemanticObject) {4786 return {4787 semanticObject: sSemanticObject,4788 action: "dummyAction"4789 };4790 });4791 var oSrvc = createService({4792 inbounds: aInbounds4793 });4794 /​/​ Act4795 oSrvc.getDistinctSemanticObjects()4796 .done(function (aSemanticObjectsGot) {4797 ok(true, "promise was resolved");4798 deepEqual(aSemanticObjectsGot, oFixture.expectedResult,4799 "the expected list of semantic objects was returned");4800 })4801 .fail(function (sMsg) {4802 ok(false, "promise was resolved");4803 })4804 .always(function () {4805 start();4806 });4807 });4808 });4809 asyncTest("getDistinctSemanticObjects behave as expected when getInbounds fails", function () {4810 /​/​ Arrange4811 var oFakeAdapter = {4812 getInbounds: function () {4813 return new jQuery.Deferred().reject("Deliberate Error").promise();4814 }4815 },4816 oSrvc = createService({4817 adapter: oFakeAdapter4818 });4819 sinon.stub(jQuery.sap.log, "error");4820 sinon.stub(jQuery.sap.log, "warning");4821 /​/​ Act4822 oSrvc.getDistinctSemanticObjects()4823 .done(function () {4824 ok(false, "promise was rejected");4825 })4826 .fail(function (sErrorMessageGot) {4827 ok(true, "promise was rejected");4828 strictEqual(sErrorMessageGot, "Deliberate Error",4829 "expected error message was returned");4830 strictEqual(4831 jQuery.sap.log.error.getCalls().length,4832 0,4833 "jQuery.sap.log.error was called 0 times"4834 );4835 strictEqual(4836 jQuery.sap.log.warning.getCalls().length,4837 0,4838 "jQuery.sap.log.warning was called 0 times"4839 );4840 })4841 .always(function () {4842 start();4843 });4844 });4845 [4846 {4847 testDescription: "matching UI5 url with sap-system and other parameters specified in intent (additionalParameters: ignored)",4848 intent: "Action-action1?sap-system=NOTRELEVANT&paramName1=pv1",4849 sCurrentFormFactor: "desktop",4850 oMockedMatchingTarget: {4851 /​/​ ignore certain fields not needed for the test4852 "matches": true,4853 "resolutionResult": { },4854 "defaultedParamNames": ["P2"],4855 "intentParamsPlusAllDefaults": {4856 "P1": ["PV1", "PV2"],4857 "P2": ["1000"],4858 "sap-system": ["AX1"]4859 },4860 "inbound": {4861 "title": "Currency manager (this one)",4862 "semanticObject": "Action",4863 "action": "action1",4864 "permanentKey": "X-SAP-UI2-CATALOGPAGE:Z_UI2_TEST:ET090M0NO76W68G7TEBEFZOSS",4865 "resolutionResult": {4866 "additionalInformation": "SAPUI5.Component=Currency.Component",4867 "applicationType": "SAPUI5",4868 "text": "Currency manager (ignored )", /​/​ ignored4869 "ui5ComponentName": "Currency.Component",4870 "url": "/​url/​to/​currency"4871 },4872 "signature": {4873 "additionalParameters": "ignored",4874 "parameters": {4875 "P2": {4876 "required": false,4877 "renameTo": "P3",4878 "defaultValue": { value: "DefaultValue" }4879 }4880 }4881 }4882 }4883 },4884 expectedResolutionResult: {4885 "additionalInformation": "SAPUI5.Component=Currency.Component",4886 "applicationType": "SAPUI5",4887 "text": "Currency manager (this one)",4888 "ui5ComponentName": "Currency.Component",4889 "sap-system": "AX1",4890 "url": "/​url/​to/​currency?P1=PV1&P1=PV2&P3=1000&sap-system=AX1&sap-ushell-defaultedParameterNames=%5B%22P3%22%5D",4891 "reservedParameters": {},4892 "inboundPermanentKey": "X-SAP-UI2-CATALOGPAGE:Z_UI2_TEST:ET090M0NO76W68G7TEBEFZOSS"4893 }4894 },4895 {4896 testDescription: "resolving local WDA url",4897 intent: "Action-action1?paramName1=pv1",4898 bIgnoreFormFactor: true,4899 sCurrentFormFactor: "desktop",4900 oMockedMatchingTarget: {4901 /​/​ ignore certain fields not needed for the test4902 "matches": true,4903 "resolutionResult": { },4904 "defaultedParamNames": ["P2"],4905 "intentParamsPlusAllDefaults": {4906 "P1": ["PV1", "PV2"],4907 "P2": ["1000"]4908 },4909 "inbound": {4910 "title": "Currency manager (this one)",4911 "semanticObject": "Action",4912 "action": "action1",4913 "permanentKey": "X-SAP-UI2-CATALOGPAGE:Z_UI2_TEST:ET090M0NO76W68G7TEBEFZOSS",4914 "resolutionResult": {4915 "additionalInformation": "",4916 "applicationType": "WDA",4917 "text": "Currency manager (ignored text)", /​/​ ignored4918 "ui5ComponentName": "Currency.Component",4919 "url": "/​ui2/​nwbc/​~canvas;window=app/​wda/​WD_ANALYZE_CONFIG_USER/​?sap-client=120&sap-language=EN"4920 },4921 "signature": {4922 "additionalParameters": "ignored",4923 "parameters": {4924 "P2": {4925 "renameTo": "P3",4926 "required": true4927 }4928 }4929 }4930 }4931 },4932 expectedResolutionResult: {4933 "additionalInformation": "",4934 "applicationType": "NWBC",4935 "reservedParameters": {},4936 "sap-system": undefined,4937 "text": "Currency manager (this one)",4938 "url": "/​ui2/​nwbc/​~canvas;window=app/​wda/​WD_ANALYZE_CONFIG_USER/​?sap-client=120&sap-language=EN&P1=PV1&P1=PV2&P3=1000&sap-ushell-defaultedParameterNames=%5B%22P3%22%5D",4939 "inboundPermanentKey": "X-SAP-UI2-CATALOGPAGE:Z_UI2_TEST:ET090M0NO76W68G7TEBEFZOSS"4940 }4941 },4942 {4943 testDescription: "resolving local WDA url with sap-system",4944 intent: "Action-action1?sap-system=NOTRELEVANT&paramName1=pv1",4945 bIgnoreFormFactor: true,4946 sCurrentFormFactor: "desktop",4947 oMockedMatchingTarget: {4948 /​/​ ignore certain fields not needed for the test4949 "matches": true,4950 "resolutionResult": {4951 "text": "Some WDA"4952 },4953 "defaultedParamNames": ["P2"],4954 "intentParamsPlusAllDefaults": {4955 "P1": ["PV1", "PV2"],4956 "P4": { },4957 "P2": ["1000"],4958 "sap-system": ["AX1"]4959 },4960 "inbound": {4961 "semanticObject": "Action",4962 "action": "action1",4963 "permanentKey": "X-SAP-UI2-CATALOGPAGE:Z_UI2_TEST:ET090M0NO76W68G7TEBEFZOSS",4964 "resolutionResult": {4965 "additionalInformation": "",4966 "applicationType": "WDA",4967 "text": "Currency manager (ignored text)", /​/​ ignored4968 "ui5ComponentName": "Currency.Component",4969 "url": "/​ui2/​nwbc/​~canvas;window=app/​wda/​WD_ANALYZE_CONFIG_USER/​?sap-client=120&sap-language=EN"4970 },4971 "signature": {4972 "additionalParameters": "ignored",4973 "parameters": {4974 "P2": {4975 "renameTo": "P3",4976 "required": true4977 }4978 }4979 }4980 }4981 },4982 expectedResolutionResult: {4983 "text": "Some WDA",4984 /​/​ NOTE: the UNMAPPED paramter list!4985 "url": "fallback :-({P1:[PV1,PV2],P2:[1000],sap-system:[AX1],sap-ushell-defaultedParameterNames:[[P3]]}"4986 }4987 }4988 ].forEach(function (oFixture) {4989 asyncTest("resolveHashFragment postprocessing when " + oFixture.testDescription, function () {4990 var oFakeAdapter = {4991 getInbounds: sinon.stub().returns(4992 new jQuery.Deferred().resolve([]).promise()4993 ),4994 resolveHashFragmentFallback: function (oIntent, oMatchingTarget, oParameters) {4995 return new jQuery.Deferred().resolve({ url: "fallback :-(" + JSON.stringify(oParameters).replace(/​["]/​g, "").replace(/​\\/​g, "") }).promise();4996 }4997 };4998 var oSrvc = new ClientSideTargetResolution(oFakeAdapter, null, null, {});4999 /​/​ Mock form factor5000 sinon.stub(utils, "getFormFactor").returns(oFixture.sCurrentFormFactor);5001 /​/​ Mock getMatchingInbounds5002 sinon.stub(oSrvc, "_getMatchingInbounds").returns(5003 new jQuery.Deferred().resolve([oFixture.oMockedMatchingTarget]).promise()5004 );5005 /​/​ Act5006 oSrvc.resolveHashFragment(oFixture.intent)5007 .done(function (oResolutionResult) {5008 /​/​ Assert5009 ok(true, "promise was resolved");5010 deepEqual(oResolutionResult, oFixture.expectedResolutionResult, "got expected resolution result");5011 })5012 .fail(function () {5013 /​/​ Assert5014 ok(false, "promise was resolved");5015 })5016 .always(function () {5017 start();5018 });5019 });5020 });5021 [5022 {5023 testDescription: "ui5 parameter mapping with appState and defaulting",5024 intent: "Action-action1?sap-system=NOTRELEVANT&paramName1=pv1",5025 sCurrentFormFactor: "desktop",5026 oMockedMatchingTarget: {5027 /​/​ ignore certain fields not needed for the test5028 "matches": true,5029 "resolutionResult": { },5030 "defaultedParamNames": ["P2", "P3", "P4", "P5"],5031 "intentParamsPlusAllDefaults": {5032 "P1": ["PV1", "PV2"],5033 "P2": ["1000"],5034 "P3": { "ranges": { option: "EQ", low: "1000" } },5035 "P4": { "ranges": { option: "EQ", low: "notusedbecauseP2" } },5036 "P5": { "ranges": { option: "EQ", low: "1000" } },5037 "P9": ["PV9"],5038 "sap-system": ["AX1"]5039 },5040 "inAppState": {5041 "selectionVariant": {5042 "Parameter": [ { "PropertyName": "P6", "PropertyValue": "0815" },5043 { "PropertyName": "P8", "PropertyValue": "0815" } ],5044 "selectOptions": [5045 {5046 "PropertyName": "P7",5047 "Ranges": [5048 {5049 "Sign": "I",5050 "Option": "EQ",5051 "Low": "INT",5052 "High": null5053 }5054 ]5055 }]5056 }5057 },5058 "inbound": {5059 "title": "Currency manager (this one)",5060 "semanticObject": "Action",5061 "action": "action1",5062 "permanentKey": "X-SAP-UI2-CATALOGPAGE:Z_UI2_TEST:ET090M0NO76W68G7TEBEFZOSS",5063 "resolutionResult": {5064 "additionalInformation": "SAPUI5.Component=Currency.Component",5065 "applicationType": "SAPUI5",5066 "text": "Currency manager (ignored )", /​/​ ignored5067 "ui5ComponentName": "Currency.Component",5068 "url": "/​url/​to/​currency"5069 },5070 "signature": {5071 "additionalParameters": "ignored",5072 "parameters": {5073 "P1": { "renameTo": "PX" },5074 "P2": { "renameTo": "P4" },5075 "P5": { "renameTo": "PX"},5076 "P6C": { "renameTo": "PC"},5077 "P6": { "renameTo": "P6New"},5078 "P7": { "renameTo": "P6New"},5079 "P8": { "renameTo": "P8New"},5080 "P9": { "renameTo": "PX"}5081 }5082 }5083 }5084 },5085 expectedResolutionResult: {5086 "additionalInformation": "SAPUI5.Component=Currency.Component",5087 "applicationType": "SAPUI5",5088 "text": "Currency manager (this one)",5089 "ui5ComponentName": "Currency.Component",5090 "sap-system": "AX1",5091 "url": "/​url/​to/​currency?P4=1000&PX=PV1&PX=PV2&sap-system=AX1&sap-ushell-defaultedParameterNames=%5B%22P4%22%5D",5092 "reservedParameters": {},5093 "inboundPermanentKey": "X-SAP-UI2-CATALOGPAGE:Z_UI2_TEST:ET090M0NO76W68G7TEBEFZOSS"5094 }5095 }5096 ].forEach(function (oFixture) {5097 asyncTest("resolveHashFragment with appstate merging " + oFixture.testDescription, function () {5098 var oFakeAdapter = {5099 getInbounds: sinon.stub().returns(5100 new jQuery.Deferred().resolve([]).promise()5101 ),5102 resolveHashFragmentFallback: function (oIntent, oMatchingTarget, oParameters) {5103 return new jQuery.Deferred().resolve({ url: "fallback :-(" + JSON.stringify(oParameters).replace(/​["]/​g, "").replace(/​\\/​g, "") }).promise();5104 }5105 };5106 var oSrvc = new ClientSideTargetResolution(oFakeAdapter, null, null, {});5107 /​/​ Mock form factor5108 sinon.stub(utils, "getFormFactor").returns(oFixture.sCurrentFormFactor);5109 /​/​ Mock getMatchingInbounds5110 sinon.stub(oSrvc, "_getMatchingInbounds").returns(5111 new jQuery.Deferred().resolve([oFixture.oMockedMatchingTarget]).promise()5112 );5113 /​/​ Act5114 oSrvc.resolveHashFragment(oFixture.intent)5115 .done(function (oResolutionResult) {5116 /​/​ Assert5117 ok(true, "promise was resolved");5118 deepEqual(oResolutionResult, oFixture.expectedResolutionResult, "got expected resolution result");5119 })5120 .fail(function () {5121 /​/​ Assert5122 ok(false, "promise was resolved");5123 })5124 .always(function () {5125 start();5126 });5127 });5128 });5129 [5130 {5131 testDescription: "form factor is not ignored",5132 sSemanticObject: "Object",5133 bIgnoreFormFactor: false,5134 mBusinessParams: {},5135 sCurrentFormFactor: "mobile",5136 expectedGetMatchingTargetsIntent: {5137 "action": undefined,5138 "formFactor": "mobile",5139 "params": {},5140 "semanticObject": "Object"5141 }5142 },5143 {5144 testDescription: "form factor is ignored",5145 sSemanticObject: "Object",5146 bIgnoreFormFactor: true,5147 mBusinessParams: {},5148 sCurrentFormFactor: "mobile",5149 expectedGetMatchingTargetsIntent: {5150 "action": undefined,5151 "formFactor": undefined,5152 "params": {},5153 "semanticObject": "Object"5154 }5155 },5156 {5157 testDescription: "parameters are specified",5158 sSemanticObject: "Object",5159 bIgnoreFormFactor: true,5160 mBusinessParams: {5161 "p1": ["v1"],5162 "p2": ["v3", "v2"]5163 },5164 sCurrentFormFactor: "mobile",5165 expectedGetMatchingTargetsIntent: {5166 "action": undefined,5167 "formFactor": undefined,5168 "params": {5169 "p1": ["v1"],5170 "p2": ["v3", "v2"]5171 },5172 "semanticObject": "Object"5173 }5174 },5175 {5176 testDescription: "semantic object is the empty string",5177 sSemanticObject: "",5178 bIgnoreFormFactor: false,5179 mBusinessParams: {},5180 sCurrentFormFactor: "mobile",5181 expectedGetMatchingTargetsIntent: {5182 "action": undefined,5183 "formFactor": "mobile",5184 "semanticObject": undefined,5185 "params": {}5186 }5187 }5188 ].forEach(function (oFixture) {5189 asyncTest("getLinks: calls _getMatchingInbounds with expected shell hash when " + oFixture.testDescription, function () {5190 var oSrvc = createService();5191 /​/​ Mock form factor5192 sinon.stub(utils, "getFormFactor").returns(oFixture.sCurrentFormFactor);5193 /​/​ Mock getMatchingInbounds5194 sinon.stub(oSrvc, "_getMatchingInbounds").returns(5195 new jQuery.Deferred().resolve([]).promise()5196 );5197 /​/​ Act5198 oSrvc.getLinks(oFixture.sSemanticObject, oFixture.mBusinessParams, oFixture.bIgnoreFormFactor)5199 .done(function (aResultSemanticObjectLinks) {5200 /​/​ Assert5201 ok(true, "promise was resolved");5202 deepEqual(oSrvc._getMatchingInbounds.getCall(0).args[0], oFixture.expectedGetMatchingTargetsIntent,5203 "_getMatchingInbounds was called with expected intent object");5204 })5205 .fail(function () {5206 /​/​ Assert5207 ok(false, "promise was resolved");5208 })5209 .always(function () {5210 start();5211 });5212 });5213 });5214 [5215 {5216 testDescription: "semantic object is a number (nominal parameters)",5217 sSemanticObject: 128,5218 mBusinessParams: {},5219 sCurrentFormFactor: "mobile",5220 bUseNominalParameters: true,5221 sExpectedErrorMessage: "invalid semantic object",5222 sExpectedErrorDetailsPart: "got [object Number] instead"5223 },5224 {5225 testDescription: "semantic object is {} (nominal parameters)",5226 sSemanticObject: {},5227 mBusinessParams: {},5228 sCurrentFormFactor: "mobile",5229 bUseNominalParameters: true,5230 sExpectedErrorMessage: "invalid semantic object",5231 sExpectedErrorDetailsPart: "got [object Object] instead"5232 },5233 {5234 testDescription: "semantic object is [] (nominal parameters)",5235 sSemanticObject: [],5236 mBusinessParams: {},5237 sCurrentFormFactor: "mobile",5238 bUseNominalParameters: true,5239 sExpectedErrorMessage: "invalid semantic object",5240 sExpectedErrorDetailsPart: "got [object Array] instead"5241 },5242 {5243 testDescription: "action is not a string (nominal parameters)",5244 sSemanticObject: "Object",5245 sAction: false,5246 mBusinessParams: {},5247 sCurrentFormFactor: "mobile",5248 bUseNominalParameters: true,5249 sExpectedErrorMessage: "invalid action",5250 sExpectedErrorDetailsPart: "the action must be a string"5251 },5252 {5253 testDescription: "action is not a string (nominal parameters)",5254 sSemanticObject: "Object",5255 sAction: "",5256 mBusinessParams: {},5257 sCurrentFormFactor: "mobile",5258 bUseNominalParameters: true,5259 sExpectedErrorMessage: "invalid action",5260 sExpectedErrorDetailsPart: "the action must not be an empty string"5261 },5262 {5263 testDescription: "semantic object is undefined",5264 sSemanticObject: undefined,5265 mBusinessParams: {},5266 sCurrentFormFactor: "mobile",5267 bUseNominalParameters: false,5268 sExpectedErrorMessage: "invalid semantic object",5269 sExpectedErrorDetailsPart: "got [object Undefined] instead"5270 },5271 {5272 testDescription: "semantic object is a number",5273 sSemanticObject: 128,5274 mBusinessParams: {},5275 sCurrentFormFactor: "mobile",5276 bUseNominalParameters: false,5277 sExpectedErrorMessage: "invalid semantic object",5278 sExpectedErrorDetailsPart: "got [object Number] instead"5279 },5280 {5281 testDescription: "semantic object is {}",5282 sSemanticObject: {},5283 mBusinessParams: {},5284 sCurrentFormFactor: "mobile",5285 bUseNominalParameters: false,5286 sExpectedErrorMessage: "invalid semantic object",5287 sExpectedErrorDetailsPart: "got [object Object] instead"5288 },5289 {5290 testDescription: "semantic object is []",5291 sSemanticObject: [],5292 mBusinessParams: {},5293 sCurrentFormFactor: "mobile",5294 bUseNominalParameters: false,5295 sExpectedErrorMessage: "invalid semantic object",5296 sExpectedErrorDetailsPart: "got [object Array] instead"5297 },5298 {5299 testDescription: "semantic object is blank",5300 sSemanticObject: " ",5301 mBusinessParams: {},5302 sCurrentFormFactor: "mobile",5303 bUseNominalParameters: false,5304 sExpectedErrorMessage: "invalid semantic object",5305 sExpectedErrorDetailsPart: "got ' ' instead"5306 },5307 {5308 testDescription: "semantic object is many blanks",5309 sSemanticObject: " ",5310 mBusinessParams: {},5311 sCurrentFormFactor: "mobile",5312 bUseNominalParameters: false,5313 sExpectedErrorMessage: "invalid semantic object",5314 sExpectedErrorDetailsPart: "got ' ' instead"5315 }5316 ].forEach(function (oFixture) {5317 asyncTest("getLinks: logs an error and rejects promise when " + oFixture.testDescription, function () {5318 var oSrvc = createService();5319 sinon.stub(jQuery.sap.log, "error");5320 /​/​ Mock form factor5321 sinon.stub(utils, "getFormFactor").returns(oFixture.sCurrentFormFactor);5322 /​/​ Mock getMatchingInbounds5323 sinon.stub(oSrvc, "_getMatchingInbounds").returns(5324 new jQuery.Deferred().resolve([]).promise()5325 );5326 /​/​ Act5327 var fnGetSemanticObjectLinksBound = oSrvc.getLinks.bind(oSrvc, oFixture.sSemanticObject, oFixture.mBusinessParams);5328 if (oFixture.bUseNominalParameters) {5329 fnGetSemanticObjectLinksBound = oSrvc.getLinks.bind(oSrvc, {5330 semanticObject: oFixture.sSemanticObject,5331 action: oFixture.sAction,5332 params: oFixture.oParams5333 });5334 }5335 fnGetSemanticObjectLinksBound()5336 .done(function (aResultSemanticObjectLinks) {5337 /​/​ Assert5338 ok(false, "promise was rejected");5339 })5340 .fail(function (sErrorMessage) {5341 /​/​ Assert5342 ok(true, "promise was rejected");5343 strictEqual(sErrorMessage, oFixture.sExpectedErrorMessage, "rejected with expected error message");5344 strictEqual(jQuery.sap.log.error.getCalls().length, 1, "jQuery.sap.log.error was called once");5345 strictEqual(jQuery.sap.log.error.getCall(0).args[0], "invalid input for _getLinks", "expected error title was logged");5346 ok(jQuery.sap.log.error.getCall(0).args[1].indexOf(oFixture.sExpectedErrorDetailsPart) >= 0, oFixture.sExpectedErrorDetailsPart + " was found in logged error details");5347 strictEqual(jQuery.sap.log.error.getCall(0).args[2], "sap.ushell.services.ClientSideTargetResolution", "error contains sap.ushell.services.ClientSideTargetResolution");5348 })5349 .always(function () {5350 start();5351 });5352 });5353 });5354 [5355 {5356 testLogLevel: [I_DEBUG],5357 sSemanticObject: "Object",5358 mBusinessParams: { "country": ["IT"] },5359 bIgnoreFormFactor: true,5360 sCurrentFormFactor: "desktop",5361 aMockedResolutionResults: [5362 {5363 "matches": true,5364 "resolutionResult": { "additionalInformation": "SAPUI5.Component=Currency.Component", "applicationType": "URL", "text": "Currency manager", "ui5ComponentName": "Currency.Component", "url": "/​url/​to/​currency?mode=desktop" },5365 "inbound": {5366 "title": "Currency manager",5367 "icon": "sap-icon:/​/​Fiori2/​F0018",5368 "subTitle": "sub Title",5369 "shortTitle": "short Title",5370 "semanticObject": "Object",5371"action": "bbb",5372 "resolutionResult": { "additionalInformation": "SAPUI5.Component=Currency.Component", "applicationType": "URL", "text": "Currency manager (ignored text)", "ui5ComponentName": "Currency.Component", "url": "/​url/​to/​currency" },5373 "signature": { "parameters": {5374 "country": {5375 required: true5376 }5377 }}5378 }5379 },5380 {5381 "matches": true,5382 "resolutionResult": { "additionalInformation": "SAPUI5.Component=Currency.Component", "applicationType": "URL", "text": "Currency manager", "ui5ComponentName": "Currency.Component", "url": "/​url/​to/​currency?mode=desktop" },5383 "inbound": {5384 "title": "Currency manager",5385 "subTitle": "sub Title",5386 "shortTitle": "short Title",5387 "icon": "sap-icon:/​/​Fiori2/​F0018",5388 "semanticObject": "Object",5389"action": "ccc",5390 "resolutionResult": { "additionalInformation": "SAPUI5.Component=Currency.Component", "applicationType": "URL", "text": "Currency manager (ignored text)", "ui5ComponentName": "Currency.Component", "url": "/​url/​to/​currency" },5391 "signature": { "parameters": { }, "additionalParameters": "ignored" }5392 }5393 }5394 ],5395 expectedSemanticObjectLinks: [5396 { "intent": "#Object-bbb?country=IT",5397 "text": "Currency manager",5398 "icon": "sap-icon:/​/​Fiori2/​F0018",5399 "subTitle": "sub Title",5400 "shortTitle": "short Title" },5401 { "intent": "#Object-ccc",5402 "text": "Currency manager",5403 "icon": "sap-icon:/​/​Fiori2/​F0018",5404 "subTitle": "sub Title",5405 "shortTitle": "short Title" }5406 ],5407 expectedLogArgs: [5408 "_getLinks filtered to unique intents.",5409 /​Reporting histogram:(.|\n)*#Object-bbb(.|\n)*#Object-ccc/​,5410 "sap.ushell.services.ClientSideTargetResolution"5411 ]5412 },5413 {5414 testLogLevel: [I_TRACE],5415 sSemanticObject: "Object",5416 mBusinessParams: { "country": ["IT"] },5417 bIgnoreFormFactor: true,5418 sCurrentFormFactor: "desktop",5419 aMockedResolutionResults: [5420 {5421 "matches": true,5422 "resolutionResult": { "additionalInformation": "SAPUI5.Component=Currency.Component", "applicationType": "URL", "text": "Currency manager", "ui5ComponentName": "Currency.Component", "url": "/​url/​to/​currency?mode=desktop" },5423 "inbound": {5424 "title": "Currency manager",5425 "subTitle": "sub Title",5426 "shortTitle": "short Title",5427 "icon": "sap-icon:/​/​Fiori2/​F0018",5428 "semanticObject": "Object",5429"action": "bbb",5430 "resolutionResult": { "additionalInformation": "SAPUI5.Component=Currency.Component", "applicationType": "URL", "text": "Currency manager (ignored text)", "ui5ComponentName": "Currency.Component", "url": "/​url/​to/​currency" },5431 "signature": { "parameters": {5432 "country": {5433 required: true5434 }5435 }}5436 }5437 },5438 {5439 "matches": true,5440 "resolutionResult": { "additionalInformation": "SAPUI5.Component=Currency.Component", "applicationType": "URL", "text": "Currency manager", "ui5ComponentName": "Currency.Component", "url": "/​url/​to/​currency?mode=desktop" },5441 "inbound": {5442 "title": "Currency manager",5443 "subTitle": "sub Title",5444 "shortTitle": "short Title",5445 "icon": "sap-icon:/​/​Fiori2/​F0018",5446 "semanticObject": "Object",5447"action": "ccc",5448 "resolutionResult": { "additionalInformation": "SAPUI5.Component=Currency.Component", "applicationType": "URL", "text": "Currency manager (ignored text)", "ui5ComponentName": "Currency.Component", "url": "/​url/​to/​currency" },5449 "signature": { "parameters": { }, "additionalParameters": "ignored" }5450 }5451 }5452 ],5453 expectedSemanticObjectLinks: [5454 { "intent": "#Object-bbb?country=IT",5455 "text": "Currency manager",5456 "icon": "sap-icon:/​/​Fiori2/​F0018",5457 "subTitle": "sub Title",5458 "shortTitle": "short Title" },5459 { "intent": "#Object-ccc",5460 "text": "Currency manager",5461 "icon": "sap-icon:/​/​Fiori2/​F0018",5462 "subTitle": "sub Title",5463 "shortTitle": "short Title"}5464 ],5465 expectedLogArgs: [5466 "_getLinks filtered to the following unique intents:",5467 /​(.|\n)*#Object-bbb.*country=IT(.|\n)*#Object-ccc.*/​,5468 "sap.ushell.services.ClientSideTargetResolution"5469 ]5470 }5471 ].forEach(function (oFixture) {5472 asyncTest("getLinks: correctly logs resulting intents in log level " + oFixture.testLogLevel, function () {5473 var oSrvc = createService(),5474 oLogMock = testUtils.createLogMock().sloppy(true);5475 /​/​ Check logging expectations via LogMock5476 oLogMock.debug.apply(oLogMock, oFixture.expectedLogArgs);5477 /​/​ LogMock doesn't keep the following original methods5478 jQuery.sap.log.getLevel = sinon.stub().returns(oFixture.testLogLevel);5479 jQuery.sap.log.Level = {5480 DEBUG: I_DEBUG,5481 TRACE: I_TRACE5482 };5483 /​/​ Mock form factor5484 sinon.stub(utils, "getFormFactor").returns(oFixture.sCurrentFormFactor);5485 /​/​ Mock getMatchingInbounds5486 sinon.stub(oSrvc, "_getMatchingInbounds").returns(5487 new jQuery.Deferred().resolve(oFixture.aMockedResolutionResults).promise()5488 );5489 /​/​ Act5490 oSrvc.getLinks(oFixture.sSemanticObject, oFixture.mBusinessParams, oFixture.bIgnoreFormFactor)5491 .done(function (aResultSemanticObjectLinks) {5492 start();5493 /​/​ Assert5494 ok(true, "promise was resolved");5495 deepEqual(aResultSemanticObjectLinks, oFixture.expectedSemanticObjectLinks, "got expected array of semantic object links");5496 oLogMock.verify();5497 })5498 .fail(function () {5499 start();5500 /​/​ Assert5501 ok(false, "promise was resolved");5502 });5503 });5504 });5505 [5506 {5507 testDescription: "semantic object/​actions are both passed",5508 sCurrentFormFactor: "phone",5509 sIntent: "#Object-action",5510 oResolve: [{}],5511 expectedResult: true,5512 expectedGetMatchingTargetsIntent: {5513 "semanticObject": "Object",5514 "action": "action",5515 "formFactor": "phone",5516 "appSpecificRoute": undefined,5517 "contextRaw": undefined,5518 "params": {}5519 }5520 },5521 {5522 testDescription: "Parameters are passed",5523 sCurrentFormFactor: "phone",5524 sIntent: "#Object-action?p1=v1&p2=v2",5525 oResolve: [],5526 expectedResult: false,5527 expectedGetMatchingTargetsIntent: {5528 "semanticObject": "Object",5529 "action": "action",5530 "formFactor": "phone",5531 "params": {5532 "p1": [ "v1" ],5533 "p2": [ "v2" ]5534 },5535 "appSpecificRoute": undefined,5536 "contextRaw": undefined5537 }5538 },5539 {5540 testDescription: " emtpy hash is processed",5541 sCurrentFormFactor: "phone",5542 sIntent: "#",5543 oResolve: [],5544 expectedResult: true,5545 expectedGetMatchingTargetsIntent: undefined5546 }5547 ].forEach(function (oFixture) {5548 function prepareTest () {5549 var oSrvc = createService();5550 sinon.stub(utils, "getFormFactor").returns(oFixture.sCurrentFormFactor);5551 sinon.stub(oSrvc, "_getMatchingInbounds").returns(5552 new jQuery.Deferred().resolve(oFixture.oResolve).promise()5553 );5554 return oSrvc;5555 }5556 asyncTest("_isIntentSupportedOne: calls _getMatchingInbounds with the expected shell hash when " + oFixture.testDescription, function () {5557 var oSrvc = prepareTest();5558 /​/​ Act5559 oSrvc._isIntentSupportedOne(oFixture.sIntent).done(function (oResult) {5560 ok(true, "promise was resolved");5561 equal(oResult, oFixture.expectedRe