|
18 | 18 | package org.apache.hadoop.ozone.om; |
19 | 19 |
|
20 | 20 | import static org.apache.hadoop.hdds.HddsUtils.getScmAddressForClients; |
21 | | -import static org.apache.hadoop.ozone.OmUtils.getOmAddressForClients; |
22 | 21 | import static org.junit.jupiter.api.Assertions.assertEquals; |
23 | 22 | import static org.junit.jupiter.api.Assertions.assertTrue; |
24 | 23 |
|
25 | 24 | import com.fasterxml.jackson.core.type.TypeReference; |
26 | 25 | import com.fasterxml.jackson.databind.ObjectMapper; |
27 | 26 | import java.net.InetSocketAddress; |
28 | 27 | import java.util.HashMap; |
| 28 | +import java.util.Iterator; |
29 | 29 | import java.util.List; |
30 | 30 | import java.util.Map; |
31 | 31 | import org.apache.hadoop.hdds.conf.OzoneConfiguration; |
32 | 32 | import org.apache.hadoop.hdds.protocol.proto.HddsProtos; |
33 | 33 | import org.apache.hadoop.net.NetUtils; |
34 | 34 | import org.apache.hadoop.ozone.MiniOzoneCluster; |
| 35 | +import org.apache.hadoop.ozone.OmUtils; |
35 | 36 | import org.apache.hadoop.ozone.om.helpers.ServiceInfo; |
36 | 37 | import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ServicePort; |
37 | 38 | import org.apache.http.HttpResponse; |
@@ -80,19 +81,16 @@ public void testGetServiceList() throws Exception { |
80 | 81 | serviceMap.put(serviceInfo.getNodeType(), serviceInfo); |
81 | 82 | } |
82 | 83 |
|
83 | | - InetSocketAddress omAddress = |
84 | | - getOmAddressForClients(conf); |
| 84 | + String omAddress = OmUtils.getOmRpcAddress(conf); |
85 | 85 | ServiceInfo omInfo = serviceMap.get(HddsProtos.NodeType.OM); |
86 | 86 |
|
87 | | - assertEquals(omAddress.getHostName(), omInfo.getHostname()); |
88 | | - assertEquals(omAddress.getPort(), |
89 | | - omInfo.getPort(ServicePort.Type.RPC)); |
| 87 | + assertEquals(omAddress, omInfo.getHostname() + ":" + omInfo.getPort(ServicePort.Type.RPC)); |
90 | 88 | assertEquals(server.getHttpAddress().getPort(), |
91 | 89 | omInfo.getPort(ServicePort.Type.HTTP)); |
92 | 90 |
|
93 | | - assertTrue(getScmAddressForClients(conf).iterator().hasNext()); |
94 | | - InetSocketAddress scmAddress = |
95 | | - getScmAddressForClients(conf).iterator().next(); |
| 91 | + Iterator<InetSocketAddress> scmAddressIterator = getScmAddressForClients(conf).iterator(); |
| 92 | + assertTrue(scmAddressIterator.hasNext()); |
| 93 | + InetSocketAddress scmAddress = scmAddressIterator.next(); |
96 | 94 | ServiceInfo scmInfo = serviceMap.get(HddsProtos.NodeType.SCM); |
97 | 95 |
|
98 | 96 | assertEquals(scmAddress.getHostName(), scmInfo.getHostname()); |
|
0 commit comments