@Test public void testForwardWithDualInputAndCollector() { compareAnalyzerResultWithAnnotationsDualInput(FlatJoinFunction.class, Join2.class, TypeInformation.of(new TypeHint<Tuple2<Long, Long>>(){}), TypeInformation.of(new TypeHint<Tuple2<Long, Long>>(){}), TypeInformation.of(new TypeHint<Tuple2<Long, Long>>(){})); }
@Test public void testCanopyExamplesMapToCenter() { compareAnalyzerResultWithAnnotationsSingleInput(MapFunction.class, MapToCenter.class, TypeInformation.of(new TypeHint<Tuple5<Integer, Boolean, Boolean, String, String>>(){}), TypeInformation.of(new TypeHint<Tuple5<Integer, Boolean, Boolean, String, String>>(){})); }
@Test public void testKMeansppExamplesRecordToDocConverter() { compareAnalyzerResultWithAnnotationsSingleInputWithKeys(GroupReduceFunction.class, RecordToDocConverter.class, TypeInformation.of(new TypeHint<Tuple3<Integer, Integer, Double>>(){}), TypeInformation.of(new TypeHint<DocumentWithFreq>(){}), new String[] { "0" }); } }
@Test public void testForwardWithAtLeastOneIterationAssumption6() { compareAnalyzerResultWithAnnotationsSingleInputWithKeys(GroupReduceFunction.class, GroupReduce9.class, TypeInformation.of(new TypeHint<Tuple2<Long, Long>>(){}), TypeInformation.of(new TypeHint<Tuple2<Long, Long>>(){}), new String[] { "f0" }); }
@Test public void testForwardWithPojoPublicAttrAccess() { compareAnalyzerResultWithAnnotationsSingleInput(MapFunction.class, Map5.class, TypeInformation.of(new TypeHint<MyPojo>(){}), Types.STRING); }
@Test public void testForwardWithAtLeastOneIterationAssumption4() { compareAnalyzerResultWithAnnotationsSingleInputWithKeys(GroupReduceFunction.class, GroupReduce7.class, TypeInformation.of(new TypeHint<Tuple2<Long, Long>>(){}), Types.LONG, new String[] { "f0" }); }
@Test public void testForwardWithAtLeastOneIterationAssumption7() { compareAnalyzerResultWithAnnotationsSingleInputWithKeys(GroupReduceFunction.class, GroupReduce10.class, TypeInformation.of(new TypeHint<Tuple2<Long, Long>>(){}), Types.BOOLEAN, new String[] { "f0" }); }
@Test public void testOfGenericClassForFlink() { try { TypeInformation.of(Tuple3.class); fail("should fail with an exception"); } catch (FlinkRuntimeException e) { // check that the error message mentions the TypeHint assertNotEquals(-1, e.getMessage().indexOf("TypeHint")); } }
@SuppressWarnings({ "unchecked", "rawtypes" }) @Test public void testGenericPojoTypeInference5() { MyMapper5<Byte> function = new MyMapper5<>(); TypeInformation<?> ti = TypeExtractor.getMapReturnTypes( function, TypeInformation.of(new TypeHint<PojoWithParameterizedFields2<Byte>>(){})); Assert.assertEquals(BasicTypeInfo.BYTE_TYPE_INFO, ti); }
@SuppressWarnings({ "unchecked", "rawtypes" }) @Test public void testInputInference3() { EdgeMapper3<Boolean, String> em = new EdgeMapper3<Boolean, String>(); TypeInformation<?> ti = TypeExtractor.getMapReturnTypes((MapFunction) em, TypeInformation.of(new TypeHint<Tuple3<Boolean,Boolean,String>>(){})); Assert.assertTrue(ti.isBasicType()); Assert.assertEquals(BasicTypeInfo.STRING_TYPE_INFO, ti); }
@SuppressWarnings({ "unchecked", "rawtypes" }) @Test public void testGenericObjectArrays() { MyGenericPojo<String>[][] array = (MyGenericPojo<String>[][]) new MyGenericPojo[][]{ { new MyGenericPojo<String>(new String[][]{{"a", "b"},{"c", "d"}}), null} }; TypeInformation<MyGenericPojo<String>[][]> ti = TypeInformation.of(new TypeHint<MyGenericPojo<String>[][]>(){}); SerializerTestInstance testInstance = new SerializerTestInstance(ti.createSerializer(new ExecutionConfig()), MyGenericPojo[][].class, -1, (Object) array); testInstance.testAll(); }
@SuppressWarnings({ "unchecked", "rawtypes" }) @Test public void testGenericPojoTypeInference3() { MyMapper3<Boolean, Character> function = new MyMapper3<>(); TypeInformation<?> ti = TypeExtractor.getMapReturnTypes( function, TypeInformation.of(new TypeHint<PojoTuple<Character, Boolean, Boolean>>(){})); Assert.assertTrue(ti instanceof TupleTypeInfo<?>); TupleTypeInfo<?> tti = (TupleTypeInfo<?>) ti; Assert.assertEquals(BasicTypeInfo.CHAR_TYPE_INFO, tti.getTypeAt(0)); Assert.assertEquals(BasicTypeInfo.BOOLEAN_TYPE_INFO, tti.getTypeAt(1)); }