public GetFileResult deepCopy() { return new GetFileResult(this); }
public GetFileResult deepCopy() { return new GetFileResult(this); }
@Test public void getFile() throws Exception { doAnswer(invocation -> { final AsyncMethodCallback<com.linecorp.centraldogma.internal.thrift.Revision> callback = invocation.getArgument(3); callback.onComplete(new com.linecorp.centraldogma.internal.thrift.Revision(1, 0)); return null; }).when(iface).normalizeRevision(any(), any(), any(), any()); doAnswer(invocation -> { final AsyncMethodCallback<GetFileResult> callback = invocation.getArgument(4); callback.onComplete(new GetFileResult(TEntryType.TEXT, "content")); return null; }).when(iface).getFile(any(), any(), any(), any(), any()); assertThat(client.getFile("project", "repo", new Revision(1), Query.ofText("/a.txt")).get()) .isEqualTo(Entry.ofText(new Revision(1), "/a.txt", "content")); verify(iface).getFile(eq("project"), eq("repo"), any(), any(), any()); }
@Test public void getFile_path() throws Exception { doAnswer(invocation -> { final AsyncMethodCallback<com.linecorp.centraldogma.internal.thrift.Revision> callback = invocation.getArgument(3); callback.onComplete(new com.linecorp.centraldogma.internal.thrift.Revision(1, 0)); return null; }).when(iface).normalizeRevision(any(), any(), any(), any()); doAnswer(invocation -> { final AsyncMethodCallback<GetFileResult> callback = invocation.getArgument(4); callback.onComplete(new GetFileResult(TEntryType.TEXT, "content")); return null; }).when(iface).getFile(any(), any(), any(), any(), any()); assertThat(client.getFile("project", "repo", new Revision(1), Query.ofText("/a.txt")).get()) .isEqualTo(Entry.ofText(new Revision(1), "/a.txt", "content")); verify(iface).getFile(eq("project"), eq("repo"), any(), any(), any()); }
@Override public void getFile(String projectName, String repositoryName, Revision revision, Query query, AsyncMethodCallback resultHandler) { handle(projectManager.get(projectName).repos().get(repositoryName) .get(convert(revision), convert(query)) .thenApply(res -> new GetFileResult(convert(res.type()), res.contentAsText())), resultHandler); }
@Override public void getFile(String projectName, String repositoryName, Revision revision, Query query, AsyncMethodCallback resultHandler) { handle(projectManager.get(projectName).repos().get(repositoryName) .get(convert(revision), convert(query)) .thenApply(res -> new GetFileResult(convert(res.type()), res.contentAsText())), resultHandler); }
@Override public void getFile(String projectName, String repositoryName, Revision revision, Query query, AsyncMethodCallback resultHandler) { handle(projectManager.get(projectName).repos().get(repositoryName) .get(convert(revision), convert(query)) .thenApply(res -> new GetFileResult(convert(res.type()), res.contentAsText())), resultHandler); }