-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Conflicts: # package.json # test-complete/nodejs-documents-query-geo-region.js
- Loading branch information
Showing
318 changed files
with
37,764 additions
and
3,009 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
{ | ||
"node": true, | ||
"curly": true, | ||
"eqeqeq": true, | ||
"eqnull": true, | ||
"noarg": true, | ||
"nonew": true, | ||
"undef": true, | ||
"unused": true | ||
"esversion": 6, | ||
"node": true, | ||
"curly": true, | ||
"eqeqeq": true, | ||
"eqnull": true, | ||
"noarg": true, | ||
"nonew": true, | ||
"undef": true, | ||
"unused": true | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Copyright 2015 MarkLogic Corporation | ||
* | ||
* Licensed 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. | ||
*/ | ||
'use strict'; | ||
|
||
var name = 'nodeOpticFunctionalTest'; | ||
|
||
var plan = { | ||
host: 'localhost', | ||
port: 8079, | ||
user: 'admin', | ||
password: 'admin', | ||
authType: 'DIGEST' | ||
} | ||
|
||
module.exports = { | ||
name: name, | ||
plan: plan | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
var admin = require("/MarkLogic/admin.xqy"); | ||
var config = admin.getConfiguration(); | ||
var dbid = xdmp.database("nodeOpticFunctionalTest"); | ||
var modDbId = xdmp.database("nodeOpticFunctionalTestModules"); | ||
|
||
var cityIndex = admin.databaseRangeElementIndex("string", "", "city", "http://marklogic.com/collation/", fn.false()); | ||
var popularityIndex = admin.databaseRangeElementIndex("int", "", "popularity", "", fn.false()); | ||
var distanceIndex = admin.databaseRangeElementIndex("double", "", "distance", "", fn.false()); | ||
var dateIndex = admin.databaseRangeElementIndex("date", "", "date", "", fn.false()); | ||
var cityLexicon = admin.databaseElementWordLexicon("", "city", "http://marklogic.com/collation/"); | ||
var geoIndex = admin.databaseGeospatialElementIndex("", "latLonPoint", "wgs84", fn.false()); | ||
var idIndex = admin.databaseRangeElementIndex("int", "", "id", "", fn.false()); | ||
|
||
var cityNameIndex = admin.databaseRangeElementIndex("string", "", "cityName", "http://marklogic.com/collation/", fn.false()); | ||
var cityTeamIndex = admin.databaseRangeElementIndex("string", "", "cityTeam", "http://marklogic.com/collation/", fn.false()); | ||
var cityPopulationIndex = admin.databaseRangeElementIndex("long", "", "cityPopulation", "", fn.false()); | ||
|
||
config = admin.databaseAddRangeElementIndex(config, dbid, cityIndex); | ||
config = admin.databaseAddRangeElementIndex(config, dbid, popularityIndex); | ||
config = admin.databaseAddRangeElementIndex(config, dbid, distanceIndex); | ||
config = admin.databaseAddRangeElementIndex(config, dbid, dateIndex); | ||
config = admin.databaseAddRangeElementIndex(config, dbid, idIndex); | ||
|
||
config = admin.databaseAddRangeElementIndex(config, dbid, cityNameIndex); | ||
config = admin.databaseAddRangeElementIndex(config, dbid, cityTeamIndex); | ||
config = admin.databaseAddRangeElementIndex(config, dbid, cityPopulationIndex); | ||
|
||
config = admin.databaseAddElementWordLexicon(config, dbid, cityLexicon); | ||
config = admin.databaseAddGeospatialElementIndex(config, dbid, geoIndex); | ||
config = admin.databaseSetTripleIndex(config, dbid, fn.true()); | ||
config = admin.databaseSetCollectionLexicon(config, dbid, fn.true()); | ||
config = admin.databaseSetUriLexicon(config, dbid, fn.true()); | ||
|
||
config = admin.databaseSetSchemaDatabase(config, dbid, modDbId); | ||
|
||
admin.saveConfiguration(config); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
'use strict'; | ||
|
||
var fs = require('fs'); | ||
|
||
var moduleFiles = [ | ||
{ | ||
uri:'/optic/view/test/masterDetail.tdex', | ||
collections:['http://marklogic.com/xdmp/tde'], | ||
contentType:'application/vnd.marklogic-tde+xml', | ||
content:fs.createReadStream('./config-optic/qa-data/masterDetail.tdex') | ||
}, | ||
{ | ||
uri:'/optic/view/test/masterDetail2.tdej', | ||
collections:['http://marklogic.com/xdmp/tde'], | ||
contentType:'application/vnd.marklogic-tde+json', | ||
content:fs.createReadStream('./config-optic/qa-data/masterDetail2.tdej') | ||
}, | ||
{ | ||
uri:'/optic/view/test/masterDetail3.tdej', | ||
collections:['http://marklogic.com/xdmp/tde'], | ||
contentType:'application/vnd.marklogic-tde+json', | ||
content:fs.createReadStream('./config-optic/qa-data/masterDetail3.tdej') | ||
}, | ||
{ | ||
uri:'/optic/view/test/masterDetail4.tdej', | ||
collections:['http://marklogic.com/xdmp/tde'], | ||
contentType:'application/vnd.marklogic-tde+json', | ||
content:fs.createReadStream('./config-optic/qa-data/masterDetail4.tdej') | ||
}, | ||
{ | ||
uri:'/optic/test/mapperReducer.sjs', | ||
contentType:'application/vnd.marklogic-javascript', | ||
content:fs.createReadStream('./config-optic/qa-data/mapperReducer.sjs') | ||
} | ||
]; | ||
|
||
var dataFiles = [ | ||
{ | ||
uri:'/optic/view/test/masterDetail.xml', | ||
collections:['/optic/view/test'], | ||
content:fs.createReadStream('./config-optic/qa-data/masterDetail.xml') | ||
},{ | ||
uri:'/optic/view/test/masterDetail2.json', | ||
collections:['/optic/view/test'], | ||
content:fs.createReadStream('./config-optic/qa-data/masterDetail2.json') | ||
},{ | ||
uri:'/optic/view/test/masterDetail3.json', | ||
collections:['/optic/view/test'], | ||
content:fs.createReadStream('./config-optic/qa-data/masterDetail3.json') | ||
},{ | ||
uri:'/optic/view/test/masterDetail4.json', | ||
collections:['/optic/view/test'], | ||
content:fs.createReadStream('./config-optic/qa-data/masterDetail4.json') | ||
},{ | ||
uri:'/optic/view/test/masterDetail5.json', | ||
collections:['/optic/view/test'], | ||
content:fs.createReadStream('./config-optic/qa-data/masterDetail5.json') | ||
},{ | ||
uri:'/optic/triple/test/playerTripleSet.xml', | ||
collections:['/optic/player/triple/test'], | ||
content:fs.createReadStream('./config-optic/qa-data/playerTripleSet.xml') | ||
},{ | ||
uri:'/optic/triple/test/teamTripleSet.xml', | ||
collections:['/optic/team/triple/test'], | ||
content:fs.createReadStream('./config-optic/qa-data/teamTripleSet.xml') | ||
},{ | ||
uri:'/optic/triple/test/duplicatePlayerTripleSet.xml', | ||
collections:['/optic/player/triple/test'], | ||
content:fs.createReadStream('./config-optic/qa-data/playerTripleSet.xml') | ||
},{ | ||
uri:'/optic/triple/test/duplicateTeamTripleSet.xml', | ||
collections:['/optic/team/triple/test'], | ||
content:fs.createReadStream('./config-optic/qa-data/teamTripleSet.xml') | ||
},{ | ||
uri:'/optic/triple/test/otherPlayerTripleSet.xml', | ||
collections:['/optic/other/player/triple/test'], | ||
content:fs.createReadStream('./config-optic/qa-data/otherPlayerTripleSet.xml') | ||
},{ | ||
uri:'/optic/lexicon/test/doc1.json', | ||
collections:['/optic/lexicon/test', '/other/coll1', '/other/coll2'], | ||
content:fs.createReadStream('./config-optic/qa-data/doc1.json') | ||
},{ | ||
uri:'/optic/lexicon/test/doc2.json', | ||
collections:['/optic/lexicon/test'], | ||
content:fs.createReadStream('./config-optic/qa-data/doc2.json') | ||
},{ | ||
uri:'/optic/lexicon/test/doc3.json', | ||
collections:['/optic/lexicon/test'], | ||
content:fs.createReadStream('./config-optic/qa-data/doc3.json') | ||
},{ | ||
uri:'/optic/lexicon/test/doc4.xml', | ||
collections:['/optic/lexicon/test'], | ||
content:fs.createReadStream('./config-optic/qa-data/doc4.xml') | ||
},{ | ||
uri:'/optic/lexicon/test/doc5.xml', | ||
collections:['/optic/lexicon/test'], | ||
content:fs.createReadStream('./config-optic/qa-data/doc5.xml') | ||
},{ | ||
uri:'/optic/lexicon/test/city1.json', | ||
collections:['/optic/lexicon/test'], | ||
content:fs.createReadStream('./config-optic/qa-data/city1.json') | ||
},{ | ||
uri:'/optic/lexicon/test/city2.json', | ||
collections:['/optic/lexicon/test'], | ||
content:fs.createReadStream('./config-optic/qa-data/city2.json') | ||
},{ | ||
uri:'/optic/lexicon/test/city3.json', | ||
collections:['/optic/lexicon/test'], | ||
content:fs.createReadStream('./config-optic/qa-data/city3.json') | ||
},{ | ||
uri:'/optic/lexicon/test/city4.json', | ||
collections:['/optic/lexicon/test'], | ||
content:fs.createReadStream('./config-optic/qa-data/city4.json') | ||
},{ | ||
uri:'/optic/lexicon/test/city5.json', | ||
collections:['/optic/lexicon/test'], | ||
content:fs.createReadStream('./config-optic/qa-data/city5.json') | ||
},{ | ||
uri:'/optic/plan/test/planViews.json', | ||
collections:['/optic/plan/test'], | ||
content:fs.createReadStream('./config-optic/qa-data/planViews.json') | ||
},{ | ||
uri:'/optic/plan/test/planLexicons.json', | ||
collections:['/optic/plan/test'], | ||
content:fs.createReadStream('./config-optic/qa-data/planLexicons.json') | ||
},{ | ||
uri:'/optic/plan/test/planTriples.json', | ||
collections:['/optic/plan/test'], | ||
content:fs.createReadStream('./config-optic/qa-data/planTriples.json') | ||
}]; | ||
|
||
var graphFiles1 = [ | ||
{ | ||
uri: '/optic/sparql/test/people.ttl', | ||
contentType: 'text/turtle', | ||
data: fs.createReadStream('./config-optic/qa-data/people.ttl') | ||
} | ||
]; | ||
|
||
var graphFiles2 = [ | ||
{ | ||
uri: '/optic/sparql/test/companies.ttl', | ||
contentType: 'text/turtle', | ||
data: fs.createReadStream('./config-optic/qa-data/companies_100.ttl') | ||
} | ||
]; | ||
|
||
function writeDocuments(db) { | ||
return db.documents.write(dataFiles); | ||
} | ||
|
||
function writeDocumentsToMod(db) { | ||
return db.documents.write(moduleFiles); | ||
} | ||
|
||
function writeGraphs1(db) { | ||
return db.graphs.write(graphFiles1); | ||
} | ||
|
||
function writeGraphs2(db) { | ||
return db.graphs.write(graphFiles2); | ||
} | ||
|
||
module.exports = { | ||
writeDocuments: writeDocuments, | ||
writeDocumentsToMod: writeDocumentsToMod, | ||
writeGraphs1: writeGraphs1, | ||
writeGraphs2: writeGraphs2 | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
xquery version "1.0-ml"; | ||
|
||
let $evalStr := | ||
' | ||
xquery version "1.0-ml"; | ||
xdmp:document-insert("/optic/view/test/masterDetail.tde", | ||
<template xmlns="http://marklogic.com/xdmp/tde"> | ||
<context>/sets</context> | ||
<templates> | ||
<template> | ||
<context>masterSet/master</context> | ||
<rows> | ||
<row> | ||
<schema-name>opticFunctionalTest</schema-name> | ||
<view-name>master</view-name> | ||
<columns> | ||
<column><name>id</name><scalar-type>int</scalar-type><val>id</val></column> | ||
<column><name>name</name><scalar-type>string</scalar-type><val>name</val></column> | ||
<column><name>date</name><scalar-type>date</scalar-type><val>date</val></column> | ||
</columns> | ||
</row> | ||
</rows> | ||
</template> | ||
<template> | ||
<context>detailSet/detail</context> | ||
<rows> | ||
<row> | ||
<schema-name>opticFunctionalTest</schema-name> | ||
<view-name>detail</view-name> | ||
<columns> | ||
<column><name>id</name><scalar-type>int</scalar-type><val>id</val></column> | ||
<column><name>name</name><scalar-type>string</scalar-type><val>name</val></column> | ||
<column><name>masterId</name><scalar-type>int</scalar-type><val>masterId</val></column> | ||
<column><name>amount</name><scalar-type>double</scalar-type><val>amount</val></column> | ||
<column><name>color</name><scalar-type>string</scalar-type><val>color</val></column> | ||
</columns> | ||
</row> | ||
</rows> | ||
</template> | ||
</templates> | ||
</template>, | ||
(xdmp:permission("rest-evaluator", "update")), | ||
"http://marklogic.com/xdmp/tde", | ||
() | ||
)' | ||
|
||
return | ||
xdmp:eval( | ||
$evalStr, | ||
(), | ||
<options xmlns="xdmp:eval"> | ||
<database>{xdmp:database("nodeOpticFunctionalTestModules")}</database> | ||
</options> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
'use strict'; | ||
|
||
var util = require('util'); | ||
|
||
var fs = require('fs'); | ||
|
||
var marklogic = require('marklogic'); | ||
var testlib = require('./testlib.js'); | ||
|
||
var clientConnectdef = require('./connectdef.js'); | ||
var testName = clientConnectdef.name; | ||
var planServerdef = clientConnectdef.plan; | ||
|
||
var testLoad = require('./loaddata.js'); | ||
var testUser = require('./userconfig.js'); | ||
|
||
var db = marklogic.createDatabaseClient({ | ||
host: planServerdef.host, | ||
port: planServerdef.port, | ||
user: 'admin', | ||
password: 'admin', | ||
authType: planServerdef.authType | ||
}); | ||
|
||
testLoad.writeDocuments(db); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
{ | ||
"cityName": "london", | ||
"cityTeam": "arsenal", | ||
"cityPopulation": 2000000 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
{ | ||
"cityName": "new york", | ||
"cityTeam": "yankee", | ||
"cityPopulation": 11000000 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
{ | ||
"cityName": "new jersey", | ||
"cityTeam": "nets", | ||
"cityPopulation": 3000000 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
{ | ||
"cityName": "beijing", | ||
"cityTeam": "ducks", | ||
"cityPopulation": 55000000 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
{ | ||
"cityName": "cape town", | ||
"cityTeam": "pirates", | ||
"cityPopulation": 650000 | ||
} |
Oops, something went wrong.