@Test public void testExtractNoEntityBecauseWrongDate() { entityBody.put(ParameterConstants.BEGIN_DATE, "2012-05-01"); Mockito.when(mockRepo.findEach(Mockito.eq(EntityNames.STAFF_PROGRAM_ASSOCIATION), Mockito.eq(new NeutralQuery()))) .thenReturn(Arrays.asList(mockEntity).iterator()); Mockito.when(mockMap.getExtractFileForEdOrg("LEA")).thenReturn(mockFile); extractor.extractEntities(staffToLeaCache); Mockito.verify(mockExtractor, Mockito.never()).extractEntity(Mockito.eq(mockEntity), Mockito.eq(mockFile), Mockito.eq(EntityNames.STAFF_PROGRAM_ASSOCIATION)); }
@Override public void extractEntities(EntityToEdOrgDateCache staffDatedCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STAFF_PROGRAM_ASSOCIATION, this.getClass().getName()); Iterator<Entity> spas = repo.findEach(EntityNames.STAFF_PROGRAM_ASSOCIATION, new NeutralQuery()); while (spas.hasNext()) { Entity spa = spas.next(); String staffId = (String) spa.getBody().get(ParameterConstants.STAFF_ID); Map<String, DateTime> edOrgs = staffDatedCache.getEntriesById(staffId); for (Map.Entry<String, DateTime> datedEdOrg : edOrgs.entrySet()) { if (EntityDateHelper.shouldExtract(spa, datedEdOrg.getValue())) { extractor.extractEntity(spa, map.getExtractFileForEdOrg(datedEdOrg.getKey()), EntityNames.STAFF_PROGRAM_ASSOCIATION); } } } }
StaffProgramAssociationExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache staffDatedCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STAFF_PROGRAM_ASSOCIATION, this.getClass().getName()); Iterator<Entity> spas = repo.findEach(EntityNames.STAFF_PROGRAM_ASSOCIATION, new NeutralQuery()); while (spas.hasNext()) { Entity spa = spas.next(); String staffId = (String) spa.getBody().get(ParameterConstants.STAFF_ID); Map<String, DateTime> edOrgs = staffDatedCache.getEntriesById(staffId); for (Map.Entry<String, DateTime> datedEdOrg : edOrgs.entrySet()) { if (EntityDateHelper.shouldExtract(spa, datedEdOrg.getValue())) { extractor.extractEntity(spa, map.getExtractFileForEdOrg(datedEdOrg.getKey()), EntityNames.STAFF_PROGRAM_ASSOCIATION); } } } } }
StaffProgramAssociationExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache staffDatedCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STAFF_PROGRAM_ASSOCIATION, this.getClass().getName()); Iterator<Entity> spas = repo.findEach(EntityNames.STAFF_PROGRAM_ASSOCIATION, new NeutralQuery()); while (spas.hasNext()) { Entity spa = spas.next(); String staffId = (String) spa.getBody().get(ParameterConstants.STAFF_ID); Map<String, DateTime> edOrgs = staffDatedCache.getEntriesById(staffId); for (Map.Entry<String, DateTime> datedEdOrg : edOrgs.entrySet()) { if (EntityDateHelper.shouldExtract(spa, datedEdOrg.getValue())) { extractor.extractEntity(spa, map.getExtractFileForEdOrg(datedEdOrg.getKey()), EntityNames.STAFF_PROGRAM_ASSOCIATION); } } } } StaffProgramAssociationExtractor(EntityExtractor extractor, ExtractFileMap map, Repository<Entity> repo, EdOrgExtractHelper edOrgExtractHelper); }
StaffProgramAssociationExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache staffDatedCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STAFF_PROGRAM_ASSOCIATION, this.getClass().getName()); Iterator<Entity> spas = repo.findEach(EntityNames.STAFF_PROGRAM_ASSOCIATION, new NeutralQuery()); while (spas.hasNext()) { Entity spa = spas.next(); String staffId = (String) spa.getBody().get(ParameterConstants.STAFF_ID); Map<String, DateTime> edOrgs = staffDatedCache.getEntriesById(staffId); for (Map.Entry<String, DateTime> datedEdOrg : edOrgs.entrySet()) { if (EntityDateHelper.shouldExtract(spa, datedEdOrg.getValue())) { extractor.extractEntity(spa, map.getExtractFileForEdOrg(datedEdOrg.getKey()), EntityNames.STAFF_PROGRAM_ASSOCIATION); } } } } StaffProgramAssociationExtractor(EntityExtractor extractor, ExtractFileMap map, Repository<Entity> repo, EdOrgExtractHelper edOrgExtractHelper); @Override void extractEntities(EntityToEdOrgDateCache staffDatedCache); }
StaffProgramAssociationExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache staffDatedCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STAFF_PROGRAM_ASSOCIATION, this.getClass().getName()); Iterator<Entity> spas = repo.findEach(EntityNames.STAFF_PROGRAM_ASSOCIATION, new NeutralQuery()); while (spas.hasNext()) { Entity spa = spas.next(); String staffId = (String) spa.getBody().get(ParameterConstants.STAFF_ID); Map<String, DateTime> edOrgs = staffDatedCache.getEntriesById(staffId); for (Map.Entry<String, DateTime> datedEdOrg : edOrgs.entrySet()) { if (EntityDateHelper.shouldExtract(spa, datedEdOrg.getValue())) { extractor.extractEntity(spa, map.getExtractFileForEdOrg(datedEdOrg.getKey()), EntityNames.STAFF_PROGRAM_ASSOCIATION); } } } } StaffProgramAssociationExtractor(EntityExtractor extractor, ExtractFileMap map, Repository<Entity> repo, EdOrgExtractHelper edOrgExtractHelper); @Override void extractEntities(EntityToEdOrgDateCache staffDatedCache);  }