コード例 #1
0
  @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);
    }
  }
コード例 #2
0
  @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());
  }
コード例 #3
0
  @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);
  }