diff --git a/.copyrightconfig b/.copyrightconfig index ccc3da50..ac6632ed 100644 --- a/.copyrightconfig +++ b/.copyrightconfig @@ -11,4 +11,4 @@ startyear: 2015 # - Dotfiles already skipped automatically # Enable by removing the leading '# ' from the next line and editing values. # filesexcluded: third_party/*, docs/generated/*.md, assets/*.png, scripts/temp_*.py, vendor/lib.js -filesexcluded: .github/*, README.md, Jenkinsfile, package.json, package-lock.json, test-app/*, *.md, docker-compose.yaml, test-complete-app/*, test-complete-app-mlDeploy/* +filesexcluded: .github/*, README.md, Jenkinsfile, package.json, package-lock.json, test-app/*, *.md, docker-compose.yaml, test-complete-app-mlDeploy/* diff --git a/.gitignore b/.gitignore index 5598f296..d3d14620 100644 --- a/.gitignore +++ b/.gitignore @@ -15,7 +15,5 @@ test-app/.gradle test-app/gradle-local.properties test-app/docker test-app/containerLogs -test-complete-app/build -test-complete-app/.gradle test-complete-app-mlDeploy/build -test-complete-app-mlDeploy/.gradle \ No newline at end of file +test-complete-app-mlDeploy/.gradle diff --git a/.npmignore b/.npmignore index 7e200ab5..351f7c5f 100644 --- a/.npmignore +++ b/.npmignore @@ -5,11 +5,10 @@ test-app/ test-basic/ test-basic-proxy/ test-complete/ -test-complete-app/ test-complete-proxy/ wiki_images/ CONTRIBUTING.md gulpfile.js Jenkinsfile .jshintrc -jsdoc.json \ No newline at end of file +jsdoc.json diff --git a/etc/test-setup-dmsdk-qa.js b/etc/test-setup-dmsdk-qa.js deleted file mode 100644 index 68ebf404..00000000 --- a/etc/test-setup-dmsdk-qa.js +++ /dev/null @@ -1,410 +0,0 @@ -/* -* Copyright (c) 2015-2025 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved. -*/ -var valcheck = require('core-util-is'); - -var marklogic = require('../lib/marklogic.js'); - -//var promptForAdmin = require('./test-setup-prompt.js'); -var setupUsers = require('./test-setup-users.js'); - -var testlib = require('./test-lib.js'); -var testconfig = require('./test-config-qa.js'); - -//promptForAdmin(createManager); -createManager('admin', 'admin'); - -function createManager(adminUser, adminPassword) { - testconfig.manageAdminConnection.user = adminUser; - testconfig.manageAdminConnection.password = adminPassword; - - var manageClient = - marklogic.createDatabaseClient(testconfig.manageAdminConnection); - var manager = testlib.createManager(manageClient); - - setup(manager); -} -function createAxis(manager, name) { - return manager.post({ - endpoint: '/manage/v2/databases/'+testconfig.dmsdktestServerName+'/temporal/axes', - body: { - 'axis-name': name+'Time', - 'axis-start': { - 'element-reference': { - 'namespace-uri': '', - 'localname': name+'StartTime', - 'scalar-type': 'dateTime' - } - }, - 'axis-end': { - 'element-reference': { - 'namespace-uri': '', - 'localname': name+'EndTime', - 'scalar-type': 'dateTime' - } - } - } - }).result(); -} -function setup(manager) { - console.log('checking for '+testconfig.dmsdktestServerName); - manager.get({ - endpoint: '/v1/rest-apis/'+testconfig.dmsdktestServerName - }). - result(function(response) { - if (response.statusCode === 404) { - console.log('creating database and REST server for '+testconfig.dmsdktestServerName); - manager.post({ - endpoint: '/v1/rest-apis', - body: { - 'rest-api': { - name: testconfig.dmsdktestServerName, - group: 'Default', - database: testconfig.dmsdktestServerName, - 'modules-database': testconfig.dmsdktestServerName+'-modules', - port: testconfig.dmsdkrestPort - } - } - }). - result(function(response) { - if (response.statusCode === 201) { - console.log('getting default indexes for '+testconfig.dmsdktestServerName); - manager.get({ - endpoint: '/manage/v2/databases/'+testconfig.dmsdktestServerName+'/properties' - }).result(). - then(function(response) { - var indexName = null; - var indexType = null; - var indexdef = null; - var i = null; - - var elementWordLexicon = response.data['element-word-lexicon']; - var lexiconTest = { - defaultWordKey: true, - taggedWordKey: true, - otherKey: true - }; - - var lexers = []; - if (valcheck.isNullOrUndefined(elementWordLexicon)) { - elementWordLexicon = []; - lexers = Object.keys(lexiconTest); - } else { - elementWordLexicon.forEach(function(index){ - indexName = index.localname; - if (!valcheck.isUndefined(lexiconTest[indexName])) { - lexiconTest[indexName] = false; - } - }); - lexers = Object.keys(lexiconTest).filter(function(indexName){ - return (lexiconTest[indexName] !== false); - }); - } - - for (i=0; i < lexers.length; i++) { - indexName = lexers[i]; - indexdef = { - collation: 'http://marklogic.com/collation/', - 'namespace-uri': '', - localname: indexName, - }; - elementWordLexicon.push(indexdef); - } - - var rangeElementIndex = response.data['range-element-index']; - - var rangeTest = { - rangeKey1: 'string', - rangeKey2: 'string', - rangeKey3: 'int', - rangeKey4: 'int', - systemStartTime: 'dateTime', - systemEndTime: 'dateTime', - validStartTime: 'dateTime', - validEndTime: 'dateTime', - popularity: 'int', - amt: 'double', - score: 'double', - rate: 'int', - datetime: 'dateTime' - }; - var rangers = []; - if (valcheck.isNullOrUndefined(rangeElementIndex)) { - rangeElementIndex = []; - rangers = Object.keys(rangeTest); - } else { - rangeElementIndex.forEach(function(index){ - indexName = index.localname; - if (!valcheck.isUndefined(rangeTest[indexName])) { - rangeTest[indexName] = false; - } - }); - rangers = Object.keys(rangeTest).filter(function(indexName){ - return (rangeTest[indexName] !== false); - }); - } - - for (i=0; i < rangers.length; i++) { - indexName = rangers[i]; - indexType = rangeTest[indexName]; - indexdef = { - 'scalar-type': indexType, - collation: (indexType === 'string') ? - 'http://marklogic.com/collation/' : '', - 'namespace-uri': '', - localname: indexName, - 'range-value-positions': false, - 'invalid-values': 'ignore' - }; - rangeElementIndex.push(indexdef); - } - var body = { - 'collection-lexicon': true, - 'triple-index': true, - 'schema-database': testconfig.dmsdktestServerName+'-modules', - 'merge-timestamp': -6000000000, - 'range-path-index': [ - { - 'scalar-type': 'decimal', - 'path-expression': 'price/amt', - collation: '', - 'range-value-positions': false, - 'invalid-values': 'reject' - } - ], - 'geospatial-path-index': [ - { - 'path-expression': 'gElemChildParent/gElemChildPoint', - 'coordinate-system': 'wgs84', - 'point-format': 'point', - 'range-value-positions': false, - 'invalid-values': 'reject' - } - ], - 'geospatial-element-index' : [ - { - 'namespace-uri': '', - localname: 'gElemPoint', - 'coordinate-system': 'wgs84', - 'point-format': 'point', - 'range-value-positions': false, - 'invalid-values': 'reject' - }, - { - 'namespace-uri': '', - localname: 'gElemPointWgs84Double', - 'coordinate-system': 'wgs84/double', - 'point-format': 'point', - 'range-value-positions': false, - 'invalid-values': 'reject' - } - ], - 'geospatial-element-child-index': [ - { - 'parent-namespace-uri': '', - 'parent-localname': 'gElemChildParent', - 'namespace-uri': '', - localname: 'gElemChildPoint', - 'coordinate-system': 'wgs84', - 'point-format': 'point', - 'range-value-positions': false, - 'invalid-values': 'reject' - }, - { - 'parent-namespace-uri': '', - 'parent-localname': 'gElemChildParentEtrs89Double', - 'namespace-uri': '', - localname: 'gElemChildPointEtrs89Double', - 'coordinate-system': 'etrs89/double', - 'point-format': 'point', - 'range-value-positions': false, - 'invalid-values': 'reject' - } - ], - 'geospatial-element-pair-index': [ - { - 'parent-namespace-uri': '', - 'parent-localname': 'gElemPair', - 'latitude-namespace-uri': '', - 'latitude-localname': 'latitude', - 'longitude-namespace-uri': '', - 'longitude-localname': 'longitude', - 'coordinate-system': 'wgs84', - 'range-value-positions': false, - 'invalid-values': 'reject' - }, - { - 'parent-namespace-uri': '', - 'parent-localname': 'gElemPairRawDouble', - 'latitude-namespace-uri': '', - 'latitude-localname': 'latitudeRawDouble', - 'longitude-namespace-uri': '', - 'longitude-localname': 'longitudeRawDouble', - 'coordinate-system': 'raw/double', - 'range-value-positions': false, - 'invalid-values': 'reject' - } - ], - 'geospatial-element-attribute-pair-index': [ - { - 'parent-namespace-uri': '', - 'parent-localname': 'gAttrPair', - 'latitude-namespace-uri': '', - 'latitude-localname': 'latitude', - 'longitude-namespace-uri': '', - 'longitude-localname': 'longitude', - 'coordinate-system': 'wgs84', - 'range-value-positions': false, - 'invalid-values': 'reject' - } - ], - 'geospatial-region-path-index': [ - { - 'path-expression': '/root/item/point', - 'coordinate-system': 'wgs84', - 'geohash-precision': 1, - 'invalid-values': 'reject' - }, - { - 'path-expression': '/root/item/linestring', - 'coordinate-system': 'wgs84/double', - 'geohash-precision': 2, - 'invalid-values': 'ignore' - }, - { - 'path-expression': '/root/item/circle', - 'coordinate-system': 'wgs84/double', - 'geohash-precision': 1, - 'invalid-values': 'reject' - }, - { - 'path-expression': '/root/item/circle', - 'coordinate-system': 'wgs84', - 'geohash-precision': 1, - 'invalid-values': 'reject' - }, - { - 'path-expression': '/root/item/box', - 'coordinate-system': 'wgs84/double', - 'geohash-precision': 2, - 'invalid-values': 'ignore' - }, - { - 'path-expression': '/root/item/polygon', - 'coordinate-system': 'wgs84', - 'geohash-precision': 3, - 'invalid-values': 'reject' - }, - { - 'path-expression': '/root/item/complex-polygon', - 'coordinate-system': 'wgs84', - 'geohash-precision': 1, - 'invalid-values': 'ignore' - } - ] - }; - if (valcheck.isArray(elementWordLexicon) && elementWordLexicon.length > 0) { - body['element-word-lexicon'] = elementWordLexicon; - } - if (valcheck.isArray(rangeElementIndex) && rangeElementIndex.length > 0) { - body['range-element-index'] = rangeElementIndex; - } - - console.log('adding custom indexes for '+testconfig.dmsdktestServerName); - return manager.put({ - endpoint: '/manage/v2/databases/'+testconfig.dmsdktestServerName+'/properties', - params: { - format: 'json' - }, - body: body, - hasResponse: true - }).result(); - }). - then(function(response) { - return manager.get({ - endpoint: '/manage/v2/databases/'+testconfig.dmsdktestServerName+'/temporal/axes/systemTime' - }).result(); - }). - then(function(response) { - if (response.statusCode < 400) { - return this; - } - return createAxis(manager, 'system'); - }). - then(function(response) { - return manager.get({ - endpoint: '/manage/v2/databases/'+testconfig.dmsdktestServerName+'/temporal/axes/validTime' - }).result(); - }). - then(function(response) { - if (response.statusCode < 400) { - return this; - } - return createAxis(manager, 'valid'); - }). - then(function(response) { - return manager.get({ - endpoint: '/manage/v2/databases/'+testconfig.dmsdktestServerName+ - '/temporal/collections/temporalCollection' - }).result(); - }). - then(function(response) { - if (response.statusCode < 400) { - return this; - } - return manager.post({ - endpoint: '/manage/v2/databases/'+testconfig.dmsdktestServerName+'/temporal/collections', - body: { - 'collection-name': 'temporalCollection', - 'system-axis': 'systemTime', - 'valid-axis': 'validTime', - 'option': ['updates-safe'] - } - }).result(); - }). - then(function(response) { - return manager.get({ - endpoint: '/manage/v2/databases/'+testconfig.dmsdktestServerName+ - '/temporal/collections/temporalCollectionLsqt' - }).result(); - }). - then(function(response) { - if (response.statusCode < 400) { - return this; - } - return manager.post({ - endpoint: '/manage/v2/databases/'+testconfig.dmsdktestServerName+ - '/temporal/collections', - body: { - 'collection-name': 'temporalCollectionLsqt', - 'system-axis': 'systemTime', - 'valid-axis': 'validTime', - 'option': ['updates-safe'] - } - }).result(); - }). - then(function(response) { - return manager.put({ - endpoint: '/manage/v2/databases/'+testconfig.dmsdktestServerName+'/temporal/collections/lsqt/properties?collection=temporalCollectionLsqt', - body: { - "lsqt-enabled": true, - "automation": { - "enabled": true - } - } - }).result(); - }). - then(function(response) { - console.log(testconfig.dmsdktestServerName+' setup succeeded'); - }); - } else { - console.log(testconfig.dmsdktestServerName+' setup failed with HTTP status: '+response.statusCode); - console.log(response.data); - } - }); - } else { - console.log(testconfig.dmsdktestServerName+' test server is available on port '+ - JSON.parse(response.data).port); - } - }); -} diff --git a/etc/test-setup-prompt.js b/etc/test-setup-prompt.js index 40f1b8c3..9158b908 100644 --- a/etc/test-setup-prompt.js +++ b/etc/test-setup-prompt.js @@ -1,8 +1,6 @@ /* * Copyright (c) 2015-2025 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved. */ -// Simplified version - no more prompting, just returns admin/admin -// TODO: Remove this file when ml-gradle migration is complete function promptForAdmin(done) { // Always use admin/admin - no prompting needed diff --git a/etc/test-setup-qa.js b/etc/test-setup-qa.js deleted file mode 100644 index 0b8f1615..00000000 --- a/etc/test-setup-qa.js +++ /dev/null @@ -1,410 +0,0 @@ -/* -* Copyright (c) 2015-2025 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved. -*/ -var valcheck = require('core-util-is'); - -var marklogic = require('../lib/marklogic.js'); - -//var promptForAdmin = require('./test-setup-prompt.js'); -var setupUsers = require('./test-setup-users.js'); - -var testlib = require('./test-lib.js'); -var testconfig = require('./test-config-qa.js'); - -//promptForAdmin(createManager); -createManager('admin', 'admin'); - -function createManager(adminUser, adminPassword) { - testconfig.manageAdminConnection.user = adminUser; - testconfig.manageAdminConnection.password = adminPassword; - - var manageClient = - marklogic.createDatabaseClient(testconfig.manageAdminConnection); - var manager = testlib.createManager(manageClient); - - setupUsers(manager, setup); -} -function createAxis(manager, name) { - return manager.post({ - endpoint: '/manage/v2/databases/' + testconfig.testServerName + '/temporal/axes', - body: { - 'axis-name': name + 'Time', - 'axis-start': { - 'element-reference': { - 'namespace-uri': '', - 'localname': name + 'StartTime', - 'scalar-type': 'dateTime' - } - }, - 'axis-end': { - 'element-reference': { - 'namespace-uri': '', - 'localname': name + 'EndTime', - 'scalar-type': 'dateTime' - } - } - } - }).result(); -} -function setup(manager) { - console.log('checking for ' + testconfig.testServerName); - manager.get({ - endpoint: '/v1/rest-apis/' + testconfig.testServerName - }). - result(function (response) { - if (response.statusCode === 404) { - console.log('creating database and REST server for ' + testconfig.testServerName); - manager.post({ - endpoint: '/v1/rest-apis', - body: { - 'rest-api': { - name: testconfig.testServerName, - group: 'Default', - database: testconfig.testServerName, - 'modules-database': testconfig.testServerName + '-modules', - port: testconfig.restPort - } - } - }). - result(function (response) { - if (response.statusCode === 201) { - console.log('getting default indexes for ' + testconfig.testServerName); - manager.get({ - endpoint: '/manage/v2/databases/' + testconfig.testServerName + '/properties' - }).result(). - then(function (response) { - var indexName = null; - var indexType = null; - var indexdef = null; - var i = null; - - var elementWordLexicon = response.data['element-word-lexicon']; - var lexiconTest = { - defaultWordKey: true, - taggedWordKey: true, - otherKey: true - }; - - var lexers = []; - if (valcheck.isNullOrUndefined(elementWordLexicon)) { - elementWordLexicon = []; - lexers = Object.keys(lexiconTest); - } else { - elementWordLexicon.forEach(function (index) { - indexName = index.localname; - if (!valcheck.isUndefined(lexiconTest[indexName])) { - lexiconTest[indexName] = false; - } - }); - lexers = Object.keys(lexiconTest).filter(function (indexName) { - return (lexiconTest[indexName] !== false); - }); - } - - for (i = 0; i < lexers.length; i++) { - indexName = lexers[i]; - indexdef = { - collation: 'http://marklogic.com/collation/', - 'namespace-uri': '', - localname: indexName, - }; - elementWordLexicon.push(indexdef); - } - - var rangeElementIndex = response.data['range-element-index']; - - var rangeTest = { - rangeKey1: 'string', - rangeKey2: 'string', - rangeKey3: 'int', - rangeKey4: 'int', - systemStartTime: 'dateTime', - systemEndTime: 'dateTime', - validStartTime: 'dateTime', - validEndTime: 'dateTime', - popularity: 'int', - amt: 'double', - score: 'double', - rate: 'int', - datetime: 'dateTime' - }; - var rangers = []; - if (valcheck.isNullOrUndefined(rangeElementIndex)) { - rangeElementIndex = []; - rangers = Object.keys(rangeTest); - } else { - rangeElementIndex.forEach(function (index) { - indexName = index.localname; - if (!valcheck.isUndefined(rangeTest[indexName])) { - rangeTest[indexName] = false; - } - }); - rangers = Object.keys(rangeTest).filter(function (indexName) { - return (rangeTest[indexName] !== false); - }); - } - - for (i = 0; i < rangers.length; i++) { - indexName = rangers[i]; - indexType = rangeTest[indexName]; - indexdef = { - 'scalar-type': indexType, - collation: (indexType === 'string') ? - 'http://marklogic.com/collation/' : '', - 'namespace-uri': '', - localname: indexName, - 'range-value-positions': false, - 'invalid-values': 'ignore' - }; - rangeElementIndex.push(indexdef); - } - var body = { - 'collection-lexicon': true, - 'triple-index': true, - 'schema-database': testconfig.testServerName + '-modules', - 'stemmed-searches': 'basic', - 'range-path-index': [ - { - 'scalar-type': 'decimal', - 'path-expression': 'price/amt', - collation: '', - 'range-value-positions': false, - 'invalid-values': 'reject' - } - ], - 'geospatial-path-index': [ - { - 'path-expression': 'gElemChildParent/gElemChildPoint', - 'coordinate-system': 'wgs84', - 'point-format': 'point', - 'range-value-positions': false, - 'invalid-values': 'reject' - } - ], - 'geospatial-element-index': [ - { - 'namespace-uri': '', - localname: 'gElemPoint', - 'coordinate-system': 'wgs84', - 'point-format': 'point', - 'range-value-positions': false, - 'invalid-values': 'reject' - }, - { - 'namespace-uri': '', - localname: 'gElemPointWgs84Double', - 'coordinate-system': 'wgs84/double', - 'point-format': 'point', - 'range-value-positions': false, - 'invalid-values': 'reject' - } - ], - 'geospatial-element-child-index': [ - { - 'parent-namespace-uri': '', - 'parent-localname': 'gElemChildParent', - 'namespace-uri': '', - localname: 'gElemChildPoint', - 'coordinate-system': 'wgs84', - 'point-format': 'point', - 'range-value-positions': false, - 'invalid-values': 'reject' - }, - { - 'parent-namespace-uri': '', - 'parent-localname': 'gElemChildParentEtrs89Double', - 'namespace-uri': '', - localname: 'gElemChildPointEtrs89Double', - 'coordinate-system': 'etrs89/double', - 'point-format': 'point', - 'range-value-positions': false, - 'invalid-values': 'reject' - } - ], - 'geospatial-element-pair-index': [ - { - 'parent-namespace-uri': '', - 'parent-localname': 'gElemPair', - 'latitude-namespace-uri': '', - 'latitude-localname': 'latitude', - 'longitude-namespace-uri': '', - 'longitude-localname': 'longitude', - 'coordinate-system': 'wgs84', - 'range-value-positions': false, - 'invalid-values': 'reject' - }, - { - 'parent-namespace-uri': '', - 'parent-localname': 'gElemPairRawDouble', - 'latitude-namespace-uri': '', - 'latitude-localname': 'latitudeRawDouble', - 'longitude-namespace-uri': '', - 'longitude-localname': 'longitudeRawDouble', - 'coordinate-system': 'raw/double', - 'range-value-positions': false, - 'invalid-values': 'reject' - } - ], - 'geospatial-element-attribute-pair-index': [ - { - 'parent-namespace-uri': '', - 'parent-localname': 'gAttrPair', - 'latitude-namespace-uri': '', - 'latitude-localname': 'latitude', - 'longitude-namespace-uri': '', - 'longitude-localname': 'longitude', - 'coordinate-system': 'wgs84', - 'range-value-positions': false, - 'invalid-values': 'reject' - } - ], - 'geospatial-region-path-index': [ - { - 'path-expression': '/root/item/point', - 'coordinate-system': 'wgs84', - 'geohash-precision': 1, - 'invalid-values': 'reject' - }, - { - 'path-expression': '/root/item/linestring', - 'coordinate-system': 'wgs84/double', - 'geohash-precision': 2, - 'invalid-values': 'ignore' - }, - { - 'path-expression': '/root/item/circle', - 'coordinate-system': 'wgs84/double', - 'geohash-precision': 1, - 'invalid-values': 'reject' - }, - { - 'path-expression': '/root/item/circle', - 'coordinate-system': 'wgs84', - 'geohash-precision': 1, - 'invalid-values': 'reject' - }, - { - 'path-expression': '/root/item/box', - 'coordinate-system': 'wgs84/double', - 'geohash-precision': 2, - 'invalid-values': 'ignore' - }, - { - 'path-expression': '/root/item/polygon', - 'coordinate-system': 'wgs84', - 'geohash-precision': 3, - 'invalid-values': 'reject' - }, - { - 'path-expression': '/root/item/complex-polygon', - 'coordinate-system': 'wgs84', - 'geohash-precision': 1, - 'invalid-values': 'ignore' - } - ] - }; - if (valcheck.isArray(elementWordLexicon) && elementWordLexicon.length > 0) { - body['element-word-lexicon'] = elementWordLexicon; - } - if (valcheck.isArray(rangeElementIndex) && rangeElementIndex.length > 0) { - body['range-element-index'] = rangeElementIndex; - } - - console.log('adding custom indexes for ' + testconfig.testServerName); - return manager.put({ - endpoint: '/manage/v2/databases/' + testconfig.testServerName + '/properties', - params: { - format: 'json' - }, - body: body, - hasResponse: true - }).result(); - }). - then(function (response) { - return manager.get({ - endpoint: '/manage/v2/databases/' + testconfig.testServerName + '/temporal/axes/systemTime' - }).result(); - }). - then(function (response) { - if (response.statusCode < 400) { - return this; - } - return createAxis(manager, 'system'); - }). - then(function (response) { - return manager.get({ - endpoint: '/manage/v2/databases/' + testconfig.testServerName + '/temporal/axes/validTime' - }).result(); - }). - then(function (response) { - if (response.statusCode < 400) { - return this; - } - return createAxis(manager, 'valid'); - }). - then(function (response) { - return manager.get({ - endpoint: '/manage/v2/databases/' + testconfig.testServerName + - '/temporal/collections/temporalCollection' - }).result(); - }). - then(function (response) { - if (response.statusCode < 400) { - return this; - } - return manager.post({ - endpoint: '/manage/v2/databases/' + testconfig.testServerName + '/temporal/collections', - body: { - 'collection-name': 'temporalCollection', - 'system-axis': 'systemTime', - 'valid-axis': 'validTime', - 'option': ['updates-safe'] - } - }).result(); - }). - then(function (response) { - return manager.get({ - endpoint: '/manage/v2/databases/' + testconfig.testServerName + - '/temporal/collections/temporalCollectionLsqt' - }).result(); - }). - then(function (response) { - if (response.statusCode < 400) { - return this; - } - return manager.post({ - endpoint: '/manage/v2/databases/' + testconfig.testServerName + - '/temporal/collections', - body: { - 'collection-name': 'temporalCollectionLsqt', - 'system-axis': 'systemTime', - 'valid-axis': 'validTime', - 'option': ['updates-safe'] - } - }).result(); - }). - then(function (response) { - return manager.put({ - endpoint: '/manage/v2/databases/' + testconfig.testServerName + '/temporal/collections/lsqt/properties?collection=temporalCollectionLsqt', - body: { - 'lsqt-enabled': true, - 'automation': { - 'enabled': true - } - } - }).result(); - }). - then(function (response) { - console.log(testconfig.testServerName + ' setup succeeded'); - }); - } else { - console.log(testconfig.testServerName + ' setup failed with HTTP status: ' + response.statusCode); - console.log(response.data); - } - }); - } else { - console.log(testconfig.testServerName + ' test server is available on port ' + - JSON.parse(response.data).port); - } - }); -} diff --git a/etc/test-setup.js b/etc/test-setup.js deleted file mode 100644 index 7bf1265f..00000000 --- a/etc/test-setup.js +++ /dev/null @@ -1,626 +0,0 @@ -/* -* Copyright (c) 2015-2025 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved. -*/ -const fs = require('fs'); -const valcheck = require('core-util-is'); -const marklogic = require('../lib/marklogic.js'); - -const promptForAdmin = require('./test-setup-prompt.js'); -const setupUsers = require('./test-setup-users.js'); - -const testlib = require('./test-lib.js'); -const testconfig = require('./test-config.js'); - -const moduleFiles = [ - { - uri:'/optic/test/masterDetail.tdex', - collections:['http://marklogic.com/xdmp/tde'], - contentType:'application/vnd.marklogic-tde+xml', - permissions: [ - {'role-name':'app-user', capabilities:['read']}, - {'role-name':'app-builder', capabilities:['read']}, - {'role-name':testconfig.restReaderConnection.user, capabilities:['read']}, - {'role-name':testconfig.restAdminConnection.user, capabilities:['read', 'update']} - ], - content:fs.createReadStream('./etc/data/masterDetail.tdex') - },{ - uri:'/optic/test/musician.tdex', - collections:['http://marklogic.com/xdmp/tde'], - contentType:'application/vnd.marklogic-tde+xml', - permissions: [ - {'role-name':'app-user', capabilities:['read']}, - {'role-name':'app-builder', capabilities:['read']}, - {'role-name':testconfig.restReaderConnection.user, capabilities:['read']}, - {'role-name':testconfig.restAdminConnection.user, capabilities:['read', 'update']} - ], - content:fs.createReadStream('./etc/data/musician.tdex') - },{ - uri:'/etc/optic/rowPostProcessors.sjs', - contentType:'application/vnd.marklogic-javascript', - permissions: [ - {'role-name':'app-user', capabilities:['read', 'execute']}, - {'role-name':'app-builder', capabilities:['read', 'execute']}, - {'role-name':testconfig.restReaderConnection.user, capabilities:['read', 'execute']}, - {'role-name':testconfig.restAdminConnection.user, capabilities:['read', 'execute', 'update']} - ], - content:fs.createReadStream('./etc/data/rowPostProcessors.sjs') - },{ - uri:'/etc/optic/employees.tdej', - contentType:'application/json', - collections:['http://marklogic.com/xdmp/tde'], - permissions: [ - {'role-name':'app-user', capabilities:['read', 'execute']}, - {'role-name':'app-builder', capabilities:['read', 'execute']}, - {'role-name':testconfig.restReaderConnection.user, capabilities:['read', 'execute']}, - {'role-name':testconfig.restAdminConnection.user, capabilities:['read', 'execute', 'update']} - ], - content:fs.createReadStream('./etc/data/employees.tdej') - }, { uri:'/etc/optic/unnestView.tdej', - contentType:'application/json', - collections:['http://marklogic.com/xdmp/tde'], - permissions: [ - {'role-name':'app-user', capabilities:['read', 'execute']}, - {'role-name':'app-builder', capabilities:['read', 'execute']}, - {'role-name':testconfig.restReaderConnection.user, capabilities:['read', 'execute', 'update']}, - {'role-name':testconfig.restWriterConnection.user, capabilities:['read', 'execute', 'update']}, - {'role-name':testconfig.restAdminConnection.user, capabilities:['read', 'execute', 'update']} - ], - content:fs.createReadStream('./etc/data/unnestView.tdej') - }, { uri:'/etc/articleCitation.json', - contentType:'application/json', - collections:['http://marklogic.com/xdmp/tde'], - permissions: [ - {'role-name':'app-user', capabilities:['read', 'execute']}, - {'role-name':'app-builder', capabilities:['read', 'execute']}, - {'role-name':testconfig.restReaderConnection.user, capabilities:['read', 'execute', 'update']}, - {'role-name':testconfig.restWriterConnection.user, capabilities:['read', 'execute', 'update']}, - {'role-name':testconfig.restAdminConnection.user, capabilities:['read', 'execute', 'update']} - ], - content:fs.createReadStream('./etc/data/articleCitation.json') - },{ uri:'/validation/validateDoc-test.json', - contentType:'application/json', - collections:['http://marklogic.com/xdmp/tde'], - permissions: [ - {'role-name':'app-user', capabilities:['read', 'execute']}, - {'role-name':'app-builder', capabilities:['read', 'execute']}, - {'role-name':testconfig.restReaderConnection.user, capabilities:['read', 'execute', 'update']}, - {'role-name':testconfig.restWriterConnection.user, capabilities:['read', 'execute', 'update']}, - {'role-name':testconfig.restAdminConnection.user, capabilities:['read', 'execute', 'update']} - ], - content:fs.createReadStream('./etc/data/validateDoc-test.json') - }, { uri:'/validateDoc-test.sch', - contentType:'application/vnd.marklogic-tde+xml', - permissions: [ - {'role-name':'app-user', capabilities:['read', 'execute']}, - {'role-name':'app-builder', capabilities:['read', 'execute']}, - {'role-name':testconfig.restReaderConnection.user, capabilities:['read', 'execute', 'update']}, - {'role-name':testconfig.restWriterConnection.user, capabilities:['read', 'execute', 'update']}, - {'role-name':testconfig.restAdminConnection.user, capabilities:['read', 'execute', 'update']} - ], - content:fs.createReadStream('./etc/data/validateDoc-test.sch') - },{ uri:'/validateDoc-test.sch-validator.xsl', - contentType:'application/vnd.marklogic-tde+xml', - permissions: [ - {'role-name':'app-user', capabilities:['read', 'execute']}, - {'role-name':'app-builder', capabilities:['read', 'execute']}, - {'role-name':testconfig.restReaderConnection.user, capabilities:['read', 'execute', 'update']}, - {'role-name':testconfig.restWriterConnection.user, capabilities:['read', 'execute', 'update']}, - {'role-name':testconfig.restAdminConnection.user, capabilities:['read', 'execute', 'update']} - ], - content:fs.createReadStream('./etc/data/validateDoc-test.sch-validator.xsl') - }, { - uri:'/optic/test/transformDoc-test.mjs', - contentType:'application/vnd.marklogic-javascript', - permissions: [ - {'role-name':'app-user', capabilities:['read', 'execute']}, - {'role-name':'app-builder', capabilities:['read', 'execute']}, - {'role-name':testconfig.restReaderConnection.user, capabilities:['read', 'execute', 'update']}, - {'role-name':testconfig.restWriterConnection.user, capabilities:['read', 'execute', 'update']}, - {'role-name':testconfig.restAdminConnection.user, capabilities:['read', 'execute', 'update']} - ], - content:fs.createReadStream('./etc/data/transformDoc-test.mjs') - }, - { - uri:'/optic/test/transformDoc-test.xslt', - contentType:'application/vnd.marklogic-tde+xml', - permissions: [ - {'role-name':'app-user', capabilities:['read', 'execute']}, - {'role-name':'app-builder', capabilities:['read', 'execute']}, - {'role-name':testconfig.restReaderConnection.user, capabilities:['read', 'execute', 'update']}, - {'role-name':testconfig.restWriterConnection.user, capabilities:['read', 'execute', 'update']}, - {'role-name':testconfig.restAdminConnection.user, capabilities:['read', 'execute', 'update']} - ], - content:fs.createReadStream('./etc/data/transformDoc-test.xslt') - }, - { - uri:'/optic/test/transformDoc-test-two-params.mjs', - contentType:'application/vnd.marklogic-tde+xml', - permissions: [ - {'role-name':'app-user', capabilities:['read', 'execute']}, - {'role-name':'app-builder', capabilities:['read', 'execute']}, - {'role-name':testconfig.restReaderConnection.user, capabilities:['read', 'execute', 'update']}, - {'role-name':testconfig.restWriterConnection.user, capabilities:['read', 'execute', 'update']}, - {'role-name':testconfig.restAdminConnection.user, capabilities:['read', 'execute', 'update']} - ], - content:fs.createReadStream('./etc/data/transformDoc-test-two-params.mjs') - } -]; - -const dataFiles = [ - { - uri:'/optic/test/masterDetail.xml', - collections:['/optic/test', '/schemas/inventory'], - permissions: [ - {'role-name':'app-user', capabilities:['read']}, - {'role-name':'app-builder', capabilities:['read', 'update']} - ], - content:fs.createReadStream('./etc/data/masterDetail.xml') - },{ - uri:'/optic/test/tripleSets.xml', - collections:['/optic/test', '/graphs/inventory'], - permissions: [ - {'role-name':'app-user', capabilities:['read']}, - {'role-name':'app-builder', capabilities:['read', 'update']} - ], - content:fs.createReadStream('./etc/data/tripleSets.xml') - },{ - uri:'/optic/test/queryDoc1.json', - collections:['/optic/test', '/optic/test1'], - permissions: [ - {'role-name':'app-user', capabilities:['read']}, - {'role-name':'app-builder', capabilities:['read', 'update']} - ], - content:{srchFood:'apples', srchNumber:2, srchLevel:20, srchCity:'Cairo', - srchPoint: '15.25, 15.25', - srchContainer:{srchColA:'common', srchColB:'outlier', srchColC:'common'}} - },{ - uri:'/optic/test/queryDoc2.json', - collections:['/optic/test', '/optic/test2'], - permissions: [ - {'role-name':'app-user', capabilities:['read']}, - {'role-name':'app-builder', capabilities:['read', 'update']} - ], - content:{srchFood:'banannas', srchNumber:3, srchLevel:30, srchCity:'Antioch', - srchPoint: '25.25, 25.25', - srchContainer:{srchColA:'common', srchColB:'common', srchColC:'outlier'}} - },{ - uri:'/optic/test/queryDoc3.json', - collections:['/optic/test', '/optic/test3'], - permissions: [ - {'role-name':'app-user', capabilities:['read']}, - {'role-name':'app-builder', capabilities:['read', 'update']} - ], - content:{srchFood:'citron', srchNumber:1, srchLevel:10, srchCity:'Bonn', - srchPoint: '35.25, 35.25', - srchContainer:{srchColA:'outlier', srchColB:'common', srchColC:'common'}} - },{ - uri:'/optic/test/musician1.json', - collections:['/optic/test', '/optic/music'], - permissions: [ - {'role-name':'app-user', capabilities:['read']}, - {'role-name':'app-builder', capabilities:['read', 'update']} - ], - content:{musician:{lastName:'Armstrong', firstName:'Louis', dob:'1901-08-04', instrument:['trumpet', 'vocal']}} - },{ - uri:'/optic/test/albums1.json', - collections:['/optic/test', '/optic/music'], - permissions: [ - {'role-name':'app-user', capabilities:['read']}, - {'role-name':'app-builder', capabilities:['read', 'update']} - ], - content:{style:['dixieland'], albums:[ - {triple:{subject:'/optic/test/albums1_1', predicate:'/optic/test/albumName', object:'Hot Fives'}}, - {triple:{subject:'/optic/test/albums1_1', predicate:'/optic/test/musicianUri', object:'/optic/test/musician1.json'}}, - {triple:{subject:'/optic/test/albums1_2', predicate:'/optic/test/albumName', object:'Porgy and Bess'}}, - {triple:{subject:'/optic/test/albums1_2', predicate:'/optic/test/musicianUri', object:'/optic/test/musician1.json'}} - ]} - },{ - uri:'/optic/test/musician2.json', - collections:['/optic/test', '/optic/music'], - permissions: [ - {'role-name':'app-user', capabilities:['read']}, - {'role-name':'app-builder', capabilities:['read', 'update']} - ], - content:{musician:{lastName:'Byron', firstName:'Don', dob:'1958-11-08', instrument:['clarinet', 'saxophone']}} - },{ - uri:'/optic/test/albums2.json', - collections:['/optic/test', '/optic/music'], - permissions: [ - {'role-name':'app-user', capabilities:['read']}, - {'role-name':'app-builder', capabilities:['read', 'update']} - ], - content:{style:['avantgarde'], albums:[ - {triple:{subject:'/optic/test/albums2_1', predicate:'/optic/test/albumName', object:'Four Thoughts on Marvin Gaye'}}, - {triple:{subject:'/optic/test/albums2_1', predicate:'/optic/test/musicianUri', object:'/optic/test/musician2.json'}}, - {triple:{subject:'/optic/test/albums2_2', predicate:'/optic/test/albumName', object:'A Ballad For Many'}}, - {triple:{subject:'/optic/test/albums2_2', predicate:'/optic/test/musicianUri', object:'/optic/test/musician2.json'}} - ]} - },{ - uri:'/optic/test/musician3.json', - collections:['/optic/test', '/optic/music'], - permissions: [ - {'role-name':'app-user', capabilities:['read']}, - {'role-name':'app-builder', capabilities:['read', 'update']} - ], - content:{musician:{lastName:'Coltrane', firstName:'John', dob:'1926-09-23', instrument:['saxophone']}} - },{ - uri:'/optic/test/albums3.json', - collections:['/optic/test', '/optic/music'], - permissions: [ - {'role-name':'app-user', capabilities:['read']}, - {'role-name':'app-builder', capabilities:['read', 'update']} - ], - content:{style:['avantgarde'], albums:[ - {triple:{subject:'/optic/test/albums3_1', predicate:'/optic/test/albumName', object:'Impressions'}}, - {triple:{subject:'/optic/test/albums3_1', predicate:'/optic/test/musicianUri', object:'/optic/test/musician3.json'}}, - {triple:{subject:'/optic/test/albums3_2', predicate:'/optic/test/albumName', object:'Crescent'}}, - {triple:{subject:'/optic/test/albums3_2', predicate:'/optic/test/musicianUri', object:'/optic/test/musician3.json'}} - ]} - },{ - uri:'/optic/test/musician4.json', - collections:['/optic/test', '/optic/music'], - permissions: [ - {'role-name':'app-user', capabilities:['read']}, - {'role-name':'app-builder', capabilities:['read', 'update']} - ], - content:{musician:{lastName:'Davis', firstName:'Miles', dob:'1926-05-26', instrument:['trumpet']}} - },{ - uri:'/optic/test/albums4.json', - collections:['/optic/test', '/optic/music'], - permissions: [ - {'role-name':'app-user', capabilities:['read']}, - {'role-name':'app-builder', capabilities:['read', 'update']} - ], - content:{style:['modal'], albums:[ - {triple:{subject:'/optic/test/albums4_1', predicate:'/optic/test/albumName', object:'Kind of Blue'}}, - {triple:{subject:'/optic/test/albums4_1', predicate:'/optic/test/musicianUri', object:'/optic/test/musician4.json'}}, - {triple:{subject:'/optic/test/albums4_2', predicate:'/optic/test/albumName', object:'In a Silent Way'}}, - {triple:{subject:'/optic/test/albums4_2', predicate:'/optic/test/musicianUri', object:'/optic/test/musician4.json'}} - ]} - },{ - uri:'/graphQL-Publisher_1.xml', - collections:['/graphQL'], - permissions: [ - {'role-name':'rest-reader', capabilities:['read']}, - {'role-name':'rest-writer', capabilities:['read', 'update']} - ], - content:fs.createReadStream('./etc/data/Publisher-1.xml') - },{ - uri:'/graphQL-Publisher_2.xml', - collections:['/graphQL'], - permissions: [ - {'role-name':'rest-reader', capabilities:['read']}, - {'role-name':'rest-writer', capabilities:['read', 'update']} - ], - content:fs.createReadStream('./etc/data/Publisher-2.xml') - }]; - -promptForAdmin(createManager); - -function createManager(adminUser, adminPassword) { - testconfig.manageAdminConnection.user = adminUser; - testconfig.manageAdminConnection.password = adminPassword; - - const manageClient = - marklogic.createDatabaseClient(testconfig.manageAdminConnection); - const manager = testlib.createManager(manageClient); - - setupUsers(manager, setup); -} -function createAxis(manager, name) { - return manager.post({ - endpoint: '/manage/v2/databases/'+testconfig.testServerName+'/temporal/axes', - body: { - 'axis-name': name+'Time', - 'axis-start': { - 'element-reference': { - 'namespace-uri': '', - 'localname': name+'StartTime', - 'scalar-type': 'dateTime' - } - }, - 'axis-end': { - 'element-reference': { - 'namespace-uri': '', - 'localname': name+'EndTime', - 'scalar-type': 'dateTime' - } - } - } - }).result(); -} -function setup(manager) { - console.log('checking for '+testconfig.testServerName); - manager.get({ - endpoint: '/v1/rest-apis/'+testconfig.testServerName - }). - result(function(response) { - if (response.statusCode === 404) { - console.log('creating database and REST server for '+testconfig.testServerName); - manager.post({ - endpoint: '/v1/rest-apis', - body: { - 'rest-api': { - name: testconfig.testServerName, - group: 'Default', - database: testconfig.testServerName, - 'modules-database': testconfig.testServerName+'-modules', - port: testconfig.restPort - } - } - }). - result(function(response) { - if (response.statusCode === 201) { - console.log('getting default indexes for '+testconfig.testServerName); - manager.get({ - endpoint: '/manage/v2/databases/'+testconfig.testServerName+'/properties' - }).result(). - then(function(response) { - let indexName = null; - let indexType = null; - let indexdef = null; - let i = null; - - const lexiconTest = { - defaultWordKey: true, - taggedWordKey: true - }; - let elementWordLexicon = response.data['element-word-lexicon']; - let lexers = []; - if (valcheck.isNullOrUndefined(elementWordLexicon)) { - elementWordLexicon = []; - lexers = Object.keys(lexiconTest); - } else { - elementWordLexicon.forEach(function(index){ - indexName = index.localname; - if (!valcheck.isUndefined(lexiconTest[indexName])) { - lexiconTest[indexName] = false; - } - }); - lexers = Object.keys(lexiconTest).filter(function(indexName){ - return (lexiconTest[indexName] !== false); - }); - } - - for (i=0; i < lexers.length; i++) { - indexName = lexers[i]; - indexdef = { - collation: 'http://marklogic.com/collation/', - 'namespace-uri': '', - localname: indexName, - }; - elementWordLexicon.push(indexdef); - } - - const rangeTest = { - rangeKey1: 'string', - rangeKey2: 'string', - rangeKey3: 'int', - rangeKey4: 'int', - rangeKey5: 'int', - srchCity: 'string', - srchLevel: 'int', - srchNumber: 'int', - systemStartTime: 'dateTime', - systemEndTime: 'dateTime', - validStartTime: 'dateTime', - validEndTime: 'dateTime' - }; - let rangeElementIndex = response.data['range-element-index']; - let rangers = []; - if (valcheck.isNullOrUndefined(rangeElementIndex)) { - rangeElementIndex = []; - rangers = Object.keys(rangeTest); - } else { - rangeElementIndex.forEach(function(index){ - indexName = index.localname; - if (!valcheck.isUndefined(rangeTest[indexName])) { - rangeTest[indexName] = false; - } - }); - rangers = Object.keys(rangeTest).filter(function(indexName){ - return (rangeTest[indexName] !== false); - }); - } - - for (i=0; i < rangers.length; i++) { - indexName = rangers[i]; - indexType = rangeTest[indexName]; - indexdef = { - 'scalar-type': indexType, - collation: (indexType === 'string') ? - 'http://marklogic.com/collation/' : '', - 'namespace-uri': '', - localname: indexName, - 'range-value-positions': false, - 'invalid-values': 'ignore' - }; - rangeElementIndex.push(indexdef); - } - - const pointGeospatialIndex = { - 'namespace-uri': '', - localname: 'point', - 'coordinate-system': 'wgs84', - 'range-value-positions': false, - 'point-format': 'point', - 'invalid-values': 'ignore' - }; - let geospatialElementIndex = response.data['geospatial-element-index']; - - if (valcheck.isNullOrUndefined(geospatialElementIndex)) { - geospatialElementIndex = [pointGeospatialIndex]; - } else if (geospatialElementIndex.some( - makeIndexTester(pointGeospatialIndex.localname) - )) { - geospatialElementIndex = null; - } else { - geospatialElementIndex.push(pointGeospatialIndex); - } - - const body = { - 'collection-lexicon': true, - 'uri-lexicon': true, - 'triple-index': true, - 'schema-database': testconfig.testServerName+'-modules', - }; - - if (valcheck.isArray(elementWordLexicon) && elementWordLexicon.length > 0) { - body['element-word-lexicon'] = elementWordLexicon; - } - if (valcheck.isArray(rangeElementIndex) && rangeElementIndex.length > 0) { - body['range-element-index'] = rangeElementIndex; - } - if (valcheck.isArray(geospatialElementIndex) && - geospatialElementIndex.length > 0) { - body['geospatial-element-index'] = geospatialElementIndex; - } - - console.log('adding custom indexes for '+testconfig.testServerName); - return manager.put({ - endpoint: '/manage/v2/databases/'+testconfig.testServerName+'/properties', - params: { - format: 'json' - }, - body: body, - hasResponse: true - }).result(); - }). - then(function(response) { - console.log('checking system temporal axis'); - return manager.get({ - endpoint: '/manage/v2/databases/'+testconfig.testServerName+'/temporal/axes/systemTime' - }).result(); - }). - then(function(response) { - if (response.statusCode < 400) { - return this; - } - console.log('creating system temporal axis'); - return createAxis(manager, 'system'); - }). - then(function(response) { - console.log('checking valid temporal axis'); - return manager.get({ - endpoint: '/manage/v2/databases/'+testconfig.testServerName+'/temporal/axes/validTime' - }).result(); - }). - then(function(response) { - if (response.statusCode < 400) { - return this; - } - console.log('creating valid temporal axis'); - return createAxis(manager, 'valid'); - }). - then(function(response) { - console.log('checking temporal collection'); - return manager.get({ - endpoint: '/manage/v2/databases/'+testconfig.testServerName+ - '/temporal/collections/temporalCollection' - }).result(); - }). - then(function(response) { - if (response.statusCode < 400) { - return this; - } - console.log('creating temporal collection'); - return manager.post({ - endpoint: '/manage/v2/databases/'+testconfig.testServerName+'/temporal/collections', - body: { - 'collection-name': 'temporalCollection', - 'system-axis': 'systemTime', - 'valid-axis': 'validTime', - option: ['updates-admin-override'] - } - }).result(); - }). - then(function(response) { - return manager.get({ - endpoint: '/manage/v2/databases/'+testconfig.testServerName+ - '/temporal/collections/lsqt/properties?collection=temporalCollection' - }).result(); - }). - then(function(response) { - // 2017-10-24: Commenting out, LSQT enablement required for LSQT testing - // if (response.statusCode < 400) { - // return this; - // } - console.log('configuring LSQT'); - return manager.put({ - endpoint: '/manage/v2/databases/'+testconfig.testServerName+ - '/temporal/collections/lsqt/properties?collection=temporalCollection', - body: { - 'lsqt-enabled': true, - automation: { - enabled: false - } - } - }).result(); - }). - then(function(response){ - console.log('setting up modules database resources'); - const modDb = marklogic.createDatabaseClient({ - database: testconfig.testServerName+'-modules', - host: testconfig.manageAdminConnection.host, - port: testconfig.manageAdminConnection.port, - user: testconfig.manageAdminConnection.user, - password: testconfig.manageAdminConnection.password, - authType: testconfig.manageAdminConnection.authType - }); - return modDb.documents.write(moduleFiles).result(); - }). -/* TODO: advance LSQT after creating documents - then(function(response) { - const evalConnection = { - host: testconfig.testHost, - port: testconfig.restPort, - user: testconfig.manageAdminConnection.user, - password: testconfig.manageAdminConnection.password, - authType: testconfig.restAuthType - }; - const evalClient = marklogic.createDatabaseClient(evalConnection); - return evalClient.xqueryEval( - 'xquery version "1.0-ml"; '+ - 'import module namespace temporal = "http://marklogic.com/xdmp/temporal" '+ - ' at "/MarkLogic/temporal.xqy"; '+ - 'temporal:advance-lsqt("temporalCollection")' - ).result(); - }). - */ - then(function(response){ - console.log('setting up sample documents'); - const db = marklogic.createDatabaseClient({ - host: testconfig.restWriterConnection.host, - port: testconfig.restWriterConnection.port, - user: testconfig.restWriterConnection.user, - password: testconfig.restWriterConnection.password, - authType: testconfig.restWriterConnection.authType - }); - return db.documents.write(dataFiles).result(); - }). - then(function(response) { - console.log(testconfig.testServerName+' setup succeeded'); - }). - catch(function(err) { - console.log('failed to set up '+testconfig.testServerName+' server:\n'+ - JSON.stringify(err, null, 2)); - process.exit(1); - }); - } else { - console.log(testconfig.testServerName+' setup failed with HTTP status: '+response.statusCode); - console.log(response.data); - process.exit(1); - } - }); - } else { - console.log(testconfig.testServerName+' test server is available on port '+ - JSON.parse(response.data).port); - } - }); -} - -function makeIndexTester(testLocalname) { - return function indexTester(index) { - return (index.localname === testLocalname); - }; -} diff --git a/etc/test-teardown-dmsdk-qa.js b/etc/test-teardown-dmsdk-qa.js deleted file mode 100644 index f8c5718b..00000000 --- a/etc/test-teardown-dmsdk-qa.js +++ /dev/null @@ -1,76 +0,0 @@ -/* -* Copyright (c) 2015-2025 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved. -*/ -var marklogic = require('../lib/marklogic.js'); - -var testlib = require('./test-lib.js'); -//var promptForAdmin = require('./test-setup-prompt.js'); -var testconfig = require('./test-config-qa.js'); - -//promptForAdmin(createManager); -createManager('admin', 'admin'); - -function createManager(adminUser, adminPassword) { - testconfig.manageAdminConnection.user = adminUser; - testconfig.manageAdminConnection.password = adminPassword; - - var manageClient = - marklogic.createDatabaseClient(testconfig.manageAdminConnection); - var manager = testlib.createManager(manageClient); - - setup(manager); -} -function setup(manager) { - console.log('checking for '+testconfig.dmsdktestServerName); - manager.get({ - endpoint: '/v1/rest-apis/'+testconfig.dmsdktestServerName - }). - result(function(response) { - if (response.statusCode === 404) { - console.log(testconfig.dmsdktestServerName+' not found - nothing to delete'); - } else { - console.log('removing database and REST server for '+testconfig.dmsdktestServerName); - manager.put({ - endpoint: '/manage/v2/databases/'+testconfig.dmsdktestServerName+'/properties', - params: { - format: 'json' - }, - body: { - 'schema-database': 'Schemas' - }, - hasResponse: true - }).result(). - then(function(response) { - return manager.post({ - endpoint: '/manage/v2/databases/' + testconfig.dmsdktestServerName, - contentType: 'application/json', - accept: 'application/json', - body: {'operation': 'clear-database'} - }).result(); - }). - then(function(response) { - return manager.post({ - endpoint: '/manage/v2/databases/' + testconfig.dmsdktestServerName+'-modules', - contentType: 'application/json', - accept: 'application/json', - body: {'operation': 'clear-database'} - }).result(); - }). - then(setTimeout(function(response) { - return manager.remove({ - endpoint: '/v1/rest-apis/'+testconfig.dmsdktestServerName, - accept: 'application/json', - params: {include: ['content', 'modules']} - }).result(); - }, 10000)). - then(setTimeout(function(response) { - console.log('teardown succeeded - restart the server'); - }, - function(error) { - console.log('failed to tear down '+testconfig.dmsdktestServerName+' server:\n'+ - JSON.stringify(error)); - }, 10000)); - } - }); -} - diff --git a/etc/test-teardown-nodeOpticFunctionalTest.js b/etc/test-teardown-nodeOpticFunctionalTest.js deleted file mode 100644 index f8c5718b..00000000 --- a/etc/test-teardown-nodeOpticFunctionalTest.js +++ /dev/null @@ -1,76 +0,0 @@ -/* -* Copyright (c) 2015-2025 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved. -*/ -var marklogic = require('../lib/marklogic.js'); - -var testlib = require('./test-lib.js'); -//var promptForAdmin = require('./test-setup-prompt.js'); -var testconfig = require('./test-config-qa.js'); - -//promptForAdmin(createManager); -createManager('admin', 'admin'); - -function createManager(adminUser, adminPassword) { - testconfig.manageAdminConnection.user = adminUser; - testconfig.manageAdminConnection.password = adminPassword; - - var manageClient = - marklogic.createDatabaseClient(testconfig.manageAdminConnection); - var manager = testlib.createManager(manageClient); - - setup(manager); -} -function setup(manager) { - console.log('checking for '+testconfig.dmsdktestServerName); - manager.get({ - endpoint: '/v1/rest-apis/'+testconfig.dmsdktestServerName - }). - result(function(response) { - if (response.statusCode === 404) { - console.log(testconfig.dmsdktestServerName+' not found - nothing to delete'); - } else { - console.log('removing database and REST server for '+testconfig.dmsdktestServerName); - manager.put({ - endpoint: '/manage/v2/databases/'+testconfig.dmsdktestServerName+'/properties', - params: { - format: 'json' - }, - body: { - 'schema-database': 'Schemas' - }, - hasResponse: true - }).result(). - then(function(response) { - return manager.post({ - endpoint: '/manage/v2/databases/' + testconfig.dmsdktestServerName, - contentType: 'application/json', - accept: 'application/json', - body: {'operation': 'clear-database'} - }).result(); - }). - then(function(response) { - return manager.post({ - endpoint: '/manage/v2/databases/' + testconfig.dmsdktestServerName+'-modules', - contentType: 'application/json', - accept: 'application/json', - body: {'operation': 'clear-database'} - }).result(); - }). - then(setTimeout(function(response) { - return manager.remove({ - endpoint: '/v1/rest-apis/'+testconfig.dmsdktestServerName, - accept: 'application/json', - params: {include: ['content', 'modules']} - }).result(); - }, 10000)). - then(setTimeout(function(response) { - console.log('teardown succeeded - restart the server'); - }, - function(error) { - console.log('failed to tear down '+testconfig.dmsdktestServerName+' server:\n'+ - JSON.stringify(error)); - }, 10000)); - } - }); -} - diff --git a/etc/test-teardown-qa.js b/etc/test-teardown-qa.js deleted file mode 100644 index b9ba184b..00000000 --- a/etc/test-teardown-qa.js +++ /dev/null @@ -1,131 +0,0 @@ -/* -* Copyright (c) 2015-2025 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved. -*/ -var marklogic = require('../lib/marklogic.js'); - -var testlib = require('./test-lib.js'); -//var promptForAdmin = require('./test-setup-prompt.js'); -var testconfig = require('./test-config-qa.js'); - -//promptForAdmin(createManager); -createManager('admin', 'admin'); - -function createManager(adminUser, adminPassword) { - testconfig.manageAdminConnection.user = adminUser; - testconfig.manageAdminConnection.password = adminPassword; - - var manageClient = - marklogic.createDatabaseClient(testconfig.manageAdminConnection); - var manager = testlib.createManager(manageClient); - - setup(manager); -} -function setup(manager) { - console.log('checking for '+testconfig.testServerName); - manager.get({ - endpoint: '/v1/rest-apis/'+testconfig.testServerName - }). - result(function(response) { - if (response.statusCode === 404) { - console.log(testconfig.testServerName+' not found - nothing to delete'); - } else { - console.log('removing database and REST server for '+testconfig.testServerName); - manager.put({ - endpoint: '/manage/v2/databases/'+testconfig.testServerName+'/properties', - params: { - format: 'json' - }, - body: { - 'schema-database': 'Schemas' - }, - hasResponse: true - }).result(). - then(function(response) { - return manager.post({ - endpoint: '/manage/v2/databases/' + testconfig.testServerName, - contentType: 'application/json', - accept: 'application/json', - body: {'operation': 'clear-database'} - }).result(); - }). - then(function(response) { - return manager.post({ - endpoint: '/manage/v2/databases/' + testconfig.testServerName+'-modules', - contentType: 'application/json', - accept: 'application/json', - body: {'operation': 'clear-database'} - }).result(); - }). - /*then(function(response) { - return manager.remove({ - endpoint: '/manage/v2/databases/'+testconfig.testServerName+'/temporal/collections?collection=temporalCollection' - }).result(); - }). - then(function(response) { - return manager.remove({ - endpoint: '/manage/v2/databases/'+testconfig.testServerName+'/temporal/collections?collection=temporalCollectionLsqt' - }).result(); - }). - then(function(response) { - return manager.remove({ - endpoint: '/manage/v2/databases/'+testconfig.testServerName+'/temporal/axes/systemTime' - }).result(); - }). - then(function(response) { - return manager.remove({ - endpoint: '/manage/v2/databases/'+testconfig.testServerName+'/temporal/axes/validTime' - }).result(); - }).*/ - then(setTimeout(function(response) { - return manager.remove({ - endpoint: '/manage/v2/users/rest-evaluator' - }).result(); - }, 3000)). - then(function(response) { - return manager.remove({ - endpoint: '/manage/v2/users/rest-admin' - }).result(); - }). - then(function(response) { - return manager.remove({ - endpoint: '/manage/v2/users/rest-writer' - }).result(); - }). - then(function(response) { - return manager.remove({ - endpoint: '/manage/v2/users/rest-reader' - }).result(); - }). - then(function(response) { - return manager.remove({ - endpoint: '/manage/v2/users/rest-temporal-writer' - }).result(); - }). - then(function(response) { - return manager.remove({ - endpoint: '/manage/v2/roles/rest-evaluator' - }).result(); - }). - then(function(response) { - return manager.remove({ - endpoint: '/manage/v2/roles/rest-temporal-writer' - }).result(); - }). - then(setTimeout(function(response) { - return manager.remove({ - endpoint: '/v1/rest-apis/'+testconfig.testServerName, - accept: 'application/json', - params: {include: ['content', 'modules']} - }).result(); - }, 10000)). - then(setTimeout(function(response) { - console.log('teardown succeeded - restart the server'); - }, - function(error) { - console.log('failed to tear down '+testconfig.testServerName+' server:\n'+ - JSON.stringify(error)); - }, 10000)); - } - }); -} - diff --git a/etc/test-teardown.js b/etc/test-teardown.js deleted file mode 100644 index f4d68da1..00000000 --- a/etc/test-teardown.js +++ /dev/null @@ -1,73 +0,0 @@ -/* -* Copyright (c) 2015-2025 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved. -*/ -var marklogic = require('../lib/marklogic.js'); - -var testlib = require('./test-lib.js'); -var promptForAdmin = require('./test-setup-prompt.js'); -var testconfig = require('./test-config.js'); - -promptForAdmin(createManager); - -function createManager(adminUser, adminPassword) { - testconfig.manageAdminConnection.user = adminUser; - testconfig.manageAdminConnection.password = adminPassword; - - var manageClient = - marklogic.createDatabaseClient(testconfig.manageAdminConnection); - var manager = testlib.createManager(manageClient); - - setup(manager); -} -function setup(manager) { - console.log('checking for '+testconfig.testServerName); - manager.get({ - endpoint: '/v1/rest-apis/'+testconfig.testServerName - }). - result(function(response) { - if (response.statusCode === 404) { - console.log(testconfig.testServerName+' not found - nothing to delete'); - } else { - console.log('removing database and REST server for '+testconfig.testServerName); - manager.post({ - endpoint: '/manage/v2/databases/' + testconfig.testServerName, - contentType: 'application/json', - accept: 'application/json', - body: {'operation': 'clear-database'} - }).result(). - then(function(response) { - return manager.post({ - endpoint: '/manage/v2/databases/' + testconfig.testServerName+'-modules', - contentType: 'application/json', - accept: 'application/json', - body: {'operation': 'clear-database'} - }).result(); - }). - then(function(response) { - return manager.put({ - endpoint: '/manage/v2/databases/'+testconfig.testServerName+'/properties', - params: { - format: 'json' - }, - body: {'schema-database': 'Schemas'}, - hasResponse: true - }).result(); - }). - then(function(response) { - return manager.remove({ - endpoint: '/v1/rest-apis/'+testconfig.testServerName, - accept: 'application/json', - params: {include: ['content', 'modules']} - }).result(); - }). - then(function(response) { - console.log('teardown succeeded - restart the server'); - }, - function(error) { - console.log('failed to tear down '+testconfig.testServerName+' server:\n'+ - JSON.stringify(error, null, 2)); - }); - } - }); -} - diff --git a/etc/users-setup.js b/etc/users-setup.js deleted file mode 100644 index c5f027f5..00000000 --- a/etc/users-setup.js +++ /dev/null @@ -1,25 +0,0 @@ -/* -* Copyright (c) 2015-2025 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved. -*/ -var valcheck = require('core-util-is'); - -var marklogic = require('../lib/marklogic.js'); - -var promptForAdmin = require('./test-setup-prompt.js'); -var setupUsers = require('./test-setup-users.js'); - -var testlib = require('./test-lib.js'); -var testconfig = require('./test-config.js'); - -promptForAdmin(createManager); - -function createManager(adminUser, adminPassword) { - testconfig.manageAdminConnection.user = adminUser; - testconfig.manageAdminConnection.password = adminPassword; - - var manageClient = - marklogic.createDatabaseClient(testconfig.manageAdminConnection); - var manager = testlib.createManager(manageClient); - - setupUsers(manager); -} diff --git a/package.json b/package.json index b8e2083f..36676144 100644 --- a/package.json +++ b/package.json @@ -8,10 +8,7 @@ "main": "./lib/marklogic.js", "scripts": { "doc": "gulp doc", - "lint": "gulp lint", - "test:setup": "node etc/test-setup.js", - "test:teardown": "node etc/test-teardown.js", - "test": "gulp test" + "lint": "gulp lint" }, "keywords": [ "marklogic", diff --git a/test-basic/rows.js b/test-basic/rows.js index f0ea8121..704a7fbe 100644 --- a/test-basic/rows.js +++ b/test-basic/rows.js @@ -236,7 +236,6 @@ describe('rows', function(){ }); describe('from a TDE view', function(){ - // View defined in etc/data/employees.tdej const planFromBuilderTemplate = p.fromView('company', 'employees', '') .select(['EmployeeID', 'FirstName', 'LastName']) .orderBy('LastName'); diff --git a/test-complete-app-mlDeploy/build.gradle b/test-complete-app-mlDeploy/build.gradle index d18b836d..3fcc0516 100644 --- a/test-complete-app-mlDeploy/build.gradle +++ b/test-complete-app-mlDeploy/build.gradle @@ -1,7 +1,3 @@ -/** - * This Gradle file is used to add a certificate template to the app that is created via the bespoke - * deployer in test-setup-qa.js and test-setup-dmsdk-qa.js. - */ plugins { id "net.saliman.properties" version "1.5.1" id "com.marklogic.ml-gradle" version "6.1.0" @@ -46,4 +42,4 @@ tasks.register("curlCompanies", Exec) { } mlDeploy.finalizedBy curlPeople -mlDeploy.finalizedBy curlCompanies \ No newline at end of file +mlDeploy.finalizedBy curlCompanies diff --git a/test-complete-app/build.gradle b/test-complete-app/build.gradle deleted file mode 100644 index 9b3e099a..00000000 --- a/test-complete-app/build.gradle +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This Gradle file is used to add a certificate template to the app that is created via the bespoke - * deployer in test-setup-qa.js and test-setup-dmsdk-qa.js. - */ -plugins { - id "net.saliman.properties" version "1.5.1" - id "com.marklogic.ml-gradle" version "6.0.1" -} - -/* - * Since our REST API server uses a certificate template, we need to execute an extra command to generate a temporary - * certificate for this template - without that, the REST API server won't be able to receive HTTP or HTTPS requests. - */ -ext { - def command = new com.marklogic.appdeployer.command.security.GenerateTemporaryCertificateCommand() - command.setTemplateIdOrName("ssl-project-template") - command.setCommonName("localhost") - command.setValidFor(365) - mlAppDeployer.commands.add(command) -} diff --git a/test-complete-app/gradle.properties b/test-complete-app/gradle.properties deleted file mode 100644 index 3d61cb0a..00000000 --- a/test-complete-app/gradle.properties +++ /dev/null @@ -1,5 +0,0 @@ -mlHost=localhost -mlUsername=admin -mlPassword=admin - -mlNoRestServer=true diff --git a/test-complete-app/gradle/wrapper/gradle-wrapper.jar b/test-complete-app/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 7f93135c..00000000 Binary files a/test-complete-app/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/test-complete-app/gradle/wrapper/gradle-wrapper.properties b/test-complete-app/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index d4081da4..00000000 --- a/test-complete-app/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,7 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip -networkTimeout=10000 -validateDistributionUrl=true -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/test-complete-app/gradlew b/test-complete-app/gradlew deleted file mode 100755 index 1aa94a42..00000000 --- a/test-complete-app/gradlew +++ /dev/null @@ -1,249 +0,0 @@ -#!/bin/sh - -# -# Copyright © 2015-2021 the original authors. -# -# 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 -# -# https://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. -# - -############################################################################## -# -# Gradle start up script for POSIX generated by Gradle. -# -# Important for running: -# -# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is -# noncompliant, but you have some other compliant shell such as ksh or -# bash, then to run this script, type that shell name before the whole -# command line, like: -# -# ksh Gradle -# -# Busybox and similar reduced shells will NOT work, because this script -# requires all of these POSIX shell features: -# * functions; -# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», -# «${var#prefix}», «${var%suffix}», and «$( cmd )»; -# * compound commands having a testable exit status, especially «case»; -# * various built-in commands including «command», «set», and «ulimit». -# -# Important for patching: -# -# (2) This script targets any POSIX shell, so it avoids extensions provided -# by Bash, Ksh, etc; in particular arrays are avoided. -# -# The "traditional" practice of packing multiple parameters into a -# space-separated string is a well documented source of bugs and security -# problems, so this is (mostly) avoided, by progressively accumulating -# options in "$@", and eventually passing that to Java. -# -# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, -# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; -# see the in-line comments for details. -# -# There are tweaks for specific operating systems such as AIX, CygWin, -# Darwin, MinGW, and NonStop. -# -# (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt -# within the Gradle project. -# -# You can find Gradle at https://github.com/gradle/gradle/. -# -############################################################################## - -# Attempt to set APP_HOME - -# Resolve links: $0 may be a link -app_path=$0 - -# Need this for daisy-chained symlinks. -while - APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path - [ -h "$app_path" ] -do - ls=$( ls -ld "$app_path" ) - link=${ls#*' -> '} - case $link in #( - /*) app_path=$link ;; #( - *) app_path=$APP_HOME$link ;; - esac -done - -# This is normally unused -# shellcheck disable=SC2034 -APP_BASE_NAME=${0##*/} -# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD=maximum - -warn () { - echo "$*" -} >&2 - -die () { - echo - echo "$*" - echo - exit 1 -} >&2 - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "$( uname )" in #( - CYGWIN* ) cygwin=true ;; #( - Darwin* ) darwin=true ;; #( - MSYS* | MINGW* ) msys=true ;; #( - NONSTOP* ) nonstop=true ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD=$JAVA_HOME/jre/sh/java - else - JAVACMD=$JAVA_HOME/bin/java - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD=java - if ! command -v java >/dev/null 2>&1 - then - die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -fi - -# Increase the maximum file descriptors if we can. -if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then - case $MAX_FD in #( - max*) - # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC2039,SC3045 - MAX_FD=$( ulimit -H -n ) || - warn "Could not query maximum file descriptor limit" - esac - case $MAX_FD in #( - '' | soft) :;; #( - *) - # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC2039,SC3045 - ulimit -n "$MAX_FD" || - warn "Could not set maximum file descriptor limit to $MAX_FD" - esac -fi - -# Collect all arguments for the java command, stacking in reverse order: -# * args from the command line -# * the main class name -# * -classpath -# * -D...appname settings -# * --module-path (only if needed) -# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. - -# For Cygwin or MSYS, switch paths to Windows format before running java -if "$cygwin" || "$msys" ; then - APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) - - JAVACMD=$( cygpath --unix "$JAVACMD" ) - - # Now convert the arguments - kludge to limit ourselves to /bin/sh - for arg do - if - case $arg in #( - -*) false ;; # don't mess with options #( - /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath - [ -e "$t" ] ;; #( - *) false ;; - esac - then - arg=$( cygpath --path --ignore --mixed "$arg" ) - fi - # Roll the args list around exactly as many times as the number of - # args, so each arg winds up back in the position where it started, but - # possibly modified. - # - # NB: a `for` loop captures its iteration list before it begins, so - # changing the positional parameters here affects neither the number of - # iterations, nor the values presented in `arg`. - shift # remove old arg - set -- "$@" "$arg" # push replacement arg - done -fi - - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - -# Collect all arguments for the java command: -# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, -# and any embedded shellness will be escaped. -# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be -# treated as '${Hostname}' itself on the command line. - -set -- \ - "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ - "$@" - -# Stop when "xargs" is not available. -if ! command -v xargs >/dev/null 2>&1 -then - die "xargs is not available" -fi - -# Use "xargs" to parse quoted args. -# -# With -n1 it outputs one arg per line, with the quotes and backslashes removed. -# -# In Bash we could simply go: -# -# readarray ARGS < <( xargs -n1 <<<"$var" ) && -# set -- "${ARGS[@]}" "$@" -# -# but POSIX shell has neither arrays nor command substitution, so instead we -# post-process each arg (as a line of input to sed) to backslash-escape any -# character that might be a shell metacharacter, then use eval to reverse -# that process (while maintaining the separation between arguments), and wrap -# the whole thing up as a single "set" statement. -# -# This will of course break if any of these variables contains a newline or -# an unmatched quote. -# - -eval "set -- $( - printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | - xargs -n1 | - sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | - tr '\n' ' ' - )" '"$@"' - -exec "$JAVACMD" "$@" diff --git a/test-complete-app/gradlew.bat b/test-complete-app/gradlew.bat deleted file mode 100644 index 6689b85b..00000000 --- a/test-complete-app/gradlew.bat +++ /dev/null @@ -1,92 +0,0 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%"=="" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%"=="" set DIRNAME=. -@rem This is normally unused -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if %ERRORLEVEL% equ 0 goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if %ERRORLEVEL% equ 0 goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -set EXIT_CODE=%ERRORLEVEL% -if %EXIT_CODE% equ 0 set EXIT_CODE=1 -if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% -exit /b %EXIT_CODE% - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/test-complete-app/src/main/ml-config/security/certificate-templates/template-1.xml b/test-complete-app/src/main/ml-config/security/certificate-templates/template-1.xml deleted file mode 100644 index d745328d..00000000 --- a/test-complete-app/src/main/ml-config/security/certificate-templates/template-1.xml +++ /dev/null @@ -1,17 +0,0 @@ - - ssl-project-template - This template is used to demonstrate how ml-gradle can enable SSL for an app server - rsa - - - 0 - - US - VA - McLean - MarkLogic - Sales - nobody@marklogic.com - - - \ No newline at end of file diff --git a/test-complete-app/src/main/ml-config/servers/rest-api-server.json b/test-complete-app/src/main/ml-config/servers/rest-api-server.json deleted file mode 100644 index 47819895..00000000 --- a/test-complete-app/src/main/ml-config/servers/rest-api-server.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "server-name": "node-client-api-ssl-server", - "port": 8016, - "server-type": "http", - "root": "/", - "content-database": "node-client-api-rest-server", - "modules-database": "node-client-api-rest-server-modules", - "default-error-format": "json", - "error-handler": "/MarkLogic/rest-api/error-handler.xqy", - "url-rewriter": "/MarkLogic/rest-api/rewriter.xml", - "rewrite-resolves-globally": true, - "authentication": "digestbasic", - "ssl-certificate-template": "ssl-project-template" -} \ No newline at end of file