Skip to content

Commit 5c8ac3e

Browse files
control center cdap
1 parent a784b2d commit 5c8ac3e

7 files changed

Lines changed: 257 additions & 0 deletions

File tree

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# Copyright © 2023 Cask Data, Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
4+
# use this file except in compliance with the License. You may obtain a copy of
5+
# the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12+
# License for the specific language governing permissions and limitations under
13+
# the License.
14+
15+
@Controlcenter
16+
17+
Feature: Controlcenter - Validate control center page flow
18+
19+
Scenario: Verify user is able to click the control center tab and successfully navigates to control center page
20+
Given Open Datafusion Project to configure pipeline
21+
Then Click on the Hamburger bar on the left panel
22+
Then Click on Control Center link from the hamburger menu
23+
Then Verify that the user is navigated to control center page successfully
24+
25+
@BQ_INSERT_INT_SOURCE_TEST @BQ_SINK_TEST
26+
Scenario: Verify that user is able to create a pipeline and then validate the presence of created pipeline in control center.
27+
Given Open Datafusion Project to configure pipeline
28+
Then Click on the Hamburger bar on the left panel
29+
Then Click on Control Center link from the hamburger menu
30+
Then Click on the Plus Green Button to import the pipelines
31+
Then Verify user is able to click on the create button to create a pipeline successfully
32+
When Expand Plugin group in the LHS plugins list: "Source"
33+
When Select plugin: "BigQuery" from the plugins list as: "Source"
34+
When Expand Plugin group in the LHS plugins list: "Sink"
35+
When Select plugin: "BigQuery" from the plugins list as: "Sink"
36+
Then Connect plugins: "BigQuery" and "BigQuery2" to establish connection
37+
Then Navigate to the properties page of plugin: "BigQuery"
38+
And Enter input plugin property: "referenceName" with value: "Reference"
39+
And Replace input plugin property: "project" with value: "projectId"
40+
And Enter input plugin property: "datasetProject" with value: "projectId"
41+
And Replace input plugin property: "dataset" with value: "dataset"
42+
Then Override Service account details if set in environment variables
43+
And Enter input plugin property: "table" with value: "bqSourceTable"
44+
Then Click on the Get Schema button
45+
Then Validate "BigQuery" plugin properties
46+
And Close the Plugin Properties page
47+
Then Navigate to the properties page of plugin: "BigQuery2"
48+
Then Replace input plugin property: "project" with value: "projectId"
49+
Then Override Service account details if set in environment variables
50+
Then Enter input plugin property: "datasetProject" with value: "projectId"
51+
Then Enter input plugin property: "referenceName" with value: "BQReferenceName"
52+
Then Enter input plugin property: "dataset" with value: "dataset"
53+
Then Enter input plugin property: "table" with value: "bqTargetTable"
54+
Then Validate "BigQuery" plugin properties
55+
And Close the Plugin Properties page
56+
Then Save the pipeline
57+
Then Deploy the pipeline
58+
Then Run the Pipeline in Runtime
59+
Then Wait till pipeline is in running state
60+
Then Verify the pipeline status is "Succeeded"
61+
Then Click on the Hamburger bar on the left panel
62+
Then Click on Control Center link from the hamburger menu
63+
Then Verify the pipeline created successfully is present in control center page
64+
65+
@BQ_INSERT_INT_SOURCE_TEST @BQ_SINK_TEST
66+
Scenario: Verify that user is able to delete the created pipeline in control center successfully.
67+
Given Open Datafusion Project to configure pipeline
68+
Then Click on the Hamburger bar on the left panel
69+
Then Click on Control Center link from the hamburger menu
70+
Then Click on the Plus Green Button to import the pipelines
71+
Then Verify user is able to click on the create button to create a pipeline successfully
72+
When Expand Plugin group in the LHS plugins list: "Source"
73+
When Select plugin: "BigQuery" from the plugins list as: "Source"
74+
When Expand Plugin group in the LHS plugins list: "Sink"
75+
When Select plugin: "BigQuery" from the plugins list as: "Sink"
76+
Then Connect plugins: "BigQuery" and "BigQuery2" to establish connection
77+
Then Navigate to the properties page of plugin: "BigQuery"
78+
And Enter input plugin property: "referenceName" with value: "Reference"
79+
And Replace input plugin property: "project" with value: "projectId"
80+
And Enter input plugin property: "datasetProject" with value: "projectId"
81+
And Replace input plugin property: "dataset" with value: "dataset"
82+
Then Override Service account details if set in environment variables
83+
And Enter input plugin property: "table" with value: "bqSourceTable"
84+
Then Click on the Get Schema button
85+
Then Validate "BigQuery" plugin properties
86+
And Close the Plugin Properties page
87+
Then Navigate to the properties page of plugin: "BigQuery2"
88+
Then Replace input plugin property: "project" with value: "projectId"
89+
Then Override Service account details if set in environment variables
90+
Then Enter input plugin property: "datasetProject" with value: "projectId"
91+
Then Enter input plugin property: "referenceName" with value: "BQReferenceName"
92+
Then Enter input plugin property: "dataset" with value: "dataset"
93+
Then Enter input plugin property: "table" with value: "bqTargetTable"
94+
Then Validate "BigQuery" plugin properties
95+
And Close the Plugin Properties page
96+
Then Save the pipeline
97+
Then Deploy the pipeline
98+
Then Click on the Hamburger bar on the left panel
99+
Then Click on Control Center link from the hamburger menu
100+
Then Click on the delete icon of the created pipeline and pipeline should get deleted successfully
101+
Then Verify the deleted pipeline is not present in the control center page
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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+
package io.cdap.cdap.controlcenter.runners;
18+
19+
import io.cucumber.junit.Cucumber;
20+
import io.cucumber.junit.CucumberOptions;
21+
import org.junit.runner.RunWith;
22+
23+
/**
24+
* Test Runner to execute controlcenter related test cases.
25+
*/
26+
@RunWith(Cucumber.class)
27+
@CucumberOptions(
28+
features = {"src/e2e-test/features"},
29+
glue = {"io.cdap.cdap.controlcenter.stepsdesign", "stepsdesign"},
30+
tags = {"@Controlcenter"},
31+
plugin = {"pretty", "html:target/cucumber-html-report/controlcenter",
32+
"json:target/cucumber-reports/cucumber-controlcenter.json",
33+
"junit:target/cucumber-reports/cucumber-controlcenter.xml"}
34+
)
35+
public class TestRunner {
36+
37+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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 runners for controlcenter features.
19+
*/
20+
package io.cdap.cdap.controlcenter.runners;
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
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+
package io.cdap.cdap.controlcenter.stepsdesign;
18+
19+
import com.google.cloud.bigquery.BigQueryException;
20+
import io.cdap.e2e.utils.BigQueryClient;
21+
import io.cdap.e2e.utils.PluginPropertyUtils;
22+
import io.cucumber.java.After;
23+
import io.cucumber.java.Before;
24+
import org.apache.commons.lang3.StringUtils;
25+
import org.junit.Assert;
26+
import stepsdesign.BeforeActions;
27+
28+
import java.io.IOException;
29+
import java.util.NoSuchElementException;
30+
import java.util.UUID;
31+
32+
public class TestSetupHooks {
33+
public static String bqTargetTable = StringUtils.EMPTY;
34+
public static String bqSourceTable = StringUtils.EMPTY;
35+
public static String datasetName = PluginPropertyUtils.pluginProp("dataset");
36+
37+
@Before(order = 1, value = "@BQ_INSERT_INT_SOURCE_TEST")
38+
public static void createSourceBQTable() throws IOException, InterruptedException {
39+
bqSourceTable = "E2E_SOURCE_" + UUID.randomUUID().toString().replaceAll("-", "_");
40+
PluginPropertyUtils.addPluginProp("bqSourceTable", bqSourceTable);
41+
BeforeActions.scenario.write("BQ source table name - " + bqSourceTable);
42+
BigQueryClient.getSoleQueryResult("create table `" + datasetName + "." + bqSourceTable + "` " +
43+
"(ID INT64, Name STRING, Price FLOAT64, Customer_Exists BOOL)");
44+
try {
45+
BigQueryClient.getSoleQueryResult("INSERT INTO `" + datasetName + "." + bqSourceTable + "` " +
46+
"(ID, Name, Price,Customer_Exists)" +
47+
"VALUES" + "(3, 'Rajan Kumar', 100.0, true)");
48+
} catch (NoSuchElementException e) {
49+
// Insert query does not return any record.
50+
// Iterator on TableResult values in getSoleQueryResult method throws NoSuchElementException
51+
BeforeActions.scenario.write("Error inserting the record in the table" + e.getStackTrace());
52+
}
53+
PluginPropertyUtils.addPluginProp(" bqSourceTable", bqSourceTable);
54+
BeforeActions.scenario.write("BQ Source Table " + bqSourceTable + " updated successfully");
55+
}
56+
57+
@After(order = 1, value = "@BQ_INSERT_INT_SOURCE_TEST")
58+
public static void deleteTempSourceBQTable() throws IOException, InterruptedException {
59+
BigQueryClient.dropBqQuery(bqSourceTable);
60+
PluginPropertyUtils.removePluginProp("bqSourceTable");
61+
BeforeActions.scenario.write("BQ source Table " + bqSourceTable + " deleted successfully");
62+
bqSourceTable = StringUtils.EMPTY;
63+
}
64+
65+
@Before(order = 1, value = "@BQ_SINK_TEST")
66+
public static void setTempTargetBQTableName() {
67+
bqTargetTable = "E2E_TARGET_" + UUID.randomUUID().toString().replaceAll("-", "_");
68+
PluginPropertyUtils.addPluginProp("bqTargetTable", bqTargetTable);
69+
BeforeActions.scenario.write("BQ Target table name - " + bqTargetTable);
70+
}
71+
72+
@After(order = 1, value = "@BQ_SINK_TEST")
73+
public static void deleteTempTargetBQTable() throws IOException, InterruptedException {
74+
try {
75+
BigQueryClient.dropBqQuery(bqTargetTable);
76+
PluginPropertyUtils.removePluginProp("bqTargetTable");
77+
BeforeActions.scenario.write("BQ Target table - " + bqTargetTable + " deleted successfully");
78+
bqTargetTable = StringUtils.EMPTY;
79+
} catch (BigQueryException e) {
80+
if (e.getMessage().contains("Not found: Table")) {
81+
BeforeActions.scenario.write("BQ Target Table " + bqTargetTable + " does not exist");
82+
} else {
83+
Assert.fail(e.getMessage());
84+
}
85+
}
86+
}
87+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
validationSuccessMessage=No errors found.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
projectId=project
2+
datasetProjectId=datasetProject
3+
referenceName=referenceName
4+
table=table

cdap-e2e-tests/src/e2e-test/resources/pluginParameters.properties

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,11 @@ clientName=cdap
22
clientUrl=http://localhost:11011
33
serverUrl=https://placeholder.com/api
44
# command to generate token: gcloud auth print-access-token
5+
6+
## CONTROLCENTER-START
57
serverAccessToken=placeholder
8+
bqSourceTable=dummy
9+
dataset=bq_automation
10+
projectId=cdf-athena
11+
datasetprojectId=cdf-athena
12+
## CONTROLCENTER-END

0 commit comments

Comments
 (0)