Skip to content

Commit

Permalink
feat(dashboard): Introduced a new module to enable DCM 2.0 Dashboards…
Browse files Browse the repository at this point in the history
…. This module is lazy loaded by default, and will not cause any breaking changes.
  • Loading branch information
raouldh authored and Thomas van Leeuwen committed Jan 27, 2023
1 parent 90452e5 commit 9b41206
Show file tree
Hide file tree
Showing 131 changed files with 4,537 additions and 306 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
cypress/videos
cypress/screenshots
cypress/snapshots/**/*.diff.png
cypress/report
cypress-visual-screenshots/comparison
cypress-visual-screenshots/diff

Expand Down Expand Up @@ -58,3 +59,6 @@ license.aql

/tools/**/
/tools/7z.*
/cypress/report/mocha
/runtime-clone
tempVersion.txt
11 changes: 11 additions & 0 deletions HOW_TO_DASHBOARD.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# DCM Dashboard
Besides regular Blueriq UI components this repository now also includes specific components to use in a Blueriq application that servers as a dashboard.

MyBlueriq documentation on DCM dashboard UI: https://my.blueriq.com/pages/viewpage.action?pageId=166822999

## Dashboard module
The `DashboardModule` is an Angular module that loads under the root routing path `/dashboard`.
The path following this root should be the name of a dashboard definition that is retrieved from a configurable endpoint inside `environment.ts`.
You can use the module as is or use it as a template to build on.
No extra steps are required on making it work expect of course having the right backend services running.
Find a more detailed explanation on how and what on MyBlueriq.
3 changes: 3 additions & 0 deletions angular.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"cli": {
"analytics": false
},
"version": 1,
"newProjectRoot": "projects",
"projects": {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified cypress-visual-screenshots/baseline/visualtesting.cy.ts-menu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 15 additions & 8 deletions cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,41 @@ const getCompareSnapshotsPlugin = require('cypress-image-diff-js/dist/plugin');
export default defineConfig({
viewportWidth: 1920,
viewportHeight: 4000,

reporter: 'junit',
reporter: './node_modules/cypress-multi-reporters',
reporterOptions: {
mochaFile: 'cypress/results/cypress-report.xml',
toConsole: true,
reporterEnabled: 'mochawesome',
mochawesomeReporterOptions: {
reportDir: 'cypress/report/mocha',
quite: true,
overwrite: false,
html: false,
json: true,
},
},
pageLoadTimeout: 180000,
responseTimeout: 120000,
e2e: {
// 1337 = local frontend used for local testing
// 9081 = docker frontend used on CI
baseUrl: 'http://localhost:9081/',
baseUrl: 'http://localhost:4200/',
setupNodeEvents(on, config) {
// implement node event listeners here
getCompareSnapshotsPlugin(on, config);

on('before:browser:launch', (browser, launchOptions) => {
if (browser.name === 'chrome') {
launchOptions.args.push('--force-device-scale-factor=1');
launchOptions.args.push('--window-size=1920,1080')
launchOptions.args.push('--window-size=1920,1080');
}

if (browser.name === 'electron') {
launchOptions.preferences.width = 1920
launchOptions.preferences.height = 1080
launchOptions.preferences.width = 1920;
launchOptions.preferences.height = 1080;
}
return launchOptions;
});
},
specPattern: 'cypress/**/*.cy.{js,jsx,ts,tsx}'
},
retries: 3,
});
2 changes: 1 addition & 1 deletion cypress/Dockerfile.cypress
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ RUN --mount=type=bind,target=/docker-context \
# 1: `docker pull cypress/included:X.Y.Z` (like: cypress/included:9.7.0)
# 2: run `docker images --digests`
# 3: copy the sha and replace it with the sha below
FROM cypress/included:10.3.0@sha256:942468cdb722c408607093f60eeb1b4ff098a384f9123bf2ded36f55d4c96352 as cypress
FROM cypress/included:10.11.0@sha256:058d1834239bf09b381325b8369d05e9e0516a46b65b32e6dc0c991801dc517a as cypress

COPY --from=workspace /usr/src/ /usr/src/

Expand Down
11 changes: 10 additions & 1 deletion cypress/Dockerfile.cypress.dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
.git/
**/docker/
./angular/
./idea/
docker/
node_modules/
dist/
runtime-clone/
videos/
report/
screenshots/
local-dev/
tools/
src/
56 changes: 46 additions & 10 deletions cypress/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ properties([
],
parameters([
gitParameter(name: 'BRANCH_NAME', defaultValue: 'master', selectedValue: 'DEFAULT', type: 'PT_BRANCH'),
string(name: 'RUNTIME_BRANCH', defaultValue: 'master', description: "The runtime branch to test against"),
])
])
node {
Expand All @@ -17,6 +18,10 @@ node {
env.PATH = "${env.JAVA_HOME}\\bin;${mvnHome}\\bin;${nodeHome};${env.PATH}";
env.COMPOSE_PROJECT_NAME = "material-e2e-cypress";

def cdsVersion;
def dashboardVersion = '0.0.1-M16'
def dcmListsVersion;

stage('checkout') {
checkout scm;
bat "git checkout ${params.BRANCH_NAME}";
Expand All @@ -38,14 +43,13 @@ node {
}
}

stage('docker prepare') {
withCredentials([file(credentialsId: 'BLUERIQ_LICENSE_15', variable: 'license_file')]) {
writeFile file: './cypress/docker/config/license.aql', text: readFile(license_file)
}
bat "yarn e2e:docker-prepare";
}

try {
stage('docker prepare') {
withCredentials([file(credentialsId: 'BLUERIQ_LICENSE_15', variable: 'license_file')]) {
writeFile file: './cypress/docker/config/license.aql', text: readFile(license_file)
}
bat "yarn e2e:docker-prepare";
}
stage('e2e tests') {
withCredentials([file(credentialsId: 'npmrc_file', variable: 'npmrc_file')]) {
bat "ant -f scripts/docker/e2e.xml run " +
Expand All @@ -54,10 +58,34 @@ node {
"-DnpmrcFileLocation=${npmrc_file}"
}
}
}
finally {
stage('docker down') {
bat "yarn e2e:docker-down";
}
}

try {
stage('docker prepare dashboards') {
withCredentials([file(credentialsId: 'BLUERIQ_LICENSE_15', variable: 'license_file')]) {
writeFile file: './cypress/docker/dashboards/config/runtime/license.aql', text: readFile(license_file)
writeFile file: './cypress/docker/dashboards/config/case-engine/license.aql', text: readFile(license_file)
}
bat "yarn e2e:docker-prepare-dashboards -overrideVersion=true -runtimeBranch=${params.RUNTIME_BRANCH} -runtimeUrl=${env.RUNTIME_GIT_URL}";
}

stage('e2e tests-dashboards') {
withCredentials([file(credentialsId: 'npmrc_file', variable: 'npmrc_file')]) {
bat "ant -f scripts/docker/e2e.xml run-e2e-dashboards " +
"-Ddocker.host=bq-docker-lin.blueriq.local " +
"-Dcommit=${env.GIT_COMMIT} " +
"-DnpmrcFileLocation=${npmrc_file}"
}
}
}
finally {
stage('docker down') {
bat "yarn e2e:docker-down";
bat "yarn e2e:docker-down-dashboards";
}
}
} catch (anyException) {
Expand All @@ -66,10 +94,18 @@ node {
} finally {
stage("Publish results") {
// Test results
step([$class: 'JUnitResultArchiver', testResults: 'results/cypress-report.xml', allowEmptyResults: true])
dir('cypress/report'){
publishHTML([ allowMissing : false,
alwaysLinkToLastBuild: false,
keepAll : true,
reportDir : 'mochareports',
reportFiles : 'report.html',
reportName : 'Cypress e2e report',
reportTitles : 'Cypress e2e report'])
}

// archive integration outputs
archiveArtifacts artifacts: 'videos/*, screenshots/**/*, snapshots/**/*.diff.png, tmp/e2e-logs.txt, diff/*, comparison/*'
archiveArtifacts artifacts: 'cypress/videos/*, cypress/screenshots/**/*, cypress/snapshots/**/*.diff.png, tmp/e2e-logs.txt, cypress-visual-screenshots/diff/*, cypress-visual-screenshots/comparison/*'
}
notifyBuildStatus();
deleteDir();
Expand Down
7 changes: 5 additions & 2 deletions cypress/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
actually copies this war to its container

# How to test

Run `yarn e2e:dev` to execute the end-to-end tests via Cypress.
Run `yarn e2e:dev` to execute the end-to-end tests via Cypress when you everything running from docker
This will first start docker with a runtime, customerdata and dcm list and after completion it will start the Cypress UI

Run `yarn e2e:local` to execute the end-to-end tests via Cypress when you everything running from your local environment (make sure to check your ports!)

## Visual regression testing

The chosen library for visual regression testing is `cypress-image-diff-js`.
Expand All @@ -23,3 +24,5 @@ In order to update the baseline, the following steps need to be taken:
* Run the `blueriq-material-e2e-cypress` job on CI (with the desired branch selected).
* Navigate to the `comparison` directory on the CI job build artifacts and download the created screenshots.
* Copy the contents of the downloaded `comparison` directory to the `../cypress-visual-screenshots/baseline` directory.


13 changes: 13 additions & 0 deletions cypress/docker/dashboards/Dockerfile.CASEENGINE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM docker-internal.blueriq.com/tomcat9-jdk17:1.0
LABEL maintainer="support@blueriq.com"

ARG BLUERIQ_LICENSE
ENV JAVA_OPTS="-Dspring.config.additional-location=file:///config/blueriq-case-engine/ -Djava.security.egd=file:/dev/./urandom -Dlogging.file.name=runtime.log -Duser.timezone=Europe/Amsterdam -Xmx768m"
ENV JAVA_TOOL_OPTIONS -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:8000
ENV JPDA_ADDRESS="8000"
ENV JPDA_TRANSPORT="dt_socket"
EXPOSE 8080 8000

COPY preparations/blueriq-runtime-application-*.war /usr/local/tomcat/webapps/runtime.war
COPY dashboards/config/case-engine /config/blueriq-case-engine/
COPY dashboards/config/exports /config/blueriq-case-engine/exports/
13 changes: 13 additions & 0 deletions cypress/docker/dashboards/Dockerfile.CDS
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM openjdk:17-jdk-slim

LABEL maintainer="support@blueriq.com"

ENV JAVA_TOOL_OPTIONS -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:8000
EXPOSE 8080 8000

COPY preparations/blueriq-customerdata-sql-store-standalone-*.jar ~/customerdata.jar
COPY dashboards/config/customerdata/blueriq-customerdata-odata-service-v1.yml /config/blueriq-customerdata/

WORKDIR ~

ENTRYPOINT ["java", "-Dspring.config.additional-location=file:///config/blueriq-customerdata/", "-jar", "customerdata.jar", "-Xmx384m" ]
12 changes: 12 additions & 0 deletions cypress/docker/dashboards/Dockerfile.DASHBOARD
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM openjdk:17-slim@sha256:aaa3b3cb27e3e520b8f116863d0580c438ed55ecfa0bc126b41f68c3f62f9774

LABEL maintainer="support@blueriq.com"

EXPOSE 8080

COPY preparations/blueriq-dcm-dashboard-service-standalone-*.jar ~/dashboard.jar
COPY dashboards/config/dashboard /config/blueriq-dashboard/

WORKDIR ~

ENTRYPOINT ["java", "-Dspring.config.additional-location=file:///config/blueriq-dashboard/", "-jar", "dashboard.jar", "-Xmx256m" ]
7 changes: 7 additions & 0 deletions cypress/docker/dashboards/Dockerfile.DASHBOARD-FRONTEND
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM nginx:1.13.12-alpine@sha256:9d46fd628d54ebe1633ee3cf0fe2acfcc419cfae541c63056530e39cd5620366

ARG HOST_PORT=unset

COPY preparations/dist /usr/share/nginx/html
COPY dashboards/config/frontend/nginx.conf.template /nginx.conf.template
RUN envsubst '$$HOST_PORT' < /nginx.conf.template > /etc/nginx/conf.d/default.conf
13 changes: 13 additions & 0 deletions cypress/docker/dashboards/Dockerfile.DCMLISTS
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM openjdk:17-jdk-slim

LABEL maintainer="support@blueriq.com"

ENV JAVA_TOOL_OPTIONS -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:8000
EXPOSE 8080 8000

COPY preparations/blueriq-dcm-lists-standalone-*.jar ~/dcm-lists.jar
COPY dashboards/config/dcm-lists/blueriq-dcm-lists.yml /config/blueriq-dcm-lists/

WORKDIR ~

ENTRYPOINT ["java", "-Dspring.config.additional-location=file:///config/blueriq-dcm-lists/", "-jar", "dcm-lists.jar", "-Xmx384m" ]
10 changes: 10 additions & 0 deletions cypress/docker/dashboards/Dockerfile.GATEWAY
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM openjdk:17-jdk-slim

LABEL maintainer="support@blueriq.com"

COPY preparations/blueriq-gateway-standalone-*.jar ~/gateway-service.jar
COPY dashboards/config/gateway/blueriq-gateway-service.yaml /config/gateway-service/

WORKDIR ~

ENTRYPOINT ["java", "-Dspring.config.additional-location=file:///config/gateway-service/", "-jar", "gateway-service.jar", "-Xmx384m" ]
10 changes: 10 additions & 0 deletions cypress/docker/dashboards/Dockerfile.H2
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM oscarfonts/h2@sha256:68f8347a24b90cebf18b01172f81e8d2c32aa1e0a06af2bb53b6d375b3681d1f

COPY dashboards/data /opt/h2-data/

WORKDIR /opt/h2-data

CMD java -cp /opt/h2/bin/h2*.jar org.h2.tools.Server \
-web -webAllowOthers -webPort 81 \
-tcp -tcpAllowOthers -tcpPort 1521 \
-baseDir ${DATA_DIR} ${H2_OPTIONS}
3 changes: 3 additions & 0 deletions cypress/docker/dashboards/Dockerfile.KEYCLOAK
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM docker-internal.blueriq.com/build-keycloak-18.0.2:1.0

COPY /dashboards/config/keycloak/blueriq-realm.json /opt/keycloak/data/import/
5 changes: 5 additions & 0 deletions cypress/docker/dashboards/Dockerfile.RABBIT
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM rabbitmq:3.10.7-management-alpine@sha256:6ffb4ddb517ba2ae95c604ba1156a0802206b8fa81a71f3787fc633f0c432e83
ADD dashboards/config/rabbitmq/rabbitmq.conf /etc/rabbitmq/
ADD dashboards/config/rabbitmq/definitions.json /etc/rabbitmq/
RUN chown rabbitmq:rabbitmq /etc/rabbitmq/rabbitmq.conf /etc/rabbitmq/definitions.json
CMD ["rabbitmq-server"]
14 changes: 14 additions & 0 deletions cypress/docker/dashboards/Dockerfile.RUNTIME
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM docker-internal.blueriq.com/tomcat9-jdk17:1.0
LABEL maintainer="support@blueriq.com"

ARG BLUERIQ_LICENSE
ENV JAVA_OPTS="-Dspring.config.additional-location=file:///config/blueriq-runtime/ -Djava.security.egd=file:/dev/./urandom -Dlogging.file.name=runtime.log -Duser.timezone=Europe/Amsterdam -Xmx768m"
ENV JAVA_TOOL_OPTIONS -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:8000
ENV JPDA_ADDRESS="8000"
ENV JPDA_TRANSPORT="dt_socket"

EXPOSE 8080 8000

COPY preparations/blueriq-runtime-application-*.war /usr/local/tomcat/webapps/runtime.war
COPY dashboards/config/runtime /config/blueriq-runtime/
COPY dashboards/config/exports /config/blueriq-runtime/exports/
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
blueriq.case.engine.data.mongodb.host=e2e-mongodb
blueriq.case.engine.data.mongodb.port=27017
blueriq.case.engine.data.mongodb.database=caseEngine

blueriq.locking.mongodb.host=e2e-mongodb
blueriq.locking.mongodb.port=27017
blueriq.locking.mongodb.database=locks

spring.quartz.job-store-type=memory

spring.quartz.properties.org.quartz.threadPool.class=org.quartz.simpl.SimpleThreadPool
spring.quartz.properties.org.quartz.threadPool.threadCount=2
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#h2 embedded settings for external datasources profiles
blueriq.datasource.h2.enabled=true

blueriq.datasource.process-sql-store.url=jdbc:h2:tcp://e2e-h2:1521/process-sql-store
blueriq.datasource.process-sql-store.username=
blueriq.datasource.process-sql-store.password=
blueriq.datasource.process-sql-store.driverClassName=org.h2.Driver
blueriq.hibernate.process-sql-store.hbm2ddl.auto=update
blueriq.hibernate.process-sql-store.dialect=org.hibernate.dialect.H2Dialect
blueriq.hibernate.process-sql-store.globally_quoted_identifiers=true
blueriq.hibernate.process-sql-store.globally_quoted_identifiers_skip_column_definitions=true

blueriq.datasource.trace-sql-store.url=jdbc:h2:tcp://e2e-h2:1521/trace-sql-store
blueriq.datasource.trace-sql-store.username=
blueriq.datasource.trace-sql-store.password=
blueriq.datasource.trace-sql-store.driverClassName=org.h2.Driver
blueriq.hibernate.trace-sql-store.hbm2ddl.auto=update
blueriq.hibernate.trace-sql-store.dialect=org.hibernate.dialect.H2Dialect
blueriq.hibernate.trace-sql-store.globally_quoted_identifiers=true
blueriq.hibernate.trace-sql-store.globally_quoted_identifiers_skip_column_definitions=true
Loading

0 comments on commit 9b41206

Please sign in to comment.