Repository: lens
Updated Branches:
  refs/heads/master 182f6dcac -> 38ab6c608


http://git-wip-us.apache.org/repos/asf/lens/blob/38ab6c60/lens-server/src/main/java/org/apache/lens/server/scheduler/SchedulerServiceImpl.java
----------------------------------------------------------------------
diff --git 
a/lens-server/src/main/java/org/apache/lens/server/scheduler/SchedulerServiceImpl.java
 
b/lens-server/src/main/java/org/apache/lens/server/scheduler/SchedulerServiceImpl.java
index c683a2c..00130d0 100644
--- 
a/lens-server/src/main/java/org/apache/lens/server/scheduler/SchedulerServiceImpl.java
+++ 
b/lens-server/src/main/java/org/apache/lens/server/scheduler/SchedulerServiceImpl.java
@@ -41,8 +41,8 @@ import org.apache.lens.server.api.LensErrorInfo;
 import org.apache.lens.server.api.error.LensException;
 import org.apache.lens.server.api.events.SchedulerAlarmEvent;
 import org.apache.lens.server.api.health.HealthStatus;
-import org.apache.lens.server.api.query.QueryEnded;
 import org.apache.lens.server.api.query.QueryExecutionService;
+import org.apache.lens.server.api.query.events.QueryEnded;
 import org.apache.lens.server.api.scheduler.SchedulerService;
 import org.apache.lens.server.error.LensSchedulerErrorCode;
 import org.apache.lens.server.session.LensSessionImpl;

http://git-wip-us.apache.org/repos/asf/lens/blob/38ab6c60/lens-server/src/test/java/org/apache/lens/server/query/QueryContextComparatorTest.java
----------------------------------------------------------------------
diff --git 
a/lens-server/src/test/java/org/apache/lens/server/query/QueryContextComparatorTest.java
 
b/lens-server/src/test/java/org/apache/lens/server/query/QueryContextComparatorTest.java
index 46adb7b..20243f4 100644
--- 
a/lens-server/src/test/java/org/apache/lens/server/query/QueryContextComparatorTest.java
+++ 
b/lens-server/src/test/java/org/apache/lens/server/query/QueryContextComparatorTest.java
@@ -27,16 +27,26 @@ import java.util.Comparator;
 
 import org.apache.lens.api.Priority;
 import org.apache.lens.server.api.query.QueryContext;
+import org.apache.lens.server.api.query.comparators.ChainedComparator;
+import org.apache.lens.server.api.query.comparators.FIFOQueryComparator;
+import org.apache.lens.server.api.query.comparators.QueryCostComparator;
+import org.apache.lens.server.api.query.comparators.QueryPriorityComparator;
 import org.apache.lens.server.api.query.cost.QueryCost;
 
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
+import com.google.common.collect.Lists;
+
 public class QueryContextComparatorTest {
 
   private final Comparator<QueryContext> priorityComparator = new 
QueryPriorityComparator();
   private final Comparator<QueryContext> costComparator = new 
QueryCostComparator();
-
+  private final Comparator<QueryContext> fifoComparator = new 
FIFOQueryComparator();
+  private final Comparator<QueryContext> priorityAndFifoComparator
+    = new ChainedComparator<>(Lists.newArrayList(priorityComparator, 
fifoComparator));
+  private final Comparator<QueryContext> costAndFifoComparator
+    = new ChainedComparator<>(Lists.newArrayList(costComparator, 
fifoComparator));
 
 
   @DataProvider
@@ -61,7 +71,7 @@ public class QueryContextComparatorTest {
     when(query2.getSelectedDriverQueryCost()).thenReturn(qcO2);
 
     when(qcO1.compareTo(qcO2)).thenReturn(resultOfQueryCostCompare);
-    assertEquals(costComparator.compare(query1, query2), expectedResult);
+    assertEquals(costAndFifoComparator.compare(query1, query2), 
expectedResult);
   }
 
   @Test
@@ -73,7 +83,7 @@ public class QueryContextComparatorTest {
     QueryContext query2 = mock(QueryContext.class);
     when(query2.getPriority()).thenReturn(Priority.LOW); // Ordinal = 3
 
-    assertEquals(priorityComparator.compare(query1, query2), -2);
+    assertEquals(priorityAndFifoComparator.compare(query1, query2), -2);
   }
 
 
@@ -114,8 +124,8 @@ public class QueryContextComparatorTest {
 
     // Cost and Priority both are same, hence the comparison should happen
     // on query submission time
-    assertEquals(priorityComparator.compare(query1, query2), expectedResult);
-    assertEquals(costComparator.compare(query1, query2), expectedResult);
+    assertEquals(priorityAndFifoComparator.compare(query1, query2), 
expectedResult);
+    assertEquals(costAndFifoComparator.compare(query1, query2), 
expectedResult);
 
   }
 }

http://git-wip-us.apache.org/repos/asf/lens/blob/38ab6c60/lens-server/src/test/java/org/apache/lens/server/query/TestEventService.java
----------------------------------------------------------------------
diff --git 
a/lens-server/src/test/java/org/apache/lens/server/query/TestEventService.java 
b/lens-server/src/test/java/org/apache/lens/server/query/TestEventService.java
index 526accc..b906776 100644
--- 
a/lens-server/src/test/java/org/apache/lens/server/query/TestEventService.java
+++ 
b/lens-server/src/test/java/org/apache/lens/server/query/TestEventService.java
@@ -39,7 +39,7 @@ import org.apache.lens.server.api.events.AsyncEventListener;
 import org.apache.lens.server.api.events.LensEvent;
 import org.apache.lens.server.api.events.LensEventListener;
 import org.apache.lens.server.api.events.LensEventService;
-import org.apache.lens.server.api.query.*;
+import org.apache.lens.server.api.query.events.*;
 import org.apache.lens.server.api.session.SessionClosed;
 import org.apache.lens.server.api.session.SessionExpired;
 import org.apache.lens.server.api.session.SessionOpened;

http://git-wip-us.apache.org/repos/asf/lens/blob/38ab6c60/lens-server/src/test/java/org/apache/lens/server/query/TestLensDAO.java
----------------------------------------------------------------------
diff --git 
a/lens-server/src/test/java/org/apache/lens/server/query/TestLensDAO.java 
b/lens-server/src/test/java/org/apache/lens/server/query/TestLensDAO.java
index e620dc5..066525b 100644
--- a/lens-server/src/test/java/org/apache/lens/server/query/TestLensDAO.java
+++ b/lens-server/src/test/java/org/apache/lens/server/query/TestLensDAO.java
@@ -25,20 +25,21 @@ import java.sql.Statement;
 import java.util.HashMap;
 import java.util.List;
 
