@Test public void testExtractNoEntityBecauseOfIdMiss() { entityBody.put(ParameterConstants.STUDENT_ID, "studentId99"); Mockito.when(mockRepo.findEach(Mockito.eq("studentGradebookEntry"), Mockito.eq(new NeutralQuery()))) .thenReturn(Arrays.asList(mockEntity).iterator()); Mockito.when(mockMap.getExtractFileForEdOrg("LEA")).thenReturn(mockFile); extractor.extractEntities(mockStudentCache); Mockito.verify(mockExtractor, Mockito.never()).extractEntity(Mockito.eq(mockEntity), Mockito.eq(mockFile), Mockito.eq("studentGradebookEntry")); }
@Override public void extractEntities(EntityToEdOrgDateCache studentCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT_GRADEBOOK_ENTRY, this.getClass().getName()); Iterator<Entity> studentGradebookEntries = repo.findEach(EntityNames.STUDENT_GRADEBOOK_ENTRY, new NeutralQuery()); while (studentGradebookEntries.hasNext()) { Entity studentGradebookEntry = studentGradebookEntries.next(); String studentId = (String) studentGradebookEntry.getBody().get(ParameterConstants.STUDENT_ID); String gradebookEntryId = (String) studentGradebookEntry.getBody().get(ParameterConstants.GRADEBOOK_ENTRY_ID); Map<String, DateTime> studentEdOrgs = studentCache.getEntriesById(studentId); for (Map.Entry<String, DateTime> entry: studentEdOrgs.entrySet()) { DateTime upToDate = entry.getValue(); if(shouldExtract(studentGradebookEntry, upToDate)) { extractor.extractEntity(studentGradebookEntry, map.getExtractFileForEdOrg(entry.getKey()), EntityNames.STUDENT_GRADEBOOK_ENTRY); gradebookEntryCache.addEntry(gradebookEntryId, entry.getKey(), upToDate); } } } }
StudentGradebookEntryExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache studentCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT_GRADEBOOK_ENTRY, this.getClass().getName()); Iterator<Entity> studentGradebookEntries = repo.findEach(EntityNames.STUDENT_GRADEBOOK_ENTRY, new NeutralQuery()); while (studentGradebookEntries.hasNext()) { Entity studentGradebookEntry = studentGradebookEntries.next(); String studentId = (String) studentGradebookEntry.getBody().get(ParameterConstants.STUDENT_ID); String gradebookEntryId = (String) studentGradebookEntry.getBody().get(ParameterConstants.GRADEBOOK_ENTRY_ID); Map<String, DateTime> studentEdOrgs = studentCache.getEntriesById(studentId); for (Map.Entry<String, DateTime> entry: studentEdOrgs.entrySet()) { DateTime upToDate = entry.getValue(); if(shouldExtract(studentGradebookEntry, upToDate)) { extractor.extractEntity(studentGradebookEntry, map.getExtractFileForEdOrg(entry.getKey()), EntityNames.STUDENT_GRADEBOOK_ENTRY); gradebookEntryCache.addEntry(gradebookEntryId, entry.getKey(), upToDate); } } } } }
StudentGradebookEntryExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache studentCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT_GRADEBOOK_ENTRY, this.getClass().getName()); Iterator<Entity> studentGradebookEntries = repo.findEach(EntityNames.STUDENT_GRADEBOOK_ENTRY, new NeutralQuery()); while (studentGradebookEntries.hasNext()) { Entity studentGradebookEntry = studentGradebookEntries.next(); String studentId = (String) studentGradebookEntry.getBody().get(ParameterConstants.STUDENT_ID); String gradebookEntryId = (String) studentGradebookEntry.getBody().get(ParameterConstants.GRADEBOOK_ENTRY_ID); Map<String, DateTime> studentEdOrgs = studentCache.getEntriesById(studentId); for (Map.Entry<String, DateTime> entry: studentEdOrgs.entrySet()) { DateTime upToDate = entry.getValue(); if(shouldExtract(studentGradebookEntry, upToDate)) { extractor.extractEntity(studentGradebookEntry, map.getExtractFileForEdOrg(entry.getKey()), EntityNames.STUDENT_GRADEBOOK_ENTRY); gradebookEntryCache.addEntry(gradebookEntryId, entry.getKey(), upToDate); } } } } StudentGradebookEntryExtractor(EntityExtractor extractor, ExtractFileMap map, Repository<Entity> repo,
            EdOrgExtractHelper edOrgExtractHelper); }
StudentGradebookEntryExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache studentCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT_GRADEBOOK_ENTRY, this.getClass().getName()); Iterator<Entity> studentGradebookEntries = repo.findEach(EntityNames.STUDENT_GRADEBOOK_ENTRY, new NeutralQuery()); while (studentGradebookEntries.hasNext()) { Entity studentGradebookEntry = studentGradebookEntries.next(); String studentId = (String) studentGradebookEntry.getBody().get(ParameterConstants.STUDENT_ID); String gradebookEntryId = (String) studentGradebookEntry.getBody().get(ParameterConstants.GRADEBOOK_ENTRY_ID); Map<String, DateTime> studentEdOrgs = studentCache.getEntriesById(studentId); for (Map.Entry<String, DateTime> entry: studentEdOrgs.entrySet()) { DateTime upToDate = entry.getValue(); if(shouldExtract(studentGradebookEntry, upToDate)) { extractor.extractEntity(studentGradebookEntry, map.getExtractFileForEdOrg(entry.getKey()), EntityNames.STUDENT_GRADEBOOK_ENTRY); gradebookEntryCache.addEntry(gradebookEntryId, entry.getKey(), upToDate); } } } } StudentGradebookEntryExtractor(EntityExtractor extractor, ExtractFileMap map, Repository<Entity> repo,
            EdOrgExtractHelper edOrgExtractHelper); @Override void extractEntities(EntityToEdOrgDateCache studentCache); EntityToEdOrgDateCache getGradebookEntryCache(); }
StudentGradebookEntryExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache studentCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT_GRADEBOOK_ENTRY, this.getClass().getName()); Iterator<Entity> studentGradebookEntries = repo.findEach(EntityNames.STUDENT_GRADEBOOK_ENTRY, new NeutralQuery()); while (studentGradebookEntries.hasNext()) { Entity studentGradebookEntry = studentGradebookEntries.next(); String studentId = (String) studentGradebookEntry.getBody().get(ParameterConstants.STUDENT_ID); String gradebookEntryId = (String) studentGradebookEntry.getBody().get(ParameterConstants.GRADEBOOK_ENTRY_ID); Map<String, DateTime> studentEdOrgs = studentCache.getEntriesById(studentId); for (Map.Entry<String, DateTime> entry: studentEdOrgs.entrySet()) { DateTime upToDate = entry.getValue(); if(shouldExtract(studentGradebookEntry, upToDate)) { extractor.extractEntity(studentGradebookEntry, map.getExtractFileForEdOrg(entry.getKey()), EntityNames.STUDENT_GRADEBOOK_ENTRY); gradebookEntryCache.addEntry(gradebookEntryId, entry.getKey(), upToDate); } } } } StudentGradebookEntryExtractor(EntityExtractor extractor, ExtractFileMap map, Repository<Entity> repo,
            EdOrgExtractHelper edOrgExtractHelper); @Override void extractEntities(EntityToEdOrgDateCache studentCache); EntityToEdOrgDateCache getGradebookEntryCache();  }