Skip to content

Commit 1e2bd57

Browse files
committed
Merge branch '2.0-develop'
# Conflicts: # package.json # test-complete/nodejs-documents-query-geo-region.js
2 parents 15b02cf + fe5a6d1 commit 1e2bd57

File tree

318 files changed

+37764
-3009
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

318 files changed

+37764
-3009
lines changed

.jshintrc

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
{
2-
"node": true,
3-
"curly": true,
4-
"eqeqeq": true,
5-
"eqnull": true,
6-
"noarg": true,
7-
"nonew": true,
8-
"undef": true,
9-
"unused": true
2+
"esversion": 6,
3+
"node": true,
4+
"curly": true,
5+
"eqeqeq": true,
6+
"eqnull": true,
7+
"noarg": true,
8+
"nonew": true,
9+
"undef": true,
10+
"unused": true
1011
}

LEGALNOTICES

Lines changed: 8793 additions & 0 deletions
Large diffs are not rendered by default.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright © 2017 MarkLogic Corporation.
1+
Copyright © 2017-2018 MarkLogic Corporation.
22

33
This project and its code and functionality is not representative of MarkLogic Server and is not supported by MarkLogic.
44

NOTICE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright © 2017 MarkLogic Corporation.
1+
Copyright © 2017-2018 MarkLogic Corporation.
22

33
This project and its code and functionality is not representative of MarkLogic Server and is not supported by MarkLogic.
44

config-optic/connectdef.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* Copyright 2015 MarkLogic Corporation
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
'use strict';
17+
18+
var name = 'nodeOpticFunctionalTest';
19+
20+
var plan = {
21+
host: 'localhost',
22+
port: 8079,
23+
user: 'admin',
24+
password: 'admin',
25+
authType: 'DIGEST'
26+
}
27+
28+
module.exports = {
29+
name: name,
30+
plan: plan
31+
};

config-optic/databaseconfig.sjs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
var admin = require("/MarkLogic/admin.xqy");
2+
var config = admin.getConfiguration();
3+
var dbid = xdmp.database("nodeOpticFunctionalTest");
4+
var modDbId = xdmp.database("nodeOpticFunctionalTestModules");
5+
6+
var cityIndex = admin.databaseRangeElementIndex("string", "", "city", "http://marklogic.com/collation/", fn.false());
7+
var popularityIndex = admin.databaseRangeElementIndex("int", "", "popularity", "", fn.false());
8+
var distanceIndex = admin.databaseRangeElementIndex("double", "", "distance", "", fn.false());
9+
var dateIndex = admin.databaseRangeElementIndex("date", "", "date", "", fn.false());
10+
var cityLexicon = admin.databaseElementWordLexicon("", "city", "http://marklogic.com/collation/");
11+
var geoIndex = admin.databaseGeospatialElementIndex("", "latLonPoint", "wgs84", fn.false());
12+
var idIndex = admin.databaseRangeElementIndex("int", "", "id", "", fn.false());
13+
14+
var cityNameIndex = admin.databaseRangeElementIndex("string", "", "cityName", "http://marklogic.com/collation/", fn.false());
15+
var cityTeamIndex = admin.databaseRangeElementIndex("string", "", "cityTeam", "http://marklogic.com/collation/", fn.false());
16+
var cityPopulationIndex = admin.databaseRangeElementIndex("long", "", "cityPopulation", "", fn.false());
17+
18+
config = admin.databaseAddRangeElementIndex(config, dbid, cityIndex);
19+
config = admin.databaseAddRangeElementIndex(config, dbid, popularityIndex);
20+
config = admin.databaseAddRangeElementIndex(config, dbid, distanceIndex);
21+
config = admin.databaseAddRangeElementIndex(config, dbid, dateIndex);
22+
config = admin.databaseAddRangeElementIndex(config, dbid, idIndex);
23+
24+
config = admin.databaseAddRangeElementIndex(config, dbid, cityNameIndex);
25+
config = admin.databaseAddRangeElementIndex(config, dbid, cityTeamIndex);
26+
config = admin.databaseAddRangeElementIndex(config, dbid, cityPopulationIndex);
27+
28+
config = admin.databaseAddElementWordLexicon(config, dbid, cityLexicon);
29+
config = admin.databaseAddGeospatialElementIndex(config, dbid, geoIndex);
30+
config = admin.databaseSetTripleIndex(config, dbid, fn.true());
31+
config = admin.databaseSetCollectionLexicon(config, dbid, fn.true());
32+
config = admin.databaseSetUriLexicon(config, dbid, fn.true());
33+
34+
config = admin.databaseSetSchemaDatabase(config, dbid, modDbId);
35+
36+
admin.saveConfiguration(config);

