You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lens.apache.org by am...@apache.org on 2014/12/23 13:21:03 UTC
incubator-lens git commit: LENS-82 : Move Mock* classes in
lens-server-api to test jar (Raju Bairishetti via amareshwari)
Repository: incubator-lens
Updated Branches:
refs/heads/master e51c14c04 -> 803c444b4
LENS-82 : Move Mock* classes in lens-server-api to test jar (Raju Bairishetti via amareshwari)
Project: http://git-wip-us.apache.org/repos/asf/incubator-lens/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-lens/commit/803c444b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-lens/tree/803c444b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-lens/diff/803c444b
Branch: refs/heads/master
Commit: 803c444b4540f511136ff65935847db68c6a63d7
Parents: e51c14c
Author: Amareshwari Sriramdasu <am...@inmobi.com>
Authored: Tue Dec 23 17:50:47 2014 +0530
Committer: Amareshwari Sriramdasu <am...@inmobi.com>
Committed: Tue Dec 23 17:50:47 2014 +0530
----------------------------------------------------------------------
lens-cli/pom.xml | 8 +-
lens-client/pom.xml | 7 +
lens-cube/pom.xml | 7 +
lens-driver-hive/pom.xml | 7 +
lens-ml-lib/pom.xml | 10 +-
lens-query-lib/pom.xml | 7 +
.../lens/server/api/driver/MockDriver.java | 362 -------------------
.../lens/server/api/driver/MockFailDriver.java | 35 --
.../server/api/driver/MockQueryContext.java | 33 --
.../lens/server/api/driver/MockDriver.java | 362 +++++++++++++++++++
.../lens/server/api/driver/MockFailDriver.java | 35 ++
.../server/api/driver/MockQueryContext.java | 33 ++
lens-server/pom.xml | 8 +-
13 files changed, 480 insertions(+), 434 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/803c444b/lens-cli/pom.xml
----------------------------------------------------------------------
diff --git a/lens-cli/pom.xml b/lens-cli/pom.xml
index 03b12ab..0e96d16 100644
--- a/lens-cli/pom.xml
+++ b/lens-cli/pom.xml
@@ -124,7 +124,13 @@
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
</dependency>
-
+ <dependency>
+ <groupId>org.apache.lens</groupId>
+ <artifactId>lens-server-api</artifactId>
+ <type>test-jar</type>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/803c444b/lens-client/pom.xml
----------------------------------------------------------------------
diff --git a/lens-client/pom.xml b/lens-client/pom.xml
index c28ad58..f471d5f 100644
--- a/lens-client/pom.xml
+++ b/lens-client/pom.xml
@@ -122,6 +122,13 @@
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-common</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.lens</groupId>
+ <artifactId>lens-server-api</artifactId>
+ <type>test-jar</type>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/803c444b/lens-cube/pom.xml
----------------------------------------------------------------------
diff --git a/lens-cube/pom.xml b/lens-cube/pom.xml
index 2a461d1..1bcb4dc 100644
--- a/lens-cube/pom.xml
+++ b/lens-cube/pom.xml
@@ -68,6 +68,13 @@
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-mapreduce-client-core</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.lens</groupId>
+ <artifactId>lens-server-api</artifactId>
+ <type>test-jar</type>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/803c444b/lens-driver-hive/pom.xml
----------------------------------------------------------------------
diff --git a/lens-driver-hive/pom.xml b/lens-driver-hive/pom.xml
index f030251..0e36660 100644
--- a/lens-driver-hive/pom.xml
+++ b/lens-driver-hive/pom.xml
@@ -123,6 +123,13 @@
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-mapreduce-client-common</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.lens</groupId>
+ <artifactId>lens-server-api</artifactId>
+ <type>test-jar</type>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/803c444b/lens-ml-lib/pom.xml
----------------------------------------------------------------------
diff --git a/lens-ml-lib/pom.xml b/lens-ml-lib/pom.xml
index f9e7e0f..2440f40 100644
--- a/lens-ml-lib/pom.xml
+++ b/lens-ml-lib/pom.xml
@@ -41,11 +41,17 @@
<dependencies>
<dependency>
- <groupId>org.apache.lens</groupId>
+ <groupId>org.apache.lens</groupId>
<artifactId>lens-server-api</artifactId>
<version>${project.version}</version>
</dependency>
-
+ <dependency>
+ <groupId>org.apache.lens</groupId>
+ <artifactId>lens-server-api</artifactId>
+ <type>test-jar</type>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>org.apache.lens</groupId>
<artifactId>lens-api</artifactId>
http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/803c444b/lens-query-lib/pom.xml
----------------------------------------------------------------------
diff --git a/lens-query-lib/pom.xml b/lens-query-lib/pom.xml
index 10b826a..4be4e3c 100644
--- a/lens-query-lib/pom.xml
+++ b/lens-query-lib/pom.xml
@@ -41,6 +41,13 @@
<version>${project.version}</version>
</dependency>
<dependency>
+ <groupId>org.apache.lens</groupId>
+ <artifactId>lens-server-api</artifactId>
+ <type>test-jar</type>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-common</artifactId>
</dependency>
http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/803c444b/lens-server-api/src/main/java/org/apache/lens/server/api/driver/MockDriver.java
----------------------------------------------------------------------
diff --git a/lens-server-api/src/main/java/org/apache/lens/server/api/driver/MockDriver.java b/lens-server-api/src/main/java/org/apache/lens/server/api/driver/MockDriver.java
deleted file mode 100644
index 341824e..0000000
--- a/lens-server-api/src/main/java/org/apache/lens/server/api/driver/MockDriver.java
+++ /dev/null
@@ -1,362 +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.lens.server.api.driver;
-
-import lombok.Getter;
-import lombok.Setter;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hive.service.cli.ColumnDescriptor;
-import org.apache.lens.api.LensException;
-import org.apache.lens.api.query.QueryCost;
-import org.apache.lens.api.query.QueryHandle;
-import org.apache.lens.api.query.QueryPrepareHandle;
-import org.apache.lens.api.query.ResultRow;
-import org.apache.lens.server.api.driver.DriverQueryStatus.DriverQueryState;
-import org.apache.lens.server.api.events.LensEventListener;
-import org.apache.lens.server.api.query.PreparedQueryContext;
-import org.apache.lens.server.api.query.QueryContext;
-
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-
-/**
- * The Class MockDriver.
- */
-public class MockDriver implements LensDriver {
-
- /**
- * The conf.
- */
- Configuration conf;
-
- /**
- * The query.
- */
- String query;
-
- /**
- * The io test val.
- */
- private int ioTestVal = -1;
-
- /**
- * Instantiates a new mock driver.
- */
- public MockDriver() {
- }
-
- @Override
- public Configuration getConf() {
- return conf;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.lens.server.api.driver.LensDriver#configure(org.apache.hadoop.conf.Configuration)
- */
- @Override
- public void configure(Configuration conf) throws LensException {
- this.conf = conf;
- ioTestVal = conf.getInt("mock.driver.test.val", -1);
- }
-
- /**
- * The Class MockQueryPlan.
- */
- public static class MockQueryPlan extends DriverQueryPlan {
-
- /**
- * The query.
- */
- String query;
-
- /**
- * Instantiates a new mock query plan.
- *
- * @param query the query
- */
- MockQueryPlan(String query) {
- this.query = query;
- setPrepareHandle(new QueryPrepareHandle(UUID.randomUUID()));
- tableWeights.put("table1", 1.0);
- tableWeights.put("table2", 2.0);
- tableWeights.put("table3", 3.0);
- }
-
- @Getter
- @Setter
- private Map<String, List<String>> partitions;
-
- @Override
- public String getPlan() {
- return query;
- }
-
- @Override
- public QueryCost getCost() {
- return new QueryCost(0L, 0.0);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.lens.server.api.driver.LensDriver#explain(java.lang.String,
- * org.apache.hadoop.conf.Configuration)
- */
- @Override
- public DriverQueryPlan explain(String query, Configuration conf) throws LensException {
- return new MockQueryPlan(query);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.lens.server.api.driver.LensDriver#updateStatus(org.apache.lens.server.api.query.QueryContext)
- */
- @Override
- public void updateStatus(QueryContext context) throws LensException {
- context.getDriverStatus().setProgress(1.0);
- context.getDriverStatus().setStatusMessage("Done");
- context.getDriverStatus().setState(DriverQueryState.SUCCESSFUL);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.lens.server.api.driver.LensDriver#cancelQuery(org.apache.lens.api.query.QueryHandle)
- */
- @Override
- public boolean cancelQuery(QueryHandle handle) throws LensException {
- return false;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.lens.server.api.driver.LensDriver#closeQuery(org.apache.lens.api.query.QueryHandle)
- */
- @Override
- public void closeQuery(QueryHandle handle) throws LensException {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.lens.server.api.driver.LensDriver#close()
- */
- @Override
- public void close() throws LensException {
- }
-
- /**
- * Add a listener for driver events.
- *
- * @param driverEventListener the driver event listener
- */
- @Override
- public void registerDriverEventListener(LensEventListener<DriverEvent> driverEventListener) {
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.lens.server.api.driver.LensDriver#prepare(org.apache.lens.server.api.query.PreparedQueryContext)
- */
- @Override
- public void prepare(PreparedQueryContext pContext) throws LensException {
- // TODO Auto-generated method stub
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.lens.server.api.driver.LensDriver
- * #explainAndPrepare(org.apache.lens.server.api.query.PreparedQueryContext)
- */
- @Override
- public DriverQueryPlan explainAndPrepare(PreparedQueryContext pContext) throws LensException {
- DriverQueryPlan p = new MockQueryPlan(pContext.getSelectedDriverQuery());
- p.setPrepareHandle(pContext.getPrepareHandle());
- return p;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.lens.server.api.driver.LensDriver#closePreparedQuery(org.apache.lens.api.query.QueryPrepareHandle)
- */
- @Override
- public void closePreparedQuery(QueryPrepareHandle handle) throws LensException {
- // TODO Auto-generated method stub
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.lens.server.api.driver.LensDriver#execute(org.apache.lens.server.api.query.QueryContext)
- */
- @Override
- public LensResultSet execute(QueryContext context) throws LensException {
- this.query = context.getSelectedDriverQuery();
- return new PersistentResultSet() {
-
- @Override
- public int size() throws LensException {
- // TODO Auto-generated method stub
- return 0;
- }
-
- @Override
- public LensResultSetMetadata getMetadata() throws LensException {
- // TODO Auto-generated method stub
- return new LensResultSetMetadata() {
-
- @Override
- public List<ColumnDescriptor> getColumns() {
- // TODO Auto-generated method stub
- return null;
- }
- };
- }
-
- @Override
- public String getOutputPath() throws LensException {
- // TODO Auto-generated method stub
- return null;
- }
- };
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.lens.server.api.driver.LensDriver#executeAsync(org.apache.lens.server.api.query.QueryContext)
- */
- @Override
- public void executeAsync(QueryContext context) throws LensException {
- this.query = context.getSelectedDriverQuery();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.lens.server.api.driver.LensDriver#fetchResultSet(org.apache.lens.server.api.query.QueryContext)
- */
- @Override
- public LensResultSet fetchResultSet(QueryContext context) throws LensException {
- return new InMemoryResultSet() {
-
- @Override
- public int size() throws LensException {
- // TODO Auto-generated method stub
- return 0;
- }
-
- @Override
- public LensResultSetMetadata getMetadata() throws LensException {
- return new LensResultSetMetadata() {
-
- @Override
- public List<ColumnDescriptor> getColumns() {
- // TODO Auto-generated method stub
- return null;
- }
- };
- }
-
- @Override
- public void setFetchSize(int size) throws LensException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public ResultRow next() throws LensException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public boolean hasNext() throws LensException {
- // TODO Auto-generated method stub
- return false;
- }
- };
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.lens.server.api.driver.LensDriver#closeResultSet(org.apache.lens.api.query.QueryHandle)
- */
- @Override
- public void closeResultSet(QueryHandle handle) throws LensException {
- // TODO Auto-generated method stub
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.lens.server.api.driver.LensDriver#registerForCompletionNotification
- * (org.apache.lens.api.query.QueryHandle, long, org.apache.lens.server.api.driver.QueryCompletionListener)
- */
- @Override
- public void registerForCompletionNotification(QueryHandle handle,
- long timeoutMillis, QueryCompletionListener listener)
- throws LensException {
- // TODO Auto-generated method stub
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.io.Externalizable#readExternal(java.io.ObjectInput)
- */
- @Override
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- ioTestVal = in.readInt();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.io.Externalizable#writeExternal(java.io.ObjectOutput)
- */
- @Override
- public void writeExternal(ObjectOutput out) throws IOException {
- out.writeInt(ioTestVal);
- }
-
- public int getTestIOVal() {
- return ioTestVal;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/803c444b/lens-server-api/src/main/java/org/apache/lens/server/api/driver/MockFailDriver.java
----------------------------------------------------------------------
diff --git a/lens-server-api/src/main/java/org/apache/lens/server/api/driver/MockFailDriver.java b/lens-server-api/src/main/java/org/apache/lens/server/api/driver/MockFailDriver.java
deleted file mode 100644
index 7ed2fd0..0000000
--- a/lens-server-api/src/main/java/org/apache/lens/server/api/driver/MockFailDriver.java
+++ /dev/null
@@ -1,35 +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.lens.server.api.driver;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.lens.api.LensException;
-
-
-public class MockFailDriver extends MockDriver {
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.lens.server.api.driver.MockDriver#explain(java.lang.String, org.apache.hadoop.conf.Configuration)
- */
- public DriverQueryPlan explain(String query, Configuration conf) throws LensException {
- throw new LensException("failing!");
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/803c444b/lens-server-api/src/main/java/org/apache/lens/server/api/driver/MockQueryContext.java
----------------------------------------------------------------------
diff --git a/lens-server-api/src/main/java/org/apache/lens/server/api/driver/MockQueryContext.java b/lens-server-api/src/main/java/org/apache/lens/server/api/driver/MockQueryContext.java
deleted file mode 100644
index 749ef60..0000000
--- a/lens-server-api/src/main/java/org/apache/lens/server/api/driver/MockQueryContext.java
+++ /dev/null
@@ -1,33 +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.lens.server.api.driver;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.lens.api.LensConf;
-import org.apache.lens.server.api.query.AbstractQueryContext;
-
-import java.util.Collection;
-
-public class MockQueryContext extends AbstractQueryContext {
-
- public MockQueryContext(final String query, final LensConf qconf,
- final Configuration conf, final Collection<LensDriver> drivers) {
- super(query, qconf, conf, drivers);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/803c444b/lens-server-api/src/test/java/org/apache/lens/server/api/driver/MockDriver.java
----------------------------------------------------------------------
diff --git a/lens-server-api/src/test/java/org/apache/lens/server/api/driver/MockDriver.java b/lens-server-api/src/test/java/org/apache/lens/server/api/driver/MockDriver.java
new file mode 100644
index 0000000..def1d63
--- /dev/null
+++ b/lens-server-api/src/test/java/org/apache/lens/server/api/driver/MockDriver.java
@@ -0,0 +1,362 @@
+/**
+ * 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.api.driver;
+
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hive.service.cli.ColumnDescriptor;
+import org.apache.lens.api.LensException;
+import org.apache.lens.api.query.QueryCost;
+import org.apache.lens.api.query.QueryHandle;
+import org.apache.lens.api.query.QueryPrepareHandle;
+import org.apache.lens.api.query.ResultRow;
+import org.apache.lens.server.api.driver.DriverQueryStatus.DriverQueryState;
+import org.apache.lens.server.api.events.LensEventListener;
+import org.apache.lens.server.api.query.PreparedQueryContext;
+import org.apache.lens.server.api.query.QueryContext;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+/**
+ * The Class MockDriver.
+ */
+public class MockDriver implements LensDriver {
+
+ /**
+ * The conf.
+ */
+ Configuration conf;
+
+ /**
+ * The query.
+ */
+ String query;
+
+ /**
+ * The io test val.
+ */
+ private int ioTestVal = -1;
+
+ /**
+ * Instantiates a new mock driver.
+ */
+ public MockDriver() {
+ }
+
+ @Override
+ public Configuration getConf() {
+ return conf;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.lens.server.api.driver.LensDriver#configure(org.apache.hadoop.conf.Configuration)
+ */
+ @Override
+ public void configure(Configuration conf) throws LensException {
+ this.conf = conf;
+ ioTestVal = conf.getInt("mock.driver.test.val", -1);
+ }
+
+ /**
+ * The Class MockQueryPlan.
+ */
+ public static class MockQueryPlan extends DriverQueryPlan {
+
+ /**
+ * The query.
+ */
+ String query;
+
+ /**
+ * Instantiates a new mock query plan.
+ *
+ * @param query the query
+ */
+ MockQueryPlan(String query) {
+ this.query = query;
+ setPrepareHandle(new QueryPrepareHandle(UUID.randomUUID()));
+ tableWeights.put("table1", 1.0);
+ tableWeights.put("table2", 2.0);
+ tableWeights.put("table3", 3.0);
+ }
+
+ @Getter
+ @Setter
+ private Map<String, List<String>> partitions;
+
+ @Override
+ public String getPlan() {
+ return query;
+ }
+
+ @Override
+ public QueryCost getCost() {
+ return new QueryCost(0L, 0.0);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.lens.server.api.driver.LensDriver#explain(java.lang.String,
+ * org.apache.hadoop.conf.Configuration)
+ */
+ @Override
+ public DriverQueryPlan explain(String query, Configuration conf) throws LensException {
+ return new MockQueryPlan(query);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.lens.server.api.driver.LensDriver#updateStatus(org.apache.lens.server.api.query.QueryContext)
+ */
+ @Override
+ public void updateStatus(QueryContext context) throws LensException {
+ context.getDriverStatus().setProgress(1.0);
+ context.getDriverStatus().setStatusMessage("Done");
+ context.getDriverStatus().setState(DriverQueryState.SUCCESSFUL);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.lens.server.api.driver.LensDriver#cancelQuery(org.apache.lens.api.query.QueryHandle)
+ */
+ @Override
+ public boolean cancelQuery(QueryHandle handle) throws LensException {
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.lens.server.api.driver.LensDriver#closeQuery(org.apache.lens.api.query.QueryHandle)
+ */
+ @Override
+ public void closeQuery(QueryHandle handle) throws LensException {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.lens.server.api.driver.LensDriver#close()
+ */
+ @Override
+ public void close() throws LensException {
+ }
+
+ /**
+ * Add a listener for driver events.
+ *
+ * @param driverEventListener the driver event listener
+ */
+ @Override
+ public void registerDriverEventListener(LensEventListener<DriverEvent> driverEventListener) {
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.lens.server.api.driver.LensDriver#prepare(org.apache.lens.server.api.query.PreparedQueryContext)
+ */
+ @Override
+ public void prepare(PreparedQueryContext pContext) throws LensException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.lens.server.api.driver.LensDriver
+ * #explainAndPrepare(org.apache.lens.server.api.query.PreparedQueryContext)
+ */
+ @Override
+ public DriverQueryPlan explainAndPrepare(PreparedQueryContext pContext) throws LensException {
+ DriverQueryPlan p = new MockQueryPlan(pContext.getSelectedDriverQuery());
+ p.setPrepareHandle(pContext.getPrepareHandle());
+ return p;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.lens.server.api.driver.LensDriver#closePreparedQuery(org.apache.lens.api.query.QueryPrepareHandle)
+ */
+ @Override
+ public void closePreparedQuery(QueryPrepareHandle handle) throws LensException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.lens.server.api.driver.LensDriver#execute(org.apache.lens.server.api.query.QueryContext)
+ */
+ @Override
+ public LensResultSet execute(QueryContext context) throws LensException {
+ this.query = context.getSelectedDriverQuery();
+ return new PersistentResultSet() {
+
+ @Override
+ public int size() throws LensException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public LensResultSetMetadata getMetadata() throws LensException {
+ // TODO Auto-generated method stub
+ return new LensResultSetMetadata() {
+
+ @Override
+ public List<ColumnDescriptor> getColumns() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+ };
+ }
+
+ @Override
+ public String getOutputPath() throws LensException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+ };
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.lens.server.api.driver.LensDriver#executeAsync(org.apache.lens.server.api.query.QueryContext)
+ */
+ @Override
+ public void executeAsync(QueryContext context) throws LensException {
+ this.query = context.getSelectedDriverQuery();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.lens.server.api.driver.LensDriver#fetchResultSet(org.apache.lens.server.api.query.QueryContext)
+ */
+ @Override
+ public LensResultSet fetchResultSet(QueryContext context) throws LensException {
+ return new InMemoryResultSet() {
+
+ @Override
+ public int size() throws LensException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public LensResultSetMetadata getMetadata() throws LensException {
+ return new LensResultSetMetadata() {
+
+ @Override
+ public List<ColumnDescriptor> getColumns() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+ };
+ }
+
+ @Override
+ public void setFetchSize(int size) throws LensException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public ResultRow next() throws LensException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean hasNext() throws LensException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+ };
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.lens.server.api.driver.LensDriver#closeResultSet(org.apache.lens.api.query.QueryHandle)
+ */
+ @Override
+ public void closeResultSet(QueryHandle handle) throws LensException {
+ // TODO Auto-generated method stub
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.lens.server.api.driver.LensDriver#registerForCompletionNotification
+ * (org.apache.lens.api.query.QueryHandle, long, org.apache.lens.server.api.driver.QueryCompletionListener)
+ */
+ @Override
+ public void registerForCompletionNotification(QueryHandle handle,
+ long timeoutMillis, QueryCompletionListener listener)
+ throws LensException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.io.Externalizable#readExternal(java.io.ObjectInput)
+ */
+ @Override
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ ioTestVal = in.readInt();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.io.Externalizable#writeExternal(java.io.ObjectOutput)
+ */
+ @Override
+ public void writeExternal(ObjectOutput out) throws IOException {
+ out.writeInt(ioTestVal);
+ }
+
+ public int getTestIOVal() {
+ return ioTestVal;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/803c444b/lens-server-api/src/test/java/org/apache/lens/server/api/driver/MockFailDriver.java
----------------------------------------------------------------------
diff --git a/lens-server-api/src/test/java/org/apache/lens/server/api/driver/MockFailDriver.java b/lens-server-api/src/test/java/org/apache/lens/server/api/driver/MockFailDriver.java
new file mode 100644
index 0000000..7ed2fd0
--- /dev/null
+++ b/lens-server-api/src/test/java/org/apache/lens/server/api/driver/MockFailDriver.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.api.driver;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.lens.api.LensException;
+
+
+public class MockFailDriver extends MockDriver {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.lens.server.api.driver.MockDriver#explain(java.lang.String, org.apache.hadoop.conf.Configuration)
+ */
+ public DriverQueryPlan explain(String query, Configuration conf) throws LensException {
+ throw new LensException("failing!");
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/803c444b/lens-server-api/src/test/java/org/apache/lens/server/api/driver/MockQueryContext.java
----------------------------------------------------------------------
diff --git a/lens-server-api/src/test/java/org/apache/lens/server/api/driver/MockQueryContext.java b/lens-server-api/src/test/java/org/apache/lens/server/api/driver/MockQueryContext.java
new file mode 100644
index 0000000..749ef60
--- /dev/null
+++ b/lens-server-api/src/test/java/org/apache/lens/server/api/driver/MockQueryContext.java
@@ -0,0 +1,33 @@
+/**
+ * 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.api.driver;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.lens.api.LensConf;
+import org.apache.lens.server.api.query.AbstractQueryContext;
+
+import java.util.Collection;
+
+public class MockQueryContext extends AbstractQueryContext {
+
+ public MockQueryContext(final String query, final LensConf qconf,
+ final Configuration conf, final Collection<LensDriver> drivers) {
+ super(query, qconf, conf, drivers);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/803c444b/lens-server/pom.xml
----------------------------------------------------------------------
diff --git a/lens-server/pom.xml b/lens-server/pom.xml
index 9a8fb7d..eee6123 100644
--- a/lens-server/pom.xml
+++ b/lens-server/pom.xml
@@ -210,7 +210,13 @@
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
</dependency>
-
+ <dependency>
+ <groupId>org.apache.lens</groupId>
+ <artifactId>lens-server-api</artifactId>
+ <type>test-jar</type>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>