JobControllerApiHandlerHelper { static HttpResponse jobTypeResponse(Controller controller, ApplicationId id, URI baseUriForJobs) { Slime slime = new Slime(); Cursor responseObject = slime.setObject(); Cursor jobsArray = responseObject.setArray("deployment"); Arrays.stream(JobType.values()) .filter(type -> type.environment().isManuallyDeployed()) .map(devType -> new JobId(id, devType)) .forEach(job -> { Collection<Run> runs = controller.jobController().runs(job).descendingMap().values(); if (runs.isEmpty()) return; Cursor jobObject = jobsArray.addObject(); jobObject.setString("jobName", job.type().jobName()); toSlime(jobObject.setArray("runs"), runs, baseUriForJobs); }); return new SlimeJsonResponse(slime); }    }
@Test public void testResponsesWithDirectDeployment() { var tester = new DeploymentTester(); var app = tester.newDeploymentContext(); tester.clock().setInstant(Instant.EPOCH); var region = "us-west-1"; var applicationPackage = new ApplicationPackageBuilder().region(region).build(); tester.controller().applications().deploy(tester.instance().id(), ZoneId.from("prod", region), Optional.of(applicationPackage), new DeployOptions(true, Optional.empty(), false, false)); assertResponse(JobControllerApiHandlerHelper.jobTypeResponse(tester.controller(), app.instanceId(), URI.create("https: "jobs-direct-deployment.json"); }