config-optic/loaddata.js

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
'use strict';
2+
3+
var fs = require('fs');
4+
5+
var moduleFiles = [
6+
{
7+
uri:'/optic/view/test/masterDetail.tdex',
8+
collections:['http://marklogic.com/xdmp/tde'],
9+
contentType:'application/vnd.marklogic-tde+xml',
10+
content:fs.createReadStream('./config-optic/qa-data/masterDetail.tdex')
11+
},
12+
{
13+
uri:'/optic/view/test/masterDetail2.tdej',
14+
collections:['http://marklogic.com/xdmp/tde'],
15+
contentType:'application/vnd.marklogic-tde+json',
16+
content:fs.createReadStream('./config-optic/qa-data/masterDetail2.tdej')
17+
},
18+
{
19+
uri:'/optic/view/test/masterDetail3.tdej',
20+
collections:['http://marklogic.com/xdmp/tde'],
21+
contentType:'application/vnd.marklogic-tde+json',
22+
content:fs.createReadStream('./config-optic/qa-data/masterDetail3.tdej')
23+
},
24+
{
25+
uri:'/optic/view/test/masterDetail4.tdej',
26+
collections:['http://marklogic.com/xdmp/tde'],
27+
contentType:'application/vnd.marklogic-tde+json',
28+
content:fs.createReadStream('./config-optic/qa-data/masterDetail4.tdej')
29+
},
30+
{
31+
uri:'/optic/test/mapperReducer.sjs',
32+
contentType:'application/vnd.marklogic-javascript',
33+
content:fs.createReadStream('./config-optic/qa-data/mapperReducer.sjs')
34+
}
35+
];
36+
37+
var dataFiles = [
38+
{
39+
uri:'/optic/view/test/masterDetail.xml',
40+
collections:['/optic/view/test'],
41+
content:fs.createReadStream('./config-optic/qa-data/masterDetail.xml')
42+
},{
43+
uri:'/optic/view/test/masterDetail2.json',
44+
collections:['/optic/view/test'],
45+
content:fs.createReadStream('./config-optic/qa-data/masterDetail2.json')
46+
},{
47+
uri:'/optic/view/test/masterDetail3.json',
48+
collections:['/optic/view/test'],
49+
content:fs.createReadStream('./config-optic/qa-data/masterDetail3.json')
50+
},{
51+
uri:'/optic/view/test/masterDetail4.json',
52+
collections:['/optic/view/test'],
53+
content:fs.createReadStream('./config-optic/qa-data/masterDetail4.json')
54+
},{
55+
uri:'/optic/view/test/masterDetail5.json',
56+
collections:['/optic/view/test'],
57+
content:fs.createReadStream('./config-optic/qa-data/masterDetail5.json')
58+
},{
59+
uri:'/optic/triple/test/playerTripleSet.xml',
60+
collections:['/optic/player/triple/test'],
61+
content:fs.createReadStream('./config-optic/qa-data/playerTripleSet.xml')
62+
},{
63+
uri:'/optic/triple/test/teamTripleSet.xml',
64+
collections:['/optic/team/triple/test'],
65+
content:fs.createReadStream('./config-optic/qa-data/teamTripleSet.xml')
66+
},{
67+
uri:'/optic/triple/test/duplicatePlayerTripleSet.xml',
68+
collections:['/optic/player/triple/test'],
69+
content:fs.createReadStream('./config-optic/qa-data/playerTripleSet.xml')
70+
},{
71+
uri:'/optic/triple/test/duplicateTeamTripleSet.xml',
72+
collections:['/optic/team/triple/test'],
73+
content:fs.createReadStream('./config-optic/qa-data/teamTripleSet.xml')
74+
},{
75+
uri:'/optic/triple/test/otherPlayerTripleSet.xml',
76+
collections:['/optic/other/player/triple/test'],
77+
content:fs.createReadStream('./config-optic/qa-data/otherPlayerTripleSet.xml')
78+
},{
79+
uri:'/optic/lexicon/test/doc1.json',
80+
collections:['/optic/lexicon/test', '/other/coll1', '/other/coll2'],
81+
content:fs.createReadStream('./config-optic/qa-data/doc1.json')
82+
},{
83+
uri:'/optic/lexicon/test/doc2.json',
84+
collections:['/optic/lexicon/test'],
85+
content:fs.createReadStream('./config-optic/qa-data/doc2.json')
86+
},{
87+
uri:'/optic/lexicon/test/doc3.json',
88+
collections:['/optic/lexicon/test'],
89+
content:fs.createReadStream('./config-optic/qa-data/doc3.json')
90+
},{
91+
uri:'/optic/lexicon/test/doc4.xml',
92+
collections:['/optic/lexicon/test'],
93+
content:fs.createReadStream('./config-optic/qa-data/doc4.xml')
94+
},{
95+
uri:'/optic/lexicon/test/doc5.xml',
96+
collections:['/optic/lexicon/test'],
97+
content:fs.createReadStream('./config-optic/qa-data/doc5.xml')
98+
},{
99+
uri:'/optic/lexicon/test/city1.json',
100+
collections:['/optic/lexicon/test'],
101+
content:fs.createReadStream('./config-optic/qa-data/city1.json')
102+
},{
103+
uri:'/optic/lexicon/test/city2.json',
104+
collections:['/optic/lexicon/test'],
105+
content:fs.createReadStream('./config-optic/qa-data/city2.json')
106+
},{
107+
uri:'/optic/lexicon/test/city3.json',
108+
collections:['/optic/lexicon/test'],
109+
content:fs.createReadStream('./config-optic/qa-data/city3.json')
110+
},{
111+
uri:'/optic/lexicon/test/city4.json',
112+
collections:['/optic/lexicon/test'],
113+
content:fs.createReadStream('./config-optic/qa-data/city4.json')
114+
},{
115+
uri:'/optic/lexicon/test/city5.json',
116+
collections:['/optic/lexicon/test'],
117+
content:fs.createReadStream('./config-optic/qa-data/city5.json')
118+
},{
119+
uri:'/optic/plan/test/planViews.json',
120+
collections:['/optic/plan/test'],
121+
content:fs.createReadStream('./config-optic/qa-data/planViews.json')
122+
},{
123+
uri:'/optic/plan/test/planLexicons.json',
124+
collections:['/optic/plan/test'],
125+
content:fs.createReadStream('./config-optic/qa-data/planLexicons.json')
126+
},{
127+
uri:'/optic/plan/test/planTriples.json',
128+
collections:['/optic/plan/test'],
129+
content:fs.createReadStream('./config-optic/qa-data/planTriples.json')
130+
}];
131+
132+
var graphFiles1 = [
133+
{
134+
uri: '/optic/sparql/test/people.ttl',
135+
contentType: 'text/turtle',
136+
data: fs.createReadStream('./config-optic/qa-data/people.ttl')
137+
}
138+
];
139+
140+
var graphFiles2 = [
141+
{
142+
uri: '/optic/sparql/test/companies.ttl',
143+
contentType: 'text/turtle',
144+
data: fs.createReadStream('./config-optic/qa-data/companies_100.ttl')
145+
}
146+
];
147+
148+
function writeDocuments(db) {
149+
return db.documents.write(dataFiles);
150+
}
151+
152+
function writeDocumentsToMod(db) {
153+
return db.documents.write(moduleFiles);
154+
}
155+
156+
function writeGraphs1(db) {
157+
return db.graphs.write(graphFiles1);
158+
}
159+
160+
function writeGraphs2(db) {
161+
return db.graphs.write(graphFiles2);
162+
}
163+
164+
module.exports = {
165+
writeDocuments: writeDocuments,
166+
writeDocumentsToMod: writeDocumentsToMod,
167+
writeGraphs1: writeGraphs1,
168+
writeGraphs2: writeGraphs2
169+
};

