@Test public void getBulkExtractEdOrgsPerAppTest() { getBulkExtractAppsTest(); Map<String, Object> edorg1 = new HashMap<String, Object>(); edorg1.put("authorizedEdorg", "edOrg1"); Map<String, Object> edorg2 = new HashMap<String, Object>(); edorg2.put("authorizedEdorg", "edOrg2"); @SuppressWarnings("unchecked") Entity authOne = buildAuthEntity("1", Arrays.asList(edorg1, edorg2)); Entity authTwo = buildAuthEntity("5", new ArrayList<Map<String, Object>>()); List<Entity> auths = Arrays.asList(authOne, authTwo); when(repository.findAll(Mockito.eq("applicationAuthorization"), Mockito.any(NeutralQuery.class))).thenReturn(auths); Map<String, Set<String>> bulkExtractEdOrgsPerApp = helper.getBulkExtractEdOrgsPerApp(); assertTrue(bulkExtractEdOrgsPerApp.size() == 2); assertTrue(bulkExtractEdOrgsPerApp.get(authOne.getBody().get("applicationId")).containsAll( Arrays.asList("edOrg1","edOrg2"))); assertTrue(bulkExtractEdOrgsPerApp.get(authTwo.getBody().get("applicationId")).isEmpty()); }
public Map<String, Set<String>> getBulkExtractEdOrgsPerApp() { NeutralQuery appQuery = new NeutralQuery(new NeutralCriteria("applicationId", NeutralCriteria.CRITERIA_IN, getBulkExtractApps())); Iterable<Entity> apps = repository.findAll("applicationAuthorization", appQuery); Map<String, Set<String>> edorgIds = new HashMap<String, Set<String>>(); for (Entity app : apps) { Set<String> edorgs = new HashSet<String>(BulkExtractMongoDA.getAuthorizedEdOrgIds(app)); edorgIds.put((String) app.getBody().get("applicationId"), edorgs); } return edorgIds; }
EdOrgExtractHelper implements InitializingBean { public Map<String, Set<String>> getBulkExtractEdOrgsPerApp() { NeutralQuery appQuery = new NeutralQuery(new NeutralCriteria("applicationId", NeutralCriteria.CRITERIA_IN, getBulkExtractApps())); Iterable<Entity> apps = repository.findAll("applicationAuthorization", appQuery); Map<String, Set<String>> edorgIds = new HashMap<String, Set<String>>(); for (Entity app : apps) { Set<String> edorgs = new HashSet<String>(BulkExtractMongoDA.getAuthorizedEdOrgIds(app)); edorgIds.put((String) app.getBody().get("applicationId"), edorgs); } return edorgIds; } }
EdOrgExtractHelper implements InitializingBean { public Map<String, Set<String>> getBulkExtractEdOrgsPerApp() { NeutralQuery appQuery = new NeutralQuery(new NeutralCriteria("applicationId", NeutralCriteria.CRITERIA_IN, getBulkExtractApps())); Iterable<Entity> apps = repository.findAll("applicationAuthorization", appQuery); Map<String, Set<String>> edorgIds = new HashMap<String, Set<String>>(); for (Entity app : apps) { Set<String> edorgs = new HashSet<String>(BulkExtractMongoDA.getAuthorizedEdOrgIds(app)); edorgIds.put((String) app.getBody().get("applicationId"), edorgs); } return edorgIds; }  }
EdOrgExtractHelper implements InitializingBean { public Map<String, Set<String>> getBulkExtractEdOrgsPerApp() { NeutralQuery appQuery = new NeutralQuery(new NeutralCriteria("applicationId", NeutralCriteria.CRITERIA_IN, getBulkExtractApps())); Iterable<Entity> apps = repository.findAll("applicationAuthorization", appQuery); Map<String, Set<String>> edorgIds = new HashMap<String, Set<String>>(); for (Entity app : apps) { Set<String> edorgs = new HashSet<String>(BulkExtractMongoDA.getAuthorizedEdOrgIds(app)); edorgIds.put((String) app.getBody().get("applicationId"), edorgs); } return edorgIds; }  @Override void afterPropertiesSet(); Set<String> getBulkExtractEdOrgs(); Map<String, Set<String>> getBulkExtractEdOrgsPerApp(); @SuppressWarnings("unchecked") Set<String> getBulkExtractApps(); Set<String> getChildEdOrgs(Collection<String> edOrgs); Iterable<Entity> retrieveSEOAS(String teacherId, String edorgId); void logSecurityEvent(Set<String> leas, String entityName, String className); void setSecurityEventUtil(SecurityEventUtil securityEventUtil); Map<String, List<String>> getEdOrgLineages(); void setEdOrgLineages(Map<String, List<String>> edOrgLineages); }
EdOrgExtractHelper implements InitializingBean { public Map<String, Set<String>> getBulkExtractEdOrgsPerApp() { NeutralQuery appQuery = new NeutralQuery(new NeutralCriteria("applicationId", NeutralCriteria.CRITERIA_IN, getBulkExtractApps())); Iterable<Entity> apps = repository.findAll("applicationAuthorization", appQuery); Map<String, Set<String>> edorgIds = new HashMap<String, Set<String>>(); for (Entity app : apps) { Set<String> edorgs = new HashSet<String>(BulkExtractMongoDA.getAuthorizedEdOrgIds(app)); edorgIds.put((String) app.getBody().get("applicationId"), edorgs); } return edorgIds; }  @Override void afterPropertiesSet(); Set<String> getBulkExtractEdOrgs(); Map<String, Set<String>> getBulkExtractEdOrgsPerApp(); @SuppressWarnings("unchecked") Set<String> getBulkExtractApps(); Set<String> getChildEdOrgs(Collection<String> edOrgs); Iterable<Entity> retrieveSEOAS(String teacherId, String edorgId); void logSecurityEvent(Set<String> leas, String entityName, String className); void setSecurityEventUtil(SecurityEventUtil securityEventUtil); Map<String, List<String>> getEdOrgLineages(); void setEdOrgLineages(Map<String, List<String>> edOrgLineages);  }