Package org.apache.kafka.common.protocol.types

Examples of org.apache.kafka.common.protocol.types.Field


    private Schema schema;
    private Struct struct;

    @Before
    public void setup() {
        this.schema = new Schema(new Field("int8", Type.INT8),
                                 new Field("int16", Type.INT16),
                                 new Field("int32", Type.INT32),
                                 new Field("int64", Type.INT64),
                                 new Field("string", Type.STRING),
                                 new Field("bytes", Type.BYTES),
                                 new Field("array", new ArrayOf(Type.INT32)),
                                 new Field("struct", new Schema(new Field("field", Type.INT32))));
        this.struct = new Struct(this.schema).set("int8", (byte) 1)
                                             .set("int16", (short) 1)
                                             .set("int32", (int) 1)
                                             .set("int64", (long) 1)
                                             .set("string", "1")
View Full Code Here


        }
    }

    @Test
    public void testDefault() {
        Schema schema = new Schema(new Field("field", Type.INT32, "doc", 42));
        Struct struct = new Struct(schema);
        assertEquals("Should get the default value", 42, struct.get("field"));
        struct.validate(); // should be valid even with missing value
    }
View Full Code Here

TOP

Related Classes of org.apache.kafka.common.protocol.types.Field

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.