From 96702fdee831722ff326a316af5441f08489c2b3 Mon Sep 17 00:00:00 2001 From: psainics Date: Fri, 24 Jan 2025 11:27:20 +0530 Subject: [PATCH] Add OracleErrorDetailsProvider --- .../java/io/cdap/plugin/util/DBUtils.java | 1 + .../features/source/OracleRunTime.feature | 2 ++ .../oracle/OracleErrorDetailsProvider.java | 31 +++++++++++++++++++ .../io/cdap/plugin/oracle/OracleSink.java | 9 ++++++ .../io/cdap/plugin/oracle/OracleSource.java | 10 ++++++ 5 files changed, 53 insertions(+) create mode 100644 oracle-plugin/src/main/java/io/cdap/plugin/oracle/OracleErrorDetailsProvider.java diff --git a/database-commons/src/main/java/io/cdap/plugin/util/DBUtils.java b/database-commons/src/main/java/io/cdap/plugin/util/DBUtils.java index ffcfdc375..6fad9a4ab 100644 --- a/database-commons/src/main/java/io/cdap/plugin/util/DBUtils.java +++ b/database-commons/src/main/java/io/cdap/plugin/util/DBUtils.java @@ -64,6 +64,7 @@ public final class DBUtils { public static final String CLOUDSQLMYSQL_SUPPORTED_DOC_URL = "https://cloud.google.com/sql/docs/mysql/error-messages"; public static final String POSTGRES_SUPPORTED_DOC_URL = "https://www.postgresql.org/docs/current/errcodes-appendix.html"; + public static final String ORACLE_SUPPORTED_DOC_URL = "https://docs.oracle.com/en/error-help/db/ora-index.html"; public static final String CLOUDSQLPOSTGRES_SUPPORTED_DOC_URL = "https://cloud.google.com/sql/docs/postgres/error-messages"; diff --git a/oracle-plugin/src/e2e-test/features/source/OracleRunTime.feature b/oracle-plugin/src/e2e-test/features/source/OracleRunTime.feature index 2040c33f6..c6ba5109b 100644 --- a/oracle-plugin/src/e2e-test/features/source/OracleRunTime.feature +++ b/oracle-plugin/src/e2e-test/features/source/OracleRunTime.feature @@ -338,7 +338,9 @@ Feature: Oracle - Verify data transfer from Oracle source to BigQuery sink And Save and Deploy Pipeline And Run the Pipeline in Runtime And Wait till pipeline is in running state + And Open and capture logs And Verify the pipeline status is "Failed" + And Close the pipeline logs Then Open Pipeline logs and verify Log entries having below listed Level and Message: | Level | Message | | ERROR | errorLogsMessageInvalidBoundingQuery | diff --git a/oracle-plugin/src/main/java/io/cdap/plugin/oracle/OracleErrorDetailsProvider.java b/oracle-plugin/src/main/java/io/cdap/plugin/oracle/OracleErrorDetailsProvider.java new file mode 100644 index 000000000..e0c770c9f --- /dev/null +++ b/oracle-plugin/src/main/java/io/cdap/plugin/oracle/OracleErrorDetailsProvider.java @@ -0,0 +1,31 @@ +/* + * Copyright © 2025 Cask Data, Inc. + * + * 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. + */ + +package io.cdap.plugin.oracle; + +import io.cdap.plugin.common.db.DBErrorDetailsProvider; +import io.cdap.plugin.util.DBUtils; + +/** + * A custom ErrorDetailsProvider for Oracle plugin. + */ +public class OracleErrorDetailsProvider extends DBErrorDetailsProvider { + + @Override + protected String getExternalDocumentationLink() { + return DBUtils.ORACLE_SUPPORTED_DOC_URL; + } +} diff --git a/oracle-plugin/src/main/java/io/cdap/plugin/oracle/OracleSink.java b/oracle-plugin/src/main/java/io/cdap/plugin/oracle/OracleSink.java index 45afbcb51..511281e9d 100644 --- a/oracle-plugin/src/main/java/io/cdap/plugin/oracle/OracleSink.java +++ b/oracle-plugin/src/main/java/io/cdap/plugin/oracle/OracleSink.java @@ -82,6 +82,15 @@ protected LineageRecorder getLineageRecorder(BatchSinkContext context) { return new LineageRecorder(context, asset); } + @Override + protected String getErrorDetailsProviderClassName() { + return OracleErrorDetailsProvider.class.getName(); + } + + @Override + protected String getExternalDocumentationLink() { + return DBUtils.ORACLE_SUPPORTED_DOC_URL; + } /** * Oracle action configuration. diff --git a/oracle-plugin/src/main/java/io/cdap/plugin/oracle/OracleSource.java b/oracle-plugin/src/main/java/io/cdap/plugin/oracle/OracleSource.java index 6df62e63e..53f75613b 100644 --- a/oracle-plugin/src/main/java/io/cdap/plugin/oracle/OracleSource.java +++ b/oracle-plugin/src/main/java/io/cdap/plugin/oracle/OracleSource.java @@ -71,6 +71,16 @@ protected Class getDBRecordType() { return OracleSourceDBRecord.class; } + @Override + protected String getExternalDocumentationLink() { + return DBUtils.ORACLE_SUPPORTED_DOC_URL; + } + + @Override + protected String getErrorDetailsProviderClassName() { + return OracleErrorDetailsProvider.class.getName(); + } + @Override protected LineageRecorder getLineageRecorder(BatchSourceContext context) { String fqn = DBUtils.constructFQN("oracle",