From 7e19b7542447564b47f1e30026e9cf131fa0c8eb Mon Sep 17 00:00:00 2001
From: Ilya Suntsov <isuntsov@gridgain.com>
Date: Sat, 14 Jul 2018 19:15:29 +0300
Subject: [PATCH] [ignite, ignite-sql] clean up for apache ignite clients

Closes #1183
Closes #1189
---
 ignite/README.md                              |  4 ++--
 .../ycsb/db/ignite/IgniteAbstractClient.java  | 21 +++++++++++++++----
 .../yahoo/ycsb/db/ignite/IgniteClient.java    | 13 +++++++-----
 .../yahoo/ycsb/db/ignite/IgniteSqlClient.java |  6 +-----
 ignite/src/main/resources/log4j2.xml          | 17 +++++++++++++++
 .../db/ignite/IgniteClientCommonTest.java     | 17 +++++++++++++++
 .../ycsb/db/ignite/IgniteClientTest.java      |  2 +-
 .../ycsb/db/ignite/IgniteSqlClientTest.java   |  2 +-
 8 files changed, 64 insertions(+), 18 deletions(-)

diff --git a/ignite/README.md b/ignite/README.md
index 4fb9e62f..991c0fde 100644
--- a/ignite/README.md
+++ b/ignite/README.md
@@ -51,7 +51,7 @@ Load the data:
          > outputload.txt
 Note: '10.0.0.1' is ip address of one of hosts where was started Apache Ignite nodes.
 
-Run the workload test with IgniteClient:
+Run the workload test with ignite:
 
     .bin/ycsb run ignite -p hosts="10.0.0.1"
          -s -P workloads/workloada \
@@ -60,7 +60,7 @@ Run the workload test with IgniteClient:
          -p recordcount=100000 \
           > outputload.txt
 
-Run the workload test with IgniteSqlClient:
+Run the workload test with ignite-sql:
 
     .bin/ycsb run ignite-sql -p hosts="10.0.0.1"
          -s -P workloads/workloada \
diff --git a/ignite/src/main/java/com/yahoo/ycsb/db/ignite/IgniteAbstractClient.java b/ignite/src/main/java/com/yahoo/ycsb/db/ignite/IgniteAbstractClient.java
index fe9518ca..7a48b2bb 100644
--- a/ignite/src/main/java/com/yahoo/ycsb/db/ignite/IgniteAbstractClient.java
+++ b/ignite/src/main/java/com/yahoo/ycsb/db/ignite/IgniteAbstractClient.java
@@ -1,3 +1,20 @@
+/**
+ * Copyright (c) 2013-2018 YCSB contributors. All rights reserved.
+ * <p>
+ * Licensed 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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. See accompanying LICENSE file.
+ * <p>
+ */
+
 package com.yahoo.ycsb.db.ignite;
 
 import com.yahoo.ycsb.DB;
@@ -22,10 +39,6 @@ import org.apache.logging.log4j.Logger;
  * Ignite abstract client.
  * <p>
  * See {@code ignite/README.md} for details.
