falcon-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rag...@apache.org
Subject falcon git commit: FALCON-1187: Test that changes made via API are reflected on UI contributed by Ruslan Ostafiychuk
Date Tue, 05 May 2015 23:02:54 GMT
Repository: falcon
Updated Branches:
  refs/heads/master bbd01241c -> 844dab219


FALCON-1187: Test that changes made via API are reflected on UI contributed by Ruslan Ostafiychuk


Project: http://git-wip-us.apache.org/repos/asf/falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/falcon/commit/844dab21
Tree: http://git-wip-us.apache.org/repos/asf/falcon/tree/844dab21
Diff: http://git-wip-us.apache.org/repos/asf/falcon/diff/844dab21

Branch: refs/heads/master
Commit: 844dab219f691ddaa1d657a475f6f208cba6c3bd
Parents: bbd0124
Author: Raghav Kumar Gautam <raghav@apache.org>
Authored: Tue May 5 16:02:44 2015 -0700
Committer: Raghav Kumar Gautam <raghav@apache.org>
Committed: Tue May 5 16:02:44 2015 -0700

----------------------------------------------------------------------
 falcon-regression/CHANGES.txt                   |   3 +
 .../regression/ui/pages/EntitiesPage.java       |   6 -
 .../apache/falcon/regression/ui/pages/Page.java |   7 ++
 .../falcon/regression/ui/search/SearchPage.java |   9 +-
 .../searchUI/EntitiesTableReflectionTest.java   | 115 +++++++++++++++++++
 .../falcon/regression/ui/ProcessUITest.java     |   5 +-
 6 files changed, 133 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/falcon/blob/844dab21/falcon-regression/CHANGES.txt
----------------------------------------------------------------------
diff --git a/falcon-regression/CHANGES.txt b/falcon-regression/CHANGES.txt
index cfae2f8..870187b 100644
--- a/falcon-regression/CHANGES.txt
+++ b/falcon-regression/CHANGES.txt
@@ -5,6 +5,9 @@ Trunk (Unreleased)
   INCOMPATIBLE CHANGES
 
   NEW FEATURES
+   FALCON-1187 Test that changes made via API are reflected on UI (Ruslan Ostafiychuk
+   via Raghav Kumar Gautam)
+
    FALCON-1173 Tests for entities table of search-ui (Ruslan Ostafiychuk)
 
    FALCON-1171 Adding search API tests (Paul Isaychuk via Raghav Kumar Gautam)

http://git-wip-us.apache.org/repos/asf/falcon/blob/844dab21/falcon-regression/merlin/src/main/java/org/apache/falcon/regression/ui/pages/EntitiesPage.java
----------------------------------------------------------------------
diff --git a/falcon-regression/merlin/src/main/java/org/apache/falcon/regression/ui/pages/EntitiesPage.java
b/falcon-regression/merlin/src/main/java/org/apache/falcon/regression/ui/pages/EntitiesPage.java
index b4f3f38..16ff525 100644
--- a/falcon-regression/merlin/src/main/java/org/apache/falcon/regression/ui/pages/EntitiesPage.java
+++ b/falcon-regression/merlin/src/main/java/org/apache/falcon/regression/ui/pages/EntitiesPage.java
@@ -119,10 +119,4 @@ public class EntitiesPage extends Page {
         return entities;
     }
 
-    /**
-     * Status of entity that can be shown on Falcon UI.
-     */
-    public enum EntityStatus {
-        UNKNOWN, SUBMITTED, RUNNING, SUSPENDED
-    }
 }

http://git-wip-us.apache.org/repos/asf/falcon/blob/844dab21/falcon-regression/merlin/src/main/java/org/apache/falcon/regression/ui/pages/Page.java
----------------------------------------------------------------------
diff --git a/falcon-regression/merlin/src/main/java/org/apache/falcon/regression/ui/pages/Page.java
b/falcon-regression/merlin/src/main/java/org/apache/falcon/regression/ui/pages/Page.java
index 5319b6d..f176949 100644
--- a/falcon-regression/merlin/src/main/java/org/apache/falcon/regression/ui/pages/Page.java
+++ b/falcon-regression/merlin/src/main/java/org/apache/falcon/regression/ui/pages/Page.java
@@ -130,6 +130,13 @@ public abstract class Page {
         }
     }
 
