You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@falcon.apache.org by ve...@apache.org on 2014/09/16 20:13:54 UTC

git commit: FALCON-724 Build fails as Integration test fails. Contributed by Balu Vellanki

Repository: incubator-falcon
Updated Branches:
  refs/heads/master d999cf27b -> 96d5da9e4


FALCON-724 Build fails as Integration test fails. Contributed by Balu Vellanki


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

Branch: refs/heads/master
Commit: 96d5da9e4535812b0657cdecc817b53ef570e004
Parents: d999cf2
Author: Venkatesh Seetharam <ve...@apache.org>
Authored: Tue Sep 16 10:14:14 2014 -0700
Committer: Venkatesh Seetharam <ve...@apache.org>
Committed: Tue Sep 16 10:14:14 2014 -0700

----------------------------------------------------------------------
 CHANGES.txt                                     |   3 +
 .../falcon/resource/EntityManagerJerseyIT.java  |  60 ---------
 .../EntityManagerPaginationJerseyIT.java        | 128 +++++++++++++++++++
 3 files changed, 131 insertions(+), 60 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/96d5da9e/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 6f7dad7..5f638a6 100755
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -89,6 +89,9 @@ Trunk (Unreleased)
   OPTIMIZATIONS
 
   BUG FIXES
+   FALCON-724 Build fails as Integration test fails (Balu Vellanki via
+   Venkatesh Seetharam)
+
    FALCON-728 Unit test failures on jenkins (Sowmya Ramesh via Venkatesh Seetharam)
 
    FALCON-727 JQuery license is incorrectly mentioned in the header file. (Srikanth Sundarrajan)

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/96d5da9e/webapp/src/test/java/org/apache/falcon/resource/EntityManagerJerseyIT.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/falcon/resource/EntityManagerJerseyIT.java b/webapp/src/test/java/org/apache/falcon/resource/EntityManagerJerseyIT.java
index cfcc14f..f33a002 100644
--- a/webapp/src/test/java/org/apache/falcon/resource/EntityManagerJerseyIT.java
+++ b/webapp/src/test/java/org/apache/falcon/resource/EntityManagerJerseyIT.java
@@ -746,39 +746,6 @@ public class EntityManagerJerseyIT {
         }
 
         response = context.service
-                .path("api/entities/list/process/")
-                .queryParam("filterBy", "TYPE:PROCESS,STATUS:RUNNING")
-                .queryParam("tags", "owner=producer@xyz.com, department=forecasting")
-                .queryParam("orderBy", "name").queryParam("sortOrder", "desc").queryParam("offset", "2")
-                .queryParam("numResults", "2").queryParam("fields", "status,tags")
-                .header("Cookie", context.getAuthenticationToken())
-                .type(MediaType.TEXT_XML)
-                .accept(MediaType.TEXT_XML)
-                .get(ClientResponse.class);
-        Assert.assertEquals(response.getStatus(), 200);
-        result = response.getEntity(EntityList.class);
-        Assert.assertNotNull(result);
-        Assert.assertEquals(result.getElements().length, 2);
-
-        response = context.service
-                .path("api/entities/list/process/")
-                .queryParam("orderBy", "name").queryParam("sortOrder", "asc")
-                .queryParam("offset", "50").queryParam("numResults", "2")
-                .header("Cookie", context.getAuthenticationToken())
-                .type(MediaType.TEXT_XML)
-                .accept(MediaType.TEXT_XML)
-                .get(ClientResponse.class);
-        Assert.assertEquals(response.getStatus(), 200);
-        result = response.getEntity(EntityList.class);
-        Assert.assertNotNull(result);
-        Assert.assertEquals(result.getElements(), null);
-
-        Map<String, String> overlay = context.getUniqueOverlay();
-        overlay.put("cluster", "WTF-" + overlay.get("cluster"));
-        response = context.submitToFalcon(TestContext.CLUSTER_TEMPLATE, overlay, EntityType.CLUSTER);
-        context.assertSuccessful(response);
-
-        response = context.service
                 .path("api/entities/list/cluster/")
                 .header("Cookie", context.getAuthenticationToken())
                 .type(MediaType.TEXT_XML)
