@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 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); } }