config-optic/loadtde.xqy

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
xquery version "1.0-ml";
2+
3+
let $evalStr :=
4+
'
5+
xquery version "1.0-ml";
6+
xdmp:document-insert("/optic/view/test/masterDetail.tde",
7+
<template xmlns="http://marklogic.com/xdmp/tde">
8+
<context>/sets</context>
9+
<templates>
10+
<template>
11+
<context>masterSet/master</context>
12+
<rows>
13+
<row>
14+
<schema-name>opticFunctionalTest</schema-name>
15+
<view-name>master</view-name>
16+
<columns>
17+
<column><name>id</name><scalar-type>int</scalar-type><val>id</val></column>
18+
<column><name>name</name><scalar-type>string</scalar-type><val>name</val></column>
19+
<column><name>date</name><scalar-type>date</scalar-type><val>date</val></column>
20+
</columns>
21+
</row>
22+
</rows>
23+
</template>
24+
<template>
25+
<context>detailSet/detail</context>
26+
<rows>
27+
<row>
28+
<schema-name>opticFunctionalTest</schema-name>
29+
<view-name>detail</view-name>
30+
<columns>
31+
<column><name>id</name><scalar-type>int</scalar-type><val>id</val></column>
32+
<column><name>name</name><scalar-type>string</scalar-type><val>name</val></column>
33+
<column><name>masterId</name><scalar-type>int</scalar-type><val>masterId</val></column>
34+
<column><name>amount</name><scalar-type>double</scalar-type><val>amount</val></column>
35+
<column><name>color</name><scalar-type>string</scalar-type><val>color</val></column>
36+
</columns>
37+
</row>
38+
</rows>
39+
</template>
40+
</templates>
41+
</template>,
42+
(xdmp:permission("rest-evaluator", "update")),
43+
"http://marklogic.com/xdmp/tde",
44+
()
45+
)'
46+
47+
return
48+
xdmp:eval(
49+
$evalStr,
50+
(),
51+
<options xmlns="xdmp:eval">
52+
<database>{xdmp:database("nodeOpticFunctionalTestModules")}</database>
53+
</options>
54+
);

