MCPcopy Create free account
hub / github.com/apache/cassandra-nodejs-driver / setupGraphExecutor

Function setupGraphExecutor

test/unit/graph/executor-tests.js:635–663  ·  view source on GitHub ↗
(clientOptions, clientProperties)

Source from the content-addressed store, hash-verified

633});
634
635function 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}

Callers 1

executor-tests.jsFile · 0.85

Calls 2

forEachMethod · 0.65
keysMethod · 0.65

Tested by

no test coverage detected