Skip to content

Commit ec40077

Browse files
CloudSql My Sql Sink Run Time Scenarios e2e tests
1 parent 86d084d commit ec40077

5 files changed

Lines changed: 73 additions & 7 deletions

File tree

cloudsql-mysql-plugin/src/e2e-test/features/source/CloudMySqlRunTime.feature

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ Feature: CloudMySql - Verify data transfer from CloudMySql source to BigQuery si
3131
Then Enter input plugin property: "connectionName" with value: "ConnectionName"
3232
Then Enter input plugin property: "user" with value: "username"
3333
Then Enter input plugin property: "password" with value: "password"
34-
# Then Replace input plugin property: "user" with value: "username" for Credentials and Authorization related fields
35-
# Then Replace input plugin property: "password" with value: "password" for Credentials and Authorization related fields
3634
Then Enter input plugin property: "referenceName" with value: "RefName"
3735
Then Enter input plugin property: "database" with value: "DatabaseName"
3836
Then Enter textarea plugin property: "importQuery" with value: "selectQuery"
@@ -147,6 +145,7 @@ Feature: CloudMySql - Verify data transfer from CloudMySql source to BigQuery si
147145
Then Wait till pipeline is in running state
148146
Then Open and capture logs
149147
Then Verify the pipeline status is "Succeeded"
148+
Then Validate the values of records transferred to target table is equal to the values from source table
150149

151150
@CLOUDMYSQL_SOURCE_DATATYPES_TEST
152151
Scenario: To verify data is getting transferred from CloudMySql source to CloudMySql successfully when connection arguments are set
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
* Copyright © 2022 Cask Data, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
5+
* use this file except in compliance with the License. You may obtain a copy of
6+
* the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
* License for the specific language governing permissions and limitations under
14+
* the License.
15+
*/
16+
17+
/**
18+
* Package contains the runners for CoudMysql features.
19+
*/
20+
21+
package io.cdap.plugin.CloudMySql.runners;

cloudsql-mysql-plugin/src/e2e-test/java/io/cdap/plugin/CloudMySql/stepsdesign/CloudMySql.java

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package io.cdap.plugin.CloudMySql.stepsdesign;
2+
3+
import io.cdap.e2e.utils.CdfHelper;
4+
import io.cdap.e2e.utils.PluginPropertyUtils;
5+
import io.cdap.plugin.CloudMySqlClient;
6+
import io.cucumber.java.en.Then;
7+
import org.junit.Assert;
8+
import stepsdesign.BeforeActions;
9+
import io.cdap.e2e.utils.PluginPropertyUtils;
10+
11+
import java.sql.SQLException;
12+
13+
/**
14+
* CloudSqlMySql Plugin related step design.
15+
*/
16+
public class CloudMysql implements CdfHelper {
17+
18+
@Then("Validate the values of records transferred to target table is equal to the values from source table")
19+
public void validateTheValuesOfRecordsTransferredToTargetTableIsEqualToTheValuesFromSourceTable() throws SQLException, ClassNotFoundException {
20+
int countRecords = CloudMySqlClient.countRecord(PluginPropertyUtils.pluginProp("targetTable"));
21+
Assert.assertEquals("Number of records transferred should be equal to records out ",
22+
countRecords, recordOut());
23+
BeforeActions.scenario.write(" ******** Number of records transferred ********:" + countRecords);
24+
boolean recordsMatched = CloudMySqlClient.validateRecordValues(PluginPropertyUtils.pluginProp("sourceTable"),
25+
PluginPropertyUtils.pluginProp("targetTable"));
26+
Assert.assertTrue("Value of records transferred to the target table should be equal to the value " +
27+
"of the records in the source table", recordsMatched);
28+
}
29+
}
30+
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
* Copyright © 2023 Cask Data, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
5+
* use this file except in compliance with the License. You may obtain a copy of
6+
* the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
* License for the specific language governing permissions and limitations under
14+
* the License.
15+
*/
16+
17+
/**
18+
* Package contains the stepDesign for CloudMysql features.
19+
*/
20+
21+
package io.cdap.plugin.CloudMySql.stepsdesign;

0 commit comments

Comments
 (0)