public WatchFileResult deepCopy() { return new WatchFileResult(this); }
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; } }
public Object getFieldValue(_Fields field) { switch (field) { case REVISION: return getRevision(); case TYPE: return getType(); case CONTENT: return getContent(); } throw new IllegalStateException(); }
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ public boolean isSet(_Fields field) { if (field == null) { throw new IllegalArgumentException(); } switch (field) { case REVISION: return isSetRevision(); case TYPE: return isSetType(); case CONTENT: return isSetContent(); } throw new IllegalStateException(); }
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; }); }
public void write(org.apache.thrift.protocol.TProtocol oprot, WatchFileResult struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); if (struct.revision != null) { if (struct.isSetRevision()) { oprot.writeFieldBegin(REVISION_FIELD_DESC); struct.revision.write(oprot); oprot.writeFieldEnd(); } } if (struct.type != null) { if (struct.isSetType()) { oprot.writeFieldBegin(TYPE_FIELD_DESC); oprot.writeI32(struct.type.getValue()); oprot.writeFieldEnd(); } } if (struct.content != null) { if (struct.isSetContent()) { oprot.writeFieldBegin(CONTENT_FIELD_DESC); oprot.writeString(struct.content); oprot.writeFieldEnd(); } } oprot.writeFieldStop(); oprot.writeStructEnd(); }
@Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof WatchFileResult) return this.equals((WatchFileResult)that); return false; }
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; }); }
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ public boolean isSet(_Fields field) { if (field == null) { throw new IllegalArgumentException(); } switch (field) { case REVISION: return isSetRevision(); case TYPE: return isSetType(); case CONTENT: return isSetContent(); } throw new IllegalStateException(); }
public void write(org.apache.thrift.protocol.TProtocol oprot, WatchFileResult struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); if (struct.revision != null) { if (struct.isSetRevision()) { oprot.writeFieldBegin(REVISION_FIELD_DESC); struct.revision.write(oprot); oprot.writeFieldEnd(); } } if (struct.type != null) { if (struct.isSetType()) { oprot.writeFieldBegin(TYPE_FIELD_DESC); oprot.writeI32(struct.type.getValue()); oprot.writeFieldEnd(); } } if (struct.content != null) { if (struct.isSetContent()) { oprot.writeFieldBegin(CONTENT_FIELD_DESC); oprot.writeString(struct.content); oprot.writeFieldEnd(); } } oprot.writeFieldStop(); oprot.writeStructEnd(); }
@Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof WatchFileResult) return this.equals((WatchFileResult)that); return false; }
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); } })); }
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; } }
public Object getFieldValue(_Fields field) { switch (field) { case REVISION: return getRevision(); case TYPE: return getType(); case CONTENT: return getContent(); } throw new IllegalStateException(); }
/** * Performs a deep copy on <i>other</i>. */ public WatchFileResult(WatchFileResult other) { if (other.isSetRevision()) { this.revision = new Revision(other.revision); } if (other.isSetType()) { this.type = other.type; } if (other.isSetContent()) { this.content = other.content; } }
public WatchFileResult deepCopy() { return new WatchFileResult(this); }
@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()); }
final Revision revision = RevisionConverter.TO_MODEL.convert(r.getRevision()); if (revision == null) { return null; switch (r.getType()) { case JSON: try { converted = unsafeCast(Entry.ofJson(revision, query.path(), r.getContent())); } catch (JsonParseException e) { throw new CompletionException("failed to parse the query result: " + query, e); converted = unsafeCast(Entry.ofText(revision, query.path(), r.getContent())); break; case DIRECTORY: break; default: throw new Error("unknown entry type: " + r.getType());
/** * Performs a deep copy on <i>other</i>. */ public WatchFileResult(WatchFileResult other) { if (other.isSetRevision()) { this.revision = new Revision(other.revision); } if (other.isSetType()) { this.type = other.type; } if (other.isSetContent()) { this.content = other.content; } }
@Test public void watchFileTimedOut() throws Exception { doAnswer(invocation -> { AsyncMethodCallback<WatchFileResult> callback = invocation.getArgument(5); callback.onComplete(new WatchFileResult()); 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()).isNull(); verify(iface).watchFile(eq("project"), eq("repo"), any(), any(), eq(100L), any()); } }