Search in sources :

Example 1 with JobInitializationException

use of org.apache.flink.runtime.client.JobInitializationException in project flink by apache.

the class ClientUtilsTest method testWaitUntilJobInitializationFinished_throwsInitializationException.

/**
 * Ensure that the waitUntilJobInitializationFinished() method throws
 * JobInitializationException.
 */
@Test
public void testWaitUntilJobInitializationFinished_throwsInitializationException() {
    Iterator<JobStatus> statusSequenceIterator = Arrays.asList(JobStatus.INITIALIZING, JobStatus.INITIALIZING, JobStatus.FAILED).iterator();
    CommonTestUtils.assertThrows("Something is wrong", JobInitializationException.class, () -> {
        ClientUtils.waitUntilJobInitializationFinished(statusSequenceIterator::next, () -> {
            Throwable throwable = new JobInitializationException(TESTING_JOB_ID, "Something is wrong", new RuntimeException("Err"));
            return buildJobResult(throwable);
        }, ClassLoader.getSystemClassLoader());
        return null;
    });
}
Also used : JobStatus(org.apache.flink.api.common.JobStatus) SerializedThrowable(org.apache.flink.util.SerializedThrowable) JobInitializationException(org.apache.flink.runtime.client.JobInitializationException) Test(org.junit.Test)

Aggregations

JobStatus (org.apache.flink.api.common.JobStatus)1 JobInitializationException (org.apache.flink.runtime.client.JobInitializationException)1 SerializedThrowable (org.apache.flink.util.SerializedThrowable)1 Test (org.junit.Test)1