mrutkows closed pull request #3624: Replace WALA Pair with clean new Pair. URL: https://github.com/apache/incubator-openwhisk/pull/3624
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/tests/src/test/scala/common/Pair.java b/tests/src/test/scala/common/Pair.java index 0853f49a0e..e31f46c53c 100644 --- a/tests/src/test/scala/common/Pair.java +++ b/tests/src/test/scala/common/Pair.java @@ -15,87 +15,14 @@ * limitations under the License. */ -/******************************************************************************* - * Copyright (c) 2002 - 2006 IBM Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ package common; -import java.util.Iterator; -import java.util.NoSuchElementException; - -public class Pair<T, U> { - - public final T fst; - public final U snd; - - protected Pair(T fst, U snd) { - this.fst = fst; - this.snd = snd; - } - - private boolean check(Object x, Object y) { - return (x == null) ? (y == null) : x.equals(y); - } - - @SuppressWarnings("rawtypes") - @Override - public boolean equals(Object o) { - return (o instanceof Pair) && check(fst, ((Pair) o).fst) - && check(snd, ((Pair) o).snd); - } - - private int hc(Object o) { - return (o == null) ? 0 : o.hashCode(); - } - - @Override - public int hashCode() { - return hc(fst) * 7219 + hc(snd); - } - - public Iterator<Object> iterator() { - return new Iterator<Object>() { - byte next = 1; - - @Override - public boolean hasNext() { - return next > 0; - } - - @Override - public Object next() { - switch (next) { - case 1: - next++; - return fst; - case 2: - next = 0; - return snd; - default: - throw new NoSuchElementException(); - } - } - - @Override - public void remove() { - assert false; - } - }; - } - - @Override - public String toString() { - return "[" + fst + "," + snd + "]"; - } +public class Pair { + public final String fst; + public final String snd; - public static <T, U> Pair<T, U> make(T x, U y) { - return new Pair<T, U>(x, y); + public Pair(String a, String b) { + this.fst = a; + this.snd = b; } } diff --git a/tests/src/test/scala/common/TestUtils.java b/tests/src/test/scala/common/TestUtils.java index 0042445469..4c379e9d50 100644 --- a/tests/src/test/scala/common/TestUtils.java +++ b/tests/src/test/scala/common/TestUtils.java @@ -218,8 +218,8 @@ protected RunResult(int exitCode, String stdout, String stderr) { this.stderr = stderr; } - public Pair<String, String> logs() { - return Pair.make(stdout, stderr); + public Pair logs() { + return new Pair(stdout, stderr); } public void validateExitCode(int expectedExitCode) { diff --git a/tests/src/test/scala/common/WhiskProperties.java b/tests/src/test/scala/common/WhiskProperties.java index d8897bca5b..08a206948d 100644 --- a/tests/src/test/scala/common/WhiskProperties.java +++ b/tests/src/test/scala/common/WhiskProperties.java @@ -254,12 +254,12 @@ public static int getMaxActionInvokesPerMinute() { * read the contents of auth key file and return as a Pair * <username,password> */ - public static Pair<String, String> getBasicAuth() { + public static Pair getBasicAuth() { File f = getAuthFileForTesting(); String contents = readAuthKey(f); String[] parts = contents.split(":"); assert parts.length == 2; - return Pair.make(parts[0], parts[1]); + return new Pair(parts[0], parts[1]); } /** ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services