@Test
  public void testFindByClientAppIdAndStatus() throws Exception {
    // ClientApp clientApp = clientAppService.getAllClientAppByClientID(new
    // Long(TEST_CLIENT_ID)).get(0);
    String testStatus = "TESTING324";
    List<TaskTranslation> translations = generateTestTranslationTasks(NEW_CLIENT_APP_ID, true, 4);
    TaskTranslation taskTranslation = translations.get(0);
    taskTranslation.setStatus(testStatus);
    translationService.updateTranslation(taskTranslation);

    List testList =
        translationService.findAllTranslationsByClientAppIdAndStatus(
            new Long(NEW_CLIENT_APP_ID), testStatus, 1000);
    assert (testList.size() == 1);

    String newClientAppId = "976";
    taskTranslation = translations.get(1);
    taskTranslation.setClientAppId(newClientAppId);
    translationService.updateTranslation(taskTranslation);

    testList =
        translationService.findAllTranslationsByClientAppIdAndStatus(
            new Long(newClientAppId), TaskTranslation.STATUS_NEW, 1000);
    assert (testList.size() == 1);
    Iterator<TaskTranslation> itr = translations.iterator();
    while (itr.hasNext()) {
      TaskTranslation translation = itr.next();
      translationService.delete(translation);
    }
  }
  @Test
  public void testFindByTaskId() throws Exception {
    TaskTranslation translation = new TaskTranslation();
    translation.setTaskId(new Long(898));
    translationService.createTranslation(translation);

    TaskTranslation found = translationService.findByTaskId(new Long(898));
    assertNotNull(found);
    translationService.delete(found);
  }
  @Test
  public void testCreateAndUpdateTranslation() throws Exception {
    int initialSize = translationService.findAllTranslations().size();
    TaskTranslation translation2 =
        new TaskTranslation(
            100l,
            "1000",
            "63636",
            null,
            null,
            null,
            null,
            100l,
            "Je m'appelle Jacques",
            TaskTranslation.STATUS_NEW);
    translationService.createTranslation(translation2);
    assertNotNull(translation2.getAuthor());
    assertNotNull(translation2.getUrl());

    TaskTranslation translation = new TaskTranslation();
    translationService.createTranslation(translation);
    assertNotNull(translation.getTranslationId());
    String newVal = "TEST";
    translation.setStatus(newVal);
    translationService.updateTranslation(translation);
    translation = translationService.findById(translation.getTranslationId());
    // we would really need to flush and clear the hibernate session for this next validation
    assertEquals(newVal, translation.getStatus());
    translationService.delete(translation);
    assertEquals(initialSize, translationService.findAllTranslations().size());
  }
  @Test
  public void testPushAllTranslations() {

    ClientApp clientApp =
        clientAppService.getAllClientAppByClientID(new Long(TEST_CLIENT_ID)).get(0);
    Long tcProjectId = new Long(TEST_TWB_PROJECT_ID);
    /*        if (clientApp.getTcProjectId() != null) {
                tcProjectId = clientApp.getTcProjectId();
            }
    */
    List translations = generateTestTranslationTasks(NEW_CLIENT_APP_ID, true, 6);
    Long clientAppId = new Long(NEW_CLIENT_APP_ID);
    List checkTranslations =
        translationService.findAllTranslationsByClientAppIdAndStatus(
            clientAppId, TaskTranslation.STATUS_NEW, 100);

    assert (checkTranslations.size() > 0);

    Map result =
        translationService.pushAllTranslations(clientAppId, new Long(TEST_TWB_PROJECT_ID), 0, 5);
    assertNotNull(result);

    List<TaskTranslation> inProgressTranslations =
        translationService.findAllTranslationsByClientAppIdAndStatus(
            clientAppId, TaskTranslation.STATUS_IN_PROGRESS, 100);
    assert (inProgressTranslations.size() > (checkTranslations.size() - 5));
    Iterator<TaskTranslation> itr = inProgressTranslations.iterator();
    while (itr.hasNext()) {
      TaskTranslation translation = itr.next();
      assert (translation.getStatus().equals(TaskTranslation.STATUS_IN_PROGRESS));
    }

    Iterator<TaskTranslation> itr2 = checkTranslations.iterator();
    while (itr2.hasNext()) {
      TaskTranslation translation = itr2.next();
      // translationService.delete(translation);
    }
  }