config-optic/myload.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
'use strict';
2+
3+
var util = require('util');
4+
5+
var fs = require('fs');
6+
7+
var marklogic = require('marklogic');
8+
var testlib = require('./testlib.js');
9+
10+
var clientConnectdef = require('./connectdef.js');
11+
var testName = clientConnectdef.name;
12+
var planServerdef = clientConnectdef.plan;
13+
14+
var testLoad = require('./loaddata.js');
15+
var testUser = require('./userconfig.js');
16+
17+
var db = marklogic.createDatabaseClient({
18+
host: planServerdef.host,
19+
port: planServerdef.port,
20+
user: 'admin',
21+
password: 'admin',
22+
authType: planServerdef.authType
23+
});
24+
25+
testLoad.writeDocuments(db);

config-optic/qa-data/city1.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
{
3+
"cityName": "london",
4+
"cityTeam": "arsenal",
5+
"cityPopulation": 2000000
6+
}

config-optic/qa-data/city2.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
{
3+
"cityName": "new york",
4+
"cityTeam": "yankee",
5+
"cityPopulation": 11000000
6+
}

config-optic/qa-data/city3.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
{
3+
"cityName": "new jersey",
4+
"cityTeam": "nets",
5+
"cityPopulation": 3000000
6+
}

config-optic/qa-data/city4.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
{
3+
"cityName": "beijing",
4+
"cityTeam": "ducks",
5+
"cityPopulation": 55000000
6+
}

config-optic/qa-data/city5.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
{
3+
"cityName": "cape town",
4+
"cityTeam": "pirates",
5+
"cityPopulation": 650000
6+
}

0 commit comments

Comments
 (0)