From a7747c2525bc0815c01a896cb0dd8eba7adf5ce5 Mon Sep 17 00:00:00 2001 From: Mark Slee Date: Mon, 29 Jan 2007 17:35:54 +0000 Subject: [PATCH] Fix HashMap => AbstractMap conversions in Java test thrift code git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664955 13f79535-47bb-0310-9956-ffa450edef68 --- test/java/src/TestClient.java | 13 +++++++------ test/java/src/TestServer.java | 17 +++++++++-------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/test/java/src/TestClient.java b/test/java/src/TestClient.java index 7e2e49e5..bc950364 100644 --- a/test/java/src/TestClient.java +++ b/test/java/src/TestClient.java @@ -10,6 +10,7 @@ import com.facebook.thrift.transport.TFramedTransport; import com.facebook.thrift.transport.TTransportException; import com.facebook.thrift.protocol.TBinaryProtocol; +import java.util.AbstractMap; import java.util.HashMap; import java.util.HashSet; import java.util.ArrayList; @@ -176,7 +177,7 @@ public class TestClient { System.out.print(key + " => " + mapout.get(key)); } System.out.print("})"); - HashMap mapin = testClient.testMap(mapout); + AbstractMap mapin = testClient.testMap(mapout); System.out.print(" = {"); first = true; for (int key : mapin.keySet()) { @@ -285,12 +286,12 @@ public class TestClient { * NESTED MAP TEST */ System.out.print("testMapMap(1)"); - HashMap> mm = + AbstractMap> mm = testClient.testMapMap(1); System.out.print(" = {"); for (int key : mm.keySet()) { System.out.print(key + " => {"); - HashMap m2 = mm.get(key); + AbstractMap m2 = mm.get(key); for (int k2 : m2.keySet()) { System.out.print(k2 + " => " + m2.get(k2) + ", "); } @@ -310,17 +311,17 @@ public class TestClient { truck.i64_thing = 8; insane.xtructs.add(truck); System.out.print("testInsanity()"); - HashMap> whoa = + AbstractMap> whoa = testClient.testInsanity(insane); System.out.print(" = {"); for (long key : whoa.keySet()) { - HashMap val = whoa.get(key); + AbstractMap val = whoa.get(key); System.out.print(key + " => {"); for (int k2 : val.keySet()) { Insanity v2 = val.get(k2); System.out.print(k2 + " => {"); - HashMap userMap = v2.userMap; + AbstractMap userMap = v2.userMap; System.out.print("{"); for (int k3 : userMap.keySet()) { System.out.print(k3 + " => " + userMap.get(k3) + ", "); diff --git a/test/java/src/TestServer.java b/test/java/src/TestServer.java index bf3f685c..d89ea210 100644 --- a/test/java/src/TestServer.java +++ b/test/java/src/TestServer.java @@ -14,6 +14,7 @@ import thrift.test.*; import java.net.ServerSocket; import java.util.ArrayList; +import java.util.AbstractMap; import java.util.HashMap; import java.util.HashSet; @@ -73,7 +74,7 @@ public class TestServer { return nest; } - public HashMap testMap(HashMap thing) { + public AbstractMap testMap(AbstractMap thing) { System.out.print("testMap({"); boolean first = true; for (int key : thing.keySet()) { @@ -128,10 +129,10 @@ public class TestServer { return thing; } - public HashMap> testMapMap(int hello) { + public AbstractMap> testMapMap(int hello) { System.out.print("testMapMap(" + hello + ")\n"); - HashMap> mapmap = - new HashMap>(); + AbstractMap> mapmap = + new HashMap>(); HashMap pos = new HashMap(); HashMap neg = new HashMap(); @@ -146,7 +147,7 @@ public class TestServer { return mapmap; } - public HashMap> testInsanity(Insanity argument) { + public AbstractMap> testInsanity(Insanity argument) { System.out.print("testInsanity()\n"); Xtruct hello = new Xtruct(); @@ -177,15 +178,15 @@ public class TestServer { second_map.put(Numberz.SIX, looney); - HashMap> insane = - new HashMap>(); + AbstractMap> insane = + new HashMap>(); insane.put((long)1, first_map); insane.put((long)2, second_map); return insane; } - public Xtruct testMulti(byte arg0, int arg1, long arg2, HashMap arg3, int arg4, long arg5) { + public Xtruct testMulti(byte arg0, int arg1, long arg2, AbstractMap arg3, int arg4, long arg5) { System.out.print("testMulti()\n"); Xtruct hello = new Xtruct();; -- 2.17.1