* register.
* @throws Exception if failed
*/
@Test
public void register() throws Exception {
JsonObject result = new JsonObject();
result.addProperty("status", "initialized");
result.addProperty("jrid", "testing");
JsonHandler handler = new JsonHandler(result);
server.register("/jobs", handler);
HttpJobClient client = new HttpJobClient(baseUrl);
JobScript script = new JobScript();
script.setBatchId("b");
script.setFlowId("f");
script.setExecutionId("e");
script.setPhase(ExecutionPhase.MAIN);
script.setStageId("s");
script.setMainClassName("Cls");
script.setProperties(new HashMap<String, String>());
script.setEnvironmentVariables(new HashMap<String, String>());
JobId id = client.register(script);
assertThat(id, is(new JobId("testing")));
assertThat(handler.requestElement, is(notNullValue()));
JsonObject object = handler.requestElement;
assertThat(object.get("batchId").getAsString(), is("b"));
assertThat(object.get("flowId").getAsString(), is("f"));
assertThat(object.get("executionId").getAsString(), is("e"));
assertThat(object.get("phaseId").getAsString(), is("main"));
assertThat(object.get("stageId").getAsString(), is("s"));
assertThat(object.get("properties").isJsonObject(), is(true));
assertThat(object.get("env").isJsonObject(), is(true));
}