@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + ENDPOINT_FIELD_NUMBER; hash = (53 * hash) + getEndpoint().hashCode(); hash = (37 * hash) + PORT_FIELD_NUMBER; hash = (53 * hash) + getPort(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof io.pravega.controller.stream.api.grpc.v1.Controller.NodeUri)) { return super.equals(obj); } io.pravega.controller.stream.api.grpc.v1.Controller.NodeUri other = (io.pravega.controller.stream.api.grpc.v1.Controller.NodeUri) obj; boolean result = true; result = result && getEndpoint() .equals(other.getEndpoint()); result = result && (getPort() == other.getPort()); result = result && unknownFields.equals(other.unknownFields); return result; }
servers = controllerServerList.getNodeURIList().stream() .map(node -> new EquivalentAddressGroup(new InetSocketAddress(node.getEndpoint(), node.getPort()))) .collect(Collectors.toList()); } else {
public Builder mergeFrom(io.pravega.controller.stream.api.grpc.v1.Controller.NodeUri other) { if (other == io.pravega.controller.stream.api.grpc.v1.Controller.NodeUri.getDefaultInstance()) return this; if (!other.getEndpoint().isEmpty()) { endpoint_ = other.endpoint_; onChanged(); } if (other.getPort() != 0) { setPort(other.getPort()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
/** * <code>string endpoint = 1;</code> */ public Builder clearEndpoint() { endpoint_ = getDefaultInstance().getEndpoint(); onChanged(); return this; } /**
@Test public void getControllerServersTest() { ResultObserver<ServerResponse> result = new ResultObserver<>(); this.controllerService.getControllerServerList(ServerRequest.getDefaultInstance(), result); assertEquals(1, result.get().getNodeURICount()); assertEquals("localhost", result.get().getNodeURI(0).getEndpoint()); assertEquals(9090, result.get().getNodeURI(0).getPort()); }
/** * Helper to convert NodeURI into PravegaNodeURI. * * @param uri Node URI. * @return PravegaNodeURI. */ public static final PravegaNodeUri encode(final NodeUri uri) { Preconditions.checkNotNull(uri, "uri"); return new PravegaNodeUri(uri.getEndpoint(), uri.getPort()); }
@Test public void getURITest() { createScopeAndStream(SCOPE1, STREAM1, ScalingPolicy.fixed(2)); ResultObserver<NodeUri> result1 = new ResultObserver<>(); this.controllerService.getURI(ModelHelper.createSegmentId(SCOPE1, STREAM1, 0), result1); NodeUri nodeUri = result1.get(); Assert.assertEquals("localhost", nodeUri.getEndpoint()); Assert.assertEquals(12345, nodeUri.getPort()); }