org.apache.flink.runtime.state.heap.TestDuplicateSerializer Java Examples

The following examples show how to use org.apache.flink.runtime.state.heap.TestDuplicateSerializer. 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: LockableTypeSerializerTest.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
/**
 * This tests that {@link Lockable.LockableTypeSerializer#duplicate()} works as expected.
 */
@Test
public void testDuplicate() {
	IntSerializer nonDuplicatingInnerSerializer = IntSerializer.INSTANCE;
	Assert.assertSame(nonDuplicatingInnerSerializer, nonDuplicatingInnerSerializer.duplicate());
	Lockable.LockableTypeSerializer<Integer> candidateTestShallowDuplicate =
		new Lockable.LockableTypeSerializer<>(nonDuplicatingInnerSerializer);
	Assert.assertSame(candidateTestShallowDuplicate, candidateTestShallowDuplicate.duplicate());

	TestDuplicateSerializer duplicatingInnerSerializer = new TestDuplicateSerializer();
	Assert.assertNotSame(duplicatingInnerSerializer, duplicatingInnerSerializer.duplicate());

	Lockable.LockableTypeSerializer<Integer> candidateTestDeepDuplicate =
		new Lockable.LockableTypeSerializer<>(duplicatingInnerSerializer);

	Lockable.LockableTypeSerializer<Integer> deepDuplicate = candidateTestDeepDuplicate.duplicate();
	Assert.assertNotSame(candidateTestDeepDuplicate, deepDuplicate);
	Assert.assertNotSame(candidateTestDeepDuplicate.getElementSerializer(), deepDuplicate.getElementSerializer());
}
 
Example #2
Source File: LockableTypeSerializerTest.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * This tests that {@link Lockable.LockableTypeSerializer#duplicate()} works as expected.
 */
@Test
public void testDuplicate() {
	IntSerializer nonDuplicatingInnerSerializer = IntSerializer.INSTANCE;
	Assert.assertSame(nonDuplicatingInnerSerializer, nonDuplicatingInnerSerializer.duplicate());
	Lockable.LockableTypeSerializer<Integer> candidateTestShallowDuplicate =
		new Lockable.LockableTypeSerializer<>(nonDuplicatingInnerSerializer);
	Assert.assertSame(candidateTestShallowDuplicate, candidateTestShallowDuplicate.duplicate());

	TestDuplicateSerializer duplicatingInnerSerializer = new TestDuplicateSerializer();
	Assert.assertNotSame(duplicatingInnerSerializer, duplicatingInnerSerializer.duplicate());

	Lockable.LockableTypeSerializer<Integer> candidateTestDeepDuplicate =
		new Lockable.LockableTypeSerializer<>(duplicatingInnerSerializer);

	Lockable.LockableTypeSerializer<Integer> deepDuplicate = candidateTestDeepDuplicate.duplicate();
	Assert.assertNotSame(candidateTestDeepDuplicate, deepDuplicate);
	Assert.assertNotSame(candidateTestDeepDuplicate.getElementSerializer(), deepDuplicate.getElementSerializer());
}
 
Example #3
Source File: LockableTypeSerializerTest.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * This tests that {@link Lockable.LockableTypeSerializer#duplicate()} works as expected.
 */
@Test
public void testDuplicate() {
	IntSerializer nonDuplicatingInnerSerializer = IntSerializer.INSTANCE;
	Assert.assertSame(nonDuplicatingInnerSerializer, nonDuplicatingInnerSerializer.duplicate());
	Lockable.LockableTypeSerializer<Integer> candidateTestShallowDuplicate =
		new Lockable.LockableTypeSerializer<>(nonDuplicatingInnerSerializer);
	Assert.assertSame(candidateTestShallowDuplicate, candidateTestShallowDuplicate.duplicate());

	TestDuplicateSerializer duplicatingInnerSerializer = new TestDuplicateSerializer();
	Assert.assertNotSame(duplicatingInnerSerializer, duplicatingInnerSerializer.duplicate());

	Lockable.LockableTypeSerializer<Integer> candidateTestDeepDuplicate =
		new Lockable.LockableTypeSerializer<>(duplicatingInnerSerializer);

	Lockable.LockableTypeSerializer<Integer> deepDuplicate = candidateTestDeepDuplicate.duplicate();
	Assert.assertNotSame(candidateTestDeepDuplicate, deepDuplicate);
	Assert.assertNotSame(candidateTestDeepDuplicate.getElementSerializer(), deepDuplicate.getElementSerializer());
}