Examples of resolveUnion()


Examples of org.apache.avro.generic.GenericData.resolveUnion()

  @Test public void testUnionWithCollection() {
    Schema s = new Schema.Parser().parse
      ("[\"null\", {\"type\":\"array\",\"items\":\"float\"}]");
    GenericData data = ReflectData.get();
    assertEquals(1, data.resolveUnion(s, new ArrayList<Float>()));
  }

  @Test public void testUnionWithMap() {
    Schema s = new Schema.Parser().parse
      ("[\"null\", {\"type\":\"map\",\"values\":\"float\"}]");
View Full Code Here

Examples of org.apache.avro.generic.GenericData.resolveUnion()

  @Test public void testUnionWithMap() {
    Schema s = new Schema.Parser().parse
      ("[\"null\", {\"type\":\"map\",\"values\":\"float\"}]");
    GenericData data = ReflectData.get();
    assertEquals(1, data.resolveUnion(s, new HashMap<String,Float>()));
  }

  @Test public void testUnionWithFixed() {
    Schema s = new Schema.Parser().parse
        ("[\"null\", {\"type\":\"fixed\",\"name\":\"f\",\"size\":1}]");
View Full Code Here

Examples of org.apache.avro.generic.GenericData.resolveUnion()

  @Test public void testUnionWithFixed() {
    Schema s = new Schema.Parser().parse
        ("[\"null\", {\"type\":\"fixed\",\"name\":\"f\",\"size\":1}]");
    Schema f = new Schema.Parser().parse("{\"type\":\"fixed\",\"name\":\"f\",\"size\":1}");
    GenericData data = ReflectData.get();
    assertEquals(1, data.resolveUnion(s, new GenericData.Fixed(f)));
  }

  @Test public void testUnionWithEnum() {
    Schema s = new Schema.Parser().parse
        ("[\"null\", {\"type\":\"enum\",\"name\":\"E\",\"namespace\":" +
View Full Code Here

Examples of org.apache.avro.generic.GenericData.resolveUnion()

  @Test public void testUnionWithEnum() {
    Schema s = new Schema.Parser().parse
        ("[\"null\", {\"type\":\"enum\",\"name\":\"E\",\"namespace\":" +
            "\"org.apache.avro.reflect.TestReflect$\",\"symbols\":[\"A\",\"B\"]}]");
    GenericData data = ReflectData.get();
    assertEquals(1, data.resolveUnion(s, E.A));
  }

  @Test public void testUnionWithBytes() {
    Schema s = new Schema.Parser().parse ("[\"null\", \"bytes\"]");
    GenericData data = ReflectData.get();
View Full Code Here

Examples of org.apache.avro.generic.GenericData.resolveUnion()

  }

  @Test public void testUnionWithBytes() {
    Schema s = new Schema.Parser().parse ("[\"null\", \"bytes\"]");
    GenericData data = ReflectData.get();
    assertEquals(1, data.resolveUnion(s, ByteBuffer.wrap(new byte[]{1})));
  }

  // test map, array and list type inference
  public static class R1 {
    private Map<String,String> mapField = new HashMap<String,String>();
View Full Code Here

Examples of org.apache.avro.generic.GenericData.resolveUnion()

  @Test public void testUnionWithCollection() {
    Schema s = Schema.parse
      ("[\"null\", {\"type\":\"array\",\"items\":\"float\"}]");
    GenericData data = ReflectData.get();
    assertEquals(1, data.resolveUnion(s, new ArrayList<Float>()));
  }

  @Test public void testUnionWithMap() {
    Schema s = Schema.parse
      ("[\"null\", {\"type\":\"map\",\"values\":\"float\"}]");
View Full Code Here

Examples of org.apache.avro.generic.GenericData.resolveUnion()

  @Test public void testUnionWithMap() {
    Schema s = Schema.parse
      ("[\"null\", {\"type\":\"map\",\"values\":\"float\"}]");
    GenericData data = ReflectData.get();
    assertEquals(1, data.resolveUnion(s, new HashMap<String,Float>()));
  }

  @Test public void testUnionWithBytes() {
    Schema s = Schema.parse ("[\"null\", \"bytes\"]");
    GenericData data = ReflectData.get();
View Full Code Here

Examples of org.apache.avro.generic.GenericData.resolveUnion()

  }

  @Test public void testUnionWithBytes() {
    Schema s = Schema.parse ("[\"null\", \"bytes\"]");
    GenericData data = ReflectData.get();
    assertEquals(1, data.resolveUnion(s, ByteBuffer.wrap(new byte[]{1})));
  }

  // test map, array and list type inference
  public static class R1 {
    private Map<String,String> mapField = new HashMap<String,String>();
View Full Code Here

Examples of org.apache.avro.generic.GenericData.resolveUnion()

  @Test public void testUnionWithCollection() {
    Schema s = new Schema.Parser().parse
      ("[\"null\", {\"type\":\"array\",\"items\":\"float\"}]");
    GenericData data = ReflectData.get();
    assertEquals(1, data.resolveUnion(s, new ArrayList<Float>()));
  }

  @Test public void testUnionWithMap() {
    Schema s = new Schema.Parser().parse
      ("[\"null\", {\"type\":\"map\",\"values\":\"float\"}]");
View Full Code Here

Examples of org.apache.avro.generic.GenericData.resolveUnion()

  @Test public void testUnionWithMap() {
    Schema s = new Schema.Parser().parse
      ("[\"null\", {\"type\":\"map\",\"values\":\"float\"}]");
    GenericData data = ReflectData.get();
    assertEquals(1, data.resolveUnion(s, new HashMap<String,Float>()));
  }

  @Test public void testUnionWithBytes() {
    Schema s = new Schema.Parser().parse ("[\"null\", \"bytes\"]");
    GenericData data = ReflectData.get();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.