Java Code Examples for org.apache.flink.runtime.testingUtils.TestingUtils#TIMEOUT

The following examples show how to use org.apache.flink.runtime.testingUtils.TestingUtils#TIMEOUT . 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: AggregatingMetricsHandlerTestBase.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Before
public void setUp() throws Exception {
	MetricFetcher fetcher = new MetricFetcherImpl<RestfulGateway>(
		mock(GatewayRetriever.class),
		mock(MetricQueryServiceRetriever.class),
		Executors.directExecutor(),
		TestingUtils.TIMEOUT(),
		MetricOptions.METRIC_FETCHER_UPDATE_INTERVAL.defaultValue());
	store = fetcher.getMetricStore();

	Collection<MetricDump> metricDumps = getMetricDumps();
	for (MetricDump dump : metricDumps) {
		store.add(dump);
	}

	handler = getHandler(
		LEADER_RETRIEVER,
		TIMEOUT,
		TEST_HEADERS,
		EXECUTOR,
		fetcher);
	pathParameters = getPathParameters();
}
 
Example 2
Source File: AggregatingMetricsHandlerTestBase.java    From flink with Apache License 2.0 6 votes vote down vote up
@Before
public void setUp() throws Exception {
	MetricFetcher fetcher = new MetricFetcherImpl<RestfulGateway>(
		mock(GatewayRetriever.class),
		mock(MetricQueryServiceRetriever.class),
		Executors.directExecutor(),
		TestingUtils.TIMEOUT(),
		MetricOptions.METRIC_FETCHER_UPDATE_INTERVAL.defaultValue());
	store = fetcher.getMetricStore();

	Collection<MetricDump> metricDumps = getMetricDumps();
	for (MetricDump dump : metricDumps) {
		store.add(dump);
	}

	handler = getHandler(
		LEADER_RETRIEVER,
		TIMEOUT,
		TEST_HEADERS,
		EXECUTOR,
		fetcher);
	pathParameters = getPathParameters();
}
 
Example 3
Source File: LegacySchedulerBatchSchedulingTest.java    From flink with Apache License 2.0 6 votes vote down vote up
private LegacyScheduler createLegacyScheduler(JobGraph jobGraph, SlotPool slotPool, ComponentMainThreadExecutor mainThreadExecutor, Time slotRequestTimeout) throws Exception {
	final Scheduler scheduler = createScheduler(slotPool, mainThreadExecutor);
	final LegacyScheduler legacyScheduler = new LegacyScheduler(
		LOG,
		jobGraph,
		VoidBackPressureStatsTracker.INSTANCE,
		TestingUtils.defaultExecutor(),
		new Configuration(),
		scheduler,
		TestingUtils.defaultExecutor(),
		getClass().getClassLoader(),
		new StandaloneCheckpointRecoveryFactory(),
		TestingUtils.TIMEOUT(),
		new NoRestartStrategy.NoRestartStrategyFactory(),
		VoidBlobWriter.getInstance(),
		UnregisteredMetricGroups.createUnregisteredJobManagerJobMetricGroup(),
		slotRequestTimeout,
		NettyShuffleMaster.INSTANCE,
		NoOpPartitionTracker.INSTANCE);

	legacyScheduler.setMainThreadExecutor(mainThreadExecutor);

	return legacyScheduler;
}
 
Example 4
Source File: AggregatingMetricsHandlerTestBase.java    From flink with Apache License 2.0 6 votes vote down vote up
@Before
public void setUp() throws Exception {
	MetricFetcher fetcher = new MetricFetcherImpl<RestfulGateway>(
		mock(GatewayRetriever.class),
		mock(MetricQueryServiceRetriever.class),
		Executors.directExecutor(),
		TestingUtils.TIMEOUT(),
		MetricOptions.METRIC_FETCHER_UPDATE_INTERVAL.defaultValue());
	store = fetcher.getMetricStore();

	Collection<MetricDump> metricDumps = getMetricDumps();
	for (MetricDump dump : metricDumps) {
		store.add(dump);
	}

	handler = getHandler(
		LEADER_RETRIEVER,
		TIMEOUT,
		TEST_HEADERS,
		EXECUTOR,
		fetcher);
	pathParameters = getPathParameters();
}
 
