Skip to content

Commit 7a62d47

Browse files
psainicsitsmekumari
authored andcommitted
oracle sink update upsert
1 parent 3474cad commit 7a62d47

14 files changed

Lines changed: 877 additions & 12 deletions

File tree

database-commons/src/main/java/io/cdap/plugin/db/DBRecord.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -314,10 +314,7 @@ protected void upsertOperation(PreparedStatement stmt) throws SQLException {
314314
}
315315

316316
private boolean fillUpdateParams(List<String> updatedKeyList, ColumnType columnType) {
317-
if (operationName.equals(Operation.UPDATE) && updatedKeyList.contains(columnType.getName())) {
318-
return true;
319-
}
320-
return false;
317+
return operationName.equals(Operation.UPDATE) && updatedKeyList.contains(columnType.getName());
321318
}
322319

323320
private Schema getNonNullableSchema(Schema.Field field) {

oracle-plugin/src/e2e-test/features/sink/OracleDesignTimeValidation.feature

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,3 +173,140 @@ Feature: Oracle sink- Verify Oracle sink plugin design time validation scenarios
173173
Then Enter input plugin property: "referenceName" with value: "sourceRef"
174174
Then Click on the Validate button
175175
Then Verify that the Plugin is displaying an error message: "errorMessageInvalidHost" on the header
176+
177+
@Oracle_Required
178+
Scenario: Verify the validation error message on header with blank database value
179+
Given Open Datafusion Project to configure pipeline
180+
When Expand Plugin group in the LHS plugins list: "Sink"
181+
When Select plugin: "Oracle" from the plugins list as: "Sink"
182+
Then Navigate to the properties page of plugin: "Oracle"
183+
Then Select dropdown plugin property: "select-jdbcPluginName" with option value: "driverName"
184+
Then Replace input plugin property: "host" with value: "host" for Credentials and Authorization related fields
185+
Then Replace input plugin property: "port" with value: "port" for Credentials and Authorization related fields
186+
Then Replace input plugin property: "user" with value: "username" for Credentials and Authorization related fields
187+
Then Replace input plugin property: "password" with value: "password" for Credentials and Authorization related fields
188+
Then Click plugin property: "switch-useConnection"
189+
Then Click on the Validate button
190+
Then Verify that the Plugin is displaying an error message: "blank.database.message" on the header
191+
192+
@ORACLE_SOURCE_DATATYPES_TEST @ORACLE_TARGET_DATATYPES_TEST @Oracle_Required
193+
Scenario: Verify the validation error message with blank password value
194+
Given Open Datafusion Project to configure pipeline
195+
When Expand Plugin group in the LHS plugins list: "Source"
196+
When Select plugin: "Oracle" from the plugins list as: "Source"
197+
When Expand Plugin group in the LHS plugins list: "Sink"
198+
When Select plugin: "Oracle" from the plugins list as: "Sink"
199+
Then Connect plugins: "Oracle" and "Oracle2" to establish connection
200+
Then Navigate to the properties page of plugin: "Oracle"
201+
Then Select dropdown plugin property: "select-jdbcPluginName" with option value: "driverName"
202+
Then Replace input plugin property: "host" with value: "host" for Credentials and Authorization related fields
203+
Then Replace input plugin property: "port" with value: "port" for Credentials and Authorization related fields
204+
Then Replace input plugin property: "user" with value: "username" for Credentials and Authorization related fields
205+
Then Replace input plugin property: "password" with value: "password" for Credentials and Authorization related fields
206+
Then Select radio button plugin property: "connectionType" with value: "service"
207+
Then Select radio button plugin property: "role" with value: "normal"
208+
Then Enter input plugin property: "referenceName" with value: "sourceRef"
209+
Then Replace input plugin property: "database" with value: "databaseName"
210+
Then Enter textarea plugin property: "importQuery" with value: "selectQuery"
211+
Then Click on the Get Schema button
212+
Then Verify the Output Schema matches the Expected Schema: "outputDatatypesSchema"
213+
Then Validate "Oracle" plugin properties
214+
Then Close the Plugin Properties page
215+
Then Navigate to the properties page of plugin: "Oracle2"
216+
Then Select dropdown plugin property: "select-jdbcPluginName" with option value: "driverName"
217+
Then Replace input plugin property: "host" with value: "host" for Credentials and Authorization related fields
218+
Then Replace input plugin property: "port" with value: "port" for Credentials and Authorization related fields
219+
Then Replace input plugin property: "database" with value: "databaseName"
220+
Then Replace input plugin property: "tableName" with value: "targetTable"
221+
Then Replace input plugin property: "dbSchemaName" with value: "schema"
222+
Then Replace input plugin property: "user" with value: "username" for Credentials and Authorization related fields
223+
Then Enter input plugin property: "referenceName" with value: "targetRef"
224+
Then Select radio button plugin property: "connectionType" with value: "service"
225+
Then Select radio button plugin property: "role" with value: "normal"
226+
Then Click on the Validate button
227+
Then Verify that the Plugin is displaying an error message: "blank.connection.message" on the header
228+
229+
@ORACLE_SOURCE_DATATYPES_TEST @ORACLE_TARGET_DATATYPES_TEST @Oracle_Required
230+
Scenario: Verify the validation error message with blank host value
231+
Given Open Datafusion Project to configure pipeline
232+
When Expand Plugin group in the LHS plugins list: "Source"
233+
When Select plugin: "Oracle" from the plugins list as: "Source"
234+
When Expand Plugin group in the LHS plugins list: "Sink"
235+
When Select plugin: "Oracle" from the plugins list as: "Sink"
236+
Then Connect plugins: "Oracle" and "Oracle2" to establish connection
237+
Then Navigate to the properties page of plugin: "Oracle"
238+
Then Select dropdown plugin property: "select-jdbcPluginName" with option value: "driverName"
239+
Then Replace input plugin property: "host" with value: "host" for Credentials and Authorization related fields
240+
Then Replace input plugin property: "port" with value: "port" for Credentials and Authorization related fields
241+
Then Replace input plugin property: "user" with value: "username" for Credentials and Authorization related fields
242+
Then Replace input plugin property: "password" with value: "password" for Credentials and Authorization related fields
243+
Then Select radio button plugin property: "connectionType" with value: "service"
244+
Then Select radio button plugin property: "role" with value: "normal"
245+
Then Enter input plugin property: "referenceName" with value: "sourceRef"
246+
Then Replace input plugin property: "database" with value: "databaseName"
247+
Then Enter textarea plugin property: "importQuery" with value: "selectQuery"
248+
Then Click on the Get Schema button
249+
Then Verify the Output Schema matches the Expected Schema: "outputDatatypesSchema"
250+
Then Validate "Oracle" plugin properties
251+
Then Close the Plugin Properties page
252+
Then Navigate to the properties page of plugin: "Oracle2"
253+
Then Select dropdown plugin property: "select-jdbcPluginName" with option value: "driverName"
254+
Then Replace input plugin property: "port" with value: "port" for Credentials and Authorization related fields
255+
Then Replace input plugin property: "database" with value: "databaseName"
256+
Then Replace input plugin property: "tableName" with value: "targetTable"
257+
Then Replace input plugin property: "dbSchemaName" with value: "schema"
258+
Then Replace input plugin property: "user" with value: "username" for Credentials and Authorization related fields
259+
Then Enter input plugin property: "referenceName" with value: "targetRef"
260+
Then Select radio button plugin property: "connectionType" with value: "service"
261+
Then Select radio button plugin property: "role" with value: "normal"
262+
Then Click on the Validate button
263+
Then Verify that the Plugin is displaying an error message: "blank.HostBlank.message" on the header
264+
265+
@ORACLE_SOURCE_DATATYPES_TEST @ORACLE_TARGET_DATATYPES_TEST @Oracle_Required
266+
Scenario Outline: To verify Oracle sink plugin validation error message for update, upsert operation name and table key
267+
Given Open Datafusion Project to configure pipeline
268+
When Expand Plugin group in the LHS plugins list: "Source"
269+
When Select plugin: "Oracle" from the plugins list as: "Source"
270+
When Expand Plugin group in the LHS plugins list: "Sink"
271+
When Select plugin: "Oracle" from the plugins list as: "Sink"
272+
Then Connect plugins: "Oracle" and "Oracle2" to establish connection
273+
Then Navigate to the properties page of plugin: "Oracle"
274+
Then Select dropdown plugin property: "select-jdbcPluginName" with option value: "driverName"
275+
Then Replace input plugin property: "host" with value: "host" for Credentials and Authorization related fields
276+
Then Replace input plugin property: "port" with value: "port" for Credentials and Authorization related fields
277+
Then Replace input plugin property: "user" with value: "username" for Credentials and Authorization related fields
278+
Then Replace input plugin property: "password" with value: "password" for Credentials and Authorization related fields
279+
Then Select radio button plugin property: "connectionType" with value: "service"
280+
Then Select radio button plugin property: "role" with value: "normal"
281+
Then Enter input plugin property: "referenceName" with value: "sourceRef"
282+
Then Replace input plugin property: "database" with value: "databaseName"
283+
Then Enter textarea plugin property: "importQuery" with value: "selectQuery"
284+
Then Click on the Get Schema button
285+
Then Verify the Output Schema matches the Expected Schema: "outputDatatypesSchema"
286+
Then Validate "Oracle" plugin properties
287+
Then Close the Plugin Properties page
288+
Then Navigate to the properties page of plugin: "Oracle2"
289+
Then Select dropdown plugin property: "select-jdbcPluginName" with option value: "driverName"
290+
Then Replace input plugin property: "host" with value: "host" for Credentials and Authorization related fields
291+
Then Replace input plugin property: "port" with value: "port" for Credentials and Authorization related fields
292+
Then Replace input plugin property: "user" with value: "username" for Credentials and Authorization related fields
293+
Then Replace input plugin property: "password" with value: "password" for Credentials and Authorization related fields
294+
Then Select radio button plugin property: "connectionType" with value: "service"
295+
Then Select radio button plugin property: "role" with value: "normal"
296+
Then Enter input plugin property: "referenceName" with value: "sourceRef"
297+
Then Replace input plugin property: "database" with value: "databaseName"
298+
Then Replace input plugin property: "tableName" with value: "targetTable"
299+
Then Replace input plugin property: "dbSchemaName" with value: "schema"
300+
Then Replace input plugin property: "user" with value: "username" for Credentials and Authorization related fields
301+
Then Replace input plugin property: "password" with value: "password" for Credentials and Authorization related fields
302+
Then Enter input plugin property: "referenceName" with value: "targetRef"
303+
Then Select radio button plugin property: "connectionType" with value: "service"
304+
Then Select radio button plugin property: "role" with value: "normal"
305+
Then Select radio button plugin property: "operationName" with value: "<options>"
306+
Then Click on the Validate button
307+
Then Verify that the Plugin Property: "operationName" is displaying an in-line error message: "errorMessageUpdateUpsertOperationName"
308+
Then Verify that the Plugin Property: "relationTableKey" is displaying an in-line error message: "errorMessageUpdateUpsertOperationName"
309+
Examples:
310+
| options |
311+
| upsert |
312+
| update |

0 commit comments

Comments
 (0)