diff --git a/.github/workflows/cypress-integration-tests-postgresql.yml b/.github/workflows/cypress-integration-tests-postgresql.yml index 5ad614d01369..408488cf1ddf 100644 --- a/.github/workflows/cypress-integration-tests-postgresql.yml +++ b/.github/workflows/cypress-integration-tests-postgresql.yml @@ -32,10 +32,6 @@ concurrency: jobs: cypress-ci-postgresql: runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - job: [0, 1, 2] environment: test steps: - name: Free Disk Space (Ubuntu) diff --git a/.github/workflows/openmetadata-airflow-apis.yml b/.github/workflows/openmetadata-airflow-apis.yml index 13f887d984fc..f87348ce8bb3 100644 --- a/.github/workflows/openmetadata-airflow-apis.yml +++ b/.github/workflows/openmetadata-airflow-apis.yml @@ -34,6 +34,6 @@ jobs: run: | make install_dev install_apis cd openmetadata-airflow-apis; \ - python setup.py build sdist bdist_wheel; \ + python -m build; \ twine check dist/*; \ twine upload dist/* --verbose diff --git a/.github/workflows/py-cli-e2e-tests.yml b/.github/workflows/py-cli-e2e-tests.yml index ea13b84bcaff..e9eca681bca3 100644 --- a/.github/workflows/py-cli-e2e-tests.yml +++ b/.github/workflows/py-cli-e2e-tests.yml @@ -25,7 +25,7 @@ jobs: strategy: fail-fast: false matrix: - e2e-test: ['bigquery', 'dbt_redshift', 'metabase', 'mssql', 'mysql', 'redash', 'snowflake', 'tableau', 'powerbi', 'vertica', 'python', 'redshift', 'hive', 'quicksight', 'datalake_s3', 'postgres', 'oracle', 'athena', 'bigquery_multiple_project'] + e2e-test: ['bigquery', 'dbt_redshift', 'metabase', 'mssql', 'mysql', 'redash', 'snowflake', 'tableau', 'powerbi', 'vertica', 'python', 'redshift', 'quicksight', 'datalake_s3', 'postgres', 'oracle', 'athena', 'bigquery_multiple_project'] environment: test steps: diff --git a/.github/workflows/py-ingestion-core-publish.yml b/.github/workflows/py-ingestion-core-publish.yml deleted file mode 100644 index 9f840e5161f8..000000000000 --- a/.github/workflows/py-ingestion-core-publish.yml +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright 2021 Collate -# 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 -# http://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. - -# When a new push happens to the main branch that -# modifies the JSON Schemas, we are going to -# generate the updated pydantic models and -# publish a new version of openmetadata-core - -name: Publish openmetadata-ingestion-core packages - -on: - workflow_dispatch: - -concurrency: - group: py-ingestion-core-publish-${{ github.head_ref || github.run_id }} - cancel-in-progress: true -jobs: - py-core-build-and-push: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Set up Python 3.9 - uses: actions/setup-python@v4 - with: - python-version: 3.9 - - name: Install Ubuntu related dependencies - run: | - sudo apt-get update && sudo apt-get install -y libsasl2-dev unixodbc-dev python3-venv - - name: Install, Generate and Publish Test PyPi packages - env: - TWINE_USERNAME: ${{ secrets.TWINE_USERNAME_TEST }} - TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD_TEST }} - run: | - python3 -m venv env - source env/bin/activate - sudo make install_antlr_cli - make install_dev generate install - cd ingestion-core; \ - python setup.py build sdist bdist_wheel; \ - twine check dist/*; \ - twine upload dist/* --verbose diff --git a/.github/workflows/py-ingestion-publish.yml b/.github/workflows/py-ingestion-publish.yml index dd4567460881..7838e25c20b8 100644 --- a/.github/workflows/py-ingestion-publish.yml +++ b/.github/workflows/py-ingestion-publish.yml @@ -37,6 +37,6 @@ jobs: sudo make install_antlr_cli make install_dev generate install cd ingestion; \ - python setup.py build sdist bdist_wheel; \ + python -m build; \ twine check dist/*; \ twine upload dist/* --verbose diff --git a/Makefile b/Makefile index 3bf028852878..9c16def705eb 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ include ingestion/Makefile .PHONY: help help: - @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[35m%-30s\033[0m %s\n", $$1, $$2}' + @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":"}; {printf "\033[35m%-35s\033[0m %s\n", $$2, $$3}' .PHONY: install_e2e_tests install_e2e_tests: ## Install the ingestion module with e2e test dependencies (playwright) @@ -24,40 +24,6 @@ yarn_install_cache: ## Use Yarn to install UI dependencies yarn_start_dev_ui: ## Run the UI locally with Yarn cd openmetadata-ui/src/main/resources/ui && yarn start -## Ingestion Core -.PHONY: core_install_dev -core_install_dev: ## Prepare a venv for the ingestion-core module - cd ingestion-core; \ - rm -rf venv; \ - python3 -m venv venv; \ - . venv/bin/activate; \ - python3 -m pip install ".[dev]" - -.PHONY: core_clean -core_clean: ## Clean the ingestion-core generated files - rm -rf ingestion-core/src/metadata/generated - rm -rf ingestion-core/build - rm -rf ingestion-core/dist - -.PHONY: core_generate -core_generate: ## Generate the pydantic models from the JSON Schemas to the ingestion-core module - $(MAKE) core_install_dev - mkdir -p ingestion-core/src/metadata/generated; \ - . ingestion-core/venv/bin/activate; \ - datamodel-codegen --input openmetadata-spec/src/main/resources/json/schema --input-file-type jsonschema --output ingestion-core/src/metadata/generated/schema - $(MAKE) core_py_antlr - -.PHONY: core_bump_version_dev -core_bump_version_dev: ## Bump a `dev` version to the ingestion-core module. To be used when schemas are updated - $(MAKE) core_install_dev - cd ingestion-core; \ - . venv/bin/activate; \ - python -m incremental.update metadata --dev - -.PHONY: core_py_antlr -core_py_antlr: ## Generate the Python core code for parsing FQNs under ingestion-core - antlr4 -Dlanguage=Python3 -o ingestion-core/src/metadata/generated/antlr ${PWD}/openmetadata-spec/src/main/antlr4/org/openmetadata/schema/*.g4 - .PHONY: py_antlr py_antlr: ## Generate the Python code for parsing FQNs antlr4 -Dlanguage=Python3 -o ingestion/src/metadata/generated/antlr ${PWD}/openmetadata-spec/src/main/antlr4/org/openmetadata/schema/*.g4 @@ -103,8 +69,8 @@ SNYK_ARGS := --severity-threshold=high .PHONY: snyk-ingestion-report snyk-ingestion-report: ## Uses Snyk CLI to validate the ingestion code and container. Don't stop the execution @echo "Validating Ingestion container..." - docker build -t openmetadata-ingestion:scan -f ingestion/Dockerfile . - snyk container test openmetadata-ingestion:scan --file=ingestion/Dockerfile $(SNYK_ARGS) --json > security-report/ingestion-docker-scan.json | true; + docker build -t openmetadata-ingestion:scan -f ingestion/Dockerfile.ci . + snyk container test openmetadata-ingestion:scan --file=ingestion/Dockerfile.ci $(SNYK_ARGS) --json > security-report/ingestion-docker-scan.json | true; @echo "Validating ALL ingestion dependencies. Make sure the venv is activated." cd ingestion; \ pip freeze > scan-requirements.txt; \ @@ -171,7 +137,7 @@ generate-schema-docs: ## Generates markdown files for documenting the JSON Sche #Upgrade release automation scripts below .PHONY: update_all -update_all: ## To update all the release related files run make update_all RELEASE_VERSION=2.2.2 PY_RELEASE_VERSION=2.2.2.2 +update_all: ## To update all the release related files run make update_all RELEASE_VERSION=2.2.2 PY_RELEASE_VERSION=2.2.2.2 @echo "The release version is: $(RELEASE_VERSION)" ; \ echo "The python metadata release version: $(PY_RELEASE_VERSION)" ; \ $(MAKE) update_maven ; \ @@ -184,7 +150,7 @@ update_all: ## To update all the release related files run make update_all RELEA #make update_all RELEASE_VERSION=2.2.2 PY_RELEASE_VERSION=2.2.2.2 .PHONY: update_maven -update_maven: ## To update the common and pom.xml maven version +update_maven: ## To update the common and pom.xml maven version @echo "Updating Maven projects to version $(RELEASE_VERSION)..."; \ mvn versions:set -DnewVersion=$(RELEASE_VERSION) #remove comment and use the below section when want to use this sub module "update_maven" independently to update github actions @@ -192,7 +158,7 @@ update_maven: ## To update the common and pom.xml maven version .PHONY: update_github_action_paths -update_github_action_paths: ## To update the github action ci docker files +update_github_action_paths: ## To update the github action ci docker files @echo "Updating docker github action release version to $(RELEASE_VERSION)... "; \ file_paths="docker/docker-compose-quickstart/Dockerfile \ .github/workflows/docker-openmetadata-db.yml \ @@ -212,7 +178,7 @@ update_github_action_paths: ## To update the github action ci docker files #make update_github_action_paths RELEASE_VERSION=2.2.2 .PHONY: update_python_release_paths -update_python_release_paths: ## To update the setup.py files +update_python_release_paths: ## To update the setup.py files file_paths="ingestion/setup.py \ openmetadata-airflow-apis/setup.py"; \ echo "Updating Python setup file versions to $(PY_RELEASE_VERSION)... "; \ @@ -223,7 +189,7 @@ update_python_release_paths: ## To update the setup.py files #make update_python_release_paths PY_RELEASE_VERSION=2.2.2.2 .PHONY: update_dockerfile_version -update_dockerfile_version: ## To update the dockerfiles version +update_dockerfile_version: ## To update the dockerfiles version @file_paths="docker/docker-compose-ingestion/docker-compose-ingestion.yml \ docker/docker-compose-openmetadata/docker-compose-openmetadata.yml \ docker/docker-compose-quickstart/docker-compose-postgres.yml \ @@ -236,7 +202,7 @@ update_dockerfile_version: ## To update the dockerfiles version #make update_dockerfile_version RELEASE_VERSION=2.2.2 .PHONY: update_ingestion_dockerfile_version -update_ingestion_dockerfile_version: ## To update the ingestion dockerfiles version +update_ingestion_dockerfile_version: ## To update the ingestion dockerfiles version @file_paths="ingestion/Dockerfile \ ingestion/operators/docker/Dockerfile"; \ echo "Updating ingestion dockerfile release version to $(PY_RELEASE_VERSION)... "; \ diff --git a/bootstrap/sql/migrations/native/1.2.3/mysql/postDataMigrationSQLScript.sql b/bootstrap/sql/migrations/native/1.2.3/mysql/postDataMigrationSQLScript.sql new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/bootstrap/sql/migrations/native/1.2.3/mysql/schemaChanges.sql b/bootstrap/sql/migrations/native/1.2.3/mysql/schemaChanges.sql new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/bootstrap/sql/migrations/native/1.2.3/postgres/postDataMigrationSQLScript.sql b/bootstrap/sql/migrations/native/1.2.3/postgres/postDataMigrationSQLScript.sql new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/bootstrap/sql/migrations/native/1.2.3/postgres/schemaChanges.sql b/bootstrap/sql/migrations/native/1.2.3/postgres/schemaChanges.sql new file mode 100644 index 000000000000..399e5d62f61d --- /dev/null +++ b/bootstrap/sql/migrations/native/1.2.3/postgres/schemaChanges.sql @@ -0,0 +1,12 @@ + +-- fixed Query for updating viewParsingTimeoutLimit +UPDATE ingestion_pipeline_entity +SET json = jsonb_set( + json::jsonb #- '{sourceConfig,config,viewParsingTimeoutLimit}', + '{sourceConfig,config,queryParsingTimeoutLimit}', + (json #> '{sourceConfig,config,viewParsingTimeoutLimit}')::jsonb, + true +) +WHERE json #>> '{pipelineType}' = 'metadata' +AND json #>> '{sourceConfig,config,type}' = 'DatabaseMetadata' +AND json #>> '{sourceConfig,config,viewParsingTimeoutLimit}' is not null; diff --git a/bootstrap/sql/migrations/native/1.3.0/mysql/postDataMigrationSQLScript.sql b/bootstrap/sql/migrations/native/1.3.0/mysql/postDataMigrationSQLScript.sql new file mode 100644 index 000000000000..e66612d8f5fa --- /dev/null +++ b/bootstrap/sql/migrations/native/1.3.0/mysql/postDataMigrationSQLScript.sql @@ -0,0 +1,8 @@ +-- Rename customMetricsProfile to customMetrics +UPDATE profiler_data_time_series +SET json = REPLACE(json, '"customMetricsProfile"', '"customMetrics"'); + +-- Delete customMetricsProfile from entity_extension +-- This was not supported on the processing side before 1.3. +DELETE FROM openmetadata_db.entity_extension ee +where extension like '%customMetrics'; \ No newline at end of file diff --git a/bootstrap/sql/migrations/native/1.3.0/postgres/postDataMigrationSQLScript.sql b/bootstrap/sql/migrations/native/1.3.0/postgres/postDataMigrationSQLScript.sql new file mode 100644 index 000000000000..6d65e5f77057 --- /dev/null +++ b/bootstrap/sql/migrations/native/1.3.0/postgres/postDataMigrationSQLScript.sql @@ -0,0 +1,8 @@ +-- Rename customMetricsProfile to customMetrics +UPDATE profiler_data_time_series +SET json = REPLACE(json::text, '"customMetricsProfile"', '"customMetrics"')::jsonb; + +-- Delete customMetricsProfile from entity_extension +-- This was not supported on the processing side before 1.3. +DELETE FROM entity_extension ee +where extension like '%customMetrics'; \ No newline at end of file diff --git a/conf/openmetadata.yaml b/conf/openmetadata.yaml index 2fa33e0991d4..839d362906e2 100644 --- a/conf/openmetadata.yaml +++ b/conf/openmetadata.yaml @@ -144,6 +144,8 @@ authorizerConfiguration: authenticationConfiguration: provider: ${AUTHENTICATION_PROVIDER:-basic} + # This is used by auth provider provide response as either id_token or code + responseType: ${AUTHENTICATION_RESPONSE_TYPE:-id_token} # This will only be valid when provider type specified is customOidc providerName: ${CUSTOM_OIDC_AUTHENTICATION_PROVIDER_NAME:-""} publicKeyUrls: ${AUTHENTICATION_PUBLIC_KEYS:-[http://localhost:8585/api/v1/system/config/jwks]} diff --git a/docker/development/docker-compose-postgres.yml b/docker/development/docker-compose-postgres.yml index ded3943fc559..cb3cab7a02d2 100644 --- a/docker/development/docker-compose-postgres.yml +++ b/docker/development/docker-compose-postgres.yml @@ -85,6 +85,7 @@ services: AUTHORIZER_ENFORCE_PRINCIPAL_DOMAIN: ${AUTHORIZER_ENFORCE_PRINCIPAL_DOMAIN:-false} AUTHORIZER_ENABLE_SECURE_SOCKET: ${AUTHORIZER_ENABLE_SECURE_SOCKET:-false} AUTHENTICATION_PROVIDER: ${AUTHENTICATION_PROVIDER:-basic} + AUTHENTICATION_RESPONSE_TYPE: ${AUTHENTICATION_RESPONSE_TYPE:-id_token} CUSTOM_OIDC_AUTHENTICATION_PROVIDER_NAME: ${CUSTOM_OIDC_AUTHENTICATION_PROVIDER_NAME:-""} AUTHENTICATION_PUBLIC_KEYS: ${AUTHENTICATION_PUBLIC_KEYS:-[http://localhost:8585/api/v1/system/config/jwks]} AUTHENTICATION_AUTHORITY: ${AUTHENTICATION_AUTHORITY:-https://accounts.google.com} @@ -230,6 +231,7 @@ services: AUTHORIZER_ENFORCE_PRINCIPAL_DOMAIN: ${AUTHORIZER_ENFORCE_PRINCIPAL_DOMAIN:-false} AUTHORIZER_ENABLE_SECURE_SOCKET: ${AUTHORIZER_ENABLE_SECURE_SOCKET:-false} AUTHENTICATION_PROVIDER: ${AUTHENTICATION_PROVIDER:-basic} + AUTHENTICATION_RESPONSE_TYPE: ${AUTHENTICATION_RESPONSE_TYPE:-id_token} CUSTOM_OIDC_AUTHENTICATION_PROVIDER_NAME: ${CUSTOM_OIDC_AUTHENTICATION_PROVIDER_NAME:-""} AUTHENTICATION_PUBLIC_KEYS: ${AUTHENTICATION_PUBLIC_KEYS:-[http://localhost:8585/api/v1/system/config/jwks]} AUTHENTICATION_AUTHORITY: ${AUTHENTICATION_AUTHORITY:-https://accounts.google.com} diff --git a/docker/development/docker-compose.yml b/docker/development/docker-compose.yml index 42840e2ba9f0..d398a774bd78 100644 --- a/docker/development/docker-compose.yml +++ b/docker/development/docker-compose.yml @@ -84,6 +84,7 @@ services: AUTHORIZER_ENFORCE_PRINCIPAL_DOMAIN: ${AUTHORIZER_ENFORCE_PRINCIPAL_DOMAIN:-false} AUTHORIZER_ENABLE_SECURE_SOCKET: ${AUTHORIZER_ENABLE_SECURE_SOCKET:-false} AUTHENTICATION_PROVIDER: ${AUTHENTICATION_PROVIDER:-basic} + AUTHENTICATION_RESPONSE_TYPE: ${AUTHENTICATION_RESPONSE_TYPE:-id_token} CUSTOM_OIDC_AUTHENTICATION_PROVIDER_NAME: ${CUSTOM_OIDC_AUTHENTICATION_PROVIDER_NAME:-""} AUTHENTICATION_PUBLIC_KEYS: ${AUTHENTICATION_PUBLIC_KEYS:-[http://localhost:8585/api/v1/system/config/jwks]} AUTHENTICATION_AUTHORITY: ${AUTHENTICATION_AUTHORITY:-https://accounts.google.com} @@ -231,6 +232,7 @@ services: AUTHORIZER_ENFORCE_PRINCIPAL_DOMAIN: ${AUTHORIZER_ENFORCE_PRINCIPAL_DOMAIN:-false} AUTHORIZER_ENABLE_SECURE_SOCKET: ${AUTHORIZER_ENABLE_SECURE_SOCKET:-false} AUTHENTICATION_PROVIDER: ${AUTHENTICATION_PROVIDER:-basic} + AUTHENTICATION_RESPONSE_TYPE: ${AUTHENTICATION_RESPONSE_TYPE:-id_token} CUSTOM_OIDC_AUTHENTICATION_PROVIDER_NAME: ${CUSTOM_OIDC_AUTHENTICATION_PROVIDER_NAME:-""} AUTHENTICATION_PUBLIC_KEYS: ${AUTHENTICATION_PUBLIC_KEYS:-[http://localhost:8585/api/v1/system/config/jwks]} AUTHENTICATION_AUTHORITY: ${AUTHENTICATION_AUTHORITY:-https://accounts.google.com} diff --git a/docker/docker-compose-openmetadata/docker-compose-openmetadata.yml b/docker/docker-compose-openmetadata/docker-compose-openmetadata.yml index 7c93ef4230a9..2b6858cc126a 100644 --- a/docker/docker-compose-openmetadata/docker-compose-openmetadata.yml +++ b/docker/docker-compose-openmetadata/docker-compose-openmetadata.yml @@ -34,6 +34,7 @@ services: AUTHORIZER_ENFORCE_PRINCIPAL_DOMAIN: ${AUTHORIZER_ENFORCE_PRINCIPAL_DOMAIN:-false} AUTHORIZER_ENABLE_SECURE_SOCKET: ${AUTHORIZER_ENABLE_SECURE_SOCKET:-false} AUTHENTICATION_PROVIDER: ${AUTHENTICATION_PROVIDER:-basic} + AUTHENTICATION_RESPONSE_TYPE: ${AUTHENTICATION_RESPONSE_TYPE:-id_token} CUSTOM_OIDC_AUTHENTICATION_PROVIDER_NAME: ${CUSTOM_OIDC_AUTHENTICATION_PROVIDER_NAME:-""} AUTHENTICATION_PUBLIC_KEYS: ${AUTHENTICATION_PUBLIC_KEYS:-[http://localhost:8585/api/v1/system/config/jwks]} AUTHENTICATION_AUTHORITY: ${AUTHENTICATION_AUTHORITY:-https://accounts.google.com} @@ -175,6 +176,7 @@ services: AUTHORIZER_ENFORCE_PRINCIPAL_DOMAIN: ${AUTHORIZER_ENFORCE_PRINCIPAL_DOMAIN:-false} AUTHORIZER_ENABLE_SECURE_SOCKET: ${AUTHORIZER_ENABLE_SECURE_SOCKET:-false} AUTHENTICATION_PROVIDER: ${AUTHENTICATION_PROVIDER:-basic} + AUTHENTICATION_RESPONSE_TYPE: ${AUTHENTICATION_RESPONSE_TYPE:-id_token} CUSTOM_OIDC_AUTHENTICATION_PROVIDER_NAME: ${CUSTOM_OIDC_AUTHENTICATION_PROVIDER_NAME:-""} AUTHENTICATION_PUBLIC_KEYS: ${AUTHENTICATION_PUBLIC_KEYS:-[http://localhost:8585/api/v1/system/config/jwks]} AUTHENTICATION_AUTHORITY: ${AUTHENTICATION_AUTHORITY:-https://accounts.google.com} diff --git a/docker/docker-compose-openmetadata/env-mysql b/docker/docker-compose-openmetadata/env-mysql index e7524f9bebb2..82daf618565c 100644 --- a/docker/docker-compose-openmetadata/env-mysql +++ b/docker/docker-compose-openmetadata/env-mysql @@ -16,6 +16,7 @@ AUTHORIZER_PRINCIPAL_DOMAIN="openmetadata.org" AUTHORIZER_ENFORCE_PRINCIPAL_DOMAIN="false" AUTHORIZER_ENABLE_SECURE_SOCKET="false" AUTHENTICATION_PROVIDER="basic" +AUTHENTICATION_RESPONSE_TYPE="id_token" CUSTOM_OIDC_AUTHENTICATION_PROVIDER_NAME="" AUTHENTICATION_PUBLIC_KEYS=[http://localhost:8585/api/v1/system/config/jwks] AUTHENTICATION_AUTHORITY="https://accounts.google.com" diff --git a/docker/docker-compose-openmetadata/env-postgres b/docker/docker-compose-openmetadata/env-postgres index 1ca2d5c3d723..db9df1a9a67a 100644 --- a/docker/docker-compose-openmetadata/env-postgres +++ b/docker/docker-compose-openmetadata/env-postgres @@ -16,6 +16,7 @@ AUTHORIZER_PRINCIPAL_DOMAIN="openmetadata.org" AUTHORIZER_ENFORCE_PRINCIPAL_DOMAIN="false" AUTHORIZER_ENABLE_SECURE_SOCKET="false" AUTHENTICATION_PROVIDER="basic" +AUTHENTICATION_RESPONSE_TYPE:"id_token" CUSTOM_OIDC_AUTHENTICATION_PROVIDER_NAME="" AUTHENTICATION_PUBLIC_KEYS=[http://localhost:8585/api/v1/system/config/jwks] AUTHENTICATION_AUTHORITY="https://accounts.google.com" diff --git a/docker/docker-compose-quickstart/docker-compose-postgres.yml b/docker/docker-compose-quickstart/docker-compose-postgres.yml index 6e5c76fa6b85..97da1f7632f5 100644 --- a/docker/docker-compose-quickstart/docker-compose-postgres.yml +++ b/docker/docker-compose-quickstart/docker-compose-postgres.yml @@ -77,6 +77,7 @@ services: AUTHORIZER_ENFORCE_PRINCIPAL_DOMAIN: ${AUTHORIZER_ENFORCE_PRINCIPAL_DOMAIN:-false} AUTHORIZER_ENABLE_SECURE_SOCKET: ${AUTHORIZER_ENABLE_SECURE_SOCKET:-false} AUTHENTICATION_PROVIDER: ${AUTHENTICATION_PROVIDER:-basic} + AUTHENTICATION_RESPONSE_TYPE: ${AUTHENTICATION_RESPONSE_TYPE:-id_token} CUSTOM_OIDC_AUTHENTICATION_PROVIDER_NAME: ${CUSTOM_OIDC_AUTHENTICATION_PROVIDER_NAME:-""} AUTHENTICATION_PUBLIC_KEYS: ${AUTHENTICATION_PUBLIC_KEYS:-[http://localhost:8585/api/v1/system/config/jwks]} AUTHENTICATION_AUTHORITY: ${AUTHENTICATION_AUTHORITY:-https://accounts.google.com} @@ -219,6 +220,7 @@ services: AUTHORIZER_ENFORCE_PRINCIPAL_DOMAIN: ${AUTHORIZER_ENFORCE_PRINCIPAL_DOMAIN:-false} AUTHORIZER_ENABLE_SECURE_SOCKET: ${AUTHORIZER_ENABLE_SECURE_SOCKET:-false} AUTHENTICATION_PROVIDER: ${AUTHENTICATION_PROVIDER:-basic} + AUTHENTICATION_RESPONSE_TYPE: ${AUTHENTICATION_RESPONSE_TYPE:-id_token} CUSTOM_OIDC_AUTHENTICATION_PROVIDER_NAME: ${CUSTOM_OIDC_AUTHENTICATION_PROVIDER_NAME:-""} AUTHENTICATION_PUBLIC_KEYS: ${AUTHENTICATION_PUBLIC_KEYS:-[http://localhost:8585/api/v1/system/config/jwks]} AUTHENTICATION_AUTHORITY: ${AUTHENTICATION_AUTHORITY:-https://accounts.google.com} diff --git a/docker/docker-compose-quickstart/docker-compose.yml b/docker/docker-compose-quickstart/docker-compose.yml index 1c6ebc413062..8fa6c340f895 100644 --- a/docker/docker-compose-quickstart/docker-compose.yml +++ b/docker/docker-compose-quickstart/docker-compose.yml @@ -75,6 +75,7 @@ services: AUTHORIZER_ENFORCE_PRINCIPAL_DOMAIN: ${AUTHORIZER_ENFORCE_PRINCIPAL_DOMAIN:-false} AUTHORIZER_ENABLE_SECURE_SOCKET: ${AUTHORIZER_ENABLE_SECURE_SOCKET:-false} AUTHENTICATION_PROVIDER: ${AUTHENTICATION_PROVIDER:-basic} + AUTHENTICATION_RESPONSE_TYPE: ${AUTHENTICATION_RESPONSE_TYPE:-id_token} CUSTOM_OIDC_AUTHENTICATION_PROVIDER_NAME: ${CUSTOM_OIDC_AUTHENTICATION_PROVIDER_NAME:-""} AUTHENTICATION_PUBLIC_KEYS: ${AUTHENTICATION_PUBLIC_KEYS:-[http://localhost:8585/api/v1/system/config/jwks]} AUTHENTICATION_AUTHORITY: ${AUTHENTICATION_AUTHORITY:-https://accounts.google.com} @@ -217,6 +218,7 @@ services: AUTHORIZER_ENFORCE_PRINCIPAL_DOMAIN: ${AUTHORIZER_ENFORCE_PRINCIPAL_DOMAIN:-false} AUTHORIZER_ENABLE_SECURE_SOCKET: ${AUTHORIZER_ENABLE_SECURE_SOCKET:-false} AUTHENTICATION_PROVIDER: ${AUTHENTICATION_PROVIDER:-basic} + AUTHENTICATION_RESPONSE_TYPE: ${AUTHENTICATION_RESPONSE_TYPE:-id_token} CUSTOM_OIDC_AUTHENTICATION_PROVIDER_NAME: ${CUSTOM_OIDC_AUTHENTICATION_PROVIDER_NAME:-""} AUTHENTICATION_PUBLIC_KEYS: ${AUTHENTICATION_PUBLIC_KEYS:-[http://localhost:8585/api/v1/system/config/jwks]} AUTHENTICATION_AUTHORITY: ${AUTHENTICATION_AUTHORITY:-https://accounts.google.com} diff --git a/ingestion-core/README.md b/ingestion-core/README.md deleted file mode 100644 index 9080a188d0c1..000000000000 --- a/ingestion-core/README.md +++ /dev/null @@ -1,31 +0,0 @@ ---- -This guide will help you set up OpenMetadata Core Models ---- - -![Python version 3.8+](https://img.shields.io/badge/python-3.8%2B-blue) - -These models are `pydantic` models automatically generated from the -central JSON Schemas that define our APIs and Entities. - -**Prerequisites** - -- Python >= 3.8.x - -### Docs - -Please refer to the documentation here https://docs.open-metadata.org/openmetadata/connectors - -### Contribution - -In order to contribute to this package: - -```bash -cd ingestion-core -python -m virtualenv venv -source venv/bin/activate -python -m pip install ".[dev]" -``` - -> OBS: During development we might need to treat this in a different - virtual environment if we are yet to update the reference to the core - package in `openmetadata-ingestion`. diff --git a/ingestion-core/setup.py b/ingestion-core/setup.py deleted file mode 100644 index c8e5dab39be7..000000000000 --- a/ingestion-core/setup.py +++ /dev/null @@ -1,56 +0,0 @@ -# Copyright 2021 Collate -# 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 -# http://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. -import os - -from setuptools import find_namespace_packages, setup - - -def get_long_description(): - root = os.path.dirname(__file__) - with open(os.path.join(root, "README.md")) as f: - description = f.read() - return description - - -dev = { - "datamodel-code-generator==0.13.0", - "black==21.12b0", - "incremental", - "twine", - "twisted", - "wheel", - "click", - "pydantic[email]==1.9.0", -} - -setup( - name="openmetadata-ingestion-core", - url="https://open-metadata.org/", - author="OpenMetadata Committers", - license="Apache License 2.0", - description="These are the generated Python classes from JSON Schema", - long_description=get_long_description(), - long_description_content_type="text/markdown", - python_requires=">=3.7", - package_dir={"": "src"}, - zip_safe=False, - use_incremental=True, - setup_requires=["incremental"], - install_requires=["incremental"], - project_urls={ - "Documentation": "https://docs.open-metadata.org/", - "Source": "https://github.com/open-metadata/OpenMetadata", - }, - packages=find_namespace_packages(where="./src", exclude=["tests*"]), - extras_require={ - "dev": list(dev), - }, -) diff --git a/ingestion-core/src/metadata/_version.py b/ingestion-core/src/metadata/_version.py deleted file mode 100644 index 140659dbc491..000000000000 --- a/ingestion-core/src/metadata/_version.py +++ /dev/null @@ -1,11 +0,0 @@ -""" -Provides metadata version information. -""" - -# This file is auto-generated! Do not edit! -# Use `python -m incremental.update metadata` to change this file. - -from incremental import Version - -__version__ = Version("metadata", 0, 12, 0, dev=20) -__all__ = ["__version__"] diff --git a/ingestion/.coveragerc b/ingestion/.coveragerc deleted file mode 100644 index 0d6a5c99fdf2..000000000000 --- a/ingestion/.coveragerc +++ /dev/null @@ -1,11 +0,0 @@ -[run] -source = env/lib/python3.9/site-packages/metadata -relative_files = True -branch = True -[report] -omit = - *__init__* - */generated/* - tests/* - ingestion/src/* - */src/metadata/ingestion/source/database/sample_* \ No newline at end of file diff --git a/ingestion/Makefile b/ingestion/Makefile index 6d57e471f3b8..41f181406229 100644 --- a/ingestion/Makefile +++ b/ingestion/Makefile @@ -30,8 +30,8 @@ install_apis: ## Install the REST APIs module to the current environment python -m pip install $(ROOT_DIR)/openmetadata-airflow-apis/ .PHONY: lint -lint: ## Run pylint on the Python sources to analyze the codebase - PYTHONPATH="${PYTHONPATH}:$(INGESTION_DIR)/plugins" find $(PY_SOURCE) -path $(PY_SOURCE)/metadata/generated -prune -false -o -type f -name "*.py" | xargs pylint +lint: ## Run pylint on the Python sources to analyze the codebase + PYTHONPATH="${PYTHONPATH}:$(INGESTION_DIR)/plugins" find $(PY_SOURCE) -path $(PY_SOURCE)/metadata/generated -prune -false -o -type f -name "*.py" | xargs pylint --rcfile=$(INGESTION_DIR)/pyproject.toml .PHONY: precommit_install precommit_install: ## Install the project's precommit hooks from .pre-commit-config.yaml @@ -41,32 +41,32 @@ precommit_install: ## Install the project's precommit hooks from .pre-commit-co .PHONY: py_format py_format: ## Run black and isort to format the Python codebase - pycln $(INGESTION_DIR)/ $(ROOT_DIR)/openmetadata-airflow-apis/ --extend-exclude $(PY_SOURCE)/metadata/generated --all - isort $(INGESTION_DIR)/ $(ROOT_DIR)/openmetadata-airflow-apis/ --skip $(PY_SOURCE)/metadata/generated --skip $(INGESTION_DIR)/env --skip $(INGESTION_DIR)/build --skip $(ROOT_DIR)/openmetadata-airflow-apis/build --profile black --multi-line 3 - black $(INGESTION_DIR)/ $(ROOT_DIR)/openmetadata-airflow-apis/ --extend-exclude $(PY_SOURCE)/metadata/generated + pycln $(INGESTION_DIR)/ $(ROOT_DIR)/openmetadata-airflow-apis/ --config $(INGESTION_DIR)/pyproject.toml + isort $(INGESTION_DIR)/ $(ROOT_DIR)/openmetadata-airflow-apis/ --settings-file $(INGESTION_DIR)/pyproject.toml + black $(INGESTION_DIR)/ $(ROOT_DIR)/openmetadata-airflow-apis/ --config $(INGESTION_DIR)/pyproject.toml .PHONY: py_format_check py_format_check: ## Check if Python sources are correctly formatted - pycln $(INGESTION_DIR)/ $(ROOT_DIR)/openmetadata-airflow-apis/ --diff --extend-exclude $(PY_SOURCE)/metadata/generated --all - isort --check-only $(INGESTION_DIR)/ $(ROOT_DIR)/openmetadata-airflow-apis/ --skip $(PY_SOURCE)/metadata/generated --skip $(INGESTION_DIR)/build --skip $(ROOT_DIR)/openmetadata-airflow-apis/build --profile black --multi-line 3 - black --check --diff $(INGESTION_DIR)/ $(ROOT_DIR)/openmetadata-airflow-apis/ --extend-exclude $(PY_SOURCE)/metadata/generated - PYTHONPATH="${PYTHONPATH}:$(INGESTION_DIR)/plugins" pylint --fail-under=10 $(PY_SOURCE)/metadata --ignore-paths $(PY_SOURCE)/metadata/generated || (echo "PyLint error code $$?"; exit 1) + pycln $(INGESTION_DIR)/ $(ROOT_DIR)/openmetadata-airflow-apis/ --diff --config $(INGESTION_DIR)/pyproject.toml + isort --check-only $(INGESTION_DIR)/ $(ROOT_DIR)/openmetadata-airflow-apis/ --settings-file $(INGESTION_DIR)/pyproject.toml + black --check --diff $(INGESTION_DIR)/ $(ROOT_DIR)/openmetadata-airflow-apis/ --config $(INGESTION_DIR)/pyproject.toml + PYTHONPATH="${PYTHONPATH}:$(INGESTION_DIR)/plugins" pylint --rcfile=$(INGESTION_DIR)/pyproject.toml --fail-under=10 $(PY_SOURCE)/metadata --ignore-paths $(PY_SOURCE)/metadata/generated || (echo "PyLint error code $$?"; exit 1) .PHONY: unit_ingestion unit_ingestion: ## Run Python unit tests - coverage run --rcfile $(INGESTION_DIR)/.coveragerc -a --branch -m pytest -c $(INGESTION_DIR)/setup.cfg --junitxml=$(INGESTION_DIR)/junit/test-results-unit.xml --ignore=$(INGESTION_DIR)/tests/unit/source $(INGESTION_DIR)/tests/unit + coverage run --rcfile $(INGESTION_DIR)/pyproject.toml -a --branch -m pytest -c $(INGESTION_DIR)/pyproject.toml --junitxml=$(INGESTION_DIR)/junit/test-results-unit.xml --ignore=$(INGESTION_DIR)/tests/unit/source $(INGESTION_DIR)/tests/unit ## Ingestion tests & QA .PHONY: run_ometa_integration_tests run_ometa_integration_tests: ## Run Python integration tests - coverage run --rcfile $(INGESTION_DIR)/.coveragerc -a --branch -m pytest -c $(INGESTION_DIR)/setup.cfg --junitxml=$(INGESTION_DIR)/junit/test-results-integration.xml $(INGESTION_DIR)/tests/integration/ometa $(INGESTION_DIR)/tests/integration/orm_profiler $(INGESTION_DIR)/tests/integration/test_suite $(INGESTION_DIR)/tests/integration/data_insight $(INGESTION_DIR)/tests/integration/lineage + coverage run --rcfile $(INGESTION_DIR)/pyproject.toml -a --branch -m pytest -c $(INGESTION_DIR)/pyproject.toml --junitxml=$(INGESTION_DIR)/junit/test-results-integration.xml $(INGESTION_DIR)/tests/integration/ometa $(INGESTION_DIR)/tests/integration/orm_profiler $(INGESTION_DIR)/tests/integration/test_suite $(INGESTION_DIR)/tests/integration/data_insight $(INGESTION_DIR)/tests/integration/lineage .PHONY: run_python_tests run_python_tests: ## Run all Python tests with coverage coverage erase $(MAKE) unit_ingestion $(MAKE) run_ometa_integration_tests - coverage report --rcfile $(INGESTION_DIR)/.coveragerc || true + coverage report --rcfile $(INGESTION_DIR)/pyproject.toml || true .PHONY: sonar_ingestion sonar_ingestion: ## Run the Sonar analysis based on the tests results and push it to SonarCloud @@ -82,20 +82,17 @@ sonar_ingestion: ## Run the Sonar analysis based on the tests results and push .PHONY: run_apis_tests run_apis_tests: ## Run the openmetadata airflow apis tests coverage erase - coverage run --rcfile $(ROOT_DIR)/openmetadata-airflow-apis/.coveragerc -a --branch -m pytest --junitxml=$(ROOT_DIR)/openmetadata-airflow-apis/junit/test-results.xml $(ROOT_DIR)/openmetadata-airflow-apis/tests - coverage report --rcfile $(ROOT_DIR)/openmetadata-airflow-apis/.coveragerc - + coverage run --rcfile $(ROOT_DIR)/openmetadata-airflow-apis/pyproject.toml -a --branch -m pytest -c $(INGESTION_DIR)/pyproject.toml --junitxml=$(ROOT_DIR)/openmetadata-airflow-apis/junit/test-results.xml $(ROOT_DIR)/openmetadata-airflow-apis/tests + coverage report --rcfile $(ROOT_DIR)/openmetadata-airflow-apis/pyproject.toml .PHONY: coverage_apis coverage_apis: ## Run the python tests on openmetadata-airflow-apis $(MAKE) run_apis_tests - coverage xml --rcfile $(ROOT_DIR)/openmetadata-airflow-apis/.coveragerc -o $(ROOT_DIR)/openmetadata-airflow-apis/coverage.xml + coverage xml --rcfile $(ROOT_DIR)/openmetadata-airflow-apis/pyproject.toml -o $(ROOT_DIR)/openmetadata-airflow-apis/coverage.xml sed -e "s/$(shell python -c "import site; import os; from pathlib import Path; print(os.path.relpath(site.getsitepackages()[0], str(Path.cwd())).replace('/','\/'))")\///g" $(ROOT_DIR)/openmetadata-airflow-apis/coverage.xml >> $(ROOT_DIR)/openmetadata-airflow-apis/ci-coverage.xml - - .PHONY: coverage coverage: ## Run all Python tests and generate the coverage XML report $(MAKE) run_python_tests - coverage xml --rcfile $(INGESTION_DIR)/.coveragerc -o $(INGESTION_DIR)/coverage.xml || true + coverage xml --rcfile $(INGESTION_DIR)/pyproject.toml -o $(INGESTION_DIR)/coverage.xml || true sed -e "s/$(shell python -c "import site; import os; from pathlib import Path; print(os.path.relpath(site.getsitepackages()[0], str(Path.cwd())).replace('/','\/'))")/src/g" $(INGESTION_DIR)/coverage.xml >> $(INGESTION_DIR)/ci-coverage.xml diff --git a/ingestion/examples/sample_data/datasets/tables.json b/ingestion/examples/sample_data/datasets/tables.json index acddd81788c7..98cfcbc216bd 100644 --- a/ingestion/examples/sample_data/datasets/tables.json +++ b/ingestion/examples/sample_data/datasets/tables.json @@ -95,7 +95,19 @@ "dataTypeDisplay": "varchar", "description": "The ZIP or postal code. For example, 90210.", "tags": [], - "ordinalPosition": 10 + "ordinalPosition": 10, + "customMetrics": [ + { + "name": "CountOfLAZipCode", + "columnName": "zip", + "expression": "SELECT COUNT(zip) FROM dim_address WHERE zip LIKE '900%'" + }, + { + "name": "CountOfOrangeCountyZipCode", + "columnName": "zip", + "expression": "SELECT COUNT(zip) FROM dim_address WHERE zip LIKE '92%'" + } + ] }, { "name": "country", @@ -113,7 +125,14 @@ "dataTypeDisplay": "varchar", "description": "The phone number of the customer.", "tags": [], - "ordinalPosition": 12 + "ordinalPosition": 12, + "customMetrics": [ + { + "name": "CountOfNonUsPhoneNumbers", + "columnName": "zip", + "expression": "SELECT COUNT(phone) FROM dim_address WHERE phone NOT LIKE '1%'" + } + ] } ], "tableConstraints": [ @@ -581,6 +600,16 @@ "timestamp": 1634366539, "columnCount": 12, "rowCount": 725, + "customMetrics": [ + { + "name": "CountOfUSAddress", + "value": 15467 + }, + { + "name": "CountOfFRAddress", + "value": 1467 + } + ], "columnProfile": [ { "name": "address_id", @@ -650,7 +679,17 @@ "uniqueCount": 11, "uniqueProportion": 0.1383472, "distinctCount": 0, - "distinctProportion": 0 + "distinctProportion": 0, + "customMetrics": [ + { + "name": "CountOfLAZipCode", + "value": 3456 + }, + { + "name": "CountOfOrangeCountyZipCode", + "value": 2345 + } + ] }, { "name": "country", @@ -674,7 +713,17 @@ "name": "sample_data.ecommerce_db.shopify", "description": "This **mock** Schema contains tables related to shopify sales and orders with related dimension tables.", "href": "http://localhost:8585/api/v1/databaseSchemas/d7be1e2c-b3dc-11ec-b909-0242ac120002" - } + }, + "customMetrics": [ + { + "name": "CountOfUSAddress", + "expression": "SELECT COUNT(address_id) FROM dim_address WHERE country = 'US'" + }, + { + "name": "CountOfFRAddress", + "expression": "SELECT COUNT(address_id) FROM dim_address WHERE country = 'FR'" + } + ] }, { "id": "1cda9ecb-f4c6-4ed4-8506-abe965b64c87", diff --git a/ingestion/examples/sample_data/profiler/tableProfile.json b/ingestion/examples/sample_data/profiler/tableProfile.json index b9e38d1e7358..0dea2772e7b3 100644 --- a/ingestion/examples/sample_data/profiler/tableProfile.json +++ b/ingestion/examples/sample_data/profiler/tableProfile.json @@ -8,6 +8,16 @@ "rowCount": 14567.0, "sizeInByte": 16890, "createDateTime": "2023-07-24T07:00:48.000750Z", + "customMetrics": [ + { + "name": "CountOfUSAddress", + "value": 15467 + }, + { + "name": "CountOfFRAddress", + "value": 1467 + } + ], "columnProfile": [ { "name": "shop_id", @@ -151,7 +161,17 @@ "distinctProportion": 0.10, "minLength": 6.0, "maxLength": 156.0, - "mean": 98.0 + "mean": 98.0, + "customMetrics": [ + { + "name": "CountOfLAZipCode", + "value": 3041 + }, + { + "name": "CountOfOrangeCountyZipCode", + "value": 2076 + } + ] }, { "name": "country", @@ -208,6 +228,16 @@ "rowCount": 13256.0, "sizeInByte": 163290, "createDateTime": "2023-07-24T07:00:48.000750Z", + "customMetrics": [ + { + "name": "CountOfUSAddress", + "value": 15098 + }, + { + "name": "CountOfFRAddress", + "value": 1402 + } + ], "columnProfile": [ { "name": "shop_id", @@ -351,7 +381,17 @@ "distinctProportion": 0.10, "minLength": 6.0, "maxLength": 156.0, - "mean": 98.0 + "mean": 98.0, + "customMetrics": [ + { + "name": "CountOfLAZipCode", + "value": 2987 + }, + { + "name": "CountOfOrangeCountyZipCode", + "value": 2005 + } + ] }, { "name": "country", @@ -408,6 +448,16 @@ "rowCount": 10256.0, "sizeInByte": 16890, "createDateTime": "2023-07-24T07:00:48.000750Z", + "customMetrics": [ + { + "name": "CountOfUSAddress", + "value": 14998 + }, + { + "name": "CountOfFRAddress", + "value": 1387 + } + ], "columnProfile": [ { "name": "shop_id", @@ -551,7 +601,17 @@ "distinctProportion": 0.10, "minLength": 6.0, "maxLength": 156.0, - "mean": 98.0 + "mean": 98.0, + "customMetrics": [ + { + "name": "CountOfLAZipCode", + "value": 3109 + }, + { + "name": "CountOfOrangeCountyZipCode", + "value": 2178 + } + ] }, { "name": "country", @@ -600,6 +660,16 @@ "rowCount": 8945.0, "sizeInByte": 16890521, "createDateTime": "2023-07-24T07:00:48.000750Z", + "customMetrics": [ + { + "name": "CountOfUSAddress", + "value": 13458 + }, + { + "name": "CountOfFRAddress", + "value": 1278 + } + ], "columnProfile": [ { "name": "shop_id", @@ -743,7 +813,17 @@ "distinctProportion": 0.10, "minLength": 6.0, "maxLength": 156.0, - "mean": 98.0 + "mean": 98.0, + "customMetrics": [ + { + "name": "CountOfLAZipCode", + "value": 3389 + }, + { + "name": "CountOfOrangeCountyZipCode", + "value": 2165 + } + ] }, { "name": "country", @@ -788,6 +868,16 @@ "rowCount": 5461.0, "sizeInByte": 1572301627719.68, "createDateTime": "2023-07-24T07:00:48.000750Z", + "customMetrics": [ + { + "name": "CountOfUSAddress", + "value": 13092 + }, + { + "name": "CountOfFRAddress", + "value": 1293 + } + ], "columnProfile": [ { "name": "shop_id", @@ -931,7 +1021,17 @@ "distinctProportion": 0.10, "minLength": 6.0, "maxLength": 156.0, - "mean": 98.0 + "mean": 98.0, + "customMetrics": [ + { + "name": "CountOfLAZipCode", + "value": 3456 + }, + { + "name": "CountOfOrangeCountyZipCode", + "value": 2345 + } + ] }, { "name": "country", diff --git a/ingestion/pyproject.toml b/ingestion/pyproject.toml new file mode 100644 index 000000000000..37f603ea256b --- /dev/null +++ b/ingestion/pyproject.toml @@ -0,0 +1,125 @@ +[build-system] +requires = ["setuptools==69.0.2"] +build-backend = "setuptools.build_meta" + +# We will keep handling dependencies in setup.py +# since it helps us organize and isolate version management +[project] +name = "openmetadata-ingestion" +version = "1.3.0.0.dev0" +dynamic = ["readme", "dependencies", "optional-dependencies"] +authors = [ + {name = "OpenMetadata Committers"} +] +license = {file = "LICENSE"} +description = "Ingestion Framework for OpenMetadata" +requires-python = ">=3.8" + +[project.urls] +Homepage = "https://open-metadata.org/" +Documentation = "https://docs.open-metadata.org/" +Source = "https://github.com/open-metadata/OpenMetadata" + +[tool.setuptools.dynamic] +readme = {file = ["README.md"]} + +[tool.setuptools.packages.find] +where = ["./src"] +exclude = ["tests*"] +namespaces = true + +[tool.setuptools.package-data] +"metadata.examples" = ["workflows/*.yaml"] + +[project.scripts] +metadata = "metadata.cmd:metadata" + +[project.entry-points.apache_airflow_provider] +provider_info = "airflow_provider_openmetadata:get_provider_config" + +[tool.coverage.run] +source = [ + "env/lib/python3.9/site-packages/metadata" +] +relative_files = true +branch = true + +[tool.coverage.report] +omit = [ + "*__init__*", + "*/generated/*", + "tests/*", + "ingestion/src/*", + "*/src/metadata/ingestion/source/database/sample_*" +] + +[tool.mypy] +mypy_path = "src" +plugins = [ + "sqlalchemy.ext.mypy.plugin", + "pydantic.mypy" +] +ignore_missing_imports = true +namespace_packages = true +strict_optional = true +check_untyped_defs = true +# eventually we'd like to enable these +disallow_untyped_defs = false +disallow_incomplete_defs = false + +[tool.pytest.ini_options] +markers = [ + "slow: marks tests as slow (deselect with '-m \"not slow\"')" +] + +[tool.pylint.BASIC] +# W1203: logging-fstring-interpolation - f-string brings better readability and unifies style +# W1202: logging-format-interpolation - lazy formatting in logging functions +# R0903: too-few-public-methods - False negatives in pydantic classes +# W0707: raise-missing-from - Tends to be a false positive as exception are closely encapsulated +# R0901: too-many-ancestors - We are already inheriting from SQA classes with a bunch of ancestors +# W0703: broad-except - We are dealing with many different source systems, but we want to make sure workflows run until the end +# W0511: fixme - These are internal notes and guides +# W1518: method-cache-max-size-none - allow us to use LRU Cache with maxsize `None` to speed up certain calls +disable = "W1203,W1202,R0903,W0707,R0901,W1201,W0703,W0511,W1518" + +docstring-min-length = 20 +max-args = 7 +max-attributes = 12 + +# usual typevar naming +good-names = "T,C,fn,db,df,i" +module-rgx = "(([a-z_][a-z0-9_]*)|([a-zA-Z0-9]+))$" + +[tool.pylint.MASTER] +fail-under = 6.0 +init-hook = "from pylint.config import find_default_config_files; import os, sys; sys.path.append(os.path.dirname(next(find_default_config_files())))" +extension-pkg-allow-list = "pydantic" +load-plugins = "ingestion.plugins.print_checker" +max-public-methods = 25 + +[tool.pylint."MESSAGES CONTROL"] +disable = "no-name-in-module,import-error,duplicate-code" +enable = "useless-suppression" + +[tool.pylint.FORMAT] +# We all have big monitors now +max-line-length = 120 + +[tool.black] +extend-exclude = "src/metadata/generated" + +[tool.pycln] +all = true +extend-exclude = "src/metadata/generated" + +[tool.isort] +skip_glob = [ + "src/metadata/generated/*", + "build/*", + "env/*", + "../openmetadata-airflow-apis/build/*" +] +profile = "black" +indent = " " +multi_line_output = 3 diff --git a/ingestion/setup.cfg b/ingestion/setup.cfg deleted file mode 100644 index 34ec910e7ce6..000000000000 --- a/ingestion/setup.cfg +++ /dev/null @@ -1,52 +0,0 @@ -[flake8] -# We ignore the line length issues here, since black will take care of them. -max-line-length = 150 -max-complexity = 15 -ignore = - # Ignore: 1 blank line required before class docstring. - D203, - W503 -exclude = - .git, - __pycache__ -per-file-ignores = - # imported but unused - __init__.py: F401 -[metadata] -license_files = LICENSE -[mypy] -mypy_path = src -plugins = - sqlalchemy.ext.mypy.plugin, - pydantic.mypy -ignore_missing_imports = yes -namespace_packages = true -strict_optional = yes -check_untyped_defs = yes -# eventually we'd like to enable these -disallow_untyped_defs = no -disallow_incomplete_defs = no - -[isort] -profile = black -indent=' ' -sections = FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER - -[tool:pytest] -markers = - slow: marks tests as slow (deselect with '-m "not slow"') -testpaths = - tests/unit - -[options] -packages = find: -package_dir = - =src - -[options.packages.find] -where = src -include = * - -[options.package_data] -metadata.examples = - workflows/*.yaml diff --git a/ingestion/setup.py b/ingestion/setup.py index c7aab12cdb14..e169ad8d180e 100644 --- a/ingestion/setup.py +++ b/ingestion/setup.py @@ -13,18 +13,9 @@ Python Dependencies """ -import os from typing import Dict, Set -from setuptools import find_namespace_packages, setup - - -def get_long_description(): - root = os.path.dirname(__file__) - with open(os.path.join(root, "README.md"), encoding="UTF-8") as file: - description = file.read() - return description - +from setuptools import setup # Add here versions required for multiple plugins VERSIONS = { @@ -123,7 +114,6 @@ def get_long_description(): "sqlalchemy>=1.4.0,<2", "collate-sqllineage>=1.0.4", "tabulate==0.9.0", - "typing-compat~=0.1.0", # compatibility requirements for 3.7 "typing_extensions<=4.5.0", # We need to have this fixed due to a yanked release 4.6.0 "typing-inspect", "wheel~=0.38.4", @@ -260,13 +250,14 @@ def get_long_description(): dev = { "black==22.3.0", - "datamodel-code-generator==0.22.0", - "docker", + "datamodel-code-generator==0.24.2", "isort", "pre-commit", "pycln", "pylint~=3.0.0", + # For publishing "twine", + "build", } test = { @@ -306,34 +297,7 @@ def get_long_description(): "pytest-base-url", } -build_options = {"includes": ["_cffi_backend"]} setup( - name="openmetadata-ingestion", - version="1.3.0.0.dev0", - url="https://open-metadata.org/", - author="OpenMetadata Committers", - license="Apache License 2.0", - description="Ingestion Framework for OpenMetadata", - long_description=get_long_description(), - long_description_content_type="text/markdown", - python_requires=">=3.8", - options={"build_exe": build_options}, - package_dir={"": "src"}, - package_data={"metadata.examples": ["workflows/*.yaml"]}, - zip_safe=False, - dependency_links=[], - project_urls={ - "Documentation": "https://docs.open-metadata.org/", - "Source": "https://github.com/open-metadata/OpenMetadata", - }, - packages=find_namespace_packages(where="./src", exclude=["tests*"]), - namespace_package=["metadata"], - entry_points={ - "console_scripts": ["metadata = metadata.cmd:metadata"], - "apache_airflow_provider": [ - "provider_info = airflow_provider_openmetadata:get_provider_config" - ], - }, install_requires=list(base_requirements), extras_require={ "base": list(base_requirements), diff --git a/ingestion/src/metadata/ingestion/source/database/athena/models.py b/ingestion/src/metadata/ingestion/source/database/athena/models.py index d833893846de..51c9403e46ae 100644 --- a/ingestion/src/metadata/ingestion/source/database/athena/models.py +++ b/ingestion/src/metadata/ingestion/source/database/athena/models.py @@ -39,3 +39,13 @@ class AthenaQueryExecution(BaseModel): class AthenaQueryExecutionList(BaseModel): QueryExecutions: Optional[List[AthenaQueryExecution]] + + +class WorkGroup(BaseModel): + Name: Optional[str] + State: Optional[str] + + +class WorkGroupsList(BaseModel): + WorkGroups: Optional[List[WorkGroup]] = [] + NextToken: Optional[str] diff --git a/ingestion/src/metadata/ingestion/source/database/athena/query_parser.py b/ingestion/src/metadata/ingestion/source/database/athena/query_parser.py index a9e2bb1beaa4..725af32ca0eb 100644 --- a/ingestion/src/metadata/ingestion/source/database/athena/query_parser.py +++ b/ingestion/src/metadata/ingestion/source/database/athena/query_parser.py @@ -12,6 +12,7 @@ Athena Query parser module """ +import traceback from abc import ABC from math import ceil @@ -27,6 +28,7 @@ from metadata.ingestion.source.database.athena.models import ( AthenaQueryExecutionList, QueryExecutionIdsResponse, + WorkGroupsList, ) from metadata.ingestion.source.database.query_parser_source import QueryParserSource from metadata.utils.constants import QUERY_WITH_DBT, QUERY_WITH_OM_VERSION @@ -36,6 +38,8 @@ ATHENA_QUERY_PAGINATOR_LIMIT = 50 +ATHENA_ENABLED_WORK_GROUP_STATE = "ENABLED" + class AthenaQueryParserSource(QueryParserSource, ABC): """ @@ -59,23 +63,67 @@ def create(cls, config_dict, metadata: OpenMetadata): ) return cls(config, metadata) - def get_queries(self): - query_limit = ceil( - self.source_config.resultLimit / ATHENA_QUERY_PAGINATOR_LIMIT - ) - paginator = self.client.get_paginator("list_query_executions") - paginator_response = paginator.paginate() - for response in paginator_response: - response_obj = QueryExecutionIdsResponse(**response) - if response_obj.QueryExecutionIds: - query_details_response = self.client.batch_get_query_execution( - QueryExecutionIds=response_obj.QueryExecutionIds + def _get_work_group_response(self, next_token: str, is_first_call: bool = False): + if is_first_call: + return self.client.list_work_groups() + return self.client.list_work_groups(NextToken=next_token) + + def get_work_groups(self) -> str: + """ + Method to get list of names of athena work groups + """ + next_token = None + is_first_call = True + try: + while True: + work_group_list = self._get_work_group_response( + next_token, is_first_call ) - query_details_list = AthenaQueryExecutionList(**query_details_response) - yield query_details_list - query_limit -= 1 - if not query_limit: - break + response_obj = WorkGroupsList(**work_group_list) + for work_group in response_obj.WorkGroups: + if ( + work_group.State + and work_group.State.upper() == ATHENA_ENABLED_WORK_GROUP_STATE + ): + yield work_group.Name + next_token = response_obj.NextToken + is_first_call = False + if next_token is None: + break + except Exception as exc: + logger.debug(f"Failed to fetch work groups due to: {exc}") + logger.debug(traceback.format_exc()) + if is_first_call: + # if it fails for the first api call, most likely due to insufficient + # permissions then still fetch the queries with default workgroup + yield None + + def get_queries(self): + """ + Method to fetch queries from all work groups + """ + for work_group in self.get_work_groups(): + query_limit = ceil( + self.source_config.resultLimit / ATHENA_QUERY_PAGINATOR_LIMIT + ) + paginator = self.client.get_paginator("list_query_executions") + if work_group: + paginator_response = paginator.paginate(WorkGroup=work_group) + else: + paginator_response = paginator.paginate() + for response in paginator_response: + response_obj = QueryExecutionIdsResponse(**response) + if response_obj.QueryExecutionIds: + query_details_response = self.client.batch_get_query_execution( + QueryExecutionIds=response_obj.QueryExecutionIds + ) + query_details_list = AthenaQueryExecutionList( + **query_details_response + ) + yield query_details_list + query_limit -= 1 + if not query_limit: + break def is_not_dbt_or_om_query(self, query_text: str) -> bool: return not ( diff --git a/ingestion/src/metadata/ingestion/source/database/athena/usage.py b/ingestion/src/metadata/ingestion/source/database/athena/usage.py index bfeb9401b41c..edc63f28917a 100644 --- a/ingestion/src/metadata/ingestion/source/database/athena/usage.py +++ b/ingestion/src/metadata/ingestion/source/database/athena/usage.py @@ -11,7 +11,7 @@ """ Athena usage module """ -from typing import Iterable, Optional +from typing import Iterable from metadata.generated.schema.type.tableQuery import TableQueries, TableQuery from metadata.ingestion.source.database.athena.query_parser import ( @@ -32,7 +32,7 @@ class AthenaUsageSource(AthenaQueryParserSource, UsageSource): Athena Usage Source """ - def yield_table_queries(self) -> Optional[Iterable[TableQuery]]: + def yield_table_queries(self) -> Iterable[TableQueries]: """ Method to yield TableQueries """ diff --git a/ingestion/src/metadata/ingestion/source/database/databricks/connection.py b/ingestion/src/metadata/ingestion/source/database/databricks/connection.py index 1953e1876827..02f90c19caa0 100644 --- a/ingestion/src/metadata/ingestion/source/database/databricks/connection.py +++ b/ingestion/src/metadata/ingestion/source/database/databricks/connection.py @@ -17,6 +17,7 @@ from databricks.sdk import WorkspaceClient from sqlalchemy.engine import Engine +from sqlalchemy.exc import DatabaseError from sqlalchemy.inspection import inspect from metadata.generated.schema.entity.automations.workflow import ( @@ -33,7 +34,6 @@ from metadata.ingestion.connections.test_connections import ( test_connection_engine_step, test_connection_steps, - test_query, ) from metadata.ingestion.ometa.ometa_api import OpenMetadata from metadata.ingestion.source.database.databricks.client import DatabricksClient @@ -42,6 +42,9 @@ DATABRICKS_GET_CATALOGS, ) from metadata.utils.db_utils import get_host_from_host_port +from metadata.utils.logger import ingestion_logger + +logger = ingestion_logger() def get_connection_url(connection: DatabricksConnection) -> str: @@ -84,6 +87,18 @@ def test_connection( """ client = DatabricksClient(service_connection) + def test_database_query(engine: Engine, statement: str): + """ + Method used to execute the given query and fetch a result + to test if user has access to the tables specified + in the sql statement + """ + try: + connection = engine.connect() + connection.execute(statement).fetchone() + except DatabaseError as soe: + logger.debug(f"Failed to fetch catalogs due to: {soe}") + if service_connection.useUnityCatalog: table_obj = DatabricksTable() @@ -121,7 +136,7 @@ def get_tables(connection: WorkspaceClient, table_obj: DatabricksTable): "GetTables": inspector.get_table_names, "GetViews": inspector.get_view_names, "GetDatabases": partial( - test_query, + test_database_query, engine=connection, statement=DATABRICKS_GET_CATALOGS, ), diff --git a/ingestion/src/metadata/ingestion/source/database/databricks/legacy/metadata.py b/ingestion/src/metadata/ingestion/source/database/databricks/legacy/metadata.py index 682de21ca40a..6d50bc9a5b71 100644 --- a/ingestion/src/metadata/ingestion/source/database/databricks/legacy/metadata.py +++ b/ingestion/src/metadata/ingestion/source/database/databricks/legacy/metadata.py @@ -13,11 +13,12 @@ import re import traceback from copy import deepcopy -from typing import Iterable +from typing import Iterable, Optional from pyhive.sqlalchemy_hive import _type_map from sqlalchemy import types, util from sqlalchemy.engine import reflection +from sqlalchemy.exc import DatabaseError from sqlalchemy.inspection import inspect from sqlalchemy.sql.sqltypes import String from sqlalchemy_databricks._dialect import DatabricksDialect @@ -35,10 +36,13 @@ from metadata.ingestion.source.database.column_type_parser import create_sqlalchemy_type from metadata.ingestion.source.database.common_db_source import CommonDbSourceService from metadata.ingestion.source.database.databricks.queries import ( + DATABRICKS_GET_CATALOGS, DATABRICKS_GET_TABLE_COMMENTS, DATABRICKS_VIEW_DEFINITIONS, ) +from metadata.ingestion.source.database.multi_db_source import MultiDBSource from metadata.utils import fqn +from metadata.utils.constants import DEFAULT_DATABASE from metadata.utils.filters import filter_by_database from metadata.utils.logger import ingestion_logger from metadata.utils.sqlalchemy_utils import ( @@ -158,7 +162,7 @@ def get_columns(self, connection, table_name, schema=None, **kw): @reflection.cache def get_schema_names(self, connection, **kw): # pylint: disable=unused-argument # Equivalent to SHOW DATABASES - if kw.get("database"): + if kw.get("database") and kw.get("is_old_version") is not True: connection.execute(f"USE CATALOG '{kw.get('database')}'") return [row[0] for row in connection.execute("SHOW SCHEMAS")] @@ -238,13 +242,26 @@ def get_view_definition( reflection.Inspector.get_schema_names = get_schema_names_reflection -class DatabricksLegacySource(CommonDbSourceService): +class DatabricksLegacySource(CommonDbSourceService, MultiDBSource): """ Implements the necessary methods to extract Database metadata from Databricks Source using the legacy hive metastore method """ + def __init__(self, config: WorkflowSource, metadata: OpenMetadata): + super().__init__(config, metadata) + self.is_older_version = False + self._init_version() + + def _init_version(self): + try: + self.connection.execute(DATABRICKS_GET_CATALOGS).fetchone() + self.is_older_version = False + except DatabaseError as soe: + logger.debug(f"Failed to fetch catalogs due to: {soe}") + self.is_older_version = True + @classmethod def create(cls, config_dict, metadata: OpenMetadata): config: WorkflowSource = WorkflowSource.parse_obj(config_dict) @@ -268,44 +285,55 @@ def set_inspector(self, database_name: str) -> None: self.engine = get_connection(new_service_connection) self.inspector = inspect(self.engine) + def get_configured_database(self) -> Optional[str]: + return self.service_connection.catalog + + def get_database_names_raw(self) -> Iterable[str]: + if not self.is_older_version: + results = self.connection.execute(DATABRICKS_GET_CATALOGS) + for res in results: + if res: + row = list(res) + yield row[0] + else: + yield DEFAULT_DATABASE + def get_database_names(self) -> Iterable[str]: - configured_catalog = self.service_connection.__dict__.get("catalog") + configured_catalog = self.service_connection.catalog if configured_catalog: self.set_inspector(database_name=configured_catalog) yield configured_catalog else: - results = self.connection.execute("SHOW CATALOGS") - for res in results: - if res: - new_catalog = res[0] - database_fqn = fqn.build( - self.metadata, - entity_type=Database, - service_name=self.context.database_service.name.__root__, - database_name=new_catalog, + for new_catalog in self.get_database_names_raw(): + database_fqn = fqn.build( + self.metadata, + entity_type=Database, + service_name=self.context.database_service.name.__root__, + database_name=new_catalog, + ) + if filter_by_database( + self.source_config.databaseFilterPattern, + database_fqn + if self.source_config.useFqnForFiltering + else new_catalog, + ): + self.status.filter(database_fqn, "Database Filtered Out") + continue + try: + self.set_inspector(database_name=new_catalog) + yield new_catalog + except Exception as exc: + logger.error(traceback.format_exc()) + logger.warning( + f"Error trying to process database {new_catalog}: {exc}" ) - if filter_by_database( - self.source_config.databaseFilterPattern, - database_fqn - if self.source_config.useFqnForFiltering - else new_catalog, - ): - self.status.filter(database_fqn, "Database Filtered Out") - continue - try: - self.set_inspector(database_name=new_catalog) - yield new_catalog - except Exception as exc: - logger.error(traceback.format_exc()) - logger.warning( - f"Error trying to process database {new_catalog}: {exc}" - ) def get_raw_database_schema_names(self) -> Iterable[str]: if self.service_connection.__dict__.get("databaseSchema"): yield self.service_connection.databaseSchema else: for schema_name in self.inspector.get_schema_names( - database=self.context.database.name.__root__ + database=self.context.database.name.__root__, + is_old_version=self.is_older_version, ): yield schema_name diff --git a/ingestion/src/metadata/ingestion/source/database/databricks/unity_catalog/metadata.py b/ingestion/src/metadata/ingestion/source/database/databricks/unity_catalog/metadata.py index 898fe2ec9ba2..fa8d010a95be 100644 --- a/ingestion/src/metadata/ingestion/source/database/databricks/unity_catalog/metadata.py +++ b/ingestion/src/metadata/ingestion/source/database/databricks/unity_catalog/metadata.py @@ -61,6 +61,7 @@ ForeignConstrains, Type, ) +from metadata.ingestion.source.database.multi_db_source import MultiDBSource from metadata.ingestion.source.database.stored_procedures_mixin import QueryByProcedure from metadata.ingestion.source.models import TableView from metadata.utils import fqn @@ -84,7 +85,7 @@ def from_dict(cls, dct: Dict[str, Any]) -> "TableConstraintList": TableConstraintList.from_dict = from_dict -class DatabricksUnityCatalogSource(DatabaseServiceSource): +class DatabricksUnityCatalogSource(DatabaseServiceSource, MultiDBSource): """ Implements the necessary methods to extract Database metadata from Databricks Source using @@ -107,6 +108,13 @@ def __init__(self, config: WorkflowSource, metadata: OpenMetadata): self.table_constraints = [] self.test_connection() + def get_configured_database(self) -> Optional[str]: + return self.service_connection.catalog + + def get_database_names_raw(self) -> Iterable[str]: + for catalog in self.client.catalogs.list(): + yield catalog.name + @classmethod def create(cls, config_dict, metadata: OpenMetadata): config: WorkflowSource = WorkflowSource.parse_obj(config_dict) @@ -131,31 +139,31 @@ def get_database_names(self) -> Iterable[str]: if self.service_connection.catalog: yield self.service_connection.catalog else: - for catalog in self.client.catalogs.list(): + for catalog_name in self.get_database_names_raw(): try: database_fqn = fqn.build( self.metadata, entity_type=Database, service_name=self.context.database_service.name.__root__, - database_name=catalog.name, + database_name=catalog_name, ) if filter_by_database( self.config.sourceConfig.config.databaseFilterPattern, database_fqn if self.config.sourceConfig.config.useFqnForFiltering - else catalog.name, + else catalog_name, ): self.status.filter( database_fqn, "Database (Catalog ID) Filtered Out", ) continue - yield catalog.name + yield catalog_name except Exception as exc: self.status.failed( StackTraceError( - name=catalog.name, - error=f"Unexpected exception to get database name [{catalog.name}]: {exc}", + name=catalog_name, + error=f"Unexpected exception to get database name [{catalog_name}]: {exc}", stack_trace=traceback.format_exc(), ) ) diff --git a/ingestion/src/metadata/ingestion/source/database/sample_data.py b/ingestion/src/metadata/ingestion/source/database/sample_data.py index a4742295a6b6..26c0147c4c6e 100644 --- a/ingestion/src/metadata/ingestion/source/database/sample_data.py +++ b/ingestion/src/metadata/ingestion/source/database/sample_data.py @@ -1292,6 +1292,7 @@ def ingest_profiles(self) -> Iterable[Either[OMetaTableProfileSampleData]]: rowCount=profile["rowCount"], createDateTime=profile.get("createDateTime"), sizeInByte=profile.get("sizeInByte"), + customMetrics=profile.get("customMetrics"), timestamp=int( ( datetime.now(tz=timezone.utc) - timedelta(days=days) diff --git a/ingestion/tests/cli_e2e/dashboard/tableau/tableau.yaml b/ingestion/tests/cli_e2e/dashboard/tableau/tableau.yaml index 53695e367c89..77d089b56995 100644 --- a/ingestion/tests/cli_e2e/dashboard/tableau/tableau.yaml +++ b/ingestion/tests/cli_e2e/dashboard/tableau/tableau.yaml @@ -11,7 +11,7 @@ source: hostPort: $E2E_TABLEAU_HOST_PORT siteName: $E2E_TABLEAU_SITE siteUrl: $E2E_TABLEAU_SITE - apiVersion: 3.19 + apiVersion: 3.21 sourceConfig: config: type: DashboardMetadata diff --git a/ingestion/tests/cli_e2e/test_cli_athena.py b/ingestion/tests/cli_e2e/test_cli_athena.py index becd6a37a58f..037854e95f3a 100644 --- a/ingestion/tests/cli_e2e/test_cli_athena.py +++ b/ingestion/tests/cli_e2e/test_cli_athena.py @@ -87,7 +87,7 @@ def get_excludes_tables() -> List[str]: @staticmethod def expected_filtered_schema_includes() -> int: - return 3 + return 4 @staticmethod def expected_filtered_schema_excludes() -> int: @@ -95,15 +95,15 @@ def expected_filtered_schema_excludes() -> int: @staticmethod def expected_filtered_table_includes() -> int: - return 26 + return 29 @staticmethod def expected_filtered_table_excludes() -> int: - return 1 + return 2 @staticmethod def expected_filtered_mix() -> int: - return 4 + return 6 def retrieve_lineage(self, entity_fqn: str) -> dict: pass diff --git a/ingestion/tests/cli_e2e/test_cli_tableau.py b/ingestion/tests/cli_e2e/test_cli_tableau.py index 6c8b4544ae1c..cfbc8e6b1793 100644 --- a/ingestion/tests/cli_e2e/test_cli_tableau.py +++ b/ingestion/tests/cli_e2e/test_cli_tableau.py @@ -54,22 +54,22 @@ def get_excludes_datamodels(self) -> List[str]: return ["Random.*"] def expected_dashboards_and_charts(self) -> int: - return 20 + return 22 def expected_lineage(self) -> int: - return 0 + return 1 def expected_tags(self) -> int: return 1 def expected_datamodel_lineage(self) -> int: - return 11 + return 5 def expected_datamodels(self) -> int: - return 10 + return 5 def expected_filtered_mix(self) -> int: - return 12 + return 2 def expected_filtered_sink_mix(self) -> int: - return 10 + return 9 diff --git a/ingestion/tests/unit/topology/database/test_databricks.py b/ingestion/tests/unit/topology/database/test_databricks.py index 412937912889..fb5be497ac57 100644 --- a/ingestion/tests/unit/topology/database/test_databricks.py +++ b/ingestion/tests/unit/topology/database/test_databricks.py @@ -1,3 +1,18 @@ +# Copyright 2021 Collate +# 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 +# http://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. + +""" +Test databricks using the topology +""" + from unittest import TestCase from unittest.mock import patch @@ -20,6 +35,7 @@ from metadata.generated.schema.type.entityReference import EntityReference from metadata.ingestion.source.database.databricks.metadata import DatabricksSource +# pylint: disable=line-too-long mock_databricks_config = { "source": { "type": "databricks", @@ -230,12 +246,20 @@ class DatabricksUnitTest(TestCase): + """ + Databricks unit tests + """ + @patch( "metadata.ingestion.source.database.common_db_source.CommonDbSourceService.test_connection" ) - def __init__(self, methodName, test_connection) -> None: + @patch( + "metadata.ingestion.source.database.databricks.legacy.metadata.DatabricksLegacySource._init_version" + ) + def __init__(self, methodName, test_connection, db_init_version) -> None: super().__init__(methodName) test_connection.return_value = False + db_init_version.return_value = None self.config = OpenMetadataWorkflowConfig.parse_obj(mock_databricks_config) self.databricks_source = DatabricksSource.create( diff --git a/openmetadata-airflow-apis/.coveragerc b/openmetadata-airflow-apis/.coveragerc deleted file mode 100644 index 64a3eb0c3c5a..000000000000 --- a/openmetadata-airflow-apis/.coveragerc +++ /dev/null @@ -1,10 +0,0 @@ -[run] -source = env/lib/python3.9/site-packages/openmetadata_managed_apis -relative_files = True -branch = True -[report] -omit = - *__init__* - tests/* - views/** - plugin.py diff --git a/openmetadata-airflow-apis/LICENSE b/openmetadata-airflow-apis/LICENSE new file mode 100644 index 000000000000..f49a4e16e68b --- /dev/null +++ b/openmetadata-airflow-apis/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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 + + http://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. \ No newline at end of file diff --git a/openmetadata-airflow-apis/pyproject.toml b/openmetadata-airflow-apis/pyproject.toml new file mode 100644 index 000000000000..8e5eafcdc556 --- /dev/null +++ b/openmetadata-airflow-apis/pyproject.toml @@ -0,0 +1,65 @@ +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +# We will keep handling dependencies in setup.py +# since it helps us organize and isolate version management +[project] +name = "openmetadata_managed_apis" +version = "1.3.0.0.dev0" +dynamic = ["readme"] +authors = [ + {name = "OpenMetadata Committers"} +] +license = {file = "LICENSE"} +description = "Airflow REST APIs to create and manage DAGS" +requires-python = ">=3.8" +dependencies = [ + "pendulum~=2.1.2", + "apache-airflow>=2.2.2", + "Flask>=1.1.4", + "Flask-Admin==1.6.0", +] + +[project.optional-dependencies] +dev = [ + "black==22.3.0", + "pytest", + "pylint", + "pytest-cov", + "isort", + "pycln", +] + +[project.urls] +Homepage = "https://open-metadata.org/" +Documentation = "https://docs.open-metadata.org/" +Source = "https://github.com/open-metadata/OpenMetadata" + +[tool.setuptools.dynamic] +readme = {file = ["README.md"]} + +[tool.setuptools.packages.find] +include = ["openmetadata_managed_apis.*", "openmetadata_managed_apis"] + +[tool.setuptools.package-data] +"openmetadata_managed_apis" = ["views/templates/rest_api/index.html", "resources/dag_runner.j2"] + +[project.entry-points."airflow.plugins"] +openmetadata_managed_apis = "openmetadata_managed_apis.plugin:RestApiPlugin" + + +[tool.coverage.run] +source = [ + "env/lib/python3.9/site-packages/openmetadata_managed_apis" +] +relative_files = true +branch = true + +[tool.coverage.report] +omit = [ + "*__init__*", + "tests/*", + "views/**", + "plugin.py" +] \ No newline at end of file diff --git a/openmetadata-airflow-apis/setup.py b/openmetadata-airflow-apis/setup.py deleted file mode 100644 index 33a3925c94ea..000000000000 --- a/openmetadata-airflow-apis/setup.py +++ /dev/null @@ -1,96 +0,0 @@ -# Copyright 2021 Collate -# 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 -# http://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. -import glob -import os -import pathlib -from itertools import chain - -from setuptools import find_packages, setup - -PLUGIN_NAME = "openmetadata_managed_apis" -PLUGIN_ROOT_FILE = "plugin" -PLUGIN_ENTRY_POINT = "RestApiPlugin" -HOME = pathlib.Path(__file__).parent -README = (HOME / "README.md").read_text() -CONFIG = HOME / PLUGIN_NAME / "config.py" - - -def get_package_data(): - """ - Add templates and html files to the built - package for easier deployments - """ - extensions = ["html", "j2"] - - files = list( - chain( - *[ - glob.glob(f"{PLUGIN_NAME}/**/*.%s" % x, recursive=True) - for x in extensions - ] - ) - ) - return [x.split(os.sep, 1)[1] for x in files] - - -def get_long_description(): - root = os.path.dirname(__file__) - with open(os.path.join(root, "README.md")) as f: - description = f.read() - return description - - -base_requirements = { - "pendulum~=2.1.2", - "apache-airflow>=2.2.2", - "Flask>=1.1.4", - "Flask-Admin==1.6.0", -} - -dev_requirements = { - "black==22.3.0", - "pytest", - "pylint", - "pytest-cov", - "isort", - "pycln", -} - -setup( - name=PLUGIN_NAME, - packages=find_packages(include=[f"{PLUGIN_NAME}.*", PLUGIN_NAME]), - include_package_data=True, - package_data={PLUGIN_NAME: get_package_data()}, - version="1.3.0.0.dev0", - url="https://open-metadata.org/", - author="OpenMetadata Committers", - license="Apache License 2.0", - description="Airflow REST APIs to create and manage DAGS", - long_description=get_long_description(), - long_description_content_type="text/markdown", - entry_points={ - "airflow.plugins": [ - f"{PLUGIN_NAME} = {PLUGIN_NAME}.{PLUGIN_ROOT_FILE}:{PLUGIN_ENTRY_POINT}" - ] - }, - python_requires=">=3.8", - zip_safe=False, - dependency_links=[], - project_urls={ - "Documentation": "https://docs.open-metadata.org/", - "Source": "https://github.com/open-metadata/OpenMetadata", - }, - install_requires=list(base_requirements), - extras_require={ - "base": list(base_requirements), - "dev": list(dev_requirements), - }, -) diff --git a/openmetadata-clients/openmetadata-java-client/pom.xml b/openmetadata-clients/openmetadata-java-client/pom.xml index bd7fbae1d76b..d9b4f6828044 100644 --- a/openmetadata-clients/openmetadata-java-client/pom.xml +++ b/openmetadata-clients/openmetadata-java-client/pom.xml @@ -15,7 +15,7 @@ ${java.version} ${java.version} 2.7.0 - 13.0 + 13.1 0.2.6 8.3.3 2.1.18 diff --git a/openmetadata-docs/content/v1.2.x/connectors/database/athena/index.md b/openmetadata-docs/content/v1.2.x/connectors/database/athena/index.md index 361ad0f75661..5a4692db6e0a 100644 --- a/openmetadata-docs/content/v1.2.x/connectors/database/athena/index.md +++ b/openmetadata-docs/content/v1.2.x/connectors/database/athena/index.md @@ -74,6 +74,7 @@ And is defined as: "athena:ListQueryExecutions", "athena:StartQueryExecution", "athena:GetQueryExecution", + "athena:ListWorkGroups", "athena:GetQueryResults", "athena:BatchGetQueryExecution" ], diff --git a/openmetadata-docs/content/v1.2.x/deployment/docker/index.md b/openmetadata-docs/content/v1.2.x/deployment/docker/index.md index d20155597f25..7d6151b44d38 100644 --- a/openmetadata-docs/content/v1.2.x/deployment/docker/index.md +++ b/openmetadata-docs/content/v1.2.x/deployment/docker/index.md @@ -102,7 +102,7 @@ This docker compose file contains only the docker compose services for OpenMetad You can also run the below command to fetch the docker compose file directly from the terminal - ```bash -wget https://github.com/open-metadata/OpenMetadata/releases/download/1.2.0-release/docker-compose-openmetadata.yml +wget https://github.com/open-metadata/OpenMetadata/releases/download/1.2.2-release/docker-compose-openmetadata.yml ``` ### 3. Update Environment Variables required for OpenMetadata Dependencies @@ -191,7 +191,7 @@ You can validate that all containers are up by running with command `docker ps`. ```commandline ❯ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES -470cc8149826 openmetadata/server:1.2.0 "./openmetadata-star…" 45 seconds ago Up 43 seconds 3306/tcp, 9200/tcp, 9300/tcp, 0.0.0.0:8585-8586->8585-8586/tcp openmetadata_server +470cc8149826 openmetadata/server:1.2.2 "./openmetadata-star…" 45 seconds ago Up 43 seconds 3306/tcp, 9200/tcp, 9300/tcp, 0.0.0.0:8585-8586->8585-8586/tcp openmetadata_server ``` In a few seconds, you should be able to access the OpenMetadata UI at [http://localhost:8585](http://localhost:8585) diff --git a/openmetadata-docs/content/v1.2.x/deployment/ingestion/mwaa.md b/openmetadata-docs/content/v1.2.x/deployment/ingestion/mwaa.md index f1f5fcd8e20f..cb8ec536c1c0 100644 --- a/openmetadata-docs/content/v1.2.x/deployment/ingestion/mwaa.md +++ b/openmetadata-docs/content/v1.2.x/deployment/ingestion/mwaa.md @@ -32,9 +32,9 @@ To install the package, we need to update the `requirements.txt` file from the M openmetadata-ingestion[]==x.y.z ``` -Where `x.y.z` is the version of the OpenMetadata ingestion package. Note that the version needs to match the server version. If we are using the server at 1.2.0, then the ingestion package needs to also be 1.2.0. +Where `x.y.z` is the version of the OpenMetadata ingestion package. Note that the version needs to match the server version. If we are using the server at 1.2.2, then the ingestion package needs to also be 1.2.2. -The plugin parameter is a list of the sources that we want to ingest. An example would look like this `openmetadata-ingestion[mysql,snowflake,s3]==1.2.0`. +The plugin parameter is a list of the sources that we want to ingest. An example would look like this `openmetadata-ingestion[mysql,snowflake,s3]==1.2.2`. A DAG deployed using a Python Operator would then look like follows @@ -106,7 +106,7 @@ We will now describe the steps, following the official AWS documentation. - The cluster needs a task to run in `FARGATE` mode. - The required image is `docker.getcollate.io/openmetadata/ingestion-base:x.y.z` - - The same logic as above applies. The `x.y.z` version needs to match the server version. For example, `docker.getcollate.io/openmetadata/ingestion-base:1.2.0` + - The same logic as above applies. The `x.y.z` version needs to match the server version. For example, `docker.getcollate.io/openmetadata/ingestion-base:1.2.2` We have tested this process with a Task Memory of 512MB and Task CPU (unit) of 256. This can be tuned depending on the amount of metadata that needs to be ingested. diff --git a/openmetadata-docs/content/v1.2.x/deployment/kubernetes/faqs.md b/openmetadata-docs/content/v1.2.x/deployment/kubernetes/faqs.md index 02ff65bfee57..492cd23b9b91 100644 --- a/openmetadata-docs/content/v1.2.x/deployment/kubernetes/faqs.md +++ b/openmetadata-docs/content/v1.2.x/deployment/kubernetes/faqs.md @@ -48,7 +48,7 @@ WORKDIR /home/ COPY . RUN update-ca-certificates ``` -where `docker.getcollate.io/openmetadata/server:x.y.z` needs to point to the same version of the OpenMetadata server, for example `docker.getcollate.io/openmetadata/server:1.2.0`. +where `docker.getcollate.io/openmetadata/server:x.y.z` needs to point to the same version of the OpenMetadata server, for example `docker.getcollate.io/openmetadata/server:1.2.2`. This image needs to be built and published to the container registry of your choice. ### 2. Update your openmetadata helm values yaml @@ -95,7 +95,7 @@ COPY setup.py . RUN pip install --no-deps . ``` -where `docker.getcollate.io/openmetadata/ingestion:x.y.z` needs to point to the same version of the OpenMetadata server, for example `docker.getcollate.io/openmetadata/ingestion:1.2.0`. +where `docker.getcollate.io/openmetadata/ingestion:x.y.z` needs to point to the same version of the OpenMetadata server, for example `docker.getcollate.io/openmetadata/ingestion:1.2.2`. This image needs to be built and published to the container registry of your choice. ### 2. Update the airflow in openmetadata dependencies values YAML diff --git a/openmetadata-docs/content/v1.2.x/deployment/upgrade/kubernetes.md b/openmetadata-docs/content/v1.2.x/deployment/upgrade/kubernetes.md index c8a30c62049c..ba72e6960c9b 100644 --- a/openmetadata-docs/content/v1.2.x/deployment/upgrade/kubernetes.md +++ b/openmetadata-docs/content/v1.2.x/deployment/upgrade/kubernetes.md @@ -45,12 +45,12 @@ Verify with the below command to see the latest release available locally. ```commandline helm search repo open-metadata --versions > NAME CHART VERSION APP VERSION DESCRIPTION -open-metadata/openmetadata 1.2.1 1.2.0 A Helm chart for OpenMetadata on Kubernetes -open-metadata/openmetadata 1.2.0 1.2.0 A Helm chart for OpenMetadata on Kubernetes +open-metadata/openmetadata 1.2.4 1.2.2 A Helm chart for OpenMetadata on Kubernetes +open-metadata/openmetadata 1.2.3 1.2.2 A Helm chart for OpenMetadata on Kubernetes ... -open-metadata/openmetadata-dependencies 1.2.1 1.2.0 Helm Dependencies for OpenMetadata -open-metadata/openmetadata-dependencies 1.2.0 1.2.0 Helm Dependencies for OpenMetadata +open-metadata/openmetadata-dependencies 1.2.4 1.2.2 Helm Dependencies for OpenMetadata +open-metadata/openmetadata-dependencies 1.2.3 1.2.2 Helm Dependencies for OpenMetadata ... ``` diff --git a/openmetadata-docs/content/v1.2.x/quick-start/local-docker-deployment.md b/openmetadata-docs/content/v1.2.x/quick-start/local-docker-deployment.md index 7d809d8e84ac..05b3d87ea3f4 100644 --- a/openmetadata-docs/content/v1.2.x/quick-start/local-docker-deployment.md +++ b/openmetadata-docs/content/v1.2.x/quick-start/local-docker-deployment.md @@ -119,15 +119,15 @@ The latest version is at the top of the page You can use the curl or wget command as well to fetch the docker compose files from your terminal - ```commandline -curl -sL -o docker-compose.yml https://github.com/open-metadata/OpenMetadata/releases/download/1.2.0-release/docker-compose.yml +curl -sL -o docker-compose.yml https://github.com/open-metadata/OpenMetadata/releases/download/1.2.2-release/docker-compose.yml -curl -sL -o docker-compose-postgres.yml https://github.com/open-metadata/OpenMetadata/releases/download/1.2.0-release/docker-compose-postgres.yml +curl -sL -o docker-compose-postgres.yml https://github.com/open-metadata/OpenMetadata/releases/download/1.2.2-release/docker-compose-postgres.yml ``` ```commandline -wget -O https://github.com/open-metadata/OpenMetadata/releases/download/1.2.0-release/docker-compose.yml +wget -O https://github.com/open-metadata/OpenMetadata/releases/download/1.2.2-release/docker-compose.yml -wget -O https://github.com/open-metadata/OpenMetadata/releases/download/1.2.0-release/docker-compose-postgres.yml +wget -O https://github.com/open-metadata/OpenMetadata/releases/download/1.2.2-release/docker-compose-postgres.yml ``` ### 3. Start the Docker Compose Services @@ -166,10 +166,10 @@ You can validate that all containers are up by running with command `docker ps`. ```commandline ❯ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES -470cc8149826 openmetadata/server:1.2.0 "./openmetadata-star…" 45 seconds ago Up 43 seconds 3306/tcp, 9200/tcp, 9300/tcp, 0.0.0.0:8585-8586->8585-8586/tcp openmetadata_server -63578aacbff5 openmetadata/ingestion:1.2.0 "./ingestion_depende…" 45 seconds ago Up 43 seconds 0.0.0.0:8080->8080/tcp openmetadata_ingestion +470cc8149826 openmetadata/server:1.2.2 "./openmetadata-star…" 45 seconds ago Up 43 seconds 3306/tcp, 9200/tcp, 9300/tcp, 0.0.0.0:8585-8586->8585-8586/tcp openmetadata_server +63578aacbff5 openmetadata/ingestion:1.2.2 "./ingestion_depende…" 45 seconds ago Up 43 seconds 0.0.0.0:8080->8080/tcp openmetadata_ingestion 9f5ee8334f4b docker.elastic.co/elasticsearch/elasticsearch:7.16.3 "/tini -- /usr/local…" 45 seconds ago Up 44 seconds 0.0.0.0:9200->9200/tcp, 0.0.0.0:9300->9300/tcp openmetadata_elasticsearch -08947ab3424b openmetadata/db:1.2.0 "/entrypoint.sh mysq…" 45 seconds ago Up 44 seconds (healthy) 3306/tcp, 33060-33061/tcp openmetadata_mysql +08947ab3424b openmetadata/db:1.2.2 "/entrypoint.sh mysq…" 45 seconds ago Up 44 seconds (healthy) 3306/tcp, 33060-33061/tcp openmetadata_mysql ``` In a few seconds, you should be able to access the OpenMetadata UI at [http://localhost:8585](http://localhost:8585) diff --git a/openmetadata-service/pom.xml b/openmetadata-service/pom.xml index e67f8f6899e5..6bf772e80e49 100644 --- a/openmetadata-service/pom.xml +++ b/openmetadata-service/pom.xml @@ -15,8 +15,8 @@ ${project.basedir}/target/surefire-reports ${project.basedir}/target/site/jacoco-aggregate/jacoco.xml ${project.basedir}/src/test/java - 1.19.1 - 2.21.16 + 1.19.2 + 2.21.26 0.5.11 2.9.0 2.2.6 @@ -471,7 +471,7 @@ com.cronutils cron-utils - 9.2.0 + 9.2.1 com.google.guava diff --git a/openmetadata-service/src/main/java/org/openmetadata/csv/CsvUtil.java b/openmetadata-service/src/main/java/org/openmetadata/csv/CsvUtil.java index c0985873337f..4de4fcd9ad38 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/csv/CsvUtil.java +++ b/openmetadata-service/src/main/java/org/openmetadata/csv/CsvUtil.java @@ -95,9 +95,8 @@ public static String quoteField(List field) { : field.stream().map(CsvUtil::quoteCsvField).collect(Collectors.joining(FIELD_SEPARATOR)); } - public static List addField(List csvRecord, Boolean field) { + public static void addField(List csvRecord, Boolean field) { csvRecord.add(field == null ? "" : field.toString()); - return csvRecord; } public static List addField(List csvRecord, String field) { @@ -129,14 +128,12 @@ public static List addTagLabels(List csvRecord, List t return csvRecord; } - public static List addOwner(List csvRecord, EntityReference owner) { + public static void addOwner(List csvRecord, EntityReference owner) { csvRecord.add(nullOrEmpty(owner) ? null : owner.getType() + FIELD_SEPARATOR + owner.getName()); - return csvRecord; } - public static List addUserOwner(List csvRecord, EntityReference owner) { + public static void addUserOwner(List csvRecord, EntityReference owner) { csvRecord.add(nullOrEmpty(owner) ? null : owner.getName()); - return csvRecord; } private static String quoteCsvField(String str) { diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/ResourceRegistry.java b/openmetadata-service/src/main/java/org/openmetadata/service/ResourceRegistry.java index 86872657f2cd..86bf260b87e9 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/ResourceRegistry.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/ResourceRegistry.java @@ -65,13 +65,13 @@ public static void addResource( ResourceDescriptor resourceDescriptor = new ResourceDescriptor() .withName(resourceName) - .withOperations(getOperations(resourceName, entitySpecificOperations, new ArrayList<>(entityFields))); + .withOperations(getOperations(entitySpecificOperations, new ArrayList<>(entityFields))); RESOURCE_DESCRIPTORS.sort(Comparator.comparing(ResourceDescriptor::getName)); RESOURCE_DESCRIPTORS.add(resourceDescriptor); } private static List getOperations( - String resourceName, List entitySpecificOperations, List entityFields) { + List entitySpecificOperations, List entityFields) { Set operations = new TreeSet<>(COMMON_OPERATIONS); if (!nullOrEmpty(entitySpecificOperations)) { operations.addAll(entitySpecificOperations); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/apps/AbstractNativeApplication.java b/openmetadata-service/src/main/java/org/openmetadata/service/apps/AbstractNativeApplication.java index 5ce5659c84d1..4c744a7e794d 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/apps/AbstractNativeApplication.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/apps/AbstractNativeApplication.java @@ -197,11 +197,11 @@ public static AppRuntime getAppRuntime(App app) { return JsonUtils.convertValue(app.getRuntime(), ScheduledExecutionContext.class); } - protected IngestionPipeline getIngestionPipeline(CreateIngestionPipeline create, String botname, String user) { + protected IngestionPipeline getIngestionPipeline(CreateIngestionPipeline create, String botName, String user) { IngestionPipelineRepository ingestionPipelineRepository = (IngestionPipelineRepository) Entity.getEntityRepository(Entity.INGESTION_PIPELINE); OpenMetadataConnection openMetadataServerConnection = - new OpenMetadataConnectionBuilder(ingestionPipelineRepository.getOpenMetadataApplicationConfig(), botname) + new OpenMetadataConnectionBuilder(ingestionPipelineRepository.getOpenMetadataApplicationConfig(), botName) .build(); return ingestionPipelineRepository .copy(new IngestionPipeline(), create, user) @@ -224,8 +224,8 @@ protected AppRunRecord getJobRecord(JobExecutionContext jobExecutionContext) { } @SneakyThrows - protected void pushAppStausUpdates(JobExecutionContext jobExecutionContext, AppRunRecord record, boolean update) { + protected void pushAppStatusUpdates(JobExecutionContext jobExecutionContext, AppRunRecord appRecord, boolean update) { OmAppJobListener listener = getJobListener(jobExecutionContext); - listener.pushApplicationStatusUpdates(jobExecutionContext, record, update); + listener.pushApplicationStatusUpdates(jobExecutionContext, appRecord, update); } } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/searchIndex/SearchIndexApp.java b/openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/searchIndex/SearchIndexApp.java index 4280c34191b1..bd78b640ef85 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/searchIndex/SearchIndexApp.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/searchIndex/SearchIndexApp.java @@ -151,7 +151,7 @@ public void updateRecordToDb(JobExecutionContext jobExecutionContext) { appRecord.setSuccessContext(new SuccessContext().withAdditionalProperty("stats", jobData.getStats())); } - pushAppStausUpdates(jobExecutionContext, appRecord, true); + pushAppStatusUpdates(jobExecutionContext, appRecord, true); } private void entitiesReIndex() { diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/apps/scheduler/AbstractOmAppJobListener.java b/openmetadata-service/src/main/java/org/openmetadata/service/apps/scheduler/AbstractOmAppJobListener.java index e89b765ab17a..d96bfd7a621f 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/apps/scheduler/AbstractOmAppJobListener.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/apps/scheduler/AbstractOmAppJobListener.java @@ -109,13 +109,13 @@ public void pushApplicationStatusUpdates(JobExecutionContext context, AppRunReco } } - private void updateStatus(UUID appId, AppRunRecord record, boolean update) { + private void updateStatus(UUID appId, AppRunRecord appRunRecord, boolean update) { if (update) { collectionDAO .appExtensionTimeSeriesDao() - .update(appId.toString(), JsonUtils.pojoToJson(record), record.getTimestamp()); + .update(appId.toString(), JsonUtils.pojoToJson(appRunRecord), appRunRecord.getTimestamp()); } else { - collectionDAO.appExtensionTimeSeriesDao().insert(JsonUtils.pojoToJson(record)); + collectionDAO.appExtensionTimeSeriesDao().insert(JsonUtils.pojoToJson(appRunRecord)); } } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/config/OMWebBundle.java b/openmetadata-service/src/main/java/org/openmetadata/service/config/OMWebBundle.java index 3eb22bfc4daa..107a964e5ad7 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/config/OMWebBundle.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/config/OMWebBundle.java @@ -75,7 +75,7 @@ protected void configureHeaderFilter( } private String deriveUrlPattern(String uri) { - return uri.endsWith("/") ? uri + "*" : uri + "/" + "*"; + return uri.endsWith("/") ? uri + "*" : uri + "/*"; } public abstract OMWebConfiguration getWebConfiguration(T var1); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/AggregatedUnusedAssetsCountAggregator.java b/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/AggregatedUnusedAssetsCountAggregator.java index 6ed6bb87127f..64e7d584df67 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/AggregatedUnusedAssetsCountAggregator.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/AggregatedUnusedAssetsCountAggregator.java @@ -9,7 +9,7 @@ public abstract class AggregatedUnusedAssetsCountAggregator implements DataInsightAggregatorInterface { private final A aggregations; - public AggregatedUnusedAssetsCountAggregator(A aggregations) { + protected AggregatedUnusedAssetsCountAggregator(A aggregations) { this.aggregations = aggregations; } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/AggregatedUnusedAssetsSizeAggregator.java b/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/AggregatedUnusedAssetsSizeAggregator.java index 43dcd0ea1888..cd0bfcd4658e 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/AggregatedUnusedAssetsSizeAggregator.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/AggregatedUnusedAssetsSizeAggregator.java @@ -9,7 +9,7 @@ public abstract class AggregatedUnusedAssetsSizeAggregator implements DataInsightAggregatorInterface { private final A aggregations; - public AggregatedUnusedAssetsSizeAggregator(A aggregations) { + protected AggregatedUnusedAssetsSizeAggregator(A aggregations) { this.aggregations = aggregations; } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/AggregatedUsedvsUnusedAssetsCountAggregator.java b/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/AggregatedUsedvsUnusedAssetsCountAggregator.java index 55da7c43ff35..903fc223a408 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/AggregatedUsedvsUnusedAssetsCountAggregator.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/AggregatedUsedvsUnusedAssetsCountAggregator.java @@ -10,7 +10,7 @@ public abstract class AggregatedUsedvsUnusedAssetsCountAggregator implements DataInsightAggregatorInterface { private final A aggregations; - public AggregatedUsedvsUnusedAssetsCountAggregator(A aggregations) { + protected AggregatedUsedvsUnusedAssetsCountAggregator(A aggregations) { this.aggregations = aggregations; } @@ -26,8 +26,8 @@ public List aggregate() throws ParseException { Double used = Objects.requireNonNullElse(getValue(totalUsed), 0.0); Double unused = Objects.requireNonNullElse(getValue(totalUnused), 0.0); Double total = used + unused; - Double usedPercentage = 0.0; - Double unusedPercentage = 0.0; + double usedPercentage = 0.0; + double unusedPercentage = 0.0; if (total != 0.0) { usedPercentage = used / total; unusedPercentage = unused / total; diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/AggregatedUsedvsUnusedAssetsSizeAggregator.java b/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/AggregatedUsedvsUnusedAssetsSizeAggregator.java index c308befe3d39..8fb0059897ec 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/AggregatedUsedvsUnusedAssetsSizeAggregator.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/AggregatedUsedvsUnusedAssetsSizeAggregator.java @@ -9,7 +9,7 @@ public abstract class AggregatedUsedvsUnusedAssetsSizeAggregator implements DataInsightAggregatorInterface { private final A aggregations; - public AggregatedUsedvsUnusedAssetsSizeAggregator(A aggregations) { + protected AggregatedUsedvsUnusedAssetsSizeAggregator(A aggregations) { this.aggregations = aggregations; } @@ -25,8 +25,8 @@ public List aggregate() throws ParseException { Double used = Objects.requireNonNullElse(getValue(totalUsed), 0.0); Double unused = Objects.requireNonNullElse(getValue(totalUnused), 0.0); Double total = used + unused; - Double usedPercentage = 0.0; - Double unusedPercentage = 0.0; + double usedPercentage = 0.0; + double unusedPercentage = 0.0; if (total != 0.0) { usedPercentage = used / total; unusedPercentage = unused / total; diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/EntitiesDescriptionAggregator.java b/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/EntitiesDescriptionAggregator.java index d830ba17284f..9c439e8eefc1 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/EntitiesDescriptionAggregator.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/EntitiesDescriptionAggregator.java @@ -8,7 +8,7 @@ public abstract class EntitiesDescriptionAggregator implements DataInsightAggregatorInterface { private final A aggregations; - public EntitiesDescriptionAggregator(A aggregations) { + protected EntitiesDescriptionAggregator(A aggregations) { this.aggregations = aggregations; } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/EntitiesOwnerAggregator.java b/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/EntitiesOwnerAggregator.java index b7f135f0b67b..43160b3ca4fd 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/EntitiesOwnerAggregator.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/EntitiesOwnerAggregator.java @@ -8,7 +8,7 @@ public abstract class EntitiesOwnerAggregator implements DataInsightAggregatorInterface { private final A aggregations; - public EntitiesOwnerAggregator(A aggregations) { + protected EntitiesOwnerAggregator(A aggregations) { this.aggregations = aggregations; } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/MostActiveUsersAggregator.java b/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/MostActiveUsersAggregator.java index f4e09c3822d1..6777ca85d13f 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/MostActiveUsersAggregator.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/MostActiveUsersAggregator.java @@ -7,7 +7,7 @@ public abstract class MostActiveUsersAggregator implements DataInsightAggregatorInterface { private final A aggregations; - public MostActiveUsersAggregator(A aggregations) { + protected MostActiveUsersAggregator(A aggregations) { this.aggregations = aggregations; } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/MostViewedEntitiesAggregator.java b/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/MostViewedEntitiesAggregator.java index 3a64f31f4632..8027b47a293e 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/MostViewedEntitiesAggregator.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/MostViewedEntitiesAggregator.java @@ -7,7 +7,7 @@ public abstract class MostViewedEntitiesAggregator implements DataInsightAggregatorInterface { protected final A aggregations; - public MostViewedEntitiesAggregator(A aggregations) { + protected MostViewedEntitiesAggregator(A aggregations) { this.aggregations = aggregations; } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/ServicesDescriptionAggregator.java b/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/ServicesDescriptionAggregator.java index 705bafd48274..22271271646d 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/ServicesDescriptionAggregator.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/ServicesDescriptionAggregator.java @@ -8,7 +8,7 @@ public abstract class ServicesDescriptionAggregator implements DataInsightAggregatorInterface { private final A aggregations; - public ServicesDescriptionAggregator(A aggregations) { + protected ServicesDescriptionAggregator(A aggregations) { this.aggregations = aggregations; } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/ServicesOwnerAggregator.java b/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/ServicesOwnerAggregator.java index 71e92e15bedb..14f7df6fa520 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/ServicesOwnerAggregator.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/ServicesOwnerAggregator.java @@ -8,7 +8,7 @@ public abstract class ServicesOwnerAggregator implements DataInsightAggregatorInterface { protected final A aggregations; - public ServicesOwnerAggregator(A aggregations) { + protected ServicesOwnerAggregator(A aggregations) { this.aggregations = aggregations; } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/TotalEntitiesAggregator.java b/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/TotalEntitiesAggregator.java index e458401ea0ec..d7d7d121f180 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/TotalEntitiesAggregator.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/TotalEntitiesAggregator.java @@ -8,7 +8,7 @@ public abstract class TotalEntitiesAggregator implements DataInsightAggregatorInterface { private final A aggregations; - public TotalEntitiesAggregator(A aggregations) { + protected TotalEntitiesAggregator(A aggregations) { this.aggregations = aggregations; } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/TotalEntitiesByTierAggregator.java b/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/TotalEntitiesByTierAggregator.java index 0ce0327dfcd3..3aa52e8e8180 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/TotalEntitiesByTierAggregator.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/TotalEntitiesByTierAggregator.java @@ -8,7 +8,7 @@ public abstract class TotalEntitiesByTierAggregator implements DataInsightAggregatorInterface { private final A aggregations; - public TotalEntitiesByTierAggregator(A aggregations) { + protected TotalEntitiesByTierAggregator(A aggregations) { this.aggregations = aggregations; } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/UnusedAssetsAggregator.java b/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/UnusedAssetsAggregator.java index 8734611a3367..4170c2542d75 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/UnusedAssetsAggregator.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/UnusedAssetsAggregator.java @@ -14,7 +14,7 @@ public abstract class UnusedAssetsAggregator, S, T> implements DataInsightAggregatorInterface { private final H hits; - public UnusedAssetsAggregator(H hits) { + protected UnusedAssetsAggregator(H hits) { this.hits = hits; } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/events/scheduled/PipelineServiceStatusJobHandler.java b/openmetadata-service/src/main/java/org/openmetadata/service/events/scheduled/PipelineServiceStatusJobHandler.java index 8385d15b3c6e..f1b3eabf1880 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/events/scheduled/PipelineServiceStatusJobHandler.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/events/scheduled/PipelineServiceStatusJobHandler.java @@ -33,7 +33,7 @@ public class PipelineServiceStatusJobHandler { private final Integer healthCheckInterval; private final Scheduler scheduler = new StdSchedulerFactory().getScheduler(); - private static PipelineServiceStatusJobHandler INSTANCE; + private static PipelineServiceStatusJobHandler instance; private PipelineServiceStatusJobHandler(PipelineServiceClientConfiguration config, String clusterName) throws SchedulerException { @@ -46,15 +46,14 @@ private PipelineServiceStatusJobHandler(PipelineServiceClientConfiguration confi } public static PipelineServiceStatusJobHandler create(PipelineServiceClientConfiguration config, String clusterName) { - if (INSTANCE != null) return INSTANCE; + if (instance != null) return instance; try { - INSTANCE = new PipelineServiceStatusJobHandler(config, clusterName); + instance = new PipelineServiceStatusJobHandler(config, clusterName); } catch (Exception ex) { LOG.error("Failed to initialize the Pipeline Service Status Handler"); } - - return INSTANCE; + return instance; } private JobDetail jobBuilder() { diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/events/subscription/AlertUtil.java b/openmetadata-service/src/main/java/org/openmetadata/service/events/subscription/AlertUtil.java index e1faf1c191cf..908dfb4485a8 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/events/subscription/AlertUtil.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/events/subscription/AlertUtil.java @@ -98,14 +98,14 @@ public static void validateSubscriptionConfig(EventSubscription eventSubscriptio } } - public static T validateExpression(String condition, Class clz) { + public static void validateExpression(String condition, Class clz) { if (condition == null) { - return null; + return; } Expression expression = parseExpression(condition); AlertsRuleEvaluator ruleEvaluator = new AlertsRuleEvaluator(null); try { - return expression.getValue(ruleEvaluator, clz); + expression.getValue(ruleEvaluator, clz); } catch (Exception exception) { // Remove unnecessary class details in the exception message String message = exception.getMessage().replaceAll("on type .*$", "").replaceAll("on object .*$", ""); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/events/subscription/SubscriptionPublisher.java b/openmetadata-service/src/main/java/org/openmetadata/service/events/subscription/SubscriptionPublisher.java index 9f85dcf5d0aa..d85c6624e85f 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/events/subscription/SubscriptionPublisher.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/events/subscription/SubscriptionPublisher.java @@ -82,19 +82,17 @@ public synchronized void setAwaitingRetry(Long attemptTime, int statusCode, Stri setStatus(AWAITING_RETRY, attemptTime, statusCode, reason, attemptTime + currentBackoffTime); } - public synchronized SubscriptionStatus setSuccessStatus(Long updateTime) { + public synchronized void setSuccessStatus(Long updateTime) { SubscriptionStatus subStatus = AlertUtil.buildSubscriptionStatus(ACTIVE, updateTime, null, null, null, updateTime, updateTime); eventSubscription.setStatusDetails(subStatus); - return subStatus; } - protected synchronized SubscriptionStatus setStatus( + protected synchronized void setStatus( SubscriptionStatus.Status status, Long attemptTime, Integer statusCode, String reason, Long timestamp) { SubscriptionStatus subStatus = AlertUtil.buildSubscriptionStatus(status, null, attemptTime, statusCode, reason, timestamp, attemptTime); eventSubscription.setStatusDetails(subStatus); - return subStatus; } public void awaitShutdown() throws InterruptedException { diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/exception/AlertRetriableException.java b/openmetadata-service/src/main/java/org/openmetadata/service/exception/AlertRetriableException.java deleted file mode 100644 index ce64ceb1e9b9..000000000000 --- a/openmetadata-service/src/main/java/org/openmetadata/service/exception/AlertRetriableException.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.openmetadata.service.exception; - -import org.openmetadata.service.events.errors.RetriableException; - -public class AlertRetriableException extends RetriableException { - private static final long serialVersionUID = 1L; - - public AlertRetriableException(String message) { - super(message); - } - - public AlertRetriableException(Throwable cause) { - super(cause); - } -} diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/AppMarketPlaceRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/AppMarketPlaceRepository.java index e5e197d5b6a9..4405ebbf64eb 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/AppMarketPlaceRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/AppMarketPlaceRepository.java @@ -20,13 +20,13 @@ public AppMarketPlaceRepository() { } @Override - public AppMarketPlaceDefinition setFields(AppMarketPlaceDefinition entity, EntityUtil.Fields fields) { - return entity; + public void setFields(AppMarketPlaceDefinition entity, EntityUtil.Fields fields) { + /* Nothing to do */ } @Override - public AppMarketPlaceDefinition clearFields(AppMarketPlaceDefinition entity, EntityUtil.Fields fields) { - return entity; + public void clearFields(AppMarketPlaceDefinition entity, EntityUtil.Fields fields) { + /* Nothing to do */ } @Override diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/AppRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/AppRepository.java index 94b6b0fe6c7a..8ea7ee102be0 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/AppRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/AppRepository.java @@ -1,6 +1,5 @@ package org.openmetadata.service.jdbi3; -import static org.openmetadata.schema.type.Include.ALL; import static org.openmetadata.service.resources.teams.UserResource.getUser; import java.util.ArrayList; @@ -29,7 +28,7 @@ @Slf4j public class AppRepository extends EntityRepository { - public static String APP_BOT_ROLE = "ApplicationBotRole"; + public static final String APP_BOT_ROLE = "ApplicationBotRole"; public static final String UPDATE_FIELDS = "appConfiguration,appSchedule"; @@ -46,21 +45,14 @@ public AppRepository() { } @Override - public App setFields(App entity, EntityUtil.Fields fields) { + public void setFields(App entity, EntityUtil.Fields fields) { entity.setPipelines(fields.contains("pipelines") ? getIngestionPipelines(entity) : entity.getPipelines()); - return entity.withBot(getBotUser(entity)); + entity.withBot(getBotUser(entity)); } @Override protected List getIngestionPipelines(App service) { - List pipelines = - findToRecords(service.getId(), entityType, Relationship.HAS, Entity.INGESTION_PIPELINE); - List ingestionPipelines = new ArrayList<>(); - for (CollectionDAO.EntityRelationshipRecord entityRelationshipRecord : pipelines) { - ingestionPipelines.add( - Entity.getEntityReferenceById(Entity.INGESTION_PIPELINE, entityRelationshipRecord.getId(), ALL)); - } - return ingestionPipelines; + return findTo(service.getId(), entityType, Relationship.HAS, Entity.INGESTION_PIPELINE); } public AppMarketPlaceRepository getMarketPlace() { @@ -68,8 +60,8 @@ public AppMarketPlaceRepository getMarketPlace() { } @Override - public App clearFields(App entity, EntityUtil.Fields fields) { - return entity; + public void clearFields(App entity, EntityUtil.Fields fields) { + /* Nothing to do */ } @Override @@ -199,8 +191,7 @@ public ResultList listAppRuns(UUID appId, int limitParam, int offs protected void cleanup(App app) { // Remove the Pipelines for Application List pipelineRef = getIngestionPipelines(app); - pipelineRef.forEach( - (reference) -> Entity.deleteEntity("admin", reference.getType(), reference.getId(), true, true)); + pipelineRef.forEach(reference -> Entity.deleteEntity("admin", reference.getType(), reference.getId(), true, true)); super.cleanup(app); } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/BotRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/BotRepository.java index 192f64a11f6e..8e258cb784c3 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/BotRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/BotRepository.java @@ -35,13 +35,13 @@ public BotRepository() { } @Override - public Bot setFields(Bot entity, Fields fields) { - return entity.withBotUser(getBotUser(entity)); + public void setFields(Bot entity, Fields fields) { + entity.withBotUser(getBotUser(entity)); } @Override - public Bot clearFields(Bot entity, Fields fields) { - return entity; + public void clearFields(Bot entity, Fields fields) { + /* Do nothing */ } @Override diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ChartRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ChartRepository.java index cc68e5d29fb4..1ccae2abe390 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ChartRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ChartRepository.java @@ -63,13 +63,13 @@ public void storeRelationships(Chart chart) { } @Override - public Chart setFields(Chart chart, Fields fields) { - return chart.withService(getContainer(chart.getId())); + public void setFields(Chart chart, Fields fields) { + chart.withService(getContainer(chart.getId())); } @Override - public Chart clearFields(Chart chart, Fields fields) { - return chart; // Nothing to do + public void clearFields(Chart chart, Fields fields) { + /* Nothing to do */ } @Override diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ClassificationRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ClassificationRepository.java index 34c8dc20f3c7..4e35e4fcee7a 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ClassificationRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ClassificationRepository.java @@ -57,15 +57,15 @@ public EntityUpdater getUpdater(Classification original, Classification updated, } @Override - public Classification setFields(Classification classification, Fields fields) { + public void setFields(Classification classification, Fields fields) { classification.withTermCount(fields.contains("termCount") ? getTermCount(classification) : null); - return classification.withUsageCount(fields.contains("usageCount") ? getUsageCount(classification) : null); + classification.withUsageCount(fields.contains("usageCount") ? getUsageCount(classification) : null); } @Override - public Classification clearFields(Classification classification, Fields fields) { + public void clearFields(Classification classification, Fields fields) { classification.withTermCount(fields.contains("termCount") ? classification.getTermCount() : null); - return classification.withUsageCount(fields.contains("usageCount") ? classification.getUsageCount() : null); + classification.withUsageCount(fields.contains("usageCount") ? classification.getUsageCount() : null); } @Override diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/CollectionDAO.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/CollectionDAO.java index f7505425d0ee..4e9ba20d12c1 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/CollectionDAO.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/CollectionDAO.java @@ -489,7 +489,7 @@ default List listBefore(ListFilter filter, int limit, String before) { } String sqlCondition = String.format("%s AND er.toId is NULL", condition); - return listBefore(getTableName(), getNameColumn(), sqlCondition, limit, before); + return listBefore(getTableName(), sqlCondition, limit, before); } @Override @@ -503,7 +503,7 @@ default List listAfter(ListFilter filter, int limit, String after) { String sqlCondition = String.format("%s AND er.toId is NULL", condition); - return listAfter(getTableName(), getNameColumn(), sqlCondition, limit, after); + return listAfter(getTableName(), sqlCondition, limit, after); } @Override @@ -516,26 +516,25 @@ default int listCount(ListFilter filter) { } String sqlCondition = String.format("%s AND er.toId is NULL", condition); - return listCount(getTableName(), getNameColumn(), sqlCondition); + return listCount(getTableName(), sqlCondition); } @SqlQuery( value = "SELECT json FROM (" - + "SELECT , ce.json FROM ce " + + "SELECT name, ce.json FROM
ce " + "LEFT JOIN (" + " SELECT toId FROM entity_relationship " + " WHERE fromEntity = 'container' AND toEntity = 'container' AND relation = 0 " + ") er " + "on ce.id = er.toId " + " AND " - + " < :before " - + "ORDER BY DESC " + + "name < :before " + + "ORDER BY name DESC " + "LIMIT :limit" - + ") last_rows_subquery ORDER BY ") + + ") last_rows_subquery ORDER BY name") List listBefore( @Define("table") String table, - @Define("nameColumn") String nameColumn, @Define("sqlCondition") String sqlCondition, @Bind("limit") int limit, @Bind("before") String before); @@ -549,12 +548,11 @@ List listBefore( + ") er " + "on ce.id = er.toId " + " AND " - + " > :after " - + "ORDER BY " + + "name > :after " + + "ORDER BY name " + "LIMIT :limit") List listAfter( @Define("table") String table, - @Define("nameColumn") String nameColumn, @Define("sqlCondition") String sqlCondition, @Bind("limit") int limit, @Bind("after") String after); @@ -568,10 +566,7 @@ List listAfter( + ") er " + "on ce.id = er.toId " + "") - int listCount( - @Define("table") String table, - @Define("nameColumn") String nameColumn, - @Define("sqlCondition") String mysqlCond); + int listCount(@Define("table") String table, @Define("sqlCondition") String mysqlCond); } interface SearchServiceDAO extends EntityDAO { @@ -776,8 +771,7 @@ void bulkInsertTo( // @SqlQuery( "SELECT toId, toEntity, json FROM entity_relationship " - + "WHERE fromId = :fromId AND fromEntity = :fromEntity AND relation IN () " - + "ORDER BY toId") + + "WHERE fromId = :fromId AND fromEntity = :fromEntity AND relation IN ()") @RegisterRowMapper(ToRelationshipMapper.class) List findTo( @BindUUID("fromId") UUID fromId, @@ -788,11 +782,9 @@ default List findTo(UUID fromId, String fromEntity, in return findTo(fromId, fromEntity, List.of(relation)); } - // TODO delete this @SqlQuery( "SELECT toId, toEntity, json FROM entity_relationship " - + "WHERE fromId = :fromId AND fromEntity = :fromEntity AND relation = :relation AND toEntity = :toEntity " - + "ORDER BY toId") + + "WHERE fromId = :fromId AND fromEntity = :fromEntity AND relation = :relation AND toEntity = :toEntity") @RegisterRowMapper(ToRelationshipMapper.class) List findTo( @BindUUID("fromId") UUID fromId, @@ -820,8 +812,7 @@ List findTo( // @SqlQuery( "SELECT fromId, fromEntity, json FROM entity_relationship " - + "WHERE toId = :toId AND toEntity = :toEntity AND relation = :relation AND fromEntity = :fromEntity " - + "ORDER BY fromId") + + "WHERE toId = :toId AND toEntity = :toEntity AND relation = :relation AND fromEntity = :fromEntity ") @RegisterRowMapper(FromRelationshipMapper.class) List findFrom( @BindUUID("toId") UUID toId, @@ -831,8 +822,7 @@ List findFrom( @SqlQuery( "SELECT fromId, fromEntity, json FROM entity_relationship " - + "WHERE toId = :toId AND toEntity = :toEntity AND relation = :relation " - + "ORDER BY fromId") + + "WHERE toId = :toId AND toEntity = :toEntity AND relation = :relation") @RegisterRowMapper(FromRelationshipMapper.class) List findFrom( @BindUUID("toId") UUID toId, @Bind("toEntity") String toEntity, @Bind("relation") int relation); @@ -852,7 +842,7 @@ List findFrom( @RegisterRowMapper(FromRelationshipMapper.class) List findFromPipeline(@BindUUID("toId") UUID toId, @Bind("relation") int relation); - @SqlQuery("SELECT count(*) FROM entity_relationship " + "WHERE fromEntity = :fromEntity AND toEntity = :toEntity") + @SqlQuery("SELECT count(*) FROM entity_relationship WHERE fromEntity = :fromEntity AND toEntity = :toEntity") int findIfAnyRelationExist(@Bind("fromEntity") String fromEntity, @Bind("toEntity") String toEntity); // @@ -1865,11 +1855,11 @@ default int listCount(ListFilter filter) { mySqlCondition = String.format("%s %s", mySqlCondition, filter.getCondition(getTableName())); postgresCondition = String.format("%s %s", postgresCondition, filter.getCondition(getTableName())); - return listCount(getTableName(), getNameColumn(), mySqlCondition, postgresCondition); + return listCount(getTableName(), mySqlCondition, postgresCondition); } String condition = filter.getCondition(getTableName()); - return listCount(getTableName(), getNameColumn(), condition, condition); + return listCount(getTableName(), condition, condition); } @Override @@ -1885,10 +1875,10 @@ default List listBefore(ListFilter filter, int limit, String before) { mySqlCondition = String.format("%s %s", mySqlCondition, filter.getCondition(getTableName())); postgresCondition = String.format("%s %s", postgresCondition, filter.getCondition(getTableName())); - return listBefore(getTableName(), getNameColumn(), mySqlCondition, postgresCondition, limit, before); + return listBefore(getTableName(), mySqlCondition, postgresCondition, limit, before); } String condition = filter.getCondition(getTableName()); - return listBefore(getTableName(), getNameColumn(), condition, condition, limit, before); + return listBefore(getTableName(), condition, condition, limit, before); } @Override @@ -1904,10 +1894,10 @@ default List listAfter(ListFilter filter, int limit, String after) { mySqlCondition = String.format("%s %s", mySqlCondition, filter.getCondition(getTableName())); postgresCondition = String.format("%s %s", postgresCondition, filter.getCondition(getTableName())); - return listAfter(getTableName(), getNameColumn(), mySqlCondition, postgresCondition, limit, after); + return listAfter(getTableName(), mySqlCondition, postgresCondition, limit, after); } String condition = filter.getCondition(getTableName()); - return listAfter(getTableName(), getNameColumn(), condition, condition, limit, after); + return listAfter(getTableName(), condition, condition, limit, after); } } @@ -2102,7 +2092,7 @@ default int listCount(ListFilter filter) { mySqlCondition = String.format("%s %s", mySqlCondition, filter.getCondition("tag")); postgresCondition = String.format("%s %s", postgresCondition, filter.getCondition("tag")); - return listCount(getTableName(), getNameColumn(), mySqlCondition, postgresCondition); + return listCount(getTableName(), mySqlCondition, postgresCondition); } @Override @@ -2140,7 +2130,7 @@ default List listBefore(ListFilter filter, int limit, String before) { mySqlCondition = String.format("%s %s", mySqlCondition, filter.getCondition("tag")); postgresCondition = String.format("%s %s", postgresCondition, filter.getCondition("tag")); - return listBefore(getTableName(), getNameColumn(), mySqlCondition, postgresCondition, limit, before); + return listBefore(getTableName(), mySqlCondition, postgresCondition, limit, before); } @Override @@ -2177,7 +2167,7 @@ default List listAfter(ListFilter filter, int limit, String after) { mySqlCondition = String.format("%s %s", mySqlCondition, filter.getCondition("tag")); postgresCondition = String.format("%s %s", postgresCondition, filter.getCondition("tag")); - return listAfter(getTableName(), getNameColumn(), mySqlCondition, postgresCondition, limit, after); + return listAfter(getTableName(), mySqlCondition, postgresCondition, limit, after); } } @@ -2199,9 +2189,6 @@ void applyTag( @Bind("labelType") int labelType, @Bind("state") int state); - @SqlQuery("SELECT targetFQNHash FROM tag_usage WHERE source = :source AND tagFQNHash = :tagFQNHash") - List getTargetFQNs(@Bind("source") int source, @BindFQN("tagFQNHash") String tagFQNHash); - default List getTags(String targetFQN) { List tags = getTagsInternal(targetFQN); tags.forEach(TagLabelUtil::applyTagCommonFields); @@ -2515,7 +2502,7 @@ default int listCount(ListFilter filter) { String.format("%s AND ((json#>'{isJoinable}')::boolean) = %s ", postgresCondition, isJoinable); } - return listCount(getTableName(), getNameColumn(), mySqlCondition, postgresCondition); + return listCount(getTableName(), mySqlCondition, postgresCondition); } @Override @@ -2548,8 +2535,8 @@ default List listBefore(ListFilter filter, int limit, String before) { } // Quoted name is stored in fullyQualifiedName column and not in the name column - before = getNameColumn().equals("name") ? FullyQualifiedName.unquoteName(before) : before; - return listBefore(getTableName(), getNameColumn(), mySqlCondition, postgresCondition, limit, before); + before = FullyQualifiedName.unquoteName(before); + return listBefore(getTableName(), mySqlCondition, postgresCondition, limit, before); } @Override @@ -2582,8 +2569,8 @@ default List listAfter(ListFilter filter, int limit, String after) { } // Quoted name is stored in fullyQualifiedName column and not in the name column - after = getNameColumn().equals("name") ? FullyQualifiedName.unquoteName(after) : after; - return listAfter(getTableName(), getNameColumn(), mySqlCondition, postgresCondition, limit, after); + after = FullyQualifiedName.unquoteName(after); + return listAfter(getTableName(), mySqlCondition, postgresCondition, limit, after); } default List listTeamsUnderOrganization(UUID teamId) { @@ -2804,8 +2791,7 @@ default int listCount(ListFilter filter) { if (team == null && isAdminStr == null && isBotStr == null) { return EntityDAO.super.listCount(filter); } - return listCount( - getTableName(), getNameColumn(), mySqlCondition, postgresCondition, team, Relationship.HAS.ordinal()); + return listCount(getTableName(), mySqlCondition, postgresCondition, team, Relationship.HAS.ordinal()); } @Override @@ -2850,14 +2836,7 @@ default List listBefore(ListFilter filter, int limit, String before) { return EntityDAO.super.listBefore(filter, limit, before); } return listBefore( - getTableName(), - getNameColumn(), - mySqlCondition, - postgresCondition, - team, - limit, - before, - Relationship.HAS.ordinal()); + getTableName(), mySqlCondition, postgresCondition, team, limit, before, Relationship.HAS.ordinal()); } @Override @@ -2902,14 +2881,7 @@ default List listAfter(ListFilter filter, int limit, String after) { return EntityDAO.super.listAfter(filter, limit, after); } return listAfter( - getTableName(), - getNameColumn(), - mySqlCondition, - postgresCondition, - team, - limit, - after, - Relationship.HAS.ordinal()); + getTableName(), mySqlCondition, postgresCondition, team, limit, after, Relationship.HAS.ordinal()); } @ConnectionAwareSqlQuery( @@ -2936,7 +2908,6 @@ default List listAfter(ListFilter filter, int limit, String after) { connectionType = POSTGRES) int listCount( @Define("table") String table, - @Define("nameColumn") String nameColumn, @Define("mysqlCond") String mysqlCond, @Define("postgresCond") String postgresCond, @BindFQN("team") String team, @@ -2945,36 +2916,35 @@ int listCount( @ConnectionAwareSqlQuery( value = "SELECT json FROM (" - + "SELECT ue., ue.json " + + "SELECT ue.name, ue.json " + "FROM user_entity ue " + "LEFT JOIN entity_relationship er on ue.id = er.toId " + "LEFT JOIN team_entity te on te.id = er.fromId and er.relation = :relation " + " " + "AND (:team IS NULL OR te.nameHash = :team) " - + "AND ue. < :before " - + "GROUP BY ue., ue.json " - + "ORDER BY ue. DESC " + + "AND ue.name < :before " + + "GROUP BY ue.name, ue.json " + + "ORDER BY ue.name DESC " + "LIMIT :limit" - + ") last_rows_subquery ORDER BY ", + + ") last_rows_subquery ORDER BY name", connectionType = MYSQL) @ConnectionAwareSqlQuery( value = "SELECT json FROM (" - + "SELECT ue., ue.json " + + "SELECT ue.name, ue.json " + "FROM user_entity ue " + "LEFT JOIN entity_relationship er on ue.id = er.toId " + "LEFT JOIN team_entity te on te.id = er.fromId and er.relation = :relation " + " " + "AND (:team IS NULL OR te.nameHash = :team) " - + "AND ue. < :before " - + "GROUP BY ue., ue.json " - + "ORDER BY ue. DESC " + + "AND ue.name < :before " + + "GROUP BY ue.name, ue.json " + + "ORDER BY ue.name DESC " + "LIMIT :limit" - + ") last_rows_subquery ORDER BY ", + + ") last_rows_subquery ORDER BY name", connectionType = POSTGRES) List listBefore( @Define("table") String table, - @Define("nameColumn") String nameColumn, @Define("mysqlCond") String mysqlCond, @Define("postgresCond") String postgresCond, @BindFQN("team") String team, @@ -2990,9 +2960,9 @@ List listBefore( + "LEFT JOIN team_entity te on te.id = er.fromId and er.relation = :relation " + " " + "AND (:team IS NULL OR te.nameHash = :team) " - + "AND ue. > :after " - + "GROUP BY ue., ue.json " - + "ORDER BY ue. " + + "AND ue.name > :after " + + "GROUP BY ue.name, ue.json " + + "ORDER BY ue.name " + "LIMIT :limit", connectionType = MYSQL) @ConnectionAwareSqlQuery( @@ -3003,14 +2973,13 @@ List listBefore( + "LEFT JOIN team_entity te on te.id = er.fromId and er.relation = :relation " + " " + "AND (:team IS NULL OR te.nameHash = :team) " - + "AND ue. > :after " - + "GROUP BY ue., ue.json " - + "ORDER BY ue. " + + "AND ue.name > :after " + + "GROUP BY ue.name, ue.json " + + "ORDER BY ue.name " + "LIMIT :limit", connectionType = POSTGRES) List listAfter( @Define("table") String table, - @Define("nameColumn") String nameColumn, @Define("mysqlCond") String mysqlCond, @Define("postgresCond") String postgresCond, @BindFQN("team") String team, @@ -3137,8 +3106,7 @@ default List listBefore(ListFilter filter, int limit, String before) { psqlCondition.append(psqlStr.replace('`', '"')); } - return listBefore( - getTableName(), getNameColumn(), mysqlCondition.toString(), psqlCondition.toString(), limit, before); + return listBefore(getTableName(), mysqlCondition.toString(), psqlCondition.toString(), limit, before); } @Override @@ -3174,8 +3142,7 @@ default List listAfter(ListFilter filter, int limit, String after) { psqlCondition.append(psqlStr.replace('`', '"')); } - return listAfter( - getTableName(), getNameColumn(), mysqlCondition.toString(), psqlCondition.toString(), limit, after); + return listAfter(getTableName(), mysqlCondition.toString(), psqlCondition.toString(), limit, after); } @Override @@ -3210,52 +3177,42 @@ default int listCount(ListFilter filter) { String psqlStr = String.format("AND supported_data_types @> '`%s`' ", supportedDataType); psqlCondition.append(psqlStr.replace('`', '"')); } - return listCount(getTableName(), getNameColumn(), mysqlCondition.toString(), psqlCondition.toString()); + return listCount(getTableName(), mysqlCondition.toString(), psqlCondition.toString()); } @ConnectionAwareSqlQuery( value = "SELECT json FROM (" - + "SELECT , json FROM
AND " - + " < :before " - + "ORDER BY DESC " + + "SELECT name, json FROM
AND " + + "name < :before " + + "ORDER BY name DESC " + "LIMIT :limit" - + ") last_rows_subquery ORDER BY ", + + ") last_rows_subquery ORDER BY name", connectionType = MYSQL) @ConnectionAwareSqlQuery( value = "SELECT json FROM (" - + "SELECT , json FROM
AND " - + " < :before " - + "ORDER BY DESC " + + "SELECT name, json FROM
AND " + + "name < :before " + + "ORDER BY name DESC " + "LIMIT :limit" - + ") last_rows_subquery ORDER BY ", + + ") last_rows_subquery ORDER BY name", connectionType = POSTGRES) List listBefore( @Define("table") String table, - @Define("nameColumn") String nameColumn, @Define("mysqlCond") String mysqlCond, @Define("psqlCond") String psqlCond, @Bind("limit") int limit, @Bind("before") String before); @ConnectionAwareSqlQuery( - value = - "SELECT json FROM
AND " - + " > :after " - + "ORDER BY " - + "LIMIT :limit", + value = "SELECT json FROM
AND name > :after ORDER BY name LIMIT :limit", connectionType = MYSQL) @ConnectionAwareSqlQuery( - value = - "SELECT json FROM
AND " - + " > :after " - + "ORDER BY " - + "LIMIT :limit", + value = "SELECT json FROM
AND name > :after ORDER BY name LIMIT :limit", connectionType = POSTGRES) List listAfter( @Define("table") String table, - @Define("nameColumn") String nameColumn, @Define("mysqlCond") String mysqlCond, @Define("psqlCond") String psqlCond, @Bind("limit") int limit, @@ -3264,10 +3221,7 @@ List listAfter( @ConnectionAwareSqlQuery(value = "SELECT count(*) FROM
", connectionType = MYSQL) @ConnectionAwareSqlQuery(value = "SELECT count(*) FROM
", connectionType = POSTGRES) int listCount( - @Define("table") String table, - @Define("nameColumn") String nameColumn, - @Define("mysqlCond") String mysqlCond, - @Define("psqlCond") String psqlCond); + @Define("table") String table, @Define("mysqlCond") String mysqlCond, @Define("psqlCond") String psqlCond); } interface TestSuiteDAO extends EntityDAO { @@ -3304,11 +3258,11 @@ default String getNameHashColumn() { } default List listBeforeTsOrder(ListFilter filter, int limit, Integer before) { - return listBeforeTsOrdered(getTableName(), getNameColumn(), filter.getCondition(), limit, before); + return listBeforeTsOrdered(getTableName(), filter.getCondition(), limit, before); } default List listAfterTsOrder(ListFilter filter, int limit, Integer after) { - return listAfterTsOrdered(getTableName(), getNameColumn(), filter.getCondition(), limit, after); + return listAfterTsOrdered(getTableName(), filter.getCondition(), limit, after); } default int countOfTestCases(List testCaseIds) { @@ -3337,7 +3291,6 @@ default int countOfTestCases(List testCaseIds) { @RegisterRowMapper(TestCaseRecordMapper.class) List listBeforeTsOrdered( @Define("table") String table, - @Define("nameColumn") String nameColumn, @Define("cond") String cond, @Bind("limit") int limit, @Bind("before") int before); @@ -3360,11 +3313,7 @@ List listBeforeTsOrdered( connectionType = POSTGRES) @RegisterRowMapper(TestCaseRecordMapper.class) List listAfterTsOrdered( - @Define("table") String table, - @Define("nameColumn") String nameColumn, - @Define("cond") String cond, - @Bind("limit") int limit, - @Bind("after") int after); + @Define("table") String table, @Define("cond") String cond, @Bind("limit") int limit, @Bind("after") int after); class TestCaseRecord { @Getter String json; @@ -3427,10 +3376,10 @@ default String getTimeSeriesTableName() { interface AppExtensionTimeSeries { @ConnectionAwareSqlUpdate( - value = "INSERT INTO apps_extension_time_series(json) " + "VALUES (:json)", + value = "INSERT INTO apps_extension_time_series(json) VALUES (:json)", connectionType = MYSQL) @ConnectionAwareSqlUpdate( - value = "INSERT INTO apps_extension_time_series(json) " + "VALUES ((:json :: jsonb))", + value = "INSERT INTO apps_extension_time_series(json) VALUES ((:json :: jsonb))", connectionType = POSTGRES) void insert(@Bind("json") String json); @@ -3808,42 +3757,32 @@ default int listCount(ListFilter filter) { sqlCondition.append(String.format("AND status='%s' ", status)); } - return listCount(getTableName(), getNameHashColumn(), sqlCondition.toString()); + return listCount(getTableName(), sqlCondition.toString()); } @SqlQuery( value = "SELECT json FROM (" - + "SELECT , json FROM
AND " - + " < :before " - + "ORDER BY DESC " + + "SELECT name, json FROM
AND " + + "name < :before " + + "ORDER BY name DESC " + "LIMIT :limit" - + ") last_rows_subquery ORDER BY ") + + ") last_rows_subquery ORDER BY name") List listBefore( @Define("table") String table, - @Define("nameColumn") String nameColumn, @Define("sqlCondition") String sqlCondition, @Bind("limit") int limit, @Bind("before") String before); - @SqlQuery( - value = - "SELECT json FROM
AND " - + " > :after " - + "ORDER BY " - + "LIMIT :limit") + @SqlQuery(value = "SELECT json FROM
AND name > :after ORDER BY name LIMIT :limit") List listAfter( @Define("table") String table, - @Define("nameColumn") String nameColumn, @Define("sqlCondition") String sqlCondition, @Bind("limit") int limit, @Bind("after") String after); @SqlQuery(value = "SELECT count(*) FROM
") - int listCount( - @Define("table") String table, - @Define("nameColumn") String nameColumn, - @Define("sqlCondition") String sqlCondition); + int listCount(@Define("table") String table, @Define("sqlCondition") String sqlCondition); } interface DataModelDAO extends EntityDAO { @@ -3911,8 +3850,7 @@ default List listBefore(ListFilter filter, int limit, String before) { psqlCondition.append(String.format(" AND entityType='%s' ", entityType)); } - return listBefore( - getTableName(), getNameColumn(), mysqlCondition.toString(), psqlCondition.toString(), limit, before); + return listBefore(getTableName(), mysqlCondition.toString(), psqlCondition.toString(), limit, before); } @Override @@ -3941,8 +3879,7 @@ default List listAfter(ListFilter filter, int limit, String after) { psqlCondition.append(String.format(" AND entityType='%s' ", entityType)); } - return listAfter( - getTableName(), getNameColumn(), mysqlCondition.toString(), psqlCondition.toString(), limit, after); + return listAfter(getTableName(), mysqlCondition.toString(), psqlCondition.toString(), limit, after); } @Override @@ -3972,52 +3909,42 @@ default int listCount(ListFilter filter) { psqlCondition.append(String.format(" AND entityType='%s' ", entityType)); } - return listCount(getTableName(), getNameColumn(), mysqlCondition.toString(), psqlCondition.toString()); + return listCount(getTableName(), mysqlCondition.toString(), psqlCondition.toString()); } @ConnectionAwareSqlQuery( value = "SELECT json FROM (" - + "SELECT , json FROM
AND " - + " < :before " - + "ORDER BY DESC " + + "SELECT name, json FROM
AND " + + "name < :before " + + "ORDER BY name DESC " + "LIMIT :limit" - + ") last_rows_subquery ORDER BY ", + + ") last_rows_subquery ORDER BY name", connectionType = MYSQL) @ConnectionAwareSqlQuery( value = "SELECT json FROM (" - + "SELECT , json FROM
AND " - + " < :before " - + "ORDER BY DESC " + + "SELECT name, json FROM
AND " + + "name < :before " + + "ORDER BY name DESC " + "LIMIT :limit" - + ") last_rows_subquery ORDER BY ", + + ") last_rows_subquery ORDER BY name", connectionType = POSTGRES) List listBefore( @Define("table") String table, - @Define("nameColumn") String nameColumn, @Define("mysqlCond") String mysqlCond, @Define("psqlCond") String psqlCond, @Bind("limit") int limit, @Bind("before") String before); @ConnectionAwareSqlQuery( - value = - "SELECT json FROM
AND " - + " > :after " - + "ORDER BY " - + "LIMIT :limit", + value = "SELECT json FROM
AND name > :after ORDER BY name LIMIT :limit", connectionType = MYSQL) @ConnectionAwareSqlQuery( - value = - "SELECT json FROM
AND " - + " > :after " - + "ORDER BY " - + "LIMIT :limit", + value = "SELECT json FROM
AND name > :after ORDER BY name LIMIT :limit", connectionType = POSTGRES) List listAfter( @Define("table") String table, - @Define("nameColumn") String nameColumn, @Define("mysqlCond") String mysqlCond, @Define("psqlCond") String psqlCond, @Bind("limit") int limit, @@ -4026,9 +3953,6 @@ List listAfter( @ConnectionAwareSqlQuery(value = "SELECT count(*) FROM
", connectionType = MYSQL) @ConnectionAwareSqlQuery(value = "SELECT count(*) FROM
", connectionType = POSTGRES) int listCount( - @Define("table") String table, - @Define("nameColumn") String nameColumn, - @Define("mysqlCond") String mysqlCond, - @Define("psqlCond") String psqlCond); + @Define("table") String table, @Define("mysqlCond") String mysqlCond, @Define("psqlCond") String psqlCond); } } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ContainerRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ContainerRepository.java index 01b5af4d5839..7ced08dbe106 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ContainerRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ContainerRepository.java @@ -50,20 +50,19 @@ public ContainerRepository() { } @Override - public Container setFields(Container container, EntityUtil.Fields fields) { + public void setFields(Container container, EntityUtil.Fields fields) { setDefaultFields(container); container.setParent(fields.contains(FIELD_PARENT) ? getParent(container) : container.getParent()); if (container.getDataModel() != null) { populateDataModelColumnTags( fields.contains(FIELD_TAGS), container.getFullyQualifiedName(), container.getDataModel().getColumns()); } - return container; } @Override - public Container clearFields(Container container, EntityUtil.Fields fields) { + public void clearFields(Container container, EntityUtil.Fields fields) { container.setParent(fields.contains(FIELD_PARENT) ? container.getParent() : null); - return container.withDataModel(fields.contains("dataModel") ? container.getDataModel() : null); + container.withDataModel(fields.contains("dataModel") ? container.getDataModel() : null); } private void populateDataModelColumnTags(boolean setTags, String fqnPrefix, List columns) { diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/DashboardDataModelRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/DashboardDataModelRepository.java index 9838dc9d2146..38e1dbd61654 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/DashboardDataModelRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/DashboardDataModelRepository.java @@ -151,7 +151,7 @@ public void storeRelationships(DashboardDataModel dashboardDataModel) { } @Override - public DashboardDataModel setFields(DashboardDataModel dashboardDataModel, Fields fields) { + public void setFields(DashboardDataModel dashboardDataModel, Fields fields) { populateEntityFieldTags( entityType, dashboardDataModel.getColumns(), @@ -160,12 +160,11 @@ public DashboardDataModel setFields(DashboardDataModel dashboardDataModel, Field if (dashboardDataModel.getService() == null) { dashboardDataModel.withService(getContainer(dashboardDataModel.getId())); } - return dashboardDataModel; } @Override - public DashboardDataModel clearFields(DashboardDataModel dashboardDataModel, Fields fields) { - return dashboardDataModel; // Nothing to do + public void clearFields(DashboardDataModel dashboardDataModel, Fields fields) { + /* Nothing to do */ } @Override diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/DashboardRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/DashboardRepository.java index 547fdab1ae36..9acf71656de5 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/DashboardRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/DashboardRepository.java @@ -94,7 +94,7 @@ static class ChartDescriptionTaskWorkflow extends DescriptionTaskWorkflow { } @Override - public Dashboard setFields(Dashboard dashboard, Fields fields) { + public void setFields(Dashboard dashboard, Fields fields) { dashboard.setService(getContainer(dashboard.getId())); dashboard.setCharts(fields.contains("charts") ? getRelatedEntities(dashboard, Entity.CHART) : null); dashboard.setDataModels( @@ -105,14 +105,13 @@ public Dashboard setFields(Dashboard dashboard, Fields fields) { ? EntityUtil.getLatestUsage(daoCollection.usageDAO(), dashboard.getId()) : null); } - return dashboard; } @Override - public Dashboard clearFields(Dashboard dashboard, Fields fields) { + public void clearFields(Dashboard dashboard, Fields fields) { dashboard.setCharts(fields.contains("charts") ? dashboard.getCharts() : null); dashboard.setDataModels(fields.contains("dataModels") ? dashboard.getDataModels() : null); - return dashboard.withUsageSummary(fields.contains("usageSummary") ? dashboard.getUsageSummary() : null); + dashboard.withUsageSummary(fields.contains("usageSummary") ? dashboard.getUsageSummary() : null); } @Override diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/DataInsightChartRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/DataInsightChartRepository.java index aedc5b045fc1..8a234e1f0cc3 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/DataInsightChartRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/DataInsightChartRepository.java @@ -75,13 +75,13 @@ public DataInsightChartRepository() { } @Override - public DataInsightChart setFields(DataInsightChart entity, EntityUtil.Fields fields) { - return entity; + public void setFields(DataInsightChart entity, EntityUtil.Fields fields) { + /* Nothing to do */ } @Override - public DataInsightChart clearFields(DataInsightChart entity, EntityUtil.Fields fields) { - return entity; + public void clearFields(DataInsightChart entity, EntityUtil.Fields fields) { + /* Nothing to do */ } @Override diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/DataProductRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/DataProductRepository.java index 3d34b64c4598..6e44f76324aa 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/DataProductRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/DataProductRepository.java @@ -50,13 +50,13 @@ public DataProductRepository() { } @Override - public DataProduct setFields(DataProduct entity, Fields fields) { - return entity.withAssets(fields.contains(FIELD_ASSETS) ? getAssets(entity) : null); + public void setFields(DataProduct entity, Fields fields) { + entity.withAssets(fields.contains(FIELD_ASSETS) ? getAssets(entity) : null); } @Override - public DataProduct clearFields(DataProduct entity, Fields fields) { - return entity.withAssets(fields.contains(FIELD_ASSETS) ? entity.getAssets() : null); + public void clearFields(DataProduct entity, Fields fields) { + entity.withAssets(fields.contains(FIELD_ASSETS) ? entity.getAssets() : null); } private List getAssets(DataProduct entity) { diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/DatabaseRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/DatabaseRepository.java index 77a726173e78..ccedb2d4e418 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/DatabaseRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/DatabaseRepository.java @@ -85,7 +85,7 @@ public EntityInterface getParentEntity(Database entity, String fields) { return Entity.getEntity(entity.getService(), fields, Include.ALL); } - public Database setFields(Database database, Fields fields) { + public void setFields(Database database, Fields fields) { database.setService(getContainer(database.getId())); database.setDatabaseSchemas( fields.contains("databaseSchemas") ? getSchemas(database) : database.getDatabaseSchemas()); @@ -99,14 +99,13 @@ public Database setFields(Database database, Fields fields) { ? EntityUtil.getLatestUsage(daoCollection.usageDAO(), database.getId()) : null); } - return database; } - public Database clearFields(Database database, Fields fields) { + public void clearFields(Database database, Fields fields) { database.setDatabaseSchemas(fields.contains("databaseSchemas") ? database.getDatabaseSchemas() : null); database.setDatabaseProfilerConfig( fields.contains(DATABASE_PROFILER_CONFIG) ? database.getDatabaseProfilerConfig() : null); - return database.withUsageSummary(fields.contains("usageSummary") ? database.getUsageSummary() : null); + database.withUsageSummary(fields.contains("usageSummary") ? database.getUsageSummary() : null); } @Override @@ -129,8 +128,7 @@ private void populateService(Database database) { public Database addDatabaseProfilerConfig(UUID databaseId, DatabaseProfilerConfig databaseProfilerConfig) { // Validate the request content - Database database = dao.findEntityById(databaseId); - + Database database = find(databaseId, Include.NON_DELETED); if (databaseProfilerConfig.getProfileSampleType() != null && databaseProfilerConfig.getProfileSample() != null) { EntityUtil.validateProfileSample( databaseProfilerConfig.getProfileSampleType().toString(), databaseProfilerConfig.getProfileSample()); @@ -155,9 +153,9 @@ public DatabaseProfilerConfig getDatabaseProfilerConfig(Database database) { public Database deleteDatabaseProfilerConfig(UUID databaseId) { // Validate the request content - Database database = dao.findEntityById(databaseId); + Database database = find(databaseId, Include.NON_DELETED); daoCollection.entityExtensionDAO().delete(databaseId, DATABASE_PROFILER_CONFIG_EXTENSION); - setFieldsInternal(database, Fields.EMPTY_FIELDS); + clearFieldsInternal(database, Fields.EMPTY_FIELDS); return database; } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/DatabaseSchemaRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/DatabaseSchemaRepository.java index 41efff8533f0..97856124001c 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/DatabaseSchemaRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/DatabaseSchemaRepository.java @@ -87,22 +87,22 @@ private List getTables(DatabaseSchema schema) { : findTo(schema.getId(), Entity.DATABASE_SCHEMA, Relationship.CONTAINS, Entity.TABLE); } - public DatabaseSchema setFields(DatabaseSchema schema, Fields fields) { + public void setFields(DatabaseSchema schema, Fields fields) { setDefaultFields(schema); schema.setTables(fields.contains("tables") ? getTables(schema) : null); schema.setDatabaseSchemaProfilerConfig( fields.contains(DATABASE_SCHEMA_PROFILER_CONFIG) ? getDatabaseSchemaProfilerConfig(schema) : schema.getDatabaseSchemaProfilerConfig()); - return schema.withUsageSummary( + schema.withUsageSummary( fields.contains("usageSummary") ? EntityUtil.getLatestUsage(daoCollection.usageDAO(), schema.getId()) : null); } - public DatabaseSchema clearFields(DatabaseSchema schema, Fields fields) { + public void clearFields(DatabaseSchema schema, Fields fields) { schema.setTables(fields.contains("tables") ? schema.getTables() : null); schema.setDatabaseSchemaProfilerConfig( fields.contains(DATABASE_SCHEMA_PROFILER_CONFIG) ? schema.getDatabaseSchemaProfilerConfig() : null); - return schema.withUsageSummary(fields.contains("usageSummary") ? schema.getUsageSummary() : null); + schema.withUsageSummary(fields.contains("usageSummary") ? schema.getUsageSummary() : null); } private void setDefaultFields(DatabaseSchema schema) { @@ -163,7 +163,7 @@ public void entitySpecificUpdate() { public DatabaseSchema addDatabaseSchemaProfilerConfig( UUID databaseSchemaId, DatabaseSchemaProfilerConfig databaseSchemaProfilerConfig) { // Validate the request content - DatabaseSchema databaseSchema = dao.findEntityById(databaseSchemaId); + DatabaseSchema databaseSchema = find(databaseSchemaId, Include.NON_DELETED); if (databaseSchemaProfilerConfig.getProfileSampleType() != null && databaseSchemaProfilerConfig.getProfileSample() != null) { @@ -193,7 +193,7 @@ public DatabaseSchemaProfilerConfig getDatabaseSchemaProfilerConfig(DatabaseSche public DatabaseSchema deleteDatabaseSchemaProfilerConfig(UUID databaseSchemaId) { // Validate the request content - DatabaseSchema database = dao.findEntityById(databaseSchemaId); + DatabaseSchema database = find(databaseSchemaId, Include.NON_DELETED); daoCollection.entityExtensionDAO().delete(databaseSchemaId, DATABASE_SCHEMA_PROFILER_CONFIG_EXTENSION); setFieldsInternal(database, Fields.EMPTY_FIELDS); return database; diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/DocumentRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/DocumentRepository.java index 2a0918ec2ab3..24589e7efe97 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/DocumentRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/DocumentRepository.java @@ -19,6 +19,7 @@ import org.jdbi.v3.sqlobject.transaction.Transaction; import org.openmetadata.schema.entities.docStore.Document; import org.openmetadata.service.Entity; +import org.openmetadata.service.jdbi3.EntityRepository.EntityUpdater; import org.openmetadata.service.resources.docstore.DocStoreResource; import org.openmetadata.service.util.EntityUtil.Fields; @@ -44,13 +45,13 @@ public void setFullyQualifiedName(Document doc) { } @Override - public Document setFields(Document document, Fields fields) { - return document; + public void setFields(Document document, Fields fields) { + /* Nothing to do */ } @Override - public Document clearFields(Document document, Fields fields) { - return document; + public void clearFields(Document document, Fields fields) { + /* Nothing to do */ } @Override diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/DomainRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/DomainRepository.java index 009ee5a97880..cc6550e87540 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/DomainRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/DomainRepository.java @@ -45,14 +45,13 @@ public DomainRepository() { } @Override - public Domain setFields(Domain entity, Fields fields) { - return entity.withParent(getParent(entity)); + public void setFields(Domain entity, Fields fields) { + entity.withParent(getParent(entity)); } @Override - public Domain clearFields(Domain entity, Fields fields) { + public void clearFields(Domain entity, Fields fields) { entity.withParent(fields.contains("parent") ? entity.getParent() : null); - return entity; } @Override diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/EntityDAO.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/EntityDAO.java index b44f28356783..97b4fa76c419 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/EntityDAO.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/EntityDAO.java @@ -46,10 +46,6 @@ public interface EntityDAO { Class getEntityClass(); - default String getNameColumn() { - return "name"; - } - default String getNameHashColumn() { return "nameHash"; } @@ -65,7 +61,7 @@ default boolean supportsSoftDelete() { @ConnectionAwareSqlUpdate( value = "INSERT INTO
(, json) VALUES (:nameHashColumnValue, :json :: jsonb)", connectionType = POSTGRES) - int insert( + void insert( @Define("table") String table, @Define("nameHashColumn") String nameHashColumn, @BindFQN("nameHashColumnValue") String nameHashColumnValue, @@ -125,49 +121,47 @@ default void updateFqn(String oldPrefix, String newPrefix) { @SqlQuery("SELECT json FROM
WHERE id = :id ") String findById(@Define("table") String table, @BindUUID("id") UUID id, @Define("cond") String cond); - @SqlQuery("SELECT json FROM
WHERE = :name ") + @SqlQuery("SELECT json FROM
WHERE = :name ") String findByName( @Define("table") String table, - @Define("nameColumn") String nameColumn, + @Define("nameColumnHash") String nameColumn, @BindFQN("name") String name, @Define("cond") String cond); @SqlQuery("SELECT count(*) FROM
") - int listCount(@Define("table") String table, @Define("nameColumn") String nameColumn, @Define("cond") String cond); + int listCount(@Define("table") String table, @Define("cond") String cond); @ConnectionAwareSqlQuery(value = "SELECT count(*) FROM
", connectionType = MYSQL) @ConnectionAwareSqlQuery(value = "SELECT count(*) FROM
", connectionType = POSTGRES) int listCount( @Define("table") String table, - @Define("nameColumn") String nameColumn, @Define("mysqlCond") String mysqlCond, @Define("postgresCond") String postgresCond); @ConnectionAwareSqlQuery( value = "SELECT json FROM (" - + "SELECT
.,
.json FROM
AND " - + "
. < :before " + + "SELECT
.name,
.json FROM
AND " + + "
.name < :before " + // Pagination by entity fullyQualifiedName or name (when entity does not have fqn) - "ORDER BY
. DESC " + "ORDER BY
.name DESC " + // Pagination ordering by entity fullyQualifiedName or name (when entity does not have fqn) "LIMIT :limit" - + ") last_rows_subquery ORDER BY ", + + ") last_rows_subquery ORDER BY name", connectionType = MYSQL) @ConnectionAwareSqlQuery( value = "SELECT json FROM (" - + "SELECT
.,
.json FROM
AND " - + "
. < :before " + + "SELECT
.name,
.json FROM
AND " + + "
.name < :before " + // Pagination by entity fullyQualifiedName or name (when entity does not have fqn) - "ORDER BY
. DESC " + "ORDER BY
.name DESC " + // Pagination ordering by entity fullyQualifiedName or name (when entity does not have fqn) "LIMIT :limit" - + ") last_rows_subquery ORDER BY ", + + ") last_rows_subquery ORDER BY name", connectionType = POSTGRES) List listBefore( @Define("table") String table, - @Define("nameColumn") String nameColumn, @Define("mysqlCond") String mysqlCond, @Define("postgresCond") String postgresCond, @Bind("limit") int limit, @@ -176,49 +170,45 @@ List listBefore( @ConnectionAwareSqlQuery( value = "SELECT
.json FROM
AND " - + "
. > :after " - + "ORDER BY
. " + + "
.name > :after " + + "ORDER BY
.name " + "LIMIT :limit", connectionType = MYSQL) @ConnectionAwareSqlQuery( value = "SELECT
.json FROM
AND " - + "
. > :after " - + "ORDER BY
. " + + "
.name > :after " + + "ORDER BY
.name " + "LIMIT :limit", connectionType = POSTGRES) List listAfter( @Define("table") String table, - @Define("nameColumn") String nameColumn, @Define("mysqlCond") String mysqlCond, @Define("postgresCond") String postgresCond, @Bind("limit") int limit, @Bind("after") String after); @SqlQuery("SELECT count(*) FROM
") - int listTotalCount(@Define("table") String table, @Define("nameColumn") String nameColumn); + int listTotalCount(@Define("table") String table); @SqlQuery( "SELECT json FROM (" - + "SELECT , json FROM
AND " - + " < :before " + + "SELECT name, json FROM
AND " + + "name < :before " + // Pagination by entity fullyQualifiedName or name (when entity does not have fqn) - "ORDER BY DESC " + "ORDER BY name DESC " + // Pagination ordering by entity fullyQualifiedName or name (when entity does not have fqn) "LIMIT :limit" - + ") last_rows_subquery ORDER BY ") + + ") last_rows_subquery ORDER BY name") List listBefore( @Define("table") String table, - @Define("nameColumn") String nameColumn, @Define("cond") String cond, @Bind("limit") int limit, @Bind("before") String before); - @SqlQuery( - "SELECT json FROM
AND " + " > :after " + "ORDER BY " + "LIMIT :limit") + @SqlQuery("SELECT json FROM
AND name > :after ORDER BY name LIMIT :limit") List listAfter( @Define("table") String table, - @Define("nameColumn") String nameColumn, @Define("cond") String cond, @Bind("limit") int limit, @Bind("after") String after); @@ -230,13 +220,9 @@ List listAfter( List migrationListAfterWithOffset( @Define("table") String table, @Define("nameHashColumn") String nameHashColumnName, @Bind("limit") int limit); - @SqlQuery("SELECT json FROM
AND " + "ORDER BY " + "LIMIT :limit " + "OFFSET :offset") + @SqlQuery("SELECT json FROM
AND ORDER BY name LIMIT :limit OFFSET :offset") List listAfter( - @Define("table") String table, - @Define("nameColumn") String nameColumn, - @Define("cond") String cond, - @Bind("limit") int limit, - @Bind("offset") int offset); + @Define("table") String table, @Define("cond") String cond, @Bind("limit") int limit, @Bind("offset") int offset); @SqlQuery("SELECT EXISTS (SELECT * FROM
WHERE id = :id)") boolean exists(@Define("table") String table, @BindUUID("id") UUID id); @@ -324,28 +310,24 @@ default T jsonToEntity(String json, Object identity) { return entity; } - default String findJsonByFqn(String fqn, Include include) { - return findByName(getTableName(), getNameHashColumn(), fqn, getCondition(include)); - } - default int listCount(ListFilter filter) { - return listCount(getTableName(), getNameHashColumn(), filter.getCondition()); + return listCount(getTableName(), filter.getCondition()); } default int listTotalCount() { - return listTotalCount(getTableName(), getNameHashColumn()); + return listTotalCount(getTableName()); } default List listBefore(ListFilter filter, int limit, String before) { // Quoted name is stored in fullyQualifiedName column and not in the name column - before = getNameColumn().equals("name") ? FullyQualifiedName.unquoteName(before) : before; - return listBefore(getTableName(), getNameColumn(), filter.getCondition(), limit, before); + before = FullyQualifiedName.unquoteName(before); + return listBefore(getTableName(), filter.getCondition(), limit, before); } default List listAfter(ListFilter filter, int limit, String after) { // Quoted name is stored in fullyQualifiedName column and not in the name column - after = getNameColumn().equals("name") ? FullyQualifiedName.unquoteName(after) : after; - return listAfter(getTableName(), getNameColumn(), filter.getCondition(), limit, after); + after = FullyQualifiedName.unquoteName(after); + return listAfter(getTableName(), filter.getCondition(), limit, after); } default List listAfterWithOffset(int limit, int offset) { @@ -359,7 +341,7 @@ default List migrationListAfterWithOffset(int limit, String nameHashColu } default List listAfter(ListFilter filter, int limit, int offset) { - return listAfter(getTableName(), getNameHashColumn(), filter.getCondition(), limit, offset); + return listAfter(getTableName(), filter.getCondition(), limit, offset); } default void exists(UUID id) { @@ -376,12 +358,11 @@ default void existsByName(String fqn) { } } - default int delete(UUID id) { + default void delete(UUID id) { int rowsDeleted = delete(getTableName(), id); if (rowsDeleted <= 0) { String entityType = Entity.getEntityTypeFromClass(getEntityClass()); throw EntityNotFoundException.byMessage(entityNotFound(entityType, id)); } - return rowsDeleted; } } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/EntityRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/EntityRepository.java index 35cb3d946894..dc91c7c96c45 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/EntityRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/EntityRepository.java @@ -98,6 +98,7 @@ import org.openmetadata.schema.CreateEntity; import org.openmetadata.schema.EntityInterface; import org.openmetadata.schema.api.VoteRequest; +import org.openmetadata.schema.api.VoteRequest.VoteType; import org.openmetadata.schema.api.feed.ResolveTask; import org.openmetadata.schema.api.teams.CreateTeam; import org.openmetadata.schema.entity.data.Table; @@ -299,13 +300,13 @@ protected EntityRepository( * Set the requested fields in an entity. This is used for requesting specific fields in the object during GET * operations. It is also used during PUT and PATCH operations to set up fields that can be updated. */ - public abstract T setFields(T entity, Fields fields); + public abstract void setFields(T entity, Fields fields); /** * Set the requested fields in an entity. This is used for requesting specific fields in the object during GET * operations. It is also used during PUT and PATCH operations to set up fields that can be updated. */ - public abstract T clearFields(T entity, Fields fields); + public abstract void clearFields(T entity, Fields fields); /** * This method is used for validating an entity to be created during POST, PUT, and PATCH operations and prepare the @@ -421,8 +422,8 @@ public static List getEntitiesFromSeedData(String entityType, String path /** Initialize a given entity if it does not exist. */ @Transaction public void initializeEntity(T entity) { - String existingJson = dao.findJsonByFqn(entity.getFullyQualifiedName(), ALL); - if (existingJson != null) { + T existingEntity = findByNameOrNull(entity.getFullyQualifiedName(), ALL); + if (existingEntity != null) { LOG.info("{} {} is already initialized", entityType, entity.getFullyQualifiedName()); return; } @@ -657,7 +658,7 @@ public T getVersion(UUID id, String version) { return JsonUtils.readValue(json, entityClass); } // If requested the latest version, return it from current version of the entity - T entity = setFieldsInternal(dao.findEntityById(id, ALL), putFields); + T entity = setFieldsInternal(find(id, ALL), putFields); if (entity.getVersion().equals(requestedVersion)) { return entity; } @@ -666,7 +667,7 @@ public T getVersion(UUID id, String version) { } public EntityHistory listVersions(UUID id) { - T latest = setFieldsInternal(dao.findEntityById(id, ALL), putFields); + T latest = setFieldsInternal(find(id, ALL), putFields); String extensionPrefix = EntityUtil.getVersionExtensionPrefix(entityType); List records = daoCollection.entityExtensionDAO().getExtensions(id, extensionPrefix); List oldVersions = new ArrayList<>(); @@ -737,7 +738,7 @@ public T clearFieldsInternal(T entity, Fields fields) { @Transaction public final PutResponse createOrUpdate(UriInfo uriInfo, T updated) { - T original = JsonUtils.readValue(dao.findJsonByFqn(updated.getFullyQualifiedName(), ALL), entityClass); + T original = findByNameOrNull(updated.getFullyQualifiedName(), ALL); if (original == null) { // If an original entity does not exist then create it, else update return new PutResponse<>(Status.CREATED, withHref(uriInfo, createNewEntity(updated)), RestUtil.ENTITY_CREATED); } @@ -779,7 +780,7 @@ public PutResponse update(UriInfo uriInfo, T original, T updated) { @Transaction public final PatchResponse patch(UriInfo uriInfo, UUID id, String user, JsonPatch patch) { // Get all the fields in the original entity that can be updated during PATCH operation - T original = setFieldsInternal(dao.findEntityById(id), patchFields); + T original = setFieldsInternal(find(id, NON_DELETED), patchFields); setInheritedFields(original, patchFields); // Apply JSON patch to the original entity to get the updated entity @@ -804,8 +805,7 @@ public final PatchResponse patch(UriInfo uriInfo, UUID id, String user, JsonP @Transaction public PutResponse addFollower(String updatedBy, UUID entityId, UUID userId) { - // Get entity - T entity = dao.findEntityById(entityId); + T entity = find(entityId, NON_DELETED); // Validate follower User user = daoCollection.userDAO().findEntityById(userId); @@ -838,7 +838,7 @@ public PutResponse addFollower(String updatedBy, UUID entityId, UUID userId) @Transaction public PutResponse updateVote(String updatedBy, UUID entityId, VoteRequest request) { - T originalEntity = dao.findEntityById(entityId); + T originalEntity = find(entityId, NON_DELETED); // Validate User User user = daoCollection.userDAO().findEntityByName(FullyQualifiedName.quoteName(updatedBy)); @@ -851,7 +851,7 @@ public PutResponse updateVote(String updatedBy, UUID entityId, VoteRequest re fieldUpdated(change, FIELD_VOTES, null, request.getUpdatedVoteType()); // Add or Delete relationship - if (request.getUpdatedVoteType() == VoteRequest.VoteType.UN_VOTED) { + if (request.getUpdatedVoteType() == VoteType.UN_VOTED) { deleteRelationship(userId, Entity.USER, entityId, entityType, Relationship.VOTED); } else { addRelationship( @@ -947,14 +947,14 @@ private DeleteResponse delete(String deletedBy, T original, boolean recursive public final DeleteResponse deleteInternalByName( String updatedBy, String name, boolean recursive, boolean hardDelete) { // Validate entity - T entity = dao.findEntityByName(name, ALL); + T entity = findByName(name, ALL); return delete(updatedBy, entity, recursive, hardDelete); } @Transaction public final DeleteResponse deleteInternal(String updatedBy, UUID id, boolean recursive, boolean hardDelete) { // Validate entity - T entity = dao.findEntityById(id, ALL); + T entity = find(id, ALL); return delete(updatedBy, entity, recursive, hardDelete); } @@ -1315,20 +1315,20 @@ protected Votes getVotes(T entity) { if (!supportsVotes || entity == null) { return new Votes(); } - List upVoters = new ArrayList<>(); - List downVoters = new ArrayList<>(); + List upVoterRecords = new ArrayList<>(); + List downVoterRecords = new ArrayList<>(); List records = findFromRecords(entity.getId(), entityType, Relationship.VOTED, Entity.USER); for (EntityRelationshipRecord entityRelationshipRecord : records) { - VoteRequest.VoteType type; - type = JsonUtils.readValue(entityRelationshipRecord.getJson(), VoteRequest.VoteType.class); - EntityReference user = Entity.getEntityReferenceById(Entity.USER, entityRelationshipRecord.getId(), ALL); - if (type == VoteRequest.VoteType.VOTED_UP) { - upVoters.add(user); - } else if (type == VoteRequest.VoteType.VOTED_DOWN) { - downVoters.add(user); + VoteType type = JsonUtils.readValue(entityRelationshipRecord.getJson(), VoteType.class); + if (type == VoteType.VOTED_UP) { + upVoterRecords.add(entityRelationshipRecord); + } else if (type == VoteType.VOTED_DOWN) { + downVoterRecords.add(entityRelationshipRecord); } } + List upVoters = getEntityReferences(upVoterRecords); + List downVoters = getEntityReferences(downVoterRecords); return new Votes() .withUpVotes(upVoters.size()) .withDownVotes(downVoters.size()) @@ -1363,7 +1363,7 @@ public PutResponse restoreEntity(String updatedBy, String entityType, UUID id // Finally set entity deleted flag to false LOG.info("Restoring the {} {}", entityType, id); - T original = dao.findEntityById(id, DELETED); + T original = find(id, DELETED); setFieldsInternal(original, putFields); T updated = JsonUtils.readValue(JsonUtils.pojoToJson(original), entityClass); updated.setUpdatedBy(updatedBy); @@ -1699,14 +1699,7 @@ protected String getCustomPropertyFQN(String entityType, String propertyName) { } protected List getIngestionPipelines(T service) { - List pipelines = - findToRecords(service.getId(), entityType, Relationship.CONTAINS, Entity.INGESTION_PIPELINE); - List ingestionPipelines = new ArrayList<>(); - for (EntityRelationshipRecord entityRelationshipRecord : pipelines) { - ingestionPipelines.add( - Entity.getEntityReferenceById(Entity.INGESTION_PIPELINE, entityRelationshipRecord.getId(), ALL)); - } - return ingestionPipelines; + return findTo(service.getId(), entityType, Relationship.CONTAINS, Entity.INGESTION_PIPELINE); } protected void checkSystemEntityDeletion(T entity) { @@ -1853,7 +1846,7 @@ public class EntityUpdater { protected T previous; protected T original; protected T updated; - protected Operation operation; + protected final Operation operation; protected ChangeDescription changeDescription = null; protected boolean majorVersionChange = false; protected final User updatingUser; diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/EntityTimeSeriesDAO.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/EntityTimeSeriesDAO.java index 7ccfcfc36f25..b5e71d455c11 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/EntityTimeSeriesDAO.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/EntityTimeSeriesDAO.java @@ -120,8 +120,8 @@ default int listCount(String entityFQNHash) { @Deprecated(since = "1.1.1") int listDistinctCount(@Define("table") String table); - default int listDistinctCount() { - return listDistinctCount(getTimeSeriesTableName()); + default void listDistinctCount() { + listDistinctCount(getTimeSeriesTableName()); } @ConnectionAwareSqlQuery( @@ -204,14 +204,14 @@ default List getLatestExtensionByFQNs(List entityFQNHashes, Stri return getLatestExtensionByFQNs(getTimeSeriesTableName(), entityFQNHashes, extension); } - @SqlQuery("SELECT json FROM
WHERE extension = :extension " + "ORDER BY timestamp DESC LIMIT 1") + @SqlQuery("SELECT json FROM
WHERE extension = :extension ORDER BY timestamp DESC LIMIT 1") String getLatestByExtension(@Define("table") String table, @Bind("extension") String extension); default String getLatestByExtension(String extension) { return getLatestByExtension(getTimeSeriesTableName(), extension); } - @SqlQuery("SELECT json FROM
WHERE extension = :extension " + "ORDER BY timestamp DESC") + @SqlQuery("SELECT json FROM
WHERE extension = :extension ORDER BY timestamp DESC") List getAllByExtension(@Define("table") String table, @Bind("extension") String extension); default List getAllByExtension(String extension) { diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/EventSubscriptionRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/EventSubscriptionRepository.java index bf3ef50456e0..0001522b9433 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/EventSubscriptionRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/EventSubscriptionRepository.java @@ -54,16 +54,15 @@ public EventSubscriptionRepository() { } @Override - public EventSubscription setFields(EventSubscription entity, Fields fields) { + public void setFields(EventSubscription entity, Fields fields) { if (entity.getStatusDetails() == null) { entity.withStatusDetails(fields.contains("statusDetails") ? getStatusForEventSubscription(entity.getId()) : null); } - return entity; } @Override - public EventSubscription clearFields(EventSubscription entity, Fields fields) { - return entity.withStatusDetails(fields.contains("statusDetails") ? entity.getStatusDetails() : null); + public void clearFields(EventSubscription entity, Fields fields) { + entity.withStatusDetails(fields.contains("statusDetails") ? entity.getStatusDetails() : null); } @Override diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/FeedRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/FeedRepository.java index c5f0f43512bd..f667e98a78d5 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/FeedRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/FeedRepository.java @@ -217,9 +217,9 @@ public Thread create(Thread thread) { } @Transaction - public Thread create(Thread thread, ChangeEvent event) { + public void create(Thread thread, ChangeEvent event) { ThreadContext threadContext = getThreadContext(thread, event); - return createThread(threadContext); + createThread(threadContext); } @Transaction diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/GlossaryRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/GlossaryRepository.java index e66f6b67efc3..0e0b6f52e1bf 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/GlossaryRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/GlossaryRepository.java @@ -78,15 +78,15 @@ public GlossaryRepository() { } @Override - public Glossary setFields(Glossary glossary, Fields fields) { + public void setFields(Glossary glossary, Fields fields) { glossary.setTermCount(fields.contains("termCount") ? getTermCount(glossary) : glossary.getTermCount()); - return glossary.withUsageCount(fields.contains("usageCount") ? getUsageCount(glossary) : glossary.getUsageCount()); + glossary.withUsageCount(fields.contains("usageCount") ? getUsageCount(glossary) : glossary.getUsageCount()); } @Override - public Glossary clearFields(Glossary glossary, Fields fields) { + public void clearFields(Glossary glossary, Fields fields) { glossary.setTermCount(fields.contains("termCount") ? glossary.getTermCount() : null); - return glossary.withUsageCount(fields.contains("usageCount") ? glossary.getUsageCount() : null); + glossary.withUsageCount(fields.contains("usageCount") ? glossary.getUsageCount() : null); } @Override diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/GlossaryTermRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/GlossaryTermRepository.java index 87e2b66629dd..3d3c4eed9b73 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/GlossaryTermRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/GlossaryTermRepository.java @@ -85,16 +85,16 @@ public GlossaryTermRepository() { } @Override - public GlossaryTerm setFields(GlossaryTerm entity, Fields fields) { + public void setFields(GlossaryTerm entity, Fields fields) { entity.withParent(getParent(entity)).withGlossary(getGlossary(entity)); entity.setRelatedTerms(fields.contains("relatedTerms") ? getRelatedTerms(entity) : entity.getRelatedTerms()); - return entity.withUsageCount(fields.contains("usageCount") ? getUsageCount(entity) : entity.getUsageCount()); + entity.withUsageCount(fields.contains("usageCount") ? getUsageCount(entity) : entity.getUsageCount()); } @Override - public GlossaryTerm clearFields(GlossaryTerm entity, Fields fields) { + public void clearFields(GlossaryTerm entity, Fields fields) { entity.setRelatedTerms(fields.contains("relatedTerms") ? entity.getRelatedTerms() : null); - return entity.withUsageCount(fields.contains("usageCount") ? entity.getUsageCount() : null); + entity.withUsageCount(fields.contains("usageCount") ? entity.getUsageCount() : null); } @Override @@ -244,6 +244,7 @@ protected void postDelete(GlossaryTerm entity) { daoCollection.tagUsageDAO().deleteTagLabels(TagSource.GLOSSARY.ordinal(), entity.getFullyQualifiedName()); } + @Override public TaskWorkflow getTaskWorkflow(ThreadContext threadContext) { validateTaskThread(threadContext); TaskType taskType = threadContext.getThread().getTask().getType(); @@ -338,7 +339,7 @@ private void createApprovalTask(GlossaryTerm entity, List paren new Thread() .withId(UUID.randomUUID()) .withThreadTs(System.currentTimeMillis()) - .withMessage("Approval required for ") // TODO fix this + .withMessage("Approval required for ") .withCreatedBy(entity.getUpdatedBy()) .withAbout(about.getLinkString()) .withType(ThreadType.Task) diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/IngestionPipelineRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/IngestionPipelineRepository.java index 9f5f86632438..9f3f05bc791b 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/IngestionPipelineRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/IngestionPipelineRepository.java @@ -76,16 +76,15 @@ public void setFullyQualifiedName(IngestionPipeline ingestionPipeline) { } @Override - public IngestionPipeline setFields(IngestionPipeline ingestionPipeline, Fields fields) { + public void setFields(IngestionPipeline ingestionPipeline, Fields fields) { if (ingestionPipeline.getService() == null) { ingestionPipeline.withService(getContainer(ingestionPipeline.getId())); } - return ingestionPipeline; } @Override - public IngestionPipeline clearFields(IngestionPipeline ingestionPipeline, Fields fields) { - return ingestionPipeline; + public void clearFields(IngestionPipeline ingestionPipeline, Fields fields) { + /* Nothing to do */ } @Override @@ -97,8 +96,7 @@ public void prepare(IngestionPipeline ingestionPipeline, boolean update) { @Transaction public IngestionPipeline deletePipelineStatus(UUID ingestionPipelineId) { // Validate the request content - IngestionPipeline ingestionPipeline = dao.findEntityById(ingestionPipelineId); - + IngestionPipeline ingestionPipeline = find(ingestionPipelineId, Include.NON_DELETED); daoCollection .entityExtensionTimeSeriesDao() .delete(ingestionPipeline.getFullyQualifiedName(), PIPELINE_STATUS_EXTENSION); @@ -180,7 +178,7 @@ private ChangeDescription addPipelineStatusChangeDescription(Double version, Obj public RestUtil.PutResponse addPipelineStatus(UriInfo uriInfo, String fqn, PipelineStatus pipelineStatus) { // Validate the request content - IngestionPipeline ingestionPipeline = dao.findEntityByName(fqn); + IngestionPipeline ingestionPipeline = findByName(fqn, Include.NON_DELETED); PipelineStatus storedPipelineStatus = JsonUtils.readValue( daoCollection @@ -218,7 +216,7 @@ public RestUtil.PutResponse addPipelineStatus(UriInfo uriInfo, String fqn, Pi } public ResultList listPipelineStatus(String ingestionPipelineFQN, Long startTs, Long endTs) { - IngestionPipeline ingestionPipeline = dao.findEntityByName(ingestionPipelineFQN); + IngestionPipeline ingestionPipeline = findByName(ingestionPipelineFQN, Include.NON_DELETED); List pipelineStatusList = JsonUtils.readObjects( getResultsFromAndToTimestamps( @@ -237,7 +235,7 @@ public PipelineStatus getLatestPipelineStatus(IngestionPipeline ingestionPipelin } public PipelineStatus getPipelineStatus(String ingestionPipelineFQN, UUID pipelineStatusRunId) { - IngestionPipeline ingestionPipeline = dao.findEntityByName(ingestionPipelineFQN); + IngestionPipeline ingestionPipeline = findByName(ingestionPipelineFQN, Include.NON_DELETED); return JsonUtils.readValue( daoCollection .entityExtensionTimeSeriesDao() diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/KpiRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/KpiRepository.java index 2b8f8a14457a..298fca3f3221 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/KpiRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/KpiRepository.java @@ -44,16 +44,16 @@ public KpiRepository() { } @Override - public Kpi setFields(Kpi kpi, EntityUtil.Fields fields) { + public void setFields(Kpi kpi, EntityUtil.Fields fields) { kpi.setDataInsightChart(fields.contains("dataInsightChart") ? getDataInsightChart(kpi) : kpi.getDataInsightChart()); - return kpi.withKpiResult( + kpi.withKpiResult( fields.contains(KPI_RESULT_FIELD) ? getKpiResult(kpi.getFullyQualifiedName()) : kpi.getKpiResult()); } @Override - public Kpi clearFields(Kpi kpi, EntityUtil.Fields fields) { + public void clearFields(Kpi kpi, EntityUtil.Fields fields) { kpi.setDataInsightChart(fields.contains("dataInsightChart") ? kpi.getDataInsightChart() : null); - return kpi.withKpiResult(fields.contains(KPI_RESULT_FIELD) ? kpi.getKpiResult() : null); + kpi.withKpiResult(fields.contains(KPI_RESULT_FIELD) ? kpi.getKpiResult() : null); } @Override @@ -103,18 +103,17 @@ public void storeRelationships(Kpi kpi) { @Transaction public RestUtil.PutResponse addKpiResult(UriInfo uriInfo, String fqn, KpiResult kpiResult) { // Validate the request content - Kpi kpi = dao.findEntityByName(fqn); + Kpi kpi = findByName(fqn, Include.NON_DELETED); storeTimeSeries(kpi.getFullyQualifiedName(), KPI_RESULT_EXTENSION, "kpiResult", JsonUtils.pojoToJson(kpiResult)); ChangeDescription change = addKpiResultChangeDescription(kpi.getVersion(), kpiResult); ChangeEvent changeEvent = getChangeEvent(withHref(uriInfo, kpi), change, entityType, kpi.getVersion()); - return new RestUtil.PutResponse<>(Response.Status.CREATED, changeEvent, RestUtil.ENTITY_FIELDS_CHANGED); } @Transaction public RestUtil.PutResponse deleteKpiResult(String fqn, Long timestamp) { // Validate the request content - Kpi kpi = dao.findEntityByName(fqn); + Kpi kpi = findByName(fqn, Include.NON_DELETED); KpiResult storedKpiResult = JsonUtils.readValue(getExtensionAtTimestamp(fqn, KPI_RESULT_EXTENSION, timestamp), KpiResult.class); if (storedKpiResult != null) { diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ListFilter.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ListFilter.java index 59c0e7873b61..c625693b1a6a 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ListFilter.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ListFilter.java @@ -187,12 +187,12 @@ private String getTestSuiteTypeCondition() { switch (testSuiteType) { case ("executable"): - if (DatasourceConfig.getInstance().isMySQL()) { + if (Boolean.TRUE.equals(DatasourceConfig.getInstance().isMySQL())) { return "(JSON_UNQUOTE(JSON_EXTRACT(json, '$.executable')) = 'true')"; } return "(json->>'executable' = 'true')"; case ("logical"): - if (DatasourceConfig.getInstance().isMySQL()) { + if (Boolean.TRUE.equals(DatasourceConfig.getInstance().isMySQL())) { return "(JSON_UNQUOTE(JSON_EXTRACT(json, '$.executable')) = 'false' OR JSON_UNQUOTE(JSON_EXTRACT(json, '$.executable')) IS NULL)"; } return "(json->>'executable' = 'false' or json -> 'executable' is null)"; @@ -218,7 +218,7 @@ private String getWebhookTypePrefixCondition(String tableName, String typePrefix private String getPipelineTypePrefixCondition(String tableName, String pipelineType) { pipelineType = escape(pipelineType); String inCondition = getInConditionFromString(pipelineType); - if (DatasourceConfig.getInstance().isMySQL()) { + if (Boolean.TRUE.equals(DatasourceConfig.getInstance().isMySQL())) { return tableName == null ? String.format( "JSON_UNQUOTE(JSON_EXTRACT(ingestion_pipeline_entity.json, '$.pipelineType')) IN (%s)", inCondition) diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/MetricsRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/MetricsRepository.java index f37f244843da..52306d68e47c 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/MetricsRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/MetricsRepository.java @@ -38,7 +38,7 @@ public void setFullyQualifiedName(Metrics metrics) { } @Override - public Metrics setFields(Metrics metrics, Fields fields) { + public void setFields(Metrics metrics, Fields fields) { metrics.setService(getContainer(metrics.getId())); // service is a default field if (metrics.getUsageSummary() == null) { metrics.withUsageSummary( @@ -46,12 +46,11 @@ public Metrics setFields(Metrics metrics, Fields fields) { ? EntityUtil.getLatestUsage(daoCollection.usageDAO(), metrics.getId()) : metrics.getUsageSummary()); } - return metrics; } @Override - public Metrics clearFields(Metrics metrics, Fields fields) { - return metrics.withUsageSummary(fields.contains("usageSummary") ? metrics.getUsageSummary() : null); + public void clearFields(Metrics metrics, Fields fields) { + metrics.withUsageSummary(fields.contains("usageSummary") ? metrics.getUsageSummary() : null); } @Override diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/MlModelRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/MlModelRepository.java index adf0cf094767..5cebb786d1e6 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/MlModelRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/MlModelRepository.java @@ -82,7 +82,7 @@ public void setFullyQualifiedName(MlModel mlModel) { } @Override - public MlModel setFields(MlModel mlModel, Fields fields) { + public void setFields(MlModel mlModel, Fields fields) { mlModel.setService(getContainer(mlModel.getId())); mlModel.setDashboard(fields.contains("dashboard") ? getDashboard(mlModel) : mlModel.getDashboard()); if (mlModel.getUsageSummary() == null) { @@ -91,13 +91,12 @@ public MlModel setFields(MlModel mlModel, Fields fields) { ? EntityUtil.getLatestUsage(daoCollection.usageDAO(), mlModel.getId()) : mlModel.getUsageSummary()); } - return mlModel; } @Override - public MlModel clearFields(MlModel mlModel, Fields fields) { + public void clearFields(MlModel mlModel, Fields fields) { mlModel.setDashboard(fields.contains("dashboard") ? mlModel.getDashboard() : null); - return mlModel.withUsageSummary(fields.contains("usageSummary") ? mlModel.getUsageSummary() : null); + mlModel.withUsageSummary(fields.contains("usageSummary") ? mlModel.getUsageSummary() : null); } @Override diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/PersonaRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/PersonaRepository.java index ba1ae3635d4a..b7d9138ccc6c 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/PersonaRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/PersonaRepository.java @@ -45,15 +45,13 @@ public PersonaRepository() { } @Override - public Persona setFields(Persona persona, Fields fields) { + public void setFields(Persona persona, Fields fields) { persona.setUsers(fields.contains(FIELD_USERS) ? getUsers(persona) : persona.getUsers()); - return persona; } @Override - public Persona clearFields(Persona persona, Fields fields) { + public void clearFields(Persona persona, Fields fields) { persona.setUsers(fields.contains(FIELD_USERS) ? persona.getUsers() : null); - return persona; } @Override diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/PipelineRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/PipelineRepository.java index 8ec3d9d5bac7..3852a85daf01 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/PipelineRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/PipelineRepository.java @@ -16,6 +16,7 @@ import static org.openmetadata.common.utils.CommonUtil.listOrEmpty; import static org.openmetadata.common.utils.CommonUtil.nullOrEmpty; import static org.openmetadata.schema.type.Include.ALL; +import static org.openmetadata.schema.type.Include.NON_DELETED; import static org.openmetadata.service.Entity.CONTAINER; import static org.openmetadata.service.Entity.FIELD_TAGS; import static org.openmetadata.service.util.EntityUtil.taskMatch; @@ -125,17 +126,17 @@ public EntityInterface performTask(String user, ResolveTask resolveTask) { } @Override - public Pipeline setFields(Pipeline pipeline, Fields fields) { + public void setFields(Pipeline pipeline, Fields fields) { pipeline.setService(getContainer(pipeline.getId())); getTaskTags(fields.contains(FIELD_TAGS), pipeline.getTasks()); - return pipeline.withPipelineStatus( + pipeline.withPipelineStatus( fields.contains("pipelineStatus") ? getPipelineStatus(pipeline) : pipeline.getPipelineStatus()); } @Override - public Pipeline clearFields(Pipeline pipeline, Fields fields) { + public void clearFields(Pipeline pipeline, Fields fields) { pipeline.withTasks(fields.contains(TASKS_FIELD) ? pipeline.getTasks() : null); - return pipeline.withPipelineStatus(fields.contains("pipelineStatus") ? pipeline.getPipelineStatus() : null); + pipeline.withPipelineStatus(fields.contains("pipelineStatus") ? pipeline.getPipelineStatus() : null); } private PipelineStatus getPipelineStatus(Pipeline pipeline) { @@ -178,7 +179,7 @@ public Pipeline addPipelineStatus(String fqn, PipelineStatus pipelineStatus) { public Pipeline deletePipelineStatus(String fqn, Long timestamp) { // Validate the request content - Pipeline pipeline = dao.findEntityByName(fqn); + Pipeline pipeline = findByName(fqn, NON_DELETED); pipeline.setService(getContainer(pipeline.getId())); PipelineStatus storedPipelineStatus = JsonUtils.readValue(getExtensionAtTimestamp(fqn, PIPELINE_STATUS_EXTENSION, timestamp), PipelineStatus.class); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/PolicyRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/PolicyRepository.java index 373564fa4dc3..840d861e6870 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/PolicyRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/PolicyRepository.java @@ -53,15 +53,15 @@ public PolicyRepository() { } @Override - public Policy setFields(Policy policy, Fields fields) { + public void setFields(Policy policy, Fields fields) { policy.setTeams(fields.contains("teams") ? getTeams(policy) : policy.getTeams()); - return policy.withRoles(fields.contains("roles") ? getRoles(policy) : policy.getRoles()); + policy.withRoles(fields.contains("roles") ? getRoles(policy) : policy.getRoles()); } @Override - public Policy clearFields(Policy policy, Fields fields) { + public void clearFields(Policy policy, Fields fields) { policy.setTeams(fields.contains("teams") ? policy.getTeams() : null); - return policy.withRoles(fields.contains("roles") ? policy.getRoles() : null); + policy.withRoles(fields.contains("roles") ? policy.getRoles() : null); } /* Get all the teams that use this policy */ diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/QueryRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/QueryRepository.java index d513af4c5809..ec3e6fe8edbf 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/QueryRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/QueryRepository.java @@ -50,15 +50,15 @@ public void setFullyQualifiedName(Query query) { } @Override - public Query setFields(Query entity, EntityUtil.Fields fields) { + public void setFields(Query entity, EntityUtil.Fields fields) { entity.setQueryUsedIn(fields.contains(QUERY_USED_IN_FIELD) ? getQueryUsage(entity) : entity.getQueryUsedIn()); - return entity.withUsers(fields.contains("users") ? getQueryUsers(entity) : entity.getUsers()); + entity.withUsers(fields.contains("users") ? getQueryUsers(entity) : entity.getUsers()); } @Override - public Query clearFields(Query entity, EntityUtil.Fields fields) { + public void clearFields(Query entity, EntityUtil.Fields fields) { entity.withQueryUsedIn(fields.contains(QUERY_USED_IN_FIELD) ? entity.getQueryUsedIn() : null); - return entity.withUsers(fields.contains("users") ? this.getQueryUsers(entity) : null); + entity.withUsers(fields.contains("users") ? this.getQueryUsers(entity) : null); } public List getQueryUsage(Query queryEntity) { @@ -128,7 +128,7 @@ private void storeQueryUsedIn( } } - public RestUtil.PutResponse AddQueryUser( + public RestUtil.PutResponse addQueryUser( UriInfo uriInfo, String updatedBy, UUID queryId, List userFqnList) { Query query = Entity.getEntity(Entity.QUERY, queryId, QUERY_USERS_FIELD, Include.NON_DELETED); List oldValue = query.getUsers(); @@ -146,7 +146,7 @@ public RestUtil.PutResponse AddQueryUser( return new RestUtil.PutResponse<>(Response.Status.CREATED, changeEvent, RestUtil.ENTITY_FIELDS_CHANGED); } - public RestUtil.PutResponse AddQueryUsedBy( + public RestUtil.PutResponse addQueryUsedBy( UriInfo uriInfo, String updatedBy, UUID queryId, List userList) { Query query = Entity.getEntity(Entity.QUERY, queryId, QUERY_UPDATE_FIELDS, Include.NON_DELETED); Query oldQuery = JsonUtils.readValue(JsonUtils.pojoToJson(query), Query.class); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ReportDataRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ReportDataRepository.java index 807ecb5cc19a..e13c2953178d 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ReportDataRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ReportDataRepository.java @@ -5,7 +5,6 @@ import org.openmetadata.schema.analytics.ReportData; import org.openmetadata.schema.analytics.ReportData.ReportDataType; import org.openmetadata.service.Entity; -import org.openmetadata.service.search.SearchRepository; import org.openmetadata.service.util.JsonUtils; import org.openmetadata.service.util.ResultList; @@ -13,15 +12,12 @@ public class ReportDataRepository extends EntityTimeSeriesRepository public static final String COLLECTION_PATH = "/v1/analytics/report"; public static final String REPORT_DATA_EXTENSION = "reportData.reportDataResult"; - private final SearchRepository searchRepository; - public ReportDataRepository() { super( COLLECTION_PATH, Entity.getCollectionDAO().reportDataTimeSeriesDao(), ReportData.class, Entity.ENTITY_REPORT_DATA); - searchRepository = Entity.getSearchRepository(); } public ResultList getReportData(ReportDataType reportDataType, Long startTs, Long endTs) { diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ReportRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ReportRepository.java index bed0912356f5..542c3cfc514f 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ReportRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ReportRepository.java @@ -29,7 +29,7 @@ public ReportRepository() { } @Override - public Report setFields(Report report, Fields fields) { + public void setFields(Report report, Fields fields) { report.setService(getService(report)); // service is a default field if (report.getUsageSummary() == null) { report.withUsageSummary( @@ -37,12 +37,11 @@ public Report setFields(Report report, Fields fields) { ? EntityUtil.getLatestUsage(daoCollection.usageDAO(), report.getId()) : report.getUsageSummary()); } - return report; } @Override - public Report clearFields(Report report, Fields fields) { - return report.withUsageSummary(fields.contains("usageSummary") ? report.getUsageSummary() : null); + public void clearFields(Report report, Fields fields) { + report.withUsageSummary(fields.contains("usageSummary") ? report.getUsageSummary() : null); } @Override @@ -62,7 +61,6 @@ public void storeRelationships(Report report) { } private EntityReference getService(Report report) { - // TODO What are the report services? return null; } } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/RoleRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/RoleRepository.java index bbebd06ac065..449b326e6493 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/RoleRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/RoleRepository.java @@ -40,17 +40,17 @@ public RoleRepository() { } @Override - public Role setFields(Role role, Fields fields) { + public void setFields(Role role, Fields fields) { role.setPolicies(fields.contains(POLICIES) ? getPolicies(role) : role.getPolicies()); role.setTeams(fields.contains("teams") ? getTeams(role) : role.getTeams()); - return role.withUsers(fields.contains("users") ? getUsers(role) : role.getUsers()); + role.withUsers(fields.contains("users") ? getUsers(role) : role.getUsers()); } @Override - public Role clearFields(Role role, Fields fields) { + public void clearFields(Role role, Fields fields) { role.setPolicies(fields.contains(POLICIES) ? role.getPolicies() : null); role.setTeams(fields.contains("teams") ? role.getTeams() : null); - return role.withUsers(fields.contains("users") ? role.getUsers() : null); + role.withUsers(fields.contains("users") ? role.getUsers() : null); } private List getPolicies(@NonNull Role role) { diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/SearchIndexRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/SearchIndexRepository.java index 10d034efd800..3b01d8ab9692 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/SearchIndexRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/SearchIndexRepository.java @@ -16,6 +16,7 @@ import static org.openmetadata.common.utils.CommonUtil.listOrEmpty; import static org.openmetadata.common.utils.CommonUtil.nullOrEmpty; import static org.openmetadata.schema.type.Include.ALL; +import static org.openmetadata.schema.type.Include.NON_DELETED; import static org.openmetadata.service.Entity.FIELD_DESCRIPTION; import static org.openmetadata.service.Entity.FIELD_DISPLAY_NAME; import static org.openmetadata.service.Entity.FIELD_FOLLOWERS; @@ -111,18 +112,17 @@ public void storeRelationships(SearchIndex searchIndex) { } @Override - public SearchIndex setFields(SearchIndex searchIndex, Fields fields) { + public void setFields(SearchIndex searchIndex, Fields fields) { searchIndex.setService(getContainer(searchIndex.getId())); searchIndex.setFollowers(fields.contains(FIELD_FOLLOWERS) ? getFollowers(searchIndex) : null); if (searchIndex.getFields() != null) { getFieldTags(fields.contains(FIELD_TAGS), searchIndex.getFields()); } - return searchIndex; } @Override - public SearchIndex clearFields(SearchIndex searchIndex, Fields fields) { - return searchIndex; + public void clearFields(SearchIndex searchIndex, Fields fields) { + /* Nothing to do */ } @Override @@ -140,8 +140,7 @@ public void setService(SearchIndex searchIndex, EntityReference service) { public SearchIndex getSampleData(UUID searchIndexId, boolean authorizePII) { // Validate the request content - SearchIndex searchIndex = dao.findEntityById(searchIndexId); - + SearchIndex searchIndex = find(searchIndexId, NON_DELETED); SearchIndexSampleData sampleData = JsonUtils.readValue( daoCollection.entityExtensionDAO().getExtension(searchIndex.getId(), "searchIndex.sampleData"), @@ -188,19 +187,6 @@ private void getFieldTags(boolean setTags, List fields) { } } - private void addDerivedFieldTags(List fields) { - if (nullOrEmpty(fields)) { - return; - } - - for (SearchIndexField field : fields) { - field.setTags(addDerivedTags(field.getTags())); - if (field.getChildren() != null) { - addDerivedFieldTags(field.getChildren()); - } - } - } - List cloneWithoutTags(List fields) { if (nullOrEmpty(fields)) { return fields; diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ServiceEntityRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ServiceEntityRepository.java index 61319a704150..744abedc4bdc 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ServiceEntityRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ServiceEntityRepository.java @@ -21,6 +21,7 @@ import org.openmetadata.schema.ServiceEntityInterface; import org.openmetadata.schema.entity.services.ServiceType; import org.openmetadata.schema.entity.services.connections.TestConnectionResult; +import org.openmetadata.schema.type.Include; import org.openmetadata.service.secrets.SecretsManager; import org.openmetadata.service.secrets.SecretsManagerFactory; import org.openmetadata.service.util.EntityUtil; @@ -46,17 +47,15 @@ protected ServiceEntityRepository( } @Override - public T setFields(T entity, EntityUtil.Fields fields) { + public void setFields(T entity, EntityUtil.Fields fields) { entity.setPipelines(fields.contains("pipelines") ? getIngestionPipelines(entity) : null); - return entity; } @Override - public T clearFields(T entity, EntityUtil.Fields fields) { + public void clearFields(T entity, EntityUtil.Fields fields) { if (!fields.contains("pipelines")) { entity.setPipelines(null); } - return entity; } @Override @@ -85,7 +84,7 @@ public void storeRelationships(T service) { } public T addTestConnectionResult(UUID serviceId, TestConnectionResult testConnectionResult) { - T service = dao.findEntityById(serviceId); + T service = find(serviceId, Include.NON_DELETED); service.setTestConnectionResult(testConnectionResult); dao.update(serviceId, service.getFullyQualifiedName(), JsonUtils.pojoToJson(service)); return service; diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/StoredProcedureRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/StoredProcedureRepository.java index 9470bda55b35..697cb9033cd1 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/StoredProcedureRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/StoredProcedureRepository.java @@ -77,15 +77,14 @@ public StoredProcedure setInheritedFields(StoredProcedure storedProcedure, Entit } @Override - public StoredProcedure setFields(StoredProcedure storedProcedure, EntityUtil.Fields fields) { + public void setFields(StoredProcedure storedProcedure, EntityUtil.Fields fields) { setDefaultFields(storedProcedure); storedProcedure.setFollowers(fields.contains(FIELD_FOLLOWERS) ? getFollowers(storedProcedure) : null); - return storedProcedure; } @Override - public StoredProcedure clearFields(StoredProcedure storedProcedure, EntityUtil.Fields fields) { - return storedProcedure; + public void clearFields(StoredProcedure storedProcedure, EntityUtil.Fields fields) { + /* Nothing to do */ } private void setDefaultFields(StoredProcedure storedProcedure) { diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TableRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TableRepository.java index 5a4dc9c16baf..6bfaa10ffa71 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TableRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TableRepository.java @@ -15,8 +15,8 @@ import static java.util.stream.Collectors.groupingBy; import static org.openmetadata.common.utils.CommonUtil.listOrEmpty; -import static org.openmetadata.common.utils.CommonUtil.nullOrEmpty; import static org.openmetadata.schema.type.Include.ALL; +import static org.openmetadata.schema.type.Include.NON_DELETED; import static org.openmetadata.service.Entity.DATABASE_SCHEMA; import static org.openmetadata.service.Entity.FIELD_OWNER; import static org.openmetadata.service.Entity.FIELD_TAGS; @@ -121,7 +121,7 @@ public TableRepository() { } @Override - public Table setFields(Table table, Fields fields) { + public void setFields(Table table, Fields fields) { setDefaultFields(table); if (table.getUsageSummary() == null) { table.setUsageSummary( @@ -144,18 +144,16 @@ public Table setFields(Table table, Fields fields) { column.setCustomMetrics(getCustomMetrics(table, column.getName())); } } - return table; } @Override - public Table clearFields(Table table, Fields fields) { + public void clearFields(Table table, Fields fields) { table.setTableConstraints(fields.contains("tableConstraints") ? table.getTableConstraints() : null); table.setUsageSummary(fields.contains("usageSummary") ? table.getUsageSummary() : null); table.setJoins(fields.contains("joins") ? table.getJoins() : null); table.setViewDefinition(fields.contains("viewDefinition") ? table.getViewDefinition() : null); table.setTableProfilerConfig(fields.contains(TABLE_PROFILER_CONFIG) ? table.getTableProfilerConfig() : null); table.setTestSuite(fields.contains("testSuite") ? table.getTestSuite() : null); - return table; } @Override @@ -191,8 +189,7 @@ public void setFullyQualifiedName(Table table) { @Transaction public Table addJoins(UUID tableId, TableJoins joins) { // Validate the request content - Table table = dao.findEntityById(tableId); - + Table table = find(tableId, NON_DELETED); if (!CommonUtil.dateInRange(RestUtil.DATE_FORMAT, joins.getStartDate(), 0, 30)) { throw new IllegalArgumentException("Date range can only include past 30 days starting today"); } @@ -223,7 +220,7 @@ public Table addJoins(UUID tableId, TableJoins joins) { @Transaction public Table addSampleData(UUID tableId, TableData tableData) { // Validate the request content - Table table = dao.findEntityById(tableId); + Table table = find(tableId, NON_DELETED); // Validate all the columns for (String columnName : tableData.getColumns()) { @@ -247,8 +244,7 @@ public Table addSampleData(UUID tableId, TableData tableData) { public Table getSampleData(UUID tableId, boolean authorizePII) { // Validate the request content - Table table = dao.findEntityById(tableId); - + Table table = find(tableId, NON_DELETED); TableData sampleData = JsonUtils.readValue( daoCollection.entityExtensionDAO().getExtension(table.getId(), TABLE_SAMPLE_DATA_EXTENSION), @@ -269,8 +265,7 @@ public Table getSampleData(UUID tableId, boolean authorizePII) { @Transaction public Table deleteSampleData(UUID tableId) { // Validate the request content - Table table = dao.findEntityById(tableId); - + Table table = find(tableId, NON_DELETED); daoCollection.entityExtensionDAO().delete(tableId, TABLE_SAMPLE_DATA_EXTENSION); setFieldsInternal(table, Fields.EMPTY_FIELDS); return table; @@ -299,7 +294,7 @@ public TestSuite getTestSuite(Table table) { @Transaction public Table addTableProfilerConfig(UUID tableId, TableProfilerConfig tableProfilerConfig) { // Validate the request content - Table table = dao.findEntityById(tableId); + Table table = find(tableId, NON_DELETED); // Validate all the columns if (tableProfilerConfig.getExcludeColumns() != null) { @@ -329,9 +324,9 @@ public Table addTableProfilerConfig(UUID tableId, TableProfilerConfig tableProfi @Transaction public Table deleteTableProfilerConfig(UUID tableId) { // Validate the request content - Table table = dao.findEntityById(tableId); + Table table = find(tableId, NON_DELETED); daoCollection.entityExtensionDAO().delete(tableId, TABLE_PROFILER_CONFIG_EXTENSION); - setFieldsInternal(table, Fields.EMPTY_FIELDS); + clearFieldsInternal(table, Fields.EMPTY_FIELDS); return table; } @@ -358,7 +353,7 @@ private Column getColumnNameForProfiler(List columnList, ColumnProfile c public Table addTableProfileData(UUID tableId, CreateTableProfile createTableProfile) { // Validate the request content - Table table = dao.findEntityById(tableId); + Table table = find(tableId, NON_DELETED); daoCollection .profilerDataTimeSeriesDao() .insert( @@ -479,7 +474,7 @@ private void setColumnProfile(List columnList) { } public Table getLatestTableProfile(String fqn, boolean authorizePII) { - Table table = dao.findEntityByName(fqn, ALL); + Table table = findByName(fqn, ALL); TableProfile tableProfile = JsonUtils.readValue( daoCollection @@ -500,7 +495,7 @@ public Table getLatestTableProfile(String fqn, boolean authorizePII) { public Table addCustomMetric(UUID tableId, CustomMetric customMetric) { // Validate the request content - Table table = dao.findEntityById(tableId); + Table table = find(tableId, NON_DELETED); String customMetricName = customMetric.getName(); String customMetricColumnName = customMetric.getColumnName(); @@ -527,7 +522,7 @@ public Table addCustomMetric(UUID tableId, CustomMetric customMetric) { public Table deleteCustomMetric(UUID tableId, String columnName, String metricName) { // Validate the request content - Table table = dao.findEntityById(tableId); + Table table = find(tableId, NON_DELETED); if (columnName != null) validateColumn(table, columnName); // Get unique entity extension and delete data from DB @@ -541,7 +536,7 @@ public Table deleteCustomMetric(UUID tableId, String columnName, String metricNa } public Table addDataModel(UUID tableId, DataModel dataModel) { - Table table = dao.findEntityById(tableId); + Table table = find(tableId, NON_DELETED); // Update the sql fields only if correct value is present if (dataModel.getRawSql() == null || dataModel.getRawSql().isBlank()) { @@ -586,19 +581,6 @@ public Table addDataModel(UUID tableId, DataModel dataModel) { return table; } - private void addDerivedColumnTags(List columns) { - if (nullOrEmpty(columns)) { - return; - } - - for (Column column : columns) { - column.setTags(addDerivedTags(column.getTags())); - if (column.getChildren() != null) { - addDerivedColumnTags(column.getChildren()); - } - } - } - @Override public void prepare(Table table, boolean update) { DatabaseSchema schema = Entity.getEntity(table.getDatabaseSchema(), "", ALL); @@ -781,7 +763,7 @@ private void validateColumnFQNs(List joinedWithList) { for (JoinedWith joinedWith : joinedWithList) { // Validate table String tableFQN = FullyQualifiedName.getTableFQN(joinedWith.getFullyQualifiedName()); - Table joinedWithTable = dao.findEntityByName(tableFQN); + Table joinedWithTable = findByName(tableFQN, NON_DELETED); // Validate column ColumnUtil.validateColumnFQN(joinedWithTable.getColumns(), joinedWith.getFullyQualifiedName()); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TagRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TagRepository.java index d502780937ba..446ec3835575 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TagRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TagRepository.java @@ -100,17 +100,16 @@ protected void postDelete(Tag entity) { } @Override - public Tag setFields(Tag tag, Fields fields) { + public void setFields(Tag tag, Fields fields) { tag.withClassification(getClassification(tag)).withParent(getParent(tag)); if (fields.contains("usageCount")) { tag.withUsageCount(getUsageCount(tag)); } - return tag; } @Override - public Tag clearFields(Tag tag, Fields fields) { - return tag.withUsageCount(fields.contains("usageCount") ? tag.getUsageCount() : null); + public void clearFields(Tag tag, Fields fields) { + tag.withUsageCount(fields.contains("usageCount") ? tag.getUsageCount() : null); } private Integer getUsageCount(Tag tag) { diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TeamRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TeamRepository.java index 26a6195fca87..1cdb95538463 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TeamRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TeamRepository.java @@ -24,6 +24,7 @@ import static org.openmetadata.schema.api.teams.CreateTeam.TeamType.GROUP; import static org.openmetadata.schema.api.teams.CreateTeam.TeamType.ORGANIZATION; import static org.openmetadata.schema.type.Include.ALL; +import static org.openmetadata.schema.type.Include.NON_DELETED; import static org.openmetadata.service.Entity.ADMIN_USER_NAME; import static org.openmetadata.service.Entity.FIELD_DOMAIN; import static org.openmetadata.service.Entity.ORGANIZATION_NAME; @@ -73,7 +74,6 @@ import org.openmetadata.service.security.policyevaluator.SubjectContext; import org.openmetadata.service.util.EntityUtil; import org.openmetadata.service.util.EntityUtil.Fields; -import org.openmetadata.service.util.JsonUtils; import org.openmetadata.service.util.ResultList; @Slf4j @@ -97,7 +97,7 @@ public TeamRepository() { } @Override - public Team setFields(Team team, Fields fields) { + public void setFields(Team team, Fields fields) { team.setUsers(fields.contains("users") ? getUsers(team) : team.getUsers()); team.setOwns(fields.contains("owns") ? getOwns(team) : team.getOwns()); team.setDefaultRoles(fields.contains(DEFAULT_ROLES) ? getDefaultRoles(team) : team.getDefaultRoles()); @@ -106,11 +106,10 @@ public Team setFields(Team team, Fields fields) { team.setPolicies(fields.contains("policies") ? getPolicies(team) : team.getPolicies()); team.setChildrenCount(fields.contains("childrenCount") ? getChildrenCount(team) : team.getChildrenCount()); team.setUserCount(fields.contains("userCount") ? getUserCount(team.getId()) : team.getUserCount()); - return team; } @Override - public Team clearFields(Team team, Fields fields) { + public void clearFields(Team team, Fields fields) { team.setProfile(fields.contains("profile") ? team.getProfile() : null); team.setUsers(fields.contains("users") ? team.getUsers() : null); team.setOwns(fields.contains("owns") ? team.getOwns() : null); @@ -119,7 +118,7 @@ public Team clearFields(Team team, Fields fields) { team.setParents(fields.contains(PARENTS_FIELD) ? team.getParents() : null); team.setPolicies(fields.contains("policies") ? team.getPolicies() : null); team.setChildrenCount(fields.contains("childrenCount") ? team.getChildrenCount() : null); - return team.withUserCount(fields.contains("userCount") ? team.getUserCount() : null); + team.withUserCount(fields.contains("userCount") ? team.getUserCount() : null); } @Override @@ -207,7 +206,7 @@ protected void preDelete(Team entity, String deletedBy) { protected void cleanup(Team team) { // When a team is deleted, if the children team don't have another parent, set Organization as the parent for (EntityReference child : listOrEmpty(team.getChildren())) { - Team childTeam = dao.findEntityById(child.getId()); + Team childTeam = find(child.getId(), NON_DELETED); getParents(childTeam); if (childTeam.getParents().size() == 1) { // Only parent is being deleted, move the parent to Organization addRelationship(organization.getId(), childTeam.getId(), TEAM, TEAM, Relationship.PARENT_OF); @@ -480,13 +479,13 @@ private List getTeams(List teamRefs) { List teams = new ArrayList<>(); for (EntityReference teamRef : teamRefs) { try { - Team team = dao.findEntityById(teamRef.getId()); + Team team = find(teamRef.getId(), NON_DELETED); teams.add(team); } catch (EntityNotFoundException ex) { // Team was soft-deleted LOG.debug("Failed to populate team since it might be soft deleted.", ex); // Ensure that the team was soft-deleted otherwise throw an exception - dao.findEntityById(teamRef.getId(), Include.DELETED); + find(teamRef.getId(), Include.DELETED); } } return teams; @@ -519,8 +518,8 @@ private void validateSingleParent(Team team, List parentRefs) { } public void initOrganization() { - String json = dao.findJsonByFqn(ORGANIZATION_NAME, Include.ALL); - if (json == null) { + organization = findByNameOrNull(ORGANIZATION_NAME, ALL); + if (organization == null) { LOG.debug("Organization {} is not initialized", ORGANIZATION_NAME); // Teams try { @@ -544,7 +543,6 @@ public void initOrganization() { throw e; } } else { - organization = JsonUtils.readValue(json, Team.class); LOG.info("Organization is already initialized"); } } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TestCaseRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TestCaseRepository.java index 35e13c865e14..2e0b17416e85 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TestCaseRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TestCaseRepository.java @@ -66,20 +66,20 @@ public TestCaseRepository() { } @Override - public TestCase setFields(TestCase test, Fields fields) { + public void setFields(TestCase test, Fields fields) { test.setTestSuites(fields.contains("testSuites") ? getTestSuites(test) : test.getTestSuites()); test.setTestSuite(fields.contains(TEST_SUITE_FIELD) ? getTestSuite(test) : test.getTestSuite()); test.setTestDefinition(fields.contains(TEST_DEFINITION) ? getTestDefinition(test) : test.getTestDefinition()); - return test.withTestCaseResult( + test.withTestCaseResult( fields.contains(TEST_CASE_RESULT_FIELD) ? getTestCaseResult(test) : test.getTestCaseResult()); } @Override - public TestCase clearFields(TestCase test, Fields fields) { + public void clearFields(TestCase test, Fields fields) { test.setTestSuites(fields.contains("testSuites") ? test.getTestSuites() : null); test.setTestSuite(fields.contains(TEST_SUITE) ? test.getTestSuite() : null); test.setTestDefinition(fields.contains(TEST_DEFINITION) ? test.getTestDefinition() : null); - return test.withTestCaseResult(fields.contains(TEST_CASE_RESULT_FIELD) ? test.getTestCaseResult() : null); + test.withTestCaseResult(fields.contains(TEST_CASE_RESULT_FIELD) ? test.getTestCaseResult() : null); } public RestUtil.PatchResponse patchTestCaseResults( @@ -105,7 +105,7 @@ public RestUtil.PatchResponse patchTestCaseResults( // set the test case result state in the test case entity if the state has changed if (!Objects.equals(original, updated)) { - TestCase testCase = dao.findEntityByName(fqn); + TestCase testCase = findByName(fqn, Include.NON_DELETED); setTestCaseResult(testCase, updated, false); } @@ -213,7 +213,7 @@ public void storeRelationships(TestCase test) { public RestUtil.PutResponse addTestCaseResult( String updatedBy, UriInfo uriInfo, String fqn, TestCaseResult testCaseResult) { // Validate the request content - TestCase testCase = dao.findEntityByName(fqn); + TestCase testCase = findByName(fqn, Include.NON_DELETED); daoCollection .dataQualityDataTimeSeriesDao() @@ -235,7 +235,7 @@ public RestUtil.PutResponse addTestCaseResult( public RestUtil.PutResponse deleteTestCaseResult(String updatedBy, String fqn, Long timestamp) { // Validate the request content - TestCase testCase = dao.findEntityByName(fqn); + TestCase testCase = findByName(fqn, Include.NON_DELETED); TestCaseResult storedTestCaseResult = JsonUtils.readValue( daoCollection @@ -472,8 +472,8 @@ public RestUtil.DeleteResponse deleteTestCaseFromLogicalTestSuite(UUID return new RestUtil.DeleteResponse<>(testCase, RestUtil.ENTITY_DELETED); } - @Transaction /** Remove test case from test suite summary and update test suite */ + @Transaction private void removeTestCaseFromTestSuiteResultSummary(UUID testSuiteId, String testCaseFqn) { TestSuite testSuite = Entity.getEntity(TEST_SUITE, testSuiteId, "*", Include.ALL, false); testSuite.setSummary(null); // we don't want to store the summary in the database diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TestConnectionDefinitionRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TestConnectionDefinitionRepository.java index aa069400c45d..7fb3b3a69540 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TestConnectionDefinitionRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TestConnectionDefinitionRepository.java @@ -6,6 +6,7 @@ import org.openmetadata.common.utils.CommonUtil; import org.openmetadata.schema.entity.services.connections.TestConnectionDefinition; import org.openmetadata.service.Entity; +import org.openmetadata.service.jdbi3.EntityRepository.EntityUpdater; import org.openmetadata.service.resources.services.connections.TestConnectionDefinitionResource; import org.openmetadata.service.util.EntityUtil; @@ -38,13 +39,13 @@ public void setFullyQualifiedName(TestConnectionDefinition entity) { } @Override - public TestConnectionDefinition setFields(TestConnectionDefinition entity, EntityUtil.Fields fields) { - return entity; // Nothing to set + public void setFields(TestConnectionDefinition entity, EntityUtil.Fields fields) { + /* Nothing to do */ } @Override - public TestConnectionDefinition clearFields(TestConnectionDefinition entity, EntityUtil.Fields fields) { - return entity; // Nothing to set + public void clearFields(TestConnectionDefinition entity, EntityUtil.Fields fields) { + /* Nothing to do */ } @Override diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TestDefinitionRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TestDefinitionRepository.java index 66dd99db43c6..8762d6f6cb39 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TestDefinitionRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TestDefinitionRepository.java @@ -6,6 +6,7 @@ import org.openmetadata.common.utils.CommonUtil; import org.openmetadata.schema.tests.TestDefinition; import org.openmetadata.service.Entity; +import org.openmetadata.service.jdbi3.EntityRepository.EntityUpdater; import org.openmetadata.service.resources.dqtests.TestDefinitionResource; import org.openmetadata.service.util.EntityUtil; @@ -21,13 +22,13 @@ public TestDefinitionRepository() { } @Override - public TestDefinition setFields(TestDefinition entity, EntityUtil.Fields fields) { - return entity; // Nothing to set + public void setFields(TestDefinition entity, EntityUtil.Fields fields) { + /* Nothing to do */ } @Override - public TestDefinition clearFields(TestDefinition entity, EntityUtil.Fields fields) { - return entity; // Nothing to set + public void clearFields(TestDefinition entity, EntityUtil.Fields fields) { + /* Nothing to do */ } @Override diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TestSuiteRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TestSuiteRepository.java index b7e0eae832d1..4779c63e9bf5 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TestSuiteRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TestSuiteRepository.java @@ -14,7 +14,6 @@ import org.jdbi.v3.sqlobject.transaction.Transaction; import org.openmetadata.schema.entity.data.Table; import org.openmetadata.schema.tests.ResultSummary; -import org.openmetadata.schema.tests.TestCase; import org.openmetadata.schema.tests.TestSuite; import org.openmetadata.schema.tests.type.TestCaseStatus; import org.openmetadata.schema.tests.type.TestSummary; @@ -46,17 +45,17 @@ public TestSuiteRepository() { } @Override - public TestSuite setFields(TestSuite entity, EntityUtil.Fields fields) { + public void setFields(TestSuite entity, EntityUtil.Fields fields) { entity.setPipelines(fields.contains("pipelines") ? getIngestionPipelines(entity) : entity.getPipelines()); entity.setSummary(fields.contains("summary") ? getTestCasesExecutionSummary(entity) : entity.getSummary()); - return entity.withTests(fields.contains("tests") ? getTestCases(entity) : entity.getTests()); + entity.withTests(fields.contains("tests") ? getTestCases(entity) : entity.getTests()); } @Override - public TestSuite clearFields(TestSuite entity, EntityUtil.Fields fields) { + public void clearFields(TestSuite entity, EntityUtil.Fields fields) { entity.setPipelines(fields.contains("pipelines") ? entity.getPipelines() : null); entity.setSummary(fields.contains("summary") ? entity.getSummary() : null); - return entity.withTests(fields.contains("tests") ? entity.getTests() : null); + entity.withTests(fields.contains("tests") ? entity.getTests() : null); } private TestSummary buildTestSummary(HashMap testCaseSummary, int total) { @@ -88,13 +87,6 @@ private HashMap getResultSummary(TestSuite testSuite) { return testCaseSummary; } - private ResultSummary getResultSummary(TestCase testCase, Long timestamp, TestCaseStatus testCaseStatus) { - return new ResultSummary() - .withTestCaseName(testCase.getFullyQualifiedName()) - .withStatus(testCaseStatus) - .withTimestamp(timestamp); - } - private TestSummary getTestCasesExecutionSummary(TestSuite entity) { if (entity.getTestCaseResultSummary().isEmpty()) return new TestSummary(); HashMap testSummary = getResultSummary(entity); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TopicRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TopicRepository.java index 2445e9bdecc6..5d5628982cfa 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TopicRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TopicRepository.java @@ -16,6 +16,7 @@ import static org.openmetadata.common.utils.CommonUtil.listOrEmpty; import static org.openmetadata.common.utils.CommonUtil.nullOrEmpty; import static org.openmetadata.schema.type.Include.ALL; +import static org.openmetadata.schema.type.Include.NON_DELETED; import static org.openmetadata.service.Entity.FIELD_DESCRIPTION; import static org.openmetadata.service.Entity.FIELD_DISPLAY_NAME; import static org.openmetadata.service.Entity.FIELD_TAGS; @@ -45,6 +46,9 @@ import org.openmetadata.schema.type.topic.TopicSampleData; import org.openmetadata.service.Entity; import org.openmetadata.service.exception.CatalogExceptionMessage; +import org.openmetadata.service.jdbi3.EntityRepository.DescriptionTaskWorkflow; +import org.openmetadata.service.jdbi3.EntityRepository.EntityUpdater; +import org.openmetadata.service.jdbi3.EntityRepository.TagTaskWorkflow; import org.openmetadata.service.jdbi3.FeedRepository.TaskWorkflow; import org.openmetadata.service.jdbi3.FeedRepository.ThreadContext; import org.openmetadata.service.resources.feeds.MessageParser.EntityLink; @@ -106,7 +110,7 @@ public void storeRelationships(Topic topic) { } @Override - public Topic setFields(Topic topic, Fields fields) { + public void setFields(Topic topic, Fields fields) { topic.setService(getContainer(topic.getId())); if (topic.getMessageSchema() != null) { populateEntityFieldTags( @@ -115,12 +119,11 @@ public Topic setFields(Topic topic, Fields fields) { topic.getFullyQualifiedName(), fields.contains(FIELD_TAGS)); } - return topic; } @Override - public Topic clearFields(Topic topic, Fields fields) { - return topic; + public void clearFields(Topic topic, Fields fields) { + /* Nothing to do */ } @Override @@ -137,7 +140,7 @@ public void setService(Topic topic, EntityReference service) { public Topic getSampleData(UUID topicId, boolean authorizePII) { // Validate the request content - Topic topic = dao.findEntityById(topicId); + Topic topic = find(topicId, NON_DELETED); TopicSampleData sampleData = JsonUtils.readValue( @@ -178,19 +181,6 @@ private void setFieldFQN(String parentFQN, List fields) { }); } - private void addDerivedFieldTags(List fields) { - if (nullOrEmpty(fields)) { - return; - } - - for (Field field : fields) { - field.setTags(addDerivedTags(field.getTags())); - if (field.getChildren() != null) { - addDerivedFieldTags(field.getChildren()); - } - } - } - List cloneWithoutTags(List fields) { if (nullOrEmpty(fields)) { return fields; diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TypeRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TypeRepository.java index c54fde50ed70..20ef0972ac83 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TypeRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TypeRepository.java @@ -59,14 +59,14 @@ public TypeRepository() { } @Override - public Type setFields(Type type, Fields fields) { - return type.withCustomProperties( + public void setFields(Type type, Fields fields) { + type.withCustomProperties( fields.contains("customProperties") ? getCustomProperties(type) : type.getCustomProperties()); } @Override - public Type clearFields(Type type, Fields fields) { - return type.withCustomProperties(fields.contains("customProperties") ? type.getCustomProperties() : null); + public void clearFields(Type type, Fields fields) { + type.withCustomProperties(fields.contains("customProperties") ? type.getCustomProperties() : null); } @Override @@ -108,7 +108,7 @@ public EntityUpdater getUpdater(Type original, Type updated, Operation operation } public PutResponse addCustomProperty(UriInfo uriInfo, String updatedBy, UUID id, CustomProperty property) { - Type type = dao.findEntityById(id, Include.NON_DELETED); + Type type = find(id, Include.NON_DELETED); property.setPropertyType( Entity.getEntityReferenceById(Entity.TYPE, property.getPropertyType().getId(), NON_DELETED)); if (type.getCategory().equals(Category.Field)) { @@ -116,7 +116,7 @@ public PutResponse addCustomProperty(UriInfo uriInfo, String updatedBy, UU } setFieldsInternal(type, putFields); - dao.findEntityById(property.getPropertyType().getId()); // Validate customProperty type exists + find(property.getPropertyType().getId(), NON_DELETED); // Validate customProperty type exists // If property already exists, then update it. Else add the new property. List updatedProperties = new ArrayList<>(List.of(property)); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/UserRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/UserRepository.java index 4b17ccce5074..e2057feab36e 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/UserRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/UserRepository.java @@ -18,6 +18,7 @@ import static org.openmetadata.csv.CsvUtil.addEntityReferences; import static org.openmetadata.csv.CsvUtil.addField; import static org.openmetadata.schema.type.Include.ALL; +import static org.openmetadata.schema.type.Include.NON_DELETED; import static org.openmetadata.schema.utils.EntityInterfaceUtil.quoteName; import static org.openmetadata.service.Entity.FIELD_DOMAIN; import static org.openmetadata.service.Entity.ROLE; @@ -198,25 +199,25 @@ public UserUpdater getUpdater(User original, User updated, Operation operation) } @Override - public User setFields(User user, Fields fields) { + public void setFields(User user, Fields fields) { user.setTeams(fields.contains(TEAMS_FIELD) ? getTeams(user) : user.getTeams()); user.setOwns(fields.contains("owns") ? getOwns(user) : user.getOwns()); user.setFollows(fields.contains("follows") ? getFollows(user) : user.getFollows()); user.setRoles(fields.contains(ROLES_FIELD) ? getRoles(user) : user.getRoles()); user.setPersonas(fields.contains("personas") ? getPersonas(user) : user.getPersonas()); user.setDefaultPersona(fields.contains("defaultPersonas") ? getDefaultPersona(user) : user.getDefaultPersona()); - return user.withInheritedRoles(fields.contains(ROLES_FIELD) ? getInheritedRoles(user) : user.getInheritedRoles()); + user.withInheritedRoles(fields.contains(ROLES_FIELD) ? getInheritedRoles(user) : user.getInheritedRoles()); } @Override - public User clearFields(User user, Fields fields) { + public void clearFields(User user, Fields fields) { user.setProfile(fields.contains("profile") ? user.getProfile() : null); user.setTeams(fields.contains(TEAMS_FIELD) ? user.getTeams() : null); user.setOwns(fields.contains("owns") ? user.getOwns() : null); user.setFollows(fields.contains("follows") ? user.getFollows() : null); user.setRoles(fields.contains(ROLES_FIELD) ? user.getRoles() : null); user.setAuthenticationMechanism(fields.contains(AUTH_MECHANISM_FIELD) ? user.getAuthenticationMechanism() : null); - return user.withInheritedRoles(fields.contains(ROLES_FIELD) ? user.getInheritedRoles() : null); + user.withInheritedRoles(fields.contains(ROLES_FIELD) ? user.getInheritedRoles() : null); } @Override @@ -253,7 +254,7 @@ public void validateTeams(User user) { /* Validate if the user is already part of the given team */ public void validateTeamAddition(UUID userId, UUID teamId) { - User user = dao.findEntityById(userId); + User user = find(userId, NON_DELETED); List teams = getTeams(user); Optional team = teams.stream().filter(t -> t.getId().equals(teamId)).findFirst(); if (team.isPresent()) { diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/WebAnalyticEventRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/WebAnalyticEventRepository.java index 4ea93a80d4bc..348275a8aff8 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/WebAnalyticEventRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/WebAnalyticEventRepository.java @@ -28,13 +28,13 @@ public WebAnalyticEventRepository() { } @Override - public WebAnalyticEvent setFields(WebAnalyticEvent entity, EntityUtil.Fields fields) { - return entity; + public void setFields(WebAnalyticEvent entity, EntityUtil.Fields fields) { + /* Nothing to do */ } @Override - public WebAnalyticEvent clearFields(WebAnalyticEvent entity, EntityUtil.Fields fields) { - return entity; + public void clearFields(WebAnalyticEvent entity, EntityUtil.Fields fields) { + /* Nothing to do */ } @Override diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/WorkflowRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/WorkflowRepository.java index 11247a267114..8c82fdf3c694 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/WorkflowRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/WorkflowRepository.java @@ -26,13 +26,13 @@ public WorkflowRepository() { } @Override - public Workflow setFields(Workflow entity, EntityUtil.Fields fields) { - return entity; + public void setFields(Workflow entity, EntityUtil.Fields fields) { + /* Nothing to do */ } @Override - public Workflow clearFields(Workflow entity, EntityUtil.Fields fields) { - return entity; + public void clearFields(Workflow entity, EntityUtil.Fields fields) { + /* Nothing to do */ } @Override diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/locator/ConnectionType.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/locator/ConnectionType.java index 82cd6bb31b29..bf8bf23554a4 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/locator/ConnectionType.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/locator/ConnectionType.java @@ -51,6 +51,6 @@ public static ConnectionType from(String value) { @Override public String toString() { - return "ConnectionType{" + "name='" + name() + '\'' + "driver='" + label + '\'' + '}'; + return "ConnectionType{name='" + name() + '\'' + "driver='" + label + '\'' + '}'; } } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/migration/api/MigrationProcessImpl.java b/openmetadata-service/src/main/java/org/openmetadata/service/migration/api/MigrationProcessImpl.java index 86b2528f3f52..c3e021a0afa9 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/migration/api/MigrationProcessImpl.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/migration/api/MigrationProcessImpl.java @@ -14,7 +14,6 @@ @Slf4j public class MigrationProcessImpl implements MigrationProcess { - private CollectionDAO collectionDAO; private MigrationDAO migrationDAO; private Handle handle; private final MigrationFile migrationFile; @@ -28,7 +27,7 @@ public MigrationProcessImpl(MigrationFile migrationFile) { @Override public void initialize(Handle handle) { this.handle = handle; - this.collectionDAO = handle.attach(CollectionDAO.class); + handle.attach(CollectionDAO.class); this.migrationDAO = handle.attach(MigrationDAO.class); } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/migration/context/MigrationContext.java b/openmetadata-service/src/main/java/org/openmetadata/service/migration/context/MigrationContext.java index ab898421f00a..7d953f515495 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/migration/context/MigrationContext.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/migration/context/MigrationContext.java @@ -33,6 +33,6 @@ public void compute() { } public void show() { - LOG.info(String.format("Version [%s] context is [%s]", version, results.toString())); + LOG.info(String.format("Version [%s] context is [%s]", version, results)); } } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/migration/mysql/v117/Migration.java b/openmetadata-service/src/main/java/org/openmetadata/service/migration/mysql/v117/Migration.java index fd563fd6c0ed..7b04945e4e9e 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/migration/mysql/v117/Migration.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/migration/mysql/v117/Migration.java @@ -27,7 +27,7 @@ public void initialize(Handle handle) { @Override @SneakyThrows public void runDataMigration() { - // tests cases coming from dbt for case-sensitive services are not properly linked to a table + // testcases coming from dbt for case-sensitive services are not properly linked to a table fixTestCases(handle, collectionDAO); // Try again the 1.1.6 test suite migration fixTestSuites(collectionDAO); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/MigrationFile.java b/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/MigrationFile.java index 1052452680ee..8006f9f70bcc 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/MigrationFile.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/MigrationFile.java @@ -27,7 +27,8 @@ public class MigrationFile implements Comparable { private final MigrationDAO migrationDAO; private final List schemaChanges; private final List postDDLScripts; - public final String DEFAULT_MIGRATION_PROCESS_CLASS = "org.openmetadata.service.migration.api.MigrationProcessImpl"; + public static final String DEFAULT_MIGRATION_PROCESS_CLASS = + "org.openmetadata.service.migration.api.MigrationProcessImpl"; public MigrationFile(File dir, MigrationDAO migrationDAO, ConnectionType connectionType) { this.dir = dir; @@ -148,8 +149,8 @@ private int compareVersionNumbers(int[] another) { private String getVersionPackageName() { StringBuilder arrayAsString = new StringBuilder(); - for (int i = 0; i < versionNumbers.length; i++) { - arrayAsString.append(versionNumbers[i]); + for (int versionNumber : versionNumbers) { + arrayAsString.append(versionNumber); } return "v" + arrayAsString; } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/V114/MigrationUtil.java b/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/V114/MigrationUtil.java index 863f4b818977..81cbd04188c3 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/V114/MigrationUtil.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/V114/MigrationUtil.java @@ -7,6 +7,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.Set; import lombok.extern.slf4j.Slf4j; import org.openmetadata.schema.api.tests.CreateTestSuite; @@ -33,11 +34,11 @@ private MigrationUtil() { * Step 1: re-run the fix for FQN to catch any issues from previous release where we were quoting the FQN Step 2: * Group all the testCases with the table. We will create a Map with Table FQN as the key and all the test cases * belonging to that Table Step 3: Iterate through the Map keySet, which is table names. For each table name we create - * a executable test suite FQN Step 4: Fetch executable testSuite using step 3 FQN Step 5: Iterate through the test + * an executable test suite FQN Step 4: Fetch executable testSuite using step 3 FQN Step 5: Iterate through the test * case list associated with the current table FQN in the loop Step 6: for each test case fetch TestSuite * relationships Step 7: Iterate through the testSuite relation to check if the executableTestSuite FQN matches. If it - * matches there exists a relation from testCase to a executable Test suite Step 8: If we can't find a match, create a - * relationship. + * matches there exists a relation from testCase to an executable Test suite Step 8: If we can't find a match, create + * a relationship. */ public static void fixTestSuites(CollectionDAO collectionDAO) { // Fix any FQN issues for executable TestSuite @@ -58,9 +59,10 @@ public static void fixTestSuites(CollectionDAO collectionDAO) { // Let's iterate through the test cases and make sure there exists a relationship between testcases and its native // TestSuite Map> testCasesGroupByTable = groupTestCasesByTable(); - for (String tableFQN : testCasesGroupByTable.keySet()) { + for (Entry> entry : testCasesGroupByTable.entrySet()) { + String tableFQN = entry.getKey(); try { - List testCases = testCasesGroupByTable.get(tableFQN); + List testCases = entry.getValue(); String executableTestSuiteFQN = tableFQN + ".testSuite"; TestSuite executableTestSuite = getOrCreateExecutableTestSuite(collectionDAO, testCases, testSuiteRepository, executableTestSuiteFQN); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/V117/MigrationUtil.java b/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/V117/MigrationUtil.java index a49c5f0482c9..4e8bd9886597 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/V117/MigrationUtil.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/V117/MigrationUtil.java @@ -16,7 +16,6 @@ import org.openmetadata.service.resources.databases.DatasourceConfig; import org.openmetadata.service.resources.feeds.MessageParser; import org.openmetadata.service.util.EntityUtil; -import org.openmetadata.service.util.JsonUtils; public class MigrationUtil { private MigrationUtil() { @@ -33,34 +32,29 @@ public static void fixTestCases(Handle handle, CollectionDAO collectionDAO) { List testCases = testCaseRepository.listAll(new EntityUtil.Fields(Set.of("id")), new ListFilter(Include.ALL)); - try { - List fqnList; - if (Boolean.TRUE.equals(DatasourceConfig.getInstance().isMySQL())) { - fqnList = handle.createQuery(MYSQL_LIST_TABLE_FQNS).mapTo(String.class).list(); - } else { - fqnList = handle.createQuery(POSTGRES_LIST_TABLE_FQNS).mapTo(String.class).list(); - } - Map tableMap = new HashMap<>(); - for (String fqn : fqnList) { - tableMap.put(fqn.toLowerCase(), fqn); - } + List fqnList; + if (Boolean.TRUE.equals(DatasourceConfig.getInstance().isMySQL())) { + fqnList = handle.createQuery(MYSQL_LIST_TABLE_FQNS).mapTo(String.class).list(); + } else { + fqnList = handle.createQuery(POSTGRES_LIST_TABLE_FQNS).mapTo(String.class).list(); + } + Map tableMap = new HashMap<>(); + for (String fqn : fqnList) { + tableMap.put(fqn.toLowerCase(), fqn); + } - for (TestCase testCase : testCases) { - // Create New Executable Test Suites - MessageParser.EntityLink entityLink = MessageParser.EntityLink.parse(testCase.getEntityLink()); - String fqn = entityLink.getEntityFQN(); - Table table = JsonUtils.readValue(tableRepository.getDao().findJsonByFqn(fqn, Include.ALL), Table.class); - if (table == null) { - String findTableFQN = tableMap.get(fqn.toLowerCase()); - MessageParser.EntityLink newEntityLink = - new MessageParser.EntityLink(entityLink.getEntityType(), findTableFQN); - testCase.setEntityLink(newEntityLink.getLinkString()); - testCase.setEntityFQN(findTableFQN); - collectionDAO.testCaseDAO().update(testCase); - } + for (TestCase testCase : testCases) { + // Create New Executable Test Suites + MessageParser.EntityLink entityLink = MessageParser.EntityLink.parse(testCase.getEntityLink()); + String fqn = entityLink.getEntityFQN(); + Table table = tableRepository.findByNameOrNull(fqn, Include.ALL); + if (table == null) { + String findTableFQN = tableMap.get(fqn.toLowerCase()); + MessageParser.EntityLink newEntityLink = new MessageParser.EntityLink(entityLink.getEntityType(), findTableFQN); + testCase.setEntityLink(newEntityLink.getLinkString()); + testCase.setEntityFQN(findTableFQN); + collectionDAO.testCaseDAO().update(testCase); } - } catch (Exception exc) { - throw exc; } } } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/v110/MigrationUtil.java b/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/v110/MigrationUtil.java index 6605c012b99b..c08a3b00d257 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/v110/MigrationUtil.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/v110/MigrationUtil.java @@ -7,6 +7,7 @@ import static org.openmetadata.service.util.EntityUtil.hash; import java.util.*; +import java.util.Map.Entry; import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.tuple.Pair; @@ -64,7 +65,6 @@ import org.openmetadata.service.jdbi3.IngestionPipelineRepository; import org.openmetadata.service.jdbi3.ListFilter; import org.openmetadata.service.jdbi3.MigrationDAO; -import org.openmetadata.service.jdbi3.TableRepository; import org.openmetadata.service.jdbi3.TestCaseRepository; import org.openmetadata.service.jdbi3.TestSuiteRepository; import org.openmetadata.service.resources.databases.DatasourceConfig; @@ -163,8 +163,8 @@ public static void readAndProcessEntity( String nameHashColumn) { LOG.debug("Starting Migration for table : {}", dao.getTableName()); if (dao instanceof CollectionDAO.TestSuiteDAO) { - // We have to do this since this column in changed in the dao in latest version after this , and this will fail - // the migrations here + // We have to do this since this column in changed in the dao in the latest version after this , and this will + // fail the migrations here nameHashColumn = "nameHash"; } while (true) { @@ -428,10 +428,7 @@ public static TestSuite getTestSuite(CollectionDAO dao, CreateTestSuite create, .withDisplayName(create.getDisplayName()) .withName(create.getName()); if (create.getExecutableEntityReference() != null) { - TableRepository tableRepository = (TableRepository) Entity.getEntityRepository(Entity.TABLE); - Table table = - JsonUtils.readValue( - tableRepository.getDao().findJsonByFqn(create.getExecutableEntityReference(), Include.ALL), Table.class); + Table table = Entity.getEntityByName(Entity.TABLE, create.getExecutableEntityReference(), "", Include.ALL); EntityReference entityReference = new EntityReference() .withId(table.getId()) @@ -470,9 +467,10 @@ public static void testSuitesMigration(CollectionDAO collectionDAO) { // create native test suites TestSuiteRepository testSuiteRepository = (TestSuiteRepository) Entity.getEntityRepository(TEST_SUITE); Map> testCasesByTable = groupTestCasesByTable(); - for (String tableFQN : testCasesByTable.keySet()) { + for (Entry> entry : testCasesByTable.entrySet()) { + String tableFQN = entry.getKey(); String nativeTestSuiteFqn = tableFQN + ".testSuite"; - List testCases = testCasesByTable.get(tableFQN); + List testCases = entry.getValue(); if (testCases != null && !testCases.isEmpty()) { MessageParser.EntityLink entityLink = MessageParser.EntityLink.parse(testCases.stream().findFirst().get().getEntityLink()); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/v120/MigrationUtil.java b/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/v120/MigrationUtil.java index 64685c61993f..03010997b09d 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/v120/MigrationUtil.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/v120/MigrationUtil.java @@ -120,8 +120,8 @@ public static void addQueryService(Handle handle, CollectionDAO collectionDAO) { } /** - * Before Release 1.2, Glossary and all of the Glossary terms , even the deeply nested glossary terms have contains - * relation with Glossary and also its parent GlossaryTerm. This causes delete issue as we recursively delete the + * Before Release 1.2, Glossary and all the Glossary terms , even the deeply nested glossary terms have contains + * relation with Glossary and also its parent GlossaryTerm. These causes delete issue as we recursively delete the * GlossaryTerms When Glossary gets deleted. We have updated the Glossary -> nested GlossaryTerm to be "Has". This * migration does following update 1. List all GlossaryTerms, update the status to Accepted , since we introduced the * Glossary Approval Workflow 2. For each term we look at who is the parent is, There should be only one parent in diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/analytics/WebAnalyticEventResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/analytics/WebAnalyticEventResource.java index de73544766c5..734e24fc6475 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/analytics/WebAnalyticEventResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/analytics/WebAnalyticEventResource.java @@ -111,7 +111,7 @@ public ResultList list( schema = @Schema(type = "string", example = FIELDS)) @QueryParam("fields") String fieldsParam, - @Parameter(description = "Limit the number report Definition returned. (1 to 1000000, default = " + "10)") + @Parameter(description = "Limit the number report Definition returned. (1 to 1000000, default = 10)") @DefaultValue("10") @QueryParam("limit") @Min(0) @@ -225,9 +225,7 @@ public Response updateDescription( content = @Content( mediaType = MediaType.APPLICATION_JSON_PATCH_JSON, - examples = { - @ExampleObject("[" + "{op:remove, path:/a}," + "{op:add, path: /b, value: val}" + "]") - })) + examples = {@ExampleObject("[{op:remove, path:/a},{op:add, path: /b, value: val}]")})) JsonPatch patch) { return patchInternal(uriInfo, securityContext, id, patch); } @@ -363,7 +361,7 @@ public EntityHistory listVersions( @Content(mediaType = "application/json", schema = @Schema(implementation = WebAnalyticEvent.class))), @ApiResponse( responseCode = "404", - description = "Web Analytic event type for instance {id} and version {version} is " + "not found") + description = "Web Analytic event type for instance {id} and version {version} is not found") }) public WebAnalyticEvent getVersion( @Context UriInfo uriInfo, diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/apps/AppMarketPlaceResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/apps/AppMarketPlaceResource.java index 89499a18fddb..f034a40bd5bc 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/apps/AppMarketPlaceResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/apps/AppMarketPlaceResource.java @@ -124,7 +124,7 @@ public ResultList list( schema = @Schema(type = "string", example = FIELDS)) @QueryParam("fields") String fieldsParam, - @Parameter(description = "Limit the number of installed applications returned. (1 to 1000000, default = " + "10)") + @Parameter(description = "Limit the number of installed applications returned. (1 to 1000000, default = 10)") @DefaultValue("10") @QueryParam("limit") @Min(0) @@ -243,9 +243,7 @@ public AppMarketPlaceDefinition getByName( responseCode = "200", description = "App", content = @Content(mediaType = "application/json", schema = @Schema(implementation = App.class))), - @ApiResponse( - responseCode = "404", - description = "App for instance {id} and version {version} is " + "not found") + @ApiResponse(responseCode = "404", description = "App for instance {id} and version {version} is not found") }) public AppMarketPlaceDefinition getVersion( @Context UriInfo uriInfo, @@ -299,9 +297,7 @@ public Response patchApplication( content = @Content( mediaType = MediaType.APPLICATION_JSON_PATCH_JSON, - examples = { - @ExampleObject("[" + "{op:remove, path:/a}," + "{op:add, path: /b, value: val}" + "]") - })) + examples = {@ExampleObject("[{op:remove, path:/a},{op:add, path: /b, value: val}]")})) JsonPatch patch) { return patchInternal(uriInfo, securityContext, id, patch); } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/apps/AppResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/apps/AppResource.java index 159aeca2c94f..53d3049b0ca8 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/apps/AppResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/apps/AppResource.java @@ -80,7 +80,6 @@ import org.openmetadata.service.security.Authorizer; import org.openmetadata.service.security.policyevaluator.OperationContext; import org.openmetadata.service.util.EntityUtil; -import org.openmetadata.service.util.JsonUtils; import org.openmetadata.service.util.OpenMetadataConnectionBuilder; import org.openmetadata.service.util.ResultList; import org.quartz.SchedulerException; @@ -124,15 +123,10 @@ public void initialize(OpenMetadataApplicationConfig config) { .getByName( null, createApp.getName(), new EntityUtil.Fields(repository.getMarketPlace().getAllowedFields())); - String existingJson = repository.getDao().findJsonByFqn(createApp.getName(), ALL); - - App app; - - if (existingJson == null) { + App app = repository.findByNameOrNull(createApp.getName(), ALL); + if (app == null) { app = getApplication(definition, createApp, "admin").withFullyQualifiedName(createApp.getName()); repository.initializeEntity(app); - } else { - app = JsonUtils.readValue(existingJson, App.class); } // Schedule @@ -184,7 +178,7 @@ public ResultList list( schema = @Schema(type = "string", example = FIELDS)) @QueryParam("fields") String fieldsParam, - @Parameter(description = "Limit the number of installed applications returned. (1 to 1000000, default = " + "10)") + @Parameter(description = "Limit the number of installed applications returned. (1 to 1000000, default = 10)") @DefaultValue("10") @QueryParam("limit") @Min(0) @@ -225,13 +219,13 @@ public Response listAppRuns( @Context UriInfo uriInfo, @Context SecurityContext securityContext, @Parameter(description = "Name of the App", schema = @Schema(type = "string")) @PathParam("name") String name, - @Parameter(description = "Limit records. (1 to 1000000, default = " + "10)") + @Parameter(description = "Limit records. (1 to 1000000, default = 10)") @DefaultValue("10") @QueryParam("limit") @Min(0) @Max(1000000) int limitParam, - @Parameter(description = "Offset records. (0 to 1000000, default = " + "0)") + @Parameter(description = "Offset records. (0 to 1000000, default = 0)") @DefaultValue("0") @QueryParam("offset") @Min(0) @@ -443,9 +437,7 @@ public App getByName( responseCode = "200", description = "App", content = @Content(mediaType = "application/json", schema = @Schema(implementation = App.class))), - @ApiResponse( - responseCode = "404", - description = "App for instance {id} and version {version} is " + "not found") + @ApiResponse(responseCode = "404", description = "App for instance {id} and version {version} is not found") }) public App getVersion( @Context UriInfo uriInfo, @@ -506,9 +498,7 @@ public Response patchApplication( content = @Content( mediaType = MediaType.APPLICATION_JSON_PATCH_JSON, - examples = { - @ExampleObject("[" + "{op:remove, path:/a}," + "{op:add, path: /b, value: val}" + "]") - })) + examples = {@ExampleObject("[{op:remove, path:/a},{op:add, path: /b, value: val}]")})) JsonPatch patch) { return patchInternal(uriInfo, securityContext, id, patch); } @@ -758,7 +748,7 @@ public Response deployApplicationFlow( } private void decryptOrNullify( - SecurityContext securityContext, IngestionPipeline ingestionPipeline, String botname, boolean forceNotMask) { + SecurityContext securityContext, IngestionPipeline ingestionPipeline, String botName, boolean forceNotMask) { SecretsManager secretsManager = SecretsManagerFactory.getSecretsManager(); try { authorizer.authorize( @@ -770,7 +760,7 @@ private void decryptOrNullify( } secretsManager.decryptIngestionPipeline(ingestionPipeline); OpenMetadataConnection openMetadataServerConnection = - new OpenMetadataConnectionBuilder(openMetadataApplicationConfig, botname).build(); + new OpenMetadataConnectionBuilder(openMetadataApplicationConfig, botName).build(); ingestionPipeline.setOpenMetadataServerConnection( secretsManager.encryptOpenMetadataConnection(openMetadataServerConnection, false)); if (authorizer.shouldMaskPasswords(securityContext) && !forceNotMask) { diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/automations/WorkflowResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/automations/WorkflowResource.java index 2b6374417792..211751dbbd3f 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/automations/WorkflowResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/automations/WorkflowResource.java @@ -122,7 +122,7 @@ public ResultList list( schema = @Schema(type = "string", example = FIELDS)) @QueryParam("fields") String fieldsParam, - @Parameter(description = "Limit the number automations workflows returned. (1 to 1000000, default = " + "10)") + @Parameter(description = "Limit the number automations workflows returned. (1 to 1000000, default = 10)") @DefaultValue("10") @QueryParam("limit") @Min(0) @@ -260,7 +260,7 @@ public Workflow getByName( content = @Content(mediaType = "application/json", schema = @Schema(implementation = Workflow.class))), @ApiResponse( responseCode = "404", - description = "Workflow for instance {id} and version {version} is " + "not found") + description = "Workflow for instance {id} and version {version} is not found") }) public Workflow getVersion( @Context UriInfo uriInfo, @@ -341,9 +341,7 @@ public Response updateDescription( content = @Content( mediaType = MediaType.APPLICATION_JSON_PATCH_JSON, - examples = { - @ExampleObject("[" + "{op:remove, path:/a}," + "{op:add, path: /b, value: val}" + "]") - })) + examples = {@ExampleObject("[{op:remove, path:/a},{op:add, path: /b, value: val}]")})) JsonPatch patch) { Response response = patchInternal(uriInfo, securityContext, id, patch); return Response.fromResponse(response) diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/bots/BotResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/bots/BotResource.java index ee40fff1e86c..5e1ef9317a44 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/bots/BotResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/bots/BotResource.java @@ -243,9 +243,7 @@ public EntityHistory listVersions( responseCode = "200", description = "bot", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Bot.class))), - @ApiResponse( - responseCode = "404", - description = "Bot for instance {id} and version {version} is " + "not found") + @ApiResponse(responseCode = "404", description = "Bot for instance {id} and version {version} is not found") }) public Bot getVersion( @Context UriInfo uriInfo, @@ -311,9 +309,7 @@ public Response patch( content = @Content( mediaType = MediaType.APPLICATION_JSON_PATCH_JSON, - examples = { - @ExampleObject("[" + "{op:remove, path:/a}," + "{op:add, path: /b, value: val}" + "]") - })) + examples = {@ExampleObject("[{op:remove, path:/a},{op:add, path: /b, value: val}]")})) JsonPatch patch) { return patchInternal(uriInfo, securityContext, id, patch); } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/charts/ChartResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/charts/ChartResource.java index 5ffae063a1ff..12b73862bd90 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/charts/ChartResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/charts/ChartResource.java @@ -66,7 +66,7 @@ @Path("/v1/charts") @Tag( name = "Charts", - description = "A `Chart` are computed from data presents data visually and can be part of " + "`Dashboards`.") + description = "A `Chart` are computed from data presents data visually and can be part of `Dashboards`.") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @Collection(name = "charts") @@ -235,9 +235,7 @@ public Chart getByName( responseCode = "200", description = "chart", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Chart.class))), - @ApiResponse( - responseCode = "404", - description = "Chart for instance {id} and version {version} is " + "not found") + @ApiResponse(responseCode = "404", description = "Chart for instance {id} and version {version} is not found") }) public Chart getVersion( @Context UriInfo uriInfo, @@ -286,9 +284,7 @@ public Response patch( content = @Content( mediaType = MediaType.APPLICATION_JSON_PATCH_JSON, - examples = { - @ExampleObject("[" + "{op:remove, path:/a}," + "{op:add, path: /b, value: val}" + "]") - })) + examples = {@ExampleObject("[{op:remove, path:/a},{op:add, path: /b, value: val}]")})) JsonPatch patch) { return patchInternal(uriInfo, securityContext, id, patch); } @@ -430,7 +426,6 @@ private Chart getChart(CreateChart create, String user) { .copy(new Chart(), create, user) .withService(EntityUtil.getEntityReference(Entity.DASHBOARD_SERVICE, create.getService())) .withChartType(create.getChartType()) - .withSourceUrl(create.getSourceUrl()) - .withTags(create.getTags()); + .withSourceUrl(create.getSourceUrl()); } } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/dashboards/DashboardResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/dashboards/DashboardResource.java index dfedc791afb3..8ea0b8a4c2e9 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/dashboards/DashboardResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/dashboards/DashboardResource.java @@ -128,7 +128,7 @@ public ResultList list( schema = @Schema(type = "string", example = "superset")) @QueryParam("service") String serviceParam, - @Parameter(description = "Limit the number dashboards returned. (1 to 1000000, " + "default = 10)") + @Parameter(description = "Limit the number dashboards returned. (1 to 1000000, default = 10)") @DefaultValue("10") @Min(0) @Max(1000000) @@ -246,7 +246,7 @@ public Dashboard getByName( content = @Content(mediaType = "application/json", schema = @Schema(implementation = Dashboard.class))), @ApiResponse( responseCode = "404", - description = "Dashboard for instance {id} and version {version} is " + "not found") + description = "Dashboard for instance {id} and version {version} is not found") }) public Dashboard getVersion( @Context UriInfo uriInfo, @@ -295,9 +295,7 @@ public Response updateDescription( content = @Content( mediaType = MediaType.APPLICATION_JSON_PATCH_JSON, - examples = { - @ExampleObject("[" + "{op:remove, path:/a}," + "{op:add, path: /b, value: val}" + "]") - })) + examples = {@ExampleObject("[{op:remove, path:/a},{op:add, path: /b, value: val}]")})) JsonPatch patch) { return patchInternal(uriInfo, securityContext, id, patch); } @@ -444,7 +442,6 @@ private Dashboard getDashboard(CreateDashboard create, String user) { .withDataModels(getEntityReferences(Entity.DASHBOARD_DATA_MODEL, create.getDataModels())) .withSourceUrl(create.getSourceUrl()) .withDashboardType(create.getDashboardType()) - .withProject(create.getProject()) - .withTags(create.getTags()); + .withProject(create.getProject()); } } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/databases/DatabaseResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/databases/DatabaseResource.java index 80d3232c640f..ec0a34a32fde 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/databases/DatabaseResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/databases/DatabaseResource.java @@ -127,7 +127,7 @@ public ResultList list( schema = @Schema(type = "string", example = "snowflakeWestCoast")) @QueryParam("service") String serviceParam, - @Parameter(description = "Limit the number tables returned. (1 to 1000000, default" + " = 10)") + @Parameter(description = "Limit the number tables returned. (1 to 1000000, default = 10)") @DefaultValue("10") @QueryParam("limit") @Min(0) @@ -245,7 +245,7 @@ public Database getByName( content = @Content(mediaType = "application/json", schema = @Schema(implementation = Database.class))), @ApiResponse( responseCode = "404", - description = "Database for instance {id} and version {version} is " + "not found") + description = "Database for instance {id} and version {version} is not found") }) public Database getVersion( @Context UriInfo uriInfo, @@ -294,9 +294,7 @@ public Response patch( content = @Content( mediaType = MediaType.APPLICATION_JSON_PATCH_JSON, - examples = { - @ExampleObject("[" + "{op:remove, path:/a}," + "{op:add, path: /b, value: val}" + "]") - })) + examples = {@ExampleObject("[{op:remove, path:/a},{op:add, path: /b, value: val}]")})) JsonPatch patch) { return patchInternal(uriInfo, securityContext, id, patch); } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/databases/DatabaseSchemaResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/databases/DatabaseSchemaResource.java index 52d2f7d47e22..5139b8c7e4b7 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/databases/DatabaseSchemaResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/databases/DatabaseSchemaResource.java @@ -123,7 +123,7 @@ public ResultList list( schema = @Schema(type = "string", example = "customerDatabase")) @QueryParam("database") String databaseParam, - @Parameter(description = "Limit the number schemas returned. (1 to 1000000, default" + " = 10)") + @Parameter(description = "Limit the number schemas returned. (1 to 1000000, default = 10)") @DefaultValue("10") @QueryParam("limit") @Min(0) @@ -244,7 +244,7 @@ public DatabaseSchema getByName( @Content(mediaType = "application/json", schema = @Schema(implementation = DatabaseSchema.class))), @ApiResponse( responseCode = "404", - description = "Database schema for instance {id} and version {version} is " + "not found") + description = "Database schema for instance {id} and version {version} is not found") }) public DatabaseSchema getVersion( @Context UriInfo uriInfo, @@ -294,9 +294,7 @@ public Response patch( content = @Content( mediaType = MediaType.APPLICATION_JSON_PATCH_JSON, - examples = { - @ExampleObject("[" + "{op:remove, path:/a}," + "{op:add, path: /b, value: val}" + "]") - })) + examples = {@ExampleObject("[{op:remove, path:/a},{op:add, path: /b, value: val}]")})) JsonPatch patch) { return patchInternal(uriInfo, securityContext, id, patch); } @@ -476,7 +474,6 @@ private DatabaseSchema getDatabaseSchema(CreateDatabaseSchema create, String use return repository .copy(new DatabaseSchema(), create, user) .withDatabase(getEntityReference(Entity.DATABASE, create.getDatabase())) - .withTags(create.getTags()) .withSourceUrl(create.getSourceUrl()) .withRetentionPeriod(create.getRetentionPeriod()); } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/databases/DatabaseUtil.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/databases/DatabaseUtil.java index c5ea9a5accbb..3a7751424802 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/databases/DatabaseUtil.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/databases/DatabaseUtil.java @@ -83,7 +83,7 @@ public static void validateViewDefinition(TableType tableType, String viewDefini && viewDefinition != null && !viewDefinition.isEmpty()) { throw new IllegalArgumentException( - "ViewDefinition can only be set on TableType View, " + "SecureView or MaterializedView"); + "ViewDefinition can only be set on TableType View, SecureView or MaterializedView"); } } @@ -149,7 +149,7 @@ public static void validateStructColumn(Column column) { ColumnDataType dataType = column.getDataType(); if (dataType == ColumnDataType.STRUCT) { if (column.getChildren() == null) { - throw new IllegalArgumentException("For column data type struct, children " + "must not be null"); + throw new IllegalArgumentException("For column data type struct, children must not be null"); } validateColumnNames(column.getChildren()); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/databases/StoredProcedureResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/databases/StoredProcedureResource.java index 8e1afd486582..5fd46bc0a0a6 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/databases/StoredProcedureResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/databases/StoredProcedureResource.java @@ -88,7 +88,7 @@ public ResultList list( schema = @Schema(type = "string", example = "customerDatabaseSchema")) @QueryParam("databaseSchema") String databaseSchemaParam, - @Parameter(description = "Limit the number schemas returned. (1 to 1000000, default" + " = 10)") + @Parameter(description = "Limit the number schemas returned. (1 to 1000000, default = 10)") @DefaultValue("10") @QueryParam("limit") @Min(0) @@ -209,7 +209,7 @@ public StoredProcedure getByName( @Content(mediaType = "application/json", schema = @Schema(implementation = StoredProcedure.class))), @ApiResponse( responseCode = "404", - description = "Stored Procedure for instance {id} and version {version} is " + "not found") + description = "Stored Procedure for instance {id} and version {version} is not found") }) public StoredProcedure getVersion( @Context UriInfo uriInfo, @@ -259,9 +259,7 @@ public Response patch( content = @Content( mediaType = MediaType.APPLICATION_JSON_PATCH_JSON, - examples = { - @ExampleObject("[" + "{op:remove, path:/a}," + "{op:add, path: /b, value: val}" + "]") - })) + examples = {@ExampleObject("[{op:remove, path:/a},{op:add, path: /b, value: val}]")})) JsonPatch patch) { return patchInternal(uriInfo, securityContext, id, patch); } @@ -417,7 +415,6 @@ private StoredProcedure getStoredProcedure(CreateStoredProcedure create, String return repository .copy(new StoredProcedure(), create, user) .withDatabaseSchema(getEntityReference(Entity.DATABASE_SCHEMA, create.getDatabaseSchema())) - .withTags(create.getTags()) .withStoredProcedureCode(create.getStoredProcedureCode()) .withSourceUrl(create.getSourceUrl()); } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/databases/TableResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/databases/TableResource.java index 2226d4065fd8..faf8843580aa 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/databases/TableResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/databases/TableResource.java @@ -176,7 +176,7 @@ public ResultList
list( @QueryParam("includeEmptyTestSuite") @DefaultValue("true") boolean includeEmptyTestSuite, - @Parameter(description = "Limit the number tables returned. (1 to 1000000, default = " + "10) ") + @Parameter(description = "Limit the number tables returned. (1 to 1000000, default = 10) ") @DefaultValue("10") @Min(0) @Max(1000000) @@ -295,9 +295,7 @@ public EntityHistory listVersions( responseCode = "200", description = "table", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Table.class))), - @ApiResponse( - responseCode = "404", - description = "Table for instance {id} and version {version} is " + "not found") + @ApiResponse(responseCode = "404", description = "Table for instance {id} and version {version} is not found") }) public Table getVersion( @Context UriInfo uriInfo, @@ -364,9 +362,7 @@ public Response patch( content = @Content( mediaType = MediaType.APPLICATION_JSON_PATCH_JSON, - examples = { - @ExampleObject("[" + "{op:remove, path:/a}," + "{op:add, path: /b, value: val}" + "]") - })) + examples = {@ExampleObject("[{op:remove, path:/a},{op:add, path: /b, value: val}]")})) JsonPatch patch) { return patchInternal(uriInfo, securityContext, id, patch); } @@ -470,7 +466,7 @@ public Response addFollower( description = "Successfully updated the Table", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Table.class))), @ApiResponse(responseCode = "404", description = "Table for instance {id} is not found"), - @ApiResponse(responseCode = "400", description = "Date range can only include past 30 days starting" + " today") + @ApiResponse(responseCode = "400", description = "Date range can only include past 30 days starting today") }) public Table addJoins( @Context UriInfo uriInfo, @@ -968,7 +964,6 @@ private Table getTable(CreateTable create, String user) { .withTableConstraints(create.getTableConstraints()) .withTablePartition(create.getTablePartition()) .withTableType(create.getTableType()) - .withTags(create.getTags()) .withFileFormat(create.getFileFormat()) .withViewDefinition(create.getViewDefinition()) .withTableProfilerConfig(create.getTableProfilerConfig()) diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/datainsight/DataInsightChartResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/datainsight/DataInsightChartResource.java index 7d38ddeb4d02..17a0aee94932 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/datainsight/DataInsightChartResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/datainsight/DataInsightChartResource.java @@ -112,7 +112,7 @@ public ResultList list( schema = @Schema(type = "string", example = FIELDS)) @QueryParam("fields") String fieldsParam, - @Parameter(description = "Limit the number data insight chart returned. (1 to 1000000, default = " + "10)") + @Parameter(description = "Limit the number data insight chart returned. (1 to 1000000, default = 10)") @DefaultValue("10") @QueryParam("limit") @Min(0) @@ -239,7 +239,7 @@ public DataInsightChart getByName( @Content(mediaType = "application/json", schema = @Schema(implementation = DataInsightChart.class))), @ApiResponse( responseCode = "404", - description = "Data Insight Chart for instance {id} and version {version} is " + "not found") + description = "Data Insight Chart for instance {id} and version {version} is not found") }) public DataInsightChart getVersion( @Context UriInfo uriInfo, @@ -291,9 +291,7 @@ public Response updateDescription( content = @Content( mediaType = MediaType.APPLICATION_JSON_PATCH_JSON, - examples = { - @ExampleObject("[" + "{op:remove, path:/a}," + "{op:add, path: /b, value: val}" + "]") - })) + examples = {@ExampleObject("[{op:remove, path:/a},{op:add, path: /b, value: val}]")})) JsonPatch patch) { return patchInternal(uriInfo, securityContext, id, patch); } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/datamodels/DashboardDataModelResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/datamodels/DashboardDataModelResource.java index a86b798fa8de..5741be9d2a72 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/datamodels/DashboardDataModelResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/datamodels/DashboardDataModelResource.java @@ -243,7 +243,7 @@ public DashboardDataModel getByName( @Content(mediaType = "application/json", schema = @Schema(implementation = DashboardDataModel.class))), @ApiResponse( responseCode = "404", - description = "DataModel for instance {id} and version {version} is " + "not found") + description = "DataModel for instance {id} and version {version} is not found") }) public DashboardDataModel getVersion( @Context UriInfo uriInfo, @@ -295,9 +295,7 @@ public Response patch( content = @Content( mediaType = MediaType.APPLICATION_JSON_PATCH_JSON, - examples = { - @ExampleObject("[" + "{op:remove, path:/a}," + "{op:add, path: /b, value: val}" + "]") - })) + examples = {@ExampleObject("[{op:remove, path:/a},{op:add, path: /b, value: val}]")})) JsonPatch patch) { return patchInternal(uriInfo, securityContext, id, patch); } @@ -447,7 +445,6 @@ private DashboardDataModel getDataModel(CreateDashboardDataModel create, String .withDataModelType(create.getDataModelType()) .withServiceType(create.getServiceType()) .withColumns(create.getColumns()) - .withProject(create.getProject()) - .withTags(create.getTags()); + .withProject(create.getProject()); } } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/docstore/DocStoreResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/docstore/DocStoreResource.java index 915df9356c28..79f9da248412 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/docstore/DocStoreResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/docstore/DocStoreResource.java @@ -231,7 +231,7 @@ public Document getByName( content = @Content(mediaType = "application/json", schema = @Schema(implementation = Document.class))), @ApiResponse( responseCode = "404", - description = "Document for instance {id} and version {version} is " + "not found") + description = "Document for instance {id} and version {version} is not found") }) public Document getVersion( @Context UriInfo uriInfo, @@ -297,9 +297,7 @@ public Response patch( content = @Content( mediaType = MediaType.APPLICATION_JSON_PATCH_JSON, - examples = { - @ExampleObject("[" + "{op:remove, path:/a}," + "{op:add, path: /b, value: val}" + "]") - })) + examples = {@ExampleObject("[{op:remove, path:/a},{op:add, path: /b, value: val}]")})) JsonPatch patch) { return patchInternal(uriInfo, securityContext, id, patch); } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/domains/DataProductResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/domains/DataProductResource.java index 09632b4d3361..e9835408dfc3 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/domains/DataProductResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/domains/DataProductResource.java @@ -218,7 +218,7 @@ public EntityHistory listVersions( content = @Content(mediaType = "application/json", schema = @Schema(implementation = DataProduct.class))), @ApiResponse( responseCode = "404", - description = "DataProduct for instance {id} and version {version} is " + "not found") + description = "DataProduct for instance {id} and version {version} is not found") }) public DataProduct getVersion( @Context UriInfo uriInfo, @@ -255,7 +255,7 @@ public Response create( operationId = "createOrUpdateDataProduct", summary = "Create or update a dataProduct", description = - "Create a dataProduct. if it does not exist. If a dataProduct already exists, update the " + "dataProduct.", + "Create a dataProduct. if it does not exist. If a dataProduct already exists, update the dataProduct.", responses = { @ApiResponse( responseCode = "200", @@ -286,9 +286,7 @@ public Response patch( content = @Content( mediaType = MediaType.APPLICATION_JSON_PATCH_JSON, - examples = { - @ExampleObject("[" + "{op:remove, path:/a}," + "{op:add, path: /b, value: val}" + "]") - })) + examples = {@ExampleObject("[{op:remove, path:/a},{op:add, path: /b, value: val}]")})) JsonPatch patch) { return patchInternal(uriInfo, securityContext, id, patch); } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/domains/DomainResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/domains/DomainResource.java index 55f8bc6bd204..9d5f04ac5527 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/domains/DomainResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/domains/DomainResource.java @@ -198,9 +198,7 @@ public EntityHistory listVersions( responseCode = "200", description = "domain", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Domain.class))), - @ApiResponse( - responseCode = "404", - description = "Domain for instance {id} and version {version} is " + "not found") + @ApiResponse(responseCode = "404", description = "Domain for instance {id} and version {version} is not found") }) public Domain getVersion( @Context UriInfo uriInfo, @@ -267,9 +265,7 @@ public Response patch( content = @Content( mediaType = MediaType.APPLICATION_JSON_PATCH_JSON, - examples = { - @ExampleObject("[" + "{op:remove, path:/a}," + "{op:add, path: /b, value: val}" + "]") - })) + examples = {@ExampleObject("[{op:remove, path:/a},{op:add, path: /b, value: val}]")})) JsonPatch patch) { return patchInternal(uriInfo, securityContext, id, patch); } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/dqtests/TestCaseResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/dqtests/TestCaseResource.java index 86e9c6152681..e1ad4bffab37 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/dqtests/TestCaseResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/dqtests/TestCaseResource.java @@ -128,7 +128,7 @@ public ResultList list( schema = @Schema(type = "string", example = FIELDS)) @QueryParam("fields") String fieldsParam, - @Parameter(description = "Limit the number tests returned. (1 to 1000000, default = " + "10)") + @Parameter(description = "Limit the number tests returned. (1 to 1000000, default = 10)") @DefaultValue("10") @QueryParam("limit") @Min(0) @@ -293,9 +293,7 @@ public TestCase getByName( responseCode = "200", description = "Test", content = @Content(mediaType = "application/json", schema = @Schema(implementation = TestCase.class))), - @ApiResponse( - responseCode = "404", - description = "Test for instance {id} and version {version} is " + "not found") + @ApiResponse(responseCode = "404", description = "Test for instance {id} and version {version} is not found") }) public TestCase getVersion( @Context UriInfo uriInfo, @@ -353,9 +351,7 @@ public Response patch( content = @Content( mediaType = MediaType.APPLICATION_JSON_PATCH_JSON, - examples = { - @ExampleObject("[" + "{op:remove, path:/a}," + "{op:add, path: /b, value: val}" + "]") - })) + examples = {@ExampleObject("[{op:remove, path:/a},{op:add, path: /b, value: val}]")})) JsonPatch patch) { // Override OperationContext to change the entity to table and operation from UPDATE to EDIT_TESTS ResourceContextInterface resourceContext = TestCaseResourceContext.builder().id(id).build(); @@ -387,9 +383,7 @@ public Response patchTestCaseResult( content = @Content( mediaType = MediaType.APPLICATION_JSON_PATCH_JSON, - examples = { - @ExampleObject("[" + "{op:remove, path:/a}," + "{op:add, path: /b, value: val}" + "]") - })) + examples = {@ExampleObject("[{op:remove, path:/a},{op:add, path: /b, value: val}]")})) JsonPatch patch) { // Override OperationContext to change the entity to table and operation from UPDATE to EDIT_TESTS ResourceContextInterface resourceContext = TestCaseResourceContext.builder().name(fqn).build(); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/dqtests/TestDefinitionResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/dqtests/TestDefinitionResource.java index f86009f77306..23f327139827 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/dqtests/TestDefinitionResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/dqtests/TestDefinitionResource.java @@ -106,7 +106,7 @@ public ResultList list( schema = @Schema(type = "string", example = FIELDS)) @QueryParam("fields") String fieldsParam, - @Parameter(description = "Limit the number test definitions returned. (1 to 1000000, default = " + "10)") + @Parameter(description = "Limit the number test definitions returned. (1 to 1000000, default = 10)") @DefaultValue("10") @QueryParam("limit") @Min(0) @@ -247,7 +247,7 @@ public TestDefinition getByName( @Content(mediaType = "application/json", schema = @Schema(implementation = TestDefinition.class))), @ApiResponse( responseCode = "404", - description = "Test Definition for instance {id} and version {version} is " + "not found") + description = "Test Definition for instance {id} and version {version} is not found") }) public TestDefinition getVersion( @Context UriInfo uriInfo, @@ -297,9 +297,7 @@ public Response updateDescription( content = @Content( mediaType = MediaType.APPLICATION_JSON_PATCH_JSON, - examples = { - @ExampleObject("[" + "{op:remove, path:/a}," + "{op:add, path: /b, value: val}" + "]") - })) + examples = {@ExampleObject("[{op:remove, path:/a},{op:add, path: /b, value: val}]")})) JsonPatch patch) { return patchInternal(uriInfo, securityContext, id, patch); } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/dqtests/TestSuiteResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/dqtests/TestSuiteResource.java index c81b15f8096b..c2a476dda892 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/dqtests/TestSuiteResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/dqtests/TestSuiteResource.java @@ -109,7 +109,7 @@ public ResultList list( schema = @Schema(type = "string", example = FIELDS)) @QueryParam("fields") String fieldsParam, - @Parameter(description = "Limit the number test definitions returned. (1 to 1000000, default = " + "10)") + @Parameter(description = "Limit the number test definitions returned. (1 to 1000000, default = 10)") @DefaultValue("10") @QueryParam("limit") @Min(0) @@ -238,7 +238,7 @@ public TestSuite getByName( content = @Content(mediaType = "application/json", schema = @Schema(implementation = TestSuite.class))), @ApiResponse( responseCode = "404", - description = "Test Suite for instance {id} and version {version} is " + "not found") + description = "Test Suite for instance {id} and version {version} is not found") }) public TestSuite getVersion( @Context UriInfo uriInfo, @@ -337,9 +337,7 @@ public Response updateDescription( content = @Content( mediaType = MediaType.APPLICATION_JSON_PATCH_JSON, - examples = { - @ExampleObject("[" + "{op:remove, path:/a}," + "{op:add, path: /b, value: val}" + "]") - })) + examples = {@ExampleObject("[{op:remove, path:/a},{op:add, path: /b, value: val}]")})) JsonPatch patch) { return patchInternal(uriInfo, securityContext, id, patch); } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/events/subscription/EventSubscriptionResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/events/subscription/EventSubscriptionResource.java index 5a0d45053d92..47323e7ba849 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/events/subscription/EventSubscriptionResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/events/subscription/EventSubscriptionResource.java @@ -164,7 +164,7 @@ public ResultList listEventSubscriptions( schema = @Schema(type = "string", example = FIELDS)) @QueryParam("fields") String fieldsParam, - @Parameter(description = "Limit the number event subscriptions returned. (1 to 1000000, default = " + "10) ") + @Parameter(description = "Limit the number event subscriptions returned. (1 to 1000000, default = 10) ") @DefaultValue("10") @Min(0) @Max(1000000) @@ -343,9 +343,7 @@ public Response patchEventSubscription( content = @Content( mediaType = MediaType.APPLICATION_JSON_PATCH_JSON, - examples = { - @ExampleObject("[" + "{op:remove, path:/a}," + "{op:add, path: /b, value: val}" + "]") - })) + examples = {@ExampleObject("[{op:remove, path:/a},{op:add, path: /b, value: val}]")})) JsonPatch patch) { Response response = patchInternal(uriInfo, securityContext, id, patch); repository.updateEventSubscription((EventSubscription) response.getEntity()); @@ -386,7 +384,7 @@ public EntityHistory listEventSubscriptionVersions( @Content(mediaType = "application/json", schema = @Schema(implementation = EventSubscription.class))), @ApiResponse( responseCode = "404", - description = "Event Subscription for instance {id} and version {version} is " + "not found") + description = "Event Subscription for instance {id} and version {version} is not found") }) public EventSubscription getEventSubscriptionVersion( @Context UriInfo uriInfo, diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/feeds/FeedResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/feeds/FeedResource.java index ac986541db00..97ed92ba4c2e 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/feeds/FeedResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/feeds/FeedResource.java @@ -303,9 +303,7 @@ public Response updateThread( content = @Content( mediaType = MediaType.APPLICATION_JSON_PATCH_JSON, - examples = { - @ExampleObject("[" + "{op:remove, path:/a}," + "{op:add, path: /b, value: val}" + "]") - })) + examples = {@ExampleObject("[{op:remove, path:/a},{op:add, path: /b, value: val}]")})) JsonPatch patch) { PatchResponse response = dao.patchThread(uriInfo, UUID.fromString(id), securityContext.getUserPrincipal().getName(), patch); @@ -416,9 +414,7 @@ public Response patchPost( content = @Content( mediaType = MediaType.APPLICATION_JSON_PATCH_JSON, - examples = { - @ExampleObject("[" + "{op:remove, path:/a}," + "{op:add, path: /b, value: val}" + "]") - })) + examples = {@ExampleObject("[{op:remove, path:/a},{op:add, path: /b, value: val}]")})) JsonPatch patch) { // validate and get thread & post Thread thread = dao.get(threadId); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/glossary/GlossaryResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/glossary/GlossaryResource.java index f40085ac4c04..80f99eaeaaee 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/glossary/GlossaryResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/glossary/GlossaryResource.java @@ -110,7 +110,7 @@ public ResultList list( schema = @Schema(type = "string", example = FIELDS)) @QueryParam("fields") String fieldsParam, - @Parameter(description = "Limit the number glossaries returned. (1 to 1000000, " + "default = 10)") + @Parameter(description = "Limit the number glossaries returned. (1 to 1000000, default = 10)") @DefaultValue("10") @Min(0) @Max(1000000) @@ -227,7 +227,7 @@ public EntityHistory listVersions( content = @Content(mediaType = "application/json", schema = @Schema(implementation = Glossary.class))), @ApiResponse( responseCode = "404", - description = "Glossary for instance {id} and version {version} is " + "not found") + description = "Glossary for instance {id} and version {version} is not found") }) public Glossary getVersion( @Context UriInfo uriInfo, @@ -276,9 +276,7 @@ public Response patch( content = @Content( mediaType = MediaType.APPLICATION_JSON_PATCH_JSON, - examples = { - @ExampleObject("[" + "{op:remove, path:/a}," + "{op:add, path: /b, value: val}" + "]") - })) + examples = {@ExampleObject("[{op:remove, path:/a},{op:add, path: /b, value: val}]")})) JsonPatch patch) { return patchInternal(uriInfo, securityContext, id, patch); } @@ -456,7 +454,6 @@ public static Glossary getGlossary(GlossaryRepository repository, CreateGlossary return repository .copy(new Glossary(), create, updatedBy) .withReviewers(getEntityReferences(Entity.USER, create.getReviewers())) - .withTags(create.getTags()) .withProvider(create.getProvider()) .withMutuallyExclusive(create.getMutuallyExclusive()); } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/glossary/GlossaryTermResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/glossary/GlossaryTermResource.java index c757a42aa329..82408625065e 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/glossary/GlossaryTermResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/glossary/GlossaryTermResource.java @@ -174,7 +174,7 @@ public ResultList list( schema = @Schema(type = "string", example = FIELDS)) @QueryParam("fields") String fieldsParam, - @Parameter(description = "Limit the number glossary terms returned. (1 to 1000000, " + "default = 10)") + @Parameter(description = "Limit the number glossary terms returned. (1 to 1000000, default = 10)") @DefaultValue("10") @Min(0) @Max(1000000) @@ -322,7 +322,7 @@ public EntityHistory listVersions( content = @Content(mediaType = "application/json", schema = @Schema(implementation = Glossary.class))), @ApiResponse( responseCode = "404", - description = "Glossary for instance {id} and version {version} is " + "not found") + description = "Glossary for instance {id} and version {version} is not found") }) public GlossaryTerm getVersion( @Context UriInfo uriInfo, @@ -371,9 +371,7 @@ public Response patch( content = @Content( mediaType = MediaType.APPLICATION_JSON_PATCH_JSON, - examples = { - @ExampleObject("[" + "{op:remove, path:/a}," + "{op:add, path: /b, value: val}" + "]") - })) + examples = {@ExampleObject("[{op:remove, path:/a},{op:add, path: /b, value: val}]")})) JsonPatch patch) { return patchInternal(uriInfo, securityContext, id, patch); } @@ -491,7 +489,6 @@ private GlossaryTerm getGlossaryTerm(CreateGlossaryTerm create, String user) { .withRelatedTerms(getEntityReferences(Entity.GLOSSARY_TERM, create.getRelatedTerms())) .withReferences(create.getReferences()) .withReviewers(getEntityReferences(Entity.USER, create.getReviewers())) - .withTags(create.getTags()) .withProvider(create.getProvider()) .withMutuallyExclusive(create.getMutuallyExclusive()); } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/kpi/KpiResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/kpi/KpiResource.java index 2a538479341d..9951f0828220 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/kpi/KpiResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/kpi/KpiResource.java @@ -108,7 +108,7 @@ public ResultList list( schema = @Schema(type = "string", example = FIELDS)) @QueryParam("fields") String fieldsParam, - @Parameter(description = "Limit the number of KIPs returned. (1 to 1000000, default = " + "10)") + @Parameter(description = "Limit the number of KIPs returned. (1 to 1000000, default = 10)") @DefaultValue("10") @QueryParam("limit") @Min(0) @@ -221,9 +221,7 @@ public Kpi getByName( responseCode = "200", description = "KPI", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Kpi.class))), - @ApiResponse( - responseCode = "404", - description = "KPI for instance {id} and version {version} is " + "not found") + @ApiResponse(responseCode = "404", description = "KPI for instance {id} and version {version} is not found") }) public Kpi getVersion( @Context UriInfo uriInfo, @@ -274,9 +272,7 @@ public Response patchKpi( content = @Content( mediaType = MediaType.APPLICATION_JSON_PATCH_JSON, - examples = { - @ExampleObject("[" + "{op:remove, path:/a}," + "{op:add, path: /b, value: val}" + "]") - })) + examples = {@ExampleObject("[{op:remove, path:/a},{op:add, path: /b, value: val}]")})) JsonPatch patch) { return patchInternal(uriInfo, securityContext, id, patch); } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/lineage/LineageResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/lineage/LineageResource.java index d29aa79b7ea8..c5633d659c11 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/lineage/LineageResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/lineage/LineageResource.java @@ -211,7 +211,7 @@ public Response deleteLineage( boolean deleted = dao.deleteLineage(fromEntity, fromId, toEntity, toId); if (!deleted) { return Response.status(NOT_FOUND) - .entity(new ErrorMessage(NOT_FOUND.getStatusCode(), "Lineage edge not " + "found")) + .entity(new ErrorMessage(NOT_FOUND.getStatusCode(), "Lineage edge not found")) .build(); } return Response.status(Status.OK).build(); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/mlmodels/MlModelResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/mlmodels/MlModelResource.java index 3267ed9f2316..3f7bb3576bf0 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/mlmodels/MlModelResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/mlmodels/MlModelResource.java @@ -65,7 +65,7 @@ @Path("/v1/mlmodels") @Tag( name = "ML Models", - description = "`Machine Learning Models` are algorithms trained on data to find patterns or " + "make predictions.") + description = "`Machine Learning Models` are algorithms trained on data to find patterns or make predictions.") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @Collection(name = "mlmodels") @@ -124,7 +124,7 @@ public ResultList list( schema = @Schema(type = "string", example = "airflow")) @QueryParam("service") String serviceParam, - @Parameter(description = "Limit the number models returned. (1 to 1000000, " + "default = 10)") + @Parameter(description = "Limit the number models returned. (1 to 1000000, default = 10)") @DefaultValue("10") @Min(0) @Max(1000000) @@ -244,9 +244,7 @@ public Response patch( content = @Content( mediaType = MediaType.APPLICATION_JSON_PATCH_JSON, - examples = { - @ExampleObject("[" + "{op:remove, path:/a}," + "{op:add, path: /b, value: val}" + "]") - })) + examples = {@ExampleObject("[{op:remove, path:/a},{op:add, path: /b, value: val}]")})) JsonPatch patch) { return patchInternal(uriInfo, securityContext, id, patch); } @@ -344,7 +342,7 @@ public EntityHistory listVersions( content = @Content(mediaType = "application/json", schema = @Schema(implementation = MlModel.class))), @ApiResponse( responseCode = "404", - description = "ML Model for instance {id} and version {version} is " + "not found") + description = "ML Model for instance {id} and version {version} is not found") }) public MlModel getVersion( @Context UriInfo uriInfo, @@ -450,7 +448,6 @@ private MlModel getMlModel(CreateMlModel create, String user) { .withMlStore(create.getMlStore()) .withServer(create.getServer()) .withTarget(create.getTarget()) - .withSourceUrl(create.getSourceUrl()) - .withTags(create.getTags()); + .withSourceUrl(create.getSourceUrl()); } } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/pipelines/PipelineResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/pipelines/PipelineResource.java index 4201e374d61f..e93e8834fbeb 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/pipelines/PipelineResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/pipelines/PipelineResource.java @@ -131,7 +131,7 @@ public ResultList list( schema = @Schema(type = "string", example = "airflow")) @QueryParam("service") String serviceParam, - @Parameter(description = "Limit the number pipelines returned. (1 to 1000000, " + "default = 10)") + @Parameter(description = "Limit the number pipelines returned. (1 to 1000000, default = 10)") @DefaultValue("10") @Min(0) @Max(1000000) @@ -249,7 +249,7 @@ public Pipeline getByName( content = @Content(mediaType = "application/json", schema = @Schema(implementation = Pipeline.class))), @ApiResponse( responseCode = "404", - description = "Pipeline for instance {id} and version {version} is " + "not found") + description = "Pipeline for instance {id} and version {version} is not found") }) public Pipeline getVersion( @Context UriInfo uriInfo, @@ -298,9 +298,7 @@ public Response updateDescription( content = @Content( mediaType = MediaType.APPLICATION_JSON_PATCH_JSON, - examples = { - @ExampleObject("[" + "{op:remove, path:/a}," + "{op:add, path: /b, value: val}" + "]") - })) + examples = {@ExampleObject("[{op:remove, path:/a},{op:add, path: /b, value: val}]")})) JsonPatch patch) { return patchInternal(uriInfo, securityContext, id, patch); } @@ -547,7 +545,6 @@ private Pipeline getPipeline(CreatePipeline create, String user) { .withService(getEntityReference(Entity.PIPELINE_SERVICE, create.getService())) .withTasks(create.getTasks()) .withSourceUrl(create.getSourceUrl()) - .withTags(create.getTags()) .withConcurrency(create.getConcurrency()) .withStartDate(create.getStartDate()) .withPipelineLocation(create.getPipelineLocation()) diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/policies/PolicyResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/policies/PolicyResource.java index c33d332f6839..6f2d05bdec0c 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/policies/PolicyResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/policies/PolicyResource.java @@ -75,7 +75,7 @@ @Path("/v1/policies") @Tag( name = "Policies", - description = "A `Policy` defines control that needs to be applied across different Data " + "Entities.") + description = "A `Policy` defines control that needs to be applied across different Data Entities.") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @Collection(name = "policies", order = 0) @@ -159,7 +159,7 @@ public ResultList list( schema = @Schema(type = "string", example = FIELDS)) @QueryParam("fields") String fieldsParam, - @Parameter(description = "Limit the number policies returned. (1 to 1000000, " + "default = 10)") + @Parameter(description = "Limit the number policies returned. (1 to 1000000, default = 10)") @DefaultValue("10") @Min(0) @Max(1000000) @@ -275,9 +275,7 @@ public EntityHistory listVersions( responseCode = "200", description = "policy", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Policy.class))), - @ApiResponse( - responseCode = "404", - description = "Policy for instance {id} and version {version} is" + " " + "not found") + @ApiResponse(responseCode = "404", description = "Policy for instance {id} and version {version} is not found") }) public Policy getVersion( @Context UriInfo uriInfo, @@ -347,9 +345,7 @@ public Response patch( content = @Content( mediaType = MediaType.APPLICATION_JSON_PATCH_JSON, - examples = { - @ExampleObject("[" + "{op:remove, path:/a}," + "{op:add, path: /b, value: val}" + "]") - })) + examples = {@ExampleObject("[{op:remove, path:/a},{op:add, path: /b, value: val}]")})) JsonPatch patch) { return patchInternal(uriInfo, securityContext, id, patch); } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/query/QueryResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/query/QueryResource.java index 108c21ed5285..64752ad72331 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/query/QueryResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/query/QueryResource.java @@ -57,7 +57,7 @@ @Path("/v1/queries") @Tag( name = "Queries", - description = "A `Query` entity represents a SQL query associated with data assets it is run " + "against.") + description = "A `Query` entity represents a SQL query associated with data assets it is run against.") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @Collection(name = "queries") @@ -118,7 +118,7 @@ public ResultList listQueries( @Parameter(description = "Filter Queries by service Fully Qualified Name", schema = @Schema(type = "string")) @QueryParam("service") String service, - @Parameter(description = "Limit the number queries returned. " + "(1 to 1000000, default = 10)") + @Parameter(description = "Limit the number queries returned. (1 to 1000000, default = 10)") @DefaultValue("10") @Min(0) @Max(1000000) @@ -221,9 +221,7 @@ public EntityHistory listVersions( responseCode = "200", description = "query", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Query.class))), - @ApiResponse( - responseCode = "404", - description = "query for instance {id} and version {version} is " + "not found") + @ApiResponse(responseCode = "404", description = "query for instance {id} and version {version} is not found") }) public Query getVersion( @Context UriInfo uriInfo, @@ -293,9 +291,7 @@ public Response patch( content = @Content( mediaType = MediaType.APPLICATION_JSON_PATCH_JSON, - examples = { - @ExampleObject("[" + "{op:remove, path:/a}," + "{op:add, path: /b, value: val}" + "]") - })) + examples = {@ExampleObject("[{op:remove, path:/a},{op:add, path: /b, value: val}]")})) JsonPatch patch) { return patchInternal(uriInfo, securityContext, id, patch); } @@ -405,7 +401,7 @@ public Response addQueryUsers( @Valid List userFqnList) { OperationContext operationContext = new OperationContext(entityType, MetadataOperation.EDIT_ALL); authorizer.authorize(securityContext, operationContext, getResourceContextById(id)); - return repository.AddQueryUser(uriInfo, securityContext.getUserPrincipal().getName(), id, userFqnList).toResponse(); + return repository.addQueryUser(uriInfo, securityContext.getUserPrincipal().getName(), id, userFqnList).toResponse(); } @PUT @@ -427,7 +423,8 @@ public Response addQueryUsedBy( @Valid List usedByList) { OperationContext operationContext = new OperationContext(entityType, MetadataOperation.EDIT_ALL); authorizer.authorize(securityContext, operationContext, getResourceContextById(id)); - return repository.AddQueryUsedBy(uriInfo, securityContext.getUserPrincipal().getName(), id, usedByList) + return repository + .addQueryUsedBy(uriInfo, securityContext.getUserPrincipal().getName(), id, usedByList) .toResponse(); } @@ -511,7 +508,6 @@ public Response delete( private Query getQuery(CreateQuery create, String user) { return repository .copy(new Query(), create, user) - .withTags(create.getTags()) .withQuery(create.getQuery()) .withService(getEntityReference(Entity.DATABASE_SERVICE, create.getService())) .withDuration(create.getDuration()) diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/search/SearchResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/search/SearchResource.java index 13fdffe71216..cc0770e0bcb7 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/search/SearchResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/search/SearchResource.java @@ -121,7 +121,7 @@ public Response search( @DefaultValue("_score") @QueryParam("sort_field") String sortFieldParam, - @Parameter(description = "Sort order asc for ascending or desc for descending, " + "defaults to desc") + @Parameter(description = "Sort order asc for ascending or desc for descending, defaults to desc") @DefaultValue("desc") @QueryParam("sort_order") String sortOrder, diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/searchindex/SearchIndexResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/searchindex/SearchIndexResource.java index 10f4c961406f..e4783987f574 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/searchindex/SearchIndexResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/searchindex/SearchIndexResource.java @@ -125,7 +125,7 @@ public ResultList list( schema = @Schema(type = "string", example = "ElasticSearchWestCoast")) @QueryParam("service") String serviceParam, - @Parameter(description = "Limit the number SearchIndexes returned. (1 to 1000000, default = " + "10)") + @Parameter(description = "Limit the number SearchIndexes returned. (1 to 1000000, default = 10)") @DefaultValue("10") @QueryParam("limit") @Min(0) @@ -242,7 +242,7 @@ public SearchIndex getByName( content = @Content(mediaType = "application/json", schema = @Schema(implementation = SearchIndex.class))), @ApiResponse( responseCode = "404", - description = "SearchIndex for instance {id} and version {version} is " + "not found") + description = "SearchIndex for instance {id} and version {version} is not found") }) public SearchIndex getVersion( @Context UriInfo uriInfo, @@ -291,9 +291,7 @@ public Response updateDescription( content = @Content( mediaType = MediaType.APPLICATION_JSON_PATCH_JSON, - examples = { - @ExampleObject("[" + "{op:remove, path:/a}," + "{op:add, path: /b, value: val}" + "]") - })) + examples = {@ExampleObject("[{op:remove, path:/a},{op:add, path: /b, value: val}]")})) JsonPatch patch) { return patchInternal(uriInfo, securityContext, id, patch); } @@ -494,7 +492,6 @@ private SearchIndex getSearchIndex(CreateSearchIndex create, String user) { .copy(new SearchIndex(), create, user) .withService(getEntityReference(Entity.SEARCH_SERVICE, create.getService())) .withFields(create.getFields()) - .withSearchIndexSettings(create.getSearchIndexSettings()) - .withTags(create.getTags()); + .withSearchIndexSettings(create.getSearchIndexSettings()); } } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/connections/TestConnectionDefinitionResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/connections/TestConnectionDefinitionResource.java index 468c1bd506af..f9c53c95fa4c 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/connections/TestConnectionDefinitionResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/connections/TestConnectionDefinitionResource.java @@ -98,8 +98,7 @@ public ResultList list( schema = @Schema(type = "string", example = FIELDS)) @QueryParam("fields") String fieldsParam, - @Parameter( - description = "Limit the number test connection definitions returned. (1 to 1000000, default = " + "10)") + @Parameter(description = "Limit the number test connection definitions returned. (1 to 1000000, default = 10)") @DefaultValue("10") @QueryParam("limit") @Min(0) diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/dashboard/DashboardServiceResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/dashboard/DashboardServiceResource.java index 7c0259b426fb..710322adaaa6 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/dashboard/DashboardServiceResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/dashboard/DashboardServiceResource.java @@ -266,14 +266,14 @@ public EntityHistory listVersions( @Content(mediaType = "application/json", schema = @Schema(implementation = DashboardService.class))), @ApiResponse( responseCode = "404", - description = "Dashboard service for instance {id} and version " + "{version} is not found") + description = "Dashboard service for instance {id} and version {version} is not found") }) public DashboardService getVersion( @Context UriInfo uriInfo, @Context SecurityContext securityContext, @Parameter(description = "Id of the dashboard service", schema = @Schema(type = "UUID")) @PathParam("id") UUID id, @Parameter( - description = "dashboard service version number in the form `major`" + ".`minor`", + description = "dashboard service version number in the form `major`.`minor`", schema = @Schema(type = "string", example = "0.1 or 1.1")) @PathParam("version") String version) { @@ -340,9 +340,7 @@ public Response patch( content = @Content( mediaType = MediaType.APPLICATION_JSON_PATCH_JSON, - examples = { - @ExampleObject("[" + "{op:remove, path:/a}," + "{op:add, path: /b, value: val}" + "]") - })) + examples = {@ExampleObject("[{op:remove, path:/a},{op:add, path: /b, value: val}]")})) JsonPatch patch) { return patchInternal(uriInfo, securityContext, id, patch); } @@ -353,10 +351,10 @@ public Response patch( operationId = "deleteDashboardService", summary = "Delete a dashboard service by Id", description = - "Delete a Dashboard services. If dashboard (and charts) belong to the service, it can't be " + "deleted.", + "Delete a Dashboard services. If dashboard (and charts) belong to the service, it can't be deleted.", responses = { @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "404", description = "DashboardService service for instance {id} " + "is not found") + @ApiResponse(responseCode = "404", description = "DashboardService service for instance {id} is not found") }) public Response delete( @Context UriInfo uriInfo, @@ -384,9 +382,7 @@ public Response delete( + "deleted.", responses = { @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse( - responseCode = "404", - description = "DashboardService service for instance {name} " + "is not found") + @ApiResponse(responseCode = "404", description = "DashboardService service for instance {name} is not found") }) public Response delete( @Context UriInfo uriInfo, diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/database/DatabaseServiceResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/database/DatabaseServiceResource.java index 0525938d5ba0..1b65f0398609 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/database/DatabaseServiceResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/database/DatabaseServiceResource.java @@ -281,14 +281,14 @@ public EntityHistory listVersions( @Content(mediaType = "application/json", schema = @Schema(implementation = DatabaseService.class))), @ApiResponse( responseCode = "404", - description = "Database service for instance {id} and version " + "{version} is not found") + description = "Database service for instance {id} and version {version} is not found") }) public DatabaseService getVersion( @Context UriInfo uriInfo, @Context SecurityContext securityContext, @Parameter(description = "Id of the database service", schema = @Schema(type = "UUID")) @PathParam("id") UUID id, @Parameter( - description = "database service version number in the form `major`" + ".`minor`", + description = "database service version number in the form `major`.`minor`", schema = @Schema(type = "string", example = "0.1 or 1.1")) @PathParam("version") String version) { @@ -355,9 +355,7 @@ public Response patch( content = @Content( mediaType = MediaType.APPLICATION_JSON_PATCH_JSON, - examples = { - @ExampleObject("[" + "{op:remove, path:/a}," + "{op:add, path: /b, value: val}" + "]") - })) + examples = {@ExampleObject("[{op:remove, path:/a},{op:add, path: /b, value: val}]")})) JsonPatch patch) { return patchInternal(uriInfo, securityContext, id, patch); } @@ -367,11 +365,10 @@ public Response patch( @Operation( operationId = "deleteDatabaseService", summary = "Delete a database service by Id", - description = - "Delete a database services. If databases (and tables) belong the service, it can't be " + "deleted.", + description = "Delete a database services. If databases (and tables) belong the service, it can't be deleted.", responses = { @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "404", description = "DatabaseService service for instance {id} " + "is not found") + @ApiResponse(responseCode = "404", description = "DatabaseService service for instance {id} is not found") }) public Response delete( @Context UriInfo uriInfo, @@ -399,9 +396,7 @@ public Response delete( + "deleted.", responses = { @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse( - responseCode = "404", - description = "DatabaseService service for instance {name} " + "is not found") + @ApiResponse(responseCode = "404", description = "DatabaseService service for instance {name} is not found") }) public Response delete( @Context UriInfo uriInfo, diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/ingestionpipelines/IngestionPipelineResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/ingestionpipelines/IngestionPipelineResource.java index 6f7d4a33ee4b..a7f9b5e2f02e 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/ingestionpipelines/IngestionPipelineResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/ingestionpipelines/IngestionPipelineResource.java @@ -167,7 +167,7 @@ public ResultList list( schema = @Schema(type = "string", example = "messagingService")) @QueryParam("serviceType") String serviceType, - @Parameter(description = "Limit the number ingestion returned. (1 to 1000000, " + "default = 10)") + @Parameter(description = "Limit the number ingestion returned. (1 to 1000000, default = 10)") @DefaultValue("10") @Min(0) @Max(1000000) @@ -275,7 +275,7 @@ public IngestionPipeline get( @Content(mediaType = "application/json", schema = @Schema(implementation = IngestionPipeline.class))), @ApiResponse( responseCode = "404", - description = "IngestionPipeline for instance {id} and version " + "{version} is not found") + description = "IngestionPipeline for instance {id} and version {version} is not found") }) public IngestionPipeline getVersion( @Context UriInfo uriInfo, @@ -371,9 +371,7 @@ public Response updateDescription( content = @Content( mediaType = MediaType.APPLICATION_JSON_PATCH_JSON, - examples = { - @ExampleObject("[" + "{op:remove, path:/a}," + "{op:add, path: /b, value: val}" + "]") - })) + examples = {@ExampleObject("[{op:remove, path:/a},{op:add, path: /b, value: val}]")})) JsonPatch patch) { Response response = patchInternal(uriInfo, securityContext, id, patch); decryptOrNullify(securityContext, (IngestionPipeline) response.getEntity(), false); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/messaging/MessagingServiceResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/messaging/MessagingServiceResource.java index 00828e304a51..6bc86ff8aa47 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/messaging/MessagingServiceResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/messaging/MessagingServiceResource.java @@ -107,7 +107,7 @@ public ResultList list( @Parameter(description = "Filter services by domain", schema = @Schema(type = "string", example = "Marketing")) @QueryParam("domain") String domain, - @Parameter(description = "Limit number services returned. (1 to 1000000, " + "default 10)") + @Parameter(description = "Limit number services returned. (1 to 1000000, default 10)") @DefaultValue("10") @Min(0) @Max(1000000) @@ -268,14 +268,14 @@ public EntityHistory listVersions( @Content(mediaType = "application/json", schema = @Schema(implementation = MessagingService.class))), @ApiResponse( responseCode = "404", - description = "Messaging service for instance {id} and version " + "{version} is not found") + description = "Messaging service for instance {id} and version {version} is not found") }) public MessagingService getVersion( @Context UriInfo uriInfo, @Context SecurityContext securityContext, @Parameter(description = "Id of the messaging service", schema = @Schema(type = "UUID")) @PathParam("id") UUID id, @Parameter( - description = "messaging service version number in the form `major`" + ".`minor`", + description = "messaging service version number in the form `major`.`minor`", schema = @Schema(type = "string", example = "0.1 or 1.1")) @PathParam("version") String version) { @@ -342,9 +342,7 @@ public Response patch( content = @Content( mediaType = MediaType.APPLICATION_JSON_PATCH_JSON, - examples = { - @ExampleObject("[" + "{op:remove, path:/a}," + "{op:add, path: /b, value: val}" + "]") - })) + examples = {@ExampleObject("[{op:remove, path:/a},{op:add, path: /b, value: val}]")})) JsonPatch patch) { return patchInternal(uriInfo, securityContext, id, patch); } @@ -354,10 +352,10 @@ public Response patch( @Operation( operationId = "deleteMessagingService", summary = "Delete a messaging service by Id", - description = "Delete a messaging service. If topics belong the service, it can't be " + "deleted.", + description = "Delete a messaging service. If topics belong the service, it can't be deleted.", responses = { @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "404", description = "MessagingService service for instance {id} " + "is not found") + @ApiResponse(responseCode = "404", description = "MessagingService service for instance {id} is not found") }) public Response delete( @Context UriInfo uriInfo, @@ -380,12 +378,10 @@ public Response delete( @Operation( operationId = "deleteMessagingServiceByName", summary = "Delete a messaging service by name", - description = "Delete a messaging service by `name`. If topics belong the service, it can't be " + "deleted.", + description = "Delete a messaging service by `name`. If topics belong the service, it can't be deleted.", responses = { @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse( - responseCode = "404", - description = "MessagingService service for instance {name} " + "is not found") + @ApiResponse(responseCode = "404", description = "MessagingService service for instance {name} is not found") }) public Response delete( @Context UriInfo uriInfo, diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/metadata/MetadataServiceResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/metadata/MetadataServiceResource.java index 5f5268225b4b..6f8ee0d69a7e 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/metadata/MetadataServiceResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/metadata/MetadataServiceResource.java @@ -311,14 +311,14 @@ public EntityHistory listVersions( @Content(mediaType = "application/json", schema = @Schema(implementation = MetadataService.class))), @ApiResponse( responseCode = "404", - description = "Metadata Service for instance {id} and version " + "{version} is not found") + description = "Metadata Service for instance {id} and version {version} is not found") }) public MetadataService getVersion( @Context UriInfo uriInfo, @Context SecurityContext securityContext, @Parameter(description = "Id of the metadata service", schema = @Schema(type = "UUID")) @PathParam("id") UUID id, @Parameter( - description = "Metadata Service version number in the form `major`" + ".`minor`", + description = "Metadata Service version number in the form `major`.`minor`", schema = @Schema(type = "string", example = "0.1 or 1.1")) @PathParam("version") String version) { @@ -385,9 +385,7 @@ public Response patch( content = @Content( mediaType = MediaType.APPLICATION_JSON_PATCH_JSON, - examples = { - @ExampleObject("[" + "{op:remove, path:/a}," + "{op:add, path: /b, value: val}" + "]") - })) + examples = {@ExampleObject("[{op:remove, path:/a},{op:add, path: /b, value: val}]")})) JsonPatch patch) { return patchInternal(uriInfo, securityContext, id, patch); } @@ -397,10 +395,10 @@ public Response patch( @Operation( operationId = "deleteMetadataService", summary = "Delete a metadata service by Id", - description = "Delete a metadata services. If some service belong the service, it can't be " + "deleted.", + description = "Delete a metadata services. If some service belong the service, it can't be deleted.", responses = { @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "404", description = "MetadataService service for instance {id} " + "is not found") + @ApiResponse(responseCode = "404", description = "MetadataService service for instance {id} is not found") }) public Response delete( @Context UriInfo uriInfo, @@ -423,13 +421,10 @@ public Response delete( @Operation( operationId = "deleteMetadataServiceByName", summary = "Delete a metadata service by name", - description = - "Delete a metadata services by `name`. If some service belong the service, it can't be " + "deleted.", + description = "Delete a metadata services by `name`. If some service belong the service, it can't be deleted.", responses = { @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse( - responseCode = "404", - description = "MetadataService service for instance {name} " + "is not found") + @ApiResponse(responseCode = "404", description = "MetadataService service for instance {name} is not found") }) public Response delete( @Context UriInfo uriInfo, diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/mlmodel/MlModelServiceResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/mlmodel/MlModelServiceResource.java index d9e19ff1c8aa..91d5766baad9 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/mlmodel/MlModelServiceResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/mlmodel/MlModelServiceResource.java @@ -122,7 +122,7 @@ public ResultList list( @Parameter(description = "Filter services by domain", schema = @Schema(type = "string", example = "Marketing")) @QueryParam("domain") String domain, - @Parameter(description = "Limit number services returned. (1 to 1000000, " + "default 10)") + @Parameter(description = "Limit number services returned. (1 to 1000000, default 10)") @DefaultValue("10") @Min(0) @Max(1000000) @@ -283,14 +283,14 @@ public EntityHistory listVersions( @Content(mediaType = "application/json", schema = @Schema(implementation = MlModelService.class))), @ApiResponse( responseCode = "404", - description = "MlModel service for instance {id} and version " + "{version} is not found") + description = "MlModel service for instance {id} and version {version} is not found") }) public MlModelService getVersion( @Context UriInfo uriInfo, @Context SecurityContext securityContext, @Parameter(description = "Id of the ML Model service", schema = @Schema(type = "UUID")) @PathParam("id") UUID id, @Parameter( - description = "mlModel service version number in the form `major`" + ".`minor`", + description = "mlModel service version number in the form `major`.`minor`", schema = @Schema(type = "string", example = "0.1 or 1.1")) @PathParam("version") String version) { @@ -357,9 +357,7 @@ public Response patch( content = @Content( mediaType = MediaType.APPLICATION_JSON_PATCH_JSON, - examples = { - @ExampleObject("[" + "{op:remove, path:/a}," + "{op:add, path: /b, value: val}" + "]") - })) + examples = {@ExampleObject("[{op:remove, path:/a},{op:add, path: /b, value: val}]")})) JsonPatch patch) { return patchInternal(uriInfo, securityContext, id, patch); } @@ -369,11 +367,10 @@ public Response patch( @Operation( operationId = "deleteMlModelService", summary = "Delete an ML model service by Id", - description = - "Delete a mlModel services. If mlModels (and tasks) belong to the service, it can't be " + "deleted.", + description = "Delete a mlModel services. If mlModels (and tasks) belong to the service, it can't be deleted.", responses = { @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "404", description = "MlModel service for instance {id} " + "is not found") + @ApiResponse(responseCode = "404", description = "MlModel service for instance {id} is not found") }) public Response delete( @Context UriInfo uriInfo, @@ -401,7 +398,7 @@ public Response delete( + "deleted.", responses = { @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "404", description = "MlModel service for instance {name} " + "is not found") + @ApiResponse(responseCode = "404", description = "MlModel service for instance {name} is not found") }) public Response delete( @Context UriInfo uriInfo, diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/pipeline/PipelineServiceResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/pipeline/PipelineServiceResource.java index c7ab1286f812..269e1a45dc0b 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/pipeline/PipelineServiceResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/pipeline/PipelineServiceResource.java @@ -120,7 +120,7 @@ public ResultList list( @Parameter(description = "Filter services by domain", schema = @Schema(type = "string", example = "Marketing")) @QueryParam("domain") String domain, - @Parameter(description = "Limit number services returned. (1 to 1000000, " + "default 10)") + @Parameter(description = "Limit number services returned. (1 to 1000000, default 10)") @DefaultValue("10") @Min(0) @Max(1000000) @@ -282,14 +282,14 @@ public EntityHistory listVersions( @Content(mediaType = "application/json", schema = @Schema(implementation = PipelineService.class))), @ApiResponse( responseCode = "404", - description = "Pipeline service for instance {id} and version " + "{version} is not found") + description = "Pipeline service for instance {id} and version {version} is not found") }) public PipelineService getVersion( @Context UriInfo uriInfo, @Context SecurityContext securityContext, @Parameter(description = "Id of the pipeline service", schema = @Schema(type = "UUID")) @PathParam("id") UUID id, @Parameter( - description = "pipeline service version number in the form `major`" + ".`minor`", + description = "pipeline service version number in the form `major`.`minor`", schema = @Schema(type = "string", example = "0.1 or 1.1")) @PathParam("version") String version) { @@ -356,9 +356,7 @@ public Response patch( content = @Content( mediaType = MediaType.APPLICATION_JSON_PATCH_JSON, - examples = { - @ExampleObject("[" + "{op:remove, path:/a}," + "{op:add, path: /b, value: val}" + "]") - })) + examples = {@ExampleObject("[{op:remove, path:/a},{op:add, path: /b, value: val}]")})) JsonPatch patch) { return patchInternal(uriInfo, securityContext, id, patch); } @@ -368,11 +366,10 @@ public Response patch( @Operation( operationId = "deletePipelineService", summary = "Delete a pipeline service by Id", - description = - "Delete a pipeline services. If pipelines (and tasks) belong to the service, it can't be " + "deleted.", + description = "Delete a pipeline services. If pipelines (and tasks) belong to the service, it can't be deleted.", responses = { @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "404", description = "Pipeline service for instance {id} " + "is not found") + @ApiResponse(responseCode = "404", description = "Pipeline service for instance {id} is not found") }) public Response delete( @Context UriInfo uriInfo, @@ -400,7 +397,7 @@ public Response delete( + "deleted.", responses = { @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "404", description = "Pipeline service for instance {fqn} " + "is not found") + @ApiResponse(responseCode = "404", description = "Pipeline service for instance {fqn} is not found") }) public Response delete( @Context UriInfo uriInfo, diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/searchIndexes/SearchServiceResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/searchIndexes/SearchServiceResource.java index ae7956a869e9..2ab8f18bc7a9 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/searchIndexes/SearchServiceResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/searchIndexes/SearchServiceResource.java @@ -262,14 +262,14 @@ public EntityHistory listVersions( content = @Content(mediaType = "application/json", schema = @Schema(implementation = SearchService.class))), @ApiResponse( responseCode = "404", - description = "Object store service for instance {id} and version " + "{version} is not found") + description = "Object store service for instance {id} and version {version} is not found") }) public SearchService getVersion( @Context UriInfo uriInfo, @Context SecurityContext securityContext, @Parameter(description = "search service Id", schema = @Schema(type = "string")) @PathParam("id") UUID id, @Parameter( - description = "search service version number in the form `major`" + ".`minor`", + description = "search service version number in the form `major`.`minor`", schema = @Schema(type = "string", example = "0.1 or 1.1")) @PathParam("version") String version) { @@ -334,9 +334,7 @@ public Response patch( content = @Content( mediaType = MediaType.APPLICATION_JSON_PATCH_JSON, - examples = { - @ExampleObject("[" + "{op:remove, path:/a}," + "{op:add, path: /b, value: val}" + "]") - })) + examples = {@ExampleObject("[{op:remove, path:/a},{op:add, path: /b, value: val}]")})) JsonPatch patch) { return patchInternal(uriInfo, securityContext, id, patch); } @@ -346,10 +344,10 @@ public Response patch( @Operation( operationId = "deleteSearchService", summary = "Delete an search service", - description = "Delete an search services. If containers belong the service, it can't be " + "deleted.", + description = "Delete an search services. If containers belong the service, it can't be deleted.", responses = { @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "404", description = "SearchService service for instance {id} " + "is not found") + @ApiResponse(responseCode = "404", description = "SearchService service for instance {id} is not found") }) public Response delete( @Context UriInfo uriInfo, diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/storage/StorageServiceResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/storage/StorageServiceResource.java index 9f4775f10e71..d0eb7daf388c 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/storage/StorageServiceResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/storage/StorageServiceResource.java @@ -56,7 +56,7 @@ @Path("/v1/services/storageServices") @Tag( name = "Object Store Services", - description = "APIs related `Object Store Service` entities, such as S3, GCS or " + "AZURE.") + description = "APIs related `Object Store Service` entities, such as S3, GCS or AZURE.") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @Collection(name = "storageServices") @@ -265,14 +265,14 @@ public EntityHistory listVersions( @Content(mediaType = "application/json", schema = @Schema(implementation = StorageService.class))), @ApiResponse( responseCode = "404", - description = "Object store service for instance {id} and version " + "{version} is not found") + description = "Object store service for instance {id} and version {version} is not found") }) public StorageService getVersion( @Context UriInfo uriInfo, @Context SecurityContext securityContext, @Parameter(description = "storage service Id", schema = @Schema(type = "string")) @PathParam("id") UUID id, @Parameter( - description = "storage service version number in the form `major`" + ".`minor`", + description = "storage service version number in the form `major`.`minor`", schema = @Schema(type = "string", example = "0.1 or 1.1")) @PathParam("version") String version) { @@ -339,9 +339,7 @@ public Response patch( content = @Content( mediaType = MediaType.APPLICATION_JSON_PATCH_JSON, - examples = { - @ExampleObject("[" + "{op:remove, path:/a}," + "{op:add, path: /b, value: val}" + "]") - })) + examples = {@ExampleObject("[{op:remove, path:/a},{op:add, path: /b, value: val}]")})) JsonPatch patch) { return patchInternal(uriInfo, securityContext, id, patch); } @@ -351,10 +349,10 @@ public Response patch( @Operation( operationId = "deleteStorageService", summary = "Delete an storage service", - description = "Delete an storage services. If containers belong the service, it can't be " + "deleted.", + description = "Delete an storage services. If containers belong the service, it can't be deleted.", responses = { @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "404", description = "StorageService service for instance {id} " + "is not found") + @ApiResponse(responseCode = "404", description = "StorageService service for instance {id} is not found") }) public Response delete( @Context UriInfo uriInfo, diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/storages/ContainerResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/storages/ContainerResource.java index 7308e6df5fec..7d4f3514f19a 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/storages/ContainerResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/storages/ContainerResource.java @@ -120,7 +120,7 @@ public ResultList list( @QueryParam("root") @DefaultValue("false") Boolean root, - @Parameter(description = "Limit the number containers returned. (1 to 1000000, " + "default = 10)") + @Parameter(description = "Limit the number containers returned. (1 to 1000000, default = 10)") @DefaultValue("10") @Min(0) @Max(1000000) @@ -242,9 +242,7 @@ public Response patch( content = @Content( mediaType = MediaType.APPLICATION_JSON_PATCH_JSON, - examples = { - @ExampleObject("[" + "{op:remove, path:/a}," + "{op:add, path: /b, value: val}" + "]") - })) + examples = {@ExampleObject("[{op:remove, path:/a},{op:add, path: /b, value: val}]")})) JsonPatch patch) { return patchInternal(uriInfo, securityContext, id, patch); } @@ -344,7 +342,7 @@ public EntityHistory listVersions( content = @Content(mediaType = "application/json", schema = @Schema(implementation = Container.class))), @ApiResponse( responseCode = "404", - description = "Container for instance {id} and version {version} is " + "not found") + description = "Container for instance {id} and version {version} is not found") }) public Container getVersion( @Context UriInfo uriInfo, @@ -449,7 +447,6 @@ private Container getContainer(CreateContainer create, String user) { .withNumberOfObjects(create.getNumberOfObjects()) .withSize(create.getSize()) .withFileFormats(create.getFileFormats()) - .withSourceUrl(create.getSourceUrl()) - .withTags(create.getTags()); + .withSourceUrl(create.getSourceUrl()); } } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/system/SystemResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/system/SystemResource.java index 624b74fa634d..6c7e509b3683 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/system/SystemResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/system/SystemResource.java @@ -163,9 +163,7 @@ public Response patch( content = @Content( mediaType = MediaType.APPLICATION_JSON_PATCH_JSON, - examples = { - @ExampleObject("[" + "{op:remove, path:/a}," + "{op:add, path: /b, value: val}" + "]") - })) + examples = {@ExampleObject("[{op:remove, path:/a},{op:add, path: /b, value: val}]")})) JsonPatch patch) { authorizer.authorizeAdmin(securityContext); return systemRepository.patchSetting(settingName, patch); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/tags/ClassificationResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/tags/ClassificationResource.java index 75d9eb197bfc..fc07f5c28efb 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/tags/ClassificationResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/tags/ClassificationResource.java @@ -112,7 +112,7 @@ public ResultList list( @QueryParam("fields") String fieldsParam, @Parameter(description = "Filter Disabled Classifications") @QueryParam("disabled") String disabled, - @Parameter(description = "Limit the number classifications returned. (1 to 1000000, default = " + "10) ") + @Parameter(description = "Limit the number classifications returned. (1 to 1000000, default = 10) ") @DefaultValue("10") @Min(0) @Max(1000000) @@ -234,7 +234,7 @@ public EntityHistory listVersions( @Content(mediaType = "application/json", schema = @Schema(implementation = Classification.class))), @ApiResponse( responseCode = "404", - description = "Classification for instance {id} and version {version} is " + "not found") + description = "Classification for instance {id} and version {version} is not found") }) public Classification getVersion( @Context UriInfo uriInfo, @@ -297,9 +297,7 @@ public Response patch( content = @Content( mediaType = MediaType.APPLICATION_JSON_PATCH_JSON, - examples = { - @ExampleObject("[" + "{op:remove, path:/a}," + "{op:add, path: /b, value: val}" + "]") - })) + examples = {@ExampleObject("[{op:remove, path:/a},{op:add, path: /b, value: val}]")})) JsonPatch patch) { return patchInternal(uriInfo, securityContext, id, patch); } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/tags/TagResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/tags/TagResource.java index 9965061c8c08..e38ffa13a558 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/tags/TagResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/tags/TagResource.java @@ -107,7 +107,7 @@ protected List getEntitySpecificOperations() { private void migrateTags() { // Just want to run it when upgrading to version above 0.13.1 where tag relationship are not there , once we have // any entries we don't need to run it - if (!(repository.getDaoCollection().relationshipDAO().findIfAnyRelationExist(CLASSIFICATION, TAG) > 0)) { + if (repository.getDaoCollection().relationshipDAO().findIfAnyRelationExist(CLASSIFICATION, TAG) <= 0) { // We are missing relationship for classification -> tag, and also tag -> tag (parent relationship) // Find tag definitions and load classifications from the json file, if necessary ClassificationRepository classificationRepository = @@ -227,7 +227,7 @@ public ResultList list( @QueryParam("disabled") @DefaultValue("false") Boolean disabled, - @Parameter(description = "Limit the number tags returned. (1 to 1000000, " + "default = 10)") + @Parameter(description = "Limit the number tags returned. (1 to 1000000, default = 10)") @DefaultValue("10") @Min(0) @Max(1000000) @@ -343,9 +343,7 @@ public EntityHistory listVersions( responseCode = "200", description = "tags", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Tag.class))), - @ApiResponse( - responseCode = "404", - description = "Tag for instance {id} and version {version} is " + "not found") + @ApiResponse(responseCode = "404", description = "Tag for instance {id} and version {version} is not found") }) public Tag getVersion( @Context UriInfo uriInfo, @@ -393,9 +391,7 @@ public Response patch( content = @Content( mediaType = MediaType.APPLICATION_JSON_PATCH_JSON, - examples = { - @ExampleObject("[" + "{op:remove, path:/a}," + "{op:add, path: /b, value: val}" + "]") - })) + examples = {@ExampleObject("[{op:remove, path:/a},{op:add, path: /b, value: val}]")})) JsonPatch patch) { return patchInternal(uriInfo, securityContext, id, patch); } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/teams/PersonaResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/teams/PersonaResource.java index 050f95c3137d..2b2690c3511a 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/teams/PersonaResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/teams/PersonaResource.java @@ -215,9 +215,7 @@ public Persona getByName( responseCode = "200", description = "Persona", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Persona.class))), - @ApiResponse( - responseCode = "404", - description = "Persona for instance {id} and version {version} is " + "not found") + @ApiResponse(responseCode = "404", description = "Persona for instance {id} and version {version} is not found") }) public Persona getVersion( @Context UriInfo uriInfo, @@ -283,9 +281,7 @@ public Response patch( content = @Content( mediaType = MediaType.APPLICATION_JSON_PATCH_JSON, - examples = { - @ExampleObject("[" + "{op:remove, path:/a}," + "{op:add, path: /b, value: val}" + "]") - })) + examples = {@ExampleObject("[{op:remove, path:/a},{op:add, path: /b, value: val}]")})) JsonPatch patch) { return patchInternal(uriInfo, securityContext, id, patch); } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/teams/RoleResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/teams/RoleResource.java index e7dcf4062958..b9b44dc293b6 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/teams/RoleResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/teams/RoleResource.java @@ -267,9 +267,7 @@ public Role getByName( responseCode = "200", description = "role", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Role.class))), - @ApiResponse( - responseCode = "404", - description = "Role for instance {id} and version {version} is " + "not found") + @ApiResponse(responseCode = "404", description = "Role for instance {id} and version {version} is not found") }) public Role getVersion( @Context UriInfo uriInfo, @@ -336,9 +334,7 @@ public Response patch( content = @Content( mediaType = MediaType.APPLICATION_JSON_PATCH_JSON, - examples = { - @ExampleObject("[" + "{op:remove, path:/a}," + "{op:add, path: /b, value: val}" + "]") - })) + examples = {@ExampleObject("[{op:remove, path:/a},{op:add, path: /b, value: val}]")})) JsonPatch patch) { return patchInternal(uriInfo, securityContext, id, patch); } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/teams/TeamResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/teams/TeamResource.java index 68bcfe325f3d..8a5287ce9951 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/teams/TeamResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/teams/TeamResource.java @@ -303,9 +303,7 @@ public Team getByName( responseCode = "200", description = "team", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Team.class))), - @ApiResponse( - responseCode = "404", - description = "Team for instance {id} and version {version} is " + "not found") + @ApiResponse(responseCode = "404", description = "Team for instance {id} and version {version} is not found") }) public Team getVersion( @Context UriInfo uriInfo, @@ -371,9 +369,7 @@ public Response patch( content = @Content( mediaType = MediaType.APPLICATION_JSON_PATCH_JSON, - examples = { - @ExampleObject("[" + "{op:remove, path:/a}," + "{op:add, path: /b, value: val}" + "]") - })) + examples = {@ExampleObject("[{op:remove, path:/a},{op:add, path: /b, value: val}]")})) JsonPatch patch) { return patchInternal(uriInfo, securityContext, id, patch); } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/teams/UserResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/teams/UserResource.java index c163fdbd0861..4e6ae01a1b66 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/teams/UserResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/teams/UserResource.java @@ -454,9 +454,7 @@ public Response logoutUser( responseCode = "200", description = "user", content = @Content(mediaType = "application/json", schema = @Schema(implementation = User.class))), - @ApiResponse( - responseCode = "404", - description = "User for instance {id} and version {version} is " + "not found") + @ApiResponse(responseCode = "404", description = "User for instance {id} and version {version} is not found") }) public User getVersion( @Context UriInfo uriInfo, @@ -712,9 +710,7 @@ public Response patch( content = @Content( mediaType = MediaType.APPLICATION_JSON_PATCH_JSON, - examples = { - @ExampleObject("[" + "{op:remove, path:/a}," + "{op:add, path: /b, value: val}" + "]") - })) + examples = {@ExampleObject("[{op:remove, path:/a},{op:add, path: /b, value: val}]")})) JsonPatch patch) { for (JsonValue patchOp : patch.toJsonArray()) { JsonObject patchOpObject = patchOp.asJsonObject(); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/topics/TopicResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/topics/TopicResource.java index ee54b3efdc22..6cdee199a07b 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/topics/TopicResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/topics/TopicResource.java @@ -126,7 +126,7 @@ public ResultList list( schema = @Schema(type = "string", example = "kafkaWestCoast")) @QueryParam("service") String serviceParam, - @Parameter(description = "Limit the number topics returned. (1 to 1000000, default = " + "10)") + @Parameter(description = "Limit the number topics returned. (1 to 1000000, default = 10)") @DefaultValue("10") @QueryParam("limit") @Min(0) @@ -240,9 +240,7 @@ public Topic getByName( responseCode = "200", description = "topic", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Topic.class))), - @ApiResponse( - responseCode = "404", - description = "Topic for instance {id} and version {version} is " + "not found") + @ApiResponse(responseCode = "404", description = "Topic for instance {id} and version {version} is not found") }) public Topic getVersion( @Context UriInfo uriInfo, @@ -291,9 +289,7 @@ public Response updateDescription( content = @Content( mediaType = MediaType.APPLICATION_JSON_PATCH_JSON, - examples = { - @ExampleObject("[" + "{op:remove, path:/a}," + "{op:add, path: /b, value: val}" + "]") - })) + examples = {@ExampleObject("[{op:remove, path:/a},{op:add, path: /b, value: val}]")})) JsonPatch patch) { return patchInternal(uriInfo, securityContext, id, patch); } @@ -501,7 +497,6 @@ private Topic getTopic(CreateTopic create, String user) { .withRetentionTime(create.getRetentionTime()) .withReplicationFactor(create.getReplicationFactor()) .withTopicConfig(create.getTopicConfig()) - .withSourceUrl(create.getSourceUrl()) - .withTags(create.getTags()); + .withSourceUrl(create.getSourceUrl()); } } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/types/TypeResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/types/TypeResource.java index 39a9597e36cc..e1c66d284b5e 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/types/TypeResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/types/TypeResource.java @@ -150,7 +150,7 @@ public ResultList list( schema = @Schema(type = "string", example = "Property, Entity")) @QueryParam("category") String categoryParam, - @Parameter(description = "Limit the number types returned. (1 to 1000000, " + "default = 10)") + @Parameter(description = "Limit the number types returned. (1 to 1000000, default = 10)") @DefaultValue("10") @Min(0) @Max(1000000) @@ -258,9 +258,7 @@ public EntityHistory listVersions( responseCode = "200", description = "types", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Type.class))), - @ApiResponse( - responseCode = "404", - description = "Type for instance {id} and version {version} is " + "not found") + @ApiResponse(responseCode = "404", description = "Type for instance {id} and version {version} is not found") }) public Type getVersion( @Context UriInfo uriInfo, @@ -308,9 +306,7 @@ public Response updateDescription( content = @Content( mediaType = MediaType.APPLICATION_JSON_PATCH_JSON, - examples = { - @ExampleObject("[" + "{op:remove, path:/a}," + "{op:add, path: /b, value: val}" + "]") - })) + examples = {@ExampleObject("[{op:remove, path:/a},{op:add, path: /b, value: val}]")})) JsonPatch patch) { return patchInternal(uriInfo, securityContext, id, patch); } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/usage/UsageResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/usage/UsageResource.java index 3a4879412154..b7ed9a748c8e 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/usage/UsageResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/usage/UsageResource.java @@ -87,13 +87,12 @@ public EntityUsage get( String entity, @Parameter(description = "Entity id", required = true, schema = @Schema(type = "string")) @PathParam("id") UUID id, - @Parameter( - description = "Usage for number of days going back from the given date " + "(default=1, min=1, max=30)") + @Parameter(description = "Usage for number of days going back from the given date (default=1, min=1, max=30)") @QueryParam("days") int days, @Parameter( description = - "Usage for number of days going back from this date in ISO 8601 format. " + "(default = currentDate)") + "Usage for number of days going back from this date in ISO 8601 format. (default = currentDate)") @QueryParam("date") String date) { OperationContext operationContext = new OperationContext(entity, MetadataOperation.VIEW_USAGE); @@ -133,13 +132,12 @@ public EntityUsage getByName( schema = @Schema(type = "string")) @PathParam("fqn") String fqn, - @Parameter( - description = "Usage for number of days going back from the given date " + "(default=1, min=1, max=30)") + @Parameter(description = "Usage for number of days going back from the given date (default=1, min=1, max=30)") @QueryParam("days") int days, @Parameter( description = - "Usage for number of days going back from this date in ISO 8601 format " + "(default = currentDate)") + "Usage for number of days going back from this date in ISO 8601 format (default = currentDate)") @QueryParam("date") String date) { OperationContext operationContext = new OperationContext(entity, MetadataOperation.VIEW_USAGE); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchClient.java b/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchClient.java index 534185b6e1bf..336ef0ec0f7d 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchClient.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchClient.java @@ -51,7 +51,7 @@ public interface SearchClient { boolean indexExists(String indexName); - boolean createIndex(IndexMapping indexMapping, String indexMappingContent); + void createIndex(IndexMapping indexMapping, String indexMappingContent); void updateIndex(IndexMapping indexMapping, String indexMappingContent); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchRepository.java index 4c6bba00e81a..9e32fd90645e 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchRepository.java @@ -32,7 +32,7 @@ import java.util.Map; import java.util.Objects; import java.util.Set; -import java.util.TreeMap; +import java.util.SortedMap; import javax.json.JsonObject; import javax.ws.rs.core.Response; import lombok.Getter; @@ -81,7 +81,6 @@ public class SearchRepository { AGGREGATED_COST_ANALYSIS_REPORT_DATA); public static final String ELASTIC_SEARCH_EXTENSION = "service.eventPublisher"; - public static final String ELASTIC_SEARCH_ENTITY_FQN_STREAM = "eventPublisher:ElasticSearch:STREAM"; public SearchRepository(ElasticSearchConfiguration config) { elasticSearchConfiguration = config; @@ -122,20 +121,20 @@ public ElasticSearchConfiguration.SearchType getSearchType() { } public void createIndexes() { - for (String entityType : entityIndexMap.keySet()) { - createIndex(entityIndexMap.get(entityType)); + for (IndexMapping indexMapping : entityIndexMap.values()) { + createIndex(indexMapping); } } public void updateIndexes() { - for (String entityType : entityIndexMap.keySet()) { - updateIndex(entityIndexMap.get(entityType)); + for (IndexMapping indexMapping : entityIndexMap.values()) { + updateIndex(indexMapping); } } public void dropIndexes() { - for (String entityType : entityIndexMap.keySet()) { - deleteIndex(entityIndexMap.get(entityType)); + for (IndexMapping indexMapping : entityIndexMap.values()) { + deleteIndex(indexMapping); } } @@ -521,7 +520,7 @@ public Response suggest(SearchRequest request) throws IOException { return searchClient.suggest(request); } - public TreeMap> getSortedDate( + public SortedMap> getSortedDate( String team, Long scheduleTime, Long currentTime, diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/search/elasticsearch/ElasticSearchClient.java b/openmetadata-service/src/main/java/org/openmetadata/service/search/elasticsearch/ElasticSearchClient.java index bfc9b5b35414..20b637588c5a 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/search/elasticsearch/ElasticSearchClient.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/search/elasticsearch/ElasticSearchClient.java @@ -192,7 +192,7 @@ public boolean indexExists(String indexName) { } @Override - public boolean createIndex(IndexMapping indexMapping, String indexMappingContent) { + public void createIndex(IndexMapping indexMapping, String indexMappingContent) { if (Boolean.TRUE.equals(isClientAvailable)) { try { CreateIndexRequest request = new CreateIndexRequest(indexMapping.getIndexName()); @@ -203,13 +203,10 @@ public boolean createIndex(IndexMapping indexMapping, String indexMappingContent createAliases(indexMapping); } catch (Exception e) { LOG.error("Failed to create Elastic Search indexes due to", e); - return false; } - return true; } else { LOG.error( "Failed to create Elastic Search index as client is not property configured, Please check your OpenMetadata configuration"); - return false; } } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/search/indexes/TableIndex.java b/openmetadata-service/src/main/java/org/openmetadata/service/search/indexes/TableIndex.java index afb41b6e2c1b..038312b7918a 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/search/indexes/TableIndex.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/search/indexes/TableIndex.java @@ -25,7 +25,7 @@ public class TableIndex implements ColumnIndex { "tableProfile", "joins", "changeDescription", - "viewDefinition, tableProfilerConfig, profile, location, tableQueries, " + "tests, dataModel"); + "viewDefinition, tableProfilerConfig, profile, location, tableQueries, tests, dataModel"); final Table table; diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/search/opensearch/OpenSearchClient.java b/openmetadata-service/src/main/java/org/openmetadata/service/search/opensearch/OpenSearchClient.java index 713166780b12..74ba3277b667 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/search/opensearch/OpenSearchClient.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/search/opensearch/OpenSearchClient.java @@ -185,7 +185,7 @@ public boolean indexExists(String indexName) { } @Override - public boolean createIndex(IndexMapping indexMapping, String indexMappingContent) { + public void createIndex(IndexMapping indexMapping, String indexMappingContent) { if (Boolean.TRUE.equals(isClientAvailable)) { try { CreateIndexRequest request = new CreateIndexRequest(indexMapping.getIndexName()); @@ -196,13 +196,10 @@ public boolean createIndex(IndexMapping indexMapping, String indexMappingContent createAliases(indexMapping); } catch (Exception e) { LOG.error("Failed to create Open Search indexes due to", e); - return false; } - return true; } else { LOG.error( "Failed to create Open Search index as client is not property configured, Please check your OpenMetadata configuration"); - return false; } } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/secrets/SecretsManager.java b/openmetadata-service/src/main/java/org/openmetadata/service/secrets/SecretsManager.java index b218e3eddc02..7990afc3d275 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/secrets/SecretsManager.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/secrets/SecretsManager.java @@ -128,7 +128,7 @@ public void encryptIngestionPipeline(IngestionPipeline ingestionPipeline) { public void decryptIngestionPipeline(IngestionPipeline ingestionPipeline) { OpenMetadataConnection openMetadataConnection = - decryptOpenMetadataConnection(ingestionPipeline.getOpenMetadataServerConnection(), true); + decryptOpenMetadataConnection(ingestionPipeline.getOpenMetadataServerConnection()); ingestionPipeline.setOpenMetadataServerConnection(null); // we don't store OM conn sensitive data IngestionPipelineBuilder.addDefinedConfig(ingestionPipeline); @@ -160,7 +160,7 @@ public Workflow encryptWorkflow(Workflow workflow) { public Workflow decryptWorkflow(Workflow workflow) { OpenMetadataConnection openMetadataConnection = - decryptOpenMetadataConnection(workflow.getOpenMetadataServerConnection(), true); + decryptOpenMetadataConnection(workflow.getOpenMetadataServerConnection()); Workflow workflowConverted = (Workflow) ClassConverterFactory.getConverter(Workflow.class).convert(workflow); // we don't store OM conn sensitive data workflowConverted.setOpenMetadataServerConnection(null); @@ -191,8 +191,7 @@ public OpenMetadataConnection encryptOpenMetadataConnection( return null; } - public OpenMetadataConnection decryptOpenMetadataConnection( - OpenMetadataConnection openMetadataConnection, boolean store) { + public OpenMetadataConnection decryptOpenMetadataConnection(OpenMetadataConnection openMetadataConnection) { if (openMetadataConnection != null) { OpenMetadataConnection openMetadataConnectionConverted = (OpenMetadataConnection) @@ -267,18 +266,10 @@ private Object decryptPasswordFields(Object toDecryptObject) { protected abstract String storeValue(String fieldName, String value, String secretId, boolean store); - protected String getSecretSeparator() { - return "/"; - } - - protected boolean startsWithSeparator() { - return true; - } - protected String buildSecretId(boolean addClusterPrefix, String... secretIdValues) { StringBuilder format = new StringBuilder(); if (addClusterPrefix) { - format.append(startsWithSeparator() ? getSecretSeparator() : ""); + format.append("/"); format.append(clusterPrefix); } else { format.append("%s"); @@ -291,7 +282,7 @@ protected String buildSecretId(boolean addClusterPrefix, String... secretIdValue if (isNull(secretIdValue)) { throw new SecretsManagerException("Cannot build a secret id with null values."); } - format.append(getSecretSeparator()); + format.append("/"); format.append("%s"); }); return String.format(format.toString(), (Object[]) secretIdValues).toLowerCase(); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/security/CatalogPrincipal.java b/openmetadata-service/src/main/java/org/openmetadata/service/security/CatalogPrincipal.java index b4d2bc082c42..3a34db2baca7 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/security/CatalogPrincipal.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/security/CatalogPrincipal.java @@ -25,6 +25,6 @@ public CatalogPrincipal(String name) { @Override public String toString() { - return "CatalogPrincipal{" + "name='" + name + '\'' + '}'; + return "CatalogPrincipal{name='" + name + '\'' + '}'; } } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/security/auth/BasicAuthenticator.java b/openmetadata-service/src/main/java/org/openmetadata/service/security/auth/BasicAuthenticator.java index a2be8c0da5c7..c1f66e63d95a 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/security/auth/BasicAuthenticator.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/security/auth/BasicAuthenticator.java @@ -96,7 +96,7 @@ public void init(OpenMetadataApplicationConfig config) { this.userRepository = (UserRepository) Entity.getEntityRepository(Entity.USER); this.tokenRepository = Entity.getTokenRepository(); this.authorizerConfiguration = config.getAuthorizerConfiguration(); - this.loginAttemptCache = new LoginAttemptCache(config); + this.loginAttemptCache = new LoginAttemptCache(); SmtpSettings smtpSettings = config.getSmtpSettings(); this.isEmailServiceEnabled = smtpSettings != null && smtpSettings.getEnableSmtpServer(); this.isSelfSignUpAvailable = config.getAuthenticationConfiguration().getEnableSelfSignup(); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/security/auth/LdapAuthenticator.java b/openmetadata-service/src/main/java/org/openmetadata/service/security/auth/LdapAuthenticator.java index ce44128eda06..fb915f06bfc1 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/security/auth/LdapAuthenticator.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/security/auth/LdapAuthenticator.java @@ -70,7 +70,7 @@ public void init(OpenMetadataApplicationConfig config) { this.userRepository = (UserRepository) Entity.getEntityRepository(Entity.USER); this.tokenRepository = Entity.getTokenRepository(); this.ldapConfiguration = config.getAuthenticationConfiguration().getLdapConfiguration(); - this.loginAttemptCache = new LoginAttemptCache(config); + this.loginAttemptCache = new LoginAttemptCache(); this.loginConfiguration = SettingsCache.getSetting(SettingsType.LOGIN_CONFIGURATION, LoginConfiguration.class); } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/security/auth/LoginAttemptCache.java b/openmetadata-service/src/main/java/org/openmetadata/service/security/auth/LoginAttemptCache.java index 273a75dff455..0ceb672d098c 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/security/auth/LoginAttemptCache.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/security/auth/LoginAttemptCache.java @@ -9,14 +9,13 @@ import org.jetbrains.annotations.NotNull; import org.openmetadata.schema.api.configuration.LoginConfiguration; import org.openmetadata.schema.settings.SettingsType; -import org.openmetadata.service.OpenMetadataApplicationConfig; import org.openmetadata.service.resources.settings.SettingsCache; public class LoginAttemptCache { private int maxAttempt = 3; private final LoadingCache attemptsCache; - public LoginAttemptCache(OpenMetadataApplicationConfig config) { + public LoginAttemptCache() { LoginConfiguration loginConfiguration = SettingsCache.getSetting(SettingsType.LOGIN_CONFIGURATION, LoginConfiguration.class); long accessBlockTime = 600; diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/security/saml/SamlSettingsHolder.java b/openmetadata-service/src/main/java/org/openmetadata/service/security/saml/SamlSettingsHolder.java index 75849c8dc975..5ca7d4ec76e9 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/security/saml/SamlSettingsHolder.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/security/saml/SamlSettingsHolder.java @@ -102,7 +102,7 @@ public void initDefaultSettings(OpenMetadataApplicationConfig catalogApplication samlData.put(SettingsBuilder.SECURITY_DIGEST_ALGORITHM, "http://www.w3.org/2001/04/xmlenc#sha256"); if (securityConfig.getSendSignedAuthRequest() || securityConfig.getWantAssertionEncrypted() - || securityConfig.getWantNameIdEncrypted()) { + || Boolean.TRUE.equals(securityConfig.getWantNameIdEncrypted())) { if (!CommonUtil.nullOrEmpty(securityConfig.getKeyStoreFilePath()) && !CommonUtil.nullOrEmpty(securityConfig.getKeyStorePassword()) && !CommonUtil.nullOrEmpty(securityConfig.getKeyStoreAlias())) { diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/socket/WebSocketManager.java b/openmetadata-service/src/main/java/org/openmetadata/service/socket/WebSocketManager.java index e7ffd56a4aed..b1205dbf89e4 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/socket/WebSocketManager.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/socket/WebSocketManager.java @@ -113,7 +113,7 @@ public void sendToOne(String username, String event, String message) { } } - public void sendToManyWithUUID(HashSet receivers, String event, String message) { + public void sendToManyWithUUID(Set receivers, String event, String message) { receivers.forEach(e -> sendToOne(e, event, message)); } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/util/AuthenticationMechanismBuilder.java b/openmetadata-service/src/main/java/org/openmetadata/service/util/AuthenticationMechanismBuilder.java index d09148ff0947..2ef96545ae94 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/util/AuthenticationMechanismBuilder.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/util/AuthenticationMechanismBuilder.java @@ -27,7 +27,7 @@ private AuthenticationMechanismBuilder() { } /** Build `AuthenticationMechanism` object with concrete class for the config which by definition it is a `Object`. */ - public static AuthenticationMechanism addDefinedConfig(AuthenticationMechanism authMechanism) { + public static void addDefinedConfig(AuthenticationMechanism authMechanism) { if (authMechanism != null) { if (JWT.equals(authMechanism.getAuthType())) { authMechanism.setConfig( @@ -37,6 +37,5 @@ public static AuthenticationMechanism addDefinedConfig(AuthenticationMechanism a ClassConverterFactory.getConverter(SSOAuthMechanism.class).convert(authMechanism.getConfig())); } } - return authMechanism; } } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/util/EntityUtil.java b/openmetadata-service/src/main/java/org/openmetadata/service/util/EntityUtil.java index 9fb94fb6f0ea..d9cc7b86bc06 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/util/EntityUtil.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/util/EntityUtil.java @@ -391,8 +391,8 @@ public static Double nextMajorVersion(Double version) { return Math.round((version + 1.0) * 10.0) / 10.0; } - public static EntityReference copy(EntityReference from, EntityReference to) { - return to.withType(from.getType()) + public static void copy(EntityReference from, EntityReference to) { + to.withType(from.getType()) .withId(from.getId()) .withName(from.getName()) .withDisplayName(from.getDisplayName()) diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/util/NotificationHandler.java b/openmetadata-service/src/main/java/org/openmetadata/service/util/NotificationHandler.java index 4b39bdfc2406..e21461b5ec87 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/util/NotificationHandler.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/util/NotificationHandler.java @@ -21,7 +21,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import freemarker.template.TemplateException; import java.io.IOException; -import java.net.URI; import java.time.Instant; import java.util.HashSet; import java.util.List; @@ -81,7 +80,7 @@ private void handleNotifications(ContainerResponseContext responseContext, Colle handleConversationNotification(thread, collectionDAO); break; case Announcement: - handleAnnouncementNotification(thread, collectionDAO); + handleAnnouncementNotification(thread); break; } } @@ -114,8 +113,7 @@ private void handleTaskNotification(Thread thread, CollectionDAO collectionDAO) } } - private void handleAnnouncementNotification(Thread thread, CollectionDAO collectionDAO) - throws JsonProcessingException { + private void handleAnnouncementNotification(Thread thread) throws JsonProcessingException { String jsonThread = mapper.writeValueAsString(thread); AnnouncementDetails announcementDetails = thread.getAnnouncement(); Long currentTimestamp = Instant.now().getEpochSecond(); @@ -155,7 +153,6 @@ private void handleConversationNotification(Thread thread, CollectionDAO collect private void handleEmailNotifications(HashSet userList, Thread thread) { UserRepository repository = (UserRepository) Entity.getEntityRepository(USER); - URI urlInstance = thread.getHref(); userList.forEach( id -> { try { diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/util/TablesInitializer.java b/openmetadata-service/src/main/java/org/openmetadata/service/util/TablesInitializer.java index f5bf8f52f691..0546363514ba 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/util/TablesInitializer.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/util/TablesInitializer.java @@ -56,10 +56,6 @@ public final class TablesInitializer { private static final String DEBUG_MODE_ENABLED = "debug_mode"; - private static final String OPTION_FLYWAY_SCRIPT_ROOT_PATH = "flyway-sql-root"; - - private static final String OPTION_NATIVE_SQL_ROOT_PATH = "native-sql-root"; - private static final String OPTION_EXTENSION_SQL_ROOT_PATH = "extension-sql-root"; private static final String OPTION_CONFIG_FILE_PATH = "config"; private static final String OPTION_FORCE_MIGRATIONS = "force"; private static final String DISABLE_VALIDATE_ON_MIGRATE = "disable-validate-on-migrate"; @@ -82,19 +78,19 @@ public final class TablesInitializer { null, SchemaMigrationOption.CHECK_CONNECTION.toString(), false, - "Check the connection for " + "configured data source"); + "Check the connection for configured data source"); OPTIONS.addOption( - null, SchemaMigrationOption.MIGRATE.toString(), false, "Execute schema migration from last " + "check point"); + null, SchemaMigrationOption.MIGRATE.toString(), false, "Execute schema migration from last check point"); OPTIONS.addOption( null, SchemaMigrationOption.INFO.toString(), false, - "Show the status of the schema migration " + "compared to the target database"); + "Show the status of the schema migration compared to the target database"); OPTIONS.addOption( null, SchemaMigrationOption.VALIDATE.toString(), false, - "Validate the target database changes " + "with the migration scripts"); + "Validate the target database changes with the migration scripts"); OPTIONS.addOption( null, SchemaMigrationOption.REPAIR.toString(), @@ -102,7 +98,7 @@ public final class TablesInitializer { "Repairs the DATABASE_CHANGE_LOG by " + "removing failed migrations and correcting checksum of existing migration script"); OPTIONS.addOption( - null, DISABLE_VALIDATE_ON_MIGRATE, false, "Disable flyway validation checks while running " + "migrate"); + null, DISABLE_VALIDATE_ON_MIGRATE, false, "Disable flyway validation checks while running migrate"); OPTIONS.addOption( null, SchemaMigrationOption.ES_CREATE.toString(), false, "Creates all the indexes in the elastic search"); OPTIONS.addOption( diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/pipelineService/PipelineServiceClientTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/pipelineService/PipelineServiceClientTest.java index cce419b22aca..aef5b1b59ea5 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/pipelineService/PipelineServiceClientTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/pipelineService/PipelineServiceClientTest.java @@ -38,12 +38,12 @@ public void testGetVersionFromStringRaises() { public void testBuildVersionMismatchErrorMessage() { String res = mockPipelineServiceClient.buildVersionMismatchErrorMessage("1.1.0.dev0", "1.0.0"); assertEquals( - res, - "Server version [1.0.0] is older than Ingestion Version [1.1.0.dev0]. Please upgrade your server or downgrade the ingestion client."); + "Server version [1.0.0] is older than Ingestion Version [1.1.0.dev0]. Please upgrade your server or downgrade the ingestion client.", + res); res = mockPipelineServiceClient.buildVersionMismatchErrorMessage("1.0.0.dev0", "1.0.1"); assertEquals( - res, - "Ingestion version [1.0.0.dev0] is older than Server Version [1.0.1]. Please upgrade your ingestion client."); + "Ingestion version [1.0.0.dev0] is older than Server Version [1.0.1]. Please upgrade your ingestion client.", + res); } } diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/resources/EntityResourceTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/resources/EntityResourceTest.java index 7dbfcec29e9c..a697da19a823 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/resources/EntityResourceTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/resources/EntityResourceTest.java @@ -2112,8 +2112,8 @@ public final T deleteAndCheckEntity(T entity, boolean recursive, boolean hardDel return deletedEntity; } - public final T deleteEntity(UUID id, Map authHeaders) throws HttpResponseException { - return deleteEntity(id, false, false, authHeaders); + public final void deleteEntity(UUID id, Map authHeaders) throws HttpResponseException { + deleteEntity(id, false, false, authHeaders); } public final T deleteEntity(UUID id, boolean recursive, boolean hardDelete, Map authHeaders) @@ -2227,14 +2227,13 @@ public T updateAndCheckEntity( return updated; } - protected final T restoreAndCheckEntity( + protected final void restoreAndCheckEntity( T entity, Map authHeaders, ChangeDescription changeDescription) throws IOException { T updated = restoreEntity(new RestoreEntity().withId(entity.getId()), Status.OK, authHeaders); validateLatestVersion(updated, MINOR_UPDATE, changeDescription, authHeaders); // GET the newly updated entity and validate T getEntity = getEntity(updated.getId(), authHeaders); validateChangeDescription(getEntity, MINOR_UPDATE, changeDescription); - return updated; } protected void validateEntityHistory( diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/resources/apps/AppsResourceTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/resources/apps/AppsResourceTest.java index bf3e8fa942c1..44940568228d 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/resources/apps/AppsResourceTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/resources/apps/AppsResourceTest.java @@ -31,7 +31,7 @@ public AppsResourceTest() { public CreateApp createRequest(String name) { // Create AppMarketPlaceDefinition AppMarketPlaceResourceTest appMarketPlaceResourceTest = new AppMarketPlaceResourceTest(); - AppMarketPlaceDefinition appMarketPlaceDefinition = null; + AppMarketPlaceDefinition appMarketPlaceDefinition; try { appMarketPlaceDefinition = appMarketPlaceResourceTest.getEntityByName(name, ADMIN_AUTH_HEADERS); } catch (EntityNotFoundException | HttpResponseException ex) { diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/resources/databases/DatabaseResourceTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/resources/databases/DatabaseResourceTest.java index c23ae1e0642a..dfcaecae9a66 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/resources/databases/DatabaseResourceTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/resources/databases/DatabaseResourceTest.java @@ -16,6 +16,7 @@ import static javax.ws.rs.core.Response.Status.BAD_REQUEST; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.openmetadata.common.utils.CommonUtil.nullOrEmpty; import static org.openmetadata.service.util.EntityUtil.getFqn; import static org.openmetadata.service.util.TestUtils.ADMIN_AUTH_HEADERS; import static org.openmetadata.service.util.TestUtils.assertListNotEmpty; @@ -87,7 +88,7 @@ void post_databaseWithDifferentService_200_ok(TestInfo test) throws IOException @Override public Database validateGetWithDifferentFields(Database database, boolean byName) throws HttpResponseException { // Add a schema if it already does not exist - if (database.getDatabaseSchemas() == null) { + if (nullOrEmpty(database.getDatabaseSchemas())) { DatabaseSchemaResourceTest databaseSchemaResourceTest = new DatabaseSchemaResourceTest(); CreateDatabaseSchema create = databaseSchemaResourceTest.createRequest("schema", "", "", null).withDatabase(getFqn(database)); diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/resources/databases/DatabaseSchemaResourceTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/resources/databases/DatabaseSchemaResourceTest.java index 1ab17198cc9a..0c58901ba55d 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/resources/databases/DatabaseSchemaResourceTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/resources/databases/DatabaseSchemaResourceTest.java @@ -16,6 +16,7 @@ import static javax.ws.rs.core.Response.Status.BAD_REQUEST; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.openmetadata.common.utils.CommonUtil.nullOrEmpty; import static org.openmetadata.service.util.TestUtils.ADMIN_AUTH_HEADERS; import static org.openmetadata.service.util.TestUtils.assertListNotNull; import static org.openmetadata.service.util.TestUtils.assertListNull; @@ -58,7 +59,7 @@ void post_schemaWithoutRequiredDatabase_400(TestInfo test) { public DatabaseSchema validateGetWithDifferentFields(DatabaseSchema schema, boolean byName) throws HttpResponseException { // Add tables to the database schema - if (schema.getTables() == null) { + if (nullOrEmpty(schema.getTables())) { TableResourceTest tableResourceTest = new TableResourceTest(); CreateTable create = tableResourceTest.createRequest("t1", "", "", null).withDatabaseSchema(schema.getFullyQualifiedName()); diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/resources/databases/TableResourceTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/resources/databases/TableResourceTest.java index bf850ebae01e..66639aae2ed3 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/resources/databases/TableResourceTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/resources/databases/TableResourceTest.java @@ -837,7 +837,7 @@ void put_tableJoinsInvalidColumnName_4xx(TestInfo test) throws IOException { invalidColumnFQN(invalidColumnFQN1)); // Invalid table name - String invalidColumnFQN2 = table2.getDatabase().getName() + ".invalidTable" + ".c1"; + String invalidColumnFQN2 = table2.getDatabase().getName() + ".invalidTable.c1"; TableJoins tableJoins2 = getTableJoins(getColumnJoin(C1, invalidColumnFQN2)); assertResponse( () -> putJoins(table1.getId(), tableJoins2, ADMIN_AUTH_HEADERS), @@ -958,7 +958,7 @@ void put_tableInvalidSampleData_4xx(TestInfo test) throws IOException { assertResponseContains( () -> putSampleData(table.getId(), tableData, ADMIN_AUTH_HEADERS), BAD_REQUEST, - "Number of columns is 3 but row " + "has 4 sample values"); + "Number of columns is 3 but row has 4 sample values"); // Send sample data that has fewer samples than the number of columns columns = Arrays.asList(C1, C2, C3); @@ -967,7 +967,7 @@ void put_tableInvalidSampleData_4xx(TestInfo test) throws IOException { assertResponseContains( () -> putSampleData(table.getId(), tableData, ADMIN_AUTH_HEADERS), BAD_REQUEST, - "Number of columns is 3 but row h" + "as 2 sample values"); + "Number of columns is 3 but row has 2 sample values"); } @Test @@ -1003,7 +1003,7 @@ void put_viewDefinition_invalid_table_4xx(TestInfo test) { assertResponseContains( () -> createAndCheckEntity(createTable, ADMIN_AUTH_HEADERS), BAD_REQUEST, - "ViewDefinition can only be set on " + "TableType View, SecureView or MaterializedView"); + "ViewDefinition can only be set on TableType View, SecureView or MaterializedView"); } @Test @@ -1417,13 +1417,13 @@ void createUpdateDeleteCustomMetrics(Table table, Map authHeader CreateCustomMetric createTableMetric = new CreateCustomMetric().withName("customTable").withExpression("SELECT SUM(xyz) + SUM(def) FROM abc"); Table tablePutResponse = putCustomMetric(table.getId(), createTableMetric, authHeaders); - assertEquals(tablePutResponse.getCustomMetrics().size(), 1); + assertEquals(1, tablePutResponse.getCustomMetrics().size()); // Add another table custom metric CreateCustomMetric createTableMetric2 = new CreateCustomMetric().withName("custom2Table").withExpression("SELECT SUM(xyz) / SUM(def) FROM abc"); tablePutResponse = putCustomMetric(table.getId(), createTableMetric2, authHeaders); - assertEquals(tablePutResponse.getCustomMetrics().size(), 2); + assertEquals(2, tablePutResponse.getCustomMetrics().size()); // check we can get the custom metrics Map customMetrics = @@ -1449,8 +1449,8 @@ void createUpdateDeleteCustomMetrics(Table table, Map authHeader // Delete table custom metric deleteTableCustomMetric(table.getId(), updatedTableMetric.getName(), authHeaders); table = getEntity(table.getId(), "customMetrics,columns", authHeaders); - assertEquals(table.getCustomMetrics().size(), 1); - assertEquals(table.getCustomMetrics().get(0).getName(), createTableMetric2.getName()); + assertEquals(1, table.getCustomMetrics().size()); + assertEquals(createTableMetric2.getName(), table.getCustomMetrics().get(0).getName()); } @Test @@ -2184,10 +2184,10 @@ public ResultList getColumnProfiles( return TestUtils.get(target, TableResource.ColumnProfileList.class, authHeaders); } - public ChangeEvent putTableQueriesData(UUID queryId, List data, Map authHeaders) + public void putTableQueriesData(UUID queryId, List data, Map authHeaders) throws HttpResponseException { WebTarget target = getResource(String.format("queries/%s/usage", queryId)); - return TestUtils.put(target, data, ChangeEvent.class, CREATED, authHeaders); + TestUtils.put(target, data, ChangeEvent.class, CREATED, authHeaders); } public List getTableQueriesData(UUID entityId, Map authHeaders) throws HttpResponseException { diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/resources/datainsight/DataInsightChartResourceTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/resources/datainsight/DataInsightChartResourceTest.java index b80b3a12dae8..535b2bce306b 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/resources/datainsight/DataInsightChartResourceTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/resources/datainsight/DataInsightChartResourceTest.java @@ -110,7 +110,7 @@ void get_data_insight_data_403() throws IOException, ParseException { true); } - /* We need elasticsearch to fecth data so we'll only test permission are + /* We need elasticsearch to fetch data, so we'll only test permission are * handled correctly in the request for a restricted user. * */ public void getDataInsightData( diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/resources/dqtests/TestCaseResourceTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/resources/dqtests/TestCaseResourceTest.java index 7c882ac93cc2..607b7dffb5a7 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/resources/dqtests/TestCaseResourceTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/resources/dqtests/TestCaseResourceTest.java @@ -363,7 +363,7 @@ void put_testCaseResults_200(TestInfo test) throws IOException, ParseException { // add a new test case to the logical test suite to validate if the // summary is updated correctly - testCaseIds.removeAll(testCaseIds); + testCaseIds.clear(); testCaseIds.add(testCase.getId()); testSuiteResourceTest.addTestCasesToLogicalTestSuite(logicalTestSuite, testCaseIds); @@ -418,7 +418,7 @@ void test_resultSummaryCascadeToAllSuites(TestInfo test) throws IOException, Par // test we get the right summary for the logical test suite TestSummary logicalTestSummary = getTestSummary(ADMIN_AUTH_HEADERS, logicalTestSuite.getId().toString()); assertEquals(1, logicalTestSummary.getTotal()); - testCaseIds.removeAll(testCaseIds); + testCaseIds.clear(); testCaseIds.add(testCase.getId()); testSuiteResourceTest.addTestCasesToLogicalTestSuite(logicalTestSuite, testCaseIds); logicalTestSummary = getTestSummary(ADMIN_AUTH_HEADERS, logicalTestSuite.getId().toString()); @@ -443,10 +443,8 @@ void test_resultSummaryCascadeToAllSuites(TestInfo test) throws IOException, Par // test suite deleteLogicalTestCase(logicalTestSuite, testCase.getId()); logicalTestSummary = getTestSummary(ADMIN_AUTH_HEADERS, logicalTestSuite.getId().toString()); - assertEquals( - null, - logicalTestSummary - .getTotal()); // check the deletion of the test case from the logical test suite is reflected in the summary + // check the deletion of the test case from the logical test suite is reflected in the summary + assertNull(logicalTestSummary.getTotal()); } @Test diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/resources/events/EventSubscriptionResourceTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/resources/events/EventSubscriptionResourceTest.java index 9b0eb1452742..db9172ce7c8d 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/resources/events/EventSubscriptionResourceTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/resources/events/EventSubscriptionResourceTest.java @@ -72,7 +72,7 @@ void post_alertActionWithEnabledStateChange(TestInfo test) throws IOException { CreateEventSubscription genericWebhookActionRequest = createRequest(webhookName).withEnabled(false).withSubscriptionConfig(genericWebhook); EventSubscription alert = createAndCheckEntity(genericWebhookActionRequest, ADMIN_AUTH_HEADERS); - // For the DISABLED Publisher are not available so it will have no status + // For the DISABLED Publisher are not available, so it will have no status SubscriptionStatus status = getStatus(alert.getId(), Response.Status.OK.getStatusCode()); assertEquals(DISABLED, status.getStatus()); WebhookCallbackResource.EventDetails details = webhookCallbackResource.getEventDetails(webhookName); diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/resources/kpi/KpiResourceTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/resources/kpi/KpiResourceTest.java index 6d7ab652a138..afa789ef3aa0 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/resources/kpi/KpiResourceTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/resources/kpi/KpiResourceTest.java @@ -57,7 +57,7 @@ public void setupKpi() throws IOException { DataInsightChartResourceTest dataInsightResourceTest = new DataInsightChartResourceTest(); CreateDataInsightChart chartRequest = dataInsightResourceTest - .createRequest(String.format("TestChart" + "%s", UUID.randomUUID())) + .createRequest(String.format("TestChart%s", UUID.randomUUID())) .withOwner(USER1_REF) .withDataIndexType(DataReportIndex.ENTITY_REPORT_DATA_INDEX) .withMetrics( diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/resources/pipelines/PipelineResourceTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/resources/pipelines/PipelineResourceTest.java index 8f99dbca3eaa..f10589160051 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/resources/pipelines/PipelineResourceTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/resources/pipelines/PipelineResourceTest.java @@ -654,10 +654,10 @@ public Pipeline putPipelineStatusData(String fqn, PipelineStatus data, Map authHeaders) + public void deletePipelineStatus(String fqn, Long timestamp, Map authHeaders) throws HttpResponseException { WebTarget target = getResource("pipelines/").path(fqn).path("/status/").path(String.valueOf(timestamp)); - return TestUtils.delete(target, Pipeline.class, authHeaders); + TestUtils.delete(target, Pipeline.class, authHeaders); } public ResultList getPipelineStatues( diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/resources/services/connections/TestConnectionDefinitionResourceTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/resources/services/connections/TestConnectionDefinitionResourceTest.java index 536cf01554da..1021378dd9af 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/resources/services/connections/TestConnectionDefinitionResourceTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/resources/services/connections/TestConnectionDefinitionResourceTest.java @@ -24,14 +24,14 @@ public class TestConnectionDefinitionResourceTest extends OpenMetadataApplicatio public void test_get_test_connection_definition() throws HttpResponseException { WebTarget target = getResourceByName(TEST_CONNECTION_NAME); TestConnectionDefinition mysqlTest = TestUtils.get(target, TestConnectionDefinition.class, ADMIN_AUTH_HEADERS); - assertEquals(mysqlTest.getName(), "Mysql"); - assertEquals(mysqlTest.getSteps().size(), 4); + assertEquals("Mysql", mysqlTest.getName()); + assertEquals(4, mysqlTest.getSteps().size()); WebTarget idTarget = getResourceById(mysqlTest.getId()); TestConnectionDefinition mysqlTestById = TestUtils.get(idTarget, TestConnectionDefinition.class, ADMIN_AUTH_HEADERS); - assertEquals(mysqlTestById.getName(), "Mysql"); - assertEquals(mysqlTestById.getSteps().size(), 4); + assertEquals("Mysql", mysqlTestById.getName()); + assertEquals(4, mysqlTestById.getSteps().size()); } @Test @@ -39,7 +39,7 @@ public void test_list_test_connection_definition() throws HttpResponseException WebTarget target = listResource(); ResultList testConnectionDefinitions = TestUtils.get(target, ResultList.class, ADMIN_AUTH_HEADERS); // we get 10 as it's the default paging size - assertEquals(testConnectionDefinitions.getData().size(), 10); + assertEquals(10, testConnectionDefinitions.getData().size()); } protected final WebTarget getResourceByName(String name) { diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/resources/teams/PersonaResourceTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/resources/teams/PersonaResourceTest.java index aa53389def75..c793c3891d2e 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/resources/teams/PersonaResourceTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/resources/teams/PersonaResourceTest.java @@ -16,6 +16,7 @@ import static javax.ws.rs.core.Response.Status.*; import static org.junit.jupiter.api.Assertions.*; import static org.openmetadata.common.utils.CommonUtil.listOrEmpty; +import static org.openmetadata.common.utils.CommonUtil.nullOrEmpty; import static org.openmetadata.service.Entity.*; import static org.openmetadata.service.exception.CatalogExceptionMessage.*; import static org.openmetadata.service.security.SecurityUtil.getPrincipalName; @@ -109,7 +110,7 @@ void delete_validPersona_200_OK(TestInfo test) throws IOException { // Ensure that the user does not have relationship to this persona User user = userResourceTest.getEntity(user1.getId(), "personas", ADMIN_AUTH_HEADERS); - assertEquals(user.getPersonas().size(), 0); + assertEquals(0, user.getPersonas().size()); } @Test @@ -195,7 +196,7 @@ private static void validatePersona( @Override public Persona validateGetWithDifferentFields(Persona expectedPersona, boolean byName) throws HttpResponseException { - if (expectedPersona.getUsers() == null) { + if (nullOrEmpty(expectedPersona.getUsers())) { UserResourceTest userResourceTest = new UserResourceTest(); CreateUser create = userResourceTest diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/resources/teams/RoleResourceTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/resources/teams/RoleResourceTest.java index 5497055378b2..400feff42f99 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/resources/teams/RoleResourceTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/resources/teams/RoleResourceTest.java @@ -16,6 +16,7 @@ import static javax.ws.rs.core.Response.Status.BAD_REQUEST; import static javax.ws.rs.core.Response.Status.FORBIDDEN; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.openmetadata.common.utils.CommonUtil.nullOrEmpty; import static org.openmetadata.service.exception.CatalogExceptionMessage.permissionNotAllowed; import static org.openmetadata.service.security.SecurityUtil.getPrincipalName; import static org.openmetadata.service.util.EntityUtil.fieldAdded; @@ -156,7 +157,7 @@ private static void validateRole( @Override public Role validateGetWithDifferentFields(Role role, boolean byName) throws HttpResponseException { // Assign two arbitrary users this role for testing. - if (role.getUsers() == null) { + if (nullOrEmpty(role.getUsers())) { UserResourceTest userResourceTest = new UserResourceTest(); userResourceTest.createEntity( userResourceTest.createRequest("roleUser1", "", "", null).withRoles(List.of(role.getId())), diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/resources/teams/TeamResourceTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/resources/teams/TeamResourceTest.java index 9f92844035a7..c94a520055b0 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/resources/teams/TeamResourceTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/resources/teams/TeamResourceTest.java @@ -23,6 +23,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import static org.openmetadata.common.utils.CommonUtil.listOf; import static org.openmetadata.common.utils.CommonUtil.listOrEmpty; +import static org.openmetadata.common.utils.CommonUtil.nullOrEmpty; import static org.openmetadata.csv.CsvUtil.recordToString; import static org.openmetadata.csv.EntityCsvTest.assertRows; import static org.openmetadata.csv.EntityCsvTest.assertSummary; @@ -836,7 +837,7 @@ private static void validateTeam( @Override public Team validateGetWithDifferentFields(Team expectedTeam, boolean byName) throws HttpResponseException { - if (expectedTeam.getUsers() == null) { + if (nullOrEmpty(expectedTeam.getUsers())) { UserResourceTest userResourceTest = new UserResourceTest(); CreateUser create = userResourceTest.createRequest("user", "", "", null).withTeams(List.of(expectedTeam.getId())); userResourceTest.createEntity(create, ADMIN_AUTH_HEADERS); diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/secrets/SecretsManagerLifecycleTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/secrets/SecretsManagerLifecycleTest.java index 90a0f3860a17..b381bc32ccc9 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/secrets/SecretsManagerLifecycleTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/secrets/SecretsManagerLifecycleTest.java @@ -66,7 +66,7 @@ void testDatabaseServiceConnectionConfigLifecycle() { // SM will have the key stored String secretValue = secretsManager.getSecret(secretName); - assertEquals(secretValue, DECRYPTED_VALUE); + assertEquals(DECRYPTED_VALUE, secretValue); // Now we delete the service secretsManager.deleteSecretsFromServiceConnectionConfig( @@ -114,7 +114,7 @@ void testWorkflowLifecycle() { // SM will have the key stored String secretValue = secretsManager.getSecret(secretName); - assertEquals(secretValue, DECRYPTED_VALUE); + assertEquals(DECRYPTED_VALUE, secretValue); // Now we delete the service secretsManager.deleteSecretsFromWorkflow(workflow); diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/secrets/masker/PasswordEntityMaskerTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/secrets/masker/PasswordEntityMaskerTest.java index 98276284d843..188ebfd328df 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/secrets/masker/PasswordEntityMaskerTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/secrets/masker/PasswordEntityMaskerTest.java @@ -25,10 +25,9 @@ void testExceptionConnection() { EntityMaskException thrown = Assertions.assertThrows( EntityMaskException.class, - () -> { - EntityMaskerFactory.createEntityMasker() - .maskServiceConnectionConfig(mysqlConnectionObject, "Mysql", ServiceType.DATABASE); - }); + () -> + EntityMaskerFactory.createEntityMasker() + .maskServiceConnectionConfig(mysqlConnectionObject, "Mysql", ServiceType.DATABASE)); Assertions.assertEquals( "Failed to mask 'Mysql' connection stored in DB due to an unrecognized field: 'username1'", @@ -37,11 +36,10 @@ void testExceptionConnection() { thrown = Assertions.assertThrows( EntityMaskException.class, - () -> { - EntityMaskerFactory.createEntityMasker() - .unmaskServiceConnectionConfig( - mysqlConnectionObject, new MysqlConnection(), "Mysql", ServiceType.DATABASE); - }); + () -> + EntityMaskerFactory.createEntityMasker() + .unmaskServiceConnectionConfig( + mysqlConnectionObject, new MysqlConnection(), "Mysql", ServiceType.DATABASE)); Assertions.assertEquals( "Failed to unmask 'Mysql' connection stored in DB due to an unrecognized field: 'username1'", diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/secrets/masker/TestEntityMasker.java b/openmetadata-service/src/test/java/org/openmetadata/service/secrets/masker/TestEntityMasker.java index b76495830f6a..e24977ca8a56 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/secrets/masker/TestEntityMasker.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/secrets/masker/TestEntityMasker.java @@ -62,9 +62,9 @@ void testAirflowConnectionMasker() { EntityMaskerFactory.createEntityMasker() .unmaskServiceConnectionConfig(masked, airflowConnection, "Airflow", ServiceType.PIPELINE); assertEquals( + PASSWORD, JsonUtils.convertValue(((MysqlConnection) unmasked.getConnection()).getAuthType(), basicAuth.class) - .getPassword(), - PASSWORD); + .getPassword()); } @Test @@ -80,7 +80,7 @@ void testBigQueryConnectionMasker() { (BigQueryConnection) EntityMaskerFactory.createEntityMasker() .unmaskServiceConnectionConfig(masked, bigQueryConnection, "BigQuery", ServiceType.DATABASE); - assertEquals(getPrivateKeyFromGcsConfig(unmasked.getCredentials()), PASSWORD); + assertEquals(PASSWORD, getPrivateKeyFromGcsConfig(unmasked.getCredentials())); } @Test @@ -97,7 +97,7 @@ void testDatalakeConnectionMasker() { (DatalakeConnection) EntityMaskerFactory.createEntityMasker() .unmaskServiceConnectionConfig(masked, datalakeConnection, "Datalake", ServiceType.DATABASE); - assertEquals(getPrivateKeyFromGcsConfig(((GCSConfig) unmasked.getConfigSource()).getSecurityConfig()), PASSWORD); + assertEquals(PASSWORD, getPrivateKeyFromGcsConfig(((GCSConfig) unmasked.getConfigSource()).getSecurityConfig())); } @Test @@ -116,13 +116,13 @@ void testDbtPipelineMasker() { getMaskedPassword()); EntityMaskerFactory.createEntityMasker().unmaskIngestionPipeline(dbtPipeline, originalDbtPipeline); assertEquals( + PASSWORD, getPrivateKeyFromGcsConfig( ((DbtGCSConfig) ((DbtPipeline) dbtPipeline.getSourceConfig().getConfig()).getDbtConfigSource()) - .getDbtSecurityConfig()), - PASSWORD); + .getDbtSecurityConfig())); assertEquals( - ((GoogleSSOClientConfig) dbtPipeline.getOpenMetadataServerConnection().getSecurityConfig()).getSecretKey(), - PASSWORD); + PASSWORD, + ((GoogleSSOClientConfig) dbtPipeline.getOpenMetadataServerConnection().getSecurityConfig()).getSecretKey()); } @Test @@ -140,9 +140,9 @@ void testSSOAuthenticationMechanismMasker() { EntityMaskerFactory.createEntityMasker() .unmaskAuthenticationMechanism("test", authenticationMechanism, originalSsoAuthenticationMechanism); assertEquals( + PASSWORD, ((GoogleSSOClientConfig) ((SSOAuthMechanism) authenticationMechanism.getConfig()).getAuthConfig()) - .getSecretKey(), - PASSWORD); + .getSecretKey()); } @Test @@ -174,9 +174,9 @@ void testSupersetConnectionMasker() { EntityMaskerFactory.createEntityMasker() .unmaskServiceConnectionConfig(masked, supersetConnection, "Superset", ServiceType.DASHBOARD); assertEquals( + PASSWORD, JsonUtils.convertValue(((MysqlConnection) unmasked.getConnection()).getAuthType(), basicAuth.class) - .getPassword(), - PASSWORD); + .getPassword()); } @Test @@ -205,17 +205,17 @@ void testWorkflowMasker() { getMaskedPassword()); Workflow unmasked = EntityMaskerFactory.createEntityMasker().unmaskWorkflow(masked, workflow); assertEquals( + PASSWORD, JsonUtils.convertValue( ((MysqlConnection) ((DatabaseConnection) ((TestServiceConnectionRequest) unmasked.getRequest()).getConnection()) .getConfig()) .getAuthType(), basicAuth.class) - .getPassword(), - PASSWORD); + .getPassword()); assertEquals( - ((GoogleSSOClientConfig) unmasked.getOpenMetadataServerConnection().getSecurityConfig()).getSecretKey(), - PASSWORD); + PASSWORD, + ((GoogleSSOClientConfig) unmasked.getOpenMetadataServerConnection().getSecurityConfig()).getSecretKey()); } @Test @@ -231,7 +231,7 @@ void testObjectMaskerWithoutACustomClassConverter() { (MysqlConnection) EntityMaskerFactory.createEntityMasker() .unmaskServiceConnectionConfig(masked, mysqlConnection, "Mysql", ServiceType.DATABASE); - assertEquals(JsonUtils.convertValue(unmasked.getAuthType(), basicAuth.class).getPassword(), PASSWORD); + assertEquals(PASSWORD, JsonUtils.convertValue(unmasked.getAuthType(), basicAuth.class).getPassword()); } protected String getMaskedPassword() { diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/security/policyevaluator/SubjectContextTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/security/policyevaluator/SubjectContextTest.java index 3b04c93f7755..b47aeeeb8ae9 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/security/policyevaluator/SubjectContextTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/security/policyevaluator/SubjectContextTest.java @@ -56,7 +56,6 @@ public class SubjectContextTest { private static List team12Roles; private static List team12Policies; - private static List team13Roles; private static List team13Policies; private static Team team13; @@ -64,7 +63,6 @@ public class SubjectContextTest { private static List team111Policies; private static Team team111; - private static List team131Roles; private static List team131Policies; private static Team team131; @@ -114,7 +112,7 @@ public static void setup() { team12Policies = getPolicies("team12"); Team team12 = createTeam("team12", team12Roles, team12Policies, List.of(team1)); - team13Roles = getRoles("team13"); + List team13Roles = getRoles("team13"); team13Policies = getPolicies("team13"); team13 = createTeam("team13", team13Roles, team13Policies, List.of(team1)); @@ -122,7 +120,7 @@ public static void setup() { team111Policies = getPolicies("team111"); team111 = createTeam("team111", team111Roles, team111Policies, List.of(team11, team12)); - team131Roles = getRoles("team131"); + List team131Roles = getRoles("team131"); team131Policies = getPolicies("team131"); team131 = createTeam("team131", team131Roles, team131Policies, List.of(team13)); diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/util/TestUtils.java b/openmetadata-service/src/test/java/org/openmetadata/service/util/TestUtils.java index 2cf54ced7648..a2b5375a599a 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/util/TestUtils.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/util/TestUtils.java @@ -514,25 +514,24 @@ public static void assertListNotNull(Object... values) { public static void assertListNotEmpty(List... values) { int index = 0; for (List value : values) { - Assertions.assertFalse(value.isEmpty(), "List at index " + index + "is empty"); + Assertions.assertFalse(value.isEmpty(), "List at index " + index + " is empty"); index++; } } - public static boolean validateAlphabeticalOrdering(List list, Comparator comparator) { + public static void validateAlphabeticalOrdering(List list, Comparator comparator) { Iterator iterator = listOrEmpty(list).iterator(); if (!iterator.hasNext()) { - return true; + return; } T prev = iterator.next(); while (iterator.hasNext()) { T next = iterator.next(); if (comparator.compare(prev, next) > 0) { - return false; + return; } prev = next; } - return true; } public static Long dateToTimestamp(String dateStr) throws ParseException { diff --git a/openmetadata-spec/src/main/resources/json/schema/configuration/authenticationConfiguration.json b/openmetadata-spec/src/main/resources/json/schema/configuration/authenticationConfiguration.json index bbfccb4b5aeb..c75f06b989a1 100644 --- a/openmetadata-spec/src/main/resources/json/schema/configuration/authenticationConfiguration.json +++ b/openmetadata-spec/src/main/resources/json/schema/configuration/authenticationConfiguration.json @@ -5,10 +5,26 @@ "description": "This schema defines the Authentication Configuration.", "type": "object", "javaType": "org.openmetadata.schema.api.security.AuthenticationConfiguration", + "definitions": { + "responseType": { + "javaType": "org.openmetadata.schema.api.security.ResponseType", + "description": "Response Type", + "type": "string", + "enum": [ + "id_token", + "code" + ], + "default": "id_token" + } + }, "properties": { "provider": { "$ref": "../entity/services/connections/metadata/openMetadataConnection.json#/definitions/authProvider" }, + "responseType": { + "description": "This is used by auth provider provide response as either id_token or code.", + "$ref": "#/definitions/responseType" + }, "providerName": { "description": "Custom OIDC Authentication Provider Name", "type": "string" diff --git a/openmetadata-ui/src/main/resources/ui/cypress/common/DomainUtils.js b/openmetadata-ui/src/main/resources/ui/cypress/common/DomainUtils.js index b17eff038c6c..6e6ba1d6fb75 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/common/DomainUtils.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/common/DomainUtils.js @@ -62,14 +62,16 @@ const checkDisplayName = (displayName) => { }); }; -const checkName = (name) => { - cy.get('[data-testid="entity-header-name"]') +const checkDataProductsCount = (dataProductsCount) => { + cy.get('[data-testid="data_products"] [data-testid="count"]') .scrollIntoView() - .should('exist') - .and('be.visible') - .within(() => { - cy.contains(name); - }); + .eq(dataProductsCount); +}; + +const checkAssetsCount = (assetsCount) => { + cy.get('[data-testid="assets"] [data-testid="count"]') + .scrollIntoView() + .eq(assetsCount); }; const updateOwner = (newOwner) => { @@ -277,6 +279,8 @@ export const createDomain = (domainObj, validate) => { cy.url().should('include', '/domain/'); checkDisplayName(domainObj.name); + checkAssetsCount(0); + checkDataProductsCount(0); }); }; @@ -290,7 +294,7 @@ export const deleteDomain = (domainObj) => { cy.get('[data-testid="delete-modal"] .ant-modal-title').should( 'contain', - `Delete ${domainObj.updatedName}` + `Delete ${domainObj.name}` ); cy.get('[data-testid="confirmation-text-input"]').type(DELETE_TERM); @@ -371,15 +375,13 @@ export const renameDomain = (domainObj) => { cy.get('[data-testid="manage-button"]').click(); cy.get('[data-testid="rename-button-details-container"]').click(); - cy.get('#name').should('not.be.disabled').clear(); + cy.get('#name').should('be.disabled'); cy.get('#displayName').should('not.be.disabled').clear(); - cy.get('#name').type(domainObj.updatedName); cy.get('#displayName').type(domainObj.updatedDisplayName); cy.get('[data-testid="save-button"]').click(); verifyResponseStatusCode('@patchName&DisplayName', 200); - checkName(domainObj.updatedName); checkDisplayName(domainObj.updatedDisplayName); }; diff --git a/openmetadata-ui/src/main/resources/ui/cypress/common/common.js b/openmetadata-ui/src/main/resources/ui/cypress/common/common.js index b7ebbb9be4e6..73462f18acda 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/common/common.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/common/common.js @@ -253,6 +253,7 @@ export const testServiceCreationAndIngestion = ({ testIngestionButton = true, serviceCategory, shouldAddIngestion = true, + allowTestConnection = true, }) => { // Storing the created service name and the type of service // Select Service in step 1 @@ -322,28 +323,30 @@ export const testServiceCreationAndIngestion = ({ interceptURL('GET', '/api/v1/automations/workflows/*', 'getWorkflow'); - cy.get('[data-testid="test-connection-btn"]').should('exist').click(); + if (allowTestConnection) { + cy.get('[data-testid="test-connection-btn"]').should('exist').click(); - verifyResponseStatusCode('@testConnectionStepDefinition', 200); + verifyResponseStatusCode('@testConnectionStepDefinition', 200); - verifyResponseStatusCode('@createWorkflow', 201); - // added extra buffer time as triggerWorkflow API can take up to 2minute to provide result - verifyResponseStatusCode('@triggerWorkflow', 200, { - responseTimeout: 120000, - }); - cy.get('[data-testid="test-connection-modal"]').should('exist'); - cy.get('.ant-modal-footer > .ant-btn-primary') - .should('exist') - .contains('OK') - .click(); - verifyResponseStatusCode('@getWorkflow', 200); - cy.get('[data-testid="messag-text"]').then(($message) => { - if ($message.text().includes('partially successful')) { - cy.contains('Test connection partially successful').should('exist'); - } else { - cy.contains('Connection test was successful').should('exist'); - } - }); + verifyResponseStatusCode('@createWorkflow', 201); + // added extra buffer time as triggerWorkflow API can take up to 2minute to provide result + verifyResponseStatusCode('@triggerWorkflow', 200, { + responseTimeout: 120000, + }); + cy.get('[data-testid="test-connection-modal"]').should('exist'); + cy.get('.ant-modal-footer > .ant-btn-primary') + .should('exist') + .contains('OK') + .click(); + verifyResponseStatusCode('@getWorkflow', 200); + cy.get('[data-testid="messag-text"]').then(($message) => { + if ($message.text().includes('partially successful')) { + cy.contains('Test connection partially successful').should('exist'); + } else { + cy.contains('Connection test was successful').should('exist'); + } + }); + } interceptURL( 'GET', '/api/v1/services/ingestionPipelines/status', @@ -1186,13 +1189,13 @@ export const addOwner = ( isGlossaryPage, isOwnerEmpty = false ) => { + interceptURL('GET', '/api/v1/users?limit=*&isBot=false', 'getUsers'); if (isGlossaryPage && isOwnerEmpty) { cy.get('[data-testid="glossary-owner-name"] > [data-testid="Add"]').click(); } else { cy.get('[data-testid="edit-owner"]').click(); } - interceptURL('GET', '/api/v1/users?limit=25&isBot=false', 'getUsers'); cy.get('.ant-tabs [id*=tab-users]').click(); verifyResponseStatusCode('@getUsers', 200); @@ -1265,7 +1268,6 @@ export const deleteEntity = ( entityName, serviceName, entity, - entityType, successMessageEntityName, deletionType = 'hard' ) => { @@ -1273,7 +1275,6 @@ export const deleteEntity = ( term: entityName, serviceName, entity, - entityType, }); cy.get('[data-testid="manage-button"]').click(); @@ -1417,7 +1418,7 @@ export const signupAndLogin = (email, password, firstName, lastName) => { // Login with the created user login(email, password); - cy.goToHomePage(true); + // cy.goToHomePage(true); cy.url().should('eq', `${BASE_URL}/my-data`); // Verify user profile diff --git a/openmetadata-ui/src/main/resources/ui/cypress/common/entityUtils.js b/openmetadata-ui/src/main/resources/ui/cypress/common/entityUtils.js index 7d784ead8922..a052e200c2a2 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/common/entityUtils.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/common/entityUtils.js @@ -174,3 +174,47 @@ export const createQueryByTableName = (token, table) => { }); }); }; + +/** + * Create a new user + */ +export const createUserEntity = ({ token, user }) => { + cy.request({ + method: 'POST', + url: `/api/v1/users/signup`, + headers: { Authorization: `Bearer ${token}` }, + body: user, + }).then((response) => { + user.id = response.body.id; + }); +}; + +/** + * Delete a user by id + */ +export const deleteUserEntity = ({ token, id }) => { + cy.request({ + method: 'DELETE', + url: `/api/v1/users/${id}?hardDelete=true&recursive=false`, + headers: { Authorization: `Bearer ${token}` }, + }); +}; + +/** + * Delete any entity by id + */ +export const deleteEntityById = ({ entityType, token, entityFqn }) => { + cy.request({ + method: 'GET', + url: `/api/v1/${entityType}/name/${entityFqn}`, + headers: { Authorization: `Bearer ${token}` }, + }).then((response) => { + cy.request({ + method: 'DELETE', + url: `/api/v1/${entityType}/${response.body.id}?hardDelete=true&recursive=true`, + headers: { Authorization: `Bearer ${token}` }, + }).then((response) => { + expect(response.status).to.eq(200); + }); + }); +}; diff --git a/openmetadata-ui/src/main/resources/ui/cypress/constants/entityConstant.js b/openmetadata-ui/src/main/resources/ui/cypress/constants/entityConstant.js index fa7e8143edcf..c9d270ba7818 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/constants/entityConstant.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/constants/entityConstant.js @@ -10,7 +10,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { uuid } from './constants'; +import { MYDATA_SUMMARY_OPTIONS, uuid } from './constants'; import { SERVICE_CATEGORIES } from './service.constants'; const DATABASE_SERVICE_NAME = `cy-database-service-${uuid()}`; @@ -267,23 +267,44 @@ export const DASHBOARD_DETAILS = { displayName: DASHBOARD_NAME, service: DASHBOARD_SERVICE_DETAILS.name, }; +export const DASHBOARD_CHART_DETAILS = { + name: 'dashboard-chart', + displayName: 'dashboard-chart', + service: DASHBOARD_SERVICE_DETAILS.name, +}; export const DASHBOARD_DATA_MODEL_DETAILS = { name: DASHBOARD_DATA_MODEL_NAME, displayName: DASHBOARD_DATA_MODEL_NAME, service: DASHBOARD_SERVICE_DETAILS.name, - columns: [], + columns: [ + { + name: 'country_name', + dataType: 'VARCHAR', + dataLength: 256, + dataTypeDisplay: 'varchar', + description: 'Name of the country.', + }, + ], dataModelType: 'SupersetDataModel', }; export const PIPELINE_DETAILS = { name: `cypress-pipeline-${uuid()}`, service: PIPELINE_SERVICE_DETAILS.name, + tasks: [{ name: 'snowflake_task' }], }; export const ML_MODEL_DETAILS = { name: `cypress-mlmodel-${uuid()}`, service: ML_MODEL_SERVICE_DETAILS.name, algorithm: 'Time Series', + mlFeatures: [ + { + name: 'sales', + dataType: 'numerical', + description: 'Sales amount', + }, + ], }; export const CONTAINER_DETAILS = { @@ -342,3 +363,63 @@ export const SINGLE_LEVEL_SERVICE = [ MLMODEL_SERVICE, STORAGE_SERVICE, ]; + +// visit entity details page object +export const VISIT_ENTITIES_DATA = { + table: { + term: DATABASE_SERVICE.tables.name, + displayName: DATABASE_SERVICE.tables.name, + entity: MYDATA_SUMMARY_OPTIONS.tables, + serviceName: DATABASE_SERVICE.service.name, + schemaName: DATABASE_SERVICE.schema.name, + entityType: 'Table', + }, + topic: { + term: MESSAGING_SERVICE.entity.name, + displayName: MESSAGING_SERVICE.entity.name, + entity: MYDATA_SUMMARY_OPTIONS.topics, + serviceName: MESSAGING_SERVICE.service.name, + entityType: 'Topic', + }, + dashboard: { + term: DASHBOARD_SERVICE.entity.name, + displayName: DASHBOARD_SERVICE.entity.name, + entity: MYDATA_SUMMARY_OPTIONS.dashboards, + serviceName: DASHBOARD_SERVICE.service.name, + entityType: 'Dashboard', + }, + pipeline: { + term: PIPELINE_SERVICE.entity.name, + displayName: PIPELINE_SERVICE.entity.name, + entity: MYDATA_SUMMARY_OPTIONS.pipelines, + serviceName: PIPELINE_SERVICE.service.name, + entityType: 'Pipeline', + }, + mlmodel: { + term: MLMODEL_SERVICE.entity.name, + displayName: MLMODEL_SERVICE.entity.name, + entity: MYDATA_SUMMARY_OPTIONS.mlmodels, + serviceName: MLMODEL_SERVICE.service.name, + entityType: 'ML Model', + }, + storedProcedure: { + term: STORED_PROCEDURE_DETAILS.name, + displayName: STORED_PROCEDURE_DETAILS.name, + entity: MYDATA_SUMMARY_OPTIONS.storedProcedures, + serviceName: DATABASE_SERVICE_DETAILS.name, + entityType: 'Stored Procedure', + }, + dataModel: { + term: DASHBOARD_DATA_MODEL_DETAILS.name, + entity: MYDATA_SUMMARY_OPTIONS.dataModel, + serviceName: DASHBOARD_DATA_MODEL_DETAILS.service, + displayName: DASHBOARD_DATA_MODEL_DETAILS.name, + entityType: 'Data Model', + }, + container: { + term: STORAGE_SERVICE.entity.name, + displayName: STORAGE_SERVICE.entity.name, + entity: 'containers', + serviceName: STORAGE_SERVICE.service.name, + }, +}; diff --git a/openmetadata-ui/src/main/resources/ui/cypress/constants/tagsAddRemove.constants.js b/openmetadata-ui/src/main/resources/ui/cypress/constants/tagsAddRemove.constants.js index 83419e0108f9..1aa4b20355d6 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/constants/tagsAddRemove.constants.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/constants/tagsAddRemove.constants.js @@ -1,3 +1,6 @@ +import { generateRandomTable } from '../common/entityUtils'; +import { DATABASE_SERVICE, VISIT_ENTITIES_DATA } from './entityConstant'; + /* * Copyright 2023 Collate. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -11,74 +14,55 @@ * limitations under the License. */ +export const TAGS_ADD_REMOVE_TABLE = generateRandomTable(); + export const TAGS_ADD_REMOVE_ENTITIES = [ { - term: 'marketing', - displayName: 'marketing', + term: TAGS_ADD_REMOVE_TABLE.name, + displayName: TAGS_ADD_REMOVE_TABLE.name, entity: 'tables', - serviceName: 'sample_data', - fieldName: 'SKU', + serviceName: DATABASE_SERVICE.service.name, + fieldName: TAGS_ADD_REMOVE_TABLE.columns[0].name, tags: ['PersonalData.Personal', 'PII.Sensitive'], permissionApi: '/api/v1/permissions/*/name/*', }, { - term: 'address_book', - displayName: 'address_book', - entity: 'topics', - serviceName: 'sample_kafka', - fieldName: 'AddressBook', + ...VISIT_ENTITIES_DATA.topic, + fieldName: 'first_name', tags: ['PersonalData.Personal', 'PII.Sensitive'], permissionApi: '/api/v1/permissions/*/name/*', }, { - term: 'deck.gl Demo', - displayName: 'deck.gl Demo', - entity: 'dashboards', + ...VISIT_ENTITIES_DATA.dashboard, insideEntity: 'charts', - serviceName: 'sample_superset', fieldName: 'e3cfd274-44f8-4bf3-b75d-d40cf88869ba', tags: ['PersonalData.Personal', 'PII.Sensitive'], permissionApi: '/api/v1/permissions/*/*', }, { - term: 'dim_address_etl', - displayName: 'dim_address etl', - entity: 'pipelines', - serviceName: 'sample_airflow', - fieldName: 'dim_address_task', + ...VISIT_ENTITIES_DATA.pipeline, + fieldName: 'snowflake_task', tags: ['PersonalData.Personal', 'PII.Sensitive'], permissionApi: '/api/v1/permissions/*/*', }, { - term: 'eta_predictions', - displayName: 'ETA Predictions', - entity: 'mlmodels', - serviceName: 'mlflow_svc', + ...VISIT_ENTITIES_DATA.mlmodel, fieldName: 'sales', tags: ['PersonalData.Personal', 'PII.Sensitive'], permissionApi: '/api/v1/permissions/*/*', }, { - term: 'engineering', - displayName: 'Engineering department', - entity: 'containers', - serviceName: 's3_storage_sample', + ...VISIT_ENTITIES_DATA.container, tags: ['PersonalData.Personal', 'PII.Sensitive'], permissionApi: '/api/v1/permissions/*/name/*', }, { - term: 'update_orders_table', - displayName: 'update_orders_table', - entity: 'storedProcedures', - serviceName: 'sample_data', + ...VISIT_ENTITIES_DATA.storedProcedure, tags: ['PersonalData.Personal', 'PII.Sensitive'], permissionApi: '/api/v1/permissions/*/name/*', }, { - term: 'orders_view', - displayName: 'orders_view', - entity: 'dashboardDataModel', - serviceName: 'sample_looker', + ...VISIT_ENTITIES_DATA.dataModel, tags: ['PersonalData.Personal', 'PII.Sensitive'], permissionApi: '/api/v1/permissions/*/name/*', }, diff --git a/openmetadata-ui/src/main/resources/ui/cypress/constants/voting.constant.js b/openmetadata-ui/src/main/resources/ui/cypress/constants/voting.constant.js deleted file mode 100644 index 062fa7667873..000000000000 --- a/openmetadata-ui/src/main/resources/ui/cypress/constants/voting.constant.js +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2023 Collate. - * 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 - * http://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. - */ - -export const VOTING_ENTITIES = [ - { - term: 'marketing', - displayName: 'marketing', - entity: 'tables', - serviceName: 'sample_data', - fieldName: 'SKU', - permissionApi: '/api/v1/permissions/*/name/*', - }, - { - term: 'address_book', - displayName: 'address_book', - entity: 'topics', - serviceName: 'sample_kafka', - fieldName: 'AddressBook', - permissionApi: '/api/v1/permissions/*/name/*', - }, - { - term: 'deck.gl Demo', - displayName: 'deck.gl Demo', - entity: 'dashboards', - insideEntity: 'charts', - serviceName: 'sample_superset', - fieldName: 'e3cfd274-44f8-4bf3-b75d-d40cf88869ba', - permissionApi: '/api/v1/permissions/*/*', - }, - { - term: 'dim_address_etl', - displayName: 'dim_address etl', - entity: 'pipelines', - serviceName: 'sample_airflow', - fieldName: 'dim_address_task', - permissionApi: '/api/v1/permissions/*/*', - }, - { - term: 'eta_predictions', - displayName: 'ETA Predictions', - entity: 'mlmodels', - serviceName: 'mlflow_svc', - fieldName: 'sales', - permissionApi: '/api/v1/permissions/*/*', - }, - { - term: 'update_orders_table', - displayName: 'update_orders_table', - entity: 'storedProcedures', - serviceName: 'sample_data', - permissionApi: '/api/v1/permissions/*/name/*', - }, - { - term: 'orders_view', - displayName: 'orders_view', - entity: 'dashboardDataModel', - serviceName: 'sample_looker', - permissionApi: '/api/v1/permissions/*/name/*', - }, -]; diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Features/DataConsumerRole.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Features/DataConsumerRole.spec.js index fbe440d30e58..f9af5a82b8c4 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Features/DataConsumerRole.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Features/DataConsumerRole.spec.js @@ -21,13 +21,18 @@ import { visitEntityDetailsPage, } from '../../common/common'; import { - BASE_URL, - SEARCH_ENTITY_DASHBOARD, - SEARCH_ENTITY_PIPELINE, - SEARCH_ENTITY_TABLE, - SEARCH_ENTITY_TOPIC, -} from '../../constants/constants'; + createEntityTable, + createSingleLevelEntity, + hardDeleteService, +} from '../../common/entityUtils'; +import { BASE_URL } from '../../constants/constants'; +import { + DATABASE_SERVICE, + SINGLE_LEVEL_SERVICE, + VISIT_ENTITIES_DATA, +} from '../../constants/entityConstant'; import { NAVBAR_DETAILS } from '../../constants/redirections.constants'; +import { SERVICE_CATEGORIES } from '../../constants/service.constants'; const CREDENTIALS = { firstName: 'Test_Data_Consumer', @@ -35,13 +40,13 @@ const CREDENTIALS = { email: `test_dataconsumer${uuid()}@openmetadata.org`, password: 'User@OMD123', }; - +const { dashboard, pipeline, table, topic } = VISIT_ENTITIES_DATA; const policy = 'Data Consumer'; const ENTITIES = { - table: SEARCH_ENTITY_TABLE.table_2, - topic: SEARCH_ENTITY_TOPIC.topic_1, - dashboard: SEARCH_ENTITY_DASHBOARD.dashboard_1, - pipeline: SEARCH_ENTITY_PIPELINE.pipeline_1, + dashboard, + pipeline, + table, + topic, }; const glossary = NAVBAR_DETAILS.glossary; @@ -119,6 +124,49 @@ const PERMISSIONS = { }; describe('DataConsumer Edit policy should work properly', () => { + before(() => { + cy.login(); + cy.getAllLocalStorage().then((data) => { + const token = Object.values(data)[0].oidcIdToken; + + createEntityTable({ + token, + ...DATABASE_SERVICE, + tables: [DATABASE_SERVICE.tables], + }); + SINGLE_LEVEL_SERVICE.forEach((data) => { + createSingleLevelEntity({ + token, + ...data, + entity: [data.entity], + }); + }); + }); + cy.logout(); + }); + + after(() => { + Cypress.session.clearAllSavedSessions(); + cy.login(); + cy.getAllLocalStorage().then((data) => { + const token = Object.values(data)[0].oidcIdToken; + + hardDeleteService({ + token, + serviceFqn: DATABASE_SERVICE.service.name, + serviceType: SERVICE_CATEGORIES.DATABASE_SERVICES, + }); + SINGLE_LEVEL_SERVICE.forEach((data) => { + hardDeleteService({ + token, + serviceFqn: data.service.name, + serviceType: data.serviceType, + }); + }); + }); + deleteUser(CREDENTIALS.id); + }); + it('Create a new account and assign Data consumer role to the user', () => { signupAndLogin( CREDENTIALS.email, @@ -263,14 +311,3 @@ describe('DataConsumer Edit policy should work properly', () => { }); }); }); - -describe('Cleanup', () => { - beforeEach(() => { - Cypress.session.clearAllSavedSessions(); - cy.login(); - }); - - it('delete user', () => { - deleteUser(CREDENTIALS.id); - }); -}); diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Features/Following.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Features/Following.spec.js index 599cd948ea70..e341a322d35a 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Features/Following.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Features/Following.spec.js @@ -16,27 +16,31 @@ import { visitEntityDetailsPage, } from '../../common/common'; import { - SEARCH_ENTITY_DASHBOARD, - SEARCH_ENTITY_DATA_MODEL, - SEARCH_ENTITY_MLMODEL, - SEARCH_ENTITY_PIPELINE, - SEARCH_ENTITY_STORED_PROCEDURE, - SEARCH_ENTITY_TABLE, - SEARCH_ENTITY_TOPIC, -} from '../../constants/constants'; + createEntityTable, + createSingleLevelEntity, + hardDeleteService, +} from '../../common/entityUtils'; +import { + DASHBOARD_DATA_MODEL_DETAILS, + DATABASE_SERVICE, + SINGLE_LEVEL_SERVICE, + STORED_PROCEDURE_DETAILS, + VISIT_ENTITIES_DATA, +} from '../../constants/entityConstant'; +import { SERVICE_CATEGORIES } from '../../constants/service.constants'; // eslint-disable-next-line spaced-comment /// // Update list if we support this for other entities too const FOLLOWING_ENTITIES = [ - SEARCH_ENTITY_TABLE.table_2, - SEARCH_ENTITY_DASHBOARD.dashboard_1, - SEARCH_ENTITY_TOPIC.topic_1, - SEARCH_ENTITY_PIPELINE.pipeline_1, - SEARCH_ENTITY_MLMODEL.mlmodel_2, - SEARCH_ENTITY_STORED_PROCEDURE.stored_procedure_2, - SEARCH_ENTITY_DATA_MODEL.data_model_2, + VISIT_ENTITIES_DATA.table, + VISIT_ENTITIES_DATA.dashboard, + VISIT_ENTITIES_DATA.topic, + VISIT_ENTITIES_DATA.pipeline, + VISIT_ENTITIES_DATA.mlmodel, + VISIT_ENTITIES_DATA.storedProcedure, + VISIT_ENTITIES_DATA.dataModel, ]; const followEntity = ({ term, serviceName, entity }, isUnfollow) => { @@ -72,6 +76,61 @@ const followEntity = ({ term, serviceName, entity }, isUnfollow) => { }; describe('Following data assets', () => { + before(() => { + cy.login(); + cy.getAllLocalStorage().then((data) => { + const token = Object.values(data)[0].oidcIdToken; + + createEntityTable({ + token, + ...DATABASE_SERVICE, + tables: [DATABASE_SERVICE.tables], + }); + SINGLE_LEVEL_SERVICE.forEach((data) => { + createSingleLevelEntity({ + token, + ...data, + entity: [data.entity], + }); + }); + + // creating data model + cy.request({ + method: 'POST', + url: `/api/v1/dashboard/datamodels`, + headers: { Authorization: `Bearer ${token}` }, + body: DASHBOARD_DATA_MODEL_DETAILS, + }); + // creating stored procedure + cy.request({ + method: 'POST', + url: `/api/v1/storedProcedures`, + headers: { Authorization: `Bearer ${token}` }, + body: STORED_PROCEDURE_DETAILS, + }); + }); + }); + + after(() => { + cy.login(); + cy.getAllLocalStorage().then((data) => { + const token = Object.values(data)[0].oidcIdToken; + + hardDeleteService({ + token, + serviceFqn: DATABASE_SERVICE.service.name, + serviceType: SERVICE_CATEGORIES.DATABASE_SERVICES, + }); + SINGLE_LEVEL_SERVICE.forEach((data) => { + hardDeleteService({ + token, + serviceFqn: data.service.name, + serviceType: data.serviceType, + }); + }); + }); + }); + beforeEach(() => { cy.login(); cy.get("[data-testid='welcome-screen-close-btn']").click(); diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Features/RecentlyViewed.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Features/RecentlyViewed.spec.js index 88b547948ed4..f44cd387983e 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Features/RecentlyViewed.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Features/RecentlyViewed.spec.js @@ -16,28 +16,80 @@ import { visitEntityDetailsPage, } from '../../common/common'; import { - SEARCH_ENTITY_DASHBOARD, - SEARCH_ENTITY_MLMODEL, - SEARCH_ENTITY_PIPELINE, - SEARCH_ENTITY_STORED_PROCEDURE, - SEARCH_ENTITY_TABLE, - SEARCH_ENTITY_TOPIC, -} from '../../constants/constants'; + createEntityTable, + createSingleLevelEntity, + hardDeleteService, +} from '../../common/entityUtils'; +import { + DATABASE_SERVICE, + SINGLE_LEVEL_SERVICE, + STORED_PROCEDURE_DETAILS, + VISIT_ENTITIES_DATA, +} from '../../constants/entityConstant'; +import { SERVICE_CATEGORIES } from '../../constants/service.constants'; // eslint-disable-next-line spaced-comment /// // Update list if we support this for other entities too const RECENTLY_VIEW_ENTITIES = [ - SEARCH_ENTITY_TABLE.table_2, - SEARCH_ENTITY_DASHBOARD.dashboard_1, - SEARCH_ENTITY_TOPIC.topic_1, - SEARCH_ENTITY_PIPELINE.pipeline_1, - SEARCH_ENTITY_MLMODEL.mlmodel_2, - SEARCH_ENTITY_STORED_PROCEDURE.stored_procedure_2, + VISIT_ENTITIES_DATA.table, + VISIT_ENTITIES_DATA.dashboard, + VISIT_ENTITIES_DATA.topic, + VISIT_ENTITIES_DATA.pipeline, + VISIT_ENTITIES_DATA.mlmodel, + VISIT_ENTITIES_DATA.storedProcedure, ]; describe('Recently viwed data assets', () => { + before(() => { + cy.login(); + cy.getAllLocalStorage().then((data) => { + const token = Object.values(data)[0].oidcIdToken; + + createEntityTable({ + token, + ...DATABASE_SERVICE, + tables: [DATABASE_SERVICE.tables], + }); + SINGLE_LEVEL_SERVICE.forEach((data) => { + createSingleLevelEntity({ + token, + ...data, + entity: [data.entity], + }); + }); + + // creating stored procedure + cy.request({ + method: 'POST', + url: `/api/v1/storedProcedures`, + headers: { Authorization: `Bearer ${token}` }, + body: STORED_PROCEDURE_DETAILS, + }); + }); + }); + + after(() => { + cy.login(); + cy.getAllLocalStorage().then((data) => { + const token = Object.values(data)[0].oidcIdToken; + + hardDeleteService({ + token, + serviceFqn: DATABASE_SERVICE.service.name, + serviceType: SERVICE_CATEGORIES.DATABASE_SERVICES, + }); + SINGLE_LEVEL_SERVICE.forEach((data) => { + hardDeleteService({ + token, + serviceFqn: data.service.name, + serviceType: data.serviceType, + }); + }); + }); + }); + beforeEach(() => { cy.login(); cy.get("[data-testid='welcome-screen-close-btn']").click(); diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/AddAndRemoveTierAndOwner.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/AddAndRemoveTierAndOwner.spec.js index 28a604dc7689..f8591f4892ea 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/AddAndRemoveTierAndOwner.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/AddAndRemoveTierAndOwner.spec.js @@ -24,31 +24,40 @@ import { visitEntityDetailsPage, } from '../../common/common'; import { - DELETE_TERM, - SEARCH_ENTITY_DASHBOARD, - SEARCH_ENTITY_MLMODEL, - SEARCH_ENTITY_PIPELINE, - SEARCH_ENTITY_STORED_PROCEDURE, - SEARCH_ENTITY_TABLE, - SEARCH_ENTITY_TOPIC, -} from '../../constants/constants'; + createEntityTable, + createSingleLevelEntity, + createUserEntity, + deleteEntityById, + deleteUserEntity, + hardDeleteService, +} from '../../common/entityUtils'; +import { DELETE_TERM, uuid } from '../../constants/constants'; +import { + DATABASE_SERVICE, + SINGLE_LEVEL_SERVICE, + STORED_PROCEDURE_DETAILS, + VISIT_ENTITIES_DATA, +} from '../../constants/entityConstant'; +import { USER_CREDENTIALS } from '../../constants/SearchIndexDetails.constants'; +import { SERVICE_CATEGORIES } from '../../constants/service.constants'; const ENTITIES = { table: { - ...SEARCH_ENTITY_TABLE.table_5, - schema: 'shopify', - database: 'ecommerce_db', + ...VISIT_ENTITIES_DATA.table, + schema: DATABASE_SERVICE.schema.name, + database: DATABASE_SERVICE.database.name, }, - topic: SEARCH_ENTITY_TOPIC.topic_2, - dashboard: SEARCH_ENTITY_DASHBOARD.dashboard_2, - pipeline: SEARCH_ENTITY_PIPELINE.pipeline_2, - mlmodel: SEARCH_ENTITY_MLMODEL.mlmodel_2, - storedProcedure: SEARCH_ENTITY_STORED_PROCEDURE.stored_procedure_2, + topic: VISIT_ENTITIES_DATA.topic, + dashboard: VISIT_ENTITIES_DATA.dashboard, + pipeline: VISIT_ENTITIES_DATA.pipeline, + mlmodel: VISIT_ENTITIES_DATA.mlmodel, + storedProcedure: VISIT_ENTITIES_DATA.storedProcedure, }; +const TEST_SUITE = { name: `aaa-cypress-test-suite-${uuid()}` }; const glossary = 'GlossaryOwnerTest'; const glossaryTerm = 'GlossaryTermOwnerTest'; -const OWNER = 'Amber Green'; +const OWNER = `${USER_CREDENTIALS.firstName}${USER_CREDENTIALS.lastName}`; const TIER = 'Tier1'; const addRemoveOwner = (ownerName, entity, isGlossaryPage) => { @@ -63,6 +72,44 @@ const addRemoveTier = (tier, entity) => { }; describe('Add and Remove Owner', () => { + before(() => { + cy.login(); + cy.getAllLocalStorage().then((data) => { + const token = Object.values(data)[0].oidcIdToken; + + createEntityTable({ + token, + ...DATABASE_SERVICE, + tables: [DATABASE_SERVICE.tables], + }); + SINGLE_LEVEL_SERVICE.forEach((data) => { + createSingleLevelEntity({ + token, + ...data, + entity: [data.entity], + }); + }); + + // creating stored procedure + cy.request({ + method: 'POST', + url: `/api/v1/storedProcedures`, + headers: { Authorization: `Bearer ${token}` }, + body: STORED_PROCEDURE_DETAILS, + }); + + // creating test suite + cy.request({ + method: 'POST', + url: `/api/v1/dataQuality/testSuites`, + headers: { Authorization: `Bearer ${token}` }, + body: TEST_SUITE, + }); + + createUserEntity({ token, user: USER_CREDENTIALS }); + }); + }); + beforeEach(() => { interceptURL('GET', '/api/v1/permissions/*/name/*', 'entityPermission'); interceptURL('GET', '/api/v1/feed/count?entityLink=*', 'activityFeed'); @@ -323,6 +370,34 @@ describe('Add and Remove Owner', () => { }); describe('Add and Remove Tier', () => { + after(() => { + cy.login(); + cy.getAllLocalStorage().then((data) => { + const token = Object.values(data)[0].oidcIdToken; + + hardDeleteService({ + token, + serviceFqn: DATABASE_SERVICE.service.name, + serviceType: SERVICE_CATEGORIES.DATABASE_SERVICES, + }); + SINGLE_LEVEL_SERVICE.forEach((data) => { + hardDeleteService({ + token, + serviceFqn: data.service.name, + serviceType: data.serviceType, + }); + }); + deleteUserEntity({ token, id: USER_CREDENTIALS.id }); + + // Delete test suite + deleteEntityById({ + entityFqn: TEST_SUITE.name, + entityType: 'dataQuality/testSuites', + token, + }); + }); + }); + beforeEach(() => { interceptURL('GET', '/api/v1/permissions/*/name/*', 'entityPermission'); interceptURL('GET', '/api/v1/feed/count?entityLink=*', 'activityFeed'); diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/EntityVoting.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/EntityVoting.spec.js index e50796cb09ca..87733757242e 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/EntityVoting.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/EntityVoting.spec.js @@ -16,9 +16,86 @@ import { verifyResponseStatusCode, visitEntityDetailsPage, } from '../../common/common'; -import { VOTING_ENTITIES } from '../../constants/voting.constant'; +import { + createEntityTable, + createSingleLevelEntity, + hardDeleteService, +} from '../../common/entityUtils'; +import { + DASHBOARD_DATA_MODEL_DETAILS, + DATABASE_SERVICE, + SINGLE_LEVEL_SERVICE, + STORED_PROCEDURE_DETAILS, + VISIT_ENTITIES_DATA, +} from '../../constants/entityConstant'; +import { SERVICE_CATEGORIES } from '../../constants/service.constants'; + +const VOTING_ENTITIES = [ + VISIT_ENTITIES_DATA.table, + VISIT_ENTITIES_DATA.topic, + VISIT_ENTITIES_DATA.dashboard, + VISIT_ENTITIES_DATA.pipeline, + VISIT_ENTITIES_DATA.mlmodel, + VISIT_ENTITIES_DATA.storedProcedure, + VISIT_ENTITIES_DATA.dataModel, +]; describe('Check if voting work properly in entities', () => { + before(() => { + cy.login(); + cy.getAllLocalStorage().then((data) => { + const token = Object.values(data)[0].oidcIdToken; + + createEntityTable({ + token, + ...DATABASE_SERVICE, + tables: [DATABASE_SERVICE.tables], + }); + SINGLE_LEVEL_SERVICE.forEach((data) => { + createSingleLevelEntity({ + token, + ...data, + entity: [data.entity], + }); + }); + + // creating data model + cy.request({ + method: 'POST', + url: `/api/v1/dashboard/datamodels`, + headers: { Authorization: `Bearer ${token}` }, + body: DASHBOARD_DATA_MODEL_DETAILS, + }); + // creating stored procedure + cy.request({ + method: 'POST', + url: `/api/v1/storedProcedures`, + headers: { Authorization: `Bearer ${token}` }, + body: STORED_PROCEDURE_DETAILS, + }); + }); + }); + + after(() => { + cy.login(); + cy.getAllLocalStorage().then((data) => { + const token = Object.values(data)[0].oidcIdToken; + + hardDeleteService({ + token, + serviceFqn: DATABASE_SERVICE.service.name, + serviceType: SERVICE_CATEGORIES.DATABASE_SERVICES, + }); + SINGLE_LEVEL_SERVICE.forEach((data) => { + hardDeleteService({ + token, + serviceFqn: data.service.name, + serviceType: data.serviceType, + }); + }); + }); + }); + beforeEach(() => { cy.login(); }); @@ -30,8 +107,6 @@ describe('Check if voting work properly in entities', () => { : entityDetails.entity; it(`UpVote the ${entityDetails.entity} entity`, () => { - interceptURL('GET', entityDetails.permissionApi, 'getEntityPermission'); - interceptURL( 'GET', `/api/v1/${apiEntity}/name/*?fields=*`, @@ -45,7 +120,6 @@ describe('Check if voting work properly in entities', () => { entity: entityDetails.entity, }); verifyResponseStatusCode('@getEntityDetail', 200); - verifyResponseStatusCode('@getEntityPermission', 200); cy.get('[data-testid="up-vote-btn"]').click(); @@ -66,8 +140,6 @@ describe('Check if voting work properly in entities', () => { : entityDetails.entity; it(`DownVote the ${entityDetails.entity} entity`, () => { - interceptURL('GET', entityDetails.permissionApi, 'getEntityPermission'); - interceptURL( 'GET', `/api/v1/${apiEntity}/name/*?fields=*`, @@ -81,7 +153,6 @@ describe('Check if voting work properly in entities', () => { entity: entityDetails.entity, }); verifyResponseStatusCode('@getEntityDetail', 200); - verifyResponseStatusCode('@getEntityPermission', 200); cy.get('[data-testid="up-vote-count"]').contains(1); @@ -105,8 +176,6 @@ describe('Check if voting work properly in entities', () => { : entityDetails.entity; it(`UnVote the ${entityDetails.entity} entity`, () => { - interceptURL('GET', entityDetails.permissionApi, 'getEntityPermission'); - interceptURL( 'GET', `/api/v1/${apiEntity}/name/*?fields=*`, @@ -120,7 +189,6 @@ describe('Check if voting work properly in entities', () => { entity: entityDetails.entity, }); verifyResponseStatusCode('@getEntityDetail', 200); - verifyResponseStatusCode('@getEntityPermission', 200); cy.get('[data-testid="down-vote-count"]').contains(1); diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/TagsAddRemove.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/TagsAddRemove.spec.js index c3909ce584d9..4169f4b632fb 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/TagsAddRemove.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/TagsAddRemove.spec.js @@ -19,7 +19,40 @@ import { verifyResponseStatusCode, visitEntityDetailsPage, } from '../../common/common'; -import { TAGS_ADD_REMOVE_ENTITIES } from '../../constants/tagsAddRemove.constants'; +import { + createEntityTable, + createSingleLevelEntity, +} from '../../common/entityUtils'; +import { + DASHBOARD_CHART_DETAILS, + DASHBOARD_DATA_MODEL_DETAILS, + DASHBOARD_DETAILS, + DASHBOARD_SERVICE, + DATABASE_SERVICE, + MESSAGING_SERVICE, + MLMODEL_SERVICE, + PIPELINE_SERVICE, + STORAGE_SERVICE, + STORED_PROCEDURE_DETAILS, +} from '../../constants/entityConstant'; +import { + TAGS_ADD_REMOVE_ENTITIES, + TAGS_ADD_REMOVE_TABLE, +} from '../../constants/tagsAddRemove.constants'; + +const SINGLE_LEVEL_SERVICE = [ + MESSAGING_SERVICE, + PIPELINE_SERVICE, + MLMODEL_SERVICE, + STORAGE_SERVICE, +]; + +const DASHBOARD_SERVICE_WITH_CHART = { + ...DASHBOARD_DETAILS, + charts: [ + `${DASHBOARD_CHART_DETAILS.service}.${DASHBOARD_CHART_DETAILS.name}`, + ], +}; const addTags = (tag) => { const tagName = Cypress._.split(tag, '.')[1]; @@ -105,6 +138,83 @@ const removeTags = (checkForParentEntity) => { }; describe('Check if tags addition and removal flow working properly from tables', () => { + before(() => { + cy.login(); + cy.getAllLocalStorage().then((data) => { + const token = Object.values(data)[0].oidcIdToken; + + createEntityTable({ + token, + ...DATABASE_SERVICE, + tables: [TAGS_ADD_REMOVE_TABLE], + }); + SINGLE_LEVEL_SERVICE.forEach((data) => { + createSingleLevelEntity({ + token, + ...data, + entity: [data.entity], + }); + }); + + // create dashboard service + cy.request({ + method: 'POST', + url: `/api/v1/services/${DASHBOARD_SERVICE.serviceType}`, + headers: { Authorization: `Bearer ${token}` }, + body: DASHBOARD_SERVICE.service, + }); + // creating chart + cy.request({ + method: 'POST', + url: `/api/v1/charts`, + headers: { Authorization: `Bearer ${token}` }, + body: DASHBOARD_CHART_DETAILS, + }); + // creating dashboard + cy.request({ + method: 'POST', + url: `/api/v1/dashboards`, + headers: { Authorization: `Bearer ${token}` }, + body: DASHBOARD_SERVICE_WITH_CHART, + }); + + // creating data model + cy.request({ + method: 'POST', + url: `/api/v1/dashboard/datamodels`, + headers: { Authorization: `Bearer ${token}` }, + body: DASHBOARD_DATA_MODEL_DETAILS, + }); + // creating stored procedure + cy.request({ + method: 'POST', + url: `/api/v1/storedProcedures`, + headers: { Authorization: `Bearer ${token}` }, + body: STORED_PROCEDURE_DETAILS, + }); + }); + }); + + // after(() => { + // cy.login(); + // cy.getAllLocalStorage().then((data) => { + // const token = Object.values(data)[0].oidcIdToken; + + // hardDeleteService({ + // token, + // serviceFqn: DATABASE_SERVICE.service.name, + // serviceType: SERVICE_CATEGORIES.DATABASE_SERVICES, + // }); + // SINGLE_LEVEL_SERVICE.forEach((data) => { + // hardDeleteService({ + // token, + // serviceFqn: data.service.name, + // serviceType: data.serviceType, + // }); + // }); + // }); + // }); + beforeEach(() => { cy.login(); }); diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/ClassificationVersionPage.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/ClassificationVersionPage.spec.js index e98967eb356f..3f3960172664 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/ClassificationVersionPage.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/ClassificationVersionPage.spec.js @@ -139,13 +139,8 @@ describe('Classification version page should work properly', () => { `/api/v1/classifications/${classificationId}/versions`, 'getVersionsList' ); - interceptURL( - 'GET', - `/api/v1/classifications/${classificationId}/versions/0.3`, - 'getSelectedVersionDetails' - ); - cy.get('[data-testid="version-button"]').contains('0.3').click(); + cy.get('[data-testid="version-button"]').contains('0.2').click(); verifyResponseStatusCode(`@getClassificationDetails`, 200); verifyResponseStatusCode('@getVersionsList', 200); @@ -153,7 +148,7 @@ describe('Classification version page should work properly', () => { cy.get('[data-testid="disabled"]').should('be.visible'); - cy.get('[data-testid="version-button"]').contains('0.3').click(); + cy.get('[data-testid="version-button"]').contains('0.2').click(); cy.get('[data-testid="manage-button"]').click({ waitForAnimations: true }); @@ -171,13 +166,8 @@ describe('Classification version page should work properly', () => { `/api/v1/classifications/${classificationId}/versions`, 'getVersionsList' ); - interceptURL( - 'GET', - `/api/v1/classifications/${classificationId}/versions/0.4`, - 'getSelectedVersionDetails' - ); - cy.get('[data-testid="version-button"]').contains('0.4').click(); + cy.get('[data-testid="version-button"]').contains('0.2').click(); verifyResponseStatusCode(`@getClassificationDetails`, 200); verifyResponseStatusCode('@getVersionsList', 200); diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Customproperties.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Customproperties.spec.js index 9d7a921408e3..f173b5fc6af8 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Customproperties.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Customproperties.spec.js @@ -34,7 +34,7 @@ describe('Custom Properties should work properly', () => { describe('Add update and delete Integer custom properties', () => { Object.values(ENTITIES).forEach((entity) => { - const propertyName = `entity${entity.name}test${uuid()}`; + const propertyName = `addcyentity${entity.name}test${uuid()}`; it(`Add Integer custom property for ${entity.name} Entities`, () => { interceptURL( @@ -106,7 +106,7 @@ describe('Custom Properties should work properly', () => { describe('Add update and delete String custom properties', () => { Object.values(ENTITIES).forEach((entity) => { - const propertyName = `entity${entity.name}test${uuid()}`; + const propertyName = `addcyentity${entity.name}test${uuid()}`; it(`Add String custom property for ${entity.name} Entities`, () => { interceptURL( @@ -182,7 +182,7 @@ describe('Custom Properties should work properly', () => { describe('Add update and delete Markdown custom properties', () => { Object.values(ENTITIES).forEach((entity) => { - const propertyName = `entity${entity.name}test${uuid()}`; + const propertyName = `addcyentity${entity.name}test${uuid()}`; it(`Add Markdown custom property for ${entity.name} Entities`, () => { interceptURL( diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/DataModelVersionPage.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/DataModelVersionPage.spec.js index 72e62349c2c2..483a5c34b554 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/DataModelVersionPage.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/DataModelVersionPage.spec.js @@ -17,8 +17,6 @@ import { addOwner, addTier, interceptURL, - removeOwner, - removeTier, toastNotification, verifyResponseStatusCode, visitDataModelPage, @@ -38,38 +36,37 @@ describe('Data model version page should work properly', () => { let dataModelId; let dataModelFQN; - beforeEach(() => { + before(() => { cy.login(); - }); - - it('Prerequisite for data model version page tests', () => { - const token = localStorage.getItem('oidcIdToken'); - - cy.request({ - method: 'PUT', - url: `/api/v1/dashboard/datamodels`, - headers: { Authorization: `Bearer ${token}` }, - body: DATA_MODEL_DETAILS_FOR_VERSION_TEST, - }).then((response) => { - expect(response.status).to.eq(201); - - dataModelId = response.body.id; - dataModelFQN = response.body.fullyQualifiedName; + cy.getAllLocalStorage().then((data) => { + const token = Object.values(data)[0].oidcIdToken; cy.request({ - method: 'PATCH', - url: `/api/v1/dashboard/datamodels/${dataModelId}`, - headers: { - Authorization: `Bearer ${token}`, - 'Content-Type': 'application/json-patch+json', - }, - body: DATA_MODEL_PATCH_PAYLOAD, + method: 'PUT', + url: `/api/v1/dashboard/datamodels`, + headers: { Authorization: `Bearer ${token}` }, + body: DATA_MODEL_DETAILS_FOR_VERSION_TEST, }).then((response) => { - expect(response.status).to.eq(200); + dataModelId = response.body.id; + dataModelFQN = response.body.fullyQualifiedName; + + cy.request({ + method: 'PATCH', + url: `/api/v1/dashboard/datamodels/${dataModelId}`, + headers: { + Authorization: `Bearer ${token}`, + 'Content-Type': 'application/json-patch+json', + }, + body: DATA_MODEL_PATCH_PAYLOAD, + }); }); }); }); + beforeEach(() => { + cy.login(); + }); + it('Data model version page should show description and tag changes properly', () => { visitDataModelVersionPage(dataModelFQN, dataModelId, dataModelName, '0.2'); @@ -104,42 +101,12 @@ describe('Data model version page should work properly', () => { .should('be.visible'); }); - it(`Data model version page should show removed tags changes properly`, () => { - visitDataModelPage(dataModelFQN, dataModelName); - - cy.get( - '[data-testid="entity-right-panel"] [data-testid="edit-button"]' - ).click(); - - cy.get( - '[data-testid="selected-tag-PersonalData.SpecialCategory"] [data-testid="remove-tags"]' - ).click(); - - interceptURL( - 'PATCH', - `/api/v1/dashboard/datamodels/${dataModelId}`, - `patchDataModel` - ); - - cy.get('[data-testid="saveAssociatedTag"]').click(); - - verifyResponseStatusCode(`@patchDataModel`, 200); - - cy.get('[data-testid="version-button"]').contains('0.3').click(); - - cy.get( - `[data-testid="entity-right-panel"] .diff-removed [data-testid="tag-PersonalData.SpecialCategory"]` - ) - .scrollIntoView() - .should('be.visible'); - }); - it(`Data model version page should show owner changes properly`, () => { visitDataModelPage(dataModelFQN, dataModelName); cy.get('[data-testid="version-button"]').as('versionButton'); - cy.get('@versionButton').contains('0.3'); + cy.get('@versionButton').contains('0.2'); addOwner(OWNER, 'dashboard/datamodels'); @@ -155,35 +122,17 @@ describe('Data model version page should work properly', () => { ); interceptURL( 'GET', - `/api/v1/dashboard/datamodels/${dataModelId}/versions/0.4`, + `/api/v1/dashboard/datamodels/${dataModelId}/versions/0.2`, 'getSelectedVersionDetails' ); - cy.get('@versionButton').contains('0.4').click(); + cy.get('@versionButton').contains('0.2').click(); verifyResponseStatusCode(`@getDataModelDetails`, 200); verifyResponseStatusCode('@getVersionsList', 200); verifyResponseStatusCode('@getSelectedVersionDetails', 200); - cy.get(`[data-testid="diff-added"]`).scrollIntoView().should('be.visible'); - - cy.get('@versionButton').contains('0.4').click(); - - removeOwner('dashboard/datamodels'); - - interceptURL( - 'GET', - `/api/v1/dashboard/datamodels/${dataModelId}/versions/0.5`, - 'getSelectedVersionDetails' - ); - - cy.get('@versionButton').contains('0.5').click(); - - verifyResponseStatusCode(`@getDataModelDetails`, 200); - verifyResponseStatusCode('@getVersionsList', 200); - verifyResponseStatusCode('@getSelectedVersionDetails', 200); - - cy.get(`[data-testid="diff-removed"]`) + cy.get('[data-testid="owner-link"] > [data-testid="diff-added"]') .scrollIntoView() .should('be.visible'); }); @@ -193,7 +142,7 @@ describe('Data model version page should work properly', () => { cy.get('[data-testid="version-button"]').as('versionButton'); - cy.get('@versionButton').contains('0.5'); + cy.get('@versionButton').contains('0.2'); addTier(TIER, 'dashboard/datamodels'); @@ -209,35 +158,17 @@ describe('Data model version page should work properly', () => { ); interceptURL( 'GET', - `/api/v1/dashboard/datamodels/${dataModelId}/versions/0.6`, - 'getSelectedVersionDetails' - ); - - cy.get('@versionButton').contains('0.6').click(); - - verifyResponseStatusCode(`@getDataModelDetails`, 200); - verifyResponseStatusCode('@getVersionsList', 200); - verifyResponseStatusCode('@getSelectedVersionDetails', 200); - - cy.get(`[data-testid="diff-added"]`).scrollIntoView().should('be.visible'); - - cy.get('@versionButton').contains('0.6').click(); - - removeTier('dashboard/datamodels'); - - interceptURL( - 'GET', - `/api/v1/dashboard/datamodels/${dataModelId}/versions/0.7`, + `/api/v1/dashboard/datamodels/${dataModelId}/versions/0.2`, 'getSelectedVersionDetails' ); - cy.get('@versionButton').contains('0.7').click(); + cy.get('@versionButton').contains('0.2').click(); verifyResponseStatusCode(`@getDataModelDetails`, 200); verifyResponseStatusCode('@getVersionsList', 200); verifyResponseStatusCode('@getSelectedVersionDetails', 200); - cy.get(`[data-testid="diff-removed"]`) + cy.get('[data-testid="Tier"] > [data-testid="diff-added"]') .scrollIntoView() .should('be.visible'); }); diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/DatabaseSchemaVersionPage.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/DatabaseSchemaVersionPage.spec.js index 77c37fb07571..7a0ab8d8cae1 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/DatabaseSchemaVersionPage.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/DatabaseSchemaVersionPage.spec.js @@ -17,8 +17,6 @@ import { addOwner, addTier, interceptURL, - removeOwner, - removeTier, toastNotification, verifyResponseStatusCode, visitServiceDetailsPage, @@ -38,99 +36,93 @@ const serviceDetails = SERVICE_DETAILS_FOR_VERSION_TEST.Database; let domainId; -describe('Common prerequisite for database schema version test', () => { - beforeEach(() => { - cy.login(); - }); - - it('Domain creation for database schema version test', () => { - const token = localStorage.getItem('oidcIdToken'); - - cy.request({ - method: 'PUT', - url: `/api/v1/domains`, - headers: { Authorization: `Bearer ${token}` }, - body: DOMAIN_CREATION_DETAILS, - }).then((response) => { - expect(response.status).to.eq(201); - - domainId = response.body.id; - }); - }); -}); - describe(`Database schema version page should work properly`, () => { let databaseId; let databaseSchemaId; let databaseSchemaFQN; - beforeEach(() => { + before(() => { cy.login(); - }); + cy.getAllLocalStorage().then((data) => { + const token = Object.values(data)[0].oidcIdToken; + cy.request({ + method: 'PUT', + url: `/api/v1/domains`, + headers: { Authorization: `Bearer ${token}` }, + body: DOMAIN_CREATION_DETAILS, + }).then((response) => { + domainId = response.body.id; + }); - it(`Prerequisite for Database Schema version page tests`, () => { - const token = localStorage.getItem('oidcIdToken'); - - // Create service - cy.request({ - method: 'POST', - url: `/api/v1/services/${serviceDetails.serviceCategory}`, - headers: { Authorization: `Bearer ${token}` }, - body: serviceDetails.entityCreationDetails, - }).then((response) => { - expect(response.status).to.eq(201); - }); + // Create service + cy.request({ + method: 'POST', + url: `/api/v1/services/${serviceDetails.serviceCategory}`, + headers: { Authorization: `Bearer ${token}` }, + body: serviceDetails.entityCreationDetails, + }); - // Create Database - cy.request({ - method: 'POST', - url: `/api/v1/databases`, - headers: { Authorization: `Bearer ${token}` }, - body: DATABASE_DETAILS_FOR_VERSION_TEST, - }).then((response) => { - expect(response.status).to.eq(201); + // Create Database + cy.request({ + method: 'POST', + url: `/api/v1/databases`, + headers: { Authorization: `Bearer ${token}` }, + body: DATABASE_DETAILS_FOR_VERSION_TEST, + }).then((response) => { + databaseId = response.body.id; + }); - databaseId = response.body.id; + // Create Database Schema + cy.request({ + method: 'PUT', + url: `/api/v1/databaseSchemas`, + headers: { Authorization: `Bearer ${token}` }, + body: DATABASE_SCHEMA_DETAILS_FOR_VERSION_TEST, + }).then((response) => { + databaseSchemaId = response.body.id; + databaseSchemaFQN = response.body.fullyQualifiedName; + + cy.request({ + method: 'PATCH', + url: `/api/v1/databaseSchemas/${databaseSchemaId}`, + headers: { + Authorization: `Bearer ${token}`, + 'Content-Type': 'application/json-patch+json', + }, + body: [ + ...COMMON_PATCH_PAYLOAD, + { + op: 'add', + path: '/domain', + value: { + id: domainId, + type: 'domain', + name: DOMAIN_CREATION_DETAILS.name, + description: DOMAIN_CREATION_DETAILS.description, + }, + }, + ], + }); + }); }); + }); - // Create Database Schema - cy.request({ - method: 'PUT', - url: `/api/v1/databaseSchemas`, - headers: { Authorization: `Bearer ${token}` }, - body: DATABASE_SCHEMA_DETAILS_FOR_VERSION_TEST, - }).then((response) => { - expect(response.status).to.eq(201); - - databaseSchemaId = response.body.id; - databaseSchemaFQN = response.body.fullyQualifiedName; - + after(() => { + cy.login(); + cy.getAllLocalStorage().then((data) => { + const token = Object.values(data)[0].oidcIdToken; cy.request({ - method: 'PATCH', - url: `/api/v1/databaseSchemas/${databaseSchemaId}`, - headers: { - Authorization: `Bearer ${token}`, - 'Content-Type': 'application/json-patch+json', - }, - body: [ - ...COMMON_PATCH_PAYLOAD, - { - op: 'add', - path: '/domain', - value: { - id: domainId, - type: 'domain', - name: DOMAIN_CREATION_DETAILS.name, - description: DOMAIN_CREATION_DETAILS.description, - }, - }, - ], - }).then((response) => { - expect(response.status).to.eq(200); + method: 'DELETE', + url: `/api/v1/domains/name/${DOMAIN_CREATION_DETAILS.name}`, + headers: { Authorization: `Bearer ${token}` }, }); }); }); + beforeEach(() => { + cy.login(); + }); + it(`Database Schema version page should show edited tags and description changes properly`, () => { visitServiceDetailsPage( serviceDetails.settingsMenuId, @@ -191,48 +183,6 @@ describe(`Database schema version page should work properly`, () => { .should('be.visible'); }); - it(`Database Schema version page should show removed tags changes properly`, () => { - visitServiceDetailsPage( - serviceDetails.settingsMenuId, - serviceDetails.serviceCategory, - serviceDetails.serviceName - ); - - cy.get(`[data-row-key="${databaseId}"]`) - .contains(DATABASE_DETAILS_FOR_VERSION_TEST.name) - .click(); - - cy.get(`[data-row-key="${databaseSchemaId}"]`) - .contains(DATABASE_SCHEMA_DETAILS_FOR_VERSION_TEST.name) - .click(); - - cy.get( - '[data-testid="entity-right-panel"] [data-testid="edit-button"]' - ).click(); - - cy.get( - '[data-testid="selected-tag-PersonalData.SpecialCategory"] [data-testid="remove-tags"]' - ).click(); - - interceptURL( - 'PATCH', - `/api/v1/databaseSchemas/${databaseSchemaId}`, - `patchDatabase` - ); - - cy.get('[data-testid="saveAssociatedTag"]').click(); - - verifyResponseStatusCode(`@patchDatabase`, 200); - - cy.get('[data-testid="version-button"]').contains('0.3').click(); - - cy.get( - `[data-testid="entity-right-panel"] .diff-removed [data-testid="tag-PersonalData.SpecialCategory"]` - ) - .scrollIntoView() - .should('be.visible'); - }); - it(`Database Schema version page should show owner changes properly`, () => { visitServiceDetailsPage( serviceDetails.settingsMenuId, @@ -250,7 +200,7 @@ describe(`Database schema version page should work properly`, () => { cy.get('[data-testid="version-button"]').as('versionButton'); - cy.get('@versionButton').contains('0.3'); + cy.get('@versionButton').contains('0.2'); addOwner(OWNER, `databaseSchemas`); @@ -266,35 +216,17 @@ describe(`Database schema version page should work properly`, () => { ); interceptURL( 'GET', - `/api/v1/databaseSchemas/${databaseSchemaId}/versions/0.4`, - 'getSelectedVersionDetails' - ); - - cy.get('@versionButton').contains('0.4').click(); - - verifyResponseStatusCode(`@getDatabaseSchemaDetails`, 200); - verifyResponseStatusCode('@getVersionsList', 200); - verifyResponseStatusCode('@getSelectedVersionDetails', 200); - - cy.get(`[data-testid="diff-added"]`).scrollIntoView().should('be.visible'); - - cy.get('@versionButton').contains('0.4').click(); - - removeOwner(`databaseSchemas`); - - interceptURL( - 'GET', - `/api/v1/databaseSchemas/${databaseSchemaId}/versions/0.5`, + `/api/v1/databaseSchemas/${databaseSchemaId}/versions/0.2`, 'getSelectedVersionDetails' ); - cy.get('@versionButton').contains('0.5').click(); + cy.get('@versionButton').contains('0.2').click(); verifyResponseStatusCode(`@getDatabaseSchemaDetails`, 200); verifyResponseStatusCode('@getVersionsList', 200); verifyResponseStatusCode('@getSelectedVersionDetails', 200); - cy.get(`[data-testid="diff-removed"]`) + cy.get('[data-testid="owner-link"] > [data-testid="diff-added"]') .scrollIntoView() .should('be.visible'); }); @@ -316,7 +248,7 @@ describe(`Database schema version page should work properly`, () => { cy.get('[data-testid="version-button"]').as('versionButton'); - cy.get('@versionButton').contains('0.5'); + cy.get('@versionButton').contains('0.2'); addTier(TIER, `databaseSchemas`); @@ -332,35 +264,17 @@ describe(`Database schema version page should work properly`, () => { ); interceptURL( 'GET', - `/api/v1/databaseSchemas/${databaseSchemaId}/versions/0.6`, - 'getSelectedVersionDetails' - ); - - cy.get('@versionButton').contains('0.6').click(); - - verifyResponseStatusCode(`@getDatabaseSchemaDetails`, 200); - verifyResponseStatusCode('@getVersionsList', 200); - verifyResponseStatusCode('@getSelectedVersionDetails', 200); - - cy.get(`[data-testid="diff-added"]`).scrollIntoView().should('be.visible'); - - cy.get('@versionButton').contains('0.6').click(); - - removeTier(`databaseSchemas`); - - interceptURL( - 'GET', - `/api/v1/databaseSchemas/${databaseSchemaId}/versions/0.7`, + `/api/v1/databaseSchemas/${databaseSchemaId}/versions/0.2`, 'getSelectedVersionDetails' ); - cy.get('@versionButton').contains('0.7').click(); + cy.get('@versionButton').contains('0.2').click(); verifyResponseStatusCode(`@getDatabaseSchemaDetails`, 200); verifyResponseStatusCode('@getVersionsList', 200); verifyResponseStatusCode('@getSelectedVersionDetails', 200); - cy.get(`[data-testid="diff-removed"]`) + cy.get('[data-testid="Tier"] > [data-testid="diff-added"]') .scrollIntoView() .should('be.visible'); }); @@ -421,21 +335,3 @@ describe(`Database schema version page should work properly`, () => { ).should('not.exist'); }); }); - -describe('Common cleanup for database schema version test', () => { - beforeEach(() => { - cy.login(); - }); - - it('Domain deletion for database schema version test', () => { - const token = localStorage.getItem('oidcIdToken'); - - cy.request({ - method: 'DELETE', - url: `/api/v1/domains/name/${DOMAIN_CREATION_DETAILS.name}`, - headers: { Authorization: `Bearer ${token}` }, - }).then((response) => { - expect(response.status).to.eq(200); - }); - }); -}); diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/DatabaseVersionPage.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/DatabaseVersionPage.spec.js index 70d8df4f6936..8b0c531c5ffa 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/DatabaseVersionPage.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/DatabaseVersionPage.spec.js @@ -10,14 +10,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -// / + +// eslint-disable-next-line spaced-comment +/// import { addOwner, addTier, interceptURL, - removeOwner, - removeTier, toastNotification, verifyResponseStatusCode, visitServiceDetailsPage, @@ -36,86 +36,82 @@ const serviceDetails = SERVICE_DETAILS_FOR_VERSION_TEST.Database; let domainId; -describe('Common prerequisite for database version test', () => { - beforeEach(() => { - cy.login(); - }); - - it('Domain creation for database version test', () => { - const token = localStorage.getItem('oidcIdToken'); - - cy.request({ - method: 'PUT', - url: `/api/v1/domains`, - headers: { Authorization: `Bearer ${token}` }, - body: DOMAIN_CREATION_DETAILS, - }).then((response) => { - expect(response.status).to.eq(201); - - domainId = response.body.id; - }); - }); -}); - describe(`Database version page should work properly`, () => { let databaseId; let databaseFQN; - beforeEach(() => { + before(() => { cy.login(); - }); - - it(`Prerequisite for Database version page tests`, () => { - const token = localStorage.getItem('oidcIdToken'); - - // Create service - cy.request({ - method: 'POST', - url: `/api/v1/services/${serviceDetails.serviceCategory}`, - headers: { Authorization: `Bearer ${token}` }, - body: serviceDetails.entityCreationDetails, - }).then((response) => { - expect(response.status).to.eq(201); - }); - - // Create Database - cy.request({ - method: 'POST', - url: `/api/v1/databases`, - headers: { Authorization: `Bearer ${token}` }, - body: DATABASE_DETAILS_FOR_VERSION_TEST, - }).then((response) => { - expect(response.status).to.eq(201); + cy.getAllLocalStorage().then((data) => { + const token = Object.values(data)[0].oidcIdToken; + cy.request({ + method: 'PUT', + url: `/api/v1/domains`, + headers: { Authorization: `Bearer ${token}` }, + body: DOMAIN_CREATION_DETAILS, + }).then((response) => { + domainId = response.body.id; + }); - databaseId = response.body.id; - databaseFQN = response.body.fullyQualifiedName; + // Create service + cy.request({ + method: 'POST', + url: `/api/v1/services/${serviceDetails.serviceCategory}`, + headers: { Authorization: `Bearer ${token}` }, + body: serviceDetails.entityCreationDetails, + }); + // Create Database cy.request({ - method: 'PATCH', - url: `/api/v1/databases/${databaseId}`, - headers: { - Authorization: `Bearer ${token}`, - 'Content-Type': 'application/json-patch+json', - }, - body: [ - ...COMMON_PATCH_PAYLOAD, - { - op: 'add', - path: '/domain', - value: { - id: domainId, - type: 'domain', - name: DOMAIN_CREATION_DETAILS.name, - description: DOMAIN_CREATION_DETAILS.description, - }, - }, - ], + method: 'POST', + url: `/api/v1/databases`, + headers: { Authorization: `Bearer ${token}` }, + body: DATABASE_DETAILS_FOR_VERSION_TEST, }).then((response) => { - expect(response.status).to.eq(200); + databaseId = response.body.id; + databaseFQN = response.body.fullyQualifiedName; + + cy.request({ + method: 'PATCH', + url: `/api/v1/databases/${databaseId}`, + headers: { + Authorization: `Bearer ${token}`, + 'Content-Type': 'application/json-patch+json', + }, + body: [ + ...COMMON_PATCH_PAYLOAD, + { + op: 'add', + path: '/domain', + value: { + id: domainId, + type: 'domain', + name: DOMAIN_CREATION_DETAILS.name, + description: DOMAIN_CREATION_DETAILS.description, + }, + }, + ], + }); + }); + }); + }); + + after(() => { + cy.login(); + cy.getAllLocalStorage().then((data) => { + const token = Object.values(data)[0].oidcIdToken; + cy.request({ + method: 'DELETE', + url: `/api/v1/domains/name/${DOMAIN_CREATION_DETAILS.name}`, + headers: { Authorization: `Bearer ${token}` }, }); }); }); + beforeEach(() => { + cy.login(); + }); + it(`Database version page should show edited tags and description changes properly`, () => { visitServiceDetailsPage( serviceDetails.settingsMenuId, @@ -172,40 +168,6 @@ describe(`Database version page should work properly`, () => { .should('be.visible'); }); - it(`Database version page should show removed tags changes properly`, () => { - visitServiceDetailsPage( - serviceDetails.settingsMenuId, - serviceDetails.serviceCategory, - serviceDetails.serviceName - ); - - cy.get(`[data-row-key="${databaseId}"]`) - .contains(DATABASE_DETAILS_FOR_VERSION_TEST.name) - .click(); - - cy.get( - '[data-testid="entity-right-panel"] [data-testid="edit-button"]' - ).click(); - - cy.get( - '[data-testid="selected-tag-PersonalData.SpecialCategory"] [data-testid="remove-tags"]' - ).click(); - - interceptURL('PATCH', `/api/v1/databases/${databaseId}`, `patchDatabase`); - - cy.get('[data-testid="saveAssociatedTag"]').click(); - - verifyResponseStatusCode(`@patchDatabase`, 200); - - cy.get('[data-testid="version-button"]').contains('0.3').click(); - - cy.get( - `[data-testid="entity-right-panel"] .diff-removed [data-testid="tag-PersonalData.SpecialCategory"]` - ) - .scrollIntoView() - .should('be.visible'); - }); - it(`Database version page should show owner changes properly`, () => { visitServiceDetailsPage( serviceDetails.settingsMenuId, @@ -219,7 +181,7 @@ describe(`Database version page should work properly`, () => { cy.get('[data-testid="version-button"]').as('versionButton'); - cy.get('@versionButton').contains('0.3'); + cy.get('@versionButton').contains('0.2'); addOwner(OWNER, `databases`); @@ -235,35 +197,17 @@ describe(`Database version page should work properly`, () => { ); interceptURL( 'GET', - `/api/v1/databases/${databaseId}/versions/0.4`, - 'getSelectedVersionDetails' - ); - - cy.get('@versionButton').contains('0.4').click(); - - verifyResponseStatusCode(`@getDatabaseDetails`, 200); - verifyResponseStatusCode('@getVersionsList', 200); - verifyResponseStatusCode('@getSelectedVersionDetails', 200); - - cy.get(`[data-testid="diff-added"]`).scrollIntoView().should('be.visible'); - - cy.get('@versionButton').contains('0.4').click(); - - removeOwner(`databases`); - - interceptURL( - 'GET', - `/api/v1/databases/${databaseId}/versions/0.5`, + `/api/v1/databases/${databaseId}/versions/0.2`, 'getSelectedVersionDetails' ); - cy.get('@versionButton').contains('0.5').click(); + cy.get('@versionButton').contains('0.2').click(); verifyResponseStatusCode(`@getDatabaseDetails`, 200); verifyResponseStatusCode('@getVersionsList', 200); verifyResponseStatusCode('@getSelectedVersionDetails', 200); - cy.get(`[data-testid="diff-removed"]`) + cy.get('[data-testid="owner-link"] > [data-testid="diff-added"]') .scrollIntoView() .should('be.visible'); }); @@ -281,7 +225,7 @@ describe(`Database version page should work properly`, () => { cy.get('[data-testid="version-button"]').as('versionButton'); - cy.get('@versionButton').contains('0.5'); + cy.get('@versionButton').contains('0.2'); addTier(TIER, `databases`); @@ -297,35 +241,17 @@ describe(`Database version page should work properly`, () => { ); interceptURL( 'GET', - `/api/v1/databases/${databaseId}/versions/0.6`, - 'getSelectedVersionDetails' - ); - - cy.get('@versionButton').contains('0.6').click(); - - verifyResponseStatusCode(`@getDatabaseDetails`, 200); - verifyResponseStatusCode('@getVersionsList', 200); - verifyResponseStatusCode('@getSelectedVersionDetails', 200); - - cy.get(`[data-testid="diff-added"]`).scrollIntoView().should('be.visible'); - - cy.get('@versionButton').contains('0.6').click(); - - removeTier(`databases`); - - interceptURL( - 'GET', - `/api/v1/databases/${databaseId}/versions/0.7`, + `/api/v1/databases/${databaseId}/versions/0.2`, 'getSelectedVersionDetails' ); - cy.get('@versionButton').contains('0.7').click(); + cy.get('@versionButton').contains('0.2').click(); verifyResponseStatusCode(`@getDatabaseDetails`, 200); verifyResponseStatusCode('@getVersionsList', 200); verifyResponseStatusCode('@getSelectedVersionDetails', 200); - cy.get(`[data-testid="diff-removed"]`) + cy.get('[data-testid="Tier"] > [data-testid="diff-added"]') .scrollIntoView() .should('be.visible'); }); @@ -382,21 +308,3 @@ describe(`Database version page should work properly`, () => { ).should('not.exist'); }); }); - -describe('Common cleanup for database version test', () => { - beforeEach(() => { - cy.login(); - }); - - it('Domain deletion for database version test', () => { - const token = localStorage.getItem('oidcIdToken'); - - cy.request({ - method: 'DELETE', - url: `/api/v1/domains/name/${DOMAIN_CREATION_DETAILS.name}`, - headers: { Authorization: `Bearer ${token}` }, - }).then((response) => { - expect(response.status).to.eq(200); - }); - }); -}); diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/EntityVersionPages.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/EntityVersionPages.spec.js index 748f1451185e..d3590f4f8d4b 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/EntityVersionPages.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/EntityVersionPages.spec.js @@ -18,8 +18,6 @@ import { addTier, deleteEntity, interceptURL, - removeOwner, - removeTier, verifyResponseStatusCode, visitEntityDetailsPage, } from '../../common/common'; @@ -34,311 +32,221 @@ import { let domainId; describe('Common prerequisite for entity version test', () => { - beforeEach(() => { + before(() => { cy.login(); - }); - - it('Domain creation for entity version test', () => { - const token = localStorage.getItem('oidcIdToken'); - - cy.request({ - method: 'PUT', - url: `/api/v1/domains`, - headers: { Authorization: `Bearer ${token}` }, - body: DOMAIN_CREATION_DETAILS, - }).then((response) => { - expect(response.status).to.eq(201); - - domainId = response.body.id; + cy.getAllLocalStorage().then((data) => { + const token = Object.values(data)[0].oidcIdToken; + cy.request({ + method: 'PUT', + url: `/api/v1/domains`, + headers: { Authorization: `Bearer ${token}` }, + body: DOMAIN_CREATION_DETAILS, + }).then((response) => { + domainId = response.body.id; + }); }); }); -}); -Object.entries(ENTITY_DETAILS_FOR_VERSION_TEST).map( - ([entityType, entityDetails]) => { - describe(`${entityType} version page should work properly`, () => { - const successMessageEntityName = - entityType === 'ML Model' ? 'Mlmodel' : entityType; - let entityId; - let entityFQN; - - beforeEach(() => { - cy.login(); + after(() => { + cy.login(); + cy.getAllLocalStorage().then((data) => { + const token = Object.values(data)[0].oidcIdToken; + cy.request({ + method: 'DELETE', + url: `/api/v1/domains/name/${DOMAIN_CREATION_DETAILS.name}`, + headers: { Authorization: `Bearer ${token}` }, }); + }); + }); - it(`Prerequisite for ${entityType} version page test`, () => { - const token = localStorage.getItem('oidcIdToken'); - - cy.request({ - method: 'PUT', - url: `/api/v1/${entityDetails.entity}`, - headers: { Authorization: `Bearer ${token}` }, - body: entityDetails.entityCreationDetails, - }).then((response) => { - expect(response.status).to.eq(201); - - entityId = response.body.id; - entityFQN = response.body.fullyQualifiedName; - - cy.request({ - method: 'PATCH', - url: `/api/v1/${entityDetails.entity}/${entityId}`, - headers: { - Authorization: `Bearer ${token}`, - 'Content-Type': 'application/json-patch+json', - }, - body: [ - ...entityDetails.entityPatchPayload, - { - op: 'add', - path: '/domain', - value: { - id: domainId, - type: 'domain', - name: DOMAIN_CREATION_DETAILS.name, - description: DOMAIN_CREATION_DETAILS.description, + Object.entries(ENTITY_DETAILS_FOR_VERSION_TEST).map( + ([entityType, entityDetails]) => { + describe(`${entityType} version page should work properly`, () => { + const successMessageEntityName = + entityType === 'ML Model' ? 'Mlmodel' : entityType; + let entityId; + let entityFQN; + + before(() => { + cy.login(); + cy.getAllLocalStorage().then((data) => { + const token = Object.values(data)[0].oidcIdToken; + cy.request({ + method: 'PUT', + url: `/api/v1/${entityDetails.entity}`, + headers: { Authorization: `Bearer ${token}` }, + body: entityDetails.entityCreationDetails, + }).then((response) => { + entityId = response.body.id; + entityFQN = response.body.fullyQualifiedName; + + cy.request({ + method: 'PATCH', + url: `/api/v1/${entityDetails.entity}/${entityId}`, + headers: { + Authorization: `Bearer ${token}`, + 'Content-Type': 'application/json-patch+json', }, - }, - ], - }).then((response) => { - expect(response.status).to.eq(200); + body: [ + ...entityDetails.entityPatchPayload, + { + op: 'add', + path: '/domain', + value: { + id: domainId, + type: 'domain', + name: DOMAIN_CREATION_DETAILS.name, + description: DOMAIN_CREATION_DETAILS.description, + }, + }, + ], + }); + }); }); }); - }); - it(`${entityType} version page should show description and tag changes properly`, () => { - visitEntityDetailsVersionPage( - entityDetails, - entityId, - entityFQN, - '0.2' - ); - - cy.get(`[data-testid="domain-link"] [data-testid="diff-added"]`) - .scrollIntoView() - .should('be.visible'); - - cy.get( - `[data-testid="asset-description-container"] [data-testid="diff-added"]` - ) - .scrollIntoView() - .should('be.visible'); - - cy.get( - `[data-testid="entity-right-panel"] .diff-added [data-testid="tag-PersonalData.SpecialCategory"]` - ) - .scrollIntoView() - .should('be.visible'); - - if (entityDetails.isChildrenExist) { - cy.get( - `[${entityDetails.childSelector}="${entityDetails.updatedTagEntityChildName}"] .diff-added [data-testid="tag-PersonalData.Personal"]` - ) + beforeEach(() => { + cy.login(); + }); + + it(`${entityType} version page should show description and tag changes properly`, () => { + visitEntityDetailsVersionPage( + entityDetails, + entityId, + entityFQN, + '0.2' + ); + + cy.get(`[data-testid="domain-link"] [data-testid="diff-added"]`) .scrollIntoView() .should('be.visible'); cy.get( - `[${entityDetails.childSelector}="${entityDetails.updatedTagEntityChildName}"] .diff-added [data-testid="tag-PII.Sensitive"]` + `[data-testid="asset-description-container"] [data-testid="diff-added"]` ) .scrollIntoView() .should('be.visible'); - cy.get(`[data-testid="diff-removed"]`) - .contains(entityDetails.entityChildRemovedDescription) - .scrollIntoView() - .should('be.visible'); - - cy.get(`[data-testid="diff-added"]`) - .contains(entityDetails.entityChildAddedDescription) + cy.get( + `[data-testid="entity-right-panel"] .diff-added [data-testid="tag-PersonalData.SpecialCategory"]` + ) .scrollIntoView() .should('be.visible'); - } - }); - it(`${entityType} version page should show removed tags changes properly`, () => { - visitEntityDetailsPage({ - term: entityDetails.name, - serviceName: entityDetails.serviceName, - entity: entityDetails.entity, - entityType: entityType, + if (entityDetails.isChildrenExist) { + cy.get( + `[${entityDetails.childSelector}="${entityDetails.updatedTagEntityChildName}"] .diff-added [data-testid="tag-PersonalData.Personal"]` + ) + .scrollIntoView() + .should('be.visible'); + + cy.get( + `[${entityDetails.childSelector}="${entityDetails.updatedTagEntityChildName}"] .diff-added [data-testid="tag-PII.Sensitive"]` + ) + .scrollIntoView() + .should('be.visible'); + + cy.get(`[data-testid="diff-removed"]`) + .contains(entityDetails.entityChildRemovedDescription) + .scrollIntoView() + .should('be.visible'); + + cy.get(`[data-testid="diff-added"]`) + .contains(entityDetails.entityChildAddedDescription) + .scrollIntoView() + .should('be.visible'); + } }); - cy.get( - '[data-testid="entity-right-panel"] [data-testid="edit-button"]' - ).click(); + it(`${entityType} version page should show owner changes properly`, () => { + visitEntityDetailsPage({ + term: entityDetails.name, + serviceName: entityDetails.serviceName, + entity: entityDetails.entity, + }); - cy.get( - '[data-testid="selected-tag-PersonalData.SpecialCategory"] [data-testid="remove-tags"]' - ).click(); + cy.get('[data-testid="version-button"]').as('versionButton'); - interceptURL( - 'PATCH', - `/api/v1/${entityDetails.entity}/${entityId}`, - `patch${entityType}` - ); + cy.get('@versionButton').contains('0.2'); - cy.get('[data-testid="saveAssociatedTag"]').click(); + addOwner(OWNER, entityDetails.entity); - verifyResponseStatusCode(`@patch${entityType}`, 200); + interceptURL( + 'GET', + `/api/v1/${entityDetails.entity}/name/${entityFQN}?*include=all`, + `get${entityType}Details` + ); + interceptURL( + 'GET', + `/api/v1/${entityDetails.entity}/${entityId}/versions`, + 'getVersionsList' + ); + interceptURL( + 'GET', + `/api/v1/${entityDetails.entity}/${entityId}/versions/0.2`, + 'getSelectedVersionDetails' + ); - cy.get('[data-testid="version-button"]').contains('0.3').click(); + cy.get('@versionButton').contains('0.2').click(); - cy.get( - `[data-testid="entity-right-panel"] .diff-removed [data-testid="tag-PersonalData.SpecialCategory"]` - ) - .scrollIntoView() - .should('be.visible'); - }); + verifyResponseStatusCode(`@get${entityType}Details`, 200); + verifyResponseStatusCode('@getVersionsList', 200); + verifyResponseStatusCode('@getSelectedVersionDetails', 200); - it(`${entityType} version page should show owner changes properly`, () => { - visitEntityDetailsPage({ - term: entityDetails.name, - serviceName: entityDetails.serviceName, - entity: entityDetails.entity, - entityType: entityType, + cy.get('[data-testid="owner-link"] > [data-testid="diff-added"]') + .scrollIntoView() + .should('be.visible'); }); - cy.get('[data-testid="version-button"]').as('versionButton'); - - cy.get('@versionButton').contains('0.3'); - - addOwner(OWNER, entityDetails.entity); - - interceptURL( - 'GET', - `/api/v1/${entityDetails.entity}/name/${entityFQN}?*include=all`, - `get${entityType}Details` - ); - interceptURL( - 'GET', - `/api/v1/${entityDetails.entity}/${entityId}/versions`, - 'getVersionsList' - ); - interceptURL( - 'GET', - `/api/v1/${entityDetails.entity}/${entityId}/versions/0.4`, - 'getSelectedVersionDetails' - ); - - cy.get('@versionButton').contains('0.4').click(); - - verifyResponseStatusCode(`@get${entityType}Details`, 200); - verifyResponseStatusCode('@getVersionsList', 200); - verifyResponseStatusCode('@getSelectedVersionDetails', 200); - - cy.get(`[data-testid="diff-added`) - .scrollIntoView() - .should('be.visible'); + it(`${entityType} version page should show tier changes properly`, () => { + visitEntityDetailsPage({ + term: entityDetails.name, + serviceName: entityDetails.serviceName, + entity: entityDetails.entity, + }); - cy.get('@versionButton').contains('0.4').click(); + cy.get('[data-testid="version-button"]').as('versionButton'); - removeOwner(entityDetails.entity); + cy.get('@versionButton').contains('0.2'); - interceptURL( - 'GET', - `/api/v1/${entityDetails.entity}/${entityId}/versions/0.5`, - 'getSelectedVersionDetails' - ); + addTier(TIER, entityDetails.entity); - cy.get('@versionButton').contains('0.5').click(); + interceptURL( + 'GET', + `/api/v1/${entityDetails.entity}/name/${entityFQN}?*include=all`, + `get${entityType}Details` + ); + interceptURL( + 'GET', + `/api/v1/${entityDetails.entity}/${entityId}/versions`, + 'getVersionsList' + ); + interceptURL( + 'GET', + `/api/v1/${entityDetails.entity}/${entityId}/versions/0.2`, + 'getSelectedVersionDetails' + ); - verifyResponseStatusCode(`@get${entityType}Details`, 200); - verifyResponseStatusCode('@getVersionsList', 200); - verifyResponseStatusCode('@getSelectedVersionDetails', 200); + cy.get('@versionButton').contains('0.2').click(); - cy.get(`[data-testid="diff-removed"]`) - .scrollIntoView() - .should('be.visible'); - }); + verifyResponseStatusCode(`@get${entityType}Details`, 200); + verifyResponseStatusCode('@getVersionsList', 200); + verifyResponseStatusCode('@getSelectedVersionDetails', 200); - it(`${entityType} version page should show tier changes properly`, () => { - visitEntityDetailsPage({ - term: entityDetails.name, - serviceName: entityDetails.serviceName, - entity: entityDetails.entity, - entityType: entityType, + cy.get('[data-testid="Tier"] > [data-testid="diff-added"]') + .scrollIntoView() + .should('be.visible'); }); - cy.get('[data-testid="version-button"]').as('versionButton'); - - cy.get('@versionButton').contains('0.5'); - - addTier(TIER, entityDetails.entity); - - interceptURL( - 'GET', - `/api/v1/${entityDetails.entity}/name/${entityFQN}?*include=all`, - `get${entityType}Details` - ); - interceptURL( - 'GET', - `/api/v1/${entityDetails.entity}/${entityId}/versions`, - 'getVersionsList' - ); - interceptURL( - 'GET', - `/api/v1/${entityDetails.entity}/${entityId}/versions/0.6`, - 'getSelectedVersionDetails' - ); - - cy.get('@versionButton').contains('0.6').click(); - - verifyResponseStatusCode(`@get${entityType}Details`, 200); - verifyResponseStatusCode('@getVersionsList', 200); - verifyResponseStatusCode('@getSelectedVersionDetails', 200); - - cy.get(`[data-testid="diff-added"]`) - .scrollIntoView() - .should('be.visible'); - - cy.get('@versionButton').contains('0.6').click(); - - removeTier(entityDetails.entity); - - interceptURL( - 'GET', - `/api/v1/${entityDetails.entity}/${entityId}/versions/0.7`, - 'getSelectedVersionDetails' - ); - - cy.get('@versionButton').contains('0.7').click(); - - verifyResponseStatusCode(`@get${entityType}Details`, 200); - verifyResponseStatusCode('@getVersionsList', 200); - verifyResponseStatusCode('@getSelectedVersionDetails', 200); - - cy.get(`[data-testid="diff-removed"]`) - .scrollIntoView() - .should('be.visible'); - }); - - it(`Cleanup for ${entityType} version page test`, () => { - deleteEntity( - entityDetails.name, - entityDetails.serviceName, - entityDetails.entity, - entityType, - successMessageEntityName - ); + it(`Cleanup for ${entityType} version page test`, () => { + deleteEntity( + entityDetails.name, + entityDetails.serviceName, + entityDetails.entity, + successMessageEntityName + ); + }); }); - }); - } -); - -describe('Common cleanup for entity version test', () => { - beforeEach(() => { - cy.login(); - }); - - it('Domain deletion for entity version test', () => { - const token = localStorage.getItem('oidcIdToken'); - - cy.request({ - method: 'DELETE', - url: `/api/v1/domains/name/${DOMAIN_CREATION_DETAILS.name}`, - headers: { Authorization: `Bearer ${token}` }, - }).then((response) => { - expect(response.status).to.eq(200); - }); - }); + } + ); }); diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/GlossaryVersionPage.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/GlossaryVersionPage.spec.js index 528db3ec2fa7..d12aa5f4ef83 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/GlossaryVersionPage.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/GlossaryVersionPage.spec.js @@ -42,88 +42,80 @@ describe('Glossary and glossary term version pages should work properly', () => let glossaryTerm1Id; let glossaryTerm2Id; - beforeEach(() => { + before(() => { cy.login(); - interceptURL('GET', `/api/v1/glossaries?fields=*`, 'getGlossaryDetails'); - interceptURL('GET', '/api/v1/glossaryTerms?glossary=*', 'getGlossaryTerms'); - visitGlossaryPage(); - }); - - it('Prerequisites for glossary and glossary term version page tests', () => { - const token = localStorage.getItem('oidcIdToken'); - - // Create Glossary - cy.request({ - method: 'PUT', - url: `/api/v1/glossaries`, - headers: { Authorization: `Bearer ${token}` }, - body: GLOSSARY_FOR_VERSION_TEST, - }).then((response) => { - expect(response.status).to.eq(201); - - glossaryId = response.body.id; - + cy.getAllLocalStorage().then((data) => { + const token = Object.values(data)[0].oidcIdToken; + // Create Glossary cy.request({ - method: 'PATCH', - url: `/api/v1/glossaries/${glossaryId}`, - headers: { - Authorization: `Bearer ${token}`, - 'Content-Type': 'application/json-patch+json', - }, - body: GLOSSARY_PATCH_PAYLOAD, + method: 'PUT', + url: `/api/v1/glossaries`, + headers: { Authorization: `Bearer ${token}` }, + body: GLOSSARY_FOR_VERSION_TEST, }).then((response) => { - expect(response.status).to.eq(200); + glossaryId = response.body.id; + + cy.request({ + method: 'PATCH', + url: `/api/v1/glossaries/${glossaryId}`, + headers: { + Authorization: `Bearer ${token}`, + 'Content-Type': 'application/json-patch+json', + }, + body: GLOSSARY_PATCH_PAYLOAD, + }); }); - }); - - // Create First Glossary Term - cy.request({ - method: 'PUT', - url: `/api/v1/glossaryTerms`, - headers: { Authorization: `Bearer ${token}` }, - body: GLOSSARY_TERM_FOR_VERSION_TEST1, - }).then((response) => { - expect(response.status).to.eq(201); - glossaryTerm1Id = response.body.id; - }); - - // Create Second Glossary Term - cy.request({ - method: 'PUT', - url: `/api/v1/glossaryTerms`, - headers: { Authorization: `Bearer ${token}` }, - body: GLOSSARY_TERM_FOR_VERSION_TEST2, - }).then((response) => { - expect(response.status).to.eq(201); - - glossaryTerm2Id = response.body.id; - - const relatedTermsPatchValue = { - op: 'add', - path: '/relatedTerms/0', - value: { - id: glossaryTerm1Id, - type: 'glossaryTerm', - displayName: GLOSSARY_TERM_NAME_FOR_VERSION_TEST1, - name: GLOSSARY_TERM_NAME_FOR_VERSION_TEST1, - }, - }; + // Create First Glossary Term + cy.request({ + method: 'PUT', + url: `/api/v1/glossaryTerms`, + headers: { Authorization: `Bearer ${token}` }, + body: GLOSSARY_TERM_FOR_VERSION_TEST1, + }).then((response) => { + glossaryTerm1Id = response.body.id; + }); + // Create Second Glossary Term cy.request({ - method: 'PATCH', - url: `/api/v1/glossaryTerms/${glossaryTerm2Id}`, - headers: { - Authorization: `Bearer ${token}`, - 'Content-Type': 'application/json-patch+json', - }, - body: [...GLOSSARY_TERM_PATCH_PAYLOAD2, relatedTermsPatchValue], + method: 'PUT', + url: `/api/v1/glossaryTerms`, + headers: { Authorization: `Bearer ${token}` }, + body: GLOSSARY_TERM_FOR_VERSION_TEST2, }).then((response) => { - expect(response.status).to.eq(200); + glossaryTerm2Id = response.body.id; + + const relatedTermsPatchValue = { + op: 'add', + path: '/relatedTerms/0', + value: { + id: glossaryTerm1Id, + type: 'glossaryTerm', + displayName: GLOSSARY_TERM_NAME_FOR_VERSION_TEST1, + name: GLOSSARY_TERM_NAME_FOR_VERSION_TEST1, + }, + }; + + cy.request({ + method: 'PATCH', + url: `/api/v1/glossaryTerms/${glossaryTerm2Id}`, + headers: { + Authorization: `Bearer ${token}`, + 'Content-Type': 'application/json-patch+json', + }, + body: [...GLOSSARY_TERM_PATCH_PAYLOAD2, relatedTermsPatchValue], + }); }); }); }); + beforeEach(() => { + cy.login(); + interceptURL('GET', `/api/v1/glossaries?fields=*`, 'getGlossaryDetails'); + interceptURL('GET', '/api/v1/glossaryTerms?glossary=*', 'getGlossaryTerms'); + visitGlossaryPage(); + }); + it('Glossary version page should display the version changes properly', () => { cy.get(`[data-menu-id*=${GLOSSARY_FOR_VERSION_TEST.displayName}]`).click(); @@ -156,11 +148,11 @@ describe('Glossary and glossary term version pages should work properly', () => interceptURL('GET', `/api/v1/glossaries/*/versions`, 'getVersionsList'); interceptURL( 'GET', - `/api/v1/glossaries/*/versions/0.3`, + `/api/v1/glossaries/*/versions/0.2`, 'getSelectedVersionDetails' ); - cy.get('[data-testid="version-button"]').contains('0.3').click(); + cy.get('[data-testid="version-button"]').contains('0.2').click(); verifyResponseStatusCode('@getVersionsList', 200); verifyResponseStatusCode('@getSelectedVersionDetails', 200); @@ -169,42 +161,22 @@ describe('Glossary and glossary term version pages should work properly', () => .scrollIntoView() .should('be.visible'); - cy.get('[data-testid="version-button"]').contains('0.3').click(); + cy.get('[data-testid="version-button"]').contains('0.2').click(); verifyResponseStatusCode('@getGlossaryDetails', 200); verifyResponseStatusCode('@getGlossaryTerms', 200); removeOwner('glossaries', true); - interceptURL( - 'GET', - `/api/v1/glossaries/*/versions/0.4`, - 'getSelectedVersionDetails' - ); - - cy.get('[data-testid="version-button"]').contains('0.4').click(); - - verifyResponseStatusCode('@getVersionsList', 200); - verifyResponseStatusCode('@getSelectedVersionDetails', 200); - - cy.get('[data-testid="glossary-owner-name"] [data-testid="diff-removed"]') - .scrollIntoView() - .should('be.visible'); - - cy.get('[data-testid="version-button"]').contains('0.4').click(); - - verifyResponseStatusCode('@getGlossaryDetails', 200); - verifyResponseStatusCode('@getGlossaryTerms', 200); - addReviewer(REVIEWER, 'glossaries'); interceptURL( 'GET', - `/api/v1/glossaries/*/versions/0.5`, + `/api/v1/glossaries/*/versions/0.2`, 'getSelectedVersionDetails' ); - cy.get('[data-testid="version-button"]').contains('0.5').click(); + cy.get('[data-testid="version-button"]').contains('0.2').click(); verifyResponseStatusCode('@getVersionsList', 200); verifyResponseStatusCode('@getSelectedVersionDetails', 200); @@ -213,27 +185,12 @@ describe('Glossary and glossary term version pages should work properly', () => .scrollIntoView() .should('be.visible'); - cy.get('[data-testid="version-button"]').contains('0.5').click(); + cy.get('[data-testid="version-button"]').contains('0.2').click(); verifyResponseStatusCode('@getGlossaryDetails', 200); verifyResponseStatusCode('@getGlossaryTerms', 200); removeReviewer('glossaries'); - - interceptURL( - 'GET', - `/api/v1/glossaries/*/versions/0.6`, - 'getSelectedVersionDetails' - ); - - cy.get('[data-testid="version-button"]').contains('0.6').click(); - - verifyResponseStatusCode('@getVersionsList', 200); - verifyResponseStatusCode('@getSelectedVersionDetails', 200); - - cy.get('[data-testid="glossary-reviewer"] [data-testid="diff-removed"]') - .scrollIntoView() - .should('be.visible'); }); it('Glossary term version page should display version changes properly', () => { @@ -318,11 +275,11 @@ describe('Glossary and glossary term version pages should work properly', () => interceptURL('GET', `/api/v1/glossaryTerms/*/versions`, 'getVersionsList'); interceptURL( 'GET', - `/api/v1/glossaryTerms/*/versions/0.3`, + `/api/v1/glossaryTerms/*/versions/0.2`, 'getSelectedVersionDetails' ); - cy.get('[data-testid="version-button"]').contains('0.3').click(); + cy.get('[data-testid="version-button"]').contains('0.2').click(); verifyResponseStatusCode('@getVersionsList', 200); verifyResponseStatusCode('@getSelectedVersionDetails', 200); @@ -331,42 +288,22 @@ describe('Glossary and glossary term version pages should work properly', () => .scrollIntoView() .should('be.visible'); - cy.get('[data-testid="version-button"]').contains('0.3').click(); + cy.get('[data-testid="version-button"]').contains('0.2').click(); verifyResponseStatusCode('@getGlossaryTermParents', 200); verifyResponseStatusCode('@getChildGlossaryTerms', 200); removeOwner('glossaryTerms', true); - interceptURL( - 'GET', - `/api/v1/glossaryTerms/*/versions/0.4`, - 'getSelectedVersionDetails' - ); - - cy.get('[data-testid="version-button"]').contains('0.4').click(); - - verifyResponseStatusCode('@getVersionsList', 200); - verifyResponseStatusCode('@getSelectedVersionDetails', 200); - - cy.get('[data-testid="glossary-owner-name"] [data-testid="diff-removed"]') - .scrollIntoView() - .should('be.visible'); - - cy.get('[data-testid="version-button"]').contains('0.4').click(); - - verifyResponseStatusCode('@getGlossaryTermParents', 200); - verifyResponseStatusCode('@getChildGlossaryTerms', 200); - addReviewer(REVIEWER, 'glossaryTerms'); interceptURL( 'GET', - `/api/v1/glossaryTerms/*/versions/0.5`, + `/api/v1/glossaryTerms/*/versions/0.2`, 'getSelectedVersionDetails' ); - cy.get('[data-testid="version-button"]').contains('0.5').click(); + cy.get('[data-testid="version-button"]').contains('0.2').click(); verifyResponseStatusCode('@getVersionsList', 200); verifyResponseStatusCode('@getSelectedVersionDetails', 200); @@ -375,27 +312,12 @@ describe('Glossary and glossary term version pages should work properly', () => .scrollIntoView() .should('be.visible'); - cy.get('[data-testid="version-button"]').contains('0.5').click(); + cy.get('[data-testid="version-button"]').contains('0.2').click(); verifyResponseStatusCode('@getGlossaryTermParents', 200); verifyResponseStatusCode('@getChildGlossaryTerms', 200); removeReviewer('glossaryTerms'); - - interceptURL( - 'GET', - `/api/v1/glossaryTerms/*/versions/0.6`, - 'getSelectedVersionDetails' - ); - - cy.get('[data-testid="version-button"]').contains('0.6').click(); - - verifyResponseStatusCode('@getVersionsList', 200); - verifyResponseStatusCode('@getSelectedVersionDetails', 200); - - cy.get('[data-testid="glossary-reviewer"] [data-testid="diff-removed"]') - .scrollIntoView() - .should('be.visible'); }); it('Cleanup for glossary and glossary term version page tests', () => { diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/SearchIndexDetails.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/SearchIndexDetails.spec.js index 85e64da8095c..8bb25cc95601 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/SearchIndexDetails.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/SearchIndexDetails.spec.js @@ -207,7 +207,6 @@ describe('SearchIndexDetails page should work properly for data consumer role', term: SEARCH_INDEX_DETAILS_FOR_DETAILS_PAGE_TEST.name, serviceName: SEARCH_INDEX_DETAILS_FOR_DETAILS_PAGE_TEST.service, entity: 'searchIndexes', - entityType: 'Search Index', }); // Edit domain option should not be available @@ -286,7 +285,6 @@ describe('SearchIndexDetails page should work properly for data steward role', ( term: SEARCH_INDEX_DETAILS_FOR_DETAILS_PAGE_TEST.name, serviceName: SEARCH_INDEX_DETAILS_FOR_DETAILS_PAGE_TEST.service, entity: 'searchIndexes', - entityType: 'Search Index', }); // Edit domain option should not be available @@ -372,7 +370,6 @@ describe('SearchIndexDetails page should work properly for admin role', () => { SEARCH_INDEX_DETAILS_FOR_DETAILS_PAGE_TEST.service, 'searchIndexes', 'Search Index', - 'Search Index', 'soft' ); @@ -443,7 +440,6 @@ describe('SearchIndexDetails page should work properly for admin role', () => { SEARCH_INDEX_DETAILS_FOR_DETAILS_PAGE_TEST.name, SEARCH_INDEX_DETAILS_FOR_DETAILS_PAGE_TEST.service, 'searchIndexes', - 'Search Index', 'Search Index' ); }); diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/ServiceVersionPage.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/ServiceVersionPage.spec.js index 356c1012685c..7a7d366a2a38 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/ServiceVersionPage.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/ServiceVersionPage.spec.js @@ -17,8 +17,6 @@ import { addOwner, addTier, interceptURL, - removeOwner, - removeTier, toastNotification, verifyResponseStatusCode, visitServiceDetailsPage, @@ -34,88 +32,151 @@ import { let domainId; describe('Common prerequisite for service version test', () => { - beforeEach(() => { + before(() => { cy.login(); - }); - - it('Domain creation for service version test', () => { - const token = localStorage.getItem('oidcIdToken'); - - cy.request({ - method: 'PUT', - url: `/api/v1/domains`, - headers: { Authorization: `Bearer ${token}` }, - body: DOMAIN_CREATION_DETAILS, - }).then((response) => { - expect(response.status).to.eq(201); - - domainId = response.body.id; + cy.getAllLocalStorage().then((data) => { + const token = Object.values(data)[0].oidcIdToken; + cy.request({ + method: 'PUT', + url: `/api/v1/domains`, + headers: { Authorization: `Bearer ${token}` }, + body: DOMAIN_CREATION_DETAILS, + }).then((response) => { + domainId = response.body.id; + }); }); }); -}); - -Object.entries(SERVICE_DETAILS_FOR_VERSION_TEST).map( - ([serviceType, serviceDetails]) => { - describe(`${serviceType} service version page`, () => { - const successMessageEntityName = - serviceType === 'ML Model' ? 'Mlmodel' : serviceType; - let serviceId; - beforeEach(() => { - cy.login(); + after(() => { + cy.login(); + cy.getAllLocalStorage().then((data) => { + const token = Object.values(data)[0].oidcIdToken; + cy.request({ + method: 'DELETE', + url: `/api/v1/domains/name/${DOMAIN_CREATION_DETAILS.name}`, + headers: { Authorization: `Bearer ${token}` }, }); + }); + }); - it(`Prerequisite for ${serviceType} service version page`, () => { - const token = localStorage.getItem('oidcIdToken'); - - cy.request({ - method: 'POST', - url: `/api/v1/services/${serviceDetails.serviceCategory}`, - headers: { Authorization: `Bearer ${token}` }, - body: serviceDetails.entityCreationDetails, - }).then((response) => { - expect(response.status).to.eq(201); - - serviceId = response.body.id; - - cy.request({ - method: 'PATCH', - url: `/api/v1/services/${serviceDetails.serviceCategory}/${serviceId}`, - headers: { - Authorization: `Bearer ${token}`, - 'Content-Type': 'application/json-patch+json', - }, - body: [ - ...serviceDetails.entityPatchPayload, - { - op: 'add', - path: '/domain', - value: { - id: domainId, - type: 'domain', - name: DOMAIN_CREATION_DETAILS.name, - description: DOMAIN_CREATION_DETAILS.description, + Object.entries(SERVICE_DETAILS_FOR_VERSION_TEST).map( + ([serviceType, serviceDetails]) => { + describe(`${serviceType} service version page`, () => { + const successMessageEntityName = + serviceType === 'ML Model' ? 'Mlmodel' : serviceType; + let serviceId; + + before(() => { + cy.login(); + cy.getAllLocalStorage().then((data) => { + const token = Object.values(data)[0].oidcIdToken; + cy.request({ + method: 'POST', + url: `/api/v1/services/${serviceDetails.serviceCategory}`, + headers: { Authorization: `Bearer ${token}` }, + body: serviceDetails.entityCreationDetails, + }).then((response) => { + serviceId = response.body.id; + + cy.request({ + method: 'PATCH', + url: `/api/v1/services/${serviceDetails.serviceCategory}/${serviceId}`, + headers: { + Authorization: `Bearer ${token}`, + 'Content-Type': 'application/json-patch+json', }, - }, - ], - }).then((response) => { - expect(response.status).to.eq(200); + body: [ + ...serviceDetails.entityPatchPayload, + { + op: 'add', + path: '/domain', + value: { + id: domainId, + type: 'domain', + name: DOMAIN_CREATION_DETAILS.name, + description: DOMAIN_CREATION_DETAILS.description, + }, + }, + ], + }); + }); }); }); - }); - serviceType !== 'Metadata' && - it(`${serviceType} service version page should show edited tags and description changes properly`, () => { + beforeEach(() => { + cy.login(); + }); + + serviceType !== 'Metadata' && + it(`${serviceType} service version page should show edited tags and description changes properly`, () => { + visitServiceDetailsPage( + serviceDetails.settingsMenuId, + serviceDetails.serviceCategory, + serviceDetails.serviceName + ); + + interceptURL( + 'GET', + `/api/v1/services/${serviceDetails.serviceCategory}/name/${serviceDetails.serviceName}?*`, + `getServiceDetails` + ); + interceptURL( + 'GET', + `/api/v1/services/${serviceDetails.serviceCategory}/${serviceId}/versions`, + 'getVersionsList' + ); + interceptURL( + 'GET', + `/api/v1/services/${serviceDetails.serviceCategory}/${serviceId}/versions/0.2`, + 'getSelectedVersionDetails' + ); + + cy.get('[data-testid="version-button"]').contains('0.2').click(); + + verifyResponseStatusCode(`@getServiceDetails`, 200); + verifyResponseStatusCode('@getVersionsList', 200); + verifyResponseStatusCode('@getSelectedVersionDetails', 200); + + cy.get(`[data-testid="domain-link"]`) + .within(($this) => $this.find(`[data-testid="diff-added"]`)) + .scrollIntoView() + .should('be.visible'); + + cy.get('[data-testid="viewer-container"]') + .within(($this) => $this.find('[data-testid="diff-added"]')) + .scrollIntoView() + .should('be.visible'); + + cy.get( + `[data-testid="entity-right-panel"] .diff-added [data-testid="tag-PersonalData.SpecialCategory"]` + ) + .scrollIntoView() + .should('be.visible'); + + cy.get( + `[data-testid="entity-right-panel"] .diff-added [data-testid="tag-PII.Sensitive"]` + ) + .scrollIntoView() + .should('be.visible'); + }); + + it(`${serviceType} version page should show owner changes properly`, () => { visitServiceDetailsPage( serviceDetails.settingsMenuId, serviceDetails.serviceCategory, serviceDetails.serviceName ); + cy.get('[data-testid="version-button"]').as('versionButton'); + + cy.get('@versionButton').contains('0.2'); + + addOwner(OWNER, `services/${serviceDetails.serviceCategory}`); + interceptURL( 'GET', `/api/v1/services/${serviceDetails.serviceCategory}/name/${serviceDetails.serviceName}?*`, - `getServiceDetails` + `get${serviceType}Details` ); interceptURL( 'GET', @@ -128,259 +189,110 @@ Object.entries(SERVICE_DETAILS_FOR_VERSION_TEST).map( 'getSelectedVersionDetails' ); - cy.get('[data-testid="version-button"]').contains('0.2').click(); + cy.get('@versionButton').contains('0.2').click(); - verifyResponseStatusCode(`@getServiceDetails`, 200); + verifyResponseStatusCode(`@get${serviceType}Details`, 200); verifyResponseStatusCode('@getVersionsList', 200); verifyResponseStatusCode('@getSelectedVersionDetails', 200); - cy.get(`[data-testid="domain-link"]`) - .within(($this) => $this.find(`[data-testid="diff-added"]`)) - .scrollIntoView() - .should('be.visible'); - - cy.get('[data-testid="viewer-container"]') - .within(($this) => $this.find('[data-testid="diff-added"]')) - .scrollIntoView() - .should('be.visible'); - - cy.get( - `[data-testid="entity-right-panel"] .diff-added [data-testid="tag-PersonalData.SpecialCategory"]` - ) - .scrollIntoView() - .should('be.visible'); - - cy.get( - `[data-testid="entity-right-panel"] .diff-added [data-testid="tag-PII.Sensitive"]` - ) + cy.get('[data-testid="owner-link"] > [data-testid="diff-added"]') .scrollIntoView() .should('be.visible'); }); - it(`${serviceType} version page should show removed tags changes properly`, () => { - visitServiceDetailsPage( - serviceDetails.settingsMenuId, - serviceDetails.serviceCategory, - serviceDetails.serviceName - ); - - cy.get( - '[data-testid="entity-right-panel"] [data-testid="edit-button"]' - ).click(); - - cy.get( - '[data-testid="selected-tag-PersonalData.SpecialCategory"] [data-testid="remove-tags"]' - ).click(); - - interceptURL( - 'PATCH', - `/api/v1/services/${serviceDetails.serviceCategory}/${serviceId}`, - `patch${serviceType}` - ); - - cy.get('[data-testid="saveAssociatedTag"]').click(); - - verifyResponseStatusCode(`@patch${serviceType}`, 200); - - cy.get('[data-testid="version-button"]').contains('0.3').click(); - - cy.get( - `[data-testid="entity-right-panel"] .diff-removed [data-testid="tag-PersonalData.SpecialCategory"]` - ) - .scrollIntoView() - .should('be.visible'); - }); - - it(`${serviceType} version page should show owner changes properly`, () => { - visitServiceDetailsPage( - serviceDetails.settingsMenuId, - serviceDetails.serviceCategory, - serviceDetails.serviceName - ); - - cy.get('[data-testid="version-button"]').as('versionButton'); - - cy.get('@versionButton').contains('0.3'); - - addOwner(OWNER, `services/${serviceDetails.serviceCategory}`); - - interceptURL( - 'GET', - `/api/v1/services/${serviceDetails.serviceCategory}/name/${serviceDetails.serviceName}?*`, - `get${serviceType}Details` - ); - interceptURL( - 'GET', - `/api/v1/services/${serviceDetails.serviceCategory}/${serviceId}/versions`, - 'getVersionsList' - ); - interceptURL( - 'GET', - `/api/v1/services/${serviceDetails.serviceCategory}/${serviceId}/versions/0.4`, - 'getSelectedVersionDetails' - ); - - cy.get('@versionButton').contains('0.4').click(); - - verifyResponseStatusCode(`@get${serviceType}Details`, 200); - verifyResponseStatusCode('@getVersionsList', 200); - verifyResponseStatusCode('@getSelectedVersionDetails', 200); - - cy.get(`[data-testid="diff-added"]`) - .scrollIntoView() - .should('be.visible'); - - cy.get('@versionButton').contains('0.4').click(); - - removeOwner(`services/${serviceDetails.serviceCategory}`); - - interceptURL( - 'GET', - `/api/v1/services/${serviceDetails.serviceCategory}/${serviceId}/versions/0.5`, - 'getSelectedVersionDetails' - ); - - cy.get('@versionButton').contains('0.5').click(); - - verifyResponseStatusCode(`@get${serviceType}Details`, 200); - verifyResponseStatusCode('@getVersionsList', 200); - verifyResponseStatusCode('@getSelectedVersionDetails', 200); - - cy.get(`[data-testid="diff-removed"]`) - .scrollIntoView() - .should('be.visible'); - }); - - it(`${serviceType} version page should show tier changes properly`, () => { - visitServiceDetailsPage( - serviceDetails.settingsMenuId, - serviceDetails.serviceCategory, - serviceDetails.serviceName - ); - - cy.get('[data-testid="version-button"]').as('versionButton'); - - cy.get('@versionButton').contains('0.5'); - - addTier(TIER, `services/${serviceDetails.serviceCategory}`); + it(`${serviceType} version page should show tier changes properly`, () => { + visitServiceDetailsPage( + serviceDetails.settingsMenuId, + serviceDetails.serviceCategory, + serviceDetails.serviceName + ); - interceptURL( - 'GET', - `/api/v1/services/${serviceDetails.serviceCategory}/name/${serviceDetails.serviceName}?*`, - `get${serviceType}Details` - ); - interceptURL( - 'GET', - `/api/v1/services/${serviceDetails.serviceCategory}/${serviceId}/versions`, - 'getVersionsList' - ); - interceptURL( - 'GET', - `/api/v1/services/${serviceDetails.serviceCategory}/${serviceId}/versions/0.6`, - 'getSelectedVersionDetails' - ); + cy.get('[data-testid="version-button"]').as('versionButton'); - cy.get('@versionButton').contains('0.6').click(); + cy.get('@versionButton').contains('0.2'); - verifyResponseStatusCode(`@get${serviceType}Details`, 200); - verifyResponseStatusCode('@getVersionsList', 200); - verifyResponseStatusCode('@getSelectedVersionDetails', 200); + addTier(TIER, `services/${serviceDetails.serviceCategory}`); - cy.get(`[data-testid="diff-added"]`) - .scrollIntoView() - .should('be.visible'); + interceptURL( + 'GET', + `/api/v1/services/${serviceDetails.serviceCategory}/name/${serviceDetails.serviceName}?*`, + `get${serviceType}Details` + ); + interceptURL( + 'GET', + `/api/v1/services/${serviceDetails.serviceCategory}/${serviceId}/versions`, + 'getVersionsList' + ); + interceptURL( + 'GET', + `/api/v1/services/${serviceDetails.serviceCategory}/${serviceId}/versions/0.2`, + 'getSelectedVersionDetails' + ); - cy.get('@versionButton').contains('0.6').click(); + cy.get('@versionButton').contains('0.2').click(); - removeTier(`services/${serviceDetails.serviceCategory}`); + verifyResponseStatusCode(`@get${serviceType}Details`, 200); + verifyResponseStatusCode('@getVersionsList', 200); + verifyResponseStatusCode('@getSelectedVersionDetails', 200); - interceptURL( - 'GET', - `/api/v1/services/${serviceDetails.serviceCategory}/${serviceId}/versions/0.7`, - 'getSelectedVersionDetails' - ); + cy.get('[data-testid="Tier"] > [data-testid="diff-added"]') + .scrollIntoView() + .should('be.visible'); + }); - cy.get('@versionButton').contains('0.7').click(); + it(`Cleanup for ${serviceType} service version page tests`, () => { + visitServiceDetailsPage( + serviceDetails.settingsMenuId, + serviceDetails.serviceCategory, + serviceDetails.serviceName + ); + // Clicking on permanent delete radio button and checking the service name + cy.get('[data-testid="manage-button"]') + .should('exist') + .should('be.visible') + .click(); + + cy.get('[data-menu-id*="delete-button"]') + .should('exist') + .should('be.visible'); + cy.get('[data-testid="delete-button-title"]') + .should('be.visible') + .click() + .as('deleteBtn'); + + // Clicking on permanent delete radio button and checking the service name + cy.get('[data-testid="hard-delete-option"]') + .contains(serviceDetails.serviceName) + .should('be.visible') + .click(); + + cy.get('[data-testid="confirmation-text-input"]') + .should('be.visible') + .type(DELETE_TERM); + interceptURL( + 'DELETE', + `/api/v1/services/${serviceDetails.serviceCategory}/*`, + 'deleteService' + ); + interceptURL( + 'GET', + '/api/v1/services/*/name/*?fields=owner', + 'serviceDetails' + ); - verifyResponseStatusCode(`@get${serviceType}Details`, 200); - verifyResponseStatusCode('@getVersionsList', 200); - verifyResponseStatusCode('@getSelectedVersionDetails', 200); + cy.get('[data-testid="confirm-button"]').should('be.visible').click(); + verifyResponseStatusCode('@deleteService', 200); - cy.get(`[data-testid="diff-removed"]`) - .scrollIntoView() - .should('be.visible'); - }); + // Closing the toast notification + toastNotification( + `${successMessageEntityName} Service deleted successfully!` + ); - it(`Cleanup for ${serviceType} service version page tests`, () => { - visitServiceDetailsPage( - serviceDetails.settingsMenuId, - serviceDetails.serviceCategory, - serviceDetails.serviceName - ); - // Clicking on permanent delete radio button and checking the service name - cy.get('[data-testid="manage-button"]') - .should('exist') - .should('be.visible') - .click(); - - cy.get('[data-menu-id*="delete-button"]') - .should('exist') - .should('be.visible'); - cy.get('[data-testid="delete-button-title"]') - .should('be.visible') - .click() - .as('deleteBtn'); - - // Clicking on permanent delete radio button and checking the service name - cy.get('[data-testid="hard-delete-option"]') - .contains(serviceDetails.serviceName) - .should('be.visible') - .click(); - - cy.get('[data-testid="confirmation-text-input"]') - .should('be.visible') - .type(DELETE_TERM); - interceptURL( - 'DELETE', - `/api/v1/services/${serviceDetails.serviceCategory}/*`, - 'deleteService' - ); - interceptURL( - 'GET', - '/api/v1/services/*/name/*?fields=owner', - 'serviceDetails' - ); - - cy.get('[data-testid="confirm-button"]').should('be.visible').click(); - verifyResponseStatusCode('@deleteService', 200); - - // Closing the toast notification - toastNotification( - `${successMessageEntityName} Service deleted successfully!` - ); - - cy.get( - `[data-testid="service-name-${serviceDetails.serviceName}"]` - ).should('not.exist'); + cy.get( + `[data-testid="service-name-${serviceDetails.serviceName}"]` + ).should('not.exist'); + }); }); - }); - } -); - -describe('Common cleanup for service version test', () => { - beforeEach(() => { - cy.login(); - }); - - it('Domain deletion for service version test', () => { - const token = localStorage.getItem('oidcIdToken'); - - cy.request({ - method: 'DELETE', - url: `/api/v1/domains/name/${DOMAIN_CREATION_DETAILS.name}`, - headers: { Authorization: `Bearer ${token}` }, - }).then((response) => { - expect(response.status).to.eq(200); - }); - }); + } + ); }); diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Teams.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Teams.spec.js index 2f234dbee684..46d9eda48152 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Teams.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Teams.spec.js @@ -319,7 +319,9 @@ describe('Teams flow should work properly', () => { cy.get('[data-testid="team-heading"]') .should('be.visible') .contains(TEAM_DETAILS.updatedName); - cy.get('[data-testid="manage-button"]').click(); + cy.get( + '[data-testid="team-detail-header"] [data-testid="manage-button"]' + ).click(); cy.get('[data-menu-id*="delete-button"]').should('be.visible'); @@ -381,10 +383,9 @@ describe('Teams flow should work properly', () => { .should('be.visible') .contains(TEAM_DETAILS.updatedName); - cy.get('[data-testid="manage-button"]') - .should('exist') - .should('be.visible') - .click(); + cy.get( + '[data-testid="team-detail-header"] [data-testid="manage-button"]' + ).click(); cy.get('[data-menu-id*="delete-button"]').should('be.visible'); @@ -435,10 +436,9 @@ describe('Teams flow should work properly', () => { .click(); verifyResponseStatusCode('@getSelectedTeam', 200); - cy.get('[data-testid="manage-button"]') - .should('exist') - .should('be.visible') - .click(); + cy.get( + '[data-testid="team-detail-header"] [data-testid="manage-button"]' + ).click(); cy.get('[data-menu-id*="delete-button"]').should('be.visible'); diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Service/MlFlow.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Service/MlFlow.spec.js index 3a236e0f8146..a5fbbeefc985 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Service/MlFlow.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Service/MlFlow.spec.js @@ -15,24 +15,18 @@ import { deleteCreatedService, goToAddNewServicePage, testServiceCreationAndIngestion, - updateDescriptionForIngestedTables, uuid, } from '../../common/common'; -import { - API_SERVICE, - MYDATA_SUMMARY_OPTIONS, - SERVICE_TYPE, -} from '../../constants/constants'; +import { API_SERVICE, SERVICE_TYPE } from '../../constants/constants'; const serviceType = 'Mlflow'; const serviceName = `${serviceType}-ct-test-${uuid()}`; const modelName = 'ElasticnetWineModel'; -const description = `This is ${modelName} description`; const connectionInput = () => { - cy.get('#root\\/trackingUri').type(Cypress.env('mlModelTrackingUri')); + cy.get('#root\\/trackingUri').type('mlModelTrackingUri'); checkServiceFieldSectionHighlighting('trackingUri'); - cy.get('#root\\/registryUri').type(Cypress.env('mlModelRegistryUri')); + cy.get('#root\\/registryUri').type('mlModelRegistryUri'); checkServiceFieldSectionHighlighting('registryUri'); }; @@ -57,19 +51,11 @@ describe('ML Flow Ingestion', () => { serviceName, type: SERVICE_TYPE.MLModels, serviceCategory: 'MlModel', + shouldAddIngestion: false, + allowTestConnection: false, }); }); - it('Update MlModel description and verify description after re-run', () => { - updateDescriptionForIngestedTables( - serviceName, - modelName, - description, - SERVICE_TYPE.MLModels, - MYDATA_SUMMARY_OPTIONS.mlmodels - ); - }); - it('delete created service', () => { deleteCreatedService( SERVICE_TYPE.MLModels, diff --git a/openmetadata-ui/src/main/resources/ui/cypress/plugins/index.js b/openmetadata-ui/src/main/resources/ui/cypress/plugins/index.js index efc8d10c323f..596e3d0458f1 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/plugins/index.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/plugins/index.js @@ -101,10 +101,6 @@ export default (on, config) => { // Airflow config.env.airflowHostPort = env.CYPRESS_AIRFLOW_HOST_PORT; - // MlModel - config.env.mlModelTrackingUri = env.CYPRESS_ML_MODEL_TRACKING_URI; - config.env.mlModelRegistryUri = env.CYPRESS_ML_MODEL_REGISTRY_URI; - // S3 storage config.env.s3StorageAccessKeyId = env.CYPRESS_S3_STORAGE_ACCESS_KEY_ID; config.env.s3StorageSecretAccessKey = diff --git a/openmetadata-ui/src/main/resources/ui/src/assets/svg/callout-danger.svg b/openmetadata-ui/src/main/resources/ui/src/assets/svg/callout-danger.svg new file mode 100644 index 000000000000..90a1c4e0c678 --- /dev/null +++ b/openmetadata-ui/src/main/resources/ui/src/assets/svg/callout-danger.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/openmetadata-ui/src/main/resources/ui/src/assets/svg/callout-info.svg b/openmetadata-ui/src/main/resources/ui/src/assets/svg/callout-info.svg new file mode 100644 index 000000000000..ec19684db624 --- /dev/null +++ b/openmetadata-ui/src/main/resources/ui/src/assets/svg/callout-info.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/openmetadata-ui/src/main/resources/ui/src/assets/svg/callout-note.svg b/openmetadata-ui/src/main/resources/ui/src/assets/svg/callout-note.svg new file mode 100644 index 000000000000..98729a7e8074 --- /dev/null +++ b/openmetadata-ui/src/main/resources/ui/src/assets/svg/callout-note.svg @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/openmetadata-ui/src/main/resources/ui/src/assets/svg/callout-warning.svg b/openmetadata-ui/src/main/resources/ui/src/assets/svg/callout-warning.svg new file mode 100644 index 000000000000..1b0082f665da --- /dev/null +++ b/openmetadata-ui/src/main/resources/ui/src/assets/svg/callout-warning.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/openmetadata-ui/src/main/resources/ui/src/assets/svg/ic-format-callout.svg b/openmetadata-ui/src/main/resources/ui/src/assets/svg/ic-format-callout.svg new file mode 100644 index 000000000000..cca17c7149e6 --- /dev/null +++ b/openmetadata-ui/src/main/resources/ui/src/assets/svg/ic-format-callout.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/openmetadata-ui/src/main/resources/ui/src/assets/svg/ic-ltr.svg b/openmetadata-ui/src/main/resources/ui/src/assets/svg/ic-ltr.svg new file mode 100644 index 000000000000..4e2fbb3c2be2 --- /dev/null +++ b/openmetadata-ui/src/main/resources/ui/src/assets/svg/ic-ltr.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/openmetadata-ui/src/main/resources/ui/src/assets/svg/ic-rtl.svg b/openmetadata-ui/src/main/resources/ui/src/assets/svg/ic-rtl.svg new file mode 100644 index 000000000000..57cac45816ad --- /dev/null +++ b/openmetadata-ui/src/main/resources/ui/src/assets/svg/ic-rtl.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Auth/AuthProviders/AuthProvider.tsx b/openmetadata-ui/src/main/resources/ui/src/components/Auth/AuthProviders/AuthProvider.tsx index b12eeb87b1b4..64cbfcdaf9af 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/Auth/AuthProviders/AuthProvider.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/Auth/AuthProviders/AuthProvider.tsx @@ -429,7 +429,7 @@ export const AuthProvider = ({ // Parse and update the query parameter const queryParams = Qs.parse(config.url.split('?')[1]); // adding quotes for exact matching - const domainStatement = `(domain.fullyQualifiedName:"${activeDomain}")`; + const domainStatement = `(domain.fullyQualifiedName:${activeDomain})`; queryParams.q = queryParams.q ?? ''; queryParams.q += isEmpty(queryParams.q) ? domainStatement diff --git a/openmetadata-ui/src/main/resources/ui/src/components/BlockEditor/Extensions/Callout/Callout.ts b/openmetadata-ui/src/main/resources/ui/src/components/BlockEditor/Extensions/Callout/Callout.ts new file mode 100644 index 000000000000..99b2f97be78a --- /dev/null +++ b/openmetadata-ui/src/main/resources/ui/src/components/BlockEditor/Extensions/Callout/Callout.ts @@ -0,0 +1,249 @@ +/* + * Copyright 2023 Collate. + * 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 + * http://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. + */ +import { Fragment, Slice } from 'prosemirror-model'; +import { TextSelection } from 'prosemirror-state'; + +import { + findParentNode, + isTextSelection, + mergeAttributes, + Node, + wrappingInputRule, +} from '@tiptap/core'; +import { ReactNodeViewRenderer } from '@tiptap/react'; +import { + CALL_OUT_INPUT_RULE_REGEX, + CALL_OUT_REGEX, +} from '../../../../constants/BlockEditor.constants'; +import CalloutComponent from './CalloutComponent'; + +export interface CalloutOptions { + /** + * Custom HTML attributes that should be added to the rendered HTML tag. + */ + HTMLAttributes: { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + [key: string]: any; + }; +} + +export interface CalloutAttributes { + /** + * The calloutType of the callout. + */ + calloutType?: string; +} + +declare module '@tiptap/core' { + interface Commands { + callout: { + /** + * Toggle a callout node. + * + * @param attributes + * @returns + */ + toggleCallout: (attributes: CalloutAttributes) => ReturnType; + }; + } +} + +export const Callout = Node.create({ + name: 'callout', + + addOptions() { + return { + HTMLAttributes: {}, + }; + }, + + content: 'block+', + + group: 'block', + + defining: true, + + draggable: true, + + addAttributes() { + return { + calloutType: { + default: 'note', + }, + }; + }, + + parseHTML() { + return [ + { + tag: `div[data-type="${this.name}"]`, + getAttrs: (node) => { + const htmlNode = node as HTMLElement; + + return { + calloutType: htmlNode.getAttribute('data-calloutType') ?? '', + content: htmlNode.textContent, + }; + }, + }, + ]; + }, + + renderHTML({ HTMLAttributes, node }) { + return [ + 'div', + mergeAttributes(this.options.HTMLAttributes, HTMLAttributes, { + 'data-type': this.name, + 'data-calloutType': node.attrs.calloutType, + }), + 0, + ]; + }, + + addNodeView() { + return ReactNodeViewRenderer(CalloutComponent); + }, + + addCommands() { + return { + toggleCallout: (attributes) => (editor) => { + return editor.commands.toggleWrap(this.name, attributes); + }, + }; + }, + + addKeyboardShortcuts() { + return { + Enter: ({ editor }) => { + const { state, view } = editor; + const { selection } = state; + + if (!(isTextSelection(selection) && selection.empty)) { + return false; + } + + const { nodeBefore, parent } = selection.$from; + + if (!nodeBefore?.isText || !parent.type.isTextblock) { + return false; + } + + const regex = CALL_OUT_REGEX; + const { text, nodeSize } = nodeBefore; + const { textContent } = parent; + + if (!text) { + return false; + } + + const matchesNodeBefore = text.match(regex); + const matchesParent = textContent.match(regex); + + if (!matchesNodeBefore || !matchesParent) { + return false; + } + + const pos = selection.$from.before(); + const end = pos + nodeSize + 1; + // +1 to account for the extra pos a node takes up + + const { tr } = state; + const slice = new Slice(Fragment.from(this.type.create()), 0, 1); + tr.replace(pos, end, slice); + + // Set the selection to within the callout + tr.setSelection(TextSelection.near(tr.doc.resolve(pos + 1))); + view.dispatch(tr); + + return true; + }, + + /** + * Handle the backspace key when deleting content. + * Aims to stop merging callouts when deleting content in between. + */ + Backspace: ({ editor }) => { + const { state, view } = editor; + const { selection } = state; + + // If the selection is not empty, return false + // and let other extension handle the deletion. + if (!selection.empty) { + return false; + } + + const { $from } = selection; + + // If not at the start of current node, no joining will happen + if ($from.parentOffset !== 0) { + return false; + } + + const previousPosition = $from.before($from.depth) - 1; + + // If nothing above to join with + if (previousPosition < 1) { + return false; + } + + const previousPos = state.doc.resolve(previousPosition); + + // If resolving previous position fails, bail out + if (!previousPos?.parent) { + return false; + } + + const previousNode = previousPos.parent; + const parentNode = findParentNode(() => true)(selection); + + if (!parentNode) { + return false; + } + + const { node, pos, depth } = parentNode; + + // If current node is nested + if (depth !== 1) { + return false; + } + + // If previous node is a callout, cut current node's content into it + if (node.type !== this.type && previousNode.type === this.type) { + const { content, nodeSize } = node; + const { tr } = state; + + tr.delete(pos, pos + nodeSize); + tr.setSelection( + TextSelection.near(tr.doc.resolve(previousPosition - 1)) + ); + tr.insert(previousPosition - 1, content); + + view.dispatch(tr); + + return true; + } + + return false; + }, + }; + }, + + addInputRules() { + return [ + wrappingInputRule({ + find: CALL_OUT_INPUT_RULE_REGEX, + type: this.type, + }), + ]; + }, +}); diff --git a/openmetadata-ui/src/main/resources/ui/src/components/BlockEditor/Extensions/Callout/CalloutComponent.tsx b/openmetadata-ui/src/main/resources/ui/src/components/BlockEditor/Extensions/Callout/CalloutComponent.tsx new file mode 100644 index 000000000000..bec5a074c772 --- /dev/null +++ b/openmetadata-ui/src/main/resources/ui/src/components/BlockEditor/Extensions/Callout/CalloutComponent.tsx @@ -0,0 +1,85 @@ +/* + * Copyright 2023 Collate. + * 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 + * http://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. + */ +import { NodeViewContent, NodeViewProps, NodeViewWrapper } from '@tiptap/react'; +import { Button, Popover } from 'antd'; +import { startCase } from 'lodash'; +import React, { FC, useState } from 'react'; +import { CALLOUT_CONTENT } from '../../../../constants/BlockEditor.constants'; + +const PopoverContent = ({ + onSelect, +}: { + onSelect: (calloutType: string) => void; +}) => { + return ( +
+ {Object.entries(CALLOUT_CONTENT).map(([key, CalloutIcon]) => { + return ( + + ); + })} +
+ ); +}; + +const CalloutComponent: FC = ({ + node, + extension, + updateAttributes, +}) => { + const { calloutType } = node.attrs; + const [isPopupVisible, setIsPopupVisible] = useState(false); + const CallOutIcon = + CALLOUT_CONTENT[calloutType as keyof typeof CALLOUT_CONTENT]; + + return ( + +
+ { + updateAttributes({ calloutType: value }); + setIsPopupVisible(false); + }} + /> + } + destroyTooltipOnHide={{ keepParent: false }} + open={isPopupVisible} + overlayClassName="om-callout-node-popover" + placement="bottomRight" + showArrow={false} + trigger="click" + onOpenChange={setIsPopupVisible}> + + + +
+
+ ); +}; + +export default CalloutComponent; diff --git a/openmetadata-ui/src/main/resources/ui/src/components/BlockEditor/Extensions/index.ts b/openmetadata-ui/src/main/resources/ui/src/components/BlockEditor/Extensions/index.ts index ebab113a0367..f961fa0d2e00 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/BlockEditor/Extensions/index.ts +++ b/openmetadata-ui/src/main/resources/ui/src/components/BlockEditor/Extensions/index.ts @@ -17,6 +17,7 @@ import TaskList from '@tiptap/extension-task-list'; import StarterKit from '@tiptap/starter-kit'; import { DROP_CURSOR_COLOR } from '../../../constants/BlockEditor.constants'; import BlockAndDragDrop from './BlockAndDragDrop/BlockAndDragDrop'; +import { Callout } from './Callout/Callout'; import DiffView from './diff-view'; import { Focus } from './focus'; import { Hashtag } from './hashtag'; @@ -113,4 +114,5 @@ export const extensions = [ Focus.configure({ mode: 'deepest', }), + Callout, ]; diff --git a/openmetadata-ui/src/main/resources/ui/src/components/BlockEditor/Extensions/slash-command/items.ts b/openmetadata-ui/src/main/resources/ui/src/components/BlockEditor/Extensions/slash-command/items.ts index bca358cb046d..18026dacea59 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/BlockEditor/Extensions/slash-command/items.ts +++ b/openmetadata-ui/src/main/resources/ui/src/components/BlockEditor/Extensions/slash-command/items.ts @@ -21,6 +21,7 @@ import NumberedListImage from '../../../../assets/img/ic-slash-numbered-list.png import QuoteImage from '../../../../assets/img/ic-slash-quote.png'; import TextImage from '../../../../assets/img/ic-slash-text.png'; import TaskListIcon from '../../../../assets/img/ic-task-list.png'; +import IconFormatCallout from '../../../../assets/svg/ic-format-callout.svg'; import CodeBlockImage from '../../../../assets/svg/ic-format-code-block.svg'; import IconFormatImage from '../../../../assets/svg/ic-format-image.svg'; import MentionImage from '../../../../assets/svg/ic-mentions.svg'; @@ -205,6 +206,16 @@ export const getSuggestionItems = (props: { imgSrc: TaskListIcon, type: SuggestionItemType.ADVANCED_BLOCKS, }, + { + title: 'Callout', + description: 'A simple callout block', + searchTerms: ['callout', 'info', 'warning', 'danger', 'note'], + command: ({ editor, range }) => { + editor.chain().focus().deleteRange(range).toggleCallout({}).run(); + }, + type: SuggestionItemType.ADVANCED_BLOCKS, + imgSrc: IconFormatCallout, + }, ]; const filteredItems = suggestionItems.filter((item) => { diff --git a/openmetadata-ui/src/main/resources/ui/src/components/BlockEditor/block-editor.less b/openmetadata-ui/src/main/resources/ui/src/components/BlockEditor/block-editor.less index a3e7ea9146bc..976a35c0bb5c 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/BlockEditor/block-editor.less +++ b/openmetadata-ui/src/main/resources/ui/src/components/BlockEditor/block-editor.less @@ -15,6 +15,12 @@ @border-radius: 6px; @border-color: #e8e8ed; @markdown-bg-color: #f8f8fa; +@hover-bg: #00000005; +@callout-bg: #f8f8fa; +@callout-warning-bg: #fff3dc; +@callout-info-bg: #d1e9ff; +@callout-danger-bg: #ff4c3b33; +@callout-border: #afafc1; .block-editor-wrapper { .om-block-editor > p:last-child { @@ -361,3 +367,60 @@ display: flex; justify-content: end; } + +.om-callout-node { + width: 100%; + display: flex; + flex-direction: row; + background-color: @callout-bg; + color: @text-color; + padding: 1rem 1.5rem; + gap: 0.5rem; + border-radius: 8px; + border-left: 8px solid @callout-border; + position: relative; +} + +.om-callout-node-warning, +.om-callout-node-caution { + background-color: @callout-warning-bg; + border-left-color: @warning-color; +} +.om-callout-node-tip, +.om-callout-node-info { + background-color: @callout-info-bg; + border-left-color: @info-color; +} + +.om-callout-node-danger { + background-color: @callout-danger-bg; + border-left-color: @error-color; +} + +.callout-type-btn.ant-btn.ant-btn-text { + padding: 2px 4px; +} + +.om-callout-node-popover { + .ant-popover-inner-content { + padding: 12px 4px; + } +} + +.callout-menu { + display: flex; + flex-direction: column; + align-items: baseline; + .ant-btn { + width: 100%; + display: inline-flex; + gap: 4px; + text-align: left; + padding: 8px 16px; + height: auto; + } +} + +.om-callout-node-content { + align-self: center; +} diff --git a/openmetadata-ui/src/main/resources/ui/src/components/DataProducts/DataProductsDetailsPage/DataProductsDetailsPage.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/DataProducts/DataProductsDetailsPage/DataProductsDetailsPage.component.tsx index 2d144865290a..da55ed0f02af 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/DataProducts/DataProductsDetailsPage/DataProductsDetailsPage.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/DataProducts/DataProductsDetailsPage/DataProductsDetailsPage.component.tsx @@ -208,7 +208,7 @@ const DataProductsDetailsPage = ({ '', 1, 0, - `(dataProducts.fullyQualifiedName:"${fqn}")`, + `(dataProducts.fullyQualifiedName:${fqn})`, '', '', SearchIndex.ALL @@ -312,12 +312,11 @@ const DataProductsDetailsPage = ({ const onNameSave = (obj: { name: string; displayName: string }) => { if (dataProduct) { - const { name, displayName } = obj; + const { displayName } = obj; let updatedDetails = cloneDeep(dataProduct); updatedDetails = { ...dataProduct, - name: name?.trim() || dataProduct.name, displayName: displayName?.trim(), }; @@ -548,10 +547,9 @@ const DataProductsDetailsPage = ({ setIsNameEditing(false)} diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Database/DatabaseSchema/DatabaseSchemaTable/DatabaseSchemaTable.tsx b/openmetadata-ui/src/main/resources/ui/src/components/Database/DatabaseSchema/DatabaseSchemaTable/DatabaseSchemaTable.tsx index ab3591e57dda..836e237de448 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/Database/DatabaseSchema/DatabaseSchemaTable/DatabaseSchemaTable.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/Database/DatabaseSchema/DatabaseSchemaTable/DatabaseSchemaTable.tsx @@ -128,12 +128,14 @@ export const DatabaseSchemaTable = () => { const handleSchemaPageChange = useCallback( ({ currentPage, cursorType }: PagingHandlerParams) => { - if (cursorType) { + if (searchValue) { + searchSchema(searchValue, currentPage); + } else if (cursorType) { fetchDatabaseSchema({ [cursorType]: paging[cursorType] }); } handlePageChange(currentPage); }, - [paging, fetchDatabaseSchema] + [paging, fetchDatabaseSchema, searchSchema, searchValue] ); const onSchemaSearch = (value: string) => { @@ -195,6 +197,7 @@ export const DatabaseSchemaTable = () => { {showPagination && ( { const data = { ...formData, - domain: domain.name, + domain: domain.fullyQualifiedName, }; try { @@ -238,7 +238,7 @@ const DomainDetailsPage = ({ '', 1, 0, - `(domain.fullyQualifiedName:"${domainFqn}")`, + `(domain.fullyQualifiedName:${domainFqn})`, '', '', SearchIndex.DATA_PRODUCT @@ -258,7 +258,7 @@ const DomainDetailsPage = ({ '', 1, 0, - `(domain.fullyQualifiedName:"${fqn}")`, + `(domain.fullyQualifiedName:${fqn})`, '', '', SearchIndex.ALL @@ -300,12 +300,11 @@ const DomainDetailsPage = ({ }, []); const onNameSave = (obj: { name: string; displayName: string }) => { - const { name, displayName } = obj; + const { displayName } = obj; let updatedDetails = cloneDeep(domain); updatedDetails = { ...domain, - name: name?.trim() || domain.name, displayName: displayName?.trim(), }; @@ -650,10 +649,9 @@ const DomainDetailsPage = ({ /> )} setIsNameEditing(false)} diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Domain/DomainTabs/DataProductsTab/DataProductsTab.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/Domain/DomainTabs/DataProductsTab/DataProductsTab.component.tsx index 2970a2ca63e5..f7cab2837bfb 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/Domain/DomainTabs/DataProductsTab/DataProductsTab.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/Domain/DomainTabs/DataProductsTab/DataProductsTab.component.tsx @@ -58,7 +58,7 @@ const DataProductsTab = forwardRef( '', 1, PAGE_SIZE_LARGE, - `(domain.fullyQualifiedName:"${domainFqn}")`, + `(domain.fullyQualifiedName:${domainFqn})`, '', '', SearchIndex.DATA_PRODUCT diff --git a/openmetadata-ui/src/main/resources/ui/src/components/FeedEditor/FeedEditor.tsx b/openmetadata-ui/src/main/resources/ui/src/components/FeedEditor/FeedEditor.tsx index 200acb18d482..484829fcd8c7 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/FeedEditor/FeedEditor.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/FeedEditor/FeedEditor.tsx @@ -34,7 +34,11 @@ import { } from '../../constants/Feeds.constants'; import { HTMLToMarkdown, matcher } from '../../utils/FeedUtils'; import { LinkBlot } from '../../utils/QuillLink/QuillLink'; -import { insertMention, insertRef } from '../../utils/QuillUtils'; +import { + directionHandler, + insertMention, + insertRef, +} from '../../utils/QuillUtils'; import { getEntityIcon } from '../../utils/TableUtils'; import { editorRef } from '../common/RichTextEditor/RichTextEditor.interface'; import './feed-editor.less'; @@ -77,6 +81,7 @@ export const FeedEditor = forwardRef( handlers: { insertMention: insertMention, insertRef: insertRef, + direction: directionHandler, }, }, 'emoji-toolbar': true, @@ -226,7 +231,10 @@ export const FeedEditor = forwardRef( }, [focused, editorRef]); return ( -
+
{ - await handleGlossaryTermUpdate({ - ...glossaryTerm, - extension: updatedTable.extension, - }); - }; + const onExtensionUpdate = useCallback( + async (updatedTable: GlossaryTerm) => { + await handleGlossaryTermUpdate({ + ...glossaryTerm, + extension: updatedTable.extension, + }); + }, + [glossaryTerm, handleGlossaryTermUpdate] + ); const tabItems = useMemo(() => { const items = [ @@ -241,6 +244,7 @@ const GlossaryTermsV1 = ({ isVersionView, assetPermissions, handleAssetSave, + onExtensionUpdate, ]); const fetchGlossaryTermAssets = async () => { diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Glossary/GlossaryTerms/tabs/AssetsTabs.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/Glossary/GlossaryTerms/tabs/AssetsTabs.component.tsx index 1f5702965e15..0d629ea225a5 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/Glossary/GlossaryTerms/tabs/AssetsTabs.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/Glossary/GlossaryTerms/tabs/AssetsTabs.component.tsx @@ -148,10 +148,10 @@ const AssetsTabs = forwardRef( const queryParam = useMemo(() => { switch (type) { case AssetsOfEntity.DOMAIN: - return `(domain.fullyQualifiedName:"${fqn}")`; + return `(domain.fullyQualifiedName:${fqn})`; case AssetsOfEntity.DATA_PRODUCT: - return `(dataProducts.fullyQualifiedName:"${fqn}")`; + return `(dataProducts.fullyQualifiedName:${fqn})`; case AssetsOfEntity.TEAM: return `(owner.fullyQualifiedName:"${fqn}")`; diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Glossary/GlossaryTerms/tabs/GlossaryOverviewTab.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/Glossary/GlossaryTerms/tabs/GlossaryOverviewTab.component.tsx index fe46c31462b3..004538048529 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/Glossary/GlossaryTerms/tabs/GlossaryOverviewTab.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/Glossary/GlossaryTerms/tabs/GlossaryOverviewTab.component.tsx @@ -18,6 +18,7 @@ import { Glossary } from '../../../../generated/entity/data/glossary'; import { GlossaryTerm } from '../../../../generated/entity/data/glossaryTerm'; import { ChangeDescription } from '../../../../generated/entity/type'; import { TagLabel } from '../../../../generated/type/tagLabel'; +import { getEntityName } from '../../../../utils/EntityUtils'; import { getEntityVersionByField, getEntityVersionTags, @@ -109,7 +110,7 @@ const GlossaryOverviewTab = ({
=> { - const glossaryResponse = await searchQuery({ - query: searchQueryParam ? `*${searchQueryParam}*` : '*', - pageNumber: page, - pageSize: 10, - queryFilter: {}, - searchIndex: SearchIndex.GLOSSARY, - }); - - const hits = glossaryResponse.hits.hits; - - return { - data: hits.map(({ _source }) => ({ - label: _source.fullyQualifiedName ?? '', - value: _source.fullyQualifiedName ?? '', - data: _source, - })), - paging: { - total: glossaryResponse.hits.total.value, - }, - }; - }, - [searchQuery, getGlossaryTerms] - ); - const fetchAPI = useCallback( (searchValue: string, page: number) => { if (tagType === TagSource.Classification) { @@ -140,7 +100,7 @@ const TagsContainerV2 = ({ return fetchGlossaryList(searchValue, page); } }, - [tagType, fetchGlossaryList] + [tagType, filterClassifications] ); const showNoDataPlaceholder = useMemo( diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Team/TeamDetails/TeamDetailsV1.tsx b/openmetadata-ui/src/main/resources/ui/src/components/Team/TeamDetails/TeamDetailsV1.tsx index 617e9bac3986..f65405039235 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/Team/TeamDetails/TeamDetailsV1.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/Team/TeamDetails/TeamDetailsV1.tsx @@ -1103,8 +1103,11 @@ const TeamDetailsV1 = ({ return (
- -
+ + ({ const [entityTypeDetailLoading, setEntityTypeDetailLoading] = useState(false); const { fqn } = useParams<{ fqn: string; tab: string; version: string }>(); + const decodedeFqn = getDecodedFqn(fqn); const fetchExtentiondetails = async () => { const response = await getEntityExtentionDetailsFromEntityType( entityType, - fqn + decodedeFqn ); setExtentionDetails(response as ExtentionEntities[T]); @@ -79,7 +81,7 @@ export const CustomPropertyTable = ({ useEffect(() => { fetchExtentiondetails(); - }, [fqn]); + }, [decodedeFqn]); const [typePermission, setPermission] = useState(); const versionDetails = entityDetails ?? extentionDetails; @@ -128,7 +130,7 @@ export const CustomPropertyTable = ({ setExtentionDetails(updatedData); } }, - [versionDetails] + [versionDetails, handleExtensionUpdate] ); const extensionObject: { diff --git a/openmetadata-ui/src/main/resources/ui/src/components/common/RichTextEditor/EditorToolBar.ts b/openmetadata-ui/src/main/resources/ui/src/components/common/RichTextEditor/EditorToolBar.ts index 9dff3a59718e..a658d1235241 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/common/RichTextEditor/EditorToolBar.ts +++ b/openmetadata-ui/src/main/resources/ui/src/components/common/RichTextEditor/EditorToolBar.ts @@ -11,6 +11,8 @@ * limitations under the License. */ +import LTRIcon from '../../../assets/svg/ic-ltr.svg'; +import RTLIcon from '../../../assets/svg/ic-rtl.svg'; import MarkdownIcon from '../../../assets/svg/markdown.svg'; import i18n from '../../../utils/i18next/LocalUtil'; @@ -41,6 +43,55 @@ const markdownButton = (): HTMLButtonElement => { return button; }; +const getRTLButtonIcon = (mode: 'rtl' | 'ltr') => ` + rtl-icon`; + +const toggleEditorDirection = (button: HTMLButtonElement) => { + const editorElement = document.querySelector( + '.toastui-editor.md-mode.active' + ); + + if (editorElement) { + const editorElementDir = editorElement.getAttribute('dir'); + const newDir = editorElementDir === 'rtl' ? 'ltr' : 'rtl'; + const textAlign = newDir === 'rtl' ? 'right' : 'left'; + + editorElement.setAttribute('dir', newDir); + editorElement.setAttribute('style', `text-align: ${textAlign};`); + button.innerHTML = getRTLButtonIcon(newDir === 'rtl' ? 'ltr' : 'rtl'); + } +}; + +const rtlButton = (): HTMLButtonElement => { + const button = document.createElement('button'); + + button.onclick = () => toggleEditorDirection(button); + + button.className = 'toastui-editor-toolbar-icons rtl-icon'; + button.id = 'rtl-button'; + button.style.cssText = 'background-image: none; margin: 0; margin-top: 4px;'; + button.type = 'button'; + button.innerHTML = getRTLButtonIcon('rtl'); + + return button; +}; + +const rtlButtonUpdateHandler = (toolbarState: { + active: boolean; + disabled?: boolean; +}) => { + const rtlButtonElement = document.getElementById('rtl-button'); + if (rtlButtonElement) { + (rtlButtonElement as HTMLButtonElement).disabled = + toolbarState.disabled || false; + } +}; + export const EDITOR_TOOLBAR_ITEMS = [ 'heading', 'bold', @@ -53,6 +104,12 @@ export const EDITOR_TOOLBAR_ITEMS = [ 'quote', 'code', 'codeblock', + { + name: i18n.t('label.rtl-ltr-direction'), + el: rtlButton(), + tooltip: i18n.t('label.rtl-ltr-direction'), + onUpdated: rtlButtonUpdateHandler, + }, { name: i18n.t('label.markdown-guide'), el: markdownButton(), diff --git a/openmetadata-ui/src/main/resources/ui/src/constants/BlockEditor.constants.ts b/openmetadata-ui/src/main/resources/ui/src/constants/BlockEditor.constants.ts index 6ff0b3d52366..ee6e68cd967c 100644 --- a/openmetadata-ui/src/main/resources/ui/src/constants/BlockEditor.constants.ts +++ b/openmetadata-ui/src/main/resources/ui/src/constants/BlockEditor.constants.ts @@ -11,6 +11,10 @@ * limitations under the License. */ import { EditorOptions } from '@tiptap/core'; +import { ReactComponent as IconDanger } from '../assets/svg/callout-danger.svg'; +import { ReactComponent as IconInfo } from '../assets/svg/callout-info.svg'; +import { ReactComponent as IconNote } from '../assets/svg/callout-note.svg'; +import { ReactComponent as IconWarning } from '../assets/svg/callout-warning.svg'; export const EDITOR_OPTIONS: Partial = { enableInputRules: [ @@ -26,6 +30,7 @@ export const EDITOR_OPTIONS: Partial = { 'strike', 'image', 'taskItem', + 'callout', ], parseOptions: { preserveWhitespace: 'full', @@ -48,3 +53,13 @@ export const CLICKABLE_NODES = [ ]; export const DROP_CURSOR_COLOR = '#ebf6fe'; + +export const CALLOUT_CONTENT = { + note: IconNote, + warning: IconWarning, + info: IconInfo, + danger: IconDanger, +}; + +export const CALL_OUT_REGEX = /^:::([A-Za-z]*)?$/; +export const CALL_OUT_INPUT_RULE_REGEX = /^::: $/; diff --git a/openmetadata-ui/src/main/resources/ui/src/constants/Feeds.constants.ts b/openmetadata-ui/src/main/resources/ui/src/constants/Feeds.constants.ts index 2da402c54ccb..36825df1f1f7 100644 --- a/openmetadata-ui/src/main/resources/ui/src/constants/Feeds.constants.ts +++ b/openmetadata-ui/src/main/resources/ui/src/constants/Feeds.constants.ts @@ -45,6 +45,7 @@ export const TOOLBAR_ITEMS = [ [{ list: 'ordered' }, { list: 'bullet' }], ['link'], ['insertMention', 'insertRef', 'emoji'], + [{ direction: 'rtl' }], ]; export enum TaskOperation { diff --git a/openmetadata-ui/src/main/resources/ui/src/locale/languages/de-de.json b/openmetadata-ui/src/main/resources/ui/src/locale/languages/de-de.json index e5feb3af1e1d..86a5b01fe465 100644 --- a/openmetadata-ui/src/main/resources/ui/src/locale/languages/de-de.json +++ b/openmetadata-ui/src/main/resources/ui/src/locale/languages/de-de.json @@ -855,6 +855,7 @@ "row": "Zeile", "row-count-lowercase": "Anzahl der Zeilen", "row-plural": "Zeilen", + "rtl-ltr-direction": "RTL/LTR direction", "rule": "Regel", "rule-effect": "Regelwirkung", "rule-lowercase": "regel", @@ -1035,6 +1036,7 @@ "test-case-lowercase": "testfall", "test-case-lowercase-plural": "testfälle", "test-case-plural": "Testfälle", + "test-email": "Test Email", "test-entity": "{{entity}}-Test", "test-plural": "Tests", "test-suite": "Test-Suite", diff --git a/openmetadata-ui/src/main/resources/ui/src/locale/languages/en-us.json b/openmetadata-ui/src/main/resources/ui/src/locale/languages/en-us.json index bc93eca2ee5b..d4b866e4206d 100644 --- a/openmetadata-ui/src/main/resources/ui/src/locale/languages/en-us.json +++ b/openmetadata-ui/src/main/resources/ui/src/locale/languages/en-us.json @@ -855,6 +855,7 @@ "row": "Row", "row-count-lowercase": "row count", "row-plural": "Rows", + "rtl-ltr-direction": "RTL/LTR direction", "rule": "Rule", "rule-effect": "Rule Effect", "rule-lowercase": "rule", @@ -1035,6 +1036,7 @@ "test-case-lowercase": "test case", "test-case-lowercase-plural": "test cases", "test-case-plural": "Test Cases", + "test-email": "Test Email", "test-entity": "Test {{entity}}", "test-plural": "Tests", "test-suite": "Test Suite", diff --git a/openmetadata-ui/src/main/resources/ui/src/locale/languages/es-es.json b/openmetadata-ui/src/main/resources/ui/src/locale/languages/es-es.json index 5924855b0023..601d177620f1 100644 --- a/openmetadata-ui/src/main/resources/ui/src/locale/languages/es-es.json +++ b/openmetadata-ui/src/main/resources/ui/src/locale/languages/es-es.json @@ -855,6 +855,7 @@ "row": "Fila", "row-count-lowercase": "número de filas", "row-plural": "Filas", + "rtl-ltr-direction": "RTL/LTR direction", "rule": "Regla", "rule-effect": "Efecto de la Regla", "rule-lowercase": "rule", @@ -1035,6 +1036,7 @@ "test-case-lowercase": "caso de prueba", "test-case-lowercase-plural": "test cases", "test-case-plural": "Casos de Prueba", + "test-email": "Test Email", "test-entity": "Prueba {{entity}}", "test-plural": "Pruebas", "test-suite": "Suite de Pruebas", diff --git a/openmetadata-ui/src/main/resources/ui/src/locale/languages/fr-fr.json b/openmetadata-ui/src/main/resources/ui/src/locale/languages/fr-fr.json index e78f7db859ca..54c414ef1b91 100644 --- a/openmetadata-ui/src/main/resources/ui/src/locale/languages/fr-fr.json +++ b/openmetadata-ui/src/main/resources/ui/src/locale/languages/fr-fr.json @@ -855,6 +855,7 @@ "row": "Ligne", "row-count-lowercase": "Nombre de Ligne", "row-plural": "Lignes", + "rtl-ltr-direction": "RTL/LTR direction", "rule": "Règle", "rule-effect": "Effet de la Règle", "rule-lowercase": "règle", @@ -1035,6 +1036,7 @@ "test-case-lowercase": "cas de test", "test-case-lowercase-plural": "cas de tests", "test-case-plural": "Cas de Tests", + "test-email": "Test Email", "test-entity": "Test {{entity}}", "test-plural": "Tests", "test-suite": "Ensemble de Tests", diff --git a/openmetadata-ui/src/main/resources/ui/src/locale/languages/ja-jp.json b/openmetadata-ui/src/main/resources/ui/src/locale/languages/ja-jp.json index dac483d8dd89..3d6b3b74e5b7 100644 --- a/openmetadata-ui/src/main/resources/ui/src/locale/languages/ja-jp.json +++ b/openmetadata-ui/src/main/resources/ui/src/locale/languages/ja-jp.json @@ -855,6 +855,7 @@ "row": "行", "row-count-lowercase": "行数", "row-plural": "行", + "rtl-ltr-direction": "RTL/LTR direction", "rule": "ルール", "rule-effect": "ルールの効果", "rule-lowercase": "rule", @@ -1035,6 +1036,7 @@ "test-case-lowercase": "テストケース", "test-case-lowercase-plural": "test cases", "test-case-plural": "テストケース", + "test-email": "Test Email", "test-entity": "テスト {{entity}}", "test-plural": "テスト", "test-suite": "テストスイート", diff --git a/openmetadata-ui/src/main/resources/ui/src/locale/languages/pt-br.json b/openmetadata-ui/src/main/resources/ui/src/locale/languages/pt-br.json index 47185c813880..3c68e50c1908 100644 --- a/openmetadata-ui/src/main/resources/ui/src/locale/languages/pt-br.json +++ b/openmetadata-ui/src/main/resources/ui/src/locale/languages/pt-br.json @@ -855,6 +855,7 @@ "row": "Linha", "row-count-lowercase": "contagem de linhas", "row-plural": "Linhas", + "rtl-ltr-direction": "RTL/LTR direction", "rule": "Regra", "rule-effect": "Efeito da regra", "rule-lowercase": "rule", @@ -1035,6 +1036,7 @@ "test-case-lowercase": "caso de teste", "test-case-lowercase-plural": "test cases", "test-case-plural": "Casos de Teste", + "test-email": "Test Email", "test-entity": "Teste {{entity}}", "test-plural": "Testes", "test-suite": "Conjunto de Testes", diff --git a/openmetadata-ui/src/main/resources/ui/src/locale/languages/ru-ru.json b/openmetadata-ui/src/main/resources/ui/src/locale/languages/ru-ru.json index 8d9fe701d7ea..3e9c9846df5e 100644 --- a/openmetadata-ui/src/main/resources/ui/src/locale/languages/ru-ru.json +++ b/openmetadata-ui/src/main/resources/ui/src/locale/languages/ru-ru.json @@ -855,6 +855,7 @@ "row": "Строка", "row-count-lowercase": "количество строк", "row-plural": "Строки", + "rtl-ltr-direction": "RTL/LTR direction", "rule": "Правило", "rule-effect": "Действие правила", "rule-lowercase": "правило", @@ -1035,6 +1036,7 @@ "test-case-lowercase": "test case", "test-case-lowercase-plural": "test cases", "test-case-plural": "Test Cases", + "test-email": "Test Email", "test-entity": "Тест {{entity}}", "test-plural": "Тесты", "test-suite": "Тестирование", diff --git a/openmetadata-ui/src/main/resources/ui/src/locale/languages/zh-cn.json b/openmetadata-ui/src/main/resources/ui/src/locale/languages/zh-cn.json index 52f57f624b4c..8d6daed00199 100644 --- a/openmetadata-ui/src/main/resources/ui/src/locale/languages/zh-cn.json +++ b/openmetadata-ui/src/main/resources/ui/src/locale/languages/zh-cn.json @@ -855,6 +855,7 @@ "row": "行", "row-count-lowercase": "行计数", "row-plural": "行", + "rtl-ltr-direction": "RTL/LTR direction", "rule": "规则", "rule-effect": "规则生效", "rule-lowercase": "规则", @@ -1035,6 +1036,7 @@ "test-case-lowercase": "测试用例", "test-case-lowercase-plural": "测试用例", "test-case-plural": "测试用例", + "test-email": "Test Email", "test-entity": "测试{{entity}}", "test-plural": "测试", "test-suite": "质控测试集", diff --git a/openmetadata-ui/src/main/resources/ui/src/pages/EmailConfigSettingsPage/EmailConfigSettingsPage.component.tsx b/openmetadata-ui/src/main/resources/ui/src/pages/EmailConfigSettingsPage/EmailConfigSettingsPage.component.tsx index 6acb39dd4c54..9a44cc7c5bcd 100644 --- a/openmetadata-ui/src/main/resources/ui/src/pages/EmailConfigSettingsPage/EmailConfigSettingsPage.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/pages/EmailConfigSettingsPage/EmailConfigSettingsPage.component.tsx @@ -12,7 +12,7 @@ */ import Icon from '@ant-design/icons/lib/components/Icon'; -import { Button, Col, Row, Skeleton, Typography } from 'antd'; +import { Button, Col, Row, Skeleton, Space, Typography } from 'antd'; import { AxiosError } from 'axios'; import { isBoolean, isEmpty, isNumber, isUndefined } from 'lodash'; import React, { useCallback, useEffect, useMemo, useState } from 'react'; @@ -25,9 +25,12 @@ import { ROUTES } from '../../constants/constants'; import { ERROR_PLACEHOLDER_TYPE } from '../../enums/common.enum'; import { SMTPSettings } from '../../generated/email/smtpSettings'; import { SettingType } from '../../generated/settings/settings'; -import { getSettingsConfigFromConfigType } from '../../rest/settingConfigAPI'; +import { + getSettingsConfigFromConfigType, + testEmailConnection, +} from '../../rest/settingConfigAPI'; import { getEmailConfigFieldLabels } from '../../utils/EmailConfigUtils'; -import { showErrorToast } from '../../utils/ToastUtils'; +import { showErrorToast, showSuccessToast } from '../../utils/ToastUtils'; function EmailConfigSettingsPage() { const { t } = useTranslation(); @@ -61,6 +64,18 @@ function EmailConfigSettingsPage() { history.push(ROUTES.SETTINGS_EDIT_EMAIL_CONFIG); }; + const handleTestEmailConnection = async () => { + try { + const res = await testEmailConnection( + emailConfigValues?.senderMail ?? '' + ); + + showSuccessToast(res.data); + } catch (error) { + showErrorToast(error as AxiosError); + } + }; + const configValues = useMemo(() => { if (isUndefined(emailConfigValues)) { return null; @@ -139,17 +154,23 @@ function EmailConfigSettingsPage() { /> - + + + + + diff --git a/openmetadata-ui/src/main/resources/ui/src/pages/Glossary/GlossaryPage/GlossaryPage.component.tsx b/openmetadata-ui/src/main/resources/ui/src/pages/Glossary/GlossaryPage/GlossaryPage.component.tsx index a549cb04b4b8..d594db19526f 100644 --- a/openmetadata-ui/src/main/resources/ui/src/pages/Glossary/GlossaryPage/GlossaryPage.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/pages/Glossary/GlossaryPage/GlossaryPage.component.tsx @@ -13,7 +13,7 @@ import { AxiosError } from 'axios'; import { compare } from 'fast-json-patch'; -import React, { useEffect, useMemo, useState } from 'react'; +import React, { useCallback, useEffect, useMemo, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { useHistory, useParams } from 'react-router-dom'; import ErrorPlaceHolder from '../../../components/common/ErrorWithPlaceholder/ErrorPlaceHolder'; @@ -248,28 +248,31 @@ const GlossaryPage = () => { .finally(() => setDeleteStatus(LOADING_STATE.INITIAL)); }; - const handleGlossaryTermUpdate = async (updatedData: GlossaryTerm) => { - const jsonPatch = compare(selectedData as GlossaryTerm, updatedData); - try { - const response = await patchGlossaryTerm( - selectedData?.id as string, - jsonPatch - ); - if (response) { - setSelectedData(response); - if (selectedData?.name !== updatedData.name) { - history.push(getGlossaryPath(response.fullyQualifiedName)); - fetchGlossaryList(); + const handleGlossaryTermUpdate = useCallback( + async (updatedData: GlossaryTerm) => { + const jsonPatch = compare(selectedData as GlossaryTerm, updatedData); + try { + const response = await patchGlossaryTerm( + selectedData?.id as string, + jsonPatch + ); + if (response) { + setSelectedData(response); + if (selectedData?.name !== updatedData.name) { + history.push(getGlossaryPath(response.fullyQualifiedName)); + fetchGlossaryList(); + } + } else { + throw t('server.entity-updating-error', { + entity: t('label.glossary-term'), + }); } - } else { - throw t('server.entity-updating-error', { - entity: t('label.glossary-term'), - }); + } catch (error) { + showErrorToast(error as AxiosError); } - } catch (error) { - showErrorToast(error as AxiosError); - } - }; + }, + [selectedData] + ); const handleGlossaryTermDelete = (id: string) => { setDeleteStatus(LOADING_STATE.WAITING); diff --git a/openmetadata-ui/src/main/resources/ui/src/pages/TasksPage/shared/TagSuggestion.tsx b/openmetadata-ui/src/main/resources/ui/src/pages/TasksPage/shared/TagSuggestion.tsx index a0147045650e..ad8541c8bd0b 100644 --- a/openmetadata-ui/src/main/resources/ui/src/pages/TasksPage/shared/TagSuggestion.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/pages/TasksPage/shared/TagSuggestion.tsx @@ -15,18 +15,33 @@ import { DefaultOptionType } from 'antd/lib/select'; import { t } from 'i18next'; import { isArray, isEmpty } from 'lodash'; import { EntityTags } from 'Models'; -import React from 'react'; +import React, { useMemo } from 'react'; import AsyncSelectList from '../../../components/AsyncSelectList/AsyncSelectList'; import { TagSource } from '../../../generated/entity/data/container'; import { TagLabel } from '../../../generated/type/tagLabel'; -import { fetchTagsElasticSearch } from '../../../utils/TagsUtils'; +import { + fetchGlossaryList, + fetchTagsElasticSearch, +} from '../../../utils/TagsUtils'; export interface TagSuggestionProps { - onChange?: (newTags: TagLabel[]) => void; + placeholder?: string; + tagType?: TagSource; value?: TagLabel[]; + onChange?: (newTags: TagLabel[]) => void; } -const TagSuggestion: React.FC = ({ onChange, value }) => { +const TagSuggestion: React.FC = ({ + onChange, + value, + placeholder, + tagType = TagSource.Classification, +}) => { + const isGlossaryType = useMemo( + () => tagType === TagSource.Glossary, + [tagType] + ); + const handleTagSelection = ( newValue: DefaultOptionType | DefaultOptionType[] ) => { @@ -40,7 +55,9 @@ const TagSuggestion: React.FC = ({ onChange, value }) => { } let tagData: EntityTags = { tagFQN: tag.value, - source: TagSource.Classification, + source: isGlossaryType + ? TagSource.Glossary + : TagSource.Classification, }; if (tag.data) { @@ -64,11 +81,14 @@ const TagSuggestion: React.FC = ({ onChange, value }) => { return ( item.tagFQN) || []} - fetchOptions={fetchTagsElasticSearch} + fetchOptions={isGlossaryType ? fetchGlossaryList : fetchTagsElasticSearch} mode="multiple" - placeholder={t('label.select-field', { - field: t('label.tag-plural'), - })} + placeholder={ + placeholder ?? + t('label.select-field', { + field: t('label.tag-plural'), + }) + } onChange={(value) => handleTagSelection(value)} /> ); diff --git a/openmetadata-ui/src/main/resources/ui/src/rest/settingConfigAPI.ts b/openmetadata-ui/src/main/resources/ui/src/rest/settingConfigAPI.ts index 7189f79b66e1..6eef609d719b 100644 --- a/openmetadata-ui/src/main/resources/ui/src/rest/settingConfigAPI.ts +++ b/openmetadata-ui/src/main/resources/ui/src/rest/settingConfigAPI.ts @@ -48,3 +48,17 @@ export const getLoginConfig = async () => { return response.data; }; + +export const testEmailConnection = async (email: string) => { + const configOptions = { + headers: { 'Content-type': 'application/json' }, + }; + + const response = await axiosClient.put( + '/system/email/test', + email, + configOptions + ); + + return response; +}; diff --git a/openmetadata-ui/src/main/resources/ui/src/utils/QuillUtils.js b/openmetadata-ui/src/main/resources/ui/src/utils/QuillUtils.js index 420c6d71fa9f..c801246ceaad 100644 --- a/openmetadata-ui/src/main/resources/ui/src/utils/QuillUtils.js +++ b/openmetadata-ui/src/main/resources/ui/src/utils/QuillUtils.js @@ -21,3 +21,19 @@ export function insertRef() { const ref = this.quill.getModule('mention'); ref.openMenu('#'); } + +export function directionHandler(value) { + const { align } = this.quill.getFormat(); + + // get the editor container + const container = document.getElementById('om-quill-editor'); + + if (value === 'rtl' && align == null) { + container.setAttribute('data-dir', value); + this.quill.format('align', 'right', 'user'); + } else if (!value && align === 'right') { + this.quill.format('align', false, 'user'); + container.setAttribute('data-dir', 'ltr'); + } + this.quill.format('direction', value, 'user'); +} diff --git a/openmetadata-ui/src/main/resources/ui/src/utils/TagsUtils.tsx b/openmetadata-ui/src/main/resources/ui/src/utils/TagsUtils.tsx index f57f2d955ab3..edcc6ab9a21b 100644 --- a/openmetadata-ui/src/main/resources/ui/src/utils/TagsUtils.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/utils/TagsUtils.tsx @@ -29,6 +29,7 @@ import { ExplorePageTabs } from '../enums/Explore.enum'; import { SearchIndex } from '../enums/search.enum'; import { Classification } from '../generated/entity/classification/classification'; import { Tag } from '../generated/entity/classification/tag'; +import { GlossaryTerm } from '../generated/entity/data/glossaryTerm'; import { Column } from '../generated/entity/data/table'; import { Paging } from '../generated/type/paging'; import { LabelType, State, TagLabel } from '../generated/type/tagLabel'; @@ -339,6 +340,39 @@ export const fetchTagsElasticSearch = async ( }; }; +export const fetchGlossaryList = async ( + searchQueryParam: string, + page: number +): Promise<{ + data: { + label: string; + value: string; + data: GlossaryTerm; + }[]; + paging: Paging; +}> => { + const glossaryResponse = await searchQuery({ + query: searchQueryParam ? `*${searchQueryParam}*` : '*', + pageNumber: page, + pageSize: 10, + queryFilter: {}, + searchIndex: SearchIndex.GLOSSARY, + }); + + const hits = glossaryResponse.hits.hits; + + return { + data: hits.map(({ _source }) => ({ + label: _source.fullyQualifiedName ?? '', + value: _source.fullyQualifiedName ?? '', + data: _source, + })), + paging: { + total: glossaryResponse.hits.total.value, + }, + }; +}; + export const createTierTag = (tag: Tag) => { return { displayName: tag.displayName, diff --git a/pom.xml b/pom.xml index ba2fee518fbe..0fc47f77e182 100644 --- a/pom.xml +++ b/pom.xml @@ -74,10 +74,10 @@ UTF-8 - 5.6.0 + 5.7.0 1.7.36 - 2.15.3 + 2.16.0 2.1.9 2.1.6 1.0 @@ -95,10 +95,10 @@ 2.15.0 0.8.10 3.37.1 - 1.5.0 - 2.14.0 + 1.6.0 + 2.15.0 9.22.3 - 2.1.0.20 + 2.1.0.22 2.10.1 8.0.33 42.6.0 @@ -112,7 +112,7 @@ 7.17.13 2.5.0 4.1.5 - 2.2.17 + 2.2.19 1.0.1.RELEASE 4.5.14 @@ -428,7 +428,7 @@ io.github.classgraph classgraph - 4.8.163 + 4.8.165 org.reflections