Refine search
@Test public void testDeserializeFromOldFormat() { assertEquals(PARAMETER_KIND_CODEC.fromJson("\"TYPE_SIGNATURE\""), ParameterKind.TYPE); assertEquals(PARAMETER_KIND_CODEC.fromJson("\"NAMED_TYPE_SIGNATURE\""), ParameterKind.NAMED_TYPE); assertEquals(PARAMETER_KIND_CODEC.fromJson("\"LONG_LITERAL\""), ParameterKind.LONG); assertEquals(PARAMETER_KIND_CODEC.fromJson("\"VARIABLE\""), ParameterKind.VARIABLE); }
private static void assertJsonRoundTrip(ClientTypeSignature signature) { String json = CLIENT_TYPE_SIGNATURE_CODEC.toJson(signature); ClientTypeSignature copy = CLIENT_TYPE_SIGNATURE_CODEC.fromJson(json); assertEquals(copy, signature); } }
@Test public void testJsonRoundTrip() { String json = TABLE_CODEC.toJson(TABLE); JmxTableHandle copy = TABLE_CODEC.fromJson(json); assertEquals(copy, TABLE); }
@Test public void testJsonRoundTripEmptyThings() { AccumuloSplit expected = new AccumuloSplit( "accumulo", "schema", "table", "id", LexicoderRowSerializer.class.getCanonicalName(), ImmutableList.of(), ImmutableList.of(), Optional.empty(), Optional.empty()); String json = codec.toJson(expected); AccumuloSplit actual = codec.fromJson(json); assertSplit(actual, expected); }
public static void validatePersonJsonCodec(JsonCodec<ImmutablePerson> jsonCodec) { ImmutablePerson expected = new ImmutablePerson("dain", true); String json = jsonCodec.toJson(expected); assertEquals(jsonCodec.fromJson(json), expected); byte[] bytes = jsonCodec.toJsonBytes(expected); assertEquals(jsonCodec.fromJson(bytes), expected); }
@Test public void testIOExplain() { String query = "SELECT * FROM orders"; MaterializedResult result = computeActual("EXPLAIN (TYPE IO, FORMAT JSON) " + query); TableColumnInfo input = new TableColumnInfo( new CatalogSchemaTableName("local", "sf0.01", "orders"), ImmutableSet.of( new ColumnConstraint( "orderstatus", createVarcharType(1).getTypeSignature(), new FormattedDomain( false, ImmutableSet.of( new FormattedRange( new FormattedMarker(Optional.of("F"), EXACTLY), new FormattedMarker(Optional.of("F"), EXACTLY)), new FormattedRange( new FormattedMarker(Optional.of("O"), EXACTLY), new FormattedMarker(Optional.of("O"), EXACTLY)), new FormattedRange( new FormattedMarker(Optional.of("P"), EXACTLY), new FormattedMarker(Optional.of("P"), EXACTLY))))))); assertEquals( jsonCodec(IOPlan.class).fromJson((String) getOnlyElement(result.getOnlyColumnAsSet())), new IOPlan(ImmutableSet.of(input), Optional.empty())); } }
@Test public void testJsonRoundTrip() { for (LocalFileColumnHandle handle : columnHandle) { String json = COLUMN_CODEC.toJson(handle); LocalFileColumnHandle copy = COLUMN_CODEC.fromJson(json); assertEquals(copy, handle); } } }
@Test public void testDeserializeFromNewFormat() { assertEquals(PARAMETER_KIND_CODEC.fromJson("\"TYPE\""), ParameterKind.TYPE); assertEquals(PARAMETER_KIND_CODEC.fromJson("\"NAMED_TYPE\""), ParameterKind.NAMED_TYPE); assertEquals(PARAMETER_KIND_CODEC.fromJson("\"LONG\""), ParameterKind.LONG); assertEquals(PARAMETER_KIND_CODEC.fromJson("\"VARIABLE\""), ParameterKind.VARIABLE); } }
private static void assertJsonRoundTrip(ServerInfo serverInfo) { String json = SERVER_INFO_CODEC.toJson(serverInfo); ServerInfo copy = SERVER_INFO_CODEC.fromJson(json); assertEquals(copy, serverInfo); } }
public static void validatePersonMapJsonCodec(JsonCodec<Map<String, ImmutablePerson>> jsonCodec) { ImmutableMap<String, ImmutablePerson> expected = ImmutableMap.<String, ImmutablePerson>builder() .put("dain", new ImmutablePerson("dain", true)) .put("martin", new ImmutablePerson("martin", true)) .put("mark", new ImmutablePerson("mark", true)) .build(); String json = jsonCodec.toJson(expected); assertEquals(jsonCodec.fromJson(json), expected); byte[] bytes = jsonCodec.toJsonBytes(expected); assertEquals(jsonCodec.fromJson(bytes), expected); }
@Test public void testIOExplain() jsonCodec(IOPlan.class).fromJson((String) getOnlyElement(result.getOnlyColumnAsSet())), new IOPlan( ImmutableSet.of(new TableColumnInfo( jsonCodec(IOPlan.class).fromJson((String) getOnlyElement(result.getOnlyColumnAsSet())), new IOPlan( ImmutableSet.of(new TableColumnInfo(
@Test public void testJsonRoundTrip() { String json = COLUMN_CODEC.toJson(columnHandle); ExampleColumnHandle copy = COLUMN_CODEC.fromJson(json); assertEquals(copy, columnHandle); }
@Test public void testBackwardsCompatible() { ServerInfo newServerInfo = new ServerInfo(UNKNOWN, "test", true, false, Optional.empty()); ServerInfo legacyServerInfo = SERVER_INFO_CODEC.fromJson("{\"nodeVersion\":{\"version\":\"<unknown>\"},\"environment\":\"test\",\"coordinator\":true}"); assertEquals(newServerInfo, legacyServerInfo); }
public static <T> void assertJsonRoundTrip(JsonCodec<T> codec, T object) { String json = codec.toJson(object); T copy = codec.fromJson(json); assertEquals(copy, object); } }
public static void validatePersonListJsonCodec(JsonCodec<List<ImmutablePerson>> jsonCodec) { ImmutableList<ImmutablePerson> expected = ImmutableList.of( new ImmutablePerson("dain", true), new ImmutablePerson("martin", true), new ImmutablePerson("mark", true)); String json = jsonCodec.toJson(expected); assertEquals(jsonCodec.fromJson(json), expected); byte[] bytes = jsonCodec.toJsonBytes(expected); assertEquals(jsonCodec.fromJson(bytes), expected); }
@Test public void testRoundTrip() { QualifiedTablePrefix table = new QualifiedTablePrefix("abc", "xyz", "fgh"); assertEquals(CODEC.fromJson(CODEC.toJson(table)), table); } }
@Test public void testCompatibility() "}"; QueryResults results = QUERY_RESULTS_CODEC.fromJson(goldenValue); assertEquals(results.getId(), "20160128_214710_00012_rk68b");