use of com.spotify.helios.common.protocol.CreateJobResponse in project helios by spotify.
the class ApiTest method testHashLessJobCreation.
/**
* Verify that the Helios master generates and returns a hash if the submitted job creation
* request does not include one.
*/
@Test
public void testHashLessJobCreation() throws Exception {
startDefaultMaster();
final Job job = Job.newBuilder().setName(testJobName).setVersion(testJobVersion).setImage(BUSYBOX).setCommand(IDLE_COMMAND).setCreatingUser(TEST_USER).build();
// Remove the hash from the id in the json serialized job
final ObjectNode json = (ObjectNode) Json.reader().readTree(Json.asString(job));
json.set("id", TextNode.valueOf(testJobName + ":" + testJobVersion));
final HttpURLConnection req = post("/jobs?user=" + TEST_USER, Json.asBytes(json));
assertEquals(req.getResponseCode(), 200);
final CreateJobResponse res = Json.read(toByteArray(req.getInputStream()), CreateJobResponse.class);
assertEquals(OK, res.getStatus());
assertTrue(res.getErrors().isEmpty());
assertEquals(job.getId().toString(), res.getId());
}
Aggregations