-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
129 changed files
with
7,428 additions
and
6,553 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# http://editorconfig.org | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false | ||
|
||
[*.java] | ||
indent_size = 4 |
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,17 @@ | ||
# Defines files to ignore when running "npm pack" | ||
test | ||
docker | ||
build | ||
.idea | ||
.gradle | ||
.dockerignore | ||
.editorconfig | ||
.gitignore | ||
.jshintrc | ||
CONTRIBUTING.md | ||
Jenkinsfile | ||
*.tar | ||
*.tgz | ||
docs | ||
examples | ||
config/test* |
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,114 @@ | ||
This guide provides instructions on developing and testing changes to this project. | ||
|
||
First, before doing anything, run: | ||
|
||
npm install | ||
|
||
## Running the default Koop server for ad hoc testing | ||
|
||
If you'd like to do some manual ad hoc testing, you should first clone the marklogic-geo-data-services project and read | ||
the CONTRIBUTING guide there for instructions on deploying the examples/sample-project application. That application | ||
installs an app server in your MarkLogic instance on port 8095. You can then run the default Koop server (which does not | ||
require any authentication): | ||
|
||
npm start | ||
|
||
This will expose a Koop server at http://localhost:80 . | ||
|
||
## Running the automated tests | ||
|
||
The tests for this project are located in a Gradle project in the `./test` directory. These tests are expected to run | ||
against the test application that is deployed by the marklogic-geo-data-services project. So you'll first need to | ||
follow the CONTRIBUTING guide for that repository in order to deploy the test application in that repository. | ||
|
||
These tests depend on hitting 2 different Koop servers: | ||
|
||
1. A Koop server on port 8090 that doesn't require authentication. | ||
2. A Koop server on port 8091 that requires MarkLogic-based authentication. | ||
|
||
To run the tests with both Koop servers active, do the following: | ||
|
||
cd test | ||
./gradlew runKoopServers test | ||
|
||
You can also run these tests from Intellij. You'll need to run the Koop servers manually. For most of the tests, | ||
run this first from the root project directory so that you have a Koop server that doesn't require auth and points to | ||
port 8096 in your MarkLogic instance: | ||
|
||
npm run start-for-tests | ||
|
||
## Testing the provider locally | ||
|
||
The ./examples/local-publish-testing project can be used to test publishing this project's npm package to a local | ||
registry and then using it in an example project built with [the Koop CLI](https://koopjs.github. | ||
io/docs/basics/quickstart). | ||
|
||
You'll first need a local npm registry. For that, [install verdaccio](https://verdaccio.org/): | ||
|
||
npm install -g verdaccio | ||
|
||
Then run it: | ||
|
||
verdaccio | ||
|
||
You can go to http://localhost:4873 to verify that it's running correctly. And you'll need to follow the first | ||
instruction there, which is to add a user: | ||
|
||
npm adduser --registry http://localhost:4873 | ||
|
||
You can add any username/password you want, and the email does not need to be a real address. | ||
|
||
Now, publish this project's npm package to the local verdaccio registry (it's okay if you forget to specify the | ||
registry; the operation will fail because you're not authorized to publish to the real npm): | ||
|
||
npm publish --registry http://localhost:4873 | ||
|
||
After doing so, http://localhost:4873/-/web/detail/@koopjs/provider-marklogic should now show the package that you just | ||
published. | ||
|
||
You can now run the local-publish-testing project. You'll first need to install the | ||
[Koop CLI](https://koopjs.github.io/docs/basics/quickstart) if you have not already: | ||
|
||
npm install -g @koopjs/cli | ||
|
||
Now run the local-publish-testing project using the Koop CLI and the package you just published locally: | ||
|
||
cd examples/local-publish-testing | ||
npm install | ||
koop serve | ||
|
||
This should launch a Koop server on port 8080. You can verify this via the following URLs: | ||
|
||
- http://localhost:8080/ = should display "Welcome to Koop!" | ||
- http://localhost:8080/marklogic/rest/services/GDeltExample/FeatureServer/0 = should return a JSON feature service | ||
descriptor | ||
|
||
## Testing the application zip | ||
|
||
The "Installation Guide" in this project's docs directory describes how a user can download a versioned application | ||
zip to use as a starting point for running a Koop server with the MarkLogic Koop provider in it. You can build and | ||
test this zip locally via the following steps: | ||
|
||
1. Run `npm pack` . This will produce a `koopjs-provider-marklogic-(version).tgz` file in the root of this project. | ||
2. Extract the file, which will create a `package` directory (which is gitignore'd). | ||
|
||
Then, follow the rest of the steps in the Installation Guide to configure and run the application. | ||
|
||
## Testing the documentation locally | ||
|
||
The docs for this project are stored in the `./docs` directory as a set of Markdown files. These are published via | ||
[GitHub Pages](https://docs.github.com/en/pages/getting-started-with-github-pages/about-github-pages) using the | ||
configuration found under "Settings / Pages" in this repository. | ||
|
||
You can build and test the docs locally by | ||
[following these GitHub instructions](https://docs.github.com/en/pages/setting-up-a-github-pages-site-with-jekyll/testing-your-github-pages-site-locally-with-jekyll), | ||
though you don't need to perform all of those steps since some of the files generated by doing so are already in the | ||
`./docs` directory. You just need to do the following: | ||
|
||
1. Install the latest Ruby (rbenv works well for this). | ||
2. Install Jekyll. | ||
3. Go to the docs directory - `cd ./docs` . | ||
4. Run `bundle install` (this may not be necessary due to Gemfile.lock being in version control). | ||
5. Run `bundle exec jekyll serve`. | ||
|
||
You can then go to http://localhost:4000 to view the docs. |
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 @@ | ||
@Library('shared-libraries') _ | ||
pipeline{ | ||
agent {label 'devExpLinuxPool'} | ||
options { | ||
checkoutToSubdirectory 'marklogic-koop-provider' | ||
buildDiscarder logRotator(artifactDaysToKeepStr: '7', artifactNumToKeepStr: '', daysToKeepStr: '30', numToKeepStr: '') | ||
} | ||
environment{ | ||
JAVA_HOME_DIR="/home/builder/java/jdk-11.0.2" | ||
NODE_HOME_DIR="/home/builder/nodeJs/node-v14.15.4-linux-x64" | ||
GRADLE_DIR =".gradle" | ||
DMC_USER = credentials('MLBUILD_USER') | ||
DMC_PASSWORD = credentials('MLBUILD_PASSWORD') | ||
} | ||
stages{ | ||
stage('tests'){ | ||
steps{ | ||
copyRPM 'Latest','11' | ||
setUpML '$WORKSPACE/xdmp/src/Mark*.rpm' | ||
gitCheckout 'marklogic-geo-data-services','https://github.com/marklogic-community/marklogic-geo-data-services.git','develop'; | ||
sh label:'test', script: '''#!/bin/bash | ||
export JAVA_HOME=$JAVA_HOME_DIR | ||
export GRADLE_USER_HOME=$WORKSPACE/$GRADLE_DIR | ||
export PATH=$NODE_HOME_DIR/bin:$GRADLE_USER_HOME:$JAVA_HOME/bin:$PATH | ||
cd $WORKSPACE/marklogic-geo-data-services | ||
./gradlew -i mlDeploy loadTestData -PmlUsername=admin -PmlPassword=admin || true | ||
cd $WORKSPACE/marklogic-koop-provider | ||
npm install | ||
cd test | ||
./gradlew runKoopServers test || true | ||
''' | ||
junit '**/build/**/*.xml' | ||
} | ||
} | ||
} | ||
} |
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
Oops, something went wrong.