public JarPlanHandler( final GatewayRetriever<? extends RestfulGateway> leaderRetriever, final Time timeout, final Map<String, String> responseHeaders, final MessageHeaders<JarPlanRequestBody, JobPlanInfo, JarPlanMessageParameters> messageHeaders, final Path jarDir, final Configuration configuration, final Executor executor) { this( leaderRetriever, timeout, responseHeaders, messageHeaders, jarDir, configuration, executor, jobGraph -> new JobPlanInfo(JsonPlanGenerator.generatePlan(jobGraph))); }
@Test public void testJarSubmission() throws Exception { final TestingDispatcherGateway restfulGateway = new TestingDispatcherGateway.Builder() .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:29")); runJar(runHandler, storedJarName, restfulGateway); deleteJar(deleteHandler, storedJarName, restfulGateway); final JarListInfo postDeleteListResponse = listJars(listHandler, restfulGateway); Assert.assertEquals(0, postDeleteListResponse.jarFileList.size()); }
@BeforeClass public static void setup() throws Exception { init(); handler = new JarPlanHandler( gatewayRetriever, timeout, responseHeaders, JarPlanHeaders.getInstance(), jarDir, new Configuration(), executor, jobGraph -> { LAST_SUBMITTED_JOB_GRAPH_REFERENCE.set(jobGraph); return new JobPlanInfo(JsonPlanGenerator.generatePlan(jobGraph)); }); }
private static JobPlanInfo createJobPlanInfo(AccessExecutionGraph executionGraph) { return new JobPlanInfo(executionGraph.getJsonPlan()); } }
private static JobPlanInfo createJobPlanInfo(AccessExecutionGraph executionGraph) { return new JobPlanInfo(executionGraph.getJsonPlan()); } }
private static JobPlanInfo createJobPlanInfo(AccessExecutionGraph executionGraph) { return new JobPlanInfo(executionGraph.getJsonPlan()); } }
localRestAddress, leaderRetriever, timeout, responseHeaders, messageHeaders, jarDir, configuration, executor, jobGraph -> new JobPlanInfo(JsonPlanGenerator.generatePlan(jobGraph)));
localRestAddress, leaderRetriever, timeout, responseHeaders, messageHeaders, jarDir, configuration, executor, jobGraph -> new JobPlanInfo(JsonPlanGenerator.generatePlan(jobGraph)));