@Test
  public void testRestUrlStartHumanTaskProcess() throws Exception {
    // create REST request
    String urlString =
        new URL(
                deploymentUrl,
                deploymentUrl.getPath() + "rest/runtime/test/process/org.jbpm.humantask/start")
            .toExternalForm();
    ClientRequest restRequest = new ClientRequest(urlString);

    // Get and check response
    logger.debug(">> [org.jbpm.humantask/start]" + urlString);
    ClientResponse responseObj = restRequest.post();
    assertEquals(200, responseObj.getStatus());
    JaxbProcessInstanceResponse processInstance =
        (JaxbProcessInstanceResponse) responseObj.getEntity(JaxbProcessInstanceResponse.class);
    long procInstId = processInstance.getId();

    urlString =
        new URL(deploymentUrl, deploymentUrl.getPath() + "rest/task/query?taskOwner=" + USER_ID)
            .toExternalForm();
    restRequest = new ClientRequest(urlString);
    logger.debug(">> [task/query]" + urlString);
    responseObj = restRequest.get();
    assertEquals(200, responseObj.getStatus());

    JaxbTaskSummaryListResponse taskSumlistResponse =
        (JaxbTaskSummaryListResponse) responseObj.getEntity(JaxbTaskSummaryListResponse.class);
    long taskId = findTaskId(procInstId, taskSumlistResponse.getResult());

    urlString =
        new URL(
                deploymentUrl,
                deploymentUrl.getPath() + "rest/task/" + taskId + "/start?userId=" + USER_ID)
            .toExternalForm();
    restRequest = new ClientRequest(urlString);

    // Get response
    logger.debug(">> [task/?/start] " + urlString);
    responseObj = restRequest.post();

    // Check response
    checkResponse(responseObj);
  }
  @Test
  public void testRestHistoryLogs() throws Exception {
    String urlString =
        new URL(
                deploymentUrl,
                deploymentUrl.getPath() + "rest/runtime/test/process/var-proc/start?map_x=initVal")
            .toExternalForm();
    ClientRequest restRequest = new ClientRequest(urlString);

    // Get and check response
    logger.debug(">> " + urlString);
    ClientResponse responseObj = restRequest.post();
    assertEquals(200, responseObj.getStatus());
    JaxbProcessInstanceResponse processInstance =
        (JaxbProcessInstanceResponse) responseObj.getEntity(JaxbProcessInstanceResponse.class);
    long procInstId = processInstance.getId();

    urlString =
        new URL(
                deploymentUrl,
                deploymentUrl.getPath()
                    + "rest/runtime/test/history/instance/"
                    + procInstId
                    + "/variable/x")
            .toExternalForm();
    restRequest = new ClientRequest(urlString);
    logger.debug(">> [history/variables]" + urlString);
    responseObj = restRequest.get();
    assertEquals(200, responseObj.getStatus());
    JaxbHistoryLogList logList =
        (JaxbHistoryLogList) responseObj.getEntity(JaxbHistoryLogList.class);
    List<AbstractJaxbHistoryObject> varLogList = logList.getHistoryLogList();
    assertEquals("Incorrect number of variable logs", 4, varLogList.size());

    for (AbstractJaxbHistoryObject<?> log : logList.getHistoryLogList()) {
      JaxbVariableInstanceLog varLog = (JaxbVariableInstanceLog) log;
      assertEquals("Incorrect variable id", "x", varLog.getVariableId());
      assertEquals("Incorrect process id", "var-proc", varLog.getProcessId());
      assertEquals("Incorrect process instance id", "var-proc", varLog.getProcessId());
    }
  }