本文整理了Java中com.linecorp.centraldogma.internal.thrift.WatchFileResult.setContent()
方法的一些代码示例,展示了WatchFileResult.setContent()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WatchFileResult.setContent()
方法的具体详情如下:
包路径:com.linecorp.centraldogma.internal.thrift.WatchFileResult
类名称:WatchFileResult
方法名:setContent
暂无
代码示例来源:origin: line/centraldogma
@Test
public void watchFile() throws Exception {
doAnswer(invocation -> {
AsyncMethodCallback<WatchFileResult> callback = invocation.getArgument(5);
callback.onComplete(new WatchFileResult().setRevision(new TRevision(42))
.setType(TEntryType.TEXT)
.setContent("foo"));
return null;
}).when(iface).watchFile(any(), any(), any(), any(), anyLong(), any());
assertThat(client.watchFile("project", "repo", new Revision(1), Query.ofText("/a.txt"), 100).get())
.isEqualTo(Entry.ofText(new Revision(42), "/a.txt", "foo"));
verify(iface).watchFile(eq("project"), eq("repo"), any(), any(), eq(100L), any());
}
代码示例来源:origin: line/centraldogma
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case REVISION:
if (value == null) {
unsetRevision();
} else {
setRevision((Revision)value);
}
break;
case TYPE:
if (value == null) {
unsetType();
} else {
setType((EntryType)value);
}
break;
case CONTENT:
if (value == null) {
unsetContent();
} else {
setContent((String)value);
}
break;
}
}
代码示例来源:origin: com.linecorp.centraldogma/centraldogma-common-legacy-shaded
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case REVISION:
if (value == null) {
unsetRevision();
} else {
setRevision((Revision)value);
}
break;
case TYPE:
if (value == null) {
unsetType();
} else {
setType((EntryType)value);
}
break;
case CONTENT:
if (value == null) {
unsetContent();
} else {
setContent((String)value);
}
break;
}
}
代码示例来源:origin: line/centraldogma
private static void handleWatchFileResult(
CompletableFuture<com.linecorp.centraldogma.common.Entry<Object>> future,
AsyncMethodCallback resultHandler) {
future.handle((res, cause) -> {
if (cause == null) {
final WatchFileResult wfr = new WatchFileResult();
wfr.setRevision(convert(res.revision()));
wfr.setType(convert(res.type()));
wfr.setContent(res.contentAsText());
resultHandler.onComplete(wfr);
} else if (cause instanceof CancellationException) {
resultHandler.onComplete(CentralDogmaConstants.EMPTY_WATCH_FILE_RESULT);
} else {
logAndInvokeOnError("watchFile", resultHandler, cause);
}
return null;
});
}
代码示例来源:origin: com.linecorp.centraldogma/centraldogma-server
private static void handleWatchFileResult(
CompletableFuture<com.linecorp.centraldogma.common.Entry<Object>> future,
AsyncMethodCallback resultHandler) {
future.handle((res, cause) -> {
if (cause == null) {
final WatchFileResult wfr = new WatchFileResult();
wfr.setRevision(convert(res.revision()));
wfr.setType(convert(res.type()));
wfr.setContent(res.contentAsText());
resultHandler.onComplete(wfr);
} else if (cause instanceof CancellationException) {
resultHandler.onComplete(CentralDogmaConstants.EMPTY_WATCH_FILE_RESULT);
} else {
logAndInvokeOnError("watchFile", resultHandler, cause);
}
return null;
});
}
代码示例来源:origin: com.linecorp.centraldogma/centraldogma-server-shaded
private static void handleWatchFileResult(
CompletableFuture<com.linecorp.centraldogma.common.Entry<Object>> future,
AsyncMethodCallback resultHandler) {
future.handle(voidFunction((res, cause) -> {
if (cause == null) {
final WatchFileResult wfr = new WatchFileResult();
wfr.setRevision(convert(res.revision()));
wfr.setType(convert(res.type()));
wfr.setContent(res.contentAsText());
resultHandler.onComplete(wfr);
} else if (cause instanceof CancellationException) {
resultHandler.onComplete(CentralDogmaConstants.EMPTY_WATCH_FILE_RESULT);
} else {
logAndInvokeOnError("watchFile", resultHandler, cause);
}
}));
}
内容来源于网络,如有侵权,请联系作者删除!