[46/50] [abbrv] tinkerpop git commit: Update Javascript GLV
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f9642146/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/graph-traversal.js -- diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/graph-traversal.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/graph-traversal.js new file mode 100644 index 000..5ee734a1 --- /dev/null +++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/graph-traversal.js @@ -0,0 +1,2095 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * @author Jorge Bay Gondra + */ +'use strict'; + +var t = require('./traversal.js'); +var remote = require('../driver/remote-connection'); +var utils = require('../utils'); +var Bytecode = require('./bytecode'); +var TraversalStrategies = require('./traversal-strategy').TraversalStrategies; +var inherits = utils.inherits; +var parseArgs = utils.parseArgs; + +/** + * + * @param {Graph} graph + * @param {TraversalStrategies} traversalStrategies + * @param {Bytecode} [bytecode] + * @constructor + */ +function GraphTraversalSource(graph, traversalStrategies, bytecode) { + this.graph = graph; + this.traversalStrategies = traversalStrategies; + this.bytecode = bytecode || new Bytecode(); +} + +/** + * @param remoteConnection + * @returns {GraphTraversalSource} + */ +GraphTraversalSource.prototype.withRemote = function (remoteConnection) { + var traversalStrategy = new TraversalStrategies(this.traversalStrategies); + traversalStrategy.addStrategy(new remote.RemoteStrategy(remoteConnection)); + return new GraphTraversalSource(this.graph, traversalStrategy, new Bytecode(this.bytecode)); +}; + +/** + * Returns the string representation of the GraphTraversalSource. + * @returns {string} + */ +GraphTraversalSource.prototype.toString = function () { + return 'graphtraversalsource[' + this.graph.toString() + ']'; +}; + +/** + * Graph Traversal Source withBulk method. + * @param {...Object} args + * @returns {GraphTraversalSource} + */ +GraphTraversalSource.prototype.withBulk = function (args) { + var b = new Bytecode(this.bytecode).addSource('withBulk', parseArgs.apply(null, arguments)); + return new GraphTraversalSource(this.graph, new TraversalStrategies(this.traversalStrategies), b); +}; + +/** + * Graph Traversal Source withComputer method. + * @param {...Object} args + * @returns {GraphTraversalSource} + */ +GraphTraversalSource.prototype.withComputer = function (args) { + var b = new Bytecode(this.bytecode).addSource('withComputer', parseArgs.apply(null, arguments)); + return new GraphTraversalSource(this.graph, new TraversalStrategies(this.traversalStrategies), b); +}; + +/** + * Graph Traversal Source withPath method. + * @param {...Object} args + * @returns {GraphTraversalSource} + */ +GraphTraversalSource.prototype.withPath = function (args) { + var b = new Bytecode(this.bytecode).addSource('withPath', parseArgs.apply(null, arguments)); + return new GraphTraversalSource(this.graph, new TraversalStrategies(this.traversalStrategies), b); +}; + +/** + * Graph Traversal Source withSack method. + * @param {...Object} args + * @returns {GraphTraversalSource} + */ +GraphTraversalSource.prototype.withSack = function (args) { + var b = new Bytecode(this.bytecode).addSource('withSack', parseArgs.apply(null, arguments)); + return new GraphTraversalSource(this.graph, new TraversalStrategies(this.traversalStrategies), b); +}; + +/** + * Graph Traversal Source withSideEffect method. + * @param {...Object} args + * @returns {GraphTraversalSource} + */ +GraphTraversalSource.prototype.withSideEffect = function (args) { + var b = new Bytecode(this.bytecode).addSource('withSideEffect', parseArgs.apply(null, arguments)); + return new GraphTraversalSource(this.graph, new TraversalStrategies(this.traversalStrategies), b); +}; + +/** + * Graph Traversal Source withStrategies method. + * @param {...Object} args + * @returns {GraphTraversalSource} + */ +GraphTraversalSource.prototype.withStrategies = function (args) { + var b = new Bytecode(this.bytecode).addSource('withStrategies',
[46/50] [abbrv] tinkerpop git commit: Update Javascript GLV
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/dfcb46f8/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/exports-test.js -- diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/exports-test.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/exports-test.js new file mode 100644 index 000..3864a4a --- /dev/null +++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/exports-test.js @@ -0,0 +1,73 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * @author Jorge Bay Gondra + */ +'use strict'; + +var assert = require('assert'); +var glvModule = require('../../'); + +describe('API', function () { + it('should export fields under process', function () { +assert.ok(glvModule); +assert.ok(glvModule.process); +assert.strictEqual(typeof glvModule.process.Bytecode, 'function'); +assert.strictEqual(typeof glvModule.process.EnumValue, 'function'); +assert.strictEqual(typeof glvModule.process.P, 'function'); +assert.strictEqual(typeof glvModule.process.Traversal, 'function'); +assert.strictEqual(typeof glvModule.process.TraversalSideEffects, 'function'); +assert.strictEqual(typeof glvModule.process.TraversalStrategies, 'function'); +assert.strictEqual(typeof glvModule.process.TraversalStrategy, 'function'); +assert.strictEqual(typeof glvModule.process.Traverser, 'function'); +assert.strictEqual(typeof glvModule.process.GraphTraversal, 'function'); +assert.strictEqual(typeof glvModule.process.GraphTraversalSource, 'function'); +assert.strictEqual(typeof glvModule.process.barrier, 'object'); +assert.strictEqual(typeof glvModule.process.cardinality, 'object'); +assert.strictEqual(typeof glvModule.process.column, 'object'); +assert.strictEqual(typeof glvModule.process.direction, 'object'); +assert.strictEqual(typeof glvModule.process.direction.both, 'object'); +assert.strictEqual(glvModule.process.direction.both.elementName, 'BOTH'); +assert.strictEqual(typeof glvModule.process.operator, 'object'); +assert.strictEqual(typeof glvModule.process.order, 'object'); +assert.strictEqual(typeof glvModule.process.pop, 'object'); +assert.strictEqual(typeof glvModule.process.scope, 'object'); +assert.strictEqual(typeof glvModule.process.t, 'object'); +assert.ok(glvModule.process.statics); + }); + it('should expose fields under structure', function () { +assert.ok(glvModule.structure); +assert.ok(glvModule.structure.io); +assert.strictEqual(typeof glvModule.structure.io.GraphSONReader, 'function'); +assert.strictEqual(typeof glvModule.structure.io.GraphSONWriter, 'function'); +assert.strictEqual(typeof glvModule.structure.Edge, 'function'); +assert.strictEqual(typeof glvModule.structure.Graph, 'function'); +assert.strictEqual(typeof glvModule.structure.Path, 'function'); +assert.strictEqual(typeof glvModule.structure.Property, 'function'); +assert.strictEqual(typeof glvModule.structure.Vertex, 'function'); +assert.strictEqual(typeof glvModule.structure.VertexProperty, 'function'); + }); + it('should expose fields under driver', function () { +assert.ok(glvModule.driver); +assert.strictEqual(typeof glvModule.driver.RemoteConnection, 'function'); +assert.strictEqual(typeof glvModule.driver.RemoteStrategy, 'function'); +assert.strictEqual(typeof glvModule.driver.RemoteTraversal, 'function'); + }); +}); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/dfcb46f8/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/graphson-test.js -- diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/graphson-test.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/graphson-test.js new file mode 100644 index 000..ed5beb3 --- /dev/null +++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/graphson-test.js @@ -0,0 +1,112 @@ +/* + * Licensed to the Apache
[46/50] [abbrv] tinkerpop git commit: Update Javascript GLV
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9e0cf362/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/exports-test.js -- diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/exports-test.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/exports-test.js new file mode 100644 index 000..3864a4a --- /dev/null +++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/exports-test.js @@ -0,0 +1,73 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * @author Jorge Bay Gondra + */ +'use strict'; + +var assert = require('assert'); +var glvModule = require('../../'); + +describe('API', function () { + it('should export fields under process', function () { +assert.ok(glvModule); +assert.ok(glvModule.process); +assert.strictEqual(typeof glvModule.process.Bytecode, 'function'); +assert.strictEqual(typeof glvModule.process.EnumValue, 'function'); +assert.strictEqual(typeof glvModule.process.P, 'function'); +assert.strictEqual(typeof glvModule.process.Traversal, 'function'); +assert.strictEqual(typeof glvModule.process.TraversalSideEffects, 'function'); +assert.strictEqual(typeof glvModule.process.TraversalStrategies, 'function'); +assert.strictEqual(typeof glvModule.process.TraversalStrategy, 'function'); +assert.strictEqual(typeof glvModule.process.Traverser, 'function'); +assert.strictEqual(typeof glvModule.process.GraphTraversal, 'function'); +assert.strictEqual(typeof glvModule.process.GraphTraversalSource, 'function'); +assert.strictEqual(typeof glvModule.process.barrier, 'object'); +assert.strictEqual(typeof glvModule.process.cardinality, 'object'); +assert.strictEqual(typeof glvModule.process.column, 'object'); +assert.strictEqual(typeof glvModule.process.direction, 'object'); +assert.strictEqual(typeof glvModule.process.direction.both, 'object'); +assert.strictEqual(glvModule.process.direction.both.elementName, 'BOTH'); +assert.strictEqual(typeof glvModule.process.operator, 'object'); +assert.strictEqual(typeof glvModule.process.order, 'object'); +assert.strictEqual(typeof glvModule.process.pop, 'object'); +assert.strictEqual(typeof glvModule.process.scope, 'object'); +assert.strictEqual(typeof glvModule.process.t, 'object'); +assert.ok(glvModule.process.statics); + }); + it('should expose fields under structure', function () { +assert.ok(glvModule.structure); +assert.ok(glvModule.structure.io); +assert.strictEqual(typeof glvModule.structure.io.GraphSONReader, 'function'); +assert.strictEqual(typeof glvModule.structure.io.GraphSONWriter, 'function'); +assert.strictEqual(typeof glvModule.structure.Edge, 'function'); +assert.strictEqual(typeof glvModule.structure.Graph, 'function'); +assert.strictEqual(typeof glvModule.structure.Path, 'function'); +assert.strictEqual(typeof glvModule.structure.Property, 'function'); +assert.strictEqual(typeof glvModule.structure.Vertex, 'function'); +assert.strictEqual(typeof glvModule.structure.VertexProperty, 'function'); + }); + it('should expose fields under driver', function () { +assert.ok(glvModule.driver); +assert.strictEqual(typeof glvModule.driver.RemoteConnection, 'function'); +assert.strictEqual(typeof glvModule.driver.RemoteStrategy, 'function'); +assert.strictEqual(typeof glvModule.driver.RemoteTraversal, 'function'); + }); +}); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9e0cf362/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/graphson-test.js -- diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/graphson-test.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/graphson-test.js new file mode 100644 index 000..ed5beb3 --- /dev/null +++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/graphson-test.js @@ -0,0 +1,112 @@ +/* + * Licensed to the Apache