Merge ChangeQuery and RemoteQuery into one RemoteApi class

Beside the change query we need to do some other REST calls. Having
one class per REST call is too much overhead. The other calls are no
queries, but normal REST requests, so rename RemoteQuery to
RemoteApi.

Change-Id: If6b87eb1688353a371ece6bbf6ac952fcb223fda
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
diff --git a/src/main/java/com/googlesource/gerrit/plugins/importer/ImportProjectTask.java b/src/main/java/com/googlesource/gerrit/plugins/importer/ImportProjectTask.java
index e4ae77c..616e3c0 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/importer/ImportProjectTask.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/importer/ImportProjectTask.java
@@ -247,7 +247,7 @@
   private void replayChanges() throws IOException, OrmException,
       NoSuchAccountException, NoSuchChangeException {
     List<ChangeInfo> changes =
-        new ChangeQuery(fromGerrit, user, password).query(name.get());
+        new RemoteApi(fromGerrit, user, password).queryChanges(name.get());
     ReviewDb db = schemaFactory.open();
     RevWalk rw = new RevWalk(repo);
     try {
diff --git a/src/main/java/com/googlesource/gerrit/plugins/importer/ChangeQuery.java b/src/main/java/com/googlesource/gerrit/plugins/importer/RemoteApi.java
similarity index 76%
rename from src/main/java/com/googlesource/gerrit/plugins/importer/ChangeQuery.java
rename to src/main/java/com/googlesource/gerrit/plugins/importer/RemoteApi.java
index 5c8fe20..d72362d 100755
--- a/src/main/java/com/googlesource/gerrit/plugins/importer/ChangeQuery.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/importer/RemoteApi.java
@@ -16,19 +16,22 @@
 
 import com.google.gerrit.extensions.client.ListChangesOption;
 import com.google.gerrit.extensions.common.ChangeInfo;
+import com.google.gerrit.server.OutputFormat;
+import com.google.gson.Gson;
 import com.google.gson.reflect.TypeToken;
 
 import java.io.IOException;
 import java.util.EnumSet;
 import java.util.List;
 
-public class ChangeQuery extends RemoteQuery {
+public class RemoteApi {
+  private final RestSession restSession;
 
-  ChangeQuery(String url, String user, String pass) {
-    super(url, user, pass);
+  RemoteApi(String url, String user, String pass) {
+    restSession = new RestSession(url, user, pass);
   }
 
-  public List<ChangeInfo> query(String projectName) throws IOException {
+  public List<ChangeInfo> queryChanges(String projectName) throws IOException {
     String endPoint =
         "/changes/?q=project:" + projectName +
         "&O=" + Integer.toHexString(ListChangesOption.toBits(
@@ -38,10 +41,14 @@
                 ListChangesOption.MESSAGES,
                 ListChangesOption.CURRENT_REVISION,
                 ListChangesOption.ALL_REVISIONS)));
-    RestResponse r = getRestSession().get(endPoint);
+    RestResponse r = restSession.get(endPoint);
     List<ChangeInfo> result =
         newGson().fromJson(r.getReader(),
             new TypeToken<List<ChangeInfo>>() {}.getType());
     return result;
   }
+
+  private static Gson newGson() {
+    return OutputFormat.JSON_COMPACT.newGson();
+  }
 }
diff --git a/src/main/java/com/googlesource/gerrit/plugins/importer/RemoteQuery.java b/src/main/java/com/googlesource/gerrit/plugins/importer/RemoteQuery.java
deleted file mode 100755
index a17453d..0000000
--- a/src/main/java/com/googlesource/gerrit/plugins/importer/RemoteQuery.java
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright (C) 2015 The Android Open Source Project
-//
-// 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
-//
-// 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 com.googlesource.gerrit.plugins.importer;
-
-import com.google.gerrit.server.OutputFormat;
-import com.google.gson.Gson;
-
-public class RemoteQuery {
-
-  private final RestSession restSession;
-
-  RemoteQuery(String url, String user, String pass) {
-    restSession = new RestSession(url, user, pass);
-  }
-
-  public RestSession getRestSession() {
-    return restSession;
-  }
-
-  protected static Gson newGson() {
-    return OutputFormat.JSON_COMPACT.newGson();
-  }
-}