+    /**
+     * Status of entity that can be shown on Falcon UI.
+     */
+    public enum EntityStatus {
+        UNKNOWN, SUBMITTED, RUNNING, SUSPENDED
+    }
+
     static class Condition implements ExpectedCondition<Boolean> {
 
         private final boolean isPresent;

http://git-wip-us.apache.org/repos/asf/falcon/blob/844dab21/falcon-regression/merlin/src/main/java/org/apache/falcon/regression/ui/search/SearchPage.java
----------------------------------------------------------------------
diff --git a/falcon-regression/merlin/src/main/java/org/apache/falcon/regression/ui/search/SearchPage.java
b/falcon-regression/merlin/src/main/java/org/apache/falcon/regression/ui/search/SearchPage.java
index 5d3febf..9ad2591 100644
--- a/falcon-regression/merlin/src/main/java/org/apache/falcon/regression/ui/search/SearchPage.java
+++ b/falcon-regression/merlin/src/main/java/org/apache/falcon/regression/ui/search/SearchPage.java
@@ -129,7 +129,8 @@ public class SearchPage extends AbstractSearchPage {
     }
 
     private String getActiveAlertText() {
-        List<WebElement> alerts = driver.findElements(By.className("ng-animate"));
+        WebElement alertsBlock = driver.findElement(By.className("messages-to-show"));
+        List<WebElement> alerts = alertsBlock.findElements(By.className("ng-animate"));
         if (!alerts.isEmpty()) {
             WebElement last = alerts.get(alerts.size() - 1);
             if (last.isDisplayed()) {
@@ -260,7 +261,7 @@ public class SearchPage extends AbstractSearchPage {
         private String tags = "";
         private String clusterName;
         private String type;
-        private String status;
+        private EntityStatus status;
 
         public static SearchResult create(String entityName) {
             return new SearchResult(entityName);
@@ -291,7 +292,7 @@ public class SearchPage extends AbstractSearchPage {
         }
 
         public SearchResult withStatus(String pStatus) {
-            this.status = pStatus;
+            this.status = EntityStatus.valueOf(pStatus);
             return this;
         }
 
@@ -315,7 +316,7 @@ public class SearchPage extends AbstractSearchPage {
             return type;
         }
 
-        public String getStatus() {
+        public EntityStatus getStatus() {
             return status;
         }
     }

http://git-wip-us.apache.org/repos/asf/falcon/blob/844dab21/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/searchUI/EntitiesTableReflectionTest.java
----------------------------------------------------------------------
diff --git a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/searchUI/EntitiesTableReflectionTest.java
b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/searchUI/EntitiesTableReflectionTest.java
new file mode 100644
index 0000000..8d64a0e
--- /dev/null
+++ b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/searchUI/EntitiesTableReflectionTest.java
@@ -0,0 +1,115 @@
+/**
+ * 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.searchUI;
+
+import org.apache.falcon.regression.core.bundle.Bundle;
+import org.apache.falcon.regression.core.util.AssertUtil;
+import org.apache.falcon.regression.core.util.BundleUtil;
+import org.apache.falcon.regression.core.util.OSUtil;
+import org.apache.falcon.regression.core.util.Util;
+import org.apache.falcon.regression.testHelper.BaseUITestClass;
+import org.apache.falcon.regression.ui.pages.Page.EntityStatus;
+import org.apache.falcon.regression.ui.search.LoginPage;
+import org.apache.falcon.regression.ui.search.SearchPage;
+import org.apache.hadoop.security.authentication.client.AuthenticationException;
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import javax.xml.bind.JAXBException;
+import java.io.IOException;
+import java.net.URISyntaxException;
+
+/** UI tests for entities table with search results. */
+@Test(groups = "search-ui")
+public class EntitiesTableReflectionTest extends BaseUITestClass {
+    private String baseTestDir = cleanAndGetTestDir();
+    private String aggregateWorkflowDir = baseTestDir + "/aggregator";
+
+    private SearchPage searchPage = null;
+
+    @BeforeClass(alwaysRun = true)
+    public void setup()
+        throws URISyntaxException, IOException, AuthenticationException, InterruptedException,
+        JAXBException {
+        uploadDirToClusters(aggregateWorkflowDir, OSUtil.RESOURCES_OOZIE);
+        openBrowser();
+        searchPage = LoginPage.open(getDriver()).doDefaultLogin();
+        bundles[0] = BundleUtil.readELBundle();
+        bundles[0] = new Bundle(bundles[0], servers.get(0));
+        bundles[0].generateUniqueBundle(this);
+        bundles[0].setProcessWorkflow(aggregateWorkflowDir);
+        bundles[0].submitBundle(prism);
+
+    }
+
+    @Test
+    public void testUIStatusChangedViaAPI() throws URISyntaxException,
+        AuthenticationException, InterruptedException, IOException, JAXBException {
+        String processName = bundles[0].getProcessName();
+        Assert.assertEquals(searchPage.doSearch(processName).size(), 1,
+            "One result should be present");
+        Assert.assertEquals(searchPage.doSearch(processName).get(0).getStatus(),
+            EntityStatus.SUBMITTED, "Status of process should be SUBMITTED");
+
+        AssertUtil.assertSucceeded(
+            prism.getProcessHelper().schedule(bundles[0].getProcessData()));
+        Assert.assertEquals(searchPage.doSearch(processName).get(0).getStatus(),
+            EntityStatus.RUNNING, "Status of process should be RUNNING");
+
+        AssertUtil.assertSucceeded(
+            prism.getProcessHelper().suspend(bundles[0].getProcessData()));
+        Assert.assertEquals(searchPage.doSearch(processName).get(0).getStatus(),
+            EntityStatus.SUSPENDED, "Status of process should be SUSPENDED");
+
+        AssertUtil.assertSucceeded(
+            prism.getProcessHelper().resume(bundles[0].getProcessData()));
+        Assert.assertEquals(searchPage.doSearch(processName).get(0).getStatus(),
+            EntityStatus.RUNNING, "Status of process should be RUNNING");
+
+        AssertUtil.assertSucceeded(
+            prism.getProcessHelper().delete(bundles[0].getProcessData()));
+        Assert.assertEquals(searchPage.doSearch(processName).size(), 0,
+            "Zero results should be present after deletion");
+
+        AssertUtil.assertSucceeded(
+            prism.getProcessHelper().submitAndSchedule(bundles[0].getProcessData()));
+        Assert.assertEquals(searchPage.doSearch(processName).get(0).getStatus(),
+            EntityStatus.RUNNING, "Status of rescheduled process should be RUNNING");
+    }
+
+    @Test
+    public void testActionsPauseResume() throws URISyntaxException,
+        AuthenticationException, InterruptedException, IOException, JAXBException {
+        String processName = Util.readEntityName(bundles[0].getProcessData());
+        Assert.assertEquals(searchPage.doSearch(processName).size(), 1,
+            "One result should be present");
+        Assert.assertEquals(searchPage.doSearch(processName).get(0).getStatus(),
+            EntityStatus.SUBMITTED, "Status of process should be SUBMITTED");
+    }
+
+
+    @AfterClass(alwaysRun = true)
+    public void tearDown() {
+        removeTestClassEntities();
+        closeBrowser();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/falcon/blob/844dab21/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/ui/ProcessUITest.java
----------------------------------------------------------------------
diff --git a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/ui/ProcessUITest.java
b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/ui/ProcessUITest.java
index 8e81dcd..12b87f5 100644
--- a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/ui/ProcessUITest.java
+++ b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/ui/ProcessUITest.java
@@ -38,6 +38,7 @@ import org.apache.falcon.regression.core.util.Util;
 import org.apache.falcon.regression.lineage.LineageApiTest;
 import org.apache.falcon.regression.testHelper.BaseUITestClass;
 import org.apache.falcon.regression.ui.pages.EntitiesPage;
+import org.apache.falcon.regression.ui.pages.Page;
 import org.apache.falcon.regression.ui.pages.ProcessPage;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.security.authentication.client.AuthenticationException;
@@ -180,14 +181,14 @@ public class ProcessUITest extends BaseUITestClass {
         String process = bundles[0].getProcessData();
         String processName = Util.readEntityName(process);
         softAssert.assertEquals(page.getEntityStatus(processName),
-                EntitiesPage.EntityStatus.SUBMITTED, "Process status should be SUBMITTED");
+                Page.EntityStatus.SUBMITTED, "Process status should be SUBMITTED");
         prism.getProcessHelper().schedule(process);
 
         InstanceUtil.waitTillInstanceReachState(clusterOC, processName, 1,
             CoordinatorAction.Status.RUNNING, EntityType.PROCESS);
 
         softAssert.assertEquals(page.getEntityStatus(processName),
-                EntitiesPage.EntityStatus.RUNNING, "Process status should be RUNNING");
+                Page.EntityStatus.RUNNING, "Process status should be RUNNING");
 
         ProcessPage processPage = new ProcessPage(getDriver(), cluster, processName);
         processPage.navigateTo();


Mime
View raw message