RealNodeRepository implements NodeRepository { @Override public void updateNodeAttributes(String hostName, NodeAttributes nodeAttributes) { NodeMessageResponse response = configServerApi.patch( "/nodes/v2/node/" + hostName, nodeRepositoryNodeFromNodeAttributes(nodeAttributes), NodeMessageResponse.class); if (Strings.isNullOrEmpty(response.errorCode)) return; throw new NodeRepositoryException("Failed to update node attributes: " + response.message + " " + response.errorCode); } RealNodeRepository(ConfigServerApi configServerApi); @Override void addNodes(List<AddNode> nodes); @Override List<NodeSpec> getNodes(String baseHostName); @Override Optional<NodeSpec> getOptionalNode(String hostName); @Override Map<String, Acl> getAcls(String hostName); @Override void updateNodeAttributes(String hostName, NodeAttributes nodeAttributes); @Override void setNodeState(String hostName, NodeState nodeState); static NodeRepositoryNode nodeRepositoryNodeFromNodeAttributes(NodeAttributes nodeAttributes);  }
@Test public void testUpdateNodeAttributes() { String hostname = "host4.yahoo.com"; nodeRepositoryApi.updateNodeAttributes( hostname, new NodeAttributes() .withRestartGeneration(1) .withDockerImage(DockerImage.fromString("image-1:6.2.3"))); }