Example 5
Source File: TaskManagerLogListHandlerTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws HandlerRequestException {
	resourceManagerGateway = new TestingResourceManagerGateway();
	taskManagerLogListHandler = new TaskManagerLogListHandler(
		() -> CompletableFuture.completedFuture(null),
		TestingUtils.TIMEOUT(),
		Collections.emptyMap(),
		TaskManagerLogsHeaders.getInstance(),
		() -> CompletableFuture.completedFuture(resourceManagerGateway));
	handlerRequest = createRequest(EXPECTED_TASK_MANAGER_ID);
}
 
Example 6
Source File: JobExceptionsHandlerTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetJobExceptionsInfo() throws HandlerRequestException {
	final JobExceptionsHandler jobExceptionsHandler = new JobExceptionsHandler(
		() -> null,
		TestingUtils.TIMEOUT(),
		Collections.emptyMap(),
		JobExceptionsHeaders.getInstance(),
		new DefaultExecutionGraphCache(TestingUtils.TIMEOUT(), TestingUtils.TIMEOUT()),
		TestingUtils.defaultExecutor());
	final int numExceptions = 20;
	final AccessExecutionGraph archivedExecutionGraph = createAccessExecutionGraph(numExceptions);
	checkExceptionLimit(jobExceptionsHandler, archivedExecutionGraph, numExceptions, 10);
	checkExceptionLimit(jobExceptionsHandler, archivedExecutionGraph, numExceptions, numExceptions);
	checkExceptionLimit(jobExceptionsHandler, archivedExecutionGraph, numExceptions, 30);
}
 
Example 7
Source File: JobConfigHandlerTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
public void handleRequest_executionConfigWithSecretValues_excludesSecretValuesFromResponse() throws HandlerRequestException {
	final JobConfigHandler jobConfigHandler = new JobConfigHandler(
		() -> null,
		TestingUtils.TIMEOUT(),
		Collections.emptyMap(),
		JobConfigHeaders.getInstance(),
		new DefaultExecutionGraphCache(TestingUtils.TIMEOUT(), TestingUtils.TIMEOUT()),
		TestingUtils.defaultExecutor());

	final Map<String, String> globalJobParameters = new HashMap<>();
	globalJobParameters.put("foobar", "barfoo");
	globalJobParameters.put("bar.secret.foo", "my secret");
	globalJobParameters.put("password.to.my.safe", "12345");

	final ArchivedExecutionConfig archivedExecutionConfig = new ArchivedExecutionConfigBuilder()
		.setGlobalJobParameters(globalJobParameters)
		.build();
	final AccessExecutionGraph archivedExecutionGraph = new ArchivedExecutionGraphBuilder()
		.setArchivedExecutionConfig(archivedExecutionConfig)
		.build();
	final HandlerRequest<EmptyRequestBody, JobMessageParameters> handlerRequest = createRequest(archivedExecutionGraph.getJobID());

	final JobConfigInfo jobConfigInfoResponse = jobConfigHandler.handleRequest(handlerRequest, archivedExecutionGraph);

	final Map<String, String> filteredGlobalJobParameters = filterSecretValues(globalJobParameters);

	assertThat(jobConfigInfoResponse.getExecutionConfigInfo().getGlobalJobParameters(), is(equalTo(filteredGlobalJobParameters)));
}
 
Example 8
Source File: JobManagerLogListHandlerTest.java    From flink with Apache License 2.0 5 votes vote down vote up
private JobManagerLogListHandler createHandler(@Nullable final File jobManagerLogRoot) {
	return new JobManagerLogListHandler(
		() -> CompletableFuture.completedFuture(dispatcherGateway),
		TestingUtils.TIMEOUT(),
		Collections.emptyMap(),
		JobManagerLogListHeaders.getInstance(),
		jobManagerLogRoot);
}