Package ar.ext.avro

Examples of ar.ext.avro.SchemaComposer


    ref.set(0, 1, 12);
    ref.set(1, 0, 21);
    ref.set(1, 1, 22);
   
    File file = new File("./testResults/counts.avro");
    Schema s = new SchemaComposer().addResource("ar/ext/avro/count.avsc").resolved();
    try (OutputStream out = new FileOutputStream(file)) {
      AggregateSerializer.serialize(ref, out, s, new Converters.FromCount(s));
      Aggregates<Integer> res = AggregateSerializer.deserialize(file, new Converters.ToCount());
 
      assertEquals(ref.lowX(), res.lowX());
View Full Code Here


 
  @Test
  public void countsRoundTrip() throws Exception {
    Aggregates<Integer> ref = count;
    File file = new File("./testResults/counts.avro");
    Schema s = new SchemaComposer().addResource("ar/ext/avro/count.avsc").resolved();
   
    try (OutputStream out = new FileOutputStream(file)) {
      AggregateSerializer.serialize(ref, out, s, new Converters.FromCount(s));
      Aggregates<Integer> res = AggregateSerializer.deserialize(file, new Converters.ToCount());
   
View Full Code Here

  }
 
  @Test
  public void CountToJSON() throws Exception {
    Aggregates<Integer> ref = count;
    Schema s = new SchemaComposer().addResource("ar/ext/avro/count.avsc").resolved();
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    AggregateSerializer.serialize(ref, baos, s, FORMAT.JSON, new Converters.FromCount(s));
    String output = new String(baos.toByteArray(), "UTF-8");
    try (JsonParser p = new JsonFactory().createJsonParser(output)) {   
      ObjectMapper mapper = new ObjectMapper();
View Full Code Here

  public void CoCRoundTrip() throws Exception {
    Aggregates<CategoricalCounts<Color>> ref = cocs;
   
    File file =  new File("./testResults/coc.avro");
    try (OutputStream out = new FileOutputStream(file)) {
      Schema s = new SchemaComposer().addResource(AggregateSerializer.COC_SCHEMA).resolved();
      AggregateSerializer.serialize(ref, out, s, new Converters.FromCoC(s));
      Aggregates<CategoricalCounts<String>> res
        = AggregateSerializer.deserialize(file, new Converters.ToCoC());
 
      assertEquals(ref.lowX(), res.lowX());
View Full Code Here

TOP

Related Classes of ar.ext.avro.SchemaComposer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.