- *
- * @author Sergey Puchnin
- * @author Taras Ledkov
- * @author Oleg Ostanin
  */
 public abstract class IgniteAbstractClient extends DB {
   /** */
diff --git a/ignite/src/main/java/com/yahoo/ycsb/db/ignite/IgniteClient.java b/ignite/src/main/java/com/yahoo/ycsb/db/ignite/IgniteClient.java
index e61fa618..a7bc37db 100644
--- a/ignite/src/main/java/com/yahoo/ycsb/db/ignite/IgniteClient.java
+++ b/ignite/src/main/java/com/yahoo/ycsb/db/ignite/IgniteClient.java
@@ -37,10 +37,6 @@ import org.apache.logging.log4j.Logger;
  * Ignite client.
  * <p>
  * See {@code ignite/README.md} for details.
- *
- * @author Sergey Puchnin
- * @author Taras Ledkov
- * @author Oleg Ostanin
  */
 public class IgniteClient extends IgniteAbstractClient {
   /** */
@@ -124,7 +120,14 @@ public class IgniteClient extends IgniteAbstractClient {
   @Override
   public Status scan(String table, String startkey, int recordcount,
                      Set<String> fields, Vector<HashMap<String, ByteIterator>> result) {
-    throw new UnsupportedOperationException("Scan method isn't implemented");
+    try {
+      return Status.OK;
+
+    } catch (Exception e) {
+      log.error(String.format("Error scanning with startkey: %s", startkey), e);
+
+      return Status.NOT_IMPLEMENTED;
+    }
   }
 
   /**
diff --git a/ignite/src/main/java/com/yahoo/ycsb/db/ignite/IgniteSqlClient.java b/ignite/src/main/java/com/yahoo/ycsb/db/ignite/IgniteSqlClient.java
index 8a3222e5..adeb717b 100644
--- a/ignite/src/main/java/com/yahoo/ycsb/db/ignite/IgniteSqlClient.java
+++ b/ignite/src/main/java/com/yahoo/ycsb/db/ignite/IgniteSqlClient.java
@@ -31,10 +31,6 @@ import org.apache.logging.log4j.Logger;
  * Ignite client.
  * <p>
  * See {@code ignite/README.md} for details.
- *
- * @author Sergey Puchnin
- * @author Taras Ledkov
- * @author Oleg Ostanin
  */
 public class IgniteSqlClient extends IgniteAbstractClient {
   /** */
@@ -112,7 +108,7 @@ public class IgniteSqlClient extends IgniteAbstractClient {
     } catch (Exception e) {
       log.error(String.format("Error scanning with startkey: %s", startkey), e);
 
-      return Status.ERROR;
+      return Status.NOT_IMPLEMENTED;
     }
 
   }
diff --git a/ignite/src/main/resources/log4j2.xml b/ignite/src/main/resources/log4j2.xml
index a221422f..474c9458 100644
--- a/ignite/src/main/resources/log4j2.xml
+++ b/ignite/src/main/resources/log4j2.xml
@@ -1,5 +1,22 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
+<!--
+   Copyright (c) 2018 YCSB contributors. All rights reserved.
+
+   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.
+ -->
+
 <Configuration status="INFO">
     <Appenders>
         <Console name="CONSOLE" target="SYSTEM_OUT">
diff --git a/ignite/src/test/java/com/yahoo/ycsb/db/ignite/IgniteClientCommonTest.java b/ignite/src/test/java/com/yahoo/ycsb/db/ignite/IgniteClientCommonTest.java
index a522124b..5cddc352 100644
--- a/ignite/src/test/java/com/yahoo/ycsb/db/ignite/IgniteClientCommonTest.java
+++ b/ignite/src/test/java/com/yahoo/ycsb/db/ignite/IgniteClientCommonTest.java
@@ -1,3 +1,20 @@
+/**
+ * Copyright (c) 2013-2018 YCSB contributors. All rights reserved.
+ * <p>
+ * Licensed 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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. See accompanying LICENSE file.
+ * <p>
+ */
+
 package com.yahoo.ycsb.db.ignite;
 
 import com.yahoo.ycsb.DB;
diff --git a/ignite/src/test/java/com/yahoo/ycsb/db/ignite/IgniteClientTest.java b/ignite/src/test/java/com/yahoo/ycsb/db/ignite/IgniteClientTest.java
index f14c5d7d..a8900d18 100644
--- a/ignite/src/test/java/com/yahoo/ycsb/db/ignite/IgniteClientTest.java
+++ b/ignite/src/test/java/com/yahoo/ycsb/db/ignite/IgniteClientTest.java
@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2015 YCSB contributors All rights reserved.
+ * Copyright (c) 2018 YCSB contributors All rights reserved.
  * <p>
  * Licensed under the Apache License, Version 2.0 (the "License"); you
  * may not use this file except in compliance with the License. You
diff --git a/ignite/src/test/java/com/yahoo/ycsb/db/ignite/IgniteSqlClientTest.java b/ignite/src/test/java/com/yahoo/ycsb/db/ignite/IgniteSqlClientTest.java
index 876ccbc3..d3dc0ba9 100644
--- a/ignite/src/test/java/com/yahoo/ycsb/db/ignite/IgniteSqlClientTest.java
+++ b/ignite/src/test/java/com/yahoo/ycsb/db/ignite/IgniteSqlClientTest.java
@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2015 YCSB contributors All rights reserved.
+ * Copyright (c) 2018 YCSB contributors All rights reserved.
  * <p>
  * Licensed under the Apache License, Version 2.0 (the "License"); you
  * may not use this file except in compliance with the License. You
-- 
GitLab