StreamSchema implements Serializable { public TypeInformation<T> getTypeInfo() { return typeInfo; } StreamSchema(TypeInformation<T> typeInfo, String... fieldNames);  StreamSchema(TypeInformation<T> typeInfo, int[] fieldIndexes, String[] fieldNames); boolean isAtomicType(); boolean isTupleType(); boolean isRowType(); boolean isPojoType(); boolean isCaseClassType(); boolean isCompositeType(); TypeInformation<T> getTypeInfo(); int[] getFieldIndexes(); String[] getFieldNames(); TypeInformation[] getFieldTypes(); StreamSerializer<T> getStreamSerializer(); TypeSerializer<T> getTypeSerializer(); void setTypeSerializer(TypeSerializer<T> typeSerializer);  }
@Test public void testStreamTupleSerializerWithPojo() { TypeInformation<Event> typeInfo = TypeExtractor.createTypeInfo(Event.class); assertTrue("Type information should be PojoTypeInfo", typeInfo instanceof PojoTypeInfo); StreamSchema<Event> schema = new StreamSchema<>(typeInfo, "id", "timestamp", "name", "price"); assertEquals(Event.class, schema.getTypeInfo().getTypeClass()); TypeInformation<Tuple2<String, Event>> tuple2TypeInformation = Types.TUPLE(TypeInformation.of(String.class), schema.getTypeInfo()); assertEquals("Java Tuple2<String, PojoType<org.apache.flink.streaming.siddhi.source.Event, fields = [id: Integer, name: String, price: Double, timestamp: Long]>>", tuple2TypeInformation.toString()); }
@Test public void testStreamTupleSerializerWithTuple() { TypeInformation<Tuple4<Integer,Long,String,Double>> typeInfo = TypeInformation.of(new TypeHint<Tuple4<Integer,Long,String,Double>>() {}); StreamSchema<Tuple4<Integer,Long,String,Double>> schema = new StreamSchema<>(typeInfo, "id", "timestamp", "name", "price"); assertEquals(Tuple4.class, schema.getTypeInfo().getTypeClass()); TypeInformation<Tuple2<String, Tuple4>> tuple2TypeInformation = Types.TUPLE(TypeInformation.of(String.class), schema.getTypeInfo()); assertEquals("Java Tuple2<String, Java Tuple4<Integer, Long, String, Double>>", tuple2TypeInformation.toString()); }
@Test public void testStreamTupleSerializerWithPrimitive() { TypeInformation<String> typeInfo = TypeInformation.of(new TypeHint<String>() {}); StreamSchema<String> schema = new StreamSchema<>(typeInfo, "words"); assertEquals(String.class, schema.getTypeInfo().getTypeClass()); TypeInformation<Tuple2<String, String>> tuple2TypeInformation = Types.TUPLE(TypeInformation.of(String.class), schema.getTypeInfo()); assertEquals("Java Tuple2<String, String>", tuple2TypeInformation.toString()); }