@Test public void testSimpleCaseDual() { String[] constantFieldsFirst = {"1->1,2", "2->3"}; String[] constantFieldsSecond = {"1->1,2", "2->3"}; TypeInformation<?> type = new TupleTypeInfo<Tuple4<Integer, Integer, Integer, Integer>>( BasicTypeInfo.INT_TYPE_INFO, BasicTypeInfo.INT_TYPE_INFO, BasicTypeInfo.INT_TYPE_INFO, BasicTypeInfo.INT_TYPE_INFO); DualInputSemanticProperties dsp = new DualInputSemanticProperties(); SemanticPropUtil.getSemanticPropsDualFromString( dsp, constantFieldsFirst, constantFieldsSecond, null, null, null, null, type, type, type); FieldSet fs = dsp.getForwardedField1(1); Assert.assertTrue(fs.size() == 2); Assert.assertTrue(fs.contains(1)); Assert.assertTrue(fs.contains(2)); fs = dsp.getForwardedField1(2); Assert.assertTrue(fs.size() == 1); Assert.assertTrue(fs.contains(3)); }
@Test public void testFieldsExceptDual() { String[] constantFieldsFirstExcept = {"1,2"}; String[] constantFieldsSecond = {"0->1"}; DualInputSemanticProperties dsp = new DualInputSemanticProperties(); TypeInformation<?> type = new TupleTypeInfo<Tuple3<Integer, Integer, Integer>>( BasicTypeInfo.INT_TYPE_INFO, BasicTypeInfo.INT_TYPE_INFO, BasicTypeInfo.INT_TYPE_INFO); SemanticPropUtil.getSemanticPropsDualFromString( dsp, null, constantFieldsSecond, constantFieldsFirstExcept, null, null, null, type, type, type); FieldSet fs = dsp.getForwardedField1(0); Assert.assertTrue(fs.size() == 1); Assert.assertTrue(fs.contains(0)); fs = dsp.getForwardedField1(1); Assert.assertTrue(fs == null); fs = dsp.getForwardedField1(2); Assert.assertTrue(fs == null); fs = dsp.getForwardedField2(0); Assert.assertTrue(fs.size() == 1); Assert.assertTrue(fs.contains(1)); }