(clientOptions, clientProperties)
| 633 | }); |
| 634 | |
| 635 | function setupGraphExecutor(clientOptions, clientProperties) { |
| 636 | clientOptions = clientOptions || { contactPoints: [ 'h1' ] }; |
| 637 | const client = new Client(clientOptions); |
| 638 | |
| 639 | const result = { |
| 640 | executionArguments: null, |
| 641 | instance: null |
| 642 | }; |
| 643 | |
| 644 | result.instance = new GraphExecutor(client, clientOptions, (query, params, options) => { |
| 645 | result.executionArguments = { query, params, options }; |
| 646 | return Promise.resolve({ rows: [] }); |
| 647 | }); |
| 648 | |
| 649 | client.hosts = { get: address => ({ type: 'host', address: address }) }; |
| 650 | client.execute = q => { |
| 651 | if (q === 'CALL DseClientTool.getAnalyticsGraphServer()') { |
| 652 | return Promise.resolve({ rows: [ { result: { location: '10.10.10.10:1234' }} ]}); |
| 653 | } |
| 654 | |
| 655 | return Promise.resolve({ rows: []}); |
| 656 | }; |
| 657 | |
| 658 | if (clientProperties) { |
| 659 | Object.keys(clientProperties).forEach(propName => client[propName] = clientProperties[propName]); |
| 660 | } |
| 661 | |
| 662 | return result; |
| 663 | } |
no test coverage detected