public Query deepCopy() { return new Query(this); }
public Query deepCopy() { return new Query(this); }
@Override protected Query doForward(com.linecorp.centraldogma.common.Query<?> query) { switch (query.type()) { case IDENTITY: return new Query(query.path(), QueryType.IDENTITY, Collections.emptyList()); case JSON_PATH: return new Query(query.path(), QueryType.JSON_PATH, query.expressions()); } throw new Error(); }
@Override protected Query doForward(com.linecorp.centraldogma.common.Query<?> query) { switch (query.type()) { case IDENTITY: return new Query(query.path(), QueryType.IDENTITY, Collections.emptyList()); case JSON_PATH: return new Query(query.path(), QueryType.JSON_PATH, query.expressions()); } throw new Error(); }
case 4: // QUERY if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { struct.query = new Query(); struct.query.read(iprot); struct.setQueryIsSet(true);
case 4: // QUERY if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { struct.query = new Query(); struct.query.read(iprot); struct.setQueryIsSet(true);
/** * Performs a deep copy on <i>other</i>. */ public NamedQuery(NamedQuery other) { __isset_bitfield = other.__isset_bitfield; if (other.isSetName()) { this.name = other.name; } this.enabled = other.enabled; if (other.isSetRepositoryName()) { this.repositoryName = other.repositoryName; } if (other.isSetQuery()) { this.query = new Query(other.query); } if (other.isSetComment()) { this.comment = new Comment(other.comment); } }
/** * Performs a deep copy on <i>other</i>. */ public NamedQuery(NamedQuery other) { __isset_bitfield = other.__isset_bitfield; if (other.isSetName()) { this.name = other.name; } this.enabled = other.enabled; if (other.isSetRepositoryName()) { this.repositoryName = other.repositoryName; } if (other.isSetQuery()) { this.query = new Query(other.query); } if (other.isSetComment()) { this.comment = new Comment(other.comment); } }
@Override public void read(org.apache.thrift.protocol.TProtocol prot, NamedQuery struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; struct.name = iprot.readString(); struct.setNameIsSet(true); struct.enabled = iprot.readBool(); struct.setEnabledIsSet(true); struct.repositoryName = iprot.readString(); struct.setRepositoryNameIsSet(true); struct.query = new Query(); struct.query.read(iprot); struct.setQueryIsSet(true); BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { struct.comment = new Comment(); struct.comment.read(iprot); struct.setCommentIsSet(true); } } }
@Override public void read(org.apache.thrift.protocol.TProtocol prot, NamedQuery struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; struct.name = iprot.readString(); struct.setNameIsSet(true); struct.enabled = iprot.readBool(); struct.setEnabledIsSet(true); struct.repositoryName = iprot.readString(); struct.setRepositoryNameIsSet(true); struct.query = new Query(); struct.query.read(iprot); struct.setQueryIsSet(true); BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { struct.comment = new Comment(); struct.comment.read(iprot); struct.setCommentIsSet(true); } } }
@Test public void thrift() throws Exception { final com.linecorp.centraldogma.internal.thrift.Revision head = new com.linecorp.centraldogma.internal.thrift.Revision(-1, 0); final Query query = new Query(PATH, QueryType.IDENTITY, ImmutableList.of()); // Should fail to decode without the decompressor. final Iface clientWithoutDecompressor = new ClientBuilder( "ttext+http://127.0.0.1:" + rule.serverAddress().getPort() + "/cd/thrift/v1") .setHttpHeader(HttpHeaderNames.AUTHORIZATION, "bearer " + CsrfToken.ANONYMOUS) .setHttpHeader(HttpHeaderNames.ACCEPT_ENCODING, "deflate") .build(Iface.class); assertThatThrownBy(() -> clientWithoutDecompressor.getFile(PROJ, REPO, head, query)) .isInstanceOf(TException.class) .hasCauseInstanceOf(JsonParseException.class); // Should succeed to decode with the decompressor. final Iface clientWithDecompressor = Clients.newDerivedClient( clientWithoutDecompressor, options -> new ClientOptionsBuilder(options) .decorator(HttpDecodingClient.newDecorator()) .build()); final GetFileResult result = clientWithDecompressor.getFile(PROJ, REPO, head, query); assertThat(result.getContent()).contains(CONTENT); }