You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@falcon.apache.org by pa...@apache.org on 2016/03/01 09:25:56 UTC
[10/51] [partial] falcon git commit: FALCON-1830 Removed code source
directories and updated pom
http://git-wip-us.apache.org/repos/asf/falcon/blob/8e49379d/falcon-regression/merlin/src/main/java/org/apache/falcon/regression/ui/search/ClusterWizardPage.java
----------------------------------------------------------------------
diff --git a/falcon-regression/merlin/src/main/java/org/apache/falcon/regression/ui/search/ClusterWizardPage.java b/falcon-regression/merlin/src/main/java/org/apache/falcon/regression/ui/search/ClusterWizardPage.java
deleted file mode 100644
index 41fc120..0000000
--- a/falcon-regression/merlin/src/main/java/org/apache/falcon/regression/ui/search/ClusterWizardPage.java
+++ /dev/null
@@ -1,556 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 org.apache.falcon.regression.ui.search;
-
-import org.apache.commons.lang.StringUtils;
-import org.apache.falcon.entity.v0.cluster.ACL;
-import org.apache.falcon.entity.v0.cluster.ClusterLocationType;
-import org.apache.falcon.entity.v0.cluster.Interface;
-import org.apache.falcon.entity.v0.cluster.Interfacetype;
-import org.apache.falcon.entity.v0.cluster.Location;
-import org.apache.falcon.entity.v0.cluster.Property;
-import org.apache.falcon.regression.Entities.ClusterMerlin;
-import org.apache.falcon.regression.core.util.UIAssert;
-import org.apache.log4j.Logger;
-import org.openqa.selenium.By;
-import org.openqa.selenium.WebDriver;
-import org.openqa.selenium.WebElement;
-import org.openqa.selenium.support.FindBy;
-import org.openqa.selenium.support.FindBys;
-import org.testng.Assert;
-
-import java.util.List;
-
-/** Page object of the Cluster creation page. */
-public class ClusterWizardPage extends EntityWizardPage {
- private static final Logger LOGGER = Logger.getLogger(ClusterWizardPage.class);
- @FindBys({
- @FindBy(className = "mainUIView"),
- @FindBy(className = "clusterForm")
- })
- private WebElement clusterBox;
- @FindBy(id = "cluster.step1")
- private WebElement next;
- @FindBy(id = "cluster.step2")
- private WebElement save;
- @FindBy(id = "cluster.backToStep1")
- private WebElement previous;
- @FindBy(xpath = "//a[contains(text(), 'Cancel')]")
- private WebElement cancel;
- @FindBy(xpath = "//div[contains(@class, 'clusterSummaryRow')][h4]")
- private WebElement summaryBox;
-
- public ClusterWizardPage(WebDriver driver) {
- super(driver);
- }
-
- @Override
- public void checkPage() {
- UIAssert.assertDisplayed(clusterBox, "Cluster box");
- }
-
- /**
- * Fills cluster setup forms with values retrieved from Filling object.
- */
- public void fillForm(ClusterMerlin cluster) {
- setName(cluster.getName());
- setColo(cluster.getColo());
- setDescription(cluster.getDescription());
- setTags(cluster.getTags());
- ACL acl = cluster.getACL();
- setOwner(acl.getOwner());
- setGroup(acl.getGroup());
- setPermissions(acl.getPermission());
- for(Interface iface : cluster.getInterfaces().getInterfaces()) {
- setInterface(iface);
- }
- for (Property property : cluster.getProperties().getProperties()) {
- addProperty(property.getName(), property.getValue());
- }
- setLocations(cluster.getLocations().getLocations());
- waitForAngularToFinish();
- }
-
- /**
- * Methods to fill specific wizard fields.
- */
- public void setName(String name) {
- WebElement nameInput = getNameInput();
- nameInput.clear();
- sendKeysSlowly(nameInput, name);
- }
-
- public String getName() {
- return getNameInput().getAttribute("value");
- }
-
- private WebElement getNameInput() {
- return driver.findElement(By.xpath("//div[label[text()='Name']]/input"));
- }
-
- public void setColo(String colo) {
- WebElement coloInput = clusterBox.findElement(By.xpath("//div[label[text()='Colo']]/input"));
- coloInput.clear();
- sendKeysSlowly(coloInput, colo);
- }
-
- public void setDescription(String description) {
- WebElement descriptionInput = clusterBox.findElement(By.xpath("//div[label[text()='Description']]/input"));
- descriptionInput.clear();
- sendKeysSlowly(descriptionInput, description);
- }
-
- public void setOwner(String owner) {
- WebElement ownerInput = clusterBox.findElement(By.xpath("//div[label[text()='Owner']]/input"));
- ownerInput.clear();
- sendKeysSlowly(ownerInput, owner);
- }
-
- public void setGroup(String group) {
- WebElement groupInput = clusterBox.findElement(By.xpath("//div[label[text()='Group']]/input"));
- groupInput.clear();
- sendKeysSlowly(groupInput, group);
- }
-
- public void setPermissions(String permissions) {
- WebElement permissionsInput = clusterBox.findElement(By.xpath("//div[label[text()='Permissions']]/input"));
- permissionsInput.clear();
- sendKeysSlowly(permissionsInput, permissions);
- }
-
- /**
- * Common method to fill interfaces.
- */
- public void setInterface(Interface iface) {
- String xpath = "//input[contains(@ng-model,"
- + " 'clusterEntity.clusterModel.cluster.interfaces.interface[%sPos]._endpoint')]";
- WebElement ifaceEndpoint = clusterBox.findElement(By.xpath(String.format(xpath, iface.getType().value())));
- ifaceEndpoint.clear();
- sendKeysSlowly(ifaceEndpoint, iface.getEndpoint());
- setInterfaceVersion(iface);
- }
-
- /**
- * Set interface version by interface type.
- */
- public void setInterfaceVersion(Interface iface) {
- WebElement ifaceVersion = getInterfaceVersionInput(iface.getType());
- if (iface.getVersion() != null) {
- ifaceVersion.clear();
- sendKeysSlowly(ifaceVersion, iface.getVersion());
- }
- }
-
- /**
- * Get input for interface version by interface type.
- */
- private WebElement getInterfaceVersionInput(Interfacetype interfacetype) {
- return clusterBox.findElement(By.xpath(String.format(
- "//input[@ng-model='clusterEntity.clusterModel.cluster.interfaces.interface[%sPos]._version']",
- interfacetype.value())));
- }
-
- /**
- * Populates form with tags.
- */
- public void setTags(String tagsStr){
- if (!StringUtils.isEmpty(tagsStr)) {
- String [] tags = tagsStr.split(",");
- for (int i = 0; i < tags.length; i++) {
- if (i > 0){
- clickAddTag();
- }
- String key = tags[i].trim().split("=")[0];
- String value = tags[i].trim().split("=")[1];
- addTag(key, value);
- }
- }
- }
-
- /**
- * Populates last (empty) tag and value fields and creates new fields.
- * @param key tag key
- * @param value tag value
- */
- public void addTag(String key, String value) {
- List<WebElement> tagInputs = clusterBox.findElements(By.xpath("//input[@ng-model='tag.key']"));
- List<WebElement> valueInputs = clusterBox.findElements(By.xpath("//input[@ng-model='tag.value']"));
- WebElement tagInput = tagInputs.get(tagInputs.size() - 1);
- sendKeysSlowly(tagInput, key);
- WebElement valueInput = valueInputs.get(valueInputs.size() - 1);
- sendKeysSlowly(valueInput, value);
- }
-
- public void clickAddTag() {
- clusterBox.findElement(By.xpath("//button[contains(., 'add tag')]")).click();
- }
-
- public void clickDeleteTag() {
- List<WebElement> buttons = clusterBox
- .findElements(By.xpath("//div[@class='row dynamic-table-spacer ng-scope']//button[contains(.,'delete')]"));
- buttons.get(buttons.size() - 1).click();
- }
-
- /**
- * Fills property fields and creates new empty property fields.
- */
- public void addProperty(String name, String value) {
- List<WebElement> propInputs = clusterBox.findElements(By.xpath("//input[@ng-model='property._name']"));
- List<WebElement> valueInputs = clusterBox.findElements(By.xpath("//input[@ng-model='property._value']"));
- WebElement propInput = propInputs.get(propInputs.size()-1);
- sendKeysSlowly(propInput, name);
- WebElement valueInput = valueInputs.get(valueInputs.size() - 1);
- sendKeysSlowly(valueInput, value);
- clickAddProperty();
- }
-
- public void clickAddProperty() {
- clusterBox.findElement(By.xpath("//button[contains(., 'add property')]")).click();
- }
-
- /**
- * Method to set locations. Location can be only one of ClusterLocationType. So adding new location only after
- * respective compulsory location was filled.
- * @param locations locations
- */
- public void setLocations(List<Location> locations) {
- boolean staging = false, temp = false, working = false;
- for(Location location : locations) {
- WebElement pathInput = null;
- if (location.getName() == ClusterLocationType.STAGING && !staging) {
- pathInput = clusterBox.findElement(By.id("location.staging"));
- staging = true;
- } else if (location.getName() == ClusterLocationType.TEMP && !temp) {
- pathInput = clusterBox.findElement(By.id("location.temp"));
- temp = true;
- } else if (location.getName() == ClusterLocationType.WORKING && !working) {
- pathInput = clusterBox.findElement(By.id("location.working"));
- working = true;
- } else {
- fillAdditionalLocation(location);
- }
- if (pathInput != null) {
- pathInput.clear();
- sendKeysSlowly(pathInput, location.getPath());
- }
- }
- }
-
- /**
- * Method populates last location fields with values and creates new fields.
- */
- public void fillAdditionalLocation(Location location) {
- List<WebElement> allNameInputs = clusterBox
- .findElements(By.xpath("//input[contains(@ng-model, 'location._name')]"));
- sendKeysSlowly(allNameInputs.get(allNameInputs.size() - 1), location.getName().value());
- List<WebElement> allPathInputs = clusterBox
- .findElements(By.xpath("//input[contains(@ng-model, 'location._path')]"));
- sendKeysSlowly(allPathInputs.get(allPathInputs.size() - 1), location.getPath());
- }
-
- public void clickAddLocation() {
- clusterBox.findElement(By.xpath("//button[contains(., 'add location')]")).click();
- }
-
- public void clickDeleteLocation() {
- List<WebElement> buttons = clusterBox
- .findElements(By.xpath("//div[@class='row ng-scope']//button[contains(.,'delete')]"));
- Assert.assertFalse(buttons.isEmpty(), "Delete button should be present.");
- buttons.get(buttons.size() - 1).click();
- }
-
- public boolean checkElementByContent(String elementTag, String content) {
- List<WebElement> elements = clusterBox.findElements(By.xpath("//" + elementTag));
- for(WebElement element : elements) {
- if (element.getAttribute("value").equals(content)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Method to assert the staging and Working location are same.
- */
- public void assertLocationsEqualError(){
-
- // Assertion for Staging Location.
- LOGGER.info(" Assertion for Staging Directory ");
- Assert.assertTrue(checkErrorMessageByElement("input[contains(@id,'location.staging')]//following-sibling::"
- + "span[contains(@ng-show, 'locationsEqualError')]",
- "Staging and Working location should be different"));
-
- // Assertion for Working Location.
- LOGGER.info("Assertion for Working Directory");
- Assert.assertTrue(checkErrorMessageByElement("input[contains(@id,'location.working')]//following-sibling::"
- + "span[contains(@ng-show, 'locationsEqualError')]",
- "Staging and Working location should be different"));
- }
-
- /**
- * Method to get the Error text message displayed based on Xpath and compares.
- * with the input string paramater : errMessage
- * @param elementTag elementTag
- * @param errMessage errMessage
- */
- public boolean checkErrorMessageByElement(String elementTag, String errMessage) {
-
- List<WebElement> elements = clusterBox.findElements(By.xpath("//" + elementTag));
- if (!elements.isEmpty()){
- for (WebElement element : elements) {
- Assert.assertEquals(element.getText(), errMessage);
- LOGGER.info("Error Message Displayed : " + element.getText());
- }
- return true;
- }else{
- LOGGER.info(" No Elements found with the xpath " + elementTag);
- return false;
- }
- }
-
- /**
- * Retrieves the value of the summary box and parses it to cluster properties.
- * @param draft empty cluster to contain all properties.
- * @return cluster filled with properties from the summary.
- */
- public ClusterMerlin getSummary(ClusterMerlin draft) {
- ClusterMerlin cluster = new ClusterMerlin(draft.toString());
- String summaryBoxText = summaryBox.getText();
- LOGGER.info("Summary block text : " + summaryBoxText);
-
- String[] slices;
- String value;
- String path;
- String label;
-
- //retrieve basic properties
- String basicProps = summaryBoxText.split("ACL")[0];
- for (String line : basicProps.split("\\n")) {
- slices = line.split(" ");
- label = slices[0].replace(":", "").trim();
- value = getValueFromSlices(slices, line);
- switch (label) {
- case "Name":
- cluster.setName(value);
- break;
- case "Colo":
- cluster.setColo(value);
- break;
- case "Description":
- cluster.setDescription(value);
- break;
- case "Tags":
- cluster.setTags(value);
- break;
- default:
- break;
- }
- }
- //retrieve ALC
- String propsLeft = summaryBoxText.split("ACL")[1];
- String[] acl = propsLeft.split("Interfaces")[0].split(" ");
- cluster.getACL().setOwner(acl[1]);
- cluster.getACL().setGroup(acl[3]);
- cluster.getACL().setPermission(acl[5].trim());
-
- //retrieve interfaces
- propsLeft = propsLeft.split("Interfaces")[1];
- boolean propertiesPresent = propsLeft.contains("Properties");
- String nextLabel = propertiesPresent ? "Properties" : "Locations";
- String interfaces = propsLeft.split(nextLabel)[0].trim();
- for (String line : interfaces.split("\\n")) {
- slices = line.split(" ");
- label = slices[0].replace(":", "").trim();
- String endpoint = slices[1].trim();
- String version = slices[3].trim();
- switch (label) {
- case "readonly":
- cluster.addInterface(Interfacetype.READONLY, endpoint, version);
- break;
- case "write":
- cluster.addInterface(Interfacetype.WRITE, endpoint, version);
- break;
- case "execute":
- cluster.addInterface(Interfacetype.EXECUTE, endpoint, version);
- break;
- case "workflow":
- cluster.addInterface(Interfacetype.WORKFLOW, endpoint, version);
- break;
- case "messaging":
- cluster.addInterface(Interfacetype.MESSAGING, endpoint, version);
- break;
- case "registry":
- cluster.addInterface(Interfacetype.REGISTRY, endpoint, version);
- break;
- default:
- break;
- }
- }
- //retrieve properties
- if (propertiesPresent) {
- propsLeft = propsLeft.split("Properties")[1];
- String properties = propsLeft.split("Locations")[0].trim();
- for (String line : properties.split("\\n")) {
- int indx = line.indexOf(":");
- String name = line.substring(0, indx).trim();
- value = line.substring(indx + 1, line.length()).trim();
- cluster.withProperty(name, value);
- }
- }
- //retrieve locations
- propsLeft = propsLeft.split("Locations")[1].trim();
- for (String line : propsLeft.split("\\n")) {
- slices = line.split(" ");
- label = slices[0].replace(":", "").trim();
- path = getValueFromSlices(slices, line);
- switch (label) {
- case "staging":
- cluster.addLocation(ClusterLocationType.STAGING, path);
- break;
- case "temp":
- cluster.addLocation(ClusterLocationType.TEMP, path);
- break;
- default:
- cluster.addLocation(ClusterLocationType.WORKING, path);
- break;
- }
- }
- return cluster;
- }
-
- /**
- * Clicks on cancel button.
- */
- public void cancel() {
- cancel.click();
- }
-
- /**
- * Click on next button which is the same as finish step 1.
- */
- public void clickNext() {
- next.click();
- waitForAngularToFinish();
- Assert.assertTrue(summaryBox.isDisplayed(), "Summary box should be displayed.");
- }
-
- /**
- * Click on next button in the cluster creation page.
- */
- public void clickJustNext() {
- next.click();
- waitForAngularToFinish();
- }
-
- /**
- * Click on save button.
- */
- public void clickSave() {
- save.click();
- waitForAlert();
- }
-
- /**
- * Clicks on previous button.
- */
- public void clickPrevious() {
- previous.click();
- waitForAngularToFinish();
- UIAssert.assertDisplayed(clusterBox, "Cluster box");
- }
-
- /**
- * Method imitates click on check box.
- * @param expectedState whether check box is expected to be enabled or not after click.
- */
- public void checkRegistry(boolean expectedState) {
- WebElement checkbox = clusterBox.findElement(By.xpath("//input[@type='checkbox']"));
- clickCheckBoxSecurely(checkbox, expectedState);
- waitForAngularToFinish();
- }
-
- public WebElement getInterfaceEndpoint(Interfacetype interfacetype) {
- String xpath = String.format("//input[@ng-model='clusterEntity.clusterModel.cluster.interfaces"
- + ".interface[%sPos]._endpoint']", interfacetype.value());
- return clusterBox.findElement(By.xpath(xpath));
- }
-
- public String getInterfaceEndpointValue(Interfacetype interfacetype) {
- return getInterfaceEndpoint(interfacetype).getAttribute("value");
- }
-
- public WebElement getInterfaceVersion(Interfacetype interfacetype) {
- String xpath = String.format("//input[@ng-model='clusterEntity.clusterModel.cluster.interfaces"
- + ".interface[%sPos]._version']", interfacetype.value());
- return clusterBox.findElement(By.xpath(xpath));
- }
-
- public String getInterfaceVersionValue(Interfacetype interfacetype) {
- return getInterfaceVersion(interfacetype).getAttribute("value");
- }
-
- /**
- * Method preventing the NullPointerException.
- */
- public String getValueFromSlices(String[] slices, String line) {
- String trimValue;
- if (slices[0].length()==(line.length())) {
- trimValue = "";
- }else {
- trimValue = slices[1].trim();
- }
- return trimValue;
- }
-
- /**
- * Checks whether registry interface is enabled for input or not.
- */
- public boolean isRegistryEnabled() {
- return getInterfaceEndpoint(Interfacetype.REGISTRY).isEnabled()
- && getInterfaceVersion(Interfacetype.REGISTRY).isEnabled();
- }
-
- private WebElement getNameUnavailable(){
- return clusterBox.findElement(By.xpath(
- "//div[contains(@class, 'nameInputDisplay') and contains(@class, 'custom-danger')]"));
- }
-
- public void checkNameUnavailableDisplayed(boolean isDisplayed) {
- if (isDisplayed){
- UIAssert.assertDisplayed(getNameUnavailable(), "Name Unavailable not displayed");
- }else {
- try{
- getNameUnavailable();
- Assert.fail("Name Unavailable found");
- } catch (Exception ex){
- LOGGER.info("Name Unavailable not found");
- }
- }
- }
-
- @Override
- public WebElement getEditXMLButton() {
- return driver.findElement(By.id("cluster.editXML"));
- }
-
- @Override
- public ClusterMerlin getEntityFromXMLPreview() {
- return new ClusterMerlin(getXMLPreview());
- }
-}
http://git-wip-us.apache.org/repos/asf/falcon/blob/8e49379d/falcon-regression/merlin/src/main/java/org/apache/falcon/regression/ui/search/EntityPage.java
----------------------------------------------------------------------
diff --git a/falcon-regression/merlin/src/main/java/org/apache/falcon/regression/ui/search/EntityPage.java b/falcon-regression/merlin/src/main/java/org/apache/falcon/regression/ui/search/EntityPage.java
deleted file mode 100644
index 98bf9b5..0000000
--- a/falcon-regression/merlin/src/main/java/org/apache/falcon/regression/ui/search/EntityPage.java
+++ /dev/null
@@ -1,692 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 org.apache.falcon.regression.ui.search;
-
-import com.google.common.collect.ImmutableMap;
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.lang.WordUtils;
-import org.apache.falcon.entity.v0.Frequency;
-import org.apache.falcon.entity.v0.feed.Cluster;
-import org.apache.falcon.entity.v0.feed.LocationType;
-import org.apache.falcon.entity.v0.feed.Property;
-import org.apache.falcon.entity.v0.process.Input;
-import org.apache.falcon.entity.v0.process.Output;
-import org.apache.falcon.entity.v0.process.Retry;
-import org.apache.falcon.regression.Entities.FeedMerlin;
-import org.apache.falcon.regression.Entities.ProcessMerlin;
-import org.apache.falcon.regression.core.util.TimeUtil;
-import org.apache.falcon.regression.core.util.UIAssert;
-import org.apache.falcon.resource.InstancesResult;
-import org.apache.log4j.Logger;
-import org.openqa.selenium.By;
-import org.openqa.selenium.Keys;
-import org.openqa.selenium.WebDriver;
-import org.openqa.selenium.WebElement;
-import org.openqa.selenium.support.FindBy;
-import org.openqa.selenium.support.FindBys;
-import org.openqa.selenium.support.PageFactory;
-import org.openqa.selenium.support.ui.Select;
-import org.testng.asserts.SoftAssert;
-
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-
-/**
- * Class representation of Search UI entity page.
- */
-public class EntityPage extends AbstractSearchPage {
- private static final Logger LOGGER = Logger.getLogger(EntityPage.class);
-
- /**
- * Possible instance actions available on entity page.
- */
- public enum InstanceAction {
- Log,
- Resume,
- Rerun,
- Suspend,
- Kill
- }
-
- public EntityPage(WebDriver driver) {
- super(driver);
- }
-
- private WebElement getEntityTitle() {
- final WebElement title = driver.findElement(By.id("entity-title"));
- UIAssert.assertDisplayed(title, "entity title");
- return title;
- }
-
- @FindBys({
- @FindBy(className = "mainUIView"),
- @FindBy(className = "dependencies-graph")
- })
- private WebElement dependencyBox;
-
-
- @FindBys({
- @FindBy(className = "mainUIView"),
- @FindBy(xpath = "(.//*[contains(@class, 'detailsBox')])[2]")
- })
- private WebElement instanceListBox;
-
- @FindBys({
- @FindBy(className = "mainUIView"),
- @FindBy(className = "summaryBox")
- })
- private WebElement propertiesBlock;
-
- public String getEntityName() {
- UIAssert.assertDisplayed(getEntityTitle(), "Entity title");
- return getEntityTitle().getText().split(" ")[0];
- }
-
- @Override
- public void checkPage() {
- UIAssert.assertDisplayed(dependencyBox, "Dependency box");
- UIAssert.assertDisplayed(instanceListBox, "Instance list box");
- UIAssert.assertDisplayed(propertiesBlock, "Summary box");
- }
-
- public EntityPage refreshPage() {
- final String entityName = getEntityName();
- SearchPage searchPage = getPageHeader().gotoHome();
- return searchPage.openEntityPage(entityName);
- }
-
- public void checkFeedProperties(FeedMerlin feed) {
- openProperties();
-
- final WebElement propertiesBox =
- propertiesBlock.findElement(By.xpath("//div[@ui-view='feedSummary']"));
- UIAssert.assertDisplayed(propertiesBox, "Properties box");
-
- //all the parts of the entity properties
- final List<WebElement> propertyParts = propertiesBox.findElements(By.xpath("./div"));
- //First set of properties
- final WebElement generalBox = propertyParts.get(0);
- final List<WebElement> generalParts = generalBox.findElements(By.xpath("./div"));
- SoftAssert softAssert = new SoftAssert();
- //General
- softAssert.assertEquals(generalParts.get(0).getText(), "General", "Unexpected heading");
- final List<WebElement> nameAndDesc = generalParts.get(1).findElements(By.xpath("./div"));
- softAssert.assertEquals(nameAndDesc.get(0).getText(), "Name: " + feed.getName(),
- "Unexpected feed name in properties.");
- softAssert.assertEquals(nameAndDesc.get(1).getText(), "Description: " + feed.getDescription(),
- "Unexpected description in properties.");
- //Tags
- softAssert.assertEquals(generalParts.get(2).getText(), "Tags", "Unexpected heading");
- softAssert.assertEquals(generalParts.get(3).getText(),
- StringUtils.trimToEmpty(feed.getTags()),
- "Unexpected tags");
- //Groups
- softAssert.assertEquals(generalParts.get(4).getText(), "Groups", "Unexpected heading");
- softAssert.assertEquals(generalParts.get(5).getText(),
- StringUtils.trimToEmpty(feed.getGroups()),
- "Unexpected groups");
- //Access Control list
- softAssert.assertEquals(generalParts.get(6).getText(), "Access Control List",
- "Unexpected heading");
- final List<WebElement> ownerGrpPerm = generalParts.get(7).findElements(By.xpath("./div"));
- softAssert.assertEquals(ownerGrpPerm.get(0).getText(),
- "Owner: " + feed.getACL().getOwner(), "Unexpected owner");
- softAssert.assertEquals(ownerGrpPerm.get(1).getText(),
- "Group: " + feed.getACL().getGroup(), "Unexpected group");
- softAssert.assertEquals(ownerGrpPerm.get(2).getText(),
- "Permissions: " + feed.getACL().getPermission(), "Unexpected permission");
- //Schema
- softAssert.assertEquals(generalParts.get(8).getText(), "Schema",
- "Unexpected heading for general properties");
- final List<WebElement> locAndProvider = generalParts.get(9).findElements(By.xpath("./div"));
- softAssert.assertEquals(locAndProvider.get(0).getText(),
- "Location: " + feed.getSchema().getLocation(), "Unexpected schema locations");
- softAssert.assertEquals(locAndProvider.get(1).getText(),
- "Provider: " + feed.getSchema().getProvider(), "Unexpected schema provider");
- //Properties
- softAssert.assertEquals(generalParts.get(10).getText(), "Properties",
- "Unexpected heading for general properties");
- final List<WebElement> freqLateAvail = generalParts.get(11).findElements(By.xpath("./div"));
- final Frequency feedFrequency = feed.getFrequency();
- softAssert.assertEquals(freqLateAvail.get(0).getText(),
- String.format("Frequency: Every %s %s",
- feedFrequency.getFrequency(), feedFrequency.getTimeUnit()),
- "Unexpected frequency");
- final Frequency feedLateCutoff = feed.getLateArrival().getCutOff();
- softAssert.assertEquals(freqLateAvail.get(1).getText(),
- String.format("Late Arrival: Up to %s %s",
- feedLateCutoff.getFrequency(), feedLateCutoff.getTimeUnit()),
- "Unexpected late arrival");
- softAssert.assertEquals(freqLateAvail.get(2).getText(),
- String.format("Availability Flag:%s",
- StringUtils.trimToEmpty(feed.getAvailabilityFlag())),
- "Unexpected availability flag");
- final List<WebElement> propertyElements =
- generalParts.get(12).findElements(By.xpath("./div"));
- List<String> displayedPropStr = new ArrayList<>();
- for (WebElement webElement : propertyElements) {
- displayedPropStr.add(webElement.getText());
- }
- Collections.sort(displayedPropStr);
- final List<String> expectedPropStr = getFeedPropString(feed);
- softAssert.assertEquals(displayedPropStr, expectedPropStr,
- "Feed properties & displayed properties don't match. Expected: " + expectedPropStr
- + " Actual: " + displayedPropStr);
- //Storage type
- softAssert.assertEquals(generalParts.get(13).getText(), "Default Storage Type:",
- "Unexpected label for storage type.");
- if (feed.getLocations() != null
- && feed.getLocations().getLocations() != null
- && feed.getLocations().getLocations().size() > 0) {
- softAssert.assertEquals(generalParts.get(13).getText(), "File System",
- "Unexpected storage type for feed.");
- } else {
- softAssert.fail("Need to add handler for other feed types.");
- }
- //Feed locations - Data followed by Stats followed by Meta
- softAssert.assertEquals(generalParts.get(14).getText(), "Default Location:",
- "Unexpected label for default location.");
- softAssert.assertEquals(generalParts.get(15).getText(),
- "Data\n" + feed.getFeedPath(LocationType.DATA),
- "Unexpected label for feed data label");
- softAssert.assertEquals(generalParts.get(16).getText(),
- "Stats\n" + feed.getFeedPath(LocationType.STATS),
- "Unexpected label for feed stats label");
- softAssert.assertEquals(generalParts.get(17).getText(),
- "Meta\n" + feed.getFeedPath(LocationType.META),
- "Unexpected label for feed mata label");
-
- //Second set of properties details with Source Cluster Properties
- final WebElement clustersBox = propertyParts.get(1);
- final List<WebElement> displayedClusters = clustersBox.findElements(By.xpath("./div"));
- final List<Cluster> feedClusters = feed.getClusters().getClusters();
- //test needs to be fixed when we have support for more than one feed cluster
- softAssert.assertEquals(feedClusters.size(), 1,
- "Current UI has support for only one feed cluster.");
- checkFeedCluster(displayedClusters.get(0), feedClusters.get(0), softAssert);
- softAssert.assertAll();
- }
-
- private void openProperties() {
- final WebElement heading = propertiesBlock.findElement(By.tagName("h4"));
- assertEquals(heading.getText(), "Properties",
- "Unexpected heading of properties box.");
- final WebElement upButton = propertiesBlock.findElement(By.className("pointer"));
- upButton.click();
- }
-
- private void checkFeedCluster(WebElement cluster, Cluster feedCluster, SoftAssert softAssert) {
- final List<WebElement> clusterElements = cluster.findElements(By.xpath("./div"));
- final String vClusterName = clusterElements.get(1).getText();
- softAssert.assertNotNull(feedCluster,
- "Unexpected feed cluster is displayed: " + vClusterName);
- final String clusterType = clusterElements.get(0).getText();
- softAssert.assertEquals(clusterType,
- WordUtils.capitalize(feedCluster.getType().toString().toLowerCase() + " Cluster"),
- "Unexpected cluster type for cluster: " + vClusterName);
- softAssert.assertEquals(clusterElements.get(2).getText(),
- "Start: " + feedCluster.getValidity().getStart()
- + "\nEnd: " + feedCluster.getValidity().getEnd(),
- "Unexpected validity of the cluster: " + vClusterName);
- softAssert.assertEquals(clusterElements.get(3).getText(), "Timezone: UTC",
- "Unexpected timezone for validity of the cluster: " + vClusterName);
- softAssert.assertEquals(clusterElements.get(4).getText(),
- "Retention: Archive in " + feedCluster.getRetention().getLimit().getFrequency()
- + " " + feedCluster.getRetention().getLimit().getTimeUnit(),
- "Unexpected retention associated with cluster: " + vClusterName);
- }
-
- private List<String> getFeedPropString(FeedMerlin feed) {
- List<String> retVals = new ArrayList<>();
- for (Property property : feed.getProperties().getProperties()) {
- retVals.add(property.getName() + ": " + property.getValue());
- }
- Collections.sort(retVals);
- return retVals;
- }
-
- public void checkProcessProperties(ProcessMerlin process) {
- openProperties();
-
- final WebElement propertiesBox =
- propertiesBlock.findElement(By.xpath("//div[@ui-view='processSummary']"));
- UIAssert.assertDisplayed(propertiesBox, "Properties box");
- final List<WebElement> propertiesParts = propertiesBox.findElements(By.xpath("./div"));
- final WebElement generalPropBlock = propertiesParts.get(0);
- final WebElement clusterPropBlock = propertiesParts.get(1);
- final WebElement inputPropBlock = propertiesParts.get(2);
- final WebElement outputPropBlock = propertiesParts.get(3);
-
- //checking general properties
- final List<WebElement> generalPropParts =
- generalPropBlock.findElement(By.xpath("./*")).findElements(By.xpath("./*"));
- SoftAssert softAssert = new SoftAssert();
- softAssert.assertEquals(generalPropParts.get(0).getText(), "Process",
- "Unexpected label in general properties.");
- softAssert.assertEquals(generalPropParts.get(1).getText(), "Name",
- "Unexpected label in general properties.");
- softAssert.assertEquals(generalPropParts.get(2).getText(), process.getName(),
- "Unexpected process name in general properties.");
- softAssert.assertEquals(generalPropParts.get(3).getText(), "Tags",
- "Unexpected label in general properties.");
- softAssert.assertEquals(generalPropParts.get(4).getText(),
- StringUtils.defaultIfBlank(process.getTags(), "No tags selected"),
- "Unexpected tags in general properties.");
- softAssert.assertEquals(generalPropParts.get(5).getText(), "Workflow",
- "Unexpected label in general properties.");
- softAssert.assertEquals(generalPropParts.get(6).getText(), "Name\nEngine\nVersion",
- "Unexpected workflow properties in general properties.");
- softAssert.assertEquals(generalPropParts.get(7).getText(),
- String.format("%s%n%s%n%s",
- StringUtils.defaultIfBlank(process.getWorkflow().getName(), ""),
- process.getWorkflow().getEngine(), process.getWorkflow().getVersion()),
- "Unexpected workflow properties in general properties.");
- softAssert.assertEquals(generalPropParts.get(7).getText(), "Path",
- "Unexpected label in general properties.");
- softAssert.assertEquals(generalPropParts.get(8).getText(), process.getWorkflow().getPath(),
- "Unexpected workflow path in general properties.");
- softAssert.assertEquals(generalPropParts.get(9).getText(), "Timing",
- "Unexpected label in general properties.");
- softAssert.assertEquals(generalPropParts.get(10).getText(), "Timezone",
- "Unexpected label in general properties.");
- softAssert.assertEquals(generalPropParts.get(12).getText(),
- String.format("Frequency%nEvery %s %s%n", process.getFrequency().getFrequency(),
- process.getFrequency().getTimeUnit())
- + "Max. parallel instances\n" + process.getParallel()
- + "\nOrder\n" + process.getOrder().toString(),
- "Unexpected frequency/parallel/order info in general properties.");
- softAssert.assertEquals(generalPropParts.get(13).getText(), "Retry",
- "Unexpected label in general properties.");
- final Retry processRetry = process.getRetry();
- softAssert.assertEquals(generalPropParts.get(14).getText(),
- "Policy\n" + processRetry.getPolicy().toString().toLowerCase()
- + "\nAttempts\n" + processRetry.getAttempts()
- + "\nDelay\nUp to " + processRetry.getDelay().getFrequency()
- + " " + processRetry.getDelay().getTimeUnit(),
- "Unexpected policy/attempt/delay in general properties.");
-
- //checking cluster properties
- final List<WebElement> allClusterProps =
- clusterPropBlock.findElements(By.xpath("./div/div/div"));
- final WebElement clustersHeading = clusterPropBlock.findElement(By.xpath(".//h5"));
- softAssert.assertEquals(clustersHeading.getText(), "Clusters",
- "Unexpected label in clusters heading");
- for (WebElement oneClusterProp : allClusterProps) {
- final List<WebElement> clusterPropParts = oneClusterProp.findElements(By.xpath("./*"));
- softAssert.assertEquals(clusterPropParts.get(0).getText(), "Name",
- "Unexpected label in clusters properties");
- final String clusterName = clusterPropParts.get(1).getText();
- final org.apache.falcon.entity.v0.process.Cluster processCluster =
- process.getClusterByName(clusterName);
- softAssert.assertNotNull(processCluster,
- "cluster with name " + clusterName + " was not present in process.");
- softAssert.assertEquals(clusterName, processCluster.getName(),
- "Unexpected cluster name in clusters properties");
- softAssert.assertEquals(clusterPropParts.get(2).getText(), "Validity",
- "Unexpected label in clusters properties");
- softAssert.assertEquals(clusterPropParts.get(3).getText(),
- "Start\n" + processCluster.getValidity().getStart()
- + "\nEnd\n" + processCluster.getValidity().getEnd(),
- "Unexpected start/end time in clusters properties");
- }
- //checking inputs properties
- final WebElement inputHeading = inputPropBlock.findElement(By.xpath(".//h5"));
- softAssert.assertEquals(inputHeading.getText(), "Inputs",
- "Unexpected heading for input properties.");
- final List<WebElement> allInputsProps =
- inputPropBlock.findElements(By.xpath("./div/div/*"));
- for (WebElement oneInputProps : allInputsProps) {
- final List<WebElement> inputPropParts = oneInputProps.findElements(By.xpath("./*"));
- softAssert.assertEquals(inputPropParts.get(0).getText(), "Name",
- "Unexpected label in input properties");
- final String inputName = inputPropParts.get(1).getText();
- final Input processInput = process.getInputByName(inputName);
- softAssert.assertEquals(inputName, processInput.getName(),
- "Unexpected input name in input properties");
- softAssert.assertEquals(inputPropParts.get(2).getText(), "Feed",
- "Unexpected label in input properties");
- softAssert.assertEquals(inputPropParts.get(3).getText(), processInput.getFeed(),
- "Unexpected label in input properties");
- softAssert.assertEquals(inputPropParts.get(4).getText(), "Instance",
- "Unexpected label in input properties");
- softAssert.assertEquals(inputPropParts.get(5).getText(),
- "Start\n" + processInput.getStart() + "\nEnd\n" + processInput.getEnd(),
- "Unexpected start/end in input properties");
- }
- final WebElement outputHeading = outputPropBlock.findElement(By.tagName("h5"));
- softAssert.assertEquals(outputHeading.getText(), "Outputs",
- "Unexpected label for output properties.");
- final List<WebElement> allOutputsProps =
- outputPropBlock.findElements(By.xpath("./div/div/*"));
- for (WebElement oneOutputProps : allOutputsProps) {
- final List<WebElement> outputPropParts = oneOutputProps.findElements(By.xpath("./*"));
- softAssert.assertEquals(outputPropParts.get(0).getText(), "Name",
- "Unexpected label in output properties");
- final String outputName = outputPropParts.get(1).getText();
- final Output processOutput = process.getOutputByName(outputName);
- softAssert.assertEquals(outputName, processOutput.getName(),
- "Unexpected output name in output properties");
- softAssert.assertEquals(outputPropParts.get(2).getText(), "Feed",
- "Unexpected label in output properties");
- softAssert.assertEquals(outputPropParts.get(3).getText(), processOutput.getFeed(),
- "Unexpected feed name in output properties");
- softAssert.assertEquals(outputPropParts.get(4).getText(), "Instance",
- "Unexpected label in output properties");
- softAssert.assertEquals(outputPropParts.get(5).getText(), processOutput.getInstance(),
- "Unexpected instance in output properties");
- softAssert.assertAll();
- }
- }
-
- public void performActionOnSelectedInstances(InstanceAction instanceAction) {
- driver.findElement(By.xpath(String.format("//td/div[%d]", instanceAction.ordinal() + 1))).click();
- waitForAngularToFinish();
- //timeout to refresh a view
- TimeUtil.sleepSeconds(2);
- }
-
- public InstanceSummary getInstanceSummary() {
- return new InstanceSummary(this);
- }
-
- /**
- * Class representing all the displayed instance.
- */
- public static class InstanceSummary {
- private final WebElement instanceListBox;
- private final WebElement summaryTableHeading;
-
- public InstanceSummary(EntityPage entityPage) {
- instanceListBox = entityPage.instanceListBox;
- UIAssert.assertDisplayed(instanceListBox, "instance list box");
- assertEquals(instanceListBox.findElement(By.tagName("h4")).getText(),
- "Instances",
- "Unexpected heading in instances box.");
-
- summaryTableHeading = instanceListBox.findElement(By.xpath(".//thead/tr"));
- }
-
- private List<WebElement> getTableRows() {
- return instanceListBox.findElements(By.xpath(".//tbody/tr"));
- }
-
- /**
- * Get instance summary starting for all the pages.
- * @return instance summary
- */
- public List<OneInstanceSummary> getSummary() {
- List<OneInstanceSummary> summary = new ArrayList<>();
- final List<WebElement> tableBody = getTableRows();
- //last line has page number
- final WebElement pageNumberRow = tableBody.remove(tableBody.size() - 1);
- final List<WebElement> pages = pageNumberRow.findElement(By.className("pagination"))
- .findElements(By.className("ng-scope"));
- final int numberOfPages = pages.size();
- for (int pageNumber = 1; pageNumber <= numberOfPages; ++pageNumber) {
- //We want to use new web elements to avoid stale element issues
- final List<WebElement> newTableBody = getTableRows();
- //last line has page number
- final WebElement newPageNumberRow = newTableBody.remove(newTableBody.size() - 1);
- final List<WebElement> newPages =
- newPageNumberRow.findElement(By.className("pagination"))
- .findElements(By.className("ng-scope"));
- newPages.get(pageNumber-1).findElement(By.tagName("a")).click();
- summary.addAll(getSummaryInner());
- }
- return summary;
- }
-
- /**
- * Get instance summary starting for the current page.
- * @return instance summary
- */
- private List<OneInstanceSummary> getSummaryInner() {
- List<OneInstanceSummary> summary = new ArrayList<>();
- final List<WebElement> tableBody = getTableRows();
- //first line in body has buttons
- tableBody.remove(0);
- //last line has page number
- tableBody.remove(tableBody.size() - 1);
- //second last line is horizontal line
- tableBody.remove(tableBody.size() - 1);
- if (tableBody.size() == 1
- && tableBody.get(0).getText().equals("There are no results")) {
- return summary;
- }
- for (WebElement oneSummaryRow : tableBody) {
- summary.add(new OneInstanceSummary(oneSummaryRow));
- }
- return summary;
- }
-
- public void check() {
- final List<WebElement> summaryHeadParts = getSummaryHeadParts();
- getSelectAllCheckBox(summaryHeadParts);
- final WebElement instanceHeadLabel = summaryHeadParts.get(1);
- assertEquals(instanceHeadLabel.getText(), "Instance",
- "Unexpected label in instance summary heading");
- getSummaryStartedButton();
- getSummaryEndedButton();
- getStatusDropDown();
- }
-
- public void setInstanceSummaryStartTime(String timeStr) {
- final WebElement startTimeButton = getSummaryStartedButton();
- startTimeButton.clear();
- sendKeysSlowly(startTimeButton, timeStr);
- startTimeButton.sendKeys(Keys.ENTER);
- }
-
- public void setInstanceSummaryEndTime(String timeStr) {
- final WebElement endTimeButton = getSummaryEndedButton();
- endTimeButton.clear();
- sendKeysSlowly(endTimeButton, timeStr);
- endTimeButton.sendKeys(Keys.ENTER);
- }
-
- public void selectInstanceSummaryStatus(String labelText) {
- getStatusDropDown().selectByVisibleText(labelText);
- }
-
- public static OneInstanceSummary getOneSummary(final List<OneInstanceSummary> summaries,
- final String nominalTime) {
- for (OneInstanceSummary oneSummary : summaries) {
- if (oneSummary.getNominalTime().equals(nominalTime)) {
- return oneSummary;
- }
- }
- return null;
- }
-
- public void checkSummary(InstancesResult.Instance[] apiSummary) {
- final List<OneInstanceSummary> summary = getSummary();
- assertEquals(apiSummary.length, summary.size(),
- String.format("Length of the displayed instance summary is not same: %s %s",
- Arrays.toString(apiSummary), summary));
- for (InstancesResult.Instance oneApiSummary : apiSummary) {
- final OneInstanceSummary oneSummary =
- getOneSummary(summary, oneApiSummary.instance);
- assertEquals(oneApiSummary.instance, oneSummary.getNominalTime(),
- "Nominal time of instance summary doesn't match.");
- final SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm");
- final Date apiStartTime = oneApiSummary.getStartTime();
- if (apiStartTime == null) {
- assertTrue(StringUtils.isEmpty(oneSummary.getStartTime()),
- "Displayed start time : " + oneSummary + " is not "
- + "consistent with start time of api which is null");
- } else {
- assertEquals(oneSummary.getStartTime(), dateFormat.format(apiStartTime),
- "Displayed start time : " + oneSummary + " is not "
- + "consistent with start time of api: " + apiStartTime);
- }
- final Date apiEndTime = oneApiSummary.getEndTime();
- if (apiEndTime == null) {
- assertTrue(StringUtils.isEmpty(oneSummary.getEndTime()),
- "Displayed end time : " + oneSummary + " is not "
- + "consistent end start time of api which is null");
- } else {
- assertEquals(oneSummary.getEndTime(), dateFormat.format(apiEndTime),
- "Displayed end time : " + oneSummary + " is not "
- + "consistent with end time of api: " + apiEndTime);
- }
- assertEquals(oneApiSummary.status.toString(), oneSummary.getStatus(),
- "Status of instance summary doesn't match.");
- }
- }
-
- public WebElement getSummaryStartedButton() {
- final WebElement startedBox = getSummaryHeadParts().get(2);
- assertEquals(startedBox.getText(), "Started ",
- "Unexpected label in instance summary heading");
- return startedBox.findElement(By.tagName("input"));
- }
-
- public WebElement getSummaryEndedButton() {
- final WebElement endedBox = getSummaryHeadParts().get(3);
- assertEquals(endedBox.getText(), "Ended ",
- "Unexpected label in instance summary heading");
- return endedBox.findElement(By.tagName("input"));
- }
-
- public Select getStatusDropDown() {
- final WebElement statusBox = getSummaryHeadParts().get(4);
- assertEquals(statusBox.getText(),
- "Status \nALL\nRUNNING\nSUCCEEDED\nSUSPENDED\nWAITING\nKILLED",
- "Unexpected label in instance summary heading");
- return new Select(statusBox.findElement(By.tagName("select")));
- }
-
- public List<WebElement> getSummaryHeadParts() {
- return summaryTableHeading.findElements(By.xpath("./th/div"));
- }
-
- public WebElement getSelectAllCheckBox(List<WebElement> summaryHeadParts) {
- return summaryHeadParts.get(0).findElement(By.tagName("input"));
- }
- }
-
-
- public InstancePage openInstance(String nominalTime) {
- instanceListBox.findElement(By.xpath("//button[contains(.,'" + nominalTime + "')]")).click();
- return PageFactory.initElements(driver, InstancePage.class);
- }
-
- /**
- * Class representing summary of one instance.
- */
- public static final class OneInstanceSummary {
- private final WebElement oneInstanceSummary;
- private final String startTime;
- private final String endTime;
- private final String status;
- private final String nominalTime;
-
- private final Map<Object, Object> statusColorMap = ImmutableMap.builder()
- .put("WAITING", "rgba(51, 51, 51, 1)")
- .put("RUNNING", "")
- .put("KILLED", "")
- .put("SUCCEEDED", "")
- .put("SUSPENDED", "")
- .put("FAILED", "").build();
- private boolean isCheckBoxTicked;
-
- private OneInstanceSummary(WebElement oneInstanceSummary) {
- this.oneInstanceSummary = oneInstanceSummary;
- nominalTime = getNominalTimeButton().getText();
- startTime = getSummaryCols().get(2).getText();
- endTime = getSummaryCols().get(3).getText();
-
- final WebElement statusElement = getSummaryCols().get(4);
- assertTrue(statusElement.isDisplayed(), "Status should be displayed");
- final String statusText = statusElement.getText();
- final Object expectedColor = statusColorMap.get(statusText.trim());
- assertNotNull(expectedColor,
- "Unexpected status: " + statusText + " not found in: " + statusColorMap);
- //status color not checked
- //final String actualColor = statusElement.getCssValue("color");
- //assertEquals(actualColor, expectedColor,
- // "Unexpected color for status in process instances block: " + statusText);
- status = statusText;
- isCheckBoxTicked = getCheckBox().isSelected();
- }
-
- private List<WebElement> getSummaryCols() {
- return oneInstanceSummary.findElements(By.tagName("td"));
- }
-
- private WebElement getCheckBox() {
- return getSummaryCols().get(0).findElement(By.tagName("input"));
- }
-
- private WebElement getNominalTimeButton() {
- return getSummaryCols().get(1);
- }
-
- public String getStartTime() {
- return startTime;
- }
-
- public String getEndTime() {
- return endTime;
- }
-
- public String getStatus() {
- return status;
- }
- public String getNominalTime() {
- return nominalTime;
- }
-
- public boolean isCheckBoxSelected() {
- return isCheckBoxTicked;
- }
-
- /**
- * Click the checkbox corresponding to this result. It is the responsibility of the
- * client to make sure that the web element for the instance is displayed and valid.
- */
- public void clickCheckBox() {
- getCheckBox().click();
- // Toggling of checkbox should change its internal state
- // Note that we can't expect the web element to be displayed & valid at the point this
- // object is used
- isCheckBoxTicked = !isCheckBoxTicked;
- }
-
- @Override
- public String toString() {
- return "OneInstanceSummary{"
- + "checkBox=" + isCheckBoxSelected()
- + ", nominalTime=" + getNominalTime()
- + ", startTime=" + getStartTime()
- + ", endTime=" + getEndTime()
- + ", status=" + getStatus()
- + "}";
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/falcon/blob/8e49379d/falcon-regression/merlin/src/main/java/org/apache/falcon/regression/ui/search/EntityWizardPage.java
----------------------------------------------------------------------
diff --git a/falcon-regression/merlin/src/main/java/org/apache/falcon/regression/ui/search/EntityWizardPage.java b/falcon-regression/merlin/src/main/java/org/apache/falcon/regression/ui/search/EntityWizardPage.java
deleted file mode 100644
index 72c03cf..0000000
--- a/falcon-regression/merlin/src/main/java/org/apache/falcon/regression/ui/search/EntityWizardPage.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 org.apache.falcon.regression.ui.search;
-
-import org.apache.falcon.entity.v0.Entity;
-import org.openqa.selenium.WebDriver;
-import org.openqa.selenium.WebElement;
-import org.openqa.selenium.support.FindBy;
-import org.testng.Assert;
-
-/**
- * https://issues.apache.org/jira/browse/FALCON-1546.
- * Parent class for cluster, feed and process wizard pages.
- */
-public abstract class EntityWizardPage extends AbstractSearchPage {
- @FindBy(xpath = "//i[contains(@class, 'pointer')]")
- protected WebElement xmlPreviewPointer;
- protected WebElement xmlPreview = null;
-
- public EntityWizardPage(WebDriver driver) {
- super(driver);
- }
-
- /**
- * Expand/collapse xml preview.
- * @param shouldBeExpanded should preview be expanded or collapsed.
- */
- public void clickXMLPreview(boolean shouldBeExpanded) {
- if (isXmlPreviewExpanded() != shouldBeExpanded) {
- xmlPreviewPointer.click();
- }
- Assert.assertEquals(isXmlPreviewExpanded(), shouldBeExpanded,
- "Xml preview should be " + (shouldBeExpanded ? " expanded." : " collapsed."));
- }
-
- /**
- * @return true if xml preview exists and is displayed, false otherwise.
- */
- public boolean isXmlPreviewExpanded() {
- xmlPreview = getElementOrNull("//textarea[@ng-model='prettyXml']");
- return xmlPreview != null && xmlPreview.isDisplayed();
- }
-
- public String getXMLPreview() {
- //preview block fetches changes slower then they appear on the form
- waitForAngularToFinish();
- clickXMLPreview(true);
- return xmlPreview.getAttribute("value");
- }
-
- public abstract Entity getEntityFromXMLPreview();
-
- /**
- * Pushes xml into xml preview block.
- * @param xml entity definition
- */
- public void setXmlPreview(String xml) {
- clickEditXml(true);
- xmlPreview.clear();
- xmlPreview.sendKeys(xml);
- waitForAngularToFinish();
- clickEditXml(false);
- }
-
- /**
- * Clicks on editXml button.
- */
- public void clickEditXml(boolean shouldBeEnabled) {
- waitForAngularToFinish();
- clickXMLPreview(true);
- getEditXMLButton().click();
- String disabled = xmlPreview.getAttribute("disabled");
- Assert.assertEquals(disabled == null, shouldBeEnabled,
- "Xml preview should be " + (shouldBeEnabled ? "enabled" : "disabled"));
- }
-
- public abstract WebElement getEditXMLButton();
-}
http://git-wip-us.apache.org/repos/asf/falcon/blob/8e49379d/falcon-regression/merlin/src/main/java/org/apache/falcon/regression/ui/search/FeedWizardPage.java
----------------------------------------------------------------------
diff --git a/falcon-regression/merlin/src/main/java/org/apache/falcon/regression/ui/search/FeedWizardPage.java b/falcon-regression/merlin/src/main/java/org/apache/falcon/regression/ui/search/FeedWizardPage.java
deleted file mode 100644
index 3dfab38..0000000
--- a/falcon-regression/merlin/src/main/java/org/apache/falcon/regression/ui/search/FeedWizardPage.java
+++ /dev/null
@@ -1,652 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 org.apache.falcon.regression.ui.search;
-
-import org.apache.falcon.regression.Entities.FeedMerlin;
-import org.apache.falcon.regression.core.util.UIAssert;
-import org.apache.log4j.Logger;
-import org.openqa.selenium.By;
-import org.openqa.selenium.WebDriver;
-import org.openqa.selenium.WebElement;
-import org.openqa.selenium.support.FindBy;
-import org.openqa.selenium.support.FindBys;
-import org.openqa.selenium.support.ui.Select;
-import org.testng.Assert;
-
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.List;
-
-/** Page object of the Feed creation page. */
-public class FeedWizardPage extends EntityWizardPage {
-
- private static final Logger LOGGER = Logger.getLogger(FeedWizardPage.class);
-
- @FindBys({
- @FindBy(className = "mainUIView"),
- @FindBy(className = "feedForm")
- })
- private WebElement feedBox;
-
- @FindBys({
- @FindBy(className = "mainUIView"),
- @FindBy(className = "feedForm"),
- @FindBy(className = "nextBtn")
- })
- private WebElement nextButton;
-
- @FindBys({
- @FindBy(className = "mainUIView"),
- @FindBy(className = "feedForm"),
- @FindBy(className = "prevBtn")
- })
- private WebElement previousButton;
-
- @FindBys({
- @FindBy(xpath = "//button[contains(.,'add tag')]")
- })
- private WebElement addTagButton;
-
- @FindBys({
- @FindBy(xpath = "//button[contains(.,'delete')]")
- })
- private WebElement deleteButton;
-
- @FindBys({
- @FindBy(xpath = "//button[contains(.,'add property')]")
- })
- private WebElement addPropertyButton;
-
- @FindBys({
- @FindBy(xpath = "//button[contains(.,'Catalog Storage')]")
- })
- private WebElement catalogStorageButton;
-
- @FindBys({
- @FindBy(id = "feed.step5")
- })
- private WebElement saveFeedButton;
-
- @FindBy(xpath = "//a[contains(.,'Cancel')]")
- private WebElement cancelButton;
-
- public FeedWizardPage(WebDriver driver) {
- super(driver);
- }
-
- @Override
- public void checkPage() {
- UIAssert.assertDisplayed(feedBox, "Feed box");
- }
-
- private WebElement getFeedName() {
- return feedBox.findElement(By.xpath("//input[@ng-model='feed.name']"));
- }
- private WebElement getFeedDescription() {
- return feedBox.findElement(By.xpath("//input[@ng-model='feed.description']"));
- }
- private WebElement getFeedTagKey(int index) {
- return feedBox.findElements(By.xpath("//input[@ng-model='tag.key']")).get(index);
- }
- private WebElement getFeedTagValue(int index) {
- return feedBox.findElements(By.xpath("//input[@ng-model='tag.value']")).get(index);
- }
- private WebElement getFeedGroups() {
- return feedBox.findElement(By.xpath("//input[@ng-model='feed.groups']"));
- }
- private WebElement getFeedACLOwner() {
- return feedBox.findElement(By.xpath("//input[@ng-model='feed.ACL.owner']"));
- }
- private WebElement getFeedACLGroup() {
- return feedBox.findElement(By.xpath("//input[@ng-model='feed.ACL.group']"));
- }
- private WebElement getFeedACLPermissions() {
- return feedBox.findElement(By.xpath("//input[@ng-model='feed.ACL.permission']"));
- }
- private WebElement getFeedSchemaLocation() {
- return feedBox.findElement(By.xpath("//input[@ng-model='feed.schema.location']"));
- }
- private WebElement getFeedSchemaProvider() {
- return feedBox.findElement(By.xpath("//input[@ng-model='feed.schema.provider']"));
- }
-
- private WebElement getFeedFrequencyQuantity() {
- return feedBox.findElement(By.xpath("//input[@ng-model='feed.frequency.quantity']"));
- }
- private Select getFeedFrequencyUnit() {
- return new Select(feedBox.findElement(By.xpath("//select[@ng-model='feed.frequency.unit']")));
- }
- private WebElement getFeedLateArrivalCheckBox() {
- return feedBox.findElement(By.xpath("//input[@ng-model='feed.lateArrival.active']"));
- }
- private WebElement getFeedLateArrivalCutOffQuantity() {
- return feedBox.findElement(By.xpath("//input[@ng-model='feed.lateArrival.cutOff.quantity']"));
- }
- private Select getFeedLateArrivalCutOffUnit() {
- return new Select(feedBox.findElement(By.xpath("//select[@ng-model='feed.lateArrival.cutOff.unit']")));
- }
- private WebElement getFeedAvailabilityFlag() {
- return feedBox.findElement(By.xpath("//input[@ng-model='feed.availabilityFlag']"));
- }
- private Select getFeedTimeZone() {
- return new Select(feedBox.findElement(By.xpath("//time-zone-select[@ng-model='feed.timezone']/select")));
- }
-
- private WebElement getQueueName() {
- return feedBox.findElement(By.xpath("//label[.='queueName']/following-sibling::div/input"));
- }
-
- private Select getJobPriority() {
- return new Select(feedBox.findElement(By.xpath("//label[.='jobPriority']/following-sibling::div/select")));
- }
-
- private WebElement getTimeoutQuantity() {
- return feedBox.findElement(By.xpath("//label[.='timeout']/following-sibling::div/input"));
- }
-
- private Select getTimeoutUnit() {
- return new Select(feedBox.findElement(By.xpath("//label[.='timeout']/following-sibling::div/select")));
- }
-
- private WebElement getParallel() {
- return feedBox.findElement(By.xpath("//label[.='parallel']/following-sibling::div/input"));
- }
-
- private WebElement getMaxMaps() {
- return feedBox.findElement(By.xpath("//label[.='maxMaps']/following-sibling::div/input"));
- }
-
- private WebElement getMapBandwidthKB() {
- return feedBox.findElement(
- By.xpath("//label[.='mapBandwidthKB']/following-sibling::div/input"));
- }
-
- private WebElement getFeedPropertyKey(int index) {
- return feedBox.findElements(By.xpath("//input[@ng-model='property.key']")).get(index);
- }
- private WebElement getFeedPropertyValue(int index) {
- return feedBox.findElements(By.xpath(
- "//div[@ng-repeat='property in feed.customProperties']/*/input[@ng-model='property.value']")).get(index);
- }
-
- private WebElement getFeedPath(int index) {
- return feedBox.findElements(By.xpath("//input[@ng-model='location.path']")).get(index);
- }
-
- private WebElement getFeedCatalogTableUri() {
- return feedBox.findElement(
- By.xpath("//input[@ng-model='feed.storage.catalog.catalogTable.uri']"));
- }
-
- private Select getFeedClusterSource() {
- return new Select(feedBox.findElement(By.id("clusterNameSelect")));
- }
-
- private WebElement getFeedClusterRetentionLimit() {
- return feedBox.findElement(By.xpath("//input[@ng-model='cluster.retention.quantity']"));
- }
-
- private Select getFeedClusterRetentionUnit() {
- return new Select(feedBox.findElement(By.xpath("//select[@ng-model='cluster.retention.unit']")));
- }
-
- private WebElement getFeedClusterValidityStartDate() {
- return feedBox.findElement(By.xpath("//input[@ng-model='cluster.validity.start.date']"));
- }
-
- private WebElement getFeedClusterValidityHour(int index) {
- return feedBox.findElements(By.xpath("//input[@ng-model='hours']")).get(index);
- }
-
- private WebElement getFeedClusterValidityMinutes(int index) {
- return feedBox.findElements(By.xpath("//input[@ng-model='minutes']")).get(index);
- }
-
- private WebElement getFeedClusterValidityMeridian(int index) {
- return feedBox.findElements(By.xpath("//td[@ng-show='showMeridian']/button")).get(index);
- }
-
- private WebElement getFeedClusterValidityEndDate() {
- return feedBox.findElement(By.xpath("//input[@ng-model='cluster.validity.end.date']"));
- }
-
- public List<String> getFeedFrequencyUnitValues(){
- return getDropdownValues(getFeedFrequencyUnit());
- }
-
- public List<String> getFeedLateArrivalCutOffUnitValues(){
- return getDropdownValues(getFeedLateArrivalCutOffUnit());
- }
-
- public List<String> getFeedClusterSourceValues(){
- return getDropdownValues(getFeedClusterSource());
- }
-
- public List<String> getFeedClusterRetentionUnitValues(){
- return getDropdownValues(getFeedClusterRetentionUnit());
- }
-
- public List<String> getJobPriorityValues(){
- return getDropdownValues(getJobPriority());
- }
-
- public List<String> getTimeoutUnitValues(){
- return getDropdownValues(getTimeoutUnit());
- }
-
- public void isFeedFrequencyDisplayed(boolean isDisplayed) {
- if (isDisplayed){
- UIAssert.assertDisplayed(getFeedFrequencyQuantity(), "Frequency Quantity");
- }else {
- try{
- getFeedFrequencyQuantity();
- Assert.fail("Frequency Quantity found");
- } catch (Exception ex){
- LOGGER.info("Frequency Quantity not found");
- }
- }
- }
-
- public void isFeedDataPathDisplayed(boolean isDisplayed) {
- if (isDisplayed){
- UIAssert.assertDisplayed(getFeedPath(0), "Feed Data Path");
- }else {
- try{
- getFeedPath(0);
- Assert.fail("Feed Data Path found");
- } catch (Exception ex){
- LOGGER.info("Feed Data Path not found");
- }
- }
- }
-
- public void isFeedClusterRetentionDisplayed(boolean isDisplayed) {
- if (isDisplayed){
- UIAssert.assertDisplayed(getFeedClusterRetentionLimit(), "Cluster Retention Limit");
- }else {
- try{
- getFeedClusterRetentionLimit();
- Assert.fail("Cluster Retention Limit found");
- } catch (Exception ex){
- LOGGER.info("Cluster Retention Limit not found");
- }
- }
- }
-
- public void isSaveFeedButtonDisplayed(boolean isDisplayed) {
- if (isDisplayed){
- UIAssert.assertDisplayed(saveFeedButton, "Save Button");
- }else {
- try{
- getSaveFeedButton();
- Assert.fail("Save Button found");
- } catch (Exception ex){
- LOGGER.info("Save Button not found");
- }
- }
- }
-
- private WebElement getSaveFeedButton(){
- return saveFeedButton;
- }
-
- public void clickNext(){
- nextButton.click();
- waitForAngularToFinish();
- }
-
- public void clickPrevious(){
- previousButton.click();
- }
-
- public void clickCancel(){
- cancelButton.click();
- }
-
- public void clickCatalogStorageButton(){
- catalogStorageButton.click();
- waitForAngularToFinish();
- }
-
- public void setFeedName(String name){
- sendKeysSlowly(getFeedName(), name);
- }
- public void setFeedDescription(String description){
- getFeedDescription().sendKeys(description);
- }
- public void setFeedTagKey(int index, String tagKey){
- getFeedTagKey(index).sendKeys(tagKey);
- }
- public void setFeedTagValue(int index, String tagValue){
- getFeedTagValue(index).sendKeys(tagValue);
- }
-
- // Tags are in the format, "first=yes","second=yes","third=yes". Need a separate method to handle this
- public void setFeedTags(String tagsStr){
- if (tagsStr == null){
- return;
- }
- String[] tags = tagsStr.split(",");
- for (int i=0; i < tags.length; i++){
- String[] keyValue = tags[i].split("=");
- setFeedTagKey(i, keyValue[0]);
- setFeedTagValue(i, keyValue[1]);
- if (tags.length > i+1){
- addTagButton.click();
- }
- }
- }
-
- public void isTagsDisplayed(int index, boolean isDisplayed){
- if (isDisplayed){
- UIAssert.assertDisplayed(getFeedTagKey(index), "Tag Key Index - " + index);
- UIAssert.assertDisplayed(getFeedTagValue(index), "Tag Value Index - " + index);
- }else{
- try{
- getFeedTagKey(index);
- Assert.fail("Tag Key Index - " + index + " found");
- } catch (Exception ex){
- LOGGER.info("Tag Key Index - " + index + " not found");
- }
- try{
- getFeedTagValue(index);
- Assert.fail("Tag Key Value - " + index + " found");
- } catch (Exception ex){
- LOGGER.info("Tag Key Value - " + index + " not found");
- }
- }
- }
-
- public String getFeedTagKeyText(int index){
- return getFeedTagKey(index).getAttribute("value");
- }
-
- public String getFeedTagValueText(int index){
- return getFeedTagValue(index).getAttribute("value");
- }
-
- public String getFeedGroupsText(){
- return getFeedGroups().getAttribute("value");
- }
-
- public String getFeedFrequencyQuantityText(){
- return getFeedFrequencyQuantity().getAttribute("value");
- }
-
- public String getFeedLateArrivalCutOffQuantityText(){
- return getFeedLateArrivalCutOffQuantity().getAttribute("value");
- }
-
- public String getFeedPathText(int index){
- return getFeedPath(index).getAttribute("value");
- }
-
- public String getFeedClusterRetentionLimitText(){
- return getFeedClusterRetentionLimit().getAttribute("value");
- }
-
- public String getFeedClusterRetentionUnitText(){
- return getFeedClusterRetentionUnit().getFirstSelectedOption().getText();
- }
-
- public void addProperty(){
- waitForAngularToFinish();
- addPropertyButton.click();
- }
-
- public void isPropertyDisplayed(int index, boolean isDisplayed){
- if (isDisplayed){
- UIAssert.assertDisplayed(getFeedPropertyKey(index), "Property Key Index - " + index);
- UIAssert.assertDisplayed(getFeedPropertyValue(index), "Property Value Index - " + index);
- }else{
- try{
- getFeedTagKey(index);
- Assert.fail("Property Key Index - " + index + " found");
- } catch (Exception ex){
- LOGGER.info("Property Key Index - " + index + " not found");
- }
- try{
- getFeedTagValue(index);
- Assert.fail("Property Key Value - " + index + " found");
- } catch (Exception ex){
- LOGGER.info("Property Key Value - " + index + " not found");
- }
- }
- }
-
-
- public void deleteTagOrProperty(){
- deleteButton.click();
- }
-
- public void setFeedGroups(String feedGroups){
- getFeedGroups().sendKeys(feedGroups);
- }
-
- public void setFeedACLOwner(String feedACLOwner){
- getFeedACLOwner().clear();
- getFeedACLOwner().sendKeys(feedACLOwner);
- }
- public void setFeedACLGroup(String feedACLGroup){
- getFeedACLGroup().clear();
- getFeedACLGroup().sendKeys(feedACLGroup);
- }
- public void setFeedACLPermissions(String feedACLPermissions){
- getFeedACLPermissions().clear();
- getFeedACLPermissions().sendKeys(feedACLPermissions);
- }
- public void setFeedSchemaLocation(String feedSchemaLocation){
- sendKeysSlowly(getFeedSchemaLocation(), feedSchemaLocation);
- }
- public void setFeedSchemaProvider(String feedSchemaProvider){
- sendKeysSlowly(getFeedSchemaProvider(), feedSchemaProvider);
- }
-
- public void setFeedFrequencyQuantity(String frequencyQuantity){
- getFeedFrequencyQuantity().sendKeys(frequencyQuantity);
- }
- public void setFeedFrequencyUnit(String frequencyUnit){
- getFeedFrequencyUnit().selectByVisibleText(frequencyUnit);
- }
-
- public void setFeedLateArrivalCheckBox(){
- getFeedLateArrivalCheckBox().click();
- }
- public void setFeedLateArrivalCutOffQuantity(int lateArrivalCutOffQuantity){
- getFeedLateArrivalCutOffQuantity().sendKeys(Integer.toString(lateArrivalCutOffQuantity));
- }
- public void setFeedLateArrivalCutOffUnit(String lateArrivalCutOffUnit){
- getFeedLateArrivalCutOffUnit().selectByVisibleText(lateArrivalCutOffUnit);
- }
- public void setFeedAvailabilityFlag(String availabilityFlag){
- getFeedAvailabilityFlag().sendKeys(availabilityFlag);
- }
- public void setFeedTimeZone(){
- String timeZone = "GMT+00:00";
- getFeedTimeZone().selectByValue(timeZone);
- }
- public void setQueueName(String queueName){
- getQueueName().clear();
- getQueueName().sendKeys(queueName);
- }
- public void setJobPriority(String jobPriority) {
- getJobPriority().selectByVisibleText(jobPriority);
- }
- public void setTimeoutQuantity(String timeoutQuantity){
- getTimeoutQuantity().clear();
- getTimeoutQuantity().sendKeys(timeoutQuantity);
- }
- public void setTimeoutUnit(String timeoutUnit) {
- getTimeoutUnit().selectByVisibleText(timeoutUnit);
- }
- public void setParallel(String parallel){
- getParallel().clear();
- getParallel().sendKeys(parallel);
- }
- public void setMaxMaps(String maxMaps){
- getMaxMaps().clear();
- getMaxMaps().sendKeys(maxMaps);
- }
- public void setMapBandwidthKB(String mapBandwidthKB){
- getMapBandwidthKB().clear();
- getMapBandwidthKB().sendKeys(mapBandwidthKB);
- }
- public void setFeedPropertyKey(int index, String propertyKey){
- getFeedPropertyKey(index).sendKeys(propertyKey);
- }
- public void setFeedPropertyValue(int index, String propertyValue){
- getFeedPropertyValue(index).sendKeys(propertyValue);
- }
-
- public void setFeedPath(int index, String path){
- getFeedPath(index).clear();
- getFeedPath(index).sendKeys(path);
- }
-
- public void setFeedCatalogTableUri(String catalogTableUri){
- getFeedCatalogTableUri().sendKeys(catalogTableUri);
- }
-
- public void setFeedClusterSource(String clusterSource){
- getFeedClusterSource().selectByVisibleText(clusterSource);
- }
-
- public void setFeedClusterRetentionLimit(String clusterRetentionLimit){
- getFeedClusterRetentionLimit().clear();
- sendKeysSlowly(getFeedClusterRetentionLimit(), clusterRetentionLimit);
- }
-
- public void setFeedClusterRetentionUnit(String clusterRetentionUnit){
- getFeedClusterRetentionUnit().selectByVisibleText(clusterRetentionUnit);
- }
-
- public void setFeedClusterValidityStartDate(String clusterValidityStartDate){
- getFeedClusterValidityStartDate().clear();
- sendKeysSlowly(getFeedClusterValidityStartDate(), clusterValidityStartDate);
- }
- public void setFeedClusterValidityHour(int index, String clusterValidityHour){
- getFeedClusterValidityHour(index).clear();
- getFeedClusterValidityHour(index).sendKeys(clusterValidityHour);
- }
- public void setFeedClusterValidityMinutes(int index, String clusterValidityMinutes){
- getFeedClusterValidityMinutes(index).clear();
- getFeedClusterValidityMinutes(index).sendKeys(clusterValidityMinutes);
- }
- public void setFeedClusterValidityMeridian(int index, String clusterValidityMeridian){
- // Toggle AM PM, if clusterValidityMeridian value is not equal to AM PM Button text
- if (!clusterValidityMeridian.equalsIgnoreCase(getFeedClusterValidityMeridian(index).getText())){
- getFeedClusterValidityMeridian(index).click();
- }
- }
- public void setFeedClusterValidityEndDate(String clusterValidityEndDate){
- getFeedClusterValidityEndDate().clear();
- sendKeysSlowly(getFeedClusterValidityEndDate(), clusterValidityEndDate);
- }
-
- // Enter feed info on Page 1 of FeedSetup Wizard
- public void setFeedGeneralInfo(FeedMerlin feed) {
- setFeedName(feed.getName());
- setFeedDescription(feed.getDescription());
- setFeedTags(feed.getTags());
- setFeedGroups(feed.getGroups());
- setFeedACLOwner(feed.getACL().getOwner());
- setFeedACLGroup(feed.getACL().getGroup());
- setFeedACLPermissions(feed.getACL().getPermission());
- setFeedSchemaLocation(feed.getSchema().getLocation());
- setFeedSchemaProvider(feed.getSchema().getProvider());
- waitForAngularToFinish();
- }
-
- // Enter feed info on Page 2 of FeedSetup Wizard
- public void setFeedPropertiesInfo(FeedMerlin feed){
- setFeedFrequencyQuantity(feed.getFrequency().getFrequency());
- setFeedFrequencyUnit(feed.getFrequency().getTimeUnit().toString());
- setFeedLateArrivalCheckBox();
- setFeedLateArrivalCutOffQuantity(feed.getLateArrival().getCutOff().getFrequencyAsInt());
- setFeedLateArrivalCutOffUnit(feed.getLateArrival().getCutOff().getTimeUnit().toString());
- setFeedAvailabilityFlag(feed.getAvailabilityFlag());
- setFeedTimeZone();
- setFeedPropertyKey(0, feed.getProperties().getProperties().get(0).getName());
- setFeedPropertyValue(0, feed.getProperties().getProperties().get(0).getValue());
- addProperty();
- waitForAngularToFinish();
- setFeedPropertyKey(1, feed.getProperties().getProperties().get(1).getName());
- setFeedPropertyValue(1, feed.getProperties().getProperties().get(1).getValue());
- waitForAngularToFinish();
- }
-
- // Enter feed info on Page 3 of FeedSetup Wizard
- public void setFeedLocationInfo(FeedMerlin feed){
- setFeedPath(0, feed.getLocations().getLocations().get(0).getPath());
- setFeedPath(1, feed.getLocations().getLocations().get(1).getPath());
- setFeedPath(2, feed.getLocations().getLocations().get(2).getPath());
- waitForAngularToFinish();
- }
-
- // Enter feed info on Page 4 of FeedSetup Wizard
- public void setFeedClustersInfo(FeedMerlin feed){
- setFeedClusterSource(feed.getClusters().getClusters().get(0).getName());
- setFeedLocationInfo(feed);
- Date startDate = feed.getClusters().getClusters().get(0).getValidity().getStart();
- Date endDate = feed.getClusters().getClusters().get(0).getValidity().getEnd();
- setFeedClusterValidityStartDate(new SimpleDateFormat("MM/dd/yyyy").format(startDate));
- setFeedClusterValidityHour(0, new SimpleDateFormat("h").format(startDate));
- setFeedClusterValidityMinutes(0, new SimpleDateFormat("m").format(startDate));
- setFeedClusterValidityMeridian(0, new SimpleDateFormat("a").format(startDate));
- setFeedClusterValidityEndDate(new SimpleDateFormat("MM/dd/yyyy").format(endDate));
- setFeedClusterValidityHour(1, new SimpleDateFormat("h").format(endDate));
- setFeedClusterValidityMinutes(1, new SimpleDateFormat("m").format(endDate));
- setFeedClusterValidityMeridian(1, new SimpleDateFormat("a").format(endDate));
- /*
- The merlin feed has 9000 months.
- The UI only support till two digits.
- Need to send hardcoded value of 99,
- instead of feed.getClusters().getClusters().get(0).getRetention().getLimit().getFrequency()
- */
- setFeedClusterRetentionLimit("99");
- setFeedClusterRetentionUnit(feed.getClusters().getClusters().get(0)
- .getRetention().getLimit().getTimeUnit().name());
- waitForAngularToFinish();
- }
-
- // setFeed method runs the default feed setup wizard, entering data on each page
- public void setFeed(FeedMerlin feed){
- setFeedGeneralInfo(feed);
- clickNext();
- setFeedPropertiesInfo(feed);
- clickNext();
- setFeedLocationInfo(feed);
- clickNext();
- setFeedClustersInfo(feed);
- clickNext();
- saveFeedButton.click();
- waitForAlert();
- }
-
- @Override
- public FeedMerlin getEntityFromXMLPreview() {
- return FeedMerlin.fromString(getXMLPreview());
- }
-
- @Override
- public WebElement getEditXMLButton() {
- return driver.findElement(By.id("feed.editXML"));
- }
-
-}