This is an automated email from the ASF dual-hosted git repository.
mrutkowski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk.git
The following commit(s) were added to refs/heads/master by this push:
new 7d9372f Replace WALA Pair with clean new Pair. (#3624)
7d9372f is described below
commit 7d9372f4ea7e49ad4dd691cba80526cc1c3e940c
Author: rodric rabbah <[email protected]>
AuthorDate: Tue May 8 12:24:17 2018 -0400
Replace WALA Pair with clean new Pair. (#3624)
---
tests/src/test/scala/common/Pair.java | 85 ++----------------------
tests/src/test/scala/common/TestUtils.java | 4 +-
tests/src/test/scala/common/WhiskProperties.java | 4 +-
3 files changed, 10 insertions(+), 83 deletions(-)
diff --git a/tests/src/test/scala/common/Pair.java
b/tests/src/test/scala/common/Pair.java
index 0853f49..e31f46c 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 0042445..4c379e9 100644
--- a/tests/src/test/scala/common/TestUtils.java
+++ b/tests/src/test/scala/common/TestUtils.java
@@ -218,8 +218,8 @@ public class TestUtils {
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 d8897bc..08a2069 100644
--- a/tests/src/test/scala/common/WhiskProperties.java
+++ b/tests/src/test/scala/common/WhiskProperties.java
@@ -254,12 +254,12 @@ public class WhiskProperties {
* 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]);
}
/**
--
To stop receiving notification emails like this one, please contact
[email protected].