+import javax.ws.rs.core.Application;
+
 import org.apache.lens.api.LensConf;
 import org.apache.lens.api.LensSessionHandle;
 import org.apache.lens.api.Priority;
+import org.apache.lens.api.query.FailedAttempt;
 import org.apache.lens.api.query.LensQuery;
 import org.apache.lens.api.query.QueryHandle;
 import org.apache.lens.api.query.QueryStatus;
 import org.apache.lens.driver.jdbc.JDBCResultSet;
+import org.apache.lens.server.LensJerseyTest;
 import org.apache.lens.server.LensServices;
 import org.apache.lens.server.api.driver.LensDriver;
 import org.apache.lens.server.api.driver.MockDriver;
-import org.apache.lens.server.api.query.DriverSelectorQueryContext;
-import org.apache.lens.server.api.query.FinishedLensQuery;
-import org.apache.lens.server.api.query.QueryContext;
-import org.apache.lens.server.api.query.QueryExecutionService;
+import org.apache.lens.server.api.query.*;
 
 import org.apache.hadoop.conf.Configuration;
 
@@ -54,7 +55,12 @@ import lombok.extern.slf4j.Slf4j;
  */
 @Test(groups = "unit-test")
 @Slf4j
-public class TestLensDAO {
+public class TestLensDAO extends LensJerseyTest {
+
+  @Override
+  protected Application configure() {
+    return new TestQueryService.QueryServiceTestApp();
+  }
 
   /**
    * Test lens server dao.
@@ -89,6 +95,10 @@ public class TestLensDAO {
     finishedLensQuery.setStatus(QueryStatus.Status.SUCCESSFUL.name());
     finishedLensQuery.setPriority(Priority.NORMAL.toString());
 
+    finishedLensQuery.setFailedAttempts(Lists.newArrayList(
+      new FailedAttempt("driver1", 1.0, "progress full", "no error", 0L, 1L),
+      new FailedAttempt("driver2", 1.0, "progress also full", "no error at 
all", 2L, 3L)
+    ));
     // Validate JDBC driver RS Meta can be deserialized
 
     // Create a valid JDBCResultSet
@@ -145,7 +155,8 @@ public class TestLensDAO {
     Assert.assertEquals(Priority.valueOf(actual.getPriority()), 
Priority.NORMAL);
     Assert.assertEquals(actual.getDriverQuery(), driverQuery);
     // when driver list contains the selected driver, selected driver should 
get set correctly in context
-    QueryContext retrievedQueryContext = actual.toQueryContext(new 
Configuration(), Lists.newArrayList(mockDriver));
+    QueryContext retrievedQueryContext = actual.toQueryContext(new 
Configuration(),
+      Lists.newArrayList(mockDriver));
     Assert.assertEquals(retrievedQueryContext.getSelectedDriverQuery(), 
driverQuery);
 
     // Test find finished queries

http://git-wip-us.apache.org/repos/asf/lens/blob/38ab6c60/lens-server/src/test/java/org/apache/lens/server/query/TestQueryIndependenceFromSessionClose.java
----------------------------------------------------------------------
diff --git 
a/lens-server/src/test/java/org/apache/lens/server/query/TestQueryIndependenceFromSessionClose.java
 
b/lens-server/src/test/java/org/apache/lens/server/query/TestQueryIndependenceFromSessionClose.java
index bf4577c..8c1bb7b 100644
--- 
a/lens-server/src/test/java/org/apache/lens/server/query/TestQueryIndependenceFromSessionClose.java
+++ 
b/lens-server/src/test/java/org/apache/lens/server/query/TestQueryIndependenceFromSessionClose.java
@@ -102,6 +102,7 @@ public class TestQueryIndependenceFromSessionClose extends 
LensJerseyTest {
    */
   @BeforeClass
   public void setUpClass() throws Exception {
+    restartLensServer(getServerConf());
     lensSessionId = getSession();
     createTable(TEST_TABLE);
     loadData(TEST_TABLE, TestResourceFile.TEST_DATA2_FILE.getValue());
@@ -110,6 +111,10 @@ public class TestQueryIndependenceFromSessionClose extends 
LensJerseyTest {
       QUERY_PERSISTENT_RESULT_INDRIVER, true,
       QUERY_OUTPUT_FORMATTER, 
TestQueryService.DeferredPersistentResultFormatter.class.getName());
   }
+  @AfterClass
+  public void restart() {
+    restartLensServer();
+  }
 
   @Override
   public Map<String, String> getServerConfOverWrites() {

http://git-wip-us.apache.org/repos/asf/lens/blob/38ab6c60/lens-server/src/test/java/org/apache/lens/server/query/TestQueryNotifictaionResource.java
----------------------------------------------------------------------
diff --git 
a/lens-server/src/test/java/org/apache/lens/server/query/TestQueryNotifictaionResource.java
 
b/lens-server/src/test/java/org/apache/lens/server/query/TestQueryNotifictaionResource.java
index 3a3f2f1..6a57b20 100644
--- 
a/lens-server/src/test/java/org/apache/lens/server/query/TestQueryNotifictaionResource.java
+++ 
b/lens-server/src/test/java/org/apache/lens/server/query/TestQueryNotifictaionResource.java
@@ -27,6 +27,7 @@ import org.apache.lens.server.api.error.LensException;
 
 
 import org.glassfish.jersey.media.multipart.FormDataParam;
+import org.testng.Assert;
 
 import lombok.Getter;
 import lombok.extern.slf4j.Slf4j;
@@ -59,7 +60,8 @@ public class TestQueryNotifictaionResource {
       + " status:" + query.getStatus() + " eventtype:" + eventtype);
 
     finishedCount++;
-
+    
Assert.assertTrue(query.getQueryName().toUpperCase().contains(query.getStatus().getStatus().name()),
+      "query " + query.getQueryName() + " " + query.getStatus());
     if (query.getStatus().successful()) {
       successfulCount++;
     } else if (query.getStatus().failed()) {

http://git-wip-us.apache.org/repos/asf/lens/blob/38ab6c60/lens-server/src/test/java/org/apache/lens/server/query/TestQueryService.java
----------------------------------------------------------------------
diff --git 
a/lens-server/src/test/java/org/apache/lens/server/query/TestQueryService.java 
b/lens-server/src/test/java/org/apache/lens/server/query/TestQueryService.java
index 440c30b..415f56f 100644
--- 
a/lens-server/src/test/java/org/apache/lens/server/query/TestQueryService.java
+++ 
b/lens-server/src/test/java/org/apache/lens/server/query/TestQueryService.java
@@ -1919,35 +1919,49 @@ public class TestQueryService extends LensJerseyTest {
 
 
   @Test(dataProvider = "mediaTypeData")
-  public void testFinishedNotifictaion(MediaType mt) throws LensException, 
InterruptedException {
-    String query = "select ID, IDSTR, count(*) from " + TEST_TABLE + " group 
by ID, IDSTR";
-    String endpoint = getBaseUri() + "/queryapi/notifictaion/finished";
-    LensConf conf = new LensConf();
-    conf.addProperty(LensConfConstants.QUERY_HTTP_NOTIFICATION_TYPE_FINISHED, 
"true");
-    conf.addProperty(LensConfConstants.QUERY_HTTP_NOTIFICATION_MEDIATYPE, mt);
-    conf.addProperty(LensConfConstants.QUERY_HTTP_NOTIFICATION_URLS, endpoint 
+ " , " + endpoint);
-
-    //Test for SUCCESSFUL FINISH notification
-    queryService.execute(lensSessionId, query, 20000, conf, 
"testHttpNotifictaionQuery");
-
-    //TEST for CANCELLED FINISH notification
-    conf.addProperty(LensConfConstants.QUERY_PERSISTENT_RESULT_SET, "true");
-    conf.addProperty(LensConfConstants.QUERY_OUTPUT_FORMATTER, 
DeferredPersistentResultFormatter.class.getName());
-    conf.addProperty("deferPersistenceByMillis", 5000); // defer persistence 
for 5 secs
-    QueryHandle hanlde = queryService.executeAsync(lensSessionId, query, conf, 
"testHttpNotifictaionQuery");
-    queryService.cancelQuery(lensSessionId, hanlde);
-
-    //Test for FAILED FINISH notification
-    conf.addProperty(LensConfConstants.QUERY_OUTPUT_FORMATTER, 
"wrong.formatter");
-    queryService.execute(lensSessionId, query, 20000, conf, 
"testHttpNotifictaionQuery");
-
-    Thread.sleep(3000); //Keep some time for notifications to get delivered
-    assertEquals(TestQueryNotifictaionResource.getSuccessfulCount(), 2);
-    assertEquals(TestQueryNotifictaionResource.getCancelledCount(), 2);
-    assertEquals(TestQueryNotifictaionResource.getFailedCount(), 2);
-    assertEquals(TestQueryNotifictaionResource.getFinishedCount(), 6);
-
-    TestQueryNotifictaionResource.clearState();
+  public void testFinishedNotification(MediaType mt) throws LensException, 
InterruptedException {
+    try {
+      String query = "select ID, IDSTR, count(*) from " + TEST_TABLE + " group 
by ID, IDSTR";
+      String endpoint = getBaseUri() + "/queryapi/notifictaion/finished";
+      LensConf conf = new LensConf();
+      
conf.addProperty(LensConfConstants.QUERY_HTTP_NOTIFICATION_TYPE_FINISHED, 
"true");
+      conf.addProperty(LensConfConstants.QUERY_HTTP_NOTIFICATION_MEDIATYPE, 
mt);
+      conf.addProperty(LensConfConstants.QUERY_HTTP_NOTIFICATION_URLS, 
endpoint + " , " + endpoint);
+
+      //Test for SUCCESSFUL FINISH notification
+      QueryHandle handle1 = queryService.executeAsync(lensSessionId, query, 
conf,
+        "testHttpNotificationQuerySuccessful");
+
+      //TEST for CANCELLED FINISH notification
+      conf.addProperty(LensConfConstants.QUERY_PERSISTENT_RESULT_SET, "true");
+      conf.addProperty(LensConfConstants.QUERY_OUTPUT_FORMATTER, 
DeferredPersistentResultFormatter.class.getName());
+      conf.addProperty("deferPersistenceByMillis", 5000); // defer persistence 
for 5 secs
+      QueryHandle handle2 = queryService.executeAsync(lensSessionId, query, 
conf, "testHttpNotificationQueryCanceled");
+      queryService.cancelQuery(lensSessionId, handle2);
+
+      //Test for FAILED FINISH notification
+      conf.addProperty(LensConfConstants.QUERY_OUTPUT_FORMATTER, 
"wrong.formatter");
+      QueryHandle handle3 = queryService.executeAsync(lensSessionId, query, 
conf, "testHttpNotificationQueryFailed");
+
+      for (QueryHandle handle : new QueryHandle[]{handle1, handle2, handle3}) {
+        LensQuery lensQuery = queryService.getQuery(lensSessionId, handle);
+        while (!lensQuery.getStatus().finished()) {
+          Thread.sleep(1000);
+          lensQuery = queryService.getQuery(lensSessionId, handle);
+        }
+        
assertTrue(lensQuery.getQueryName().toUpperCase().contains(lensQuery.getStatus().getStatus().name()),
+          "Query finished with wrong status: " + lensQuery);
+        log.info("query {} finished", lensQuery);
+      }
+      // sleep more to allow notifications to go
+      Thread.sleep(3000);
+      assertEquals(TestQueryNotifictaionResource.getFinishedCount(), 6);
+      assertEquals(TestQueryNotifictaionResource.getSuccessfulCount(), 2);
+      assertEquals(TestQueryNotifictaionResource.getCancelledCount(), 2);
+      assertEquals(TestQueryNotifictaionResource.getFailedCount(), 2);
+    } finally {
+      TestQueryNotifictaionResource.clearState();
+    }
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/lens/blob/38ab6c60/lens-server/src/test/java/org/apache/lens/server/query/collect/QueryCollectUtil.java
----------------------------------------------------------------------
diff --git 
a/lens-server/src/test/java/org/apache/lens/server/query/collect/QueryCollectUtil.java
 
b/lens-server/src/test/java/org/apache/lens/server/query/collect/QueryCollectUtil.java
index 8b72c81..82fd8ff 100644
--- 
a/lens-server/src/test/java/org/apache/lens/server/query/collect/QueryCollectUtil.java
+++ 
b/lens-server/src/test/java/org/apache/lens/server/query/collect/QueryCollectUtil.java
@@ -25,9 +25,9 @@ import static java.lang.reflect.Modifier.isSynchronized;
 import org.apache.lens.api.Priority;
 import org.apache.lens.api.query.QueryHandle;
 import org.apache.lens.server.api.query.QueryContext;
+import org.apache.lens.server.api.query.comparators.QueryCostComparator;
+import org.apache.lens.server.api.query.comparators.QueryPriorityComparator;
 import org.apache.lens.server.api.query.cost.FactPartitionBasedQueryCost;
-import org.apache.lens.server.query.QueryCostComparator;
-import org.apache.lens.server.query.QueryPriorityComparator;
 
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;

http://git-wip-us.apache.org/repos/asf/lens/blob/38ab6c60/lens-server/src/test/java/org/apache/lens/server/query/constraint/DefaultQueryLaunchingConstraintsCheckerTest.java
----------------------------------------------------------------------
diff --git 
a/lens-server/src/test/java/org/apache/lens/server/query/constraint/DefaultQueryLaunchingConstraintsCheckerTest.java
 
b/lens-server/src/test/java/org/apache/lens/server/query/constraint/DefaultQueryLaunchingConstraintsCheckerTest.java
index ab030cc..9bb159d 100644
--- 
a/lens-server/src/test/java/org/apache/lens/server/query/constraint/DefaultQueryLaunchingConstraintsCheckerTest.java
+++ 
b/lens-server/src/test/java/org/apache/lens/server/query/constraint/DefaultQueryLaunchingConstraintsCheckerTest.java
@@ -23,6 +23,7 @@ import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 import static org.testng.Assert.assertEquals;
 
+import org.apache.lens.api.query.QueryStatus;
 import org.apache.lens.server.api.query.QueryContext;
 import 
org.apache.lens.server.api.query.collect.EstimatedImmutableQueryCollection;
 import org.apache.lens.server.api.query.constraint.QueryLaunchingConstraint;
@@ -45,24 +46,27 @@ public class DefaultQueryLaunchingConstraintsCheckerTest {
     final QueryLaunchingConstraint constraint2 = 
mock(QueryLaunchingConstraint.class);
     QueryLaunchingConstraintsChecker constraintsChecker
       = new 
DefaultQueryLaunchingConstraintsChecker(ImmutableSet.of(constraint1, 
constraint2));
-
+    QueryStatus status = QueryStatus.getQueuedStatus();
     final QueryLaunchingConstraint driverConstraint = 
mock(QueryLaunchingConstraint.class);
     
when(mockCandidateQuery.getSelectedDriverQueryConstraints()).thenReturn(ImmutableSet.of(driverConstraint));
+    when(mockCandidateQuery.getStatus()).thenReturn(status);
 
     /* Constraint1 stubbed to pass */
-    when(constraint1.allowsLaunchOf(mockCandidateQuery, 
mockRunningQueries)).thenReturn(true);
+    when(constraint1.allowsLaunchOf(mockCandidateQuery, 
mockRunningQueries)).thenReturn(null);
 
     /* Constraint2 stubbed to fail */
-    when(constraint2.allowsLaunchOf(mockCandidateQuery, 
mockRunningQueries)).thenReturn(false);
+    when(constraint2.allowsLaunchOf(mockCandidateQuery, 
mockRunningQueries)).thenReturn("constraint 2 failed");
 
     /* DriverConstraint stubbed to fail */
-    when(driverConstraint.allowsLaunchOf(mockCandidateQuery, 
mockRunningQueries)).thenReturn(false);
+    when(driverConstraint.allowsLaunchOf(mockCandidateQuery, 
mockRunningQueries))
+      .thenReturn("driver constraint failed");
 
     /* Execute test */
     boolean canLaunchQuery = constraintsChecker.canLaunch(mockCandidateQuery, 
mockRunningQueries);
 
     /* Verify */
     Assert.assertFalse(canLaunchQuery);
+    Assert.assertEquals(mockCandidateQuery.getStatus().getProgressMessage(), 
"constraint 2 failed");
   }
 
   @Test
@@ -81,9 +85,9 @@ public class DefaultQueryLaunchingConstraintsCheckerTest {
     
when(mockCandidateQuery.getSelectedDriverQueryConstraints()).thenReturn(ImmutableSet.of(driverConstraint));
 
     /* all constraints stubbed to pass */
-    when(constraint1.allowsLaunchOf(mockCandidateQuery, 
mockRunningQueries)).thenReturn(true);
-    when(constraint2.allowsLaunchOf(mockCandidateQuery, 
mockRunningQueries)).thenReturn(true);
-    when(driverConstraint.allowsLaunchOf(mockCandidateQuery, 
mockRunningQueries)).thenReturn(true);
+    when(constraint1.allowsLaunchOf(mockCandidateQuery, 
mockRunningQueries)).thenReturn(null);
+    when(constraint2.allowsLaunchOf(mockCandidateQuery, 
mockRunningQueries)).thenReturn(null);
+    when(driverConstraint.allowsLaunchOf(mockCandidateQuery, 
mockRunningQueries)).thenReturn(null);
 
     /* Execute test */
     boolean canLaunchQuery = constraintsChecker.canLaunch(mockCandidateQuery, 
mockRunningQueries);

http://git-wip-us.apache.org/repos/asf/lens/blob/38ab6c60/lens-server/src/test/java/org/apache/lens/server/query/constraint/ThreadSafeEstimatedQueryCollectionTest.java
----------------------------------------------------------------------
diff --git 
a/lens-server/src/test/java/org/apache/lens/server/query/constraint/ThreadSafeEstimatedQueryCollectionTest.java
 
b/lens-server/src/test/java/org/apache/lens/server/query/constraint/ThreadSafeEstimatedQueryCollectionTest.java
index d972780..97a7a59 100644
--- 
a/lens-server/src/test/java/org/apache/lens/server/query/constraint/ThreadSafeEstimatedQueryCollectionTest.java
+++ 
b/lens-server/src/test/java/org/apache/lens/server/query/constraint/ThreadSafeEstimatedQueryCollectionTest.java
@@ -21,7 +21,8 @@ package org.apache.lens.server.query.constraint;
 
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
-import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertNull;
 
 import org.apache.lens.server.api.driver.LensDriver;
 import org.apache.lens.server.api.query.QueryContext;
@@ -74,8 +75,12 @@ public class ThreadSafeEstimatedQueryCollectionTest {
     QueryContext mockCandidateQuery = mock(QueryContext.class);
     when(mockCandidateQuery.getSelectedDriver()).thenReturn(mockDriver);
     when(mockCandidateQuery.getSelectedDriverQueryCost()).thenReturn(COST);
-    boolean actualCanLaunch = constraint.allowsLaunchOf(mockCandidateQuery, 
col);
+    String actualCanLaunch = constraint.allowsLaunchOf(mockCandidateQuery, 
col);
 
-    assertEquals(actualCanLaunch, expectedCanLaunch);
+    if (expectedCanLaunch) {
+      assertNull(actualCanLaunch);
+    } else {
+      assertNotNull(actualCanLaunch);
+    }
   }
 }

http://git-wip-us.apache.org/repos/asf/lens/blob/38ab6c60/lens-server/src/test/java/org/apache/lens/server/query/constraint/TotalQueryCostCeilingConstraintTest.java
----------------------------------------------------------------------
diff --git 
a/lens-server/src/test/java/org/apache/lens/server/query/constraint/TotalQueryCostCeilingConstraintTest.java
 
b/lens-server/src/test/java/org/apache/lens/server/query/constraint/TotalQueryCostCeilingConstraintTest.java
index 460190a..80229e8 100644
--- 
a/lens-server/src/test/java/org/apache/lens/server/query/constraint/TotalQueryCostCeilingConstraintTest.java
+++ 
b/lens-server/src/test/java/org/apache/lens/server/query/constraint/TotalQueryCostCeilingConstraintTest.java
@@ -21,7 +21,8 @@ package org.apache.lens.server.query.constraint;
 
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
-import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertNull;
 
 import org.apache.lens.server.api.query.QueryContext;
 import 
org.apache.lens.server.api.query.collect.EstimatedImmutableQueryCollection;
@@ -42,7 +43,7 @@ public class TotalQueryCostCeilingConstraintTest {
   }
 
   @Test(dataProvider = "dpTestAllowsLaunchOfQuery")
-  public void testAllowsLaunchOfQuery(final double 
totalQueryCostForCurrentUser, final boolean expectedCanLaunchQuery) {
+  public void testAllowsLaunchOfQuery(final double 
totalQueryCostForCurrentUser, final boolean expectedCanLaunch) {
 
     final QueryCost totalQueryCostCeilingPerUser = new 
FactPartitionBasedQueryCost(90.0);
     final QueryLaunchingConstraint queryConstraint
@@ -56,8 +57,13 @@ public class TotalQueryCostCeilingConstraintTest {
     when(launchedQueries.getTotalQueryCost(mockUser))
       .thenReturn(new 
FactPartitionBasedQueryCost(totalQueryCostForCurrentUser));
 
-    boolean actualCanLaunchQuery = queryConstraint.allowsLaunchOf(query, 
launchedQueries);
-    assertEquals(actualCanLaunchQuery, expectedCanLaunchQuery);
+    String actualCanLaunch = queryConstraint.allowsLaunchOf(query, 
launchedQueries);
+
+    if (expectedCanLaunch) {
+      assertNull(actualCanLaunch);
+    } else {
+      assertNotNull(actualCanLaunch);
+    }
   }
 
   @Test
@@ -69,7 +75,7 @@ public class TotalQueryCostCeilingConstraintTest {
     final QueryContext query = mock(QueryContext.class);
     final EstimatedImmutableQueryCollection launchedQueries = 
mock(EstimatedImmutableQueryCollection.class);
 
-    boolean actualCanLaunchQuery = queryConstraint.allowsLaunchOf(query, 
launchedQueries);
-    assertEquals(actualCanLaunchQuery, true);
+    String actualCanLaunch = queryConstraint.allowsLaunchOf(query, 
launchedQueries);
+    assertNull(actualCanLaunch);
   }
 }

http://git-wip-us.apache.org/repos/asf/lens/blob/38ab6c60/lens-server/src/test/java/org/apache/lens/server/query/retry/MockDriverForRetries.java
----------------------------------------------------------------------
diff --git 
a/lens-server/src/test/java/org/apache/lens/server/query/retry/MockDriverForRetries.java
 
b/lens-server/src/test/java/org/apache/lens/server/query/retry/MockDriverForRetries.java
new file mode 100644
index 0000000..f9cf6c8
--- /dev/null
+++ 
b/lens-server/src/test/java/org/apache/lens/server/query/retry/MockDriverForRetries.java
@@ -0,0 +1,82 @@
+/**
+ * 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.lens.server.query.retry;
+
+import org.apache.lens.server.api.driver.DriverQueryStatus;
+import org.apache.lens.server.api.driver.MockDriver;
+import org.apache.lens.server.api.error.LensException;
+import org.apache.lens.server.api.query.AbstractQueryContext;
+import org.apache.lens.server.api.query.QueryContext;
+import org.apache.lens.server.api.query.cost.FactPartitionBasedQueryCost;
+import org.apache.lens.server.api.query.cost.QueryCost;
+
+import org.apache.hadoop.conf.Configuration;
+
+import lombok.Getter;
+
+
+public class MockDriverForRetries extends MockDriver {
+  private int numRetries;
+  @Getter
+  private String fullyQualifiedName;
+
+  @Override
+  public void configure(Configuration conf, String driverType, String 
driverName) throws LensException {
+    this.conf = conf;
+    this.fullyQualifiedName = driverType + "/" + driverName;
+    this.conf.addResource(getDriverResourcePath("driver-site.xml"));
+    this.numRetries = this.conf.getInt("num.retries", 0);
+    loadQueryHook();
+    loadRetryPolicyDecider();
+  }
+
+  private String getDriverProperty(QueryContext ctx, String name) {
+    return ctx.getLensConf().getProperty("driver." + 
this.getFullyQualifiedName() + "." + name);
+  }
+
+  @Override
+  public void updateStatus(QueryContext context) throws LensException {
+    if (context.getFailedAttempts().size() < numRetries) {
+      String errorMessage = getDriverProperty(context, "error.message");
+      if (errorMessage == null) {
+        errorMessage = "Simulated Failure";
+      }
+      
context.getDriverStatus().setState(DriverQueryStatus.DriverQueryState.FAILED);
+      context.getDriverStatus().setErrorMessage(errorMessage);
+    } else {
+      
context.getDriverStatus().setState(DriverQueryStatus.DriverQueryState.SUCCESSFUL);
+    }
+    context.getDriverStatus().setDriverFinishTime(System.currentTimeMillis());
+  }
+
+  @Override
+  public void executeAsync(QueryContext context) throws LensException {
+    super.executeAsync(context);
+    context.getDriverStatus().setDriverStartTime(System.currentTimeMillis());
+  }
+
+  @Override
+  public QueryCost estimate(AbstractQueryContext qctx) throws LensException {
+    String cost = qctx.getLensConf().getProperty("driver." + 
this.getFullyQualifiedName() + ".cost");
+    if (cost == null) {
+      throw new LensException("Can't run query");
+    }
+    return new FactPartitionBasedQueryCost(Double.parseDouble(cost));
+  }
+}

http://git-wip-us.apache.org/repos/asf/lens/blob/38ab6c60/lens-server/src/test/java/org/apache/lens/server/query/retry/MockRetryPolicyDecider.java
----------------------------------------------------------------------
diff --git 
a/lens-server/src/test/java/org/apache/lens/server/query/retry/MockRetryPolicyDecider.java
 
b/lens-server/src/test/java/org/apache/lens/server/query/retry/MockRetryPolicyDecider.java
new file mode 100644
index 0000000..e65e191
--- /dev/null
+++ 
b/lens-server/src/test/java/org/apache/lens/server/query/retry/MockRetryPolicyDecider.java
@@ -0,0 +1,35 @@
+/**
+ * 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.lens.server.query.retry;
+
+import org.apache.lens.server.api.query.QueryContext;
+import org.apache.lens.server.api.retry.BackOffRetryHandler;
+import 
org.apache.lens.server.api.retry.FibonacciExponentialBackOffRetryHandler;
+import org.apache.lens.server.api.retry.ImmediateRetryHandler;
+import org.apache.lens.server.api.retry.RetryPolicyDecider;
+
+public class MockRetryPolicyDecider implements 
RetryPolicyDecider<QueryContext> {
+  @Override
+  public BackOffRetryHandler<QueryContext> decidePolicy(String errorMessage) {
+    if (errorMessage.contains("fibonacci")) {
+      return new FibonacciExponentialBackOffRetryHandler<>(3, 10000, 
Long.parseLong(errorMessage.substring(10)));
+    }
+    return new ImmediateRetryHandler<>(1);
+  }
+}

http://git-wip-us.apache.org/repos/asf/lens/blob/38ab6c60/lens-server/src/test/java/org/apache/lens/server/query/retry/QueryRetryTest.java
----------------------------------------------------------------------
diff --git 
a/lens-server/src/test/java/org/apache/lens/server/query/retry/QueryRetryTest.java
 
b/lens-server/src/test/java/org/apache/lens/server/query/retry/QueryRetryTest.java
new file mode 100644
index 0000000..b90b043
--- /dev/null
+++ 
b/lens-server/src/test/java/org/apache/lens/server/query/retry/QueryRetryTest.java
@@ -0,0 +1,212 @@
+/**
+ * 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.lens.server.query.retry;
+
+
+import static 
org.apache.lens.server.api.LensConfConstants.DRIVER_TYPES_AND_CLASSES;
+import static 
org.apache.lens.server.api.LensConfConstants.QUERY_RETRY_POLICY_CLASSES;
+import static org.apache.lens.server.api.LensServerAPITestUtil.getLensConf;
+import static org.apache.lens.server.api.util.LensUtil.getHashMap;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+
+import java.util.Map;
+
+import javax.ws.rs.core.Application;
+import javax.ws.rs.core.MediaType;
+
+import org.apache.lens.api.LensSessionHandle;
+import org.apache.lens.api.query.FailedAttempt;
+import org.apache.lens.api.query.LensQuery;
+import org.apache.lens.api.query.QueryHandle;
+import org.apache.lens.server.LensJerseyTest;
+import org.apache.lens.server.LensServices;
+import org.apache.lens.server.api.error.LensException;
+import org.apache.lens.server.api.query.QueryContext;
+import org.apache.lens.server.api.query.QueryExecutionService;
+import org.apache.lens.server.api.session.SessionService;
+import org.apache.lens.server.common.RestAPITestUtil;
+import org.apache.lens.server.query.QueryExecutionServiceImpl;
+import org.apache.lens.server.query.TestQueryService;
+
+import org.glassfish.jersey.test.TestProperties;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+@Test(groups = "post-restart", dependsOnGroups = "restart-test")
+public class QueryRetryTest extends LensJerseyTest {
+
+  private QueryExecutionServiceImpl queryService;
+  private SessionService sessionService;
+  private LensSessionHandle session;
+
+  private QueryExecutionServiceImpl getQueryService() {
+    return queryService = 
LensServices.get().getService(QueryExecutionService.NAME);
+  }
+
+  @Override
+  protected Application configure() {
+    enable(TestProperties.LOG_TRAFFIC);
+    enable(TestProperties.DUMP_ENTITY);
+    return new TestQueryService.QueryServiceTestApp();
+  }
+
+  private SessionService getSessionService() {
+    return sessionService = LensServices.get().getService(SessionService.NAME);
+  }
+
+  private LensSessionHandle getSession() throws LensException {
+    return getSessionService().openSession("foo", "bar", null, null);
+  }
+
+  @BeforeTest
+  public void setUp() throws Exception {
+    super.setUp();
+  }
+  @BeforeClass
+  public void setUpClass() throws Exception {
+    restartLensServer(getServerConf(), false);
+    session = getSession();
+  }
+  @AfterClass
+  public void cleanupClass() throws Exception {
+    getSessionService().closeSession(session);
+    restartLensServer();
+  }
+
+  @Override
+  public Map<String, String> getServerConfOverWrites() {
+    return getHashMap(DRIVER_TYPES_AND_CLASSES, 
"retry:org.apache.lens.server.query.retry.MockDriverForRetries",
+      QUERY_RETRY_POLICY_CLASSES, 
TestServerRetryPolicyDecider.class.getName());
+  }
+
+  @Test
+  public void testSingleRetrySameDriver() throws LensException, 
InterruptedException {
+    QueryHandle handle = getQueryService().executeAsync(session, "select 1",
+      getLensConf("driver.retry/single_failure.cost", "1", 
"driver.retry/double_failure.cost", "2"),
+      "random query");
+    QueryContext ctx = getQueryService().getQueryContext(handle);
+    while (!ctx.getStatus().finished()) {
+      ctx = getQueryService().getQueryContext(handle);
+      Thread.sleep(1000);
+    }
+    assertEquals(ctx.getFailedAttempts().size(), 1);
+    FailedAttempt failedAttempt = ctx.getFailedAttempts().get(0);
+    assertEquals(failedAttempt.getDriverName(), "retry/single_failure");
+    assertEquals(ctx.getSelectedDriver().getFullyQualifiedName(), 
"retry/single_failure");
+    assertTrue(failedAttempt.getDriverFinishTime() > 
failedAttempt.getDriverStartTime());
+    assertTrue(ctx.getDriverStatus().getDriverStartTime() > 
failedAttempt.getDriverFinishTime());
+
+  }
+
+  @Test
+  public void testRetryOnDifferentDriver() throws LensException, 
InterruptedException {
+    QueryHandle handle = getQueryService().executeAsync(session, "select 1",
+      getLensConf("driver.retry/single_failure.cost", "2", 
"driver.retry/double_failure.cost", "1"),
+      "random query");
+    QueryContext ctx = getQueryService().getQueryContext(handle);
+    while (!ctx.getStatus().finished()) {
+      ctx = getQueryService().getQueryContext(handle);
+      Thread.sleep(1000);
+    }
+    assertEquals(ctx.getFailedAttempts().size(), 2);
+    FailedAttempt attempt1 = ctx.getFailedAttempts().get(0);
+    FailedAttempt attempt2 = ctx.getFailedAttempts().get(1);
+    // two retries on double_failure
+    assertEquals(attempt1.getDriverName(), "retry/double_failure");
+    assertEquals(attempt2.getDriverName(), "retry/double_failure");
+    // first retry failed on single_failure since the driver checks total 
retries before failing.
+    // If there weren't any attempts before this one, then this attempt would 
fail, but since there
+    // have already been 2 attempts and 2 > 1, this attempt passed.
+    assertEquals(ctx.getSelectedDriver().getFullyQualifiedName(), 
"retry/single_failure");
+    assertTrue(attempt2.getDriverStartTime() > attempt1.getDriverFinishTime());
+    assertTrue(ctx.getDriverStatus().getDriverStartTime() > 
attempt2.getDriverFinishTime());
+
+    // test rest api
+    LensQuery lensQuery = RestAPITestUtil.getLensQuery(target(), session, 
handle, MediaType.APPLICATION_XML_TYPE);
+    assertEquals(lensQuery.getFailedAttempts(), ctx.getFailedAttempts());
+  }
+
+  @Test
+  public void testFailureAfterRetry() throws LensException, 
InterruptedException {
+    QueryHandle handle = getQueryService().executeAsync(session, "select 1",
+      getLensConf("driver.retry/double_failure.cost", "1"),
+      "random query");
+    QueryContext ctx = getQueryService().getQueryContext(handle);
+    while (!ctx.getStatus().finished()) {
+      ctx = getQueryService().getQueryContext(handle);
+      Thread.sleep(1000);
+    }
+    assertTrue(ctx.getStatus().failed());
+    assertEquals(ctx.getFailedAttempts().size(), 1);
+    FailedAttempt attempt1 = ctx.getFailedAttempts().get(0);
+    assertEquals(attempt1.getDriverName(), "retry/double_failure");
+    assertEquals(ctx.getSelectedDriver().getFullyQualifiedName(), 
"retry/double_failure");
+    assertTrue(ctx.getStatus().failed());
+  }
+
+  @Test
+  public void testDelayedLaunch() throws LensException, InterruptedException {
+    QueryHandle handle = getQueryService().executeAsync(session, "select 1",
+      getLensConf("driver.retry/double_failure.cost", "1",
+        "driver.retry/double_failure.error.message", "fibonacci.500"),
+      "random query");
+    QueryContext ctx = getQueryService().getQueryContext(handle);
+
+    while (!ctx.getStatus().finished()) {
+      ctx = getQueryService().getQueryContext(handle);
+      Thread.sleep(1000);
+    }
+    assertTrue(ctx.getStatus().successful());
+    assertEquals(ctx.getFailedAttempts().size(), 2);
+    FailedAttempt attempt1 = ctx.getFailedAttempts().get(0);
+    FailedAttempt attempt2 = ctx.getFailedAttempts().get(1);
+    assertTrue(attempt2.getDriverStartTime() - attempt1.getDriverFinishTime() 
>= 500);
+    assertTrue(ctx.getDriverStatus().getDriverStartTime() - 
attempt2.getDriverFinishTime() >= 1000);
+  }
+
+  @Test
+  public void testRestartWhileRetry() throws LensException, 
InterruptedException {
+    QueryHandle handle = getQueryService().executeAsync(session, "select 1",
+      getLensConf("driver.retry/double_failure.cost", "1",
+        "driver.retry/double_failure.error.message", "fibonacci.5000"),
+      "random query");
+    QueryContext ctx = getQueryService().getQueryContext(handle);
+
+    while (ctx.getFailedAttempts().size() == 0) {
+      ctx = getQueryService().getQueryContext(handle);
+      Thread.sleep(1000);
+    }
+    restartLensServer(getServerConf(), false);
+    ctx = getQueryService().getQueryContext(handle);
+    while (!ctx.getStatus().finished()) {
+      ctx = getQueryService().getQueryContext(handle);
+      Thread.sleep(1000);
+    }
+    assertTrue(ctx.getStatus().successful());
+    assertEquals(ctx.getFailedAttempts().size(), 2);
+    FailedAttempt attempt1 = ctx.getFailedAttempts().get(0);
+    FailedAttempt attempt2 = ctx.getFailedAttempts().get(1);
+    assertTrue(attempt2.getDriverStartTime() - attempt1.getDriverFinishTime() 
>= 5000);
+    assertTrue(ctx.getDriverStatus().getDriverStartTime() - 
attempt2.getDriverFinishTime() >= 10000);
+  }
+}

http://git-wip-us.apache.org/repos/asf/lens/blob/38ab6c60/lens-server/src/test/java/org/apache/lens/server/query/retry/TestServerRetryPolicyDecider.java
----------------------------------------------------------------------
diff --git 
a/lens-server/src/test/java/org/apache/lens/server/query/retry/TestServerRetryPolicyDecider.java
 
b/lens-server/src/test/java/org/apache/lens/server/query/retry/TestServerRetryPolicyDecider.java
new file mode 100644
index 0000000..a6e55c9
--- /dev/null
+++ 
b/lens-server/src/test/java/org/apache/lens/server/query/retry/TestServerRetryPolicyDecider.java
@@ -0,0 +1,32 @@
+/**
+ * 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.lens.server.query.retry;
+
+import org.apache.lens.server.api.query.QueryContext;
+import org.apache.lens.server.api.retry.BackOffRetryHandler;
+import org.apache.lens.server.api.retry.ImmediateRetryHandler;
+import org.apache.lens.server.api.retry.RetryPolicyDecider;
+
+public class TestServerRetryPolicyDecider implements 
RetryPolicyDecider<QueryContext> {
+
+  @Override
+  public BackOffRetryHandler<QueryContext> decidePolicy(String errorMessage) {
+    return new ImmediateRetryHandler<>(1);
+  }
+}

http://git-wip-us.apache.org/repos/asf/lens/blob/38ab6c60/lens-server/src/test/java/org/apache/lens/server/scheduler/util/SchedulerTestUtils.java
----------------------------------------------------------------------
diff --git 
a/lens-server/src/test/java/org/apache/lens/server/scheduler/util/SchedulerTestUtils.java
 
b/lens-server/src/test/java/org/apache/lens/server/scheduler/util/SchedulerTestUtils.java
index d50474a..daea7a2 100644
--- 
a/lens-server/src/test/java/org/apache/lens/server/scheduler/util/SchedulerTestUtils.java
+++ 
b/lens-server/src/test/java/org/apache/lens/server/scheduler/util/SchedulerTestUtils.java
@@ -33,8 +33,8 @@ import org.apache.lens.api.query.QueryHandle;
 import org.apache.lens.api.query.QueryStatus;
 import org.apache.lens.api.scheduler.*;
 import org.apache.lens.server.api.query.QueryContext;
-import org.apache.lens.server.api.query.QueryEnded;
 import org.apache.lens.server.api.query.QueryExecutionService;
+import org.apache.lens.server.api.query.events.QueryEnded;
 import org.apache.lens.server.scheduler.SchedulerServiceImpl;
 
 import org.apache.hadoop.conf.Configuration;

http://git-wip-us.apache.org/repos/asf/lens/blob/38ab6c60/lens-server/src/test/resources/drivers/mock/single_failure/failing-query-driver-site.xml
----------------------------------------------------------------------
diff --git 
a/lens-server/src/test/resources/drivers/mock/single_failure/failing-query-driver-site.xml
 
b/lens-server/src/test/resources/drivers/mock/single_failure/failing-query-driver-site.xml
new file mode 100644
index 0000000..9bb3f1d
--- /dev/null
+++ 
b/lens-server/src/test/resources/drivers/mock/single_failure/failing-query-driver-site.xml
@@ -0,0 +1,32 @@
+<?xml version="1.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.
+  -->
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+
+<configuration>
+  <property>
+    <name>lens.driver.test.key</name>
+    <value>set</value>
+  </property>
+
+  <property>
+    <name>lens.driver.test.drivername</name>
+    <value>mock/single_failure</value>
+  </property>
+</configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lens/blob/38ab6c60/lens-server/src/test/resources/drivers/retry/double_failure/driver-site.xml
----------------------------------------------------------------------
diff --git 
a/lens-server/src/test/resources/drivers/retry/double_failure/driver-site.xml 
b/lens-server/src/test/resources/drivers/retry/double_failure/driver-site.xml
new file mode 100644
index 0000000..c0e6695
--- /dev/null
+++ 
b/lens-server/src/test/resources/drivers/retry/double_failure/driver-site.xml
@@ -0,0 +1,31 @@
+<?xml version="1.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.
+  -->
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+
+<configuration>
+  <property>
+    <name>num.retries</name>
+    <value>2</value>
+  </property>
+  <property>
+    <name>query.retry.policy.classes</name>
+    <value>org.apache.lens.server.query.retry.MockRetryPolicyDecider</value>
+  </property>
+</configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lens/blob/38ab6c60/lens-server/src/test/resources/drivers/retry/single_failure/driver-site.xml
----------------------------------------------------------------------
diff --git 
a/lens-server/src/test/resources/drivers/retry/single_failure/driver-site.xml 
b/lens-server/src/test/resources/drivers/retry/single_failure/driver-site.xml
new file mode 100644
index 0000000..e9e0550
--- /dev/null
+++ 
b/lens-server/src/test/resources/drivers/retry/single_failure/driver-site.xml
@@ -0,0 +1,31 @@
+<?xml version="1.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.
+  -->
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+
+<configuration>
+  <property>
+    <name>num.retries</name>
+    <value>1</value>
+  </property>
+  <property>
+    <name>query.retry.policy.classes</name>
+    <value>org.apache.lens.server.query.retry.MockRetryPolicyDecider</value>
+  </property>
+</configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lens/blob/38ab6c60/lens-server/src/test/resources/drivers/retry/triple_failure/driver-site.xml
----------------------------------------------------------------------
diff --git 
a/lens-server/src/test/resources/drivers/retry/triple_failure/driver-site.xml 
b/lens-server/src/test/resources/drivers/retry/triple_failure/driver-site.xml
new file mode 100644
index 0000000..b7ed287
--- /dev/null
+++ 
b/lens-server/src/test/resources/drivers/retry/triple_failure/driver-site.xml
@@ -0,0 +1,31 @@
+<?xml version="1.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.
+  -->
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+
+<configuration>
+  <property>
+    <name>num.retries</name>
+    <value>3</value>
+  </property>
+  <property>
+    <name>query.retry.policy.classes</name>
+    <value>org.apache.lens.server.query.retry.MockRetryPolicyDecider</value>
+  </property>
+</configuration>
\ No newline at end of file

Reply via email to