use of org.apache.flink.runtime.rest.messages.JobPlanInfo in project flink by apache.
the class JarPlanHandlerParameterTest method setup.
@BeforeClass
public static void setup() throws Exception {
init();
handler = new JarPlanHandler(gatewayRetriever, timeout, responseHeaders, JarPlanGetHeaders.getInstance(), jarDir, new Configuration(), executor, jobGraph -> {
LAST_SUBMITTED_JOB_GRAPH_REFERENCE.set(jobGraph);
return new JobPlanInfo(JsonPlanGenerator.generatePlan(jobGraph));
});
}
use of org.apache.flink.runtime.rest.messages.JobPlanInfo in project flink by apache.
the class JarSubmissionITCase method testJarSubmission.
@Test
public void testJarSubmission() throws Exception {
final TestingDispatcherGateway restfulGateway = TestingDispatcherGateway.newBuilder().setBlobServerPort(blobServerResource.getBlobServerPort()).setSubmitFunction(jobGraph -> CompletableFuture.completedFuture(Acknowledge.get())).build();
final JarHandlers handlers = new JarHandlers(temporaryFolder.newFolder().toPath(), restfulGateway);
final JarUploadHandler uploadHandler = handlers.uploadHandler;
final JarListHandler listHandler = handlers.listHandler;
final JarPlanHandler planHandler = handlers.planHandler;
final JarRunHandler runHandler = handlers.runHandler;
final JarDeleteHandler deleteHandler = handlers.deleteHandler;
// targetDir property is set via surefire configuration
final Path originalJar = Paths.get(System.getProperty("targetDir")).resolve("test-program.jar");
final Path jar = Files.copy(originalJar, temporaryFolder.getRoot().toPath().resolve("test-program.jar"));
final String storedJarPath = uploadJar(uploadHandler, jar, restfulGateway);
final String storedJarName = Paths.get(storedJarPath).getFileName().toString();
final JarListInfo postUploadListResponse = listJars(listHandler, restfulGateway);
Assert.assertEquals(1, postUploadListResponse.jarFileList.size());
final JarListInfo.JarFileInfo listEntry = postUploadListResponse.jarFileList.iterator().next();
Assert.assertEquals(jar.getFileName().toString(), listEntry.name);
Assert.assertEquals(storedJarName, listEntry.id);
final JobPlanInfo planResponse = showPlan(planHandler, storedJarName, restfulGateway);
// we're only interested in the core functionality so checking for a small detail is
// sufficient
Assert.assertThat(planResponse.getJsonPlan(), containsString("TestProgram.java:28"));
runJar(runHandler, storedJarName, restfulGateway);
deleteJar(deleteHandler, storedJarName, restfulGateway);
final JarListInfo postDeleteListResponse = listJars(listHandler, restfulGateway);
Assert.assertEquals(0, postDeleteListResponse.jarFileList.size());
}
Aggregations