Skip to content

Commit

Permalink
Joiner New Changes
Browse files Browse the repository at this point in the history
Advance and Basic Joiner Plugin features.
Selected input scenarios for basic joins.
  • Loading branch information
rahuldash171 committed Sep 15, 2023
1 parent 5a8c415 commit ce2b19a
Show file tree
Hide file tree
Showing 8 changed files with 322 additions and 2 deletions.
264 changes: 264 additions & 0 deletions core-plugins/src/e2e-test/features/joiner/JoinerWithFile.feature

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,17 @@
import io.cdap.e2e.pages.locators.CdfPluginPropertiesLocators;
import io.cdap.e2e.utils.ElementHelper;
import io.cdap.e2e.utils.SeleniumHelper;
import io.cdap.e2e.utils.WaitHelper;
import io.cdap.plugin.joiner.locators.JoinerLocators;
import org.openqa.selenium.ElementClickInterceptedException;

/**
* Joiner Related Actions.
*/
public class JoinerActions {
static {
SeleniumHelper.getPropertiesLocators(JoinerLocators.class);

}

public static void clickFieldsExpandButton() {
Expand All @@ -37,9 +40,14 @@ public static void enterNumPartitions(String numPartitions) {
}

public static void uncheckPluginFieldAliasCheckBox(String plugin, String field) {
WaitHelper.waitForElementToBeClickable(JoinerLocators.fieldAliasCheckBox(plugin, field),6L);
ElementHelper.selectCheckbox(JoinerLocators.fieldAliasCheckBox(plugin, field));
}

public static void selectRequiredInputCheckbox(int value, String inputSchemaName) {
ElementHelper.selectCheckbox(JoinerLocators.requiredInputCheckbox(value - 1, inputSchemaName));
}

public static void selectJoinerType(String targetJoinerType) {
ElementHelper.selectDropdownOption(JoinerLocators.joinerTypeSelectDropdown,
CdfPluginPropertiesLocators.locateDropdownListItem(targetJoinerType));
Expand All @@ -49,4 +57,9 @@ public static int getTargetRecordsCount() {
String incount = JoinerLocators.targetRecordsCount.getText();
return Integer.parseInt(incount.replaceAll(",", ""));
}

public static void clickByclosingSelectedinputsPannel(String inputSchemaName) {
ElementHelper.clickOnElement(JoinerLocators.closeSelectedInputsPannel(inputSchemaName));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,17 @@ public class JoinerLocators {

public static WebElement fieldAliasCheckBox(String pluginName, String field) {
String xpath = "//*[@data-cy='" + pluginName + "-stage-expansion-panel']" + "//*[@data-cy='" + field +
"-field-selector-name']/..//*[@type='checkbox']";
"-field-selector-name']/..//*[@data-cy='" + field + "-field-selector-checkbox']";
return SeleniumDriver.getDriver().findElement(By.xpath(xpath));
}

public static WebElement requiredInputCheckbox(int value, String inputSchemaName) {
String xpath = "//*[@type='checkbox'][@value='" + value + "-" + inputSchemaName + "']";
return SeleniumDriver.getDriver().findElement(By.xpath(xpath));
}

public static WebElement closeSelectedInputsPannel(String inputSchemaName) {
String xpath = "//*[@data-cy='" + inputSchemaName + "-stage-expansion-panel']//*[contains(@class,'edgeEnd')]";
return SeleniumDriver.getDriver().findElement(By.xpath(xpath));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ public void uncheckPluginFieldAliasCheckBox(String plugin, String field) {
JoinerActions.uncheckPluginFieldAliasCheckBox(plugin, field);
}

@Then("Click on the required input checkbox for schema {int} named {string}")
public void clickRequiredInput(int value, String inputSchemaName) {
JoinerActions.selectRequiredInputCheckbox(value, inputSchemaName);
}

@Then("Enter numPartitions {string}")
public void openJoinerProperties(String partitions) {
JoinerActions.enterNumPartitions(PluginPropertyUtils.pluginProp(partitions));
Expand All @@ -55,4 +60,9 @@ public void scrollToValidationButton() {
public void validateOUTRecordCountOfJoinerIsEqualToINRecordCountOfSink() {
Assert.assertEquals(recordOut(), JoinerActions.getTargetRecordsCount());
}

@Then("Close {string} plugin selected input pannel")
public void closeJoinerSelectedInputsPannel(String inputSchemaName) {
JoinerActions.clickByclosingSelectedinputsPannel(inputSchemaName);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ joinerInvalidPartitions=&*^*
joinerKeys=File.purchase_id = File2.customer_id
joinerInputMemory=File
joinerNullKeys=false
joinConditionSQLExpression=File.customer_name = customers.name
joinConditionSQLExpression=File.id = File2.customerid
joinerOutputSchema={ "type": "record", "name": "text", "fields": [ \
{ "name": "purchase_id", "type": "int" }, { "name": "customer_name", "type": "string" }, \
{ "name": "item", "type": "string" }, { "name": "customer_id", "type": "int" }, { "name": "name", "type": "string" } ] }
Expand All @@ -254,6 +254,9 @@ joinerTest2OutputFile=e2e-tests/expected_outputs/CSV_JOINER_TEST2_Output.csv
joinerTest3OutputFile=e2e-tests/expected_outputs/CSV_JOINER_TEST3_Output.csv
joinerTest4OutputFile=e2e-tests/expected_outputs/CSV_JOINER_TEST4_Output.csv
joinerMacroOutputFile=e2e-tests/expected_outputs/CSV_JOINER_TEST5_Output.csv
joinerTest6OutputFile=e2e-tests/expected_outputs/CSV_JOINER_TEST6_Output.csv
joinerTest7OutputFile=e2e-tests/expected_outputs/CSV_JOINER_TEST7_Output.csv

## JOINER-PLUGIN-PROPERTIES-END

## ERROR-COLLECTOR-PROPERTIES-START
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
1,Douglas,1, Vista Montana,San Jose,CA,95134,408-777-3214,1,0.8
1,Douglas,1, Vista Montana,San Jose,CA,95134,408-777-3214,1,2.05
2,David,3, Baypointe Parkway,Houston,TX,78970,804-777-2341,2,1.5
2,David,3, Baypointe Parkway,Houston,TX,78970,804-777-2341,2,0.5
3,Hugh,5, Cool Way,Manhattan,NY,67263,708-234-2168,3,1.99
4,Walter,3828, Piermont Dr,Orlando,FL,73498,201-734-7315,,
5,Frank,1609 Far St.,San Diego,CA,29770,201-506-8756,5,0.5
6,Serena,123 Far St.,Las Vegas,Nv,45334,888-605-3479,,
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
1,Douglas,1, Vista Montana,San Jose,CA,95134,408-777-3214,1
1,Douglas,1, Vista Montana,San Jose,CA,95134,408-777-3214,1
2,David,3, Baypointe Parkway,Houston,TX,78970,804-777-2341,2
2,David,3, Baypointe Parkway,Houston,TX,78970,804-777-2341,2
3,Hugh,5, Cool Way,Manhattan,NY,67263,708-234-2168,3
5,Frank,1609 Far St.,San Diego,CA,29770,201-506-8756,5
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
1,Douglas,1, Vista Montana,San Jose,95134,408-777-3214,1
1,Douglas,1, Vista Montana,San Jose,95134,408-777-3214,1
2,David,3, Baypointe Parkway,Houston,78970,804-777-2341,2
2,David,3, Baypointe Parkway,Houston,78970,804-777-2341,2
3,Hugh,5, Cool Way,Manhattan,67263,708-234-2168,3
5,Frank,1609 Far St.,San Diego,29770,201-506-8756,5

0 comments on commit ce2b19a

Please sign in to comment.