CheramiClientImpl implements CheramiClient { @Override public ConsumerGroupDescription updateConsumerGroup(UpdateConsumerGroupRequest request) throws EntityNotExistsError, BadRequestError, IOException { this.throwOnNullRequest(request); if (!request.isSetConsumerGroupName()) { throw new BadRequestError("request missing consumerGroupName parameter"); } if (!request.isSetDestinationPath()) { throw new BadRequestError("request missing destinationPath parameter"); } ThriftRequest<updateConsumerGroup_args> thriftRequest = null; ThriftResponse<updateConsumerGroup_result> thriftResponse = null; try { thriftRequest = buildThriftRequest("updateConsumerGroup", new updateConsumerGroup_args(request)); thriftResponse = doRemoteCall(thriftRequest); updateConsumerGroup_result result = thriftResponse.getBody(updateConsumerGroup_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("updateConsumerGroup 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 testUpdateConsumerGroup() throws Exception { CreateConsumerGroupRequest request = new CreateConsumerGroupRequest(); final String destination = "/foo/bar"; final String consumerGroup = "TestConsumerGroup"; final int lockTimeout = new Random().nextInt(); final int maxDelivery = new Random().nextInt(); final String email = "foo@bar.com"; final int skipOlder = new Random().nextInt(); final long timestamp = new Date().getTime(); request.setDestinationPath(destination); request.setConsumerGroupName(consumerGroup); request.setLockTimeoutInSeconds(lockTimeout); request.setMaxDeliveryCount(maxDelivery); request.setOwnerEmail(email); request.setSkipOlderMessagesInSeconds(skipOlder); request.setStartFrom(timestamp); client.createConsumerGroup(request); UpdateConsumerGroupRequest updateRequest = new UpdateConsumerGroupRequest(); final String newDest = "/new/path/"; updateRequest.setConsumerGroupName(consumerGroup); updateRequest.setDestinationPath(newDest); updateRequest.setOwnerEmail(email); updateRequest.setMaxDeliveryCount(maxDelivery); updateRequest.setLockTimeoutInSeconds(lockTimeout); updateRequest.setSkipOlderMessagesInSeconds(skipOlder); updateRequest.setStatus(ConsumerGroupStatus.ENABLED); ConsumerGroupDescription response = client.updateConsumerGroup(updateRequest); assert (response.getDestinationPath().equals(newDest)); assert (response.getConsumerGroupName().equals(consumerGroup)); ReadConsumerGroupRequest readRequest = new ReadConsumerGroupRequest(); readRequest.setConsumerGroupName(consumerGroup); readRequest.setDestinationPath(newDest); ConsumerGroupDescription result = client.readConsumerGroup(readRequest); assert (result.getDestinationPath().equals(newDest)); assert (result.getConsumerGroupName().equals(consumerGroup)); thrown.expect(EntityNotExistsError.class); updateRequest.setConsumerGroupName("invalidGroup"); client.updateConsumerGroup(updateRequest); }