Skip to content

Commit a2e5027

Browse files
authored
Develop (#941)
* Fixing Issue #440: Adding example w/ gradle props Adding a new example that utilizes gradle properties within deployment configuration files for substitutions for variables. This eliminates the need to utilize the mlAppConfig extension in build.gradle files * E2E/bug fixes -- tests for some bug fixes (#927) * modify verification on advanced setting * add tests on primary key and duplicate properties * modify verification on trace headers * added step on run input flow to set output uri suffix * added mlcpInput page object * DHFPROD-496 make consistent with current tutorial (#933) Remove title declarations since we don't define a title property in the tutuorial. * DHFPROD-675 add index confirm for save new entity * added step to update index after initial entity creation (#940)
1 parent e2846cb commit a2e5027

File tree

7 files changed

+196
-2
lines changed

7 files changed

+196
-2
lines changed

examples/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
This folder contains working examples of various DHF usage scenarios.
44

55
1. [barebones](https://github.com/marklogic/marklogic-data-hub/tree/master/examples/barebones) - an example of the minimum configuration necessary to run a Gradle based Data Hub
6+
1. [custom-tokens](https://github.com/marklogic/marklogic-data-hub/tree/master/examples/custom-tokens) - an example where gradle environment properties are used in substitutions of configuration files that is based off of the barebones example
67
1. [healthcare](https://github.com/marklogic/marklogic-data-hub/tree/master/examples/healthcare) - an example of a Healthcare 360 Data Hub
78
1. [hr-hub](https://github.com/marklogic/marklogic-data-hub/tree/master/examples/hr-hub) - an example used for our 1.x tutorial. This example harmonizes data from various HR systems
89
1. [load-binaries](https://github.com/marklogic/marklogic-data-hub/tree/master/examples/load-binaries) - an example of how to ingest binaries via an MLCP Input Flow
910
1. [online-store](https://github.com/marklogic/marklogic-data-hub/tree/master/examples/online-store) - the example we use for our [Tutorial](https://marklogic.github.io/marklogic-data-hub/tutorial/)
11+
1. [single-step-ingest](https://github.com/marklogic/marklogic-data-hub/tree/master/examples/single-step-ingest) - an example of a custom REST endpoint that a user can call that will ingest a document into the STAGING database and then harmonize the same document immediately after the document was ingested
1012
1. [spring-batch](https://github.com/marklogic/marklogic-data-hub/tree/master/examples/spring-batch) - an example of how to load relational data into a Data Hub using Spring Batch
1113
1. [ssl](https://github.com/marklogic/marklogic-data-hub/tree/master/examples/ssl) - an example of how to configure your Data Hub to use SSL for added security

examples/custom-tokens/README.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Custom Tokens Example
2+
3+
This example demonstrates how to utilize gradle environment properties that are substituted in configuraton files within the MarkLogic deployment process. We are basing this example off of the [barebones example](https://github.com/marklogic/marklogic-data-hub/tree/master/examples/barebones).
4+
5+
This example utilizes gradle environment properties that are substituted in the configuration files for a user defined database and application server. You can see the environment properties that are defined at the bottom of the `gradle.properties` file.
6+
7+
Inside of the `gradle.properties` file, you can see the following information:
8+
9+
```
10+
# Custom properties defined here
11+
TEST_DATABASE_NAME=custom-tokens-test-database
12+
TEST_SERVER_NAME=custom-tokens-test-database-server
13+
TEST_SERVER_PORT=8014
14+
TEST_TRACE_AUTH=digest
15+
```
16+
17+
To utilize the custom tokens, then you will need to refer to them as `%%TEST_DATABASE_NAME%%` if you want to reference the `TEST_DATABASE_NAME` name token within your gradle deployment. You can change the default token prefix and suffix from "%%" by utilizing the following tokens in your `gradle.properties` file by setting the appropriate prefix and suffix values according:
18+
19+
```
20+
mlTokenPrefix=
21+
mlTokenSuffix=
22+
```
23+
For more information regarding this, then you can refer to the [ml-gradle wiki](https://github.com/marklogic-community/ml-gradle/wiki/Configuring-resources)
24+
25+
You can see that we are referencing the new custom tokens within the `custom-tokens-test-server.json` file. We are utilizing the four (4) custom tokens that we defined in our properties file which are the following: `%%TEST_SERVER_NAME%%`, `%%TEST_SERVER_PORT%%`, `%%TEST_DATABASE_NAME%%`, and `%%TEST_TRACE_AUTH%%`.
26+
27+
```json
28+
{
29+
"server-name": "%%TEST_SERVER_NAME%%",
30+
"server-type": "http",
31+
"root": "/",
32+
"group-name": "%%GROUP%%",
33+
"port": "%%TEST_SERVER_PORT%%",
34+
"modules-database": "%%mlModulesDbName%%",
35+
"content-database": "%%TEST_DATABASE_NAME%%",
36+
"authentication": "%%TEST_TRACE_AUTH%%",
37+
"default-error-format": "json",
38+
"error-handler": "/MarkLogic/rest-api/error-handler.xqy",
39+
"url-rewriter": "/MarkLogic/rest-api/rewriter.xml",
40+
"rewrite-resolves-globally": true
41+
}
42+
```
43+
44+
Next, Initialize your DHF app:
45+
46+
```bash
47+
gradle hubInit
48+
```
49+
50+
Then Bootstrap your DHF app with the user defined database and application that utilized custom tokens:
51+
52+
```bash
53+
gradle mlDeploy
54+
```
55+
Once the deployment is complete, then you can login to the admin console and see the new test database and test database application server that were created with the values that were specified from our properties file. Now that you've mastered utilizing custom tokens for your gradle deployment, you can continue on with your DHF app development.
56+
57+
For a complete list of gradle tasks, check here: [https://github.com/marklogic/marklogic-data-hub/wiki/Gradle-Tasks](https://github.com/marklogic/marklogic-data-hub/wiki/Gradle-Tasks)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
plugins {
2+
// this plugin lets you create properties files
3+
// for multiple environments... like dev, qa, prod
4+
id 'net.saliman.properties' version '1.4.6'
5+
6+
// this is the data hub framework gradle plugin
7+
// it includes ml-gradle. This plugin is what lets you
8+
// run DHF (Data Hub Framework) tasks from the
9+
// command line
10+
id 'com.marklogic.ml-data-hub' version '2.0.4'
11+
}
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# These settings are used by the Data Hub Framework when
2+
# communicating with MarkLogic.
3+
# The values in this file are meant as project-wide settings.
4+
# You can override these properties for a specific environment
5+
# by creating a gradle-{environment}.properties file.
6+
# For example, to create a properties file for your prod environment create a file
7+
# named gradle-prod.properties.
8+
#
9+
# ....
10+
mlHost=localhost
11+
12+
# Your MarkLogic Username and Password
13+
mlUsername=admin
14+
mlPassword=admin
15+
16+
# If specified, the manage username/password combo is used with the ML Management REST API for managing application
17+
# resources; this user must have the manage-admin and rest-admin roles.
18+
#
19+
# If these are not set, then mlUsername/mlPassword is used for managing application resources.
20+
# mlManageUsername=
21+
# mlManagePassword=
22+
23+
# If specified, the admin username/password combo is used with the ML Management REST API for creating users and roles. This
24+
# user must have the manage-admin or admin role. A good practice is to use your admin account here to create app-specific
25+
# users and roles, which can then be used as mlManageUsername/mlManagePassword and mlUsername/mlPassword.
26+
#
27+
# These properties are also used for connecting to the admin application on port 8001 - e.g. for initializing ML and for
28+
# waiting for ML to restart.
29+
#
30+
# If these properties are not set, then mlUsername/mlPassword will be used.
31+
# mlAdminUsername=
32+
# mlAdminPassword=
33+
34+
# If specified, these values can override where the DHF thinks
35+
# MarkLogic default ports are at. You would only use this if you
36+
# have changed the ports on which MarkLogic listens
37+
#
38+
# mlAppServicesPort=8000
39+
# mlAdminPort=8001
40+
# mlManagePort=8002
41+
42+
mlStagingAppserverName=data-hub-STAGING
43+
mlStagingPort=8010
44+
mlStagingDbName=data-hub-STAGING
45+
mlStagingForestsPerHost=4
46+
mlStagingAuth=digest
47+
48+
mlFinalAppserverName=data-hub-FINAL
49+
mlFinalPort=8011
50+
mlFinalDbName=data-hub-FINAL
51+
mlFinalForestsPerHost=4
52+
mlFinalAuth=digest
53+
54+
mlTraceAppserverName=data-hub-TRACING
55+
mlTracePort=8012
56+
mlTraceDbName=data-hub-TRACING
57+
mlTraceForestsPerHost=1
58+
mlTraceAuth=digest
59+
60+
mlJobAppserverName=data-hub-JOBS
61+
mlJobPort=8013
62+
mlJobDbName=data-hub-JOBS
63+
mlJobForestsPerHost=1
64+
mlJobAuth=digest
65+
66+
mlModulesDbName=data-hub-MODULES
67+
mlModulesForestsPerHost=1
68+
69+
mlTriggersDbName=data-hub-TRIGGERS
70+
mlTriggersForestsPerHost=1
71+
72+
mlSchemasDbName=data-hub-SCHEMAS
73+
mlSchemasForestsPerHost=1
74+
75+
# You can override this to specify an alternate folder for your
76+
# custom forest info. Defaults to user-config/forests/
77+
# mlCustomForestPath=forests
78+
79+
# The name of the Role to create for Hub Access
80+
mlHubUserRole=data-hub-role
81+
mlHubUserName=data-hub-user
82+
# this password is autogenerated for you via the 'gradle hubInit' task
83+
mlHubUserPassword=b$I7'3Ya|&;Ohw.ZzsDY
84+
85+
# Custom properties defined here
86+
TEST_DATABASE_NAME=custom-tokens-test-database
87+
TEST_SERVER_NAME=custom-tokens-test-database-server
88+
TEST_SERVER_PORT=8014
89+
TEST_TRACE_AUTH=digest
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"database-name": "%%TEST_DATABASE_NAME%%"
3+
}
4+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"server-name": "%%TEST_SERVER_NAME%%",
3+
"server-type": "http",
4+
"root": "/",
5+
"group-name": "%%GROUP%%",
6+
"port": "%%TEST_SERVER_PORT%%",
7+
"modules-database": "%%mlModulesDbName%%",
8+
"content-database": "%%TEST_DATABASE_NAME%%",
9+
"authentication": "%%TEST_TRACE_AUTH%%",
10+
"default-error-format": "json",
11+
"error-handler": "/MarkLogic/rest-api/error-handler.xqy",
12+
"url-rewriter": "/MarkLogic/rest-api/rewriter.xml",
13+
"rewrite-resolves-globally": true
14+
}
15+

quick-start/e2e/specs/create/create.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ export default function() {
9090
expect(entityPage.entityEditor.isPresent()).toBe(true);
9191
entityPage.entityTitle.sendKeys('Order');
9292
entityPage.saveEntity.click();
93+
browser.wait(EC.elementToBeClickable(entityPage.confirmDialogYesButton));
94+
expect(entityPage.confirmDialogYesButton.isPresent()).toBe(true);
95+
entityPage.confirmDialogYesButton.click();
96+
browser.wait(EC.presenceOf(entityPage.toast));
97+
browser.wait(EC.stalenessOf(entityPage.toast));
9398
browser.wait(EC.visibilityOf(entityPage.getEntityBox('Order')));
9499
expect(entityPage.getEntityBox('Order').isDisplayed()).toBe(true);
95100
console.log('click edit Order entity');
@@ -113,6 +118,11 @@ export default function() {
113118
expect(entityPage.entityEditor.isPresent()).toBe(true);
114119
entityPage.entityTitle.sendKeys('Product');
115120
entityPage.saveEntity.click();
121+
browser.wait(EC.elementToBeClickable(entityPage.confirmDialogYesButton));
122+
expect(entityPage.confirmDialogYesButton.isPresent()).toBe(true);
123+
entityPage.confirmDialogYesButton.click();
124+
browser.wait(EC.presenceOf(entityPage.toast));
125+
browser.wait(EC.stalenessOf(entityPage.toast));
116126
browser.wait(EC.visibilityOf(entityPage.getEntityBox('Product')));
117127
expect(entityPage.getEntityBox('Product').isDisplayed()).toBe(true);
118128
console.log('click edit Product entity');
@@ -316,6 +326,11 @@ export default function() {
316326
entityPage.getPropertyType(lastProperty).element(by.cssContainingText('option', 'string')).click();
317327
entityPage.getPropertyDescription(lastProperty).sendKeys('remove-prop1 description');
318328
entityPage.saveEntity.click();
329+
browser.wait(EC.elementToBeClickable(entityPage.confirmDialogYesButton));
330+
expect(entityPage.confirmDialogYesButton.isPresent()).toBe(true);
331+
entityPage.confirmDialogYesButton.click();
332+
browser.wait(EC.presenceOf(entityPage.toast));
333+
browser.wait(EC.stalenessOf(entityPage.toast));
319334
browser.wait(EC.visibilityOf(entityPage.getEntityBox('removeEntity')));
320335
entityPage.toolsButton.click();
321336
//remove removeEntity entity
@@ -334,6 +349,9 @@ export default function() {
334349
expect(entityPage.entityEditor.isPresent()).toBe(true);
335350
entityPage.entityTitle.sendKeys('TestEntity');
336351
entityPage.saveEntity.click();
352+
browser.wait(EC.elementToBeClickable(entityPage.confirmDialogNoButton));
353+
expect(entityPage.confirmDialogNoButton.isPresent()).toBe(true);
354+
entityPage.confirmDialogNoButton.click();
337355
browser.wait(EC.visibilityOf(entityPage.getEntityBox('TestEntity')));
338356
expect(entityPage.getEntityBox('TestEntity').isDisplayed()).toBe(true);
339357
entityPage.toolsButton.click();
@@ -376,8 +394,6 @@ export default function() {
376394
entityPage.getPropertyPrimaryKeyColumn(lastProperty).click();
377395
entityPage.getPropertyType(lastProperty).element(by.cssContainingText('option', 'integer')).click();
378396
entityPage.getPropertyDescription(lastProperty).sendKeys("this is our primary key");
379-
380-
381397
//let's save it now that it's populated
382398
entityPage.saveEntity.click();
383399
browser.wait(EC.elementToBeClickable(entityPage.confirmDialogNoButton));

0 commit comments

Comments
 (0)