@@ -790,33 +757,6 @@ public class EntityManagerJerseyIT {
         for (EntityList.EntityElement entityElement : result.getElements()) {
             Assert.assertNull(entityElement.status); // status is null
         }
-
-        response = context.service
-                .path("api/entities/list/cluster/")
-                .queryParam("fields", "status")
-                .header("Cookie", context.getAuthenticationToken())
-                .type(MediaType.APPLICATION_JSON)
-                .accept(MediaType.APPLICATION_JSON)
-                .get(ClientResponse.class);
-        Assert.assertEquals(response.getStatus(), 200);
-        result = response.getEntity(EntityList.class);
-        Assert.assertNotNull(result);
-        for (EntityList.EntityElement entityElement : result.getElements()) {
-            Assert.assertNotNull(entityElement.status); // status is null
-        }
-
-        response = context.service
-                .path("api/entities/summary/process/" + overlay.get("cluster"))
-                .queryParam("fields", "status,pipelines")
-                .queryParam("numInstances", "1")
-                .queryParam("orderBy", "name")
-                .header("Cookie", context.getAuthenticationToken())
-                .type(MediaType.APPLICATION_JSON)
-                .accept(MediaType.APPLICATION_JSON)
-                .get(ClientResponse.class);
-        Assert.assertEquals(response.getStatus(), 200);
-        EntitySummaryResult summaryResult = response.getEntity(EntitySummaryResult.class);
-        Assert.assertNotNull(summaryResult);
     }
 
     public Date getEndTime() {

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/96d5da9e/webapp/src/test/java/org/apache/falcon/resource/EntityManagerPaginationJerseyIT.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/falcon/resource/EntityManagerPaginationJerseyIT.java b/webapp/src/test/java/org/apache/falcon/resource/EntityManagerPaginationJerseyIT.java
new file mode 100644
index 0000000..bd68e57
--- /dev/null
+++ b/webapp/src/test/java/org/apache/falcon/resource/EntityManagerPaginationJerseyIT.java
@@ -0,0 +1,128 @@
+/**
+ * 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.resource;
+
+import com.sun.jersey.api.client.ClientResponse;
+import org.apache.falcon.util.OozieTestUtils;
+import org.testng.Assert;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import javax.ws.rs.core.MediaType;
+import java.util.Map;
+
+/**
+ * Test class for Entity LIST pagination REST APIs.
+ */
+public class EntityManagerPaginationJerseyIT {
+
+    private TestContext context;
+
+    @BeforeClass
+    public void prepare() throws Exception {
+        TestContext.prepare();
+        context = new TestContext();
+        scheduleMultipleProcess(5);
+    }
+
+    @AfterMethod
+    public void cleanup() throws Exception {
+        OozieTestUtils.killOozieJobs(context);
+    }
+
+    @Test
+    public void testGetEntityList() throws Exception {
+        ClientResponse response = context.service
+                .path("api/entities/list/process/")
+                .header("Cookie", context.getAuthenticationToken())
+                .type(MediaType.TEXT_XML)
+                .accept(MediaType.TEXT_XML)
+                .get(ClientResponse.class);
+        Assert.assertEquals(response.getStatus(), 200);
+        EntityList result = response.getEntity(EntityList.class);
+        Assert.assertNotNull(result);
+        for (EntityList.EntityElement entityElement : result.getElements()) {
+            Assert.assertNull(entityElement.status); // status is null
+            Assert.assertNotNull(entityElement.name);
+        }
+    }
+
+    @Test
+    public void testPagination() {
+        ClientResponse response = context.service
+                .path("api/entities/list/process/")
+                .queryParam("filterBy", "TYPE:PROCESS,STATUS:RUNNING")
+                .queryParam("tags", "owner=producer@xyz.com, department=forecasting")
+                .queryParam("orderBy", "name").queryParam("sortOrder", "desc").queryParam("offset", "2")
+                .queryParam("numResults", "2").queryParam("fields", "status,tags")
+                .header("Cookie", context.getAuthenticationToken())
+                .type(MediaType.TEXT_XML)
+                .accept(MediaType.TEXT_XML)
+                .get(ClientResponse.class);
+        Assert.assertEquals(response.getStatus(), 200);
+        EntityList result = response.getEntity(EntityList.class);
+        Assert.assertNotNull(result);
+        Assert.assertEquals(result.getElements().length, 2);
+    }
+
+    @Test
+    public void testPaginationHugeOffset() throws Exception {
+        ClientResponse response = context.service
+                .path("api/entities/list/process/")
+                .queryParam("orderBy", "name").queryParam("sortOrder", "asc")
+                .queryParam("offset", "50").queryParam("numResults", "2")
+                .header("Cookie", context.getAuthenticationToken())
+                .type(MediaType.TEXT_XML)
+                .accept(MediaType.TEXT_XML)
+                .get(ClientResponse.class);
+        Assert.assertEquals(response.getStatus(), 200);
+        EntityList result = response.getEntity(EntityList.class);
+        Assert.assertNotNull(result);
+        Assert.assertEquals(result.getElements(), null);
+    }
+
+    @Test
+    public void testPaginationEntitySummary() throws Exception {
+        Map<String, String> overlay = context.getUniqueOverlay();
+        context.scheduleProcess(TestContext.PROCESS_TEMPLATE, overlay);
+        OozieTestUtils.waitForProcessWFtoStart(context);
+
+        ClientResponse response = context.service
+                .path("api/entities/summary/process/" + overlay.get("cluster"))
+                .queryParam("fields", "status,pipelines")
+                .queryParam("numInstances", "1")
+                .queryParam("orderBy", "name")
+                .header("Cookie", context.getAuthenticationToken())
+                .type(MediaType.APPLICATION_JSON)
+                .accept(MediaType.APPLICATION_JSON)
+                .get(ClientResponse.class);
+        Assert.assertEquals(response.getStatus(), 200);
+        EntitySummaryResult summaryResult = response.getEntity(EntitySummaryResult.class);
+        Assert.assertNotNull(summaryResult);
+    }
+
+    private void scheduleMultipleProcess(int count) throws Exception {
+        for (int i=0; i<count; i++) {
+            context.scheduleProcess();
+            Thread.sleep(100);
+        }
+        OozieTestUtils.waitForProcessWFtoStart(context);
+    }
+}