org.apache.flink.testutils.DeeplyEqualsChecker Java Examples
The following examples show how to use
org.apache.flink.testutils.DeeplyEqualsChecker.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ArrayDataSerializerTest.java From flink with Apache License 2.0 | 6 votes |
public ArrayDataSerializerTest() { super(new DeeplyEqualsChecker().withCustomCheck( (o1, o2) -> o1 instanceof ArrayData && o2 instanceof ArrayData, (o1, o2, checker) -> { ArrayData array1 = (ArrayData) o1; ArrayData array2 = (ArrayData) o2; if (array1.size() != array2.size()) { return false; } for (int i = 0; i < array1.size(); i++) { if (!array1.isNullAt(i) || !array2.isNullAt(i)) { if (array1.isNullAt(i) || array2.isNullAt(i)) { return false; } else { if (!array1.getString(i).equals(array2.getString(i))) { return false; } } } } return true; } )); }
Example #2
Source File: UnionSerializerTest.java From flink with Apache License 2.0 | 6 votes |
public UnionSerializerTest() { super(new DeeplyEqualsChecker() .withCustomCheck( (o1, o2) -> o1 instanceof TaggedUnion && o2 instanceof TaggedUnion, (o1, o2, checker) -> { TaggedUnion union1 = (TaggedUnion) o1; TaggedUnion union2 = (TaggedUnion) o2; if (union1.isOne() && union2.isOne()) { return checker.deepEquals(union1.getOne(), union2.getOne()); } else if (union1.isTwo() && union2.isTwo()) { return checker.deepEquals(union1.getTwo(), union2.getTwo()); } else { return false; } } )); }
Example #3
Source File: RowDataSerializerTest.java From flink with Apache License 2.0 | 6 votes |
public RowDataSerializerTest() { super( new DeeplyEqualsChecker() .withCustomCheck( (o1, o2) -> o1 instanceof RowData && o2 instanceof RowData, (o1, o2, checker) -> { LogicalType[] fieldTypes = new LogicalType[] { new BigIntType(), new BigIntType() }; RowDataSerializer serializer = new RowDataSerializer(new ExecutionConfig(), fieldTypes); return deepEqualsRowData( (RowData) o1, (RowData) o2, (RowDataSerializer) serializer.duplicate(), (RowDataSerializer) serializer.duplicate()); } )); }
Example #4
Source File: RowDataSerializerTest.java From flink with Apache License 2.0 | 6 votes |
public RowDataSerializerTest(RowDataSerializer serializer, RowData[] testData) { super( new DeeplyEqualsChecker() .withCustomCheck( (o1, o2) -> o1 instanceof RowData && o2 instanceof RowData, (o1, o2, checker) -> deepEqualsRowData((RowData) o1, (RowData) o2, (RowDataSerializer) serializer.duplicate(), (RowDataSerializer) serializer.duplicate()) ), serializer, RowData.class, -1, testData); this.serializer = serializer; this.testData = testData; }
Example #5
Source File: UnionSerializerTest.java From flink with Apache License 2.0 | 6 votes |
public UnionSerializerTest() { super(new DeeplyEqualsChecker() .withCustomCheck( (o1, o2) -> o1 instanceof TaggedUnion && o2 instanceof TaggedUnion, (o1, o2, checker) -> { TaggedUnion union1 = (TaggedUnion) o1; TaggedUnion union2 = (TaggedUnion) o2; if (union1.isOne() && union2.isOne()) { return checker.deepEquals(union1.getOne(), union2.getOne()); } else if (union1.isTwo() && union2.isTwo()) { return checker.deepEquals(union1.getTwo(), union2.getTwo()); } else { return false; } } )); }
Example #6
Source File: BaseArraySerializerTest.java From flink with Apache License 2.0 | 6 votes |
public BaseArraySerializerTest() { super(new DeeplyEqualsChecker().withCustomCheck( (o1, o2) -> o1 instanceof BaseArray && o2 instanceof BaseArray, (o1, o2, checker) -> { BaseArray array1 = (BaseArray) o1; BaseArray array2 = (BaseArray) o2; if (array1.numElements() != array2.numElements()) { return false; } for (int i = 0; i < array1.numElements(); i++) { if (!array1.isNullAt(i) || !array2.isNullAt(i)) { if (array1.isNullAt(i) || array2.isNullAt(i)) { return false; } else { if (!array1.getString(i).equals(array2.getString(i))) { return false; } } } } return true; } )); }
Example #7
Source File: BaseRowSerializerTest.java From flink with Apache License 2.0 | 6 votes |
public BaseRowSerializerTest(BaseRowSerializer serializer, BaseRow[] testData) { super( new DeeplyEqualsChecker() .withCustomCheck( (o1, o2) -> o1 instanceof BaseRow && o2 instanceof BaseRow, (o1, o2, checker) -> deepEqualsBaseRow((BaseRow) o1, (BaseRow) o2, (BaseRowSerializer) serializer.duplicate(), (BaseRowSerializer) serializer.duplicate()) ), serializer, BaseRow.class, -1, testData); this.serializer = serializer; this.testData = testData; }
Example #8
Source File: UnionSerializerTest.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
public UnionSerializerTest() { super(new DeeplyEqualsChecker() .withCustomCheck( (o1, o2) -> o1 instanceof TaggedUnion && o2 instanceof TaggedUnion, (o1, o2, checker) -> { TaggedUnion union1 = (TaggedUnion) o1; TaggedUnion union2 = (TaggedUnion) o2; if (union1.isOne() && union2.isOne()) { return checker.deepEquals(union1.getOne(), union2.getOne()); } else if (union1.isTwo() && union2.isTwo()) { return checker.deepEquals(union1.getTwo(), union2.getTwo()); } else { return false; } } )); }
Example #9
Source File: RawValueDataSerializerTest.java From flink with Apache License 2.0 | 5 votes |
public RawValueDataSerializerTest() { super(new DeeplyEqualsChecker() .withCustomCheck( (o, o2) -> o instanceof RawValueData && o2 instanceof RawValueData, (o, o2, checker) -> RawValueDataAsserter.equivalent( (RawValueData) o2, new RawValueDataSerializer<>(StringSerializer.INSTANCE)).matches(o) )); }
Example #10
Source File: ValueArraySerializerTestBase.java From flink with Apache License 2.0 | 5 votes |
ValueArraySerializerTestBase() { super( new DeeplyEqualsChecker() .withCustomCheck( (o1, o2) -> o1 instanceof ValueArray && o2 instanceof ValueArray, (o1, o2, checker) -> Objects.equals(o1, o2))); }
Example #11
Source File: SerializerTestInstance.java From flink with Apache License 2.0 | 5 votes |
@SafeVarargs public SerializerTestInstance( DeeplyEqualsChecker checker, TypeSerializer<T> serializer, Class<T> typeClass, int length, T... testData) { super(checker); this.serializer = serializer; this.typeClass = typeClass; this.length = length; this.testData = testData; }
Example #12
Source File: SerializerTestBase.java From flink with Apache License 2.0 | 5 votes |
SerializerRunner( CyclicBarrier allReadyBarrier, TypeSerializer<T> serializer, T[] testData, long testTargetDurationMillis, DeeplyEqualsChecker checker) { this.allReadyBarrier = allReadyBarrier; this.serializer = serializer; this.testData = testData; this.durationLimitMillis = testTargetDurationMillis; this.checker = checker; this.failure = null; }
Example #13
Source File: ArrowSourceFunctionTest.java From flink with Apache License 2.0 | 5 votes |
public ArrowSourceFunctionTest() { super(VectorSchemaRoot.create(ArrowUtils.toArrowSchema(rowType), allocator), serializer, Comparator.comparing(o -> o.getString(0)), new DeeplyEqualsChecker() .withCustomCheck( (o1, o2) -> o1 instanceof RowData && o2 instanceof RowData, (o1, o2, checker) -> deepEqualsBaseRow( (RowData) o1, (RowData) o2, (RowDataSerializer) serializer.duplicate(), (RowDataSerializer) serializer.duplicate()))); }
Example #14
Source File: RowDataArrowReaderWriterTest.java From flink with Apache License 2.0 | 5 votes |
public RowDataArrowReaderWriterTest() { super(new DeeplyEqualsChecker() .withCustomCheck( (o1, o2) -> o1 instanceof RowData && o2 instanceof RowData, (o1, o2, checker) -> { RowDataSerializer serializer = new RowDataSerializer( new ExecutionConfig(), fieldTypes.toArray(new LogicalType[0])); return deepEqualsRowData( (RowData) o1, (RowData) o2, (RowDataSerializer) serializer.duplicate(), (RowDataSerializer) serializer.duplicate()); })); }
Example #15
Source File: MapDataSerializerTest.java From flink with Apache License 2.0 | 5 votes |
public MapDataSerializerTest() { super(new DeeplyEqualsChecker().withCustomCheck( (o1, o2) -> o1 instanceof MapData && o2 instanceof MapData, (o1, o2, checker) -> // Better is more proper to compare the maps after changing them to Java maps // instead of binary maps. For example, consider the following two maps: // {1: 1.0F, 2: 2.0F, 3: 3.0F} and {3: 3.0F, 2: 2.0F, 1: 1.0F} // These are actually the same maps, but their key / value order will be // different when stored as binary maps, and the equalsTo method of binary // map will return false. convertToJavaMap((MapData) o1, BIGINT, FLOAT) .equals(convertToJavaMap((MapData) o2, BIGINT, FLOAT)) )); }
Example #16
Source File: SerializerTestBase.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
SerializerRunner( CyclicBarrier allReadyBarrier, TypeSerializer<T> serializer, T[] testData, long testTargetDurationMillis, DeeplyEqualsChecker checker) { this.allReadyBarrier = allReadyBarrier; this.serializer = serializer; this.testData = testData; this.durationLimitMillis = testTargetDurationMillis; this.checker = checker; this.failure = null; }
Example #17
Source File: BaseMapSerializerTest.java From flink with Apache License 2.0 | 5 votes |
public BaseMapSerializerTest() { super(new DeeplyEqualsChecker().withCustomCheck( (o1, o2) -> o1 instanceof BaseMap && o2 instanceof BaseMap, (o1, o2, checker) -> // Better is more proper to compare the maps after changing them to Java maps // instead of binary maps. For example, consider the following two maps: // {1: 'a', 2: 'b', 3: 'c'} and {3: 'c', 2: 'b', 1: 'a'} // These are actually the same maps, but their key / value order will be // different when stored as binary maps, and the equalsTo method of binary // map will return false. ((BaseMap) o1).toJavaMap(INT, STRING) .equals(((BaseMap) o2).toJavaMap(INT, STRING)) )); }
Example #18
Source File: MapDataSerializerTest.java From flink with Apache License 2.0 | 5 votes |
public MapDataSerializerTest() { super(new DeeplyEqualsChecker().withCustomCheck( (o1, o2) -> o1 instanceof MapData && o2 instanceof MapData, (o1, o2, checker) -> // Better is more proper to compare the maps after changing them to Java maps // instead of binary maps. For example, consider the following two maps: // {1: 'a', 2: 'b', 3: 'c'} and {3: 'c', 2: 'b', 1: 'a'} // These are actually the same maps, but their key / value order will be // different when stored as binary maps, and the equalsTo method of binary // map will return false. convertToJavaMap((MapData) o1, INT, STRING) .equals(convertToJavaMap((MapData) o2, INT, STRING)) )); }
Example #19
Source File: ValueArraySerializerTestBase.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
ValueArraySerializerTestBase() { super( new DeeplyEqualsChecker() .withCustomCheck( (o1, o2) -> o1 instanceof ValueArray && o2 instanceof ValueArray, (o1, o2, checker) -> Objects.equals(o1, o2))); }
Example #20
Source File: TaggedBootstrapDataSerializerTest.java From stateful-functions with Apache License 2.0 | 5 votes |
public TaggedBootstrapDataSerializerTest() { super( new DeeplyEqualsChecker().withCustomCheck( (o1, o2) -> o1 instanceof TaggedBootstrapData && o2 instanceof TaggedBootstrapData, (o1, o2, checker) -> { TaggedBootstrapData obj1 = (TaggedBootstrapData) o1; TaggedBootstrapData obj2 = (TaggedBootstrapData) o2; return obj1.getTarget().equals(obj2.getTarget()) && obj1.getUnionIndex() == obj2.getUnionIndex() // equality checks on payload makes sense here since // the payloads are only booleans or integers in this test && obj1.getPayload().equals(obj2.getPayload()); })); }
Example #21
Source File: SerializerTestInstance.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@SafeVarargs public SerializerTestInstance( DeeplyEqualsChecker checker, TypeSerializer<T> serializer, Class<T> typeClass, int length, T... testData) { super(checker); this.serializer = serializer; this.typeClass = typeClass; this.length = length; this.testData = testData; }
Example #22
Source File: ValueArraySerializerTestBase.java From flink with Apache License 2.0 | 5 votes |
ValueArraySerializerTestBase() { super( new DeeplyEqualsChecker() .withCustomCheck( (o1, o2) -> o1 instanceof ValueArray && o2 instanceof ValueArray, (o1, o2, checker) -> Objects.equals(o1, o2))); }
Example #23
Source File: SerializerTestInstance.java From flink with Apache License 2.0 | 5 votes |
@SafeVarargs public SerializerTestInstance( DeeplyEqualsChecker checker, TypeSerializer<T> serializer, Class<T> typeClass, int length, T... testData) { super(checker); this.serializer = serializer; this.typeClass = typeClass; this.length = length; this.testData = testData; }
Example #24
Source File: SerializerTestBase.java From flink with Apache License 2.0 | 5 votes |
SerializerRunner( CyclicBarrier allReadyBarrier, TypeSerializer<T> serializer, T[] testData, long testTargetDurationMillis, DeeplyEqualsChecker checker) { this.allReadyBarrier = allReadyBarrier; this.serializer = serializer; this.testData = testData; this.durationLimitMillis = testTargetDurationMillis; this.checker = checker; this.failure = null; }
Example #25
Source File: TaggedBootstrapDataSerializerTest.java From flink-statefun with Apache License 2.0 | 5 votes |
public TaggedBootstrapDataSerializerTest() { super( new DeeplyEqualsChecker() .withCustomCheck( (o1, o2) -> o1 instanceof TaggedBootstrapData && o2 instanceof TaggedBootstrapData, (o1, o2, checker) -> { TaggedBootstrapData obj1 = (TaggedBootstrapData) o1; TaggedBootstrapData obj2 = (TaggedBootstrapData) o2; return obj1.getTarget().equals(obj2.getTarget()) && obj1.getUnionIndex() == obj2.getUnionIndex() // equality checks on payload makes sense here since // the payloads are only booleans or integers in this test && obj1.getPayload().equals(obj2.getPayload()); })); }
Example #26
Source File: ArrowSourceFunctionTestBase.java From flink with Apache License 2.0 | 4 votes |
ArrowSourceFunctionTestBase(VectorSchemaRoot root, TypeSerializer<T> typeSerializer, Comparator<T> comparator, DeeplyEqualsChecker checker) { this.root = Preconditions.checkNotNull(root); this.typeSerializer = Preconditions.checkNotNull(typeSerializer); this.comparator = Preconditions.checkNotNull(comparator); this.checker = Preconditions.checkNotNull(checker); }
Example #27
Source File: SerializerTestBase.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
protected SerializerTestBase(DeeplyEqualsChecker checker) { this.checker = checker; }
Example #28
Source File: SerializerTestBase.java From flink with Apache License 2.0 | 4 votes |
protected SerializerTestBase() { this.checker = new DeeplyEqualsChecker(); }
Example #29
Source File: SerializerTestInstance.java From flink with Apache License 2.0 | 4 votes |
@SafeVarargs public SerializerTestInstance(TypeSerializer<T> serializer, Class<T> typeClass, int length, T... testData) { this(new DeeplyEqualsChecker(), serializer, typeClass, length, testData); }
Example #30
Source File: SerializerTestBase.java From flink with Apache License 2.0 | 4 votes |
protected SerializerTestBase(DeeplyEqualsChecker checker) { this.checker = checker; }