OrganizationServiceImpl extends AbstractConsoleService<OrganizationTblDao> implements OrganizationService { @Override public void updateOrganizations() { List<OrganizationTbl> remoteDBOrgs = retrieveOrgInfoFromRemote(); List<OrganizationTbl> localDBOrgs = getAllOrganizations(); List<OrganizationTbl> orgsToCreate = getOrgTblCreateList(remoteDBOrgs, localDBOrgs); List<OrganizationTbl> orgsToUpdate = getOrgTblUpdateList(remoteDBOrgs, localDBOrgs); updateDB(orgsToCreate, orgsToUpdate); }  @Override void updateOrganizations(); @Override List<OrganizationTbl> getAllOrganizations(); @Override OrganizationTbl getOrganizationTblByCMSOrganiztionId(long organizationId); @Override OrganizationTbl getOrgByName(String name); @Override List<OrganizationTbl> getInvolvedOrgs(); @Override OrganizationTbl getOrganization(long xpipeOrgId);  }
@Test public void testUpdateOrganizations() { List<OrganizationTbl> localDbOrgs = createOrganizationTblList(10); organizationDao.createBatchOrganizations(localDbOrgs); localDbOrgs = organizationService.getAllOrganizations(); List<OrganizationTbl> remoteDbOrgs = Lists.newArrayList(localDbOrgs); OrganizationTbl org = new OrganizationTbl().setOrgId(remoteDbOrgs.get(0).getOrgId()).setOrgName("test-different"); remoteDbOrgs.set(0, org); List<OrganizationTbl> result = organizationService.getOrgTblUpdateList(remoteDbOrgs, localDbOrgs); Assert.assertEquals(1, result.size()); Assert.assertEquals("test-different", result.get(0).getOrgName()); OrganizationTbl organizationTbl = organizationService.getOrganizationTblByCMSOrganiztionId(result.get(0).getOrgId()); System.out.println(organizationTbl.getOrgName()); }