public Object getFieldValue(_Fields field) { switch (field) { case TYPE: return getType(); case CONTENT: return getContent(); } throw new IllegalStateException(); }
public GetFileResultDto(GetFileResult result) { type = result.getType(); content = result.getContent(); }
public GetFileResultDto(GetFileResult result) { type = result.getType(); content = result.getContent(); }
public Object getFieldValue(_Fields field) { switch (field) { case TYPE: return getType(); case CONTENT: return getContent(); } throw new IllegalStateException(); }
public GetFileResultDto(GetFileResult result) { type = result.getType(); content = result.getContent(); }
try { converted = unsafeCast( Entry.ofJson(normRev, query.path(), Jackson.readTree(r.getContent()))); } catch (IOException e) { throw new CompletionException( converted = unsafeCast(Entry.ofText(normRev, query.path(), r.getContent())); break; case DIRECTORY:
try { converted = unsafeCast( Entry.ofJson(normRev, query.path(), Jackson.readTree(r.getContent()))); } catch (IOException e) { throw new CompletionException( converted = unsafeCast(Entry.ofText(normRev, query.path(), r.getContent())); break; case DIRECTORY:
try { converted = unsafeCast( Entry.ofJson(normRev, query.path(), Jackson.readTree(r.getContent()))); } catch (IOException e) { throw new CompletionException( converted = unsafeCast(Entry.ofText(normRev, query.path(), r.getContent())); break; case DIRECTORY:
@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); }