CheramiClientImpl implements CheramiClient { @Override public DestinationDescription updateDestination(UpdateDestinationRequest request) throws BadRequestError, EntityNotExistsError, IOException { this.throwOnNullRequest(request); if (!request.isSetPath()) { throw new BadRequestError("request missing 'path' parameter"); } ThriftRequest<updateDestination_args> thriftRequest = null; ThriftResponse<updateDestination_result> thriftResponse = null; try { thriftRequest = buildThriftRequest("updateDestination", new updateDestination_args(request)); thriftResponse = doRemoteCall(thriftRequest); updateDestination_result result = thriftResponse.getBody(updateDestination_result.class); if (thriftResponse.getResponseCode() == ResponseCode.OK) { return result.getSuccess(); } if (result != null && result.isSetEntityError()) { throw result.getEntityError(); } if (result != null && result.isSetRequestError()) { throw result.getRequestError(); } throw new IOException("updateDestination failed with unknown error:" + result); } finally { if (thriftResponse != null) { thriftResponse.release(); } } } private  CheramiClientImpl(ClientOptions options); protected  CheramiClientImpl(String host, int port, ClientOptions options); protected  CheramiClientImpl(String routerFile, ClientOptions options); @Override ClientOptions getOptions(); @Override void close(); @Override ConsumerGroupDescription createConsumerGroup(CreateConsumerGroupRequest request); @Override DestinationDescription createDestination(CreateDestinationRequest request); @Override CheramiPublisher createPublisher(CreatePublisherRequest request); @Override CheramiConsumer createConsumer(CreateConsumerRequest request); @Override void deleteConsumerGroup(DeleteConsumerGroupRequest request); @Override void deleteDestination(DeleteDestinationRequest request); @Override ConsumerGroupDescription readConsumerGroup(ReadConsumerGroupRequest request); @Override DestinationDescription readDestination(ReadDestinationRequest request); @Override ConsumerGroupDescription updateConsumerGroup(UpdateConsumerGroupRequest request); @Override DestinationDescription updateDestination(UpdateDestinationRequest request); @Override ListConsumerGroupResult listConsumerGroups(ListConsumerGroupRequest request); @Override ListDestinationsResult listDestinations(ListDestinationsRequest request); @Override List<HostAddress> readDestinationHosts(String path); @Override ReadPublisherOptionsResult readPublisherOptions(String path); @Override ReadConsumerGroupHostsResult readConsumerGroupHosts(String path, String consumerGroupName);  }
@Test public void testUpdateDestination() throws Exception { CreateDestinationRequest request = new CreateDestinationRequest(); final String destination = "/foo/bar"; final String email = "foo@bar.com"; final int consumedRetention = new Random().nextInt(); final int unconsumedRetention = new Random().nextInt(); request.setPath(destination); request.setOwnerEmail(email); request.setType(DestinationType.PLAIN); request.setConsumedMessagesRetention(consumedRetention); request.setUnconsumedMessagesRetention(unconsumedRetention); client.createDestination(request); UpdateDestinationRequest updateRequest = new UpdateDestinationRequest(); final String newEmail = "foo@uber.com"; updateRequest.setPath(destination); updateRequest.setOwnerEmail(newEmail); updateRequest.setUnconsumedMessagesRetention(unconsumedRetention); updateRequest.setConsumedMessagesRetention(consumedRetention); updateRequest.setStatus(DestinationStatus.ENABLED); DestinationDescription response = client.updateDestination(updateRequest); assert (response.getOwnerEmail().equals(newEmail)); ReadDestinationRequest readRequest = new ReadDestinationRequest(); readRequest.setPath(destination); DestinationDescription result = client.readDestination(readRequest); assert (result.getPath().equals(destination)); assert (result.getOwnerEmail().equals(newEmail)); thrown.expect(EntityNotExistsError.class); updateRequest.setPath("/invalid/path"); client.updateDestination(updateRequest); }