You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2018/05/08 18:41:04 UTC

[GitHub] jasonpet closed pull request #171: Remove reference to Pair and replace with bespoke class.

jasonpet closed pull request #171: Remove reference to Pair and replace with bespoke class.
URL: https://github.com/apache/incubator-openwhisk-package-cloudant/pull/171
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/.gitignore b/.gitignore
index ede5a15..4f86fab 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,6 @@
 .gradle
 build/
 node_modules/
-action/*.zip
\ No newline at end of file
+action/*.zip
+.idea
+*.iml
diff --git a/tests/src/test/scala/system/CloudantUtil.java b/tests/src/test/scala/system/CloudantUtil.java
index 7776203..a8c9c61 100755
--- a/tests/src/test/scala/system/CloudantUtil.java
+++ b/tests/src/test/scala/system/CloudantUtil.java
@@ -20,7 +20,6 @@
 import com.cloudant.client.api.Database;
 import com.google.gson.*;
 import com.jayway.restassured.response.Response;
-import common.Pair;
 import common.TestUtils;
 
 import java.io.*;
@@ -53,9 +52,18 @@
     public static final File VIEW_AND_SEARCH_DDOC_PATH = getFileRelativeToCloudantHome("tests/dat/searchdesigndoc.txt");
     public static final File FILTER_DDOC_PATH = getFileRelativeToCloudantHome("tests/dat/filterdesigndoc.txt");
 
-
     private static Gson gson = new Gson();
 
+    private static class ResponsePair {
+        public final Integer fst;
+        public final JsonObject snd;
+
+        public ResponsePair(Integer a, JsonObject b) {
+            this.fst = a;
+            this.snd = b;
+        }
+    }
+
     public static class Credential {
         public final String user;
         public final String password;
@@ -96,7 +104,7 @@ public static void setUp(Credential credential) throws Exception {
         deleteTestDatabase(credential);
         for (int i = 0; i < 5; i++) {
             try {
-                Pair<Integer, JsonObject> response = CloudantUtil.createTestDatabase(credential, false);
+                ResponsePair response = CloudantUtil.createTestDatabase(credential, false);
                 if (response.fst == 201)
                     return;
                 // respond code is sometimes not 201 but still ok
@@ -147,11 +155,11 @@ public static JsonObject deleteTestDatabase(Credential credential, String dbName
      *
      * @throws UnsupportedEncodingException
      */
-    public static Pair<Integer, JsonObject> createTestDatabase(Credential credential) throws UnsupportedEncodingException {
+    public static ResponsePair createTestDatabase(Credential credential) throws UnsupportedEncodingException {
         return createTestDatabase(credential, true);
     }
 
-    private static Pair<Integer, JsonObject> createTestDatabase(Credential credential, boolean failIfCannotCreate) throws UnsupportedEncodingException {
+    private static ResponsePair createTestDatabase(Credential credential, boolean failIfCannotCreate) throws UnsupportedEncodingException {
         // Use PUT to create the database.
         // This could fail if the database already exists, but that's ok.
         String dbName = credential.dbname;
@@ -160,7 +168,7 @@ public static JsonObject deleteTestDatabase(Credential credential, String dbName
         System.out.format("Response of create database %s: %s\n", dbName, response.asString());
         if (failIfCannotCreate)
             assertTrue("failed to create database " + dbName, response.statusCode() == 201 || response.statusCode() == 202);
-        return Pair.make(response.statusCode(), (JsonObject) new JsonParser().parse(response.asString()));
+        return new ResponsePair(response.statusCode(), (JsonObject) new JsonParser().parse(response.asString()));
     }
 
     /**


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services