org.apache.flink.runtime.event.task.IntegerTaskEvent Java Examples

The following examples show how to use org.apache.flink.runtime.event.task.IntegerTaskEvent. 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: TaskEventHandlerTest.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
/**
 * Tests the publish/subscribe mechanisms implemented in the {@link TaskEventHandler}.
 */
@Test
public void testEventNotificationManager() {

	final TaskEventHandler evm = new TaskEventHandler();
	final TestEventListener listener = new TestEventListener();

	evm.subscribe(listener, StringTaskEvent.class);

	final StringTaskEvent stringTaskEvent1 = new StringTaskEvent("Test 1");

	evm.publish(stringTaskEvent1);
	evm.publish(new IntegerTaskEvent(5));

	assertNotNull(listener.getLastReceivedEvent());
	StringTaskEvent receivedStringEvent = (StringTaskEvent) listener.getLastReceivedEvent();
	assertEquals(stringTaskEvent1, receivedStringEvent);
}
 
Example #2
Source File: TaskEventHandlerTest.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * Tests the publish/subscribe mechanisms implemented in the {@link TaskEventHandler}.
 */
@Test
public void testEventNotificationManager() {

	final TaskEventHandler evm = new TaskEventHandler();
	final TestEventListener listener = new TestEventListener();

	evm.subscribe(listener, StringTaskEvent.class);

	final StringTaskEvent stringTaskEvent1 = new StringTaskEvent("Test 1");

	evm.publish(stringTaskEvent1);
	evm.publish(new IntegerTaskEvent(5));

	assertNotNull(listener.getLastReceivedEvent());
	StringTaskEvent receivedStringEvent = (StringTaskEvent) listener.getLastReceivedEvent();
	assertEquals(stringTaskEvent1, receivedStringEvent);
}
 
Example #3
Source File: TaskEventHandlerTest.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * Tests the publish/subscribe mechanisms implemented in the {@link TaskEventHandler}.
 */
@Test
public void testEventNotificationManager() {

	final TaskEventHandler evm = new TaskEventHandler();
	final TestEventListener listener = new TestEventListener();

	evm.subscribe(listener, StringTaskEvent.class);

	final StringTaskEvent stringTaskEvent1 = new StringTaskEvent("Test 1");

	evm.publish(stringTaskEvent1);
	evm.publish(new IntegerTaskEvent(5));

	assertNotNull(listener.getLastReceivedEvent());
	StringTaskEvent receivedStringEvent = (StringTaskEvent) listener.getLastReceivedEvent();
	assertEquals(stringTaskEvent1, receivedStringEvent);
}
 
Example #4
Source File: NettyMessageServerSideSerializationTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
public void testTaskEventRequest() {
	NettyMessage.TaskEventRequest expected = new NettyMessage.TaskEventRequest(
		new IntegerTaskEvent(random.nextInt()),
		new ResultPartitionID(),
		new InputChannelID());
	NettyMessage.TaskEventRequest actual = encodeAndDecode(expected, channel);

	assertEquals(expected.event, actual.event);
	assertEquals(expected.partitionId, actual.partitionId);
	assertEquals(expected.receiverId, actual.receiverId);
}