target stringlengths 20 113k | src_fm stringlengths 11 86.3k | src_fm_fc stringlengths 21 86.4k | src_fm_fc_co stringlengths 30 86.4k | src_fm_fc_ms stringlengths 42 86.8k | src_fm_fc_ms_ff stringlengths 43 86.8k |
|---|---|---|---|---|---|
@Test public void testManyExtractedEntities() { Entity e = Mockito.mock(Entity.class); Mockito.when(mockRepo.findEach(Mockito.eq("student"), Mockito.eq(new NeutralQuery()))).thenReturn( Arrays.asList(e, e, e).iterator()); Map<String, DateTime> datedEdorgs = new HashMap<String, DateTime>(); datedEdorgs.put("LEA", DateTi... | @Override public void extractEntities(EntityToEdOrgCache dummyCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT, this.getClass().getName()); Iterator<Entity> cursor = repo.findEach(EntityNames.STUDENT, new NeutralQuery()); while (cursor.hasNext()) { Entity student = cursor.next(); buildS... | StudentExtractor implements EntityExtract { @Override public void extractEntities(EntityToEdOrgCache dummyCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT, this.getClass().getName()); Iterator<Entity> cursor = repo.findEach(EntityNames.STUDENT, new NeutralQuery()); while (cursor.hasNext... | StudentExtractor implements EntityExtract { @Override public void extractEntities(EntityToEdOrgCache dummyCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT, this.getClass().getName()); Iterator<Entity> cursor = repo.findEach(EntityNames.STUDENT, new NeutralQuery()); while (cursor.hasNext... | StudentExtractor implements EntityExtract { @Override public void extractEntities(EntityToEdOrgCache dummyCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT, this.getClass().getName()); Iterator<Entity> cursor = repo.findEach(EntityNames.STUDENT, new NeutralQuery()); while (cursor.hasNext... | StudentExtractor implements EntityExtract { @Override public void extractEntities(EntityToEdOrgCache dummyCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT, this.getClass().getName()); Iterator<Entity> cursor = repo.findEach(EntityNames.STUDENT, new NeutralQuery()); while (cursor.hasNext... |
@Test public void testNoExtractedEntities() { Entity e = Mockito.mock(Entity.class); Mockito.when(mockRepo.findEach(Mockito.eq("student"), Mockito.eq(new NeutralQuery()))).thenReturn( Arrays.asList(e).iterator()); extractor.extractEntities(null); Mockito.verify(mockExtractor, Mockito.never()).extractEntity(Mockito.any(... | @Override public void extractEntities(EntityToEdOrgCache dummyCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT, this.getClass().getName()); Iterator<Entity> cursor = repo.findEach(EntityNames.STUDENT, new NeutralQuery()); while (cursor.hasNext()) { Entity student = cursor.next(); buildS... | StudentExtractor implements EntityExtract { @Override public void extractEntities(EntityToEdOrgCache dummyCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT, this.getClass().getName()); Iterator<Entity> cursor = repo.findEach(EntityNames.STUDENT, new NeutralQuery()); while (cursor.hasNext... | StudentExtractor implements EntityExtract { @Override public void extractEntities(EntityToEdOrgCache dummyCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT, this.getClass().getName()); Iterator<Entity> cursor = repo.findEach(EntityNames.STUDENT, new NeutralQuery()); while (cursor.hasNext... | StudentExtractor implements EntityExtract { @Override public void extractEntities(EntityToEdOrgCache dummyCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT, this.getClass().getName()); Iterator<Entity> cursor = repo.findEach(EntityNames.STUDENT, new NeutralQuery()); while (cursor.hasNext... | StudentExtractor implements EntityExtract { @Override public void extractEntities(EntityToEdOrgCache dummyCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT, this.getClass().getName()); Iterator<Entity> cursor = repo.findEach(EntityNames.STUDENT, new NeutralQuery()); while (cursor.hasNext... |
@Test public void testGetValue() { BSONObject field = new BasicBSONObject("field", "TEST1"); BSONObject entry = new BasicBSONObject("enum", field); BSONWritable entity = new BSONWritable(entry); EnumValueMapper<Testing> m = new EnumValueMapper<Testing>("enum.field", Testing.class); Writable value = m.getValue(entity); ... | @Override public Writable getValue(BSONWritable entity) { Writable rval = NullWritable.get(); String value = null; try { value = BSONUtilities.getValue(entity, fieldName); if (value != null) { value = Enum.valueOf(enumClass, value).toString(); rval = new Text(value); } } catch (IllegalArgumentException e) { log.severe(... | EnumValueMapper extends ValueMapper { @Override public Writable getValue(BSONWritable entity) { Writable rval = NullWritable.get(); String value = null; try { value = BSONUtilities.getValue(entity, fieldName); if (value != null) { value = Enum.valueOf(enumClass, value).toString(); rval = new Text(value); } } catch (Ill... | EnumValueMapper extends ValueMapper { @Override public Writable getValue(BSONWritable entity) { Writable rval = NullWritable.get(); String value = null; try { value = BSONUtilities.getValue(entity, fieldName); if (value != null) { value = Enum.valueOf(enumClass, value).toString(); rval = new Text(value); } } catch (Ill... | EnumValueMapper extends ValueMapper { @Override public Writable getValue(BSONWritable entity) { Writable rval = NullWritable.get(); String value = null; try { value = BSONUtilities.getValue(entity, fieldName); if (value != null) { value = Enum.valueOf(enumClass, value).toString(); rval = new Text(value); } } catch (Ill... | EnumValueMapper extends ValueMapper { @Override public Writable getValue(BSONWritable entity) { Writable rval = NullWritable.get(); String value = null; try { value = BSONUtilities.getValue(entity, fieldName); if (value != null) { value = Enum.valueOf(enumClass, value).toString(); rval = new Text(value); } } catch (Ill... |
@Test public void testExtractOneEntity() { entityBody.put(ParameterConstants.BEGIN_DATE, "2010-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")... | @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())... | 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... | 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... | 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... | 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... |
@Test public void testExtractManyEntity() { entityBody.put(ParameterConstants.BEGIN_DATE, "2010-05-01"); Mockito.when(mockRepo.findEach(Mockito.eq(EntityNames.STAFF_PROGRAM_ASSOCIATION), Mockito.eq(new NeutralQuery()))) .thenReturn(Arrays.asList(mockEntity, mockEntity).iterator()); Mockito.when(mockMap.getExtractFileFo... | @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())... | 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... | 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... | 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... | 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... |
@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.getExtractFile... | @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())... | 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... | 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... | 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... | 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... |
@Test public void testExtractNoEntityBecauseOfLEAMiss() { entityBody.put(ParameterConstants.BEGIN_DATE, "2010-05-01"); Mockito.when(mockEntity.getEntityId()).thenReturn("Staff2"); Mockito.when(mockRepo.findEach(Mockito.eq(EntityNames.STAFF_PROGRAM_ASSOCIATION), Mockito.eq(new NeutralQuery()))).thenReturn(Arrays.asList(... | @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())... | 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... | 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... | 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... | 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... |
@Test public void testBuildExtractFile() { Assert.assertTrue(factory.buildEdOrgExtractFile("bloop", "Bleep", "BLOO BLOO", null, null) != null); Assert.assertTrue(factory.buildEdOrgExtractFile("bloop", "Bleep", "BLOOB BLOO", null, null).getClass() == ExtractFile.class); } | public ExtractFile buildEdOrgExtractFile(String path, String edOrg, String archiveName, Map<String, PublicKey> appPublicKeys, SecurityEventUtil securityEventUtil) { File directory = new File(path, edOrg); directory.mkdirs(); return new ExtractFile(directory, archiveName, appPublicKeys, securityEventUtil); } | ExtractorFactory { public ExtractFile buildEdOrgExtractFile(String path, String edOrg, String archiveName, Map<String, PublicKey> appPublicKeys, SecurityEventUtil securityEventUtil) { File directory = new File(path, edOrg); directory.mkdirs(); return new ExtractFile(directory, archiveName, appPublicKeys, securityEventU... | ExtractorFactory { public ExtractFile buildEdOrgExtractFile(String path, String edOrg, String archiveName, Map<String, PublicKey> appPublicKeys, SecurityEventUtil securityEventUtil) { File directory = new File(path, edOrg); directory.mkdirs(); return new ExtractFile(directory, archiveName, appPublicKeys, securityEventU... | ExtractorFactory { public ExtractFile buildEdOrgExtractFile(String path, String edOrg, String archiveName, Map<String, PublicKey> appPublicKeys, SecurityEventUtil securityEventUtil) { File directory = new File(path, edOrg); directory.mkdirs(); return new ExtractFile(directory, archiveName, appPublicKeys, securityEventU... | ExtractorFactory { public ExtractFile buildEdOrgExtractFile(String path, String edOrg, String archiveName, Map<String, PublicKey> appPublicKeys, SecurityEventUtil securityEventUtil) { File directory = new File(path, edOrg); directory.mkdirs(); return new ExtractFile(directory, archiveName, appPublicKeys, securityEventU... |
@Test public void testBuildAttendanceExtractor() { Assert.assertTrue(factory.buildAttendanceExtractor(null, null, null, null) != null); Assert.assertTrue(factory.buildAttendanceExtractor(null, null, null, null).getClass() == AttendanceExtractor.class); } | public EntityDatedExtract buildAttendanceExtractor(EntityExtractor extractor, ExtractFileMap map, Repository<Entity> repo, EdOrgExtractHelper edOrgExtractHelper) { return new AttendanceExtractor(extractor, map, repo, edOrgExtractHelper); } | ExtractorFactory { public EntityDatedExtract buildAttendanceExtractor(EntityExtractor extractor, ExtractFileMap map, Repository<Entity> repo, EdOrgExtractHelper edOrgExtractHelper) { return new AttendanceExtractor(extractor, map, repo, edOrgExtractHelper); } } | ExtractorFactory { public EntityDatedExtract buildAttendanceExtractor(EntityExtractor extractor, ExtractFileMap map, Repository<Entity> repo, EdOrgExtractHelper edOrgExtractHelper) { return new AttendanceExtractor(extractor, map, repo, edOrgExtractHelper); } } | ExtractorFactory { public EntityDatedExtract buildAttendanceExtractor(EntityExtractor extractor, ExtractFileMap map, Repository<Entity> repo, EdOrgExtractHelper edOrgExtractHelper) { return new AttendanceExtractor(extractor, map, repo, edOrgExtractHelper); } StudentExtractor buildStudentExtractor(EntityExtractor extra... | ExtractorFactory { public EntityDatedExtract buildAttendanceExtractor(EntityExtractor extractor, ExtractFileMap map, Repository<Entity> repo, EdOrgExtractHelper edOrgExtractHelper) { return new AttendanceExtractor(extractor, map, repo, edOrgExtractHelper); } StudentExtractor buildStudentExtractor(EntityExtractor extra... |
@Test public void testBuildStudentExtractor() { Assert.assertTrue(factory.buildStudentExtractor(null, null, null, null) != null); Assert.assertTrue(factory.buildStudentExtractor(null, null, null, null).getClass() == StudentExtractor.class); } | public StudentExtractor buildStudentExtractor(EntityExtractor extractor, ExtractFileMap map, Repository<Entity> repo, EdOrgExtractHelper edOrgExtractHelper) { return new StudentExtractor(extractor, map, repo, new ExtractorHelper(edOrgExtractHelper), edOrgExtractHelper); } | ExtractorFactory { public StudentExtractor buildStudentExtractor(EntityExtractor extractor, ExtractFileMap map, Repository<Entity> repo, EdOrgExtractHelper edOrgExtractHelper) { return new StudentExtractor(extractor, map, repo, new ExtractorHelper(edOrgExtractHelper), edOrgExtractHelper); } } | ExtractorFactory { public StudentExtractor buildStudentExtractor(EntityExtractor extractor, ExtractFileMap map, Repository<Entity> repo, EdOrgExtractHelper edOrgExtractHelper) { return new StudentExtractor(extractor, map, repo, new ExtractorHelper(edOrgExtractHelper), edOrgExtractHelper); } } | ExtractorFactory { public StudentExtractor buildStudentExtractor(EntityExtractor extractor, ExtractFileMap map, Repository<Entity> repo, EdOrgExtractHelper edOrgExtractHelper) { return new StudentExtractor(extractor, map, repo, new ExtractorHelper(edOrgExtractHelper), edOrgExtractHelper); } StudentExtractor buildStude... | ExtractorFactory { public StudentExtractor buildStudentExtractor(EntityExtractor extractor, ExtractFileMap map, Repository<Entity> repo, EdOrgExtractHelper edOrgExtractHelper) { return new StudentExtractor(extractor, map, repo, new ExtractorHelper(edOrgExtractHelper), edOrgExtractHelper); } StudentExtractor buildStude... |
@Test public void testBuildStudentAssessmentExtractor() { Assert.assertTrue(factory.buildStudentAssessmentExtractor(null, null, null, null) != null); Assert.assertTrue(factory.buildStudentAssessmentExtractor(null, null, null, null).getClass() == StudentAssessmentExtractor.class); } | public EntityDatedExtract buildStudentAssessmentExtractor(EntityExtractor extractor, ExtractFileMap map, Repository<Entity> repo, EdOrgExtractHelper edOrgExtractHelper) { return new StudentAssessmentExtractor(extractor, map, repo, edOrgExtractHelper); } | ExtractorFactory { public EntityDatedExtract buildStudentAssessmentExtractor(EntityExtractor extractor, ExtractFileMap map, Repository<Entity> repo, EdOrgExtractHelper edOrgExtractHelper) { return new StudentAssessmentExtractor(extractor, map, repo, edOrgExtractHelper); } } | ExtractorFactory { public EntityDatedExtract buildStudentAssessmentExtractor(EntityExtractor extractor, ExtractFileMap map, Repository<Entity> repo, EdOrgExtractHelper edOrgExtractHelper) { return new StudentAssessmentExtractor(extractor, map, repo, edOrgExtractHelper); } } | ExtractorFactory { public EntityDatedExtract buildStudentAssessmentExtractor(EntityExtractor extractor, ExtractFileMap map, Repository<Entity> repo, EdOrgExtractHelper edOrgExtractHelper) { return new StudentAssessmentExtractor(extractor, map, repo, edOrgExtractHelper); } StudentExtractor buildStudentExtractor(EntityE... | ExtractorFactory { public EntityDatedExtract buildStudentAssessmentExtractor(EntityExtractor extractor, ExtractFileMap map, Repository<Entity> repo, EdOrgExtractHelper edOrgExtractHelper) { return new StudentAssessmentExtractor(extractor, map, repo, edOrgExtractHelper); } StudentExtractor buildStudentExtractor(EntityE... |
@Test public void testBuildStaffExtractor() { Assert.assertTrue(factory.buildStaffExtractor(null, null, null, null) != null); Assert.assertTrue(factory.buildStaffExtractor(null, null, null, null).getClass() == StaffExtractor.class); } | public EntityDatedExtract buildStaffExtractor(EntityExtractor extractor, ExtractFileMap map, Repository<Entity> repo, EdOrgExtractHelper edOrgExtractHelper) { return new StaffExtractor(extractor, map, repo, edOrgExtractHelper); } | ExtractorFactory { public EntityDatedExtract buildStaffExtractor(EntityExtractor extractor, ExtractFileMap map, Repository<Entity> repo, EdOrgExtractHelper edOrgExtractHelper) { return new StaffExtractor(extractor, map, repo, edOrgExtractHelper); } } | ExtractorFactory { public EntityDatedExtract buildStaffExtractor(EntityExtractor extractor, ExtractFileMap map, Repository<Entity> repo, EdOrgExtractHelper edOrgExtractHelper) { return new StaffExtractor(extractor, map, repo, edOrgExtractHelper); } } | ExtractorFactory { public EntityDatedExtract buildStaffExtractor(EntityExtractor extractor, ExtractFileMap map, Repository<Entity> repo, EdOrgExtractHelper edOrgExtractHelper) { return new StaffExtractor(extractor, map, repo, edOrgExtractHelper); } StudentExtractor buildStudentExtractor(EntityExtractor extractor, Extr... | ExtractorFactory { public EntityDatedExtract buildStaffExtractor(EntityExtractor extractor, ExtractFileMap map, Repository<Entity> repo, EdOrgExtractHelper edOrgExtractHelper) { return new StaffExtractor(extractor, map, repo, edOrgExtractHelper); } StudentExtractor buildStudentExtractor(EntityExtractor extractor, Extr... |
@Test public void testFetchCurrentParentsFromStudentNullChecks() { Map<String, List<Entity>> embeddedData = new HashMap<String, List<Entity>>(); Assert.assertTrue(helper.fetchCurrentParentsFromStudent(mockEntity).size() == 0); Mockito.when(mockEntity.getEmbeddedData()).thenReturn(embeddedData); Assert.assertTrue(helper... | public Set<String> fetchCurrentParentsFromStudent(Entity student) { Set<String> parents = new TreeSet<String>(); if (student.getEmbeddedData().containsKey(EntityNames.STUDENT_PARENT_ASSOCIATION)) { for (Entity assoc : student.getEmbeddedData().get(EntityNames.STUDENT_PARENT_ASSOCIATION)) { String parentId = (String) as... | ExtractorHelper { public Set<String> fetchCurrentParentsFromStudent(Entity student) { Set<String> parents = new TreeSet<String>(); if (student.getEmbeddedData().containsKey(EntityNames.STUDENT_PARENT_ASSOCIATION)) { for (Entity assoc : student.getEmbeddedData().get(EntityNames.STUDENT_PARENT_ASSOCIATION)) { String pare... | ExtractorHelper { public Set<String> fetchCurrentParentsFromStudent(Entity student) { Set<String> parents = new TreeSet<String>(); if (student.getEmbeddedData().containsKey(EntityNames.STUDENT_PARENT_ASSOCIATION)) { for (Entity assoc : student.getEmbeddedData().get(EntityNames.STUDENT_PARENT_ASSOCIATION)) { String pare... | ExtractorHelper { public Set<String> fetchCurrentParentsFromStudent(Entity student) { Set<String> parents = new TreeSet<String>(); if (student.getEmbeddedData().containsKey(EntityNames.STUDENT_PARENT_ASSOCIATION)) { for (Entity assoc : student.getEmbeddedData().get(EntityNames.STUDENT_PARENT_ASSOCIATION)) { String pare... | ExtractorHelper { public Set<String> fetchCurrentParentsFromStudent(Entity student) { Set<String> parents = new TreeSet<String>(); if (student.getEmbeddedData().containsKey(EntityNames.STUDENT_PARENT_ASSOCIATION)) { for (Entity assoc : student.getEmbeddedData().get(EntityNames.STUDENT_PARENT_ASSOCIATION)) { String pare... |
@Test public void testGetValueNotFound() { BSONObject field = new BasicBSONObject("field", "Unknown"); BSONObject entry = new BasicBSONObject("enum", field); BSONWritable entity = new BSONWritable(entry); EnumValueMapper<Testing> m = new EnumValueMapper<Testing>("enum.field", Testing.class); Writable value = m.getValue... | @Override public Writable getValue(BSONWritable entity) { Writable rval = NullWritable.get(); String value = null; try { value = BSONUtilities.getValue(entity, fieldName); if (value != null) { value = Enum.valueOf(enumClass, value).toString(); rval = new Text(value); } } catch (IllegalArgumentException e) { log.severe(... | EnumValueMapper extends ValueMapper { @Override public Writable getValue(BSONWritable entity) { Writable rval = NullWritable.get(); String value = null; try { value = BSONUtilities.getValue(entity, fieldName); if (value != null) { value = Enum.valueOf(enumClass, value).toString(); rval = new Text(value); } } catch (Ill... | EnumValueMapper extends ValueMapper { @Override public Writable getValue(BSONWritable entity) { Writable rval = NullWritable.get(); String value = null; try { value = BSONUtilities.getValue(entity, fieldName); if (value != null) { value = Enum.valueOf(enumClass, value).toString(); rval = new Text(value); } } catch (Ill... | EnumValueMapper extends ValueMapper { @Override public Writable getValue(BSONWritable entity) { Writable rval = NullWritable.get(); String value = null; try { value = BSONUtilities.getValue(entity, fieldName); if (value != null) { value = Enum.valueOf(enumClass, value).toString(); rval = new Text(value); } } catch (Ill... | EnumValueMapper extends ValueMapper { @Override public Writable getValue(BSONWritable entity) { Writable rval = NullWritable.get(); String value = null; try { value = BSONUtilities.getValue(entity, fieldName); if (value != null) { value = Enum.valueOf(enumClass, value).toString(); rval = new Text(value); } } catch (Ill... |
@Test public void testBuildSubToParentEdOrgCache() { EntityToEdOrgCache cache = new EntityToEdOrgCache(); cache.addEntry("lea-1", "school-1"); cache.addEntry("lea-1", "school-2"); cache.addEntry("lea-1", "school-3"); cache.addEntry("lea-2", "school-4"); cache.addEntry("lea-2", "school-5"); cache.addEntry("lea-3", "scho... | public Map<String, Collection<String>> buildSubToParentEdOrgCache(EntityToEdOrgCache edOrgCache) { Map<String, String> result = new HashMap<String, String>(); HashMultimap<String, String> map = HashMultimap.create(); for(String lea : edOrgCache.getEntityIds()) { for (String child : edOrgCache.getEntriesById(lea)) { res... | ExtractorHelper { public Map<String, Collection<String>> buildSubToParentEdOrgCache(EntityToEdOrgCache edOrgCache) { Map<String, String> result = new HashMap<String, String>(); HashMultimap<String, String> map = HashMultimap.create(); for(String lea : edOrgCache.getEntityIds()) { for (String child : edOrgCache.getEntri... | ExtractorHelper { public Map<String, Collection<String>> buildSubToParentEdOrgCache(EntityToEdOrgCache edOrgCache) { Map<String, String> result = new HashMap<String, String>(); HashMultimap<String, String> map = HashMultimap.create(); for(String lea : edOrgCache.getEntityIds()) { for (String child : edOrgCache.getEntri... | ExtractorHelper { public Map<String, Collection<String>> buildSubToParentEdOrgCache(EntityToEdOrgCache edOrgCache) { Map<String, String> result = new HashMap<String, String>(); HashMultimap<String, String> map = HashMultimap.create(); for(String lea : edOrgCache.getEntityIds()) { for (String child : edOrgCache.getEntri... | ExtractorHelper { public Map<String, Collection<String>> buildSubToParentEdOrgCache(EntityToEdOrgCache edOrgCache) { Map<String, String> result = new HashMap<String, String>(); HashMultimap<String, String> map = HashMultimap.create(); for(String lea : edOrgCache.getEntityIds()) { for (String child : edOrgCache.getEntri... |
@Test public void testExtractOneEntity() { entityBody.put(ParameterConstants.BEGIN_DATE, "2010-05-01"); Mockito.when(mockRepo.findEach(Mockito.eq(EntityNames.STAFF_COHORT_ASSOCIATION), Mockito.eq(new NeutralQuery()))) .thenReturn(Arrays.asList(mockEntity).iterator()); Mockito.when(mockMap.getExtractFileForEdOrg("LEA"))... | @Override public void extractEntities(EntityToEdOrgDateCache staffDatedCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STAFF_COHORT_ASSOCIATION, this.getClass().getName()); Iterator<Entity> scas = repo.findEach(EntityNames.STAFF_COHORT_ASSOCIATION, new NeutralQuery()); while (scas.hasNext()) {... | StaffCohortAssociationExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache staffDatedCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STAFF_COHORT_ASSOCIATION, this.getClass().getName()); Iterator<Entity> scas = repo.findEach(EntityNames.STAFF_C... | StaffCohortAssociationExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache staffDatedCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STAFF_COHORT_ASSOCIATION, this.getClass().getName()); Iterator<Entity> scas = repo.findEach(EntityNames.STAFF_C... | StaffCohortAssociationExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache staffDatedCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STAFF_COHORT_ASSOCIATION, this.getClass().getName()); Iterator<Entity> scas = repo.findEach(EntityNames.STAFF_C... | StaffCohortAssociationExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache staffDatedCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STAFF_COHORT_ASSOCIATION, this.getClass().getName()); Iterator<Entity> scas = repo.findEach(EntityNames.STAFF_C... |
@Test public void testExtractManyEntity() { entityBody.put(ParameterConstants.BEGIN_DATE, "2010-05-01"); Mockito.when(mockRepo.findEach(Mockito.eq(EntityNames.STAFF_COHORT_ASSOCIATION), Mockito.eq(new NeutralQuery()))) .thenReturn(Arrays.asList(mockEntity, mockEntity).iterator()); Mockito.when(mockMap.getExtractFileFor... | @Override public void extractEntities(EntityToEdOrgDateCache staffDatedCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STAFF_COHORT_ASSOCIATION, this.getClass().getName()); Iterator<Entity> scas = repo.findEach(EntityNames.STAFF_COHORT_ASSOCIATION, new NeutralQuery()); while (scas.hasNext()) {... | StaffCohortAssociationExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache staffDatedCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STAFF_COHORT_ASSOCIATION, this.getClass().getName()); Iterator<Entity> scas = repo.findEach(EntityNames.STAFF_C... | StaffCohortAssociationExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache staffDatedCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STAFF_COHORT_ASSOCIATION, this.getClass().getName()); Iterator<Entity> scas = repo.findEach(EntityNames.STAFF_C... | StaffCohortAssociationExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache staffDatedCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STAFF_COHORT_ASSOCIATION, this.getClass().getName()); Iterator<Entity> scas = repo.findEach(EntityNames.STAFF_C... | StaffCohortAssociationExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache staffDatedCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STAFF_COHORT_ASSOCIATION, this.getClass().getName()); Iterator<Entity> scas = repo.findEach(EntityNames.STAFF_C... |
@Test public void testExtractNoEntityBecauseWrongDate() { entityBody.put(ParameterConstants.BEGIN_DATE, "2012-05-01"); Mockito.when(mockRepo.findEach(Mockito.eq(EntityNames.STAFF_COHORT_ASSOCIATION), Mockito.eq(new NeutralQuery()))) .thenReturn(Arrays.asList(mockEntity).iterator()); Mockito.when(mockMap.getExtractFileF... | @Override public void extractEntities(EntityToEdOrgDateCache staffDatedCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STAFF_COHORT_ASSOCIATION, this.getClass().getName()); Iterator<Entity> scas = repo.findEach(EntityNames.STAFF_COHORT_ASSOCIATION, new NeutralQuery()); while (scas.hasNext()) {... | StaffCohortAssociationExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache staffDatedCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STAFF_COHORT_ASSOCIATION, this.getClass().getName()); Iterator<Entity> scas = repo.findEach(EntityNames.STAFF_C... | StaffCohortAssociationExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache staffDatedCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STAFF_COHORT_ASSOCIATION, this.getClass().getName()); Iterator<Entity> scas = repo.findEach(EntityNames.STAFF_C... | StaffCohortAssociationExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache staffDatedCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STAFF_COHORT_ASSOCIATION, this.getClass().getName()); Iterator<Entity> scas = repo.findEach(EntityNames.STAFF_C... | StaffCohortAssociationExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache staffDatedCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STAFF_COHORT_ASSOCIATION, this.getClass().getName()); Iterator<Entity> scas = repo.findEach(EntityNames.STAFF_C... |
@Test public void testExtractNoEntityBecauseOfLEAMiss() { entityBody.put(ParameterConstants.BEGIN_DATE, "2010-05-01"); Mockito.when(mockEntity.getEntityId()).thenReturn("Staff2"); Mockito.when(mockRepo.findEach(Mockito.eq(EntityNames.STAFF_COHORT_ASSOCIATION), Mockito.eq(new NeutralQuery()))).thenReturn(Arrays.asList(m... | @Override public void extractEntities(EntityToEdOrgDateCache staffDatedCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STAFF_COHORT_ASSOCIATION, this.getClass().getName()); Iterator<Entity> scas = repo.findEach(EntityNames.STAFF_COHORT_ASSOCIATION, new NeutralQuery()); while (scas.hasNext()) {... | StaffCohortAssociationExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache staffDatedCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STAFF_COHORT_ASSOCIATION, this.getClass().getName()); Iterator<Entity> scas = repo.findEach(EntityNames.STAFF_C... | StaffCohortAssociationExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache staffDatedCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STAFF_COHORT_ASSOCIATION, this.getClass().getName()); Iterator<Entity> scas = repo.findEach(EntityNames.STAFF_C... | StaffCohortAssociationExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache staffDatedCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STAFF_COHORT_ASSOCIATION, this.getClass().getName()); Iterator<Entity> scas = repo.findEach(EntityNames.STAFF_C... | StaffCohortAssociationExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache staffDatedCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STAFF_COHORT_ASSOCIATION, this.getClass().getName()); Iterator<Entity> scas = repo.findEach(EntityNames.STAFF_C... |
@Test public void testWriteOneAttendance() { Mockito.when(mockRepo.findEach(Mockito.eq("attendance"), Mockito.eq(new NeutralQuery()))).thenReturn( Arrays.asList(mockEntity).iterator()); entityBody.put("studentId", "student"); entityBody.put(ParameterConstants.SCHOOL_YEAR, "2010-2011"); extractor.extractEntities(mockCac... | @Override public void extractEntities(EntityToEdOrgDateCache studentCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.ATTENDANCE, this.getClass().getName()); Iterator<Entity> attendances = repo.findEach("attendance", new NeutralQuery()); while (attendances.hasNext()) { Entity attendance = attend... | AttendanceExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache studentCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.ATTENDANCE, this.getClass().getName()); Iterator<Entity> attendances = repo.findEach("attendance", new NeutralQuery()); while ... | AttendanceExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache studentCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.ATTENDANCE, this.getClass().getName()); Iterator<Entity> attendances = repo.findEach("attendance", new NeutralQuery()); while ... | AttendanceExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache studentCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.ATTENDANCE, this.getClass().getName()); Iterator<Entity> attendances = repo.findEach("attendance", new NeutralQuery()); while ... | AttendanceExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache studentCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.ATTENDANCE, this.getClass().getName()); Iterator<Entity> attendances = repo.findEach("attendance", new NeutralQuery()); while ... |
@Test public void testWriteManyAttendances() { Mockito.when(mockRepo.findEach(Mockito.eq("attendance"), Mockito.eq(new NeutralQuery()))).thenReturn( Arrays.asList(mockEntity, mockEntity, mockEntity).iterator()); entityBody.put("studentId", "student"); entityBody.put(ParameterConstants.SCHOOL_YEAR, "2010-2011"); extract... | @Override public void extractEntities(EntityToEdOrgDateCache studentCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.ATTENDANCE, this.getClass().getName()); Iterator<Entity> attendances = repo.findEach("attendance", new NeutralQuery()); while (attendances.hasNext()) { Entity attendance = attend... | AttendanceExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache studentCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.ATTENDANCE, this.getClass().getName()); Iterator<Entity> attendances = repo.findEach("attendance", new NeutralQuery()); while ... | AttendanceExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache studentCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.ATTENDANCE, this.getClass().getName()); Iterator<Entity> attendances = repo.findEach("attendance", new NeutralQuery()); while ... | AttendanceExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache studentCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.ATTENDANCE, this.getClass().getName()); Iterator<Entity> attendances = repo.findEach("attendance", new NeutralQuery()); while ... | AttendanceExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache studentCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.ATTENDANCE, this.getClass().getName()); Iterator<Entity> attendances = repo.findEach("attendance", new NeutralQuery()); while ... |
@Test public void testWriteNoAttendances() { Mockito.when(mockRepo.findEach(Mockito.eq("attendance"), Mockito.eq(new NeutralQuery()))).thenReturn( Arrays.asList(mockEntity, mockEntity, mockEntity).iterator()); entityBody.put("studentId", "student"); entityBody.put(ParameterConstants.SCHOOL_YEAR, "2010-2011"); Mockito.w... | @Override public void extractEntities(EntityToEdOrgDateCache studentCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.ATTENDANCE, this.getClass().getName()); Iterator<Entity> attendances = repo.findEach("attendance", new NeutralQuery()); while (attendances.hasNext()) { Entity attendance = attend... | AttendanceExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache studentCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.ATTENDANCE, this.getClass().getName()); Iterator<Entity> attendances = repo.findEach("attendance", new NeutralQuery()); while ... | AttendanceExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache studentCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.ATTENDANCE, this.getClass().getName()); Iterator<Entity> attendances = repo.findEach("attendance", new NeutralQuery()); while ... | AttendanceExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache studentCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.ATTENDANCE, this.getClass().getName()); Iterator<Entity> attendances = repo.findEach("attendance", new NeutralQuery()); while ... | AttendanceExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache studentCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.ATTENDANCE, this.getClass().getName()); Iterator<Entity> attendances = repo.findEach("attendance", new NeutralQuery()); while ... |
@Test public void testWriteFutureAttendances() { Mockito.when(mockRepo.findEach(Mockito.eq("attendance"), Mockito.eq(new NeutralQuery()))).thenReturn( Arrays.asList(mockEntity, mockEntity, mockEntity).iterator()); entityBody.put("studentId", "student"); entityBody.put(ParameterConstants.SCHOOL_YEAR, "3010-3011"); extra... | @Override public void extractEntities(EntityToEdOrgDateCache studentCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.ATTENDANCE, this.getClass().getName()); Iterator<Entity> attendances = repo.findEach("attendance", new NeutralQuery()); while (attendances.hasNext()) { Entity attendance = attend... | AttendanceExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache studentCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.ATTENDANCE, this.getClass().getName()); Iterator<Entity> attendances = repo.findEach("attendance", new NeutralQuery()); while ... | AttendanceExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache studentCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.ATTENDANCE, this.getClass().getName()); Iterator<Entity> attendances = repo.findEach("attendance", new NeutralQuery()); while ... | AttendanceExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache studentCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.ATTENDANCE, this.getClass().getName()); Iterator<Entity> attendances = repo.findEach("attendance", new NeutralQuery()); while ... | AttendanceExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache studentCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.ATTENDANCE, this.getClass().getName()); Iterator<Entity> attendances = repo.findEach("attendance", new NeutralQuery()); while ... |
@Test public void testTwoLeasOneStudent() { Map<String, DateTime> edOrgDate = new HashMap<String, DateTime>(); edOrgDate.put("LEA-1", DateTime.now()); edOrgDate.put("LEA-2", DateTime.now()); Mockito.when(mockStudentCache.getEntriesById(Mockito.eq("student-1"))).thenReturn(edOrgDate); Entity e = Mockito.mock(Entity.clas... | @Override public void extractEntities(EntityToEdOrgDateCache studentDateCache) { helper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT_SCHOOL_ASSOCIATION, this.getClass().getName()); Iterator<Entity> cursor = repo.findEach("studentSchoolAssociation", new NeutralQuery()); while(cursor.hasNext()) { Entity ssa = cu... | StudentSchoolAssociationExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache studentDateCache) { helper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT_SCHOOL_ASSOCIATION, this.getClass().getName()); Iterator<Entity> cursor = repo.findEach("studentSchoolAssociatio... | StudentSchoolAssociationExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache studentDateCache) { helper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT_SCHOOL_ASSOCIATION, this.getClass().getName()); Iterator<Entity> cursor = repo.findEach("studentSchoolAssociatio... | StudentSchoolAssociationExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache studentDateCache) { helper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT_SCHOOL_ASSOCIATION, this.getClass().getName()); Iterator<Entity> cursor = repo.findEach("studentSchoolAssociatio... | StudentSchoolAssociationExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache studentDateCache) { helper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT_SCHOOL_ASSOCIATION, this.getClass().getName()); Iterator<Entity> cursor = repo.findEach("studentSchoolAssociatio... |
@Test public void testGetValue() { BSONObject field = new BasicBSONObject("field", 1.312D); BSONObject entry = new BasicBSONObject("double", field); BSONWritable entity = new BSONWritable(entry); DoubleValueMapper mapper = new DoubleValueMapper("double.field"); Writable value = mapper.getValue(entity); assertFalse(valu... | @Override public Writable getValue(BSONWritable entity) { Writable rval = NullWritable.get(); String value = null; try { value = BSONUtilities.getValue(entity, fieldName); if (value != null) { rval = new DoubleWritable(Double.parseDouble(value.toString())); } } catch (NumberFormatException e) { log.severe(String.format... | DoubleValueMapper extends ValueMapper { @Override public Writable getValue(BSONWritable entity) { Writable rval = NullWritable.get(); String value = null; try { value = BSONUtilities.getValue(entity, fieldName); if (value != null) { rval = new DoubleWritable(Double.parseDouble(value.toString())); } } catch (NumberForma... | DoubleValueMapper extends ValueMapper { @Override public Writable getValue(BSONWritable entity) { Writable rval = NullWritable.get(); String value = null; try { value = BSONUtilities.getValue(entity, fieldName); if (value != null) { rval = new DoubleWritable(Double.parseDouble(value.toString())); } } catch (NumberForma... | DoubleValueMapper extends ValueMapper { @Override public Writable getValue(BSONWritable entity) { Writable rval = NullWritable.get(); String value = null; try { value = BSONUtilities.getValue(entity, fieldName); if (value != null) { rval = new DoubleWritable(Double.parseDouble(value.toString())); } } catch (NumberForma... | DoubleValueMapper extends ValueMapper { @Override public Writable getValue(BSONWritable entity) { Writable rval = NullWritable.get(); String value = null; try { value = BSONUtilities.getValue(entity, fieldName); if (value != null) { rval = new DoubleWritable(Double.parseDouble(value.toString())); } } catch (NumberForma... |
@Test public void testOneStudentOneLea() { Map<String, DateTime> edOrgDate = new HashMap<String, DateTime>(); edOrgDate.put("LEA-1", DateTime.now()); Mockito.when(mockStudentCache.getEntriesById(Mockito.eq("student-1"))).thenReturn(edOrgDate); Entity e = Mockito.mock(Entity.class); Map entityBody = new HashMap<String, ... | @Override public void extractEntities(EntityToEdOrgDateCache studentDateCache) { helper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT_SCHOOL_ASSOCIATION, this.getClass().getName()); Iterator<Entity> cursor = repo.findEach("studentSchoolAssociation", new NeutralQuery()); while(cursor.hasNext()) { Entity ssa = cu... | StudentSchoolAssociationExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache studentDateCache) { helper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT_SCHOOL_ASSOCIATION, this.getClass().getName()); Iterator<Entity> cursor = repo.findEach("studentSchoolAssociatio... | StudentSchoolAssociationExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache studentDateCache) { helper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT_SCHOOL_ASSOCIATION, this.getClass().getName()); Iterator<Entity> cursor = repo.findEach("studentSchoolAssociatio... | StudentSchoolAssociationExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache studentDateCache) { helper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT_SCHOOL_ASSOCIATION, this.getClass().getName()); Iterator<Entity> cursor = repo.findEach("studentSchoolAssociatio... | StudentSchoolAssociationExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache studentDateCache) { helper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT_SCHOOL_ASSOCIATION, this.getClass().getName()); Iterator<Entity> cursor = repo.findEach("studentSchoolAssociatio... |
@Test public void testTwoStudentsOneLea() { Map<String, DateTime> edOrgDate = new HashMap<String, DateTime>(); edOrgDate.put("LEA-1", DateTime.now()); Mockito.when(mockStudentCache.getEntriesById(Mockito.eq("student-1"))).thenReturn(edOrgDate); Mockito.when(mockStudentCache.getEntriesById(Mockito.eq("student-2"))).then... | @Override public void extractEntities(EntityToEdOrgDateCache studentDateCache) { helper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT_SCHOOL_ASSOCIATION, this.getClass().getName()); Iterator<Entity> cursor = repo.findEach("studentSchoolAssociation", new NeutralQuery()); while(cursor.hasNext()) { Entity ssa = cu... | StudentSchoolAssociationExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache studentDateCache) { helper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT_SCHOOL_ASSOCIATION, this.getClass().getName()); Iterator<Entity> cursor = repo.findEach("studentSchoolAssociatio... | StudentSchoolAssociationExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache studentDateCache) { helper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT_SCHOOL_ASSOCIATION, this.getClass().getName()); Iterator<Entity> cursor = repo.findEach("studentSchoolAssociatio... | StudentSchoolAssociationExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache studentDateCache) { helper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT_SCHOOL_ASSOCIATION, this.getClass().getName()); Iterator<Entity> cursor = repo.findEach("studentSchoolAssociatio... | StudentSchoolAssociationExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache studentDateCache) { helper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT_SCHOOL_ASSOCIATION, this.getClass().getName()); Iterator<Entity> cursor = repo.findEach("studentSchoolAssociatio... |
@Test public void testNonCurrentDate() { Map<String, DateTime> edOrgDate = new HashMap<String, DateTime>(); edOrgDate.put("LEA-1", DateTime.now()); Mockito.when(mockStudentCache.getEntriesById(Mockito.eq("student-1"))).thenReturn(edOrgDate); Mockito.when(mockStudentCache.getEntriesById(Mockito.eq("student-2"))).thenRet... | @Override public void extractEntities(EntityToEdOrgDateCache studentDateCache) { helper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT_SCHOOL_ASSOCIATION, this.getClass().getName()); Iterator<Entity> cursor = repo.findEach("studentSchoolAssociation", new NeutralQuery()); while(cursor.hasNext()) { Entity ssa = cu... | StudentSchoolAssociationExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache studentDateCache) { helper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT_SCHOOL_ASSOCIATION, this.getClass().getName()); Iterator<Entity> cursor = repo.findEach("studentSchoolAssociatio... | StudentSchoolAssociationExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache studentDateCache) { helper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT_SCHOOL_ASSOCIATION, this.getClass().getName()); Iterator<Entity> cursor = repo.findEach("studentSchoolAssociatio... | StudentSchoolAssociationExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache studentDateCache) { helper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT_SCHOOL_ASSOCIATION, this.getClass().getName()); Iterator<Entity> cursor = repo.findEach("studentSchoolAssociatio... | StudentSchoolAssociationExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache studentDateCache) { helper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT_SCHOOL_ASSOCIATION, this.getClass().getName()); Iterator<Entity> cursor = repo.findEach("studentSchoolAssociatio... |
@Test public void testExtractDisciplineIncidentAndAction() { Entity da1 = createDisciplineAction("2009-01-01"); Entity da2 = createDisciplineAction("2010-02-13"); Mockito.when(repo.findEach(Mockito.eq("disciplineAction"), Mockito.any(NeutralQuery.class))).thenReturn(Arrays.asList(da1, da2).listIterator(0)); Entity di1 ... | @Override @SuppressWarnings("unchecked") public void extractEntities(final EntityToEdOrgDateCache diCache) { extract(EntityNames.DISCIPLINE_INCIDENT, new Function<Entity, Set<String>>() { @Override public Set<String> apply(Entity input) { String id = input.getEntityId(); Map<String, DateTime> edorgDate = diCache.getEnt... | DisciplineExtractor implements EntityDatedExtract { @Override @SuppressWarnings("unchecked") public void extractEntities(final EntityToEdOrgDateCache diCache) { extract(EntityNames.DISCIPLINE_INCIDENT, new Function<Entity, Set<String>>() { @Override public Set<String> apply(Entity input) { String id = input.getEntityId... | DisciplineExtractor implements EntityDatedExtract { @Override @SuppressWarnings("unchecked") public void extractEntities(final EntityToEdOrgDateCache diCache) { extract(EntityNames.DISCIPLINE_INCIDENT, new Function<Entity, Set<String>>() { @Override public Set<String> apply(Entity input) { String id = input.getEntityId... | DisciplineExtractor implements EntityDatedExtract { @Override @SuppressWarnings("unchecked") public void extractEntities(final EntityToEdOrgDateCache diCache) { extract(EntityNames.DISCIPLINE_INCIDENT, new Function<Entity, Set<String>>() { @Override public Set<String> apply(Entity input) { String id = input.getEntityId... | DisciplineExtractor implements EntityDatedExtract { @Override @SuppressWarnings("unchecked") public void extractEntities(final EntityToEdOrgDateCache diCache) { extract(EntityNames.DISCIPLINE_INCIDENT, new Function<Entity, Set<String>>() { @Override public Set<String> apply(Entity input) { String id = input.getEntityId... |
@Test public void testWriteOneEntity() { Mockito.when(mockRepo.findEach(Mockito.eq(EntityNames.STUDENT_ASSESSMENT), Mockito.eq(new NeutralQuery()))) .thenReturn( Arrays.asList(mockEntity).iterator()); entityBody.put(ParameterConstants.STUDENT_ID, "student"); extractor.extractEntities(mockStudentCache); Mockito.verify(m... | @Override public void extractEntities(EntityToEdOrgDateCache entityToEdOrgDateCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT_ASSESSMENT, this.getClass().getName()); Iterator<Entity> assessments = repo.findEach(EntityNames.STUDENT_ASSESSMENT, new NeutralQuery()); while (assessments.has... | StudentAssessmentExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache entityToEdOrgDateCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT_ASSESSMENT, this.getClass().getName()); Iterator<Entity> assessments = repo.findEach(EntityNames.STUD... | StudentAssessmentExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache entityToEdOrgDateCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT_ASSESSMENT, this.getClass().getName()); Iterator<Entity> assessments = repo.findEach(EntityNames.STUD... | StudentAssessmentExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache entityToEdOrgDateCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT_ASSESSMENT, this.getClass().getName()); Iterator<Entity> assessments = repo.findEach(EntityNames.STUD... | StudentAssessmentExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache entityToEdOrgDateCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT_ASSESSMENT, this.getClass().getName()); Iterator<Entity> assessments = repo.findEach(EntityNames.STUD... |
@Test public void testWriteManyEntities() { Mockito.when(mockRepo.findEach(Mockito.eq(EntityNames.STUDENT_ASSESSMENT), Mockito.eq(new NeutralQuery()))) .thenReturn( Arrays.asList(mockEntity, mockEntity, mockEntity).iterator()); entityBody.put(ParameterConstants.STUDENT_ID, "student"); extractor.extractEntities(mockStud... | @Override public void extractEntities(EntityToEdOrgDateCache entityToEdOrgDateCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT_ASSESSMENT, this.getClass().getName()); Iterator<Entity> assessments = repo.findEach(EntityNames.STUDENT_ASSESSMENT, new NeutralQuery()); while (assessments.has... | StudentAssessmentExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache entityToEdOrgDateCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT_ASSESSMENT, this.getClass().getName()); Iterator<Entity> assessments = repo.findEach(EntityNames.STUD... | StudentAssessmentExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache entityToEdOrgDateCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT_ASSESSMENT, this.getClass().getName()); Iterator<Entity> assessments = repo.findEach(EntityNames.STUD... | StudentAssessmentExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache entityToEdOrgDateCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT_ASSESSMENT, this.getClass().getName()); Iterator<Entity> assessments = repo.findEach(EntityNames.STUD... | StudentAssessmentExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache entityToEdOrgDateCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT_ASSESSMENT, this.getClass().getName()); Iterator<Entity> assessments = repo.findEach(EntityNames.STUD... |
@Test public void testWriteSomeEntities() { Entity saEntity = Mockito.mock(Entity.class); Map<String, Object> saEntityBody = new HashMap<String, Object>(); saEntityBody.put("administrationDate", "3000-12-21"); saEntityBody.put(ParameterConstants.STUDENT_ID, "student"); Mockito.when(saEntity.getBody()).thenReturn(saEnti... | @Override public void extractEntities(EntityToEdOrgDateCache entityToEdOrgDateCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT_ASSESSMENT, this.getClass().getName()); Iterator<Entity> assessments = repo.findEach(EntityNames.STUDENT_ASSESSMENT, new NeutralQuery()); while (assessments.has... | StudentAssessmentExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache entityToEdOrgDateCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT_ASSESSMENT, this.getClass().getName()); Iterator<Entity> assessments = repo.findEach(EntityNames.STUD... | StudentAssessmentExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache entityToEdOrgDateCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT_ASSESSMENT, this.getClass().getName()); Iterator<Entity> assessments = repo.findEach(EntityNames.STUD... | StudentAssessmentExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache entityToEdOrgDateCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT_ASSESSMENT, this.getClass().getName()); Iterator<Entity> assessments = repo.findEach(EntityNames.STUD... | StudentAssessmentExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache entityToEdOrgDateCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT_ASSESSMENT, this.getClass().getName()); Iterator<Entity> assessments = repo.findEach(EntityNames.STUD... |
@Test public void testExtractNoEntityBecauseOfLEAMiss() { Mockito.when(mockRepo.findEach(Mockito.eq(EntityNames.STUDENT_ASSESSMENT), Mockito.eq(new NeutralQuery()))) .thenReturn( Arrays.asList(mockEntity).iterator()); Mockito.when(mockMap.getExtractFileForEdOrg("LEA")).thenReturn(null); extractor.extractEntities(mockSt... | @Override public void extractEntities(EntityToEdOrgDateCache entityToEdOrgDateCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT_ASSESSMENT, this.getClass().getName()); Iterator<Entity> assessments = repo.findEach(EntityNames.STUDENT_ASSESSMENT, new NeutralQuery()); while (assessments.has... | StudentAssessmentExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache entityToEdOrgDateCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT_ASSESSMENT, this.getClass().getName()); Iterator<Entity> assessments = repo.findEach(EntityNames.STUD... | StudentAssessmentExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache entityToEdOrgDateCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT_ASSESSMENT, this.getClass().getName()); Iterator<Entity> assessments = repo.findEach(EntityNames.STUD... | StudentAssessmentExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache entityToEdOrgDateCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT_ASSESSMENT, this.getClass().getName()); Iterator<Entity> assessments = repo.findEach(EntityNames.STUD... | StudentAssessmentExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache entityToEdOrgDateCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT_ASSESSMENT, this.getClass().getName()); Iterator<Entity> assessments = repo.findEach(EntityNames.STUD... |
@Test public void testExtractNoEntityBecauseOfIdMiss() { entityBody.put(ParameterConstants.STUDENT_ID, "STUDENT1"); Mockito.when(mockRepo.findEach(Mockito.eq(EntityNames.STUDENT_ASSESSMENT), Mockito.eq(new NeutralQuery()))) .thenReturn( Arrays.asList(mockEntity).iterator()); Mockito.when(mockMap.getExtractFileForEdOrg(... | @Override public void extractEntities(EntityToEdOrgDateCache entityToEdOrgDateCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT_ASSESSMENT, this.getClass().getName()); Iterator<Entity> assessments = repo.findEach(EntityNames.STUDENT_ASSESSMENT, new NeutralQuery()); while (assessments.has... | StudentAssessmentExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache entityToEdOrgDateCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT_ASSESSMENT, this.getClass().getName()); Iterator<Entity> assessments = repo.findEach(EntityNames.STUD... | StudentAssessmentExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache entityToEdOrgDateCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT_ASSESSMENT, this.getClass().getName()); Iterator<Entity> assessments = repo.findEach(EntityNames.STUD... | StudentAssessmentExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache entityToEdOrgDateCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT_ASSESSMENT, this.getClass().getName()); Iterator<Entity> assessments = repo.findEach(EntityNames.STUD... | StudentAssessmentExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache entityToEdOrgDateCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT_ASSESSMENT, this.getClass().getName()); Iterator<Entity> assessments = repo.findEach(EntityNames.STUD... |
@Test public void testAudit() { SecurityEvent securityEvent = new SecurityEvent(); securityEvent.setClassName(this.getClass().getName()); securityEvent.setLogMessage("Test Message"); securityEvent.setLogLevel(LogLevelType.TYPE_TRACE); audit(securityEvent); Mockito.verify(mockedEntityRepository, times(1)).create(any(Str... | public static void audit(SecurityEvent event) { if (entityRepository != null) { Map<String, Object> metadata = new HashMap<String, Object>(); metadata.put("tenantId", event.getTenantId()); entityRepository.create("securityEvent", event.getProperties(), metadata, "securityEvent"); } else { LOG.error("Could not log Secur... | LogUtil { public static void audit(SecurityEvent event) { if (entityRepository != null) { Map<String, Object> metadata = new HashMap<String, Object>(); metadata.put("tenantId", event.getTenantId()); entityRepository.create("securityEvent", event.getProperties(), metadata, "securityEvent"); } else { LOG.error("Could not... | LogUtil { public static void audit(SecurityEvent event) { if (entityRepository != null) { Map<String, Object> metadata = new HashMap<String, Object>(); metadata.put("tenantId", event.getTenantId()); entityRepository.create("securityEvent", event.getProperties(), metadata, "securityEvent"); } else { LOG.error("Could not... | LogUtil { public static void audit(SecurityEvent event) { if (entityRepository != null) { Map<String, Object> metadata = new HashMap<String, Object>(); metadata.put("tenantId", event.getTenantId()); entityRepository.create("securityEvent", event.getProperties(), metadata, "securityEvent"); } else { LOG.error("Could not... | LogUtil { public static void audit(SecurityEvent event) { if (entityRepository != null) { Map<String, Object> metadata = new HashMap<String, Object>(); metadata.put("tenantId", event.getTenantId()); entityRepository.create("securityEvent", event.getProperties(), metadata, "securityEvent"); } else { LOG.error("Could not... |
@Test public void testValueNotFound() { BSONObject field = new BasicBSONObject("field", 1.312D); BSONObject entry = new BasicBSONObject("double", field); BSONWritable entity = new BSONWritable(entry); DoubleValueMapper mapper = new DoubleValueMapper("double.missing_field"); Writable value = mapper.getValue(entity); ass... | @Override public Writable getValue(BSONWritable entity) { Writable rval = NullWritable.get(); String value = null; try { value = BSONUtilities.getValue(entity, fieldName); if (value != null) { rval = new DoubleWritable(Double.parseDouble(value.toString())); } } catch (NumberFormatException e) { log.severe(String.format... | DoubleValueMapper extends ValueMapper { @Override public Writable getValue(BSONWritable entity) { Writable rval = NullWritable.get(); String value = null; try { value = BSONUtilities.getValue(entity, fieldName); if (value != null) { rval = new DoubleWritable(Double.parseDouble(value.toString())); } } catch (NumberForma... | DoubleValueMapper extends ValueMapper { @Override public Writable getValue(BSONWritable entity) { Writable rval = NullWritable.get(); String value = null; try { value = BSONUtilities.getValue(entity, fieldName); if (value != null) { rval = new DoubleWritable(Double.parseDouble(value.toString())); } } catch (NumberForma... | DoubleValueMapper extends ValueMapper { @Override public Writable getValue(BSONWritable entity) { Writable rval = NullWritable.get(); String value = null; try { value = BSONUtilities.getValue(entity, fieldName); if (value != null) { rval = new DoubleWritable(Double.parseDouble(value.toString())); } } catch (NumberForma... | DoubleValueMapper extends ValueMapper { @Override public Writable getValue(BSONWritable entity) { Writable rval = NullWritable.get(); String value = null; try { value = BSONUtilities.getValue(entity, fieldName); if (value != null) { rval = new DoubleWritable(Double.parseDouble(value.toString())); } } catch (NumberForma... |
@Test public void generateArchiveTest() throws Exception { String fileName = archiveFile.getFileName(testApp); archiveFile.generateArchive(); TarArchiveInputStream tarInputStream = null; List<String> names = new ArrayList<String>(); File decryptedFile = null; try { decryptedFile = decrypt(new File(fileName)); tarInputS... | public boolean generateArchive() { boolean success = true; TarArchiveOutputStream tarArchiveOutputStream = null; MultiOutputStream multiOutputStream = new MultiOutputStream(); try { for(String app : clientKeys.keySet()){ SecurityEvent event = securityEventUtil.createSecurityEvent(this.getClass().getName(), "Writing ext... | ExtractFile { public boolean generateArchive() { boolean success = true; TarArchiveOutputStream tarArchiveOutputStream = null; MultiOutputStream multiOutputStream = new MultiOutputStream(); try { for(String app : clientKeys.keySet()){ SecurityEvent event = securityEventUtil.createSecurityEvent(this.getClass().getName()... | ExtractFile { public boolean generateArchive() { boolean success = true; TarArchiveOutputStream tarArchiveOutputStream = null; MultiOutputStream multiOutputStream = new MultiOutputStream(); try { for(String app : clientKeys.keySet()){ SecurityEvent event = securityEventUtil.createSecurityEvent(this.getClass().getName()... | ExtractFile { public boolean generateArchive() { boolean success = true; TarArchiveOutputStream tarArchiveOutputStream = null; MultiOutputStream multiOutputStream = new MultiOutputStream(); try { for(String app : clientKeys.keySet()){ SecurityEvent event = securityEventUtil.createSecurityEvent(this.getClass().getName()... | ExtractFile { public boolean generateArchive() { boolean success = true; TarArchiveOutputStream tarArchiveOutputStream = null; MultiOutputStream multiOutputStream = new MultiOutputStream(); try { for(String app : clientKeys.keySet()){ SecurityEvent event = securityEventUtil.createSecurityEvent(this.getClass().getName()... |
@Test public void testErrorFile() throws IOException { File parentDir = new File("./"); parentDir.deleteOnExit(); ErrorFile error = new ErrorFile(parentDir); for (int i=0; i < 3; i++) { Entity entity = Mockito.mock(Entity.class); Mockito.when(entity.getType()).thenReturn("TYPE" + i); error.logEntityError(entity); } Ent... | public ErrorFile(File parent) { errorFile = new File(parent, ERROR_FILE_NAME); } | ErrorFile { public ErrorFile(File parent) { errorFile = new File(parent, ERROR_FILE_NAME); } } | ErrorFile { public ErrorFile(File parent) { errorFile = new File(parent, ERROR_FILE_NAME); } ErrorFile(File parent); } | ErrorFile { public ErrorFile(File parent) { errorFile = new File(parent, ERROR_FILE_NAME); } ErrorFile(File parent); void logEntityError(Entity entity); File getFile(); } | ErrorFile { public ErrorFile(File parent) { errorFile = new File(parent, ERROR_FILE_NAME); } ErrorFile(File parent); void logEntityError(Entity entity); File getFile(); static final String ERROR_FILE_NAME; } |
@Test public void testWrite() { ExtractFile archiveFile = Mockito.mock(ExtractFile.class); JsonFileWriter jsonFile = Mockito.mock(JsonFileWriter.class); Mockito.when(archiveFile.getDataFileEntry(Mockito.anyString())).thenReturn(jsonFile); Entity entity = Mockito.mock(Entity.class); Mockito.when(entity.getType()).thenRe... | public Entity write(Entity entity, ExtractFile archiveFile) { writeEntityFile(entity, archiveFile); writerCollectionFile(entity, archiveFile); return entity; } | EntityWriterManager { public Entity write(Entity entity, ExtractFile archiveFile) { writeEntityFile(entity, archiveFile); writerCollectionFile(entity, archiveFile); return entity; } } | EntityWriterManager { public Entity write(Entity entity, ExtractFile archiveFile) { writeEntityFile(entity, archiveFile); writerCollectionFile(entity, archiveFile); return entity; } } | EntityWriterManager { public Entity write(Entity entity, ExtractFile archiveFile) { writeEntityFile(entity, archiveFile); writerCollectionFile(entity, archiveFile); return entity; } Entity write(Entity entity, ExtractFile archiveFile); void writeDeleteFile(Entity entity, ExtractFile archiveFile); void setWriters(Defau... | EntityWriterManager { public Entity write(Entity entity, ExtractFile archiveFile) { writeEntityFile(entity, archiveFile); writerCollectionFile(entity, archiveFile); return entity; } Entity write(Entity entity, ExtractFile archiveFile); void writeDeleteFile(Entity entity, ExtractFile archiveFile); void setWriters(Defau... |
@Test public void testWriteDefault() { ExtractFile archiveFile = Mockito.mock(ExtractFile.class); JsonFileWriter jsonFile = Mockito.mock(JsonFileWriter.class); Mockito.when(archiveFile.getDataFileEntry(Mockito.anyString())).thenReturn(jsonFile); Entity entity = Mockito.mock(Entity.class); Mockito.when(entity.getType())... | public Entity write(Entity entity, ExtractFile archiveFile) { writeEntityFile(entity, archiveFile); writerCollectionFile(entity, archiveFile); return entity; } | EntityWriterManager { public Entity write(Entity entity, ExtractFile archiveFile) { writeEntityFile(entity, archiveFile); writerCollectionFile(entity, archiveFile); return entity; } } | EntityWriterManager { public Entity write(Entity entity, ExtractFile archiveFile) { writeEntityFile(entity, archiveFile); writerCollectionFile(entity, archiveFile); return entity; } } | EntityWriterManager { public Entity write(Entity entity, ExtractFile archiveFile) { writeEntityFile(entity, archiveFile); writerCollectionFile(entity, archiveFile); return entity; } Entity write(Entity entity, ExtractFile archiveFile); void writeDeleteFile(Entity entity, ExtractFile archiveFile); void setWriters(Defau... | EntityWriterManager { public Entity write(Entity entity, ExtractFile archiveFile) { writeEntityFile(entity, archiveFile); writerCollectionFile(entity, archiveFile); return entity; } Entity write(Entity entity, ExtractFile archiveFile); void writeDeleteFile(Entity entity, ExtractFile archiveFile); void setWriters(Defau... |
@Test public void testWrite() { JsonFileWriter file = Mockito.mock(JsonFileWriter.class); ErrorFile errorFile = Mockito.mock(ErrorFile.class); Entity entity = Mockito.mock(Entity.class); Entity check = writer.write(entity, file, errorFile); Assert.assertEquals(treatedEntity, check); try { Mockito.verify(file, Mockito.t... | public Entity write(Entity entity, JsonFileWriter file, ErrorFile errors) { Entity treated = applicator.apply(entity); try { file.write(treated); } catch (JsonProcessingException e) { LOG.error("Error while extracting from " + entity.getType(), e); errors.logEntityError(entity); } catch (IOException e) { LOG.error("Err... | EntityWriter { public Entity write(Entity entity, JsonFileWriter file, ErrorFile errors) { Entity treated = applicator.apply(entity); try { file.write(treated); } catch (JsonProcessingException e) { LOG.error("Error while extracting from " + entity.getType(), e); errors.logEntityError(entity); } catch (IOException e) {... | EntityWriter { public Entity write(Entity entity, JsonFileWriter file, ErrorFile errors) { Entity treated = applicator.apply(entity); try { file.write(treated); } catch (JsonProcessingException e) { LOG.error("Error while extracting from " + entity.getType(), e); errors.logEntityError(entity); } catch (IOException e) {... | EntityWriter { public Entity write(Entity entity, JsonFileWriter file, ErrorFile errors) { Entity treated = applicator.apply(entity); try { file.write(treated); } catch (JsonProcessingException e) { LOG.error("Error while extracting from " + entity.getType(), e); errors.logEntityError(entity); } catch (IOException e) {... | EntityWriter { public Entity write(Entity entity, JsonFileWriter file, ErrorFile errors) { Entity treated = applicator.apply(entity); try { file.write(treated); } catch (JsonProcessingException e) { LOG.error("Error while extracting from " + entity.getType(), e); errors.logEntityError(entity); } catch (IOException e) {... |
@Test public void testIOException() throws IOException { JsonFileWriter file = Mockito.mock(JsonFileWriter.class); Mockito.doThrow(new IOException("Mock IOException")).when(file).write(Mockito.any(Entity.class)); ErrorFile errorFile = Mockito.mock(ErrorFile.class); Entity entity = Mockito.mock(Entity.class); Mockito.wh... | public Entity write(Entity entity, JsonFileWriter file, ErrorFile errors) { Entity treated = applicator.apply(entity); try { file.write(treated); } catch (JsonProcessingException e) { LOG.error("Error while extracting from " + entity.getType(), e); errors.logEntityError(entity); } catch (IOException e) { LOG.error("Err... | EntityWriter { public Entity write(Entity entity, JsonFileWriter file, ErrorFile errors) { Entity treated = applicator.apply(entity); try { file.write(treated); } catch (JsonProcessingException e) { LOG.error("Error while extracting from " + entity.getType(), e); errors.logEntityError(entity); } catch (IOException e) {... | EntityWriter { public Entity write(Entity entity, JsonFileWriter file, ErrorFile errors) { Entity treated = applicator.apply(entity); try { file.write(treated); } catch (JsonProcessingException e) { LOG.error("Error while extracting from " + entity.getType(), e); errors.logEntityError(entity); } catch (IOException e) {... | EntityWriter { public Entity write(Entity entity, JsonFileWriter file, ErrorFile errors) { Entity treated = applicator.apply(entity); try { file.write(treated); } catch (JsonProcessingException e) { LOG.error("Error while extracting from " + entity.getType(), e); errors.logEntityError(entity); } catch (IOException e) {... | EntityWriter { public Entity write(Entity entity, JsonFileWriter file, ErrorFile errors) { Entity treated = applicator.apply(entity); try { file.write(treated); } catch (JsonProcessingException e) { LOG.error("Error while extracting from " + entity.getType(), e); errors.logEntityError(entity); } catch (IOException e) {... |
@Test public void testGetSampleExtract() throws Exception { injector.setEducatorContext(); ResponseImpl res = (ResponseImpl) bulkExtract.get(req); assertEquals(200, res.getStatus()); MultivaluedMap<String, Object> headers = res.getMetadata(); assertNotNull(headers); assertTrue(headers.containsKey("content-disposition")... | @GET @Path("extract") @RightsAllowed({ Right.BULK_EXTRACT }) public Response get(@Context HttpServletRequest request) throws Exception { LOG.info("Received request to stream sample bulk extract..."); logSecurityEvent("Received request to stream sample bulk extract"); validateRequestCertificate(request); final InputStre... | BulkExtract { @GET @Path("extract") @RightsAllowed({ Right.BULK_EXTRACT }) public Response get(@Context HttpServletRequest request) throws Exception { LOG.info("Received request to stream sample bulk extract..."); logSecurityEvent("Received request to stream sample bulk extract"); validateRequestCertificate(request); f... | BulkExtract { @GET @Path("extract") @RightsAllowed({ Right.BULK_EXTRACT }) public Response get(@Context HttpServletRequest request) throws Exception { LOG.info("Received request to stream sample bulk extract..."); logSecurityEvent("Received request to stream sample bulk extract"); validateRequestCertificate(request); f... | BulkExtract { @GET @Path("extract") @RightsAllowed({ Right.BULK_EXTRACT }) public Response get(@Context HttpServletRequest request) throws Exception { LOG.info("Received request to stream sample bulk extract..."); logSecurityEvent("Received request to stream sample bulk extract"); validateRequestCertificate(request); f... | BulkExtract { @GET @Path("extract") @RightsAllowed({ Right.BULK_EXTRACT }) public Response get(@Context HttpServletRequest request) throws Exception { LOG.info("Received request to stream sample bulk extract..."); logSecurityEvent("Received request to stream sample bulk extract"); validateRequestCertificate(request); f... |
@Test public void testGetExtractResponse() throws Exception { injector.setOauthAuthenticationWithEducationRole(); mockApplicationEntity(); mockBulkExtractEntity(null); HttpRequestContext context = new HttpRequestContextAdapter() { @Override public String getMethod() { return "GET"; } }; Response res = bulkExtract.getEd... | Response getEdOrgExtractResponse(final HttpRequestContext req, final String edOrgId, final String deltaDate) { ExtractFile ef = getEdOrgExtractFile(edOrgId, deltaDate); if (ef == null) { return Response.status(Status.NOT_FOUND).build(); } return fileResource.getFileResponse(req, ef, ef.getLastModified()); } | BulkExtract { Response getEdOrgExtractResponse(final HttpRequestContext req, final String edOrgId, final String deltaDate) { ExtractFile ef = getEdOrgExtractFile(edOrgId, deltaDate); if (ef == null) { return Response.status(Status.NOT_FOUND).build(); } return fileResource.getFileResponse(req, ef, ef.getLastModified());... | BulkExtract { Response getEdOrgExtractResponse(final HttpRequestContext req, final String edOrgId, final String deltaDate) { ExtractFile ef = getEdOrgExtractFile(edOrgId, deltaDate); if (ef == null) { return Response.status(Status.NOT_FOUND).build(); } return fileResource.getFileResponse(req, ef, ef.getLastModified());... | BulkExtract { Response getEdOrgExtractResponse(final HttpRequestContext req, final String edOrgId, final String deltaDate) { ExtractFile ef = getEdOrgExtractFile(edOrgId, deltaDate); if (ef == null) { return Response.status(Status.NOT_FOUND).build(); } return fileResource.getFileResponse(req, ef, ef.getLastModified());... | BulkExtract { Response getEdOrgExtractResponse(final HttpRequestContext req, final String edOrgId, final String deltaDate) { ExtractFile ef = getEdOrgExtractFile(edOrgId, deltaDate); if (ef == null) { return Response.status(Status.NOT_FOUND).build(); } return fileResource.getFileResponse(req, ef, ef.getLastModified());... |
@Test public void testHeadTenant() throws Exception { injector.setOauthAuthenticationWithEducationRole(); mockApplicationEntity(); mockBulkExtractEntity(null); HttpRequestContext context = new HttpRequestContextAdapter() { @Override public String getMethod() { return "HEAD"; } }; Response res = bulkExtract.getEdOrgExtr... | Response getEdOrgExtractResponse(final HttpRequestContext req, final String edOrgId, final String deltaDate) { ExtractFile ef = getEdOrgExtractFile(edOrgId, deltaDate); if (ef == null) { return Response.status(Status.NOT_FOUND).build(); } return fileResource.getFileResponse(req, ef, ef.getLastModified()); } | BulkExtract { Response getEdOrgExtractResponse(final HttpRequestContext req, final String edOrgId, final String deltaDate) { ExtractFile ef = getEdOrgExtractFile(edOrgId, deltaDate); if (ef == null) { return Response.status(Status.NOT_FOUND).build(); } return fileResource.getFileResponse(req, ef, ef.getLastModified());... | BulkExtract { Response getEdOrgExtractResponse(final HttpRequestContext req, final String edOrgId, final String deltaDate) { ExtractFile ef = getEdOrgExtractFile(edOrgId, deltaDate); if (ef == null) { return Response.status(Status.NOT_FOUND).build(); } return fileResource.getFileResponse(req, ef, ef.getLastModified());... | BulkExtract { Response getEdOrgExtractResponse(final HttpRequestContext req, final String edOrgId, final String deltaDate) { ExtractFile ef = getEdOrgExtractFile(edOrgId, deltaDate); if (ef == null) { return Response.status(Status.NOT_FOUND).build(); } return fileResource.getFileResponse(req, ef, ef.getLastModified());... | BulkExtract { Response getEdOrgExtractResponse(final HttpRequestContext req, final String edOrgId, final String deltaDate) { ExtractFile ef = getEdOrgExtractFile(edOrgId, deltaDate); if (ef == null) { return Response.status(Status.NOT_FOUND).build(); } return fileResource.getFileResponse(req, ef, ef.getLastModified());... |
@Test public void testRange() throws Exception { injector.setOauthAuthenticationWithEducationRole(); mockApplicationEntity(); mockBulkExtractEntity(null); HttpRequestContext failureContext = Mockito.mock(HttpRequestContext.class); Mockito.when(failureContext.getMethod()).thenReturn("HEAD"); Mockito.when(failureContext.... | Response getEdOrgExtractResponse(final HttpRequestContext req, final String edOrgId, final String deltaDate) { ExtractFile ef = getEdOrgExtractFile(edOrgId, deltaDate); if (ef == null) { return Response.status(Status.NOT_FOUND).build(); } return fileResource.getFileResponse(req, ef, ef.getLastModified()); } | BulkExtract { Response getEdOrgExtractResponse(final HttpRequestContext req, final String edOrgId, final String deltaDate) { ExtractFile ef = getEdOrgExtractFile(edOrgId, deltaDate); if (ef == null) { return Response.status(Status.NOT_FOUND).build(); } return fileResource.getFileResponse(req, ef, ef.getLastModified());... | BulkExtract { Response getEdOrgExtractResponse(final HttpRequestContext req, final String edOrgId, final String deltaDate) { ExtractFile ef = getEdOrgExtractFile(edOrgId, deltaDate); if (ef == null) { return Response.status(Status.NOT_FOUND).build(); } return fileResource.getFileResponse(req, ef, ef.getLastModified());... | BulkExtract { Response getEdOrgExtractResponse(final HttpRequestContext req, final String edOrgId, final String deltaDate) { ExtractFile ef = getEdOrgExtractFile(edOrgId, deltaDate); if (ef == null) { return Response.status(Status.NOT_FOUND).build(); } return fileResource.getFileResponse(req, ef, ef.getLastModified());... | BulkExtract { Response getEdOrgExtractResponse(final HttpRequestContext req, final String edOrgId, final String deltaDate) { ExtractFile ef = getEdOrgExtractFile(edOrgId, deltaDate); if (ef == null) { return Response.status(Status.NOT_FOUND).build(); } return fileResource.getFileResponse(req, ef, ef.getLastModified());... |
@Test public void testGetValueNotDouble() { BSONObject field = new BasicBSONObject("field", "Bob"); BSONObject entry = new BasicBSONObject("double", field); BSONWritable entity = new BSONWritable(entry); DoubleValueMapper mapper = new DoubleValueMapper("double.field"); Writable value = mapper.getValue(entity); assertTr... | @Override public Writable getValue(BSONWritable entity) { Writable rval = NullWritable.get(); String value = null; try { value = BSONUtilities.getValue(entity, fieldName); if (value != null) { rval = new DoubleWritable(Double.parseDouble(value.toString())); } } catch (NumberFormatException e) { log.severe(String.format... | DoubleValueMapper extends ValueMapper { @Override public Writable getValue(BSONWritable entity) { Writable rval = NullWritable.get(); String value = null; try { value = BSONUtilities.getValue(entity, fieldName); if (value != null) { rval = new DoubleWritable(Double.parseDouble(value.toString())); } } catch (NumberForma... | DoubleValueMapper extends ValueMapper { @Override public Writable getValue(BSONWritable entity) { Writable rval = NullWritable.get(); String value = null; try { value = BSONUtilities.getValue(entity, fieldName); if (value != null) { rval = new DoubleWritable(Double.parseDouble(value.toString())); } } catch (NumberForma... | DoubleValueMapper extends ValueMapper { @Override public Writable getValue(BSONWritable entity) { Writable rval = NullWritable.get(); String value = null; try { value = BSONUtilities.getValue(entity, fieldName); if (value != null) { rval = new DoubleWritable(Double.parseDouble(value.toString())); } } catch (NumberForma... | DoubleValueMapper extends ValueMapper { @Override public Writable getValue(BSONWritable entity) { Writable rval = NullWritable.get(); String value = null; try { value = BSONUtilities.getValue(entity, fieldName); if (value != null) { rval = new DoubleWritable(Double.parseDouble(value.toString())); } } catch (NumberForma... |
@Test public void testFailedEvaluatePreconditions() throws Exception { injector.setOauthAuthenticationWithEducationRole(); mockApplicationEntity(); mockBulkExtractEntity(null); HttpRequestContext context = new HttpRequestContextAdapter() { @Override public ResponseBuilder evaluatePreconditions(Date lastModified, Entity... | Response getEdOrgExtractResponse(final HttpRequestContext req, final String edOrgId, final String deltaDate) { ExtractFile ef = getEdOrgExtractFile(edOrgId, deltaDate); if (ef == null) { return Response.status(Status.NOT_FOUND).build(); } return fileResource.getFileResponse(req, ef, ef.getLastModified()); } | BulkExtract { Response getEdOrgExtractResponse(final HttpRequestContext req, final String edOrgId, final String deltaDate) { ExtractFile ef = getEdOrgExtractFile(edOrgId, deltaDate); if (ef == null) { return Response.status(Status.NOT_FOUND).build(); } return fileResource.getFileResponse(req, ef, ef.getLastModified());... | BulkExtract { Response getEdOrgExtractResponse(final HttpRequestContext req, final String edOrgId, final String deltaDate) { ExtractFile ef = getEdOrgExtractFile(edOrgId, deltaDate); if (ef == null) { return Response.status(Status.NOT_FOUND).build(); } return fileResource.getFileResponse(req, ef, ef.getLastModified());... | BulkExtract { Response getEdOrgExtractResponse(final HttpRequestContext req, final String edOrgId, final String deltaDate) { ExtractFile ef = getEdOrgExtractFile(edOrgId, deltaDate); if (ef == null) { return Response.status(Status.NOT_FOUND).build(); } return fileResource.getFileResponse(req, ef, ef.getLastModified());... | BulkExtract { Response getEdOrgExtractResponse(final HttpRequestContext req, final String edOrgId, final String deltaDate) { ExtractFile ef = getEdOrgExtractFile(edOrgId, deltaDate); if (ef == null) { return Response.status(Status.NOT_FOUND).build(); } return fileResource.getFileResponse(req, ef, ef.getLastModified());... |
@Test public void testGetDelta() throws Exception { injector.setOauthAuthenticationWithEducationRole(); mockApplicationEntity(); mockAppAuth(); Map<String, Object> body = new HashMap<String, Object>(); File f = File.createTempFile("bulkExtract", ".tar"); try { body.put(BulkExtract.BULK_EXTRACT_FILE_PATH, f.getAbsoluteP... | @GET @Path("extract/{edOrgId}/delta/{date}") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getDelta(@Context HttpServletRequest request, @Context HttpContext context, @PathParam("edOrgId") String edOrgId, @PathParam("date") String date) { logSecurityEvent("Received request to stream Edorg delta bulk extract da... | BulkExtract { @GET @Path("extract/{edOrgId}/delta/{date}") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getDelta(@Context HttpServletRequest request, @Context HttpContext context, @PathParam("edOrgId") String edOrgId, @PathParam("date") String date) { logSecurityEvent("Received request to stream Edorg delta b... | BulkExtract { @GET @Path("extract/{edOrgId}/delta/{date}") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getDelta(@Context HttpServletRequest request, @Context HttpContext context, @PathParam("edOrgId") String edOrgId, @PathParam("date") String date) { logSecurityEvent("Received request to stream Edorg delta b... | BulkExtract { @GET @Path("extract/{edOrgId}/delta/{date}") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getDelta(@Context HttpServletRequest request, @Context HttpContext context, @PathParam("edOrgId") String edOrgId, @PathParam("date") String date) { logSecurityEvent("Received request to stream Edorg delta b... | BulkExtract { @GET @Path("extract/{edOrgId}/delta/{date}") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getDelta(@Context HttpServletRequest request, @Context HttpContext context, @PathParam("edOrgId") String edOrgId, @PathParam("date") String date) { logSecurityEvent("Received request to stream Edorg delta b... |
@Test public void testSEADelta() throws Exception { String edOrgId = "Midvale"; Map<String, Object> edOrgBody = new HashMap<String, Object>(); List<String> orgCategory = new ArrayList<String>(); orgCategory.add("State Education Agency"); edOrgBody.put("organizationCategories", orgCategory); Entity edOrg = new MongoEnti... | @GET @Path("extract/public/delta/{date}") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getPublicDelta(@Context HttpServletRequest request, @Context HttpContext context, @PathParam("date") String date) { logSecurityEvent("Received request to stream public delta bulk extract data"); if (deltasEnabled) { LOG.inf... | BulkExtract { @GET @Path("extract/public/delta/{date}") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getPublicDelta(@Context HttpServletRequest request, @Context HttpContext context, @PathParam("date") String date) { logSecurityEvent("Received request to stream public delta bulk extract data"); if (deltasEnab... | BulkExtract { @GET @Path("extract/public/delta/{date}") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getPublicDelta(@Context HttpServletRequest request, @Context HttpContext context, @PathParam("date") String date) { logSecurityEvent("Received request to stream public delta bulk extract data"); if (deltasEnab... | BulkExtract { @GET @Path("extract/public/delta/{date}") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getPublicDelta(@Context HttpServletRequest request, @Context HttpContext context, @PathParam("date") String date) { logSecurityEvent("Received request to stream public delta bulk extract data"); if (deltasEnab... | BulkExtract { @GET @Path("extract/public/delta/{date}") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getPublicDelta(@Context HttpServletRequest request, @Context HttpContext context, @PathParam("date") String date) { logSecurityEvent("Received request to stream public delta bulk extract data"); if (deltasEnab... |
@Test(expected = AccessDeniedException.class) public void testAppIsNotAuthorizedForLea() throws Exception { injector.setEducatorContext(); Map<String, Object> body = new HashMap<String, Object>(); body.put("isBulkExtract", true); body.put("authorized_ed_orgs", Arrays.asList("ONE")); body.put("public_key", "KEY"); Entit... | @GET @Path("extract/{edOrgId}") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getEdOrgExtract(@Context HttpContext context, @Context HttpServletRequest request, @PathParam("edOrgId") String edOrgId) { logSecurityEvent("Received request to stream Edorg data"); if (edOrgId == null || edOrgId.isEmpty()) { logSecu... | BulkExtract { @GET @Path("extract/{edOrgId}") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getEdOrgExtract(@Context HttpContext context, @Context HttpServletRequest request, @PathParam("edOrgId") String edOrgId) { logSecurityEvent("Received request to stream Edorg data"); if (edOrgId == null || edOrgId.isEmpt... | BulkExtract { @GET @Path("extract/{edOrgId}") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getEdOrgExtract(@Context HttpContext context, @Context HttpServletRequest request, @PathParam("edOrgId") String edOrgId) { logSecurityEvent("Received request to stream Edorg data"); if (edOrgId == null || edOrgId.isEmpt... | BulkExtract { @GET @Path("extract/{edOrgId}") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getEdOrgExtract(@Context HttpContext context, @Context HttpServletRequest request, @PathParam("edOrgId") String edOrgId) { logSecurityEvent("Received request to stream Edorg data"); if (edOrgId == null || edOrgId.isEmpt... | BulkExtract { @GET @Path("extract/{edOrgId}") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getEdOrgExtract(@Context HttpContext context, @Context HttpServletRequest request, @PathParam("edOrgId") String edOrgId) { logSecurityEvent("Received request to stream Edorg data"); if (edOrgId == null || edOrgId.isEmpt... |
@Test(expected = AccessDeniedException.class) public void testAppIsNotAuthorizedForDeltaLea() throws Exception { injector.setEducatorContext(); Map<String, Object> body = new HashMap<String, Object>(); body.put("isBulkExtract", true); body.put("authorized_ed_orgs", Arrays.asList("ONE")); body.put("public_key", "KEY"); ... | @GET @Path("extract/{edOrgId}/delta/{date}") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getDelta(@Context HttpServletRequest request, @Context HttpContext context, @PathParam("edOrgId") String edOrgId, @PathParam("date") String date) { logSecurityEvent("Received request to stream Edorg delta bulk extract da... | BulkExtract { @GET @Path("extract/{edOrgId}/delta/{date}") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getDelta(@Context HttpServletRequest request, @Context HttpContext context, @PathParam("edOrgId") String edOrgId, @PathParam("date") String date) { logSecurityEvent("Received request to stream Edorg delta b... | BulkExtract { @GET @Path("extract/{edOrgId}/delta/{date}") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getDelta(@Context HttpServletRequest request, @Context HttpContext context, @PathParam("edOrgId") String edOrgId, @PathParam("date") String date) { logSecurityEvent("Received request to stream Edorg delta b... | BulkExtract { @GET @Path("extract/{edOrgId}/delta/{date}") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getDelta(@Context HttpServletRequest request, @Context HttpContext context, @PathParam("edOrgId") String edOrgId, @PathParam("date") String date) { logSecurityEvent("Received request to stream Edorg delta b... | BulkExtract { @GET @Path("extract/{edOrgId}/delta/{date}") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getDelta(@Context HttpServletRequest request, @Context HttpContext context, @PathParam("edOrgId") String edOrgId, @PathParam("date") String date) { logSecurityEvent("Received request to stream Edorg delta b... |
@Test(expected = AccessDeniedException.class) public void testAppAuthIsEmpty() throws Exception { injector.setEducatorContext(); Map<String, Object> body = new HashMap<String, Object>(); body.put("isBulkExtract", true); body.put("authorized_ed_orgs", Arrays.asList("ONE")); body.put("public_key", "KEY"); Entity mockEnti... | @GET @Path("extract/{edOrgId}") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getEdOrgExtract(@Context HttpContext context, @Context HttpServletRequest request, @PathParam("edOrgId") String edOrgId) { logSecurityEvent("Received request to stream Edorg data"); if (edOrgId == null || edOrgId.isEmpty()) { logSecu... | BulkExtract { @GET @Path("extract/{edOrgId}") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getEdOrgExtract(@Context HttpContext context, @Context HttpServletRequest request, @PathParam("edOrgId") String edOrgId) { logSecurityEvent("Received request to stream Edorg data"); if (edOrgId == null || edOrgId.isEmpt... | BulkExtract { @GET @Path("extract/{edOrgId}") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getEdOrgExtract(@Context HttpContext context, @Context HttpServletRequest request, @PathParam("edOrgId") String edOrgId) { logSecurityEvent("Received request to stream Edorg data"); if (edOrgId == null || edOrgId.isEmpt... | BulkExtract { @GET @Path("extract/{edOrgId}") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getEdOrgExtract(@Context HttpContext context, @Context HttpServletRequest request, @PathParam("edOrgId") String edOrgId) { logSecurityEvent("Received request to stream Edorg data"); if (edOrgId == null || edOrgId.isEmpt... | BulkExtract { @GET @Path("extract/{edOrgId}") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getEdOrgExtract(@Context HttpContext context, @Context HttpServletRequest request, @PathParam("edOrgId") String edOrgId) { logSecurityEvent("Received request to stream Edorg data"); if (edOrgId == null || edOrgId.isEmpt... |
@Test(expected = AccessDeniedException.class) public void testAppHasNoAuthorizedEdorgs() throws Exception { injector.setEducatorContext(); Map<String, Object> body = new HashMap<String, Object>(); body.put("isBulkExtract", true); body.put("authorized_ed_orgs", Arrays.asList()); body.put("public_key", "KEY"); Entity moc... | @GET @Path("extract/{edOrgId}") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getEdOrgExtract(@Context HttpContext context, @Context HttpServletRequest request, @PathParam("edOrgId") String edOrgId) { logSecurityEvent("Received request to stream Edorg data"); if (edOrgId == null || edOrgId.isEmpty()) { logSecu... | BulkExtract { @GET @Path("extract/{edOrgId}") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getEdOrgExtract(@Context HttpContext context, @Context HttpServletRequest request, @PathParam("edOrgId") String edOrgId) { logSecurityEvent("Received request to stream Edorg data"); if (edOrgId == null || edOrgId.isEmpt... | BulkExtract { @GET @Path("extract/{edOrgId}") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getEdOrgExtract(@Context HttpContext context, @Context HttpServletRequest request, @PathParam("edOrgId") String edOrgId) { logSecurityEvent("Received request to stream Edorg data"); if (edOrgId == null || edOrgId.isEmpt... | BulkExtract { @GET @Path("extract/{edOrgId}") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getEdOrgExtract(@Context HttpContext context, @Context HttpServletRequest request, @PathParam("edOrgId") String edOrgId) { logSecurityEvent("Received request to stream Edorg data"); if (edOrgId == null || edOrgId.isEmpt... | BulkExtract { @GET @Path("extract/{edOrgId}") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getEdOrgExtract(@Context HttpContext context, @Context HttpServletRequest request, @PathParam("edOrgId") String edOrgId) { logSecurityEvent("Received request to stream Edorg data"); if (edOrgId == null || edOrgId.isEmpt... |
@Test(expected = AccessDeniedException.class) public void testUserNotInLEA() throws Exception { injector.setEducatorContext(); Mockito.when(mockValidator.validate(eq(EntityNames.EDUCATION_ORGANIZATION), Mockito.any(Set.class))) .thenReturn(Collections.EMPTY_SET); bulkExtract.getEdOrgExtract(CONTEXT, req, "BLEEP"); } | @GET @Path("extract/{edOrgId}") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getEdOrgExtract(@Context HttpContext context, @Context HttpServletRequest request, @PathParam("edOrgId") String edOrgId) { logSecurityEvent("Received request to stream Edorg data"); if (edOrgId == null || edOrgId.isEmpty()) { logSecu... | BulkExtract { @GET @Path("extract/{edOrgId}") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getEdOrgExtract(@Context HttpContext context, @Context HttpServletRequest request, @PathParam("edOrgId") String edOrgId) { logSecurityEvent("Received request to stream Edorg data"); if (edOrgId == null || edOrgId.isEmpt... | BulkExtract { @GET @Path("extract/{edOrgId}") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getEdOrgExtract(@Context HttpContext context, @Context HttpServletRequest request, @PathParam("edOrgId") String edOrgId) { logSecurityEvent("Received request to stream Edorg data"); if (edOrgId == null || edOrgId.isEmpt... | BulkExtract { @GET @Path("extract/{edOrgId}") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getEdOrgExtract(@Context HttpContext context, @Context HttpServletRequest request, @PathParam("edOrgId") String edOrgId) { logSecurityEvent("Received request to stream Edorg data"); if (edOrgId == null || edOrgId.isEmpt... | BulkExtract { @GET @Path("extract/{edOrgId}") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getEdOrgExtract(@Context HttpContext context, @Context HttpServletRequest request, @PathParam("edOrgId") String edOrgId) { logSecurityEvent("Received request to stream Edorg data"); if (edOrgId == null || edOrgId.isEmpt... |
@Test(expected = AccessDeniedException.class) public void testGetSLEAListFalseAppAuth() throws Exception { injector.setEducatorContext(); Entity mockEntity = mockApplicationEntity(); mockEntity.getBody().put("isBulkExtract", false); bulkExtract.getBulkExtractList(req, CONTEXT); } | @GET @Path("extract/list") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getBulkExtractList(@Context HttpServletRequest request, @Context HttpContext context) throws Exception { LOG.info("Received request for list of links for all edOrgs and public data for this user/app"); logSecurityEvent("Received request f... | BulkExtract { @GET @Path("extract/list") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getBulkExtractList(@Context HttpServletRequest request, @Context HttpContext context) throws Exception { LOG.info("Received request for list of links for all edOrgs and public data for this user/app"); logSecurityEvent("Rece... | BulkExtract { @GET @Path("extract/list") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getBulkExtractList(@Context HttpServletRequest request, @Context HttpContext context) throws Exception { LOG.info("Received request for list of links for all edOrgs and public data for this user/app"); logSecurityEvent("Rece... | BulkExtract { @GET @Path("extract/list") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getBulkExtractList(@Context HttpServletRequest request, @Context HttpContext context) throws Exception { LOG.info("Received request for list of links for all edOrgs and public data for this user/app"); logSecurityEvent("Rece... | BulkExtract { @GET @Path("extract/list") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getBulkExtractList(@Context HttpServletRequest request, @Context HttpContext context) throws Exception { LOG.info("Received request for list of links for all edOrgs and public data for this user/app"); logSecurityEvent("Rece... |
@Test(expected = AccessDeniedException.class) public void testGetSLEAListCheckUserAssociatedSLEAsFailure() throws Exception { injector.setEducatorContext(); mockApplicationEntity(); bulkExtract.getBulkExtractList(req, CONTEXT); } | @GET @Path("extract/list") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getBulkExtractList(@Context HttpServletRequest request, @Context HttpContext context) throws Exception { LOG.info("Received request for list of links for all edOrgs and public data for this user/app"); logSecurityEvent("Received request f... | BulkExtract { @GET @Path("extract/list") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getBulkExtractList(@Context HttpServletRequest request, @Context HttpContext context) throws Exception { LOG.info("Received request for list of links for all edOrgs and public data for this user/app"); logSecurityEvent("Rece... | BulkExtract { @GET @Path("extract/list") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getBulkExtractList(@Context HttpServletRequest request, @Context HttpContext context) throws Exception { LOG.info("Received request for list of links for all edOrgs and public data for this user/app"); logSecurityEvent("Rece... | BulkExtract { @GET @Path("extract/list") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getBulkExtractList(@Context HttpServletRequest request, @Context HttpContext context) throws Exception { LOG.info("Received request for list of links for all edOrgs and public data for this user/app"); logSecurityEvent("Rece... | BulkExtract { @GET @Path("extract/list") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getBulkExtractList(@Context HttpServletRequest request, @Context HttpContext context) throws Exception { LOG.info("Received request for list of links for all edOrgs and public data for this user/app"); logSecurityEvent("Rece... |
@Test public void testToBSON() { IdFieldEmittableKey key = new IdFieldEmittableKey("test.id.key.field"); key.setId(new Text("1234")); BSONObject bson = key.toBSON(); assertNotNull(bson); assertTrue(bson.containsField("test.id.key.field")); Object obj = bson.get("test.id.key.field"); assertNotNull(obj); assertTrue(obj i... | @Override public BSONObject toBSON() { BSONObject rval = new BasicBSONObject(); rval.put(getIdField().toString(), getId().toString()); return rval; } | IdFieldEmittableKey extends EmittableKey { @Override public BSONObject toBSON() { BSONObject rval = new BasicBSONObject(); rval.put(getIdField().toString(), getId().toString()); return rval; } } | IdFieldEmittableKey extends EmittableKey { @Override public BSONObject toBSON() { BSONObject rval = new BasicBSONObject(); rval.put(getIdField().toString(), getId().toString()); return rval; } IdFieldEmittableKey(); IdFieldEmittableKey(final String mongoFieldName); } | IdFieldEmittableKey extends EmittableKey { @Override public BSONObject toBSON() { BSONObject rval = new BasicBSONObject(); rval.put(getIdField().toString(), getId().toString()); return rval; } IdFieldEmittableKey(); IdFieldEmittableKey(final String mongoFieldName); Text getIdField(); Text getId(); void setId(final Tex... | IdFieldEmittableKey extends EmittableKey { @Override public BSONObject toBSON() { BSONObject rval = new BasicBSONObject(); rval.put(getIdField().toString(), getId().toString()); return rval; } IdFieldEmittableKey(); IdFieldEmittableKey(final String mongoFieldName); Text getIdField(); Text getId(); void setId(final Tex... |
@Test() public void testGetLEAListNoUserAssociatedLEAs() throws Exception { injector.setEducatorContext(); mockApplicationEntity(); Mockito.when(edOrgHelper.getUserEdorgs(Mockito.any(Entity.class))).thenReturn(Arrays.asList("123")); Response res = bulkExtract.getBulkExtractList(req, CONTEXT); assertEquals(404, res.getS... | @GET @Path("extract/list") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getBulkExtractList(@Context HttpServletRequest request, @Context HttpContext context) throws Exception { LOG.info("Received request for list of links for all edOrgs and public data for this user/app"); logSecurityEvent("Received request f... | BulkExtract { @GET @Path("extract/list") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getBulkExtractList(@Context HttpServletRequest request, @Context HttpContext context) throws Exception { LOG.info("Received request for list of links for all edOrgs and public data for this user/app"); logSecurityEvent("Rece... | BulkExtract { @GET @Path("extract/list") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getBulkExtractList(@Context HttpServletRequest request, @Context HttpContext context) throws Exception { LOG.info("Received request for list of links for all edOrgs and public data for this user/app"); logSecurityEvent("Rece... | BulkExtract { @GET @Path("extract/list") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getBulkExtractList(@Context HttpServletRequest request, @Context HttpContext context) throws Exception { LOG.info("Received request for list of links for all edOrgs and public data for this user/app"); logSecurityEvent("Rece... | BulkExtract { @GET @Path("extract/list") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getBulkExtractList(@Context HttpServletRequest request, @Context HttpContext context) throws Exception { LOG.info("Received request for list of links for all edOrgs and public data for this user/app"); logSecurityEvent("Rece... |
@Test public void testNullDeltaDate() { try { bulkExtract.getDelta(req, CONTEXT, "Midgar", null); fail("Should have thrown exception for null date"); } catch (IllegalArgumentException e) { assertTrue(!e.getMessage().isEmpty()); } } | @GET @Path("extract/{edOrgId}/delta/{date}") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getDelta(@Context HttpServletRequest request, @Context HttpContext context, @PathParam("edOrgId") String edOrgId, @PathParam("date") String date) { logSecurityEvent("Received request to stream Edorg delta bulk extract da... | BulkExtract { @GET @Path("extract/{edOrgId}/delta/{date}") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getDelta(@Context HttpServletRequest request, @Context HttpContext context, @PathParam("edOrgId") String edOrgId, @PathParam("date") String date) { logSecurityEvent("Received request to stream Edorg delta b... | BulkExtract { @GET @Path("extract/{edOrgId}/delta/{date}") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getDelta(@Context HttpServletRequest request, @Context HttpContext context, @PathParam("edOrgId") String edOrgId, @PathParam("date") String date) { logSecurityEvent("Received request to stream Edorg delta b... | BulkExtract { @GET @Path("extract/{edOrgId}/delta/{date}") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getDelta(@Context HttpServletRequest request, @Context HttpContext context, @PathParam("edOrgId") String edOrgId, @PathParam("date") String date) { logSecurityEvent("Received request to stream Edorg delta b... | BulkExtract { @GET @Path("extract/{edOrgId}/delta/{date}") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getDelta(@Context HttpServletRequest request, @Context HttpContext context, @PathParam("edOrgId") String edOrgId, @PathParam("date") String date) { logSecurityEvent("Received request to stream Edorg delta b... |
@Test public void testEdOrgFullExtract() throws IOException, ParseException { injector.setOauthAuthenticationWithEducationRole(); mockApplicationEntity(); Entity mockedEntity = mockBulkExtractEntity(null); Mockito.when(edOrgHelper.byId(eq("ONE"))).thenReturn(mockedEntity); Map<String, Object> authBody = new HashMap<Str... | @GET @Path("extract/{edOrgId}") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getEdOrgExtract(@Context HttpContext context, @Context HttpServletRequest request, @PathParam("edOrgId") String edOrgId) { logSecurityEvent("Received request to stream Edorg data"); if (edOrgId == null || edOrgId.isEmpty()) { logSecu... | BulkExtract { @GET @Path("extract/{edOrgId}") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getEdOrgExtract(@Context HttpContext context, @Context HttpServletRequest request, @PathParam("edOrgId") String edOrgId) { logSecurityEvent("Received request to stream Edorg data"); if (edOrgId == null || edOrgId.isEmpt... | BulkExtract { @GET @Path("extract/{edOrgId}") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getEdOrgExtract(@Context HttpContext context, @Context HttpServletRequest request, @PathParam("edOrgId") String edOrgId) { logSecurityEvent("Received request to stream Edorg data"); if (edOrgId == null || edOrgId.isEmpt... | BulkExtract { @GET @Path("extract/{edOrgId}") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getEdOrgExtract(@Context HttpContext context, @Context HttpServletRequest request, @PathParam("edOrgId") String edOrgId) { logSecurityEvent("Received request to stream Edorg data"); if (edOrgId == null || edOrgId.isEmpt... | BulkExtract { @GET @Path("extract/{edOrgId}") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getEdOrgExtract(@Context HttpContext context, @Context HttpServletRequest request, @PathParam("edOrgId") String edOrgId) { logSecurityEvent("Received request to stream Edorg data"); if (edOrgId == null || edOrgId.isEmpt... |
@Test public void testPublicExtract() throws IOException, ParseException { injector.setOauthAuthenticationWithEducationRole(); mockApplicationEntity(); Entity mockedEntity = mockBulkExtractEntity(null); Mockito.when(edOrgHelper.byId(eq("ONE"))).thenReturn(mockedEntity); Response res = bulkExtract.getPublicExtract(CONTE... | @GET @Path("extract/public") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getPublicExtract(@Context HttpContext context, @Context HttpServletRequest request) { logSecurityEvent("Received request to stream public data"); validateRequestCertificate(request); return getPublicExtractResponse(context.getRequest(),... | BulkExtract { @GET @Path("extract/public") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getPublicExtract(@Context HttpContext context, @Context HttpServletRequest request) { logSecurityEvent("Received request to stream public data"); validateRequestCertificate(request); return getPublicExtractResponse(context... | BulkExtract { @GET @Path("extract/public") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getPublicExtract(@Context HttpContext context, @Context HttpServletRequest request) { logSecurityEvent("Received request to stream public data"); validateRequestCertificate(request); return getPublicExtractResponse(context... | BulkExtract { @GET @Path("extract/public") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getPublicExtract(@Context HttpContext context, @Context HttpServletRequest request) { logSecurityEvent("Received request to stream public data"); validateRequestCertificate(request); return getPublicExtractResponse(context... | BulkExtract { @GET @Path("extract/public") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getPublicExtract(@Context HttpContext context, @Context HttpServletRequest request) { logSecurityEvent("Received request to stream public data"); validateRequestCertificate(request); return getPublicExtractResponse(context... |
@Test public void testGetApiVersionSolo() { String version = "foo"; String uriPath = version + "/bar"; UriInfo uriInfo = mock(UriInfo.class); when(uriInfo.getPath()).thenReturn(uriPath); assertTrue(ResourceUtil.getApiVersion(uriInfo).equals(version)); } | public static String getApiVersion(final UriInfo uriInfo) { if (uriInfo != null) { String uriPath = uriInfo.getPath(); if (uriPath != null) { int indexOfSlash = uriPath.indexOf("/"); if (indexOfSlash >= 0) { String version = uriPath.substring(0, indexOfSlash); return version; } else { return uriPath; } } } return null;... | ResourceUtil { public static String getApiVersion(final UriInfo uriInfo) { if (uriInfo != null) { String uriPath = uriInfo.getPath(); if (uriPath != null) { int indexOfSlash = uriPath.indexOf("/"); if (indexOfSlash >= 0) { String version = uriPath.substring(0, indexOfSlash); return version; } else { return uriPath; } }... | ResourceUtil { public static String getApiVersion(final UriInfo uriInfo) { if (uriInfo != null) { String uriPath = uriInfo.getPath(); if (uriPath != null) { int indexOfSlash = uriPath.indexOf("/"); if (indexOfSlash >= 0) { String version = uriPath.substring(0, indexOfSlash); return version; } else { return uriPath; } }... | ResourceUtil { public static String getApiVersion(final UriInfo uriInfo) { if (uriInfo != null) { String uriPath = uriInfo.getPath(); if (uriPath != null) { int indexOfSlash = uriPath.indexOf("/"); if (indexOfSlash >= 0) { String version = uriPath.substring(0, indexOfSlash); return version; } else { return uriPath; } }... | ResourceUtil { public static String getApiVersion(final UriInfo uriInfo) { if (uriInfo != null) { String uriPath = uriInfo.getPath(); if (uriPath != null) { int indexOfSlash = uriPath.indexOf("/"); if (indexOfSlash >= 0) { String version = uriPath.substring(0, indexOfSlash); return version; } else { return uriPath; } }... |
@Test public void testGetApiVersionNothingElse() { String version = "foo"; UriInfo uriInfo = mock(UriInfo.class); when(uriInfo.getPath()).thenReturn(version); assertTrue(ResourceUtil.getApiVersion(uriInfo).equals(version)); } | public static String getApiVersion(final UriInfo uriInfo) { if (uriInfo != null) { String uriPath = uriInfo.getPath(); if (uriPath != null) { int indexOfSlash = uriPath.indexOf("/"); if (indexOfSlash >= 0) { String version = uriPath.substring(0, indexOfSlash); return version; } else { return uriPath; } } } return null;... | ResourceUtil { public static String getApiVersion(final UriInfo uriInfo) { if (uriInfo != null) { String uriPath = uriInfo.getPath(); if (uriPath != null) { int indexOfSlash = uriPath.indexOf("/"); if (indexOfSlash >= 0) { String version = uriPath.substring(0, indexOfSlash); return version; } else { return uriPath; } }... | ResourceUtil { public static String getApiVersion(final UriInfo uriInfo) { if (uriInfo != null) { String uriPath = uriInfo.getPath(); if (uriPath != null) { int indexOfSlash = uriPath.indexOf("/"); if (indexOfSlash >= 0) { String version = uriPath.substring(0, indexOfSlash); return version; } else { return uriPath; } }... | ResourceUtil { public static String getApiVersion(final UriInfo uriInfo) { if (uriInfo != null) { String uriPath = uriInfo.getPath(); if (uriPath != null) { int indexOfSlash = uriPath.indexOf("/"); if (indexOfSlash >= 0) { String version = uriPath.substring(0, indexOfSlash); return version; } else { return uriPath; } }... | ResourceUtil { public static String getApiVersion(final UriInfo uriInfo) { if (uriInfo != null) { String uriPath = uriInfo.getPath(); if (uriPath != null) { int indexOfSlash = uriPath.indexOf("/"); if (indexOfSlash >= 0) { String version = uriPath.substring(0, indexOfSlash); return version; } else { return uriPath; } }... |
@Test public void testGetApiVersionLinked() { String version = "bar"; String uriPath = version + "/foo"; UriInfo uriInfo = mock(UriInfo.class); when(uriInfo.getPath()).thenReturn(uriPath); when(uriInfo.getBaseUriBuilder()).thenReturn(this.createUriBuilder()); EntityDefinition defn = mock(EntityDefinition.class); String... | public static EmbeddedLink getSelfLinkForEntity(final UriInfo uriInfo, final String entityId, final EntityDefinition defn) { return new EmbeddedLink(ResourceConstants.SELF, getURI(uriInfo, getApiVersion(uriInfo), PathConstants.TEMP_MAP.get(defn.getResourceName()), entityId).toString()); } | ResourceUtil { public static EmbeddedLink getSelfLinkForEntity(final UriInfo uriInfo, final String entityId, final EntityDefinition defn) { return new EmbeddedLink(ResourceConstants.SELF, getURI(uriInfo, getApiVersion(uriInfo), PathConstants.TEMP_MAP.get(defn.getResourceName()), entityId).toString()); } } | ResourceUtil { public static EmbeddedLink getSelfLinkForEntity(final UriInfo uriInfo, final String entityId, final EntityDefinition defn) { return new EmbeddedLink(ResourceConstants.SELF, getURI(uriInfo, getApiVersion(uriInfo), PathConstants.TEMP_MAP.get(defn.getResourceName()), entityId).toString()); } } | ResourceUtil { public static EmbeddedLink getSelfLinkForEntity(final UriInfo uriInfo, final String entityId, final EntityDefinition defn) { return new EmbeddedLink(ResourceConstants.SELF, getURI(uriInfo, getApiVersion(uriInfo), PathConstants.TEMP_MAP.get(defn.getResourceName()), entityId).toString()); } static String ... | ResourceUtil { public static EmbeddedLink getSelfLinkForEntity(final UriInfo uriInfo, final String entityId, final EntityDefinition defn) { return new EmbeddedLink(ResourceConstants.SELF, getURI(uriInfo, getApiVersion(uriInfo), PathConstants.TEMP_MAP.get(defn.getResourceName()), entityId).toString()); } static String ... |
@Test public void shouldVerifyMissingFieldReturnsFalse() { EntityBody entity = new EntityBody(); NeutralQuery query = new NeutralQuery(); query.addCriteria(new NeutralCriteria("foo", NeutralCriteria.CRITERIA_EXISTS, true)); boolean result = eval.entitySatisfiesDateQuery(entity, query); Assert.assertEquals("Should match... | public boolean entitySatisfiesDateQuery(EntityBody entity, NeutralQuery query) { for (NeutralCriteria andCriteria : query.getCriteria()) { String fieldName = andCriteria.getKey(); String operator = andCriteria.getOperator(); if (NeutralCriteria.CRITERIA_EXISTS.equals(operator)) { boolean shouldExist = (Boolean) andCrit... | InProcessDateQueryEvaluator { public boolean entitySatisfiesDateQuery(EntityBody entity, NeutralQuery query) { for (NeutralCriteria andCriteria : query.getCriteria()) { String fieldName = andCriteria.getKey(); String operator = andCriteria.getOperator(); if (NeutralCriteria.CRITERIA_EXISTS.equals(operator)) { boolean s... | InProcessDateQueryEvaluator { public boolean entitySatisfiesDateQuery(EntityBody entity, NeutralQuery query) { for (NeutralCriteria andCriteria : query.getCriteria()) { String fieldName = andCriteria.getKey(); String operator = andCriteria.getOperator(); if (NeutralCriteria.CRITERIA_EXISTS.equals(operator)) { boolean s... | InProcessDateQueryEvaluator { public boolean entitySatisfiesDateQuery(EntityBody entity, NeutralQuery query) { for (NeutralCriteria andCriteria : query.getCriteria()) { String fieldName = andCriteria.getKey(); String operator = andCriteria.getOperator(); if (NeutralCriteria.CRITERIA_EXISTS.equals(operator)) { boolean s... | InProcessDateQueryEvaluator { public boolean entitySatisfiesDateQuery(EntityBody entity, NeutralQuery query) { for (NeutralCriteria andCriteria : query.getCriteria()) { String fieldName = andCriteria.getKey(); String operator = andCriteria.getOperator(); if (NeutralCriteria.CRITERIA_EXISTS.equals(operator)) { boolean s... |
@Test public void shouldVerifyOrQueryReturnsFalse(){ EntityBody entity = new EntityBody(); entity.put("date", "2005"); NeutralQuery query = new NeutralQuery(); query.addOrQuery(createQuery(new NeutralCriteria("date",NeutralCriteria.CRITERIA_GT,"2007"))); boolean result = eval.entitySatisfiesDateQuery(entity, query); As... | public boolean entitySatisfiesDateQuery(EntityBody entity, NeutralQuery query) { for (NeutralCriteria andCriteria : query.getCriteria()) { String fieldName = andCriteria.getKey(); String operator = andCriteria.getOperator(); if (NeutralCriteria.CRITERIA_EXISTS.equals(operator)) { boolean shouldExist = (Boolean) andCrit... | InProcessDateQueryEvaluator { public boolean entitySatisfiesDateQuery(EntityBody entity, NeutralQuery query) { for (NeutralCriteria andCriteria : query.getCriteria()) { String fieldName = andCriteria.getKey(); String operator = andCriteria.getOperator(); if (NeutralCriteria.CRITERIA_EXISTS.equals(operator)) { boolean s... | InProcessDateQueryEvaluator { public boolean entitySatisfiesDateQuery(EntityBody entity, NeutralQuery query) { for (NeutralCriteria andCriteria : query.getCriteria()) { String fieldName = andCriteria.getKey(); String operator = andCriteria.getOperator(); if (NeutralCriteria.CRITERIA_EXISTS.equals(operator)) { boolean s... | InProcessDateQueryEvaluator { public boolean entitySatisfiesDateQuery(EntityBody entity, NeutralQuery query) { for (NeutralCriteria andCriteria : query.getCriteria()) { String fieldName = andCriteria.getKey(); String operator = andCriteria.getOperator(); if (NeutralCriteria.CRITERIA_EXISTS.equals(operator)) { boolean s... | InProcessDateQueryEvaluator { public boolean entitySatisfiesDateQuery(EntityBody entity, NeutralQuery query) { for (NeutralCriteria andCriteria : query.getCriteria()) { String fieldName = andCriteria.getKey(); String operator = andCriteria.getOperator(); if (NeutralCriteria.CRITERIA_EXISTS.equals(operator)) { boolean s... |
@Test public void shouldVerifyOrQueryReturnsTrue(){ EntityBody entity = new EntityBody(); entity.put("date", "2005"); NeutralQuery query = new NeutralQuery(); query.addOrQuery(createQuery(new NeutralCriteria("date",NeutralCriteria.CRITERIA_GT,"2007"))); query.addOrQuery(createQuery(new NeutralCriteria("date",NeutralCri... | public boolean entitySatisfiesDateQuery(EntityBody entity, NeutralQuery query) { for (NeutralCriteria andCriteria : query.getCriteria()) { String fieldName = andCriteria.getKey(); String operator = andCriteria.getOperator(); if (NeutralCriteria.CRITERIA_EXISTS.equals(operator)) { boolean shouldExist = (Boolean) andCrit... | InProcessDateQueryEvaluator { public boolean entitySatisfiesDateQuery(EntityBody entity, NeutralQuery query) { for (NeutralCriteria andCriteria : query.getCriteria()) { String fieldName = andCriteria.getKey(); String operator = andCriteria.getOperator(); if (NeutralCriteria.CRITERIA_EXISTS.equals(operator)) { boolean s... | InProcessDateQueryEvaluator { public boolean entitySatisfiesDateQuery(EntityBody entity, NeutralQuery query) { for (NeutralCriteria andCriteria : query.getCriteria()) { String fieldName = andCriteria.getKey(); String operator = andCriteria.getOperator(); if (NeutralCriteria.CRITERIA_EXISTS.equals(operator)) { boolean s... | InProcessDateQueryEvaluator { public boolean entitySatisfiesDateQuery(EntityBody entity, NeutralQuery query) { for (NeutralCriteria andCriteria : query.getCriteria()) { String fieldName = andCriteria.getKey(); String operator = andCriteria.getOperator(); if (NeutralCriteria.CRITERIA_EXISTS.equals(operator)) { boolean s... | InProcessDateQueryEvaluator { public boolean entitySatisfiesDateQuery(EntityBody entity, NeutralQuery query) { for (NeutralCriteria andCriteria : query.getCriteria()) { String fieldName = andCriteria.getKey(); String operator = andCriteria.getOperator(); if (NeutralCriteria.CRITERIA_EXISTS.equals(operator)) { boolean s... |
@Test public void testGetIdField() { IdFieldEmittableKey key = new IdFieldEmittableKey("test.id.key.field"); assertEquals(key.getIdField().toString(), "test.id.key.field"); } | public Text getIdField() { return super.getFieldName(); } | IdFieldEmittableKey extends EmittableKey { public Text getIdField() { return super.getFieldName(); } } | IdFieldEmittableKey extends EmittableKey { public Text getIdField() { return super.getFieldName(); } IdFieldEmittableKey(); IdFieldEmittableKey(final String mongoFieldName); } | IdFieldEmittableKey extends EmittableKey { public Text getIdField() { return super.getFieldName(); } IdFieldEmittableKey(); IdFieldEmittableKey(final String mongoFieldName); Text getIdField(); Text getId(); void setId(final Text value); @Override void readFields(DataInput data); @Override void write(DataOutput data); ... | IdFieldEmittableKey extends EmittableKey { public Text getIdField() { return super.getFieldName(); } IdFieldEmittableKey(); IdFieldEmittableKey(final String mongoFieldName); Text getIdField(); Text getId(); void setId(final Text value); @Override void readFields(DataInput data); @Override void write(DataOutput data); ... |
@Test public void testSessionEmails() throws Exception { buildWithEmailType(Arrays.asList("Work")); Map<String, Object> response = (Map<String, Object>) resource.sessionCheck(); assertEquals("[email protected]", response.get("email")); buildWithEmailType(Arrays.asList("Organization")); response = (Map<String, Object>) reso... | @GET @Path("check") public Object sessionCheck() { final Map<String, Object> sessionDetails = new TreeMap<String, Object>(); if (isAuthenticated(SecurityContextHolder.getContext())) { sessionDetails.put("authenticated", true); SLIPrincipal principal = (SLIPrincipal) SecurityContextHolder.getContext().getAuthentication(... | SecuritySessionResource { @GET @Path("check") public Object sessionCheck() { final Map<String, Object> sessionDetails = new TreeMap<String, Object>(); if (isAuthenticated(SecurityContextHolder.getContext())) { sessionDetails.put("authenticated", true); SLIPrincipal principal = (SLIPrincipal) SecurityContextHolder.getCo... | SecuritySessionResource { @GET @Path("check") public Object sessionCheck() { final Map<String, Object> sessionDetails = new TreeMap<String, Object>(); if (isAuthenticated(SecurityContextHolder.getContext())) { sessionDetails.put("authenticated", true); SLIPrincipal principal = (SLIPrincipal) SecurityContextHolder.getCo... | SecuritySessionResource { @GET @Path("check") public Object sessionCheck() { final Map<String, Object> sessionDetails = new TreeMap<String, Object>(); if (isAuthenticated(SecurityContextHolder.getContext())) { sessionDetails.put("authenticated", true); SLIPrincipal principal = (SLIPrincipal) SecurityContextHolder.getCo... | SecuritySessionResource { @GET @Path("check") public Object sessionCheck() { final Map<String, Object> sessionDetails = new TreeMap<String, Object>(); if (isAuthenticated(SecurityContextHolder.getContext())) { sessionDetails.put("authenticated", true); SLIPrincipal principal = (SLIPrincipal) SecurityContextHolder.getCo... |
@Test public void testAddClientRole() throws Exception { try { resource.updateRealm("-1", null, null); assertFalse(false); } catch (IllegalArgumentException e) { assertTrue(true); } UriInfo uriInfo = ResourceTestUtil.buildMockUriInfo(""); Response res = resource.updateRealm("1234", mapping, uriInfo); Assert.assertEqual... | @PUT @Path("{realmId}") @Consumes("application/json") @RightsAllowed({ Right.CRUD_REALM }) public Response updateRealm(@PathParam("realmId") String realmId, EntityBody updatedRealm, @Context final UriInfo uriInfo) { if (updatedRealm == null) { throw new IllegalArgumentException("Updated Realm was null"); } EntityBody o... | RealmResource { @PUT @Path("{realmId}") @Consumes("application/json") @RightsAllowed({ Right.CRUD_REALM }) public Response updateRealm(@PathParam("realmId") String realmId, EntityBody updatedRealm, @Context final UriInfo uriInfo) { if (updatedRealm == null) { throw new IllegalArgumentException("Updated Realm was null")... | RealmResource { @PUT @Path("{realmId}") @Consumes("application/json") @RightsAllowed({ Right.CRUD_REALM }) public Response updateRealm(@PathParam("realmId") String realmId, EntityBody updatedRealm, @Context final UriInfo uriInfo) { if (updatedRealm == null) { throw new IllegalArgumentException("Updated Realm was null")... | RealmResource { @PUT @Path("{realmId}") @Consumes("application/json") @RightsAllowed({ Right.CRUD_REALM }) public Response updateRealm(@PathParam("realmId") String realmId, EntityBody updatedRealm, @Context final UriInfo uriInfo) { if (updatedRealm == null) { throw new IllegalArgumentException("Updated Realm was null")... | RealmResource { @PUT @Path("{realmId}") @Consumes("application/json") @RightsAllowed({ Right.CRUD_REALM }) public Response updateRealm(@PathParam("realmId") String realmId, EntityBody updatedRealm, @Context final UriInfo uriInfo) { if (updatedRealm == null) { throw new IllegalArgumentException("Updated Realm was null")... |
@Test public void testvalidateArtifactResolution() { Response res = resource.validateArtifactResolution(null, null); Assert.assertNull(res); res = resource.validateArtifactResolution("", ""); Assert.assertNull(res); res = resource.validateArtifactResolution("testEndpoint", "ccf4f3895f6e37896e7511ed1d991b1d96f04ac1"); A... | protected Response validateArtifactResolution(String artifactResolutionEndpoint, String sourceId) { if (artifactResolutionEndpoint == null && sourceId == null) { return null; } Map<String, String> res = new HashMap<String, String>(); if (artifactResolutionEndpoint != null && sourceId != null) { if ((artifactResolutionE... | RealmResource { protected Response validateArtifactResolution(String artifactResolutionEndpoint, String sourceId) { if (artifactResolutionEndpoint == null && sourceId == null) { return null; } Map<String, String> res = new HashMap<String, String>(); if (artifactResolutionEndpoint != null && sourceId != null) { if ((art... | RealmResource { protected Response validateArtifactResolution(String artifactResolutionEndpoint, String sourceId) { if (artifactResolutionEndpoint == null && sourceId == null) { return null; } Map<String, String> res = new HashMap<String, String>(); if (artifactResolutionEndpoint != null && sourceId != null) { if ((art... | RealmResource { protected Response validateArtifactResolution(String artifactResolutionEndpoint, String sourceId) { if (artifactResolutionEndpoint == null && sourceId == null) { return null; } Map<String, String> res = new HashMap<String, String>(); if (artifactResolutionEndpoint != null && sourceId != null) { if ((art... | RealmResource { protected Response validateArtifactResolution(String artifactResolutionEndpoint, String sourceId) { if (artifactResolutionEndpoint == null && sourceId == null) { return null; } Map<String, String> res = new HashMap<String, String>(); if (artifactResolutionEndpoint != null && sourceId != null) { if ((art... |
@Test public void testGetMappingsFound() throws Exception { Response res = resource.readRealm("1234"); Assert.assertEquals(Response.Status.OK.getStatusCode(), res.getStatus()); Assert.assertNotNull(res.getEntity()); } | @GET @Path("{realmId}") @RightsAllowed({ Right.ADMIN_ACCESS }) public Response readRealm(@PathParam("realmId") String realmId) { EntityBody result = service.get(realmId); return Response.ok(result).build(); } | RealmResource { @GET @Path("{realmId}") @RightsAllowed({ Right.ADMIN_ACCESS }) public Response readRealm(@PathParam("realmId") String realmId) { EntityBody result = service.get(realmId); return Response.ok(result).build(); } } | RealmResource { @GET @Path("{realmId}") @RightsAllowed({ Right.ADMIN_ACCESS }) public Response readRealm(@PathParam("realmId") String realmId) { EntityBody result = service.get(realmId); return Response.ok(result).build(); } } | RealmResource { @GET @Path("{realmId}") @RightsAllowed({ Right.ADMIN_ACCESS }) public Response readRealm(@PathParam("realmId") String realmId) { EntityBody result = service.get(realmId); return Response.ok(result).build(); } @PostConstruct void init(); void setService(EntityService service); @PUT @Path("{realmId}") @C... | RealmResource { @GET @Path("{realmId}") @RightsAllowed({ Right.ADMIN_ACCESS }) public Response readRealm(@PathParam("realmId") String realmId) { EntityBody result = service.get(realmId); return Response.ok(result).build(); } @PostConstruct void init(); void setService(EntityService service); @PUT @Path("{realmId}") @C... |
@Test public void testGetMappingsNotFound() throws Exception { Response res = resource.readRealm("-1"); Assert.assertEquals(Response.Status.OK.getStatusCode(), res.getStatus()); Assert.assertNull(res.getEntity()); } | @GET @Path("{realmId}") @RightsAllowed({ Right.ADMIN_ACCESS }) public Response readRealm(@PathParam("realmId") String realmId) { EntityBody result = service.get(realmId); return Response.ok(result).build(); } | RealmResource { @GET @Path("{realmId}") @RightsAllowed({ Right.ADMIN_ACCESS }) public Response readRealm(@PathParam("realmId") String realmId) { EntityBody result = service.get(realmId); return Response.ok(result).build(); } } | RealmResource { @GET @Path("{realmId}") @RightsAllowed({ Right.ADMIN_ACCESS }) public Response readRealm(@PathParam("realmId") String realmId) { EntityBody result = service.get(realmId); return Response.ok(result).build(); } } | RealmResource { @GET @Path("{realmId}") @RightsAllowed({ Right.ADMIN_ACCESS }) public Response readRealm(@PathParam("realmId") String realmId) { EntityBody result = service.get(realmId); return Response.ok(result).build(); } @PostConstruct void init(); void setService(EntityService service); @PUT @Path("{realmId}") @C... | RealmResource { @GET @Path("{realmId}") @RightsAllowed({ Right.ADMIN_ACCESS }) public Response readRealm(@PathParam("realmId") String realmId) { EntityBody result = service.get(realmId); return Response.ok(result).build(); } @PostConstruct void init(); void setService(EntityService service); @PUT @Path("{realmId}") @C... |
@Test public void testUpdateOtherEdOrgRealm() { EntityBody temp = new EntityBody(); temp.put("foo", "foo"); UriInfo uriInfo = null; Response res = resource.updateRealm("other-realm", temp, uriInfo); Assert.assertEquals(403, res.getStatus()); } | @PUT @Path("{realmId}") @Consumes("application/json") @RightsAllowed({ Right.CRUD_REALM }) public Response updateRealm(@PathParam("realmId") String realmId, EntityBody updatedRealm, @Context final UriInfo uriInfo) { if (updatedRealm == null) { throw new IllegalArgumentException("Updated Realm was null"); } EntityBody o... | RealmResource { @PUT @Path("{realmId}") @Consumes("application/json") @RightsAllowed({ Right.CRUD_REALM }) public Response updateRealm(@PathParam("realmId") String realmId, EntityBody updatedRealm, @Context final UriInfo uriInfo) { if (updatedRealm == null) { throw new IllegalArgumentException("Updated Realm was null")... | RealmResource { @PUT @Path("{realmId}") @Consumes("application/json") @RightsAllowed({ Right.CRUD_REALM }) public Response updateRealm(@PathParam("realmId") String realmId, EntityBody updatedRealm, @Context final UriInfo uriInfo) { if (updatedRealm == null) { throw new IllegalArgumentException("Updated Realm was null")... | RealmResource { @PUT @Path("{realmId}") @Consumes("application/json") @RightsAllowed({ Right.CRUD_REALM }) public Response updateRealm(@PathParam("realmId") String realmId, EntityBody updatedRealm, @Context final UriInfo uriInfo) { if (updatedRealm == null) { throw new IllegalArgumentException("Updated Realm was null")... | RealmResource { @PUT @Path("{realmId}") @Consumes("application/json") @RightsAllowed({ Right.CRUD_REALM }) public Response updateRealm(@PathParam("realmId") String realmId, EntityBody updatedRealm, @Context final UriInfo uriInfo) { if (updatedRealm == null) { throw new IllegalArgumentException("Updated Realm was null")... |
@SuppressWarnings("unchecked") @Test public void getMetadataTest() { Response response = resource.getMetadata(); Assert.assertNotNull(response); Assert.assertEquals(Status.OK.getStatusCode(), response.getStatus()); Assert.assertNotNull(response.getEntity()); Exception exception = null; try { DocumentBuilderFactory dbf ... | @GET @Path("metadata") @Produces({ "text/xml" }) public Response getMetadata() { if (!metadata.isEmpty()) { return Response.ok(metadata).build(); } return Response.status(Response.Status.NOT_FOUND).build(); } | SamlFederationResource { @GET @Path("metadata") @Produces({ "text/xml" }) public Response getMetadata() { if (!metadata.isEmpty()) { return Response.ok(metadata).build(); } return Response.status(Response.Status.NOT_FOUND).build(); } } | SamlFederationResource { @GET @Path("metadata") @Produces({ "text/xml" }) public Response getMetadata() { if (!metadata.isEmpty()) { return Response.ok(metadata).build(); } return Response.status(Response.Status.NOT_FOUND).build(); } } | SamlFederationResource { @GET @Path("metadata") @Produces({ "text/xml" }) public Response getMetadata() { if (!metadata.isEmpty()) { return Response.ok(metadata).build(); } return Response.status(Response.Status.NOT_FOUND).build(); } @GET @Path("metadata") @Produces({ "text/xml" }) Response getMetadata(); @POST @Path(... | SamlFederationResource { @GET @Path("metadata") @Produces({ "text/xml" }) public Response getMetadata() { if (!metadata.isEmpty()) { return Response.ok(metadata).build(); } return Response.status(Response.Status.NOT_FOUND).build(); } @GET @Path("metadata") @Produces({ "text/xml" }) Response getMetadata(); @POST @Path(... |
@Test (expected= APIAccessDeniedException.class) public void processArtifactBindingInvalidRequest() { setRealm(false); HttpServletRequest request = Mockito.mock(HttpServletRequest.class); UriInfo uriInfo = Mockito.mock(UriInfo.class); Mockito.when(request.getParameter("RelayState")).thenReturn("My Realm"); resource.pro... | @GET @Path("sso/artifact") public Response processArtifactBinding(@Context HttpServletRequest request, @Context UriInfo uriInfo) { String artifact = request.getParameter("SAMLart"); String realmId = request.getParameter("RelayState"); if (artifact == null) { throw new APIAccessDeniedException("No artifact provided by t... | SamlFederationResource { @GET @Path("sso/artifact") public Response processArtifactBinding(@Context HttpServletRequest request, @Context UriInfo uriInfo) { String artifact = request.getParameter("SAMLart"); String realmId = request.getParameter("RelayState"); if (artifact == null) { throw new APIAccessDeniedException("... | SamlFederationResource { @GET @Path("sso/artifact") public Response processArtifactBinding(@Context HttpServletRequest request, @Context UriInfo uriInfo) { String artifact = request.getParameter("SAMLart"); String realmId = request.getParameter("RelayState"); if (artifact == null) { throw new APIAccessDeniedException("... | SamlFederationResource { @GET @Path("sso/artifact") public Response processArtifactBinding(@Context HttpServletRequest request, @Context UriInfo uriInfo) { String artifact = request.getParameter("SAMLart"); String realmId = request.getParameter("RelayState"); if (artifact == null) { throw new APIAccessDeniedException("... | SamlFederationResource { @GET @Path("sso/artifact") public Response processArtifactBinding(@Context HttpServletRequest request, @Context UriInfo uriInfo) { String artifact = request.getParameter("SAMLart"); String realmId = request.getParameter("RelayState"); if (artifact == null) { throw new APIAccessDeniedException("... |
@Test public void processArtifactBindingInvalidCondition() throws URISyntaxException { setRealm(false); HttpServletRequest request = Mockito.mock(HttpServletRequest.class); UriInfo uriInfo = Mockito.mock(UriInfo.class); URI uri = new URI(issuerString); Mockito.when(uriInfo.getRequestUri()).thenReturn(uri); Mockito.when... | @GET @Path("sso/artifact") public Response processArtifactBinding(@Context HttpServletRequest request, @Context UriInfo uriInfo) { String artifact = request.getParameter("SAMLart"); String realmId = request.getParameter("RelayState"); if (artifact == null) { throw new APIAccessDeniedException("No artifact provided by t... | SamlFederationResource { @GET @Path("sso/artifact") public Response processArtifactBinding(@Context HttpServletRequest request, @Context UriInfo uriInfo) { String artifact = request.getParameter("SAMLart"); String realmId = request.getParameter("RelayState"); if (artifact == null) { throw new APIAccessDeniedException("... | SamlFederationResource { @GET @Path("sso/artifact") public Response processArtifactBinding(@Context HttpServletRequest request, @Context UriInfo uriInfo) { String artifact = request.getParameter("SAMLart"); String realmId = request.getParameter("RelayState"); if (artifact == null) { throw new APIAccessDeniedException("... | SamlFederationResource { @GET @Path("sso/artifact") public Response processArtifactBinding(@Context HttpServletRequest request, @Context UriInfo uriInfo) { String artifact = request.getParameter("SAMLart"); String realmId = request.getParameter("RelayState"); if (artifact == null) { throw new APIAccessDeniedException("... | SamlFederationResource { @GET @Path("sso/artifact") public Response processArtifactBinding(@Context HttpServletRequest request, @Context UriInfo uriInfo) { String artifact = request.getParameter("SAMLart"); String realmId = request.getParameter("RelayState"); if (artifact == null) { throw new APIAccessDeniedException("... |
@Test public void testValidCreate() throws URISyntaxException { setRealms(REALM_ID); EntityBody body = getValidRoleDoc(); mockGetRealmId(); Mockito.when(service.create(body)).thenReturn("new-role-id"); Response res = resource.createCustomRole(body, getMockUriInfo()); Assert.assertEquals(201, res.getStatus()); } | @POST @RightsAllowed({Right.CRUD_ROLE }) public Response createCustomRole(EntityBody newCustomRole, @Context final UriInfo uriInfo) { String realmId = (String) newCustomRole.get("realmId"); Response res = validateRights(newCustomRole); if (res != null) { auditSecEvent(uriInfo, "Failed to create custom role rights valid... | CustomRoleResource { @POST @RightsAllowed({Right.CRUD_ROLE }) public Response createCustomRole(EntityBody newCustomRole, @Context final UriInfo uriInfo) { String realmId = (String) newCustomRole.get("realmId"); Response res = validateRights(newCustomRole); if (res != null) { auditSecEvent(uriInfo, "Failed to create cus... | CustomRoleResource { @POST @RightsAllowed({Right.CRUD_ROLE }) public Response createCustomRole(EntityBody newCustomRole, @Context final UriInfo uriInfo) { String realmId = (String) newCustomRole.get("realmId"); Response res = validateRights(newCustomRole); if (res != null) { auditSecEvent(uriInfo, "Failed to create cus... | CustomRoleResource { @POST @RightsAllowed({Right.CRUD_ROLE }) public Response createCustomRole(EntityBody newCustomRole, @Context final UriInfo uriInfo) { String realmId = (String) newCustomRole.get("realmId"); Response res = validateRights(newCustomRole); if (res != null) { auditSecEvent(uriInfo, "Failed to create cus... | CustomRoleResource { @POST @RightsAllowed({Right.CRUD_ROLE }) public Response createCustomRole(EntityBody newCustomRole, @Context final UriInfo uriInfo) { String realmId = (String) newCustomRole.get("realmId"); Response res = validateRights(newCustomRole); if (res != null) { auditSecEvent(uriInfo, "Failed to create cus... |
@Test public void testToString() { IdFieldEmittableKey key = new IdFieldEmittableKey("test.id.key.field"); key.setId(new Text("1234")); assertEquals(key.toString(), "IdFieldEmittableKey [test.id.key.field=1234]"); } | @Override public String toString() { return "IdFieldEmittableKey [" + getIdField() + "=" + getId().toString() + "]"; } | IdFieldEmittableKey extends EmittableKey { @Override public String toString() { return "IdFieldEmittableKey [" + getIdField() + "=" + getId().toString() + "]"; } } | IdFieldEmittableKey extends EmittableKey { @Override public String toString() { return "IdFieldEmittableKey [" + getIdField() + "=" + getId().toString() + "]"; } IdFieldEmittableKey(); IdFieldEmittableKey(final String mongoFieldName); } | IdFieldEmittableKey extends EmittableKey { @Override public String toString() { return "IdFieldEmittableKey [" + getIdField() + "=" + getId().toString() + "]"; } IdFieldEmittableKey(); IdFieldEmittableKey(final String mongoFieldName); Text getIdField(); Text getId(); void setId(final Text value); @Override void readFi... | IdFieldEmittableKey extends EmittableKey { @Override public String toString() { return "IdFieldEmittableKey [" + getIdField() + "=" + getId().toString() + "]"; } IdFieldEmittableKey(); IdFieldEmittableKey(final String mongoFieldName); Text getIdField(); Text getId(); void setId(final Text value); @Override void readFi... |
@Test public void testValidUpdate() { setRealms(REALM_ID); EntityBody body = getValidRoleDoc(); mockGetRealmId(); String id = "old-id"; Mockito.when(service.get(id)).thenReturn((EntityBody) body.clone()); body.put("roles", new ArrayList<Map<String, List<String>>>()); Mockito.when(service.update(id, body, false)).thenRe... | @PUT @Path("{id}") @RightsAllowed({Right.CRUD_ROLE }) public Response updateCustomRole(@PathParam("id") String id, EntityBody updated, @Context final UriInfo uriInfo) { Response res = validateRights(updated); if (res != null) { auditSecEvent(uriInfo, "Failed to create custom role rights validation failed.",null); retur... | CustomRoleResource { @PUT @Path("{id}") @RightsAllowed({Right.CRUD_ROLE }) public Response updateCustomRole(@PathParam("id") String id, EntityBody updated, @Context final UriInfo uriInfo) { Response res = validateRights(updated); if (res != null) { auditSecEvent(uriInfo, "Failed to create custom role rights validation ... | CustomRoleResource { @PUT @Path("{id}") @RightsAllowed({Right.CRUD_ROLE }) public Response updateCustomRole(@PathParam("id") String id, EntityBody updated, @Context final UriInfo uriInfo) { Response res = validateRights(updated); if (res != null) { auditSecEvent(uriInfo, "Failed to create custom role rights validation ... | CustomRoleResource { @PUT @Path("{id}") @RightsAllowed({Right.CRUD_ROLE }) public Response updateCustomRole(@PathParam("id") String id, EntityBody updated, @Context final UriInfo uriInfo) { Response res = validateRights(updated); if (res != null) { auditSecEvent(uriInfo, "Failed to create custom role rights validation ... | CustomRoleResource { @PUT @Path("{id}") @RightsAllowed({Right.CRUD_ROLE }) public Response updateCustomRole(@PathParam("id") String id, EntityBody updated, @Context final UriInfo uriInfo) { Response res = validateRights(updated); if (res != null) { auditSecEvent(uriInfo, "Failed to create custom role rights validation ... |
@Test public void testReadAll() { setRealms(REALM_ID); EntityBody body = getValidRoleDoc(); String id = "old-id"; Mockito.when(service.get(id)).thenReturn((EntityBody) body.clone()); mockGetRealmId(); Entity mockEntity = Mockito.mock(Entity.class); Mockito.when(mockEntity.getEntityId()).thenReturn("mock-id"); Mockito.w... | @GET @RightsAllowed({Right.CRUD_ROLE }) public Response readAll(@Context final UriInfo uriInfo, @DefaultValue("") @QueryParam("realmId") String realmId) { if (uriInfo.getQueryParameters() != null) { String defaultsOnly = uriInfo.getQueryParameters().getFirst("defaultsOnly"); if (defaultsOnly != null && Boolean.valueOf(... | CustomRoleResource { @GET @RightsAllowed({Right.CRUD_ROLE }) public Response readAll(@Context final UriInfo uriInfo, @DefaultValue("") @QueryParam("realmId") String realmId) { if (uriInfo.getQueryParameters() != null) { String defaultsOnly = uriInfo.getQueryParameters().getFirst("defaultsOnly"); if (defaultsOnly != nul... | CustomRoleResource { @GET @RightsAllowed({Right.CRUD_ROLE }) public Response readAll(@Context final UriInfo uriInfo, @DefaultValue("") @QueryParam("realmId") String realmId) { if (uriInfo.getQueryParameters() != null) { String defaultsOnly = uriInfo.getQueryParameters().getFirst("defaultsOnly"); if (defaultsOnly != nul... | CustomRoleResource { @GET @RightsAllowed({Right.CRUD_ROLE }) public Response readAll(@Context final UriInfo uriInfo, @DefaultValue("") @QueryParam("realmId") String realmId) { if (uriInfo.getQueryParameters() != null) { String defaultsOnly = uriInfo.getQueryParameters().getFirst("defaultsOnly"); if (defaultsOnly != nul... | CustomRoleResource { @GET @RightsAllowed({Right.CRUD_ROLE }) public Response readAll(@Context final UriInfo uriInfo, @DefaultValue("") @QueryParam("realmId") String realmId) { if (uriInfo.getQueryParameters() != null) { String defaultsOnly = uriInfo.getQueryParameters().getFirst("defaultsOnly"); if (defaultsOnly != nul... |
@Test public void testReadAllWithBadRealmIdParam() { setRealms(REALM_ID); EntityBody body = getValidRoleDoc(); String id = "old-id"; Mockito.when(service.get(id)).thenReturn((EntityBody) body.clone()); mockGetRealmId(); Entity mockEntity = Mockito.mock(Entity.class); Mockito.when(mockEntity.getEntityId()).thenReturn("m... | @GET @RightsAllowed({Right.CRUD_ROLE }) public Response readAll(@Context final UriInfo uriInfo, @DefaultValue("") @QueryParam("realmId") String realmId) { if (uriInfo.getQueryParameters() != null) { String defaultsOnly = uriInfo.getQueryParameters().getFirst("defaultsOnly"); if (defaultsOnly != null && Boolean.valueOf(... | CustomRoleResource { @GET @RightsAllowed({Right.CRUD_ROLE }) public Response readAll(@Context final UriInfo uriInfo, @DefaultValue("") @QueryParam("realmId") String realmId) { if (uriInfo.getQueryParameters() != null) { String defaultsOnly = uriInfo.getQueryParameters().getFirst("defaultsOnly"); if (defaultsOnly != nul... | CustomRoleResource { @GET @RightsAllowed({Right.CRUD_ROLE }) public Response readAll(@Context final UriInfo uriInfo, @DefaultValue("") @QueryParam("realmId") String realmId) { if (uriInfo.getQueryParameters() != null) { String defaultsOnly = uriInfo.getQueryParameters().getFirst("defaultsOnly"); if (defaultsOnly != nul... | CustomRoleResource { @GET @RightsAllowed({Right.CRUD_ROLE }) public Response readAll(@Context final UriInfo uriInfo, @DefaultValue("") @QueryParam("realmId") String realmId) { if (uriInfo.getQueryParameters() != null) { String defaultsOnly = uriInfo.getQueryParameters().getFirst("defaultsOnly"); if (defaultsOnly != nul... | CustomRoleResource { @GET @RightsAllowed({Right.CRUD_ROLE }) public Response readAll(@Context final UriInfo uriInfo, @DefaultValue("") @QueryParam("realmId") String realmId) { if (uriInfo.getQueryParameters() != null) { String defaultsOnly = uriInfo.getQueryParameters().getFirst("defaultsOnly"); if (defaultsOnly != nul... |
@Test public void testReadAllWithMultipleRealmsAndNoRealmIdParam() { setRealms(REALM_ID, "REALM2"); EntityBody body = getValidRoleDoc(); String id = "old-id"; Mockito.when(service.get(id)).thenReturn((EntityBody) body.clone()); mockGetRealmId(); Entity mockEntity = Mockito.mock(Entity.class); Mockito.when(mockEntity.ge... | @GET @RightsAllowed({Right.CRUD_ROLE }) public Response readAll(@Context final UriInfo uriInfo, @DefaultValue("") @QueryParam("realmId") String realmId) { if (uriInfo.getQueryParameters() != null) { String defaultsOnly = uriInfo.getQueryParameters().getFirst("defaultsOnly"); if (defaultsOnly != null && Boolean.valueOf(... | CustomRoleResource { @GET @RightsAllowed({Right.CRUD_ROLE }) public Response readAll(@Context final UriInfo uriInfo, @DefaultValue("") @QueryParam("realmId") String realmId) { if (uriInfo.getQueryParameters() != null) { String defaultsOnly = uriInfo.getQueryParameters().getFirst("defaultsOnly"); if (defaultsOnly != nul... | CustomRoleResource { @GET @RightsAllowed({Right.CRUD_ROLE }) public Response readAll(@Context final UriInfo uriInfo, @DefaultValue("") @QueryParam("realmId") String realmId) { if (uriInfo.getQueryParameters() != null) { String defaultsOnly = uriInfo.getQueryParameters().getFirst("defaultsOnly"); if (defaultsOnly != nul... | CustomRoleResource { @GET @RightsAllowed({Right.CRUD_ROLE }) public Response readAll(@Context final UriInfo uriInfo, @DefaultValue("") @QueryParam("realmId") String realmId) { if (uriInfo.getQueryParameters() != null) { String defaultsOnly = uriInfo.getQueryParameters().getFirst("defaultsOnly"); if (defaultsOnly != nul... | CustomRoleResource { @GET @RightsAllowed({Right.CRUD_ROLE }) public Response readAll(@Context final UriInfo uriInfo, @DefaultValue("") @QueryParam("realmId") String realmId) { if (uriInfo.getQueryParameters() != null) { String defaultsOnly = uriInfo.getQueryParameters().getFirst("defaultsOnly"); if (defaultsOnly != nul... |
@Test public void testReadAllWithMultipleRealmsAndValidRealmIdParam() { setRealms(REALM_ID, "REALM2"); EntityBody body = getValidRoleDoc(); String id = "old-id"; Mockito.when(service.get(id)).thenReturn((EntityBody) body.clone()); mockGetRealmId(); Entity mockEntity = Mockito.mock(Entity.class); Mockito.when(mockEntity... | @GET @RightsAllowed({Right.CRUD_ROLE }) public Response readAll(@Context final UriInfo uriInfo, @DefaultValue("") @QueryParam("realmId") String realmId) { if (uriInfo.getQueryParameters() != null) { String defaultsOnly = uriInfo.getQueryParameters().getFirst("defaultsOnly"); if (defaultsOnly != null && Boolean.valueOf(... | CustomRoleResource { @GET @RightsAllowed({Right.CRUD_ROLE }) public Response readAll(@Context final UriInfo uriInfo, @DefaultValue("") @QueryParam("realmId") String realmId) { if (uriInfo.getQueryParameters() != null) { String defaultsOnly = uriInfo.getQueryParameters().getFirst("defaultsOnly"); if (defaultsOnly != nul... | CustomRoleResource { @GET @RightsAllowed({Right.CRUD_ROLE }) public Response readAll(@Context final UriInfo uriInfo, @DefaultValue("") @QueryParam("realmId") String realmId) { if (uriInfo.getQueryParameters() != null) { String defaultsOnly = uriInfo.getQueryParameters().getFirst("defaultsOnly"); if (defaultsOnly != nul... | CustomRoleResource { @GET @RightsAllowed({Right.CRUD_ROLE }) public Response readAll(@Context final UriInfo uriInfo, @DefaultValue("") @QueryParam("realmId") String realmId) { if (uriInfo.getQueryParameters() != null) { String defaultsOnly = uriInfo.getQueryParameters().getFirst("defaultsOnly"); if (defaultsOnly != nul... | CustomRoleResource { @GET @RightsAllowed({Right.CRUD_ROLE }) public Response readAll(@Context final UriInfo uriInfo, @DefaultValue("") @QueryParam("realmId") String realmId) { if (uriInfo.getQueryParameters() != null) { String defaultsOnly = uriInfo.getQueryParameters().getFirst("defaultsOnly"); if (defaultsOnly != nul... |
@Test public void testReadAccessible() { setRealms(REALM_ID); EntityBody body = getValidRoleDoc(); String id = "old-id"; Mockito.when(service.get(id)).thenReturn((EntityBody) body.clone()); mockGetRealmId(); Response res = resource.read(id, uriInfo); Assert.assertEquals(200, res.getStatus()); Assert.assertEquals(body, ... | @GET @Path("{id}") @RightsAllowed({Right.CRUD_ROLE }) public Response read(@PathParam("id") String id, @Context final UriInfo uriInfo) { EntityBody customRole = service.get(id); String realmId = (String)customRole.get("realmId"); if (!realmHelper.getAssociatedRealmIds().contains(realmId)) { auditSecEvent(uriInfo, "Fail... | CustomRoleResource { @GET @Path("{id}") @RightsAllowed({Right.CRUD_ROLE }) public Response read(@PathParam("id") String id, @Context final UriInfo uriInfo) { EntityBody customRole = service.get(id); String realmId = (String)customRole.get("realmId"); if (!realmHelper.getAssociatedRealmIds().contains(realmId)) { auditSe... | CustomRoleResource { @GET @Path("{id}") @RightsAllowed({Right.CRUD_ROLE }) public Response read(@PathParam("id") String id, @Context final UriInfo uriInfo) { EntityBody customRole = service.get(id); String realmId = (String)customRole.get("realmId"); if (!realmHelper.getAssociatedRealmIds().contains(realmId)) { auditSe... | CustomRoleResource { @GET @Path("{id}") @RightsAllowed({Right.CRUD_ROLE }) public Response read(@PathParam("id") String id, @Context final UriInfo uriInfo) { EntityBody customRole = service.get(id); String realmId = (String)customRole.get("realmId"); if (!realmHelper.getAssociatedRealmIds().contains(realmId)) { auditSe... | CustomRoleResource { @GET @Path("{id}") @RightsAllowed({Right.CRUD_ROLE }) public Response read(@PathParam("id") String id, @Context final UriInfo uriInfo) { EntityBody customRole = service.get(id); String realmId = (String)customRole.get("realmId"); if (!realmHelper.getAssociatedRealmIds().contains(realmId)) { auditSe... |
@Test public void testReadInaccessible() { String inaccessibleId = "inaccessible-id"; EntityBody body = getValidRoleDoc(); body.put("realmId", "BAD-REALM"); Mockito.when(service.get(inaccessibleId)).thenReturn(body); Response res = resource.read(inaccessibleId, uriInfo); Assert.assertEquals(403, res.getStatus()); Asser... | @GET @Path("{id}") @RightsAllowed({Right.CRUD_ROLE }) public Response read(@PathParam("id") String id, @Context final UriInfo uriInfo) { EntityBody customRole = service.get(id); String realmId = (String)customRole.get("realmId"); if (!realmHelper.getAssociatedRealmIds().contains(realmId)) { auditSecEvent(uriInfo, "Fail... | CustomRoleResource { @GET @Path("{id}") @RightsAllowed({Right.CRUD_ROLE }) public Response read(@PathParam("id") String id, @Context final UriInfo uriInfo) { EntityBody customRole = service.get(id); String realmId = (String)customRole.get("realmId"); if (!realmHelper.getAssociatedRealmIds().contains(realmId)) { auditSe... | CustomRoleResource { @GET @Path("{id}") @RightsAllowed({Right.CRUD_ROLE }) public Response read(@PathParam("id") String id, @Context final UriInfo uriInfo) { EntityBody customRole = service.get(id); String realmId = (String)customRole.get("realmId"); if (!realmHelper.getAssociatedRealmIds().contains(realmId)) { auditSe... | CustomRoleResource { @GET @Path("{id}") @RightsAllowed({Right.CRUD_ROLE }) public Response read(@PathParam("id") String id, @Context final UriInfo uriInfo) { EntityBody customRole = service.get(id); String realmId = (String)customRole.get("realmId"); if (!realmHelper.getAssociatedRealmIds().contains(realmId)) { auditSe... | CustomRoleResource { @GET @Path("{id}") @RightsAllowed({Right.CRUD_ROLE }) public Response read(@PathParam("id") String id, @Context final UriInfo uriInfo) { EntityBody customRole = service.get(id); String realmId = (String)customRole.get("realmId"); if (!realmHelper.getAssociatedRealmIds().contains(realmId)) { auditSe... |
@Test public void testUpdateWithDuplicateRoles() { EntityBody body = getRoleDocWithDuplicateRole(); body.put("customRights", Arrays.asList(new String[] {"Something", "Else"})); mockGetRealmId(); String id = "old-id"; Mockito.when(service.get(id)).thenReturn((EntityBody) body.clone()); Mockito.when(service.update(id, bo... | @PUT @Path("{id}") @RightsAllowed({Right.CRUD_ROLE }) public Response updateCustomRole(@PathParam("id") String id, EntityBody updated, @Context final UriInfo uriInfo) { Response res = validateRights(updated); if (res != null) { auditSecEvent(uriInfo, "Failed to create custom role rights validation failed.",null); retur... | CustomRoleResource { @PUT @Path("{id}") @RightsAllowed({Right.CRUD_ROLE }) public Response updateCustomRole(@PathParam("id") String id, EntityBody updated, @Context final UriInfo uriInfo) { Response res = validateRights(updated); if (res != null) { auditSecEvent(uriInfo, "Failed to create custom role rights validation ... | CustomRoleResource { @PUT @Path("{id}") @RightsAllowed({Right.CRUD_ROLE }) public Response updateCustomRole(@PathParam("id") String id, EntityBody updated, @Context final UriInfo uriInfo) { Response res = validateRights(updated); if (res != null) { auditSecEvent(uriInfo, "Failed to create custom role rights validation ... | CustomRoleResource { @PUT @Path("{id}") @RightsAllowed({Right.CRUD_ROLE }) public Response updateCustomRole(@PathParam("id") String id, EntityBody updated, @Context final UriInfo uriInfo) { Response res = validateRights(updated); if (res != null) { auditSecEvent(uriInfo, "Failed to create custom role rights validation ... | CustomRoleResource { @PUT @Path("{id}") @RightsAllowed({Right.CRUD_ROLE }) public Response updateCustomRole(@PathParam("id") String id, EntityBody updated, @Context final UriInfo uriInfo) { Response res = validateRights(updated); if (res != null) { auditSecEvent(uriInfo, "Failed to create custom role rights validation ... |
@Test public void testUpdateWithInvalidRight() { EntityBody body = getRoleDocWithInvalidRight(); body.put("customRights", Arrays.asList(new String[] {"Something", "Else"})); mockGetRealmId(); String id = "old-id"; Mockito.when(service.get(id)).thenReturn((EntityBody) body.clone()); Mockito.when(service.update(id, body,... | @PUT @Path("{id}") @RightsAllowed({Right.CRUD_ROLE }) public Response updateCustomRole(@PathParam("id") String id, EntityBody updated, @Context final UriInfo uriInfo) { Response res = validateRights(updated); if (res != null) { auditSecEvent(uriInfo, "Failed to create custom role rights validation failed.",null); retur... | CustomRoleResource { @PUT @Path("{id}") @RightsAllowed({Right.CRUD_ROLE }) public Response updateCustomRole(@PathParam("id") String id, EntityBody updated, @Context final UriInfo uriInfo) { Response res = validateRights(updated); if (res != null) { auditSecEvent(uriInfo, "Failed to create custom role rights validation ... | CustomRoleResource { @PUT @Path("{id}") @RightsAllowed({Right.CRUD_ROLE }) public Response updateCustomRole(@PathParam("id") String id, EntityBody updated, @Context final UriInfo uriInfo) { Response res = validateRights(updated); if (res != null) { auditSecEvent(uriInfo, "Failed to create custom role rights validation ... | CustomRoleResource { @PUT @Path("{id}") @RightsAllowed({Right.CRUD_ROLE }) public Response updateCustomRole(@PathParam("id") String id, EntityBody updated, @Context final UriInfo uriInfo) { Response res = validateRights(updated); if (res != null) { auditSecEvent(uriInfo, "Failed to create custom role rights validation ... | CustomRoleResource { @PUT @Path("{id}") @RightsAllowed({Right.CRUD_ROLE }) public Response updateCustomRole(@PathParam("id") String id, EntityBody updated, @Context final UriInfo uriInfo) { Response res = validateRights(updated); if (res != null) { auditSecEvent(uriInfo, "Failed to create custom role rights validation ... |
@Test public void testUpdateWithInvalidRealmId() { EntityBody body = getRoleDocWithInvalidRealm(); body.put("customRights", Arrays.asList(new String[] {"Something", "Else"})); mockGetRealmId(); String id = "old-id"; Mockito.when(service.get(id)).thenReturn((EntityBody) body.clone()); Mockito.when(service.update(id, bod... | @PUT @Path("{id}") @RightsAllowed({Right.CRUD_ROLE }) public Response updateCustomRole(@PathParam("id") String id, EntityBody updated, @Context final UriInfo uriInfo) { Response res = validateRights(updated); if (res != null) { auditSecEvent(uriInfo, "Failed to create custom role rights validation failed.",null); retur... | CustomRoleResource { @PUT @Path("{id}") @RightsAllowed({Right.CRUD_ROLE }) public Response updateCustomRole(@PathParam("id") String id, EntityBody updated, @Context final UriInfo uriInfo) { Response res = validateRights(updated); if (res != null) { auditSecEvent(uriInfo, "Failed to create custom role rights validation ... | CustomRoleResource { @PUT @Path("{id}") @RightsAllowed({Right.CRUD_ROLE }) public Response updateCustomRole(@PathParam("id") String id, EntityBody updated, @Context final UriInfo uriInfo) { Response res = validateRights(updated); if (res != null) { auditSecEvent(uriInfo, "Failed to create custom role rights validation ... | CustomRoleResource { @PUT @Path("{id}") @RightsAllowed({Right.CRUD_ROLE }) public Response updateCustomRole(@PathParam("id") String id, EntityBody updated, @Context final UriInfo uriInfo) { Response res = validateRights(updated); if (res != null) { auditSecEvent(uriInfo, "Failed to create custom role rights validation ... | CustomRoleResource { @PUT @Path("{id}") @RightsAllowed({Right.CRUD_ROLE }) public Response updateCustomRole(@PathParam("id") String id, EntityBody updated, @Context final UriInfo uriInfo) { Response res = validateRights(updated); if (res != null) { auditSecEvent(uriInfo, "Failed to create custom role rights validation ... |
@Test public void testToBSON() { TenantAndIdEmittableKey key = new TenantAndIdEmittableKey("meta.data.tenantId", "test.id.key.field"); key.setTenantId(new Text("Midgar")); key.setId(new Text("1234")); BSONObject bson = key.toBSON(); assertNotNull(bson); assertTrue(bson.containsField("meta.data.tenantId")); Object obj =... | @Override public BSONObject toBSON() { BSONObject bson = new BasicBSONObject(); bson.put(getTenantIdField().toString(), getTenantId().toString()); bson.put(getIdField().toString(), getId().toString()); return bson; } | TenantAndIdEmittableKey extends EmittableKey { @Override public BSONObject toBSON() { BSONObject bson = new BasicBSONObject(); bson.put(getTenantIdField().toString(), getTenantId().toString()); bson.put(getIdField().toString(), getId().toString()); return bson; } } | TenantAndIdEmittableKey extends EmittableKey { @Override public BSONObject toBSON() { BSONObject bson = new BasicBSONObject(); bson.put(getTenantIdField().toString(), getTenantId().toString()); bson.put(getIdField().toString(), getId().toString()); return bson; } TenantAndIdEmittableKey(); TenantAndIdEmittableKey(fina... | TenantAndIdEmittableKey extends EmittableKey { @Override public BSONObject toBSON() { BSONObject bson = new BasicBSONObject(); bson.put(getTenantIdField().toString(), getTenantId().toString()); bson.put(getIdField().toString(), getId().toString()); return bson; } TenantAndIdEmittableKey(); TenantAndIdEmittableKey(fina... | TenantAndIdEmittableKey extends EmittableKey { @Override public BSONObject toBSON() { BSONObject bson = new BasicBSONObject(); bson.put(getTenantIdField().toString(), getTenantId().toString()); bson.put(getIdField().toString(), getId().toString()); return bson; } TenantAndIdEmittableKey(); TenantAndIdEmittableKey(fina... |
@Test public void testUpdateWithDuplicateRights() { EntityBody body = getRoleDocWithDuplicateRights(); body.put("customRights", Arrays.asList(new String[] {"Something", "Else"})); mockGetRealmId(); String id = "old-id"; Mockito.when(service.get(id)).thenReturn((EntityBody) body.clone()); Mockito.when(service.update(id,... | @PUT @Path("{id}") @RightsAllowed({Right.CRUD_ROLE }) public Response updateCustomRole(@PathParam("id") String id, EntityBody updated, @Context final UriInfo uriInfo) { Response res = validateRights(updated); if (res != null) { auditSecEvent(uriInfo, "Failed to create custom role rights validation failed.",null); retur... | CustomRoleResource { @PUT @Path("{id}") @RightsAllowed({Right.CRUD_ROLE }) public Response updateCustomRole(@PathParam("id") String id, EntityBody updated, @Context final UriInfo uriInfo) { Response res = validateRights(updated); if (res != null) { auditSecEvent(uriInfo, "Failed to create custom role rights validation ... | CustomRoleResource { @PUT @Path("{id}") @RightsAllowed({Right.CRUD_ROLE }) public Response updateCustomRole(@PathParam("id") String id, EntityBody updated, @Context final UriInfo uriInfo) { Response res = validateRights(updated); if (res != null) { auditSecEvent(uriInfo, "Failed to create custom role rights validation ... | CustomRoleResource { @PUT @Path("{id}") @RightsAllowed({Right.CRUD_ROLE }) public Response updateCustomRole(@PathParam("id") String id, EntityBody updated, @Context final UriInfo uriInfo) { Response res = validateRights(updated); if (res != null) { auditSecEvent(uriInfo, "Failed to create custom role rights validation ... | CustomRoleResource { @PUT @Path("{id}") @RightsAllowed({Right.CRUD_ROLE }) public Response updateCustomRole(@PathParam("id") String id, EntityBody updated, @Context final UriInfo uriInfo) { Response res = validateRights(updated); if (res != null) { auditSecEvent(uriInfo, "Failed to create custom role rights validation ... |
@Test public void testCreateWithDuplicateRoles() { EntityBody body = getRoleDocWithDuplicateRole(); mockGetRealmId(); Mockito.when(service.create(body)).thenReturn("new-role-id"); Response res = resource.createCustomRole(body, uriInfo); Assert.assertEquals(400, res.getStatus()); Assert.assertEquals(CustomRoleResource.E... | @POST @RightsAllowed({Right.CRUD_ROLE }) public Response createCustomRole(EntityBody newCustomRole, @Context final UriInfo uriInfo) { String realmId = (String) newCustomRole.get("realmId"); Response res = validateRights(newCustomRole); if (res != null) { auditSecEvent(uriInfo, "Failed to create custom role rights valid... | CustomRoleResource { @POST @RightsAllowed({Right.CRUD_ROLE }) public Response createCustomRole(EntityBody newCustomRole, @Context final UriInfo uriInfo) { String realmId = (String) newCustomRole.get("realmId"); Response res = validateRights(newCustomRole); if (res != null) { auditSecEvent(uriInfo, "Failed to create cus... | CustomRoleResource { @POST @RightsAllowed({Right.CRUD_ROLE }) public Response createCustomRole(EntityBody newCustomRole, @Context final UriInfo uriInfo) { String realmId = (String) newCustomRole.get("realmId"); Response res = validateRights(newCustomRole); if (res != null) { auditSecEvent(uriInfo, "Failed to create cus... | CustomRoleResource { @POST @RightsAllowed({Right.CRUD_ROLE }) public Response createCustomRole(EntityBody newCustomRole, @Context final UriInfo uriInfo) { String realmId = (String) newCustomRole.get("realmId"); Response res = validateRights(newCustomRole); if (res != null) { auditSecEvent(uriInfo, "Failed to create cus... | CustomRoleResource { @POST @RightsAllowed({Right.CRUD_ROLE }) public Response createCustomRole(EntityBody newCustomRole, @Context final UriInfo uriInfo) { String realmId = (String) newCustomRole.get("realmId"); Response res = validateRights(newCustomRole); if (res != null) { auditSecEvent(uriInfo, "Failed to create cus... |
@Test public void testCreateWithInvalidRight() { EntityBody body = getRoleDocWithInvalidRight(); mockGetRealmId(); Mockito.when(service.create(body)).thenReturn("new-role-id"); Response res = resource.createCustomRole(body, uriInfo); Assert.assertEquals(400, res.getStatus()); Assert.assertEquals(CustomRoleResource.ERRO... | @POST @RightsAllowed({Right.CRUD_ROLE }) public Response createCustomRole(EntityBody newCustomRole, @Context final UriInfo uriInfo) { String realmId = (String) newCustomRole.get("realmId"); Response res = validateRights(newCustomRole); if (res != null) { auditSecEvent(uriInfo, "Failed to create custom role rights valid... | CustomRoleResource { @POST @RightsAllowed({Right.CRUD_ROLE }) public Response createCustomRole(EntityBody newCustomRole, @Context final UriInfo uriInfo) { String realmId = (String) newCustomRole.get("realmId"); Response res = validateRights(newCustomRole); if (res != null) { auditSecEvent(uriInfo, "Failed to create cus... | CustomRoleResource { @POST @RightsAllowed({Right.CRUD_ROLE }) public Response createCustomRole(EntityBody newCustomRole, @Context final UriInfo uriInfo) { String realmId = (String) newCustomRole.get("realmId"); Response res = validateRights(newCustomRole); if (res != null) { auditSecEvent(uriInfo, "Failed to create cus... | CustomRoleResource { @POST @RightsAllowed({Right.CRUD_ROLE }) public Response createCustomRole(EntityBody newCustomRole, @Context final UriInfo uriInfo) { String realmId = (String) newCustomRole.get("realmId"); Response res = validateRights(newCustomRole); if (res != null) { auditSecEvent(uriInfo, "Failed to create cus... | CustomRoleResource { @POST @RightsAllowed({Right.CRUD_ROLE }) public Response createCustomRole(EntityBody newCustomRole, @Context final UriInfo uriInfo) { String realmId = (String) newCustomRole.get("realmId"); Response res = validateRights(newCustomRole); if (res != null) { auditSecEvent(uriInfo, "Failed to create cus... |
@Test public void testCreateWithInvalidRealmId() { EntityBody body = getRoleDocWithInvalidRealm(); mockGetRealmId(); Mockito.when(service.create(body)).thenReturn("new-role-id"); Response res = resource.createCustomRole(body, uriInfo); Assert.assertEquals(403, res.getStatus()); Assert.assertEquals(CustomRoleResource.ER... | @POST @RightsAllowed({Right.CRUD_ROLE }) public Response createCustomRole(EntityBody newCustomRole, @Context final UriInfo uriInfo) { String realmId = (String) newCustomRole.get("realmId"); Response res = validateRights(newCustomRole); if (res != null) { auditSecEvent(uriInfo, "Failed to create custom role rights valid... | CustomRoleResource { @POST @RightsAllowed({Right.CRUD_ROLE }) public Response createCustomRole(EntityBody newCustomRole, @Context final UriInfo uriInfo) { String realmId = (String) newCustomRole.get("realmId"); Response res = validateRights(newCustomRole); if (res != null) { auditSecEvent(uriInfo, "Failed to create cus... | CustomRoleResource { @POST @RightsAllowed({Right.CRUD_ROLE }) public Response createCustomRole(EntityBody newCustomRole, @Context final UriInfo uriInfo) { String realmId = (String) newCustomRole.get("realmId"); Response res = validateRights(newCustomRole); if (res != null) { auditSecEvent(uriInfo, "Failed to create cus... | CustomRoleResource { @POST @RightsAllowed({Right.CRUD_ROLE }) public Response createCustomRole(EntityBody newCustomRole, @Context final UriInfo uriInfo) { String realmId = (String) newCustomRole.get("realmId"); Response res = validateRights(newCustomRole); if (res != null) { auditSecEvent(uriInfo, "Failed to create cus... | CustomRoleResource { @POST @RightsAllowed({Right.CRUD_ROLE }) public Response createCustomRole(EntityBody newCustomRole, @Context final UriInfo uriInfo) { String realmId = (String) newCustomRole.get("realmId"); Response res = validateRights(newCustomRole); if (res != null) { auditSecEvent(uriInfo, "Failed to create cus... |
@Test public void testCreateWithDuplicateRights() { EntityBody body = getRoleDocWithDuplicateRights(); mockGetRealmId(); Mockito.when(service.create(body)).thenReturn("new-role-id"); Response res = resource.createCustomRole(body, uriInfo); Assert.assertEquals(400, res.getStatus()); Assert.assertEquals(CustomRoleResourc... | @POST @RightsAllowed({Right.CRUD_ROLE }) public Response createCustomRole(EntityBody newCustomRole, @Context final UriInfo uriInfo) { String realmId = (String) newCustomRole.get("realmId"); Response res = validateRights(newCustomRole); if (res != null) { auditSecEvent(uriInfo, "Failed to create custom role rights valid... | CustomRoleResource { @POST @RightsAllowed({Right.CRUD_ROLE }) public Response createCustomRole(EntityBody newCustomRole, @Context final UriInfo uriInfo) { String realmId = (String) newCustomRole.get("realmId"); Response res = validateRights(newCustomRole); if (res != null) { auditSecEvent(uriInfo, "Failed to create cus... | CustomRoleResource { @POST @RightsAllowed({Right.CRUD_ROLE }) public Response createCustomRole(EntityBody newCustomRole, @Context final UriInfo uriInfo) { String realmId = (String) newCustomRole.get("realmId"); Response res = validateRights(newCustomRole); if (res != null) { auditSecEvent(uriInfo, "Failed to create cus... | CustomRoleResource { @POST @RightsAllowed({Right.CRUD_ROLE }) public Response createCustomRole(EntityBody newCustomRole, @Context final UriInfo uriInfo) { String realmId = (String) newCustomRole.get("realmId"); Response res = validateRights(newCustomRole); if (res != null) { auditSecEvent(uriInfo, "Failed to create cus... | CustomRoleResource { @POST @RightsAllowed({Right.CRUD_ROLE }) public Response createCustomRole(EntityBody newCustomRole, @Context final UriInfo uriInfo) { String realmId = (String) newCustomRole.get("realmId"); Response res = validateRights(newCustomRole); if (res != null) { auditSecEvent(uriInfo, "Failed to create cus... |
@Test public void testCreateDuplicate() { setRealms(REALM_ID); NeutralQuery existingCustomRoleQuery = new NeutralQuery(); existingCustomRoleQuery.addCriteria(new NeutralCriteria("realmId", NeutralCriteria.OPERATOR_EQUAL, REALM_ID)); Entity mockEntity = Mockito.mock(Entity.class); Mockito.when(mockEntity.getEntityId()).... | @POST @RightsAllowed({Right.CRUD_ROLE }) public Response createCustomRole(EntityBody newCustomRole, @Context final UriInfo uriInfo) { String realmId = (String) newCustomRole.get("realmId"); Response res = validateRights(newCustomRole); if (res != null) { auditSecEvent(uriInfo, "Failed to create custom role rights valid... | CustomRoleResource { @POST @RightsAllowed({Right.CRUD_ROLE }) public Response createCustomRole(EntityBody newCustomRole, @Context final UriInfo uriInfo) { String realmId = (String) newCustomRole.get("realmId"); Response res = validateRights(newCustomRole); if (res != null) { auditSecEvent(uriInfo, "Failed to create cus... | CustomRoleResource { @POST @RightsAllowed({Right.CRUD_ROLE }) public Response createCustomRole(EntityBody newCustomRole, @Context final UriInfo uriInfo) { String realmId = (String) newCustomRole.get("realmId"); Response res = validateRights(newCustomRole); if (res != null) { auditSecEvent(uriInfo, "Failed to create cus... | CustomRoleResource { @POST @RightsAllowed({Right.CRUD_ROLE }) public Response createCustomRole(EntityBody newCustomRole, @Context final UriInfo uriInfo) { String realmId = (String) newCustomRole.get("realmId"); Response res = validateRights(newCustomRole); if (res != null) { auditSecEvent(uriInfo, "Failed to create cus... | CustomRoleResource { @POST @RightsAllowed({Right.CRUD_ROLE }) public Response createCustomRole(EntityBody newCustomRole, @Context final UriInfo uriInfo) { String realmId = (String) newCustomRole.get("realmId"); Response res = validateRights(newCustomRole); if (res != null) { auditSecEvent(uriInfo, "Failed to create cus... |
@Test public void testBadData() { Response response = resource.provision(new HashMap<String, String>(), null); assertEquals(response.getStatus(), Status.BAD_REQUEST.getStatusCode()); } | @POST @RightsAllowed({Right.INGEST_DATA }) public Response provision(Map<String, String> reqBody, @Context final UriInfo uriInfo) { String orgId = reqBody.get(STATE_EDORG_ID); if (orgId == null) { return Response.status(Status.BAD_REQUEST).entity("Missing required " + STATE_EDORG_ID).build(); } Response r = createEdOrg... | OnboardingResource { @POST @RightsAllowed({Right.INGEST_DATA }) public Response provision(Map<String, String> reqBody, @Context final UriInfo uriInfo) { String orgId = reqBody.get(STATE_EDORG_ID); if (orgId == null) { return Response.status(Status.BAD_REQUEST).entity("Missing required " + STATE_EDORG_ID).build(); } Res... | OnboardingResource { @POST @RightsAllowed({Right.INGEST_DATA }) public Response provision(Map<String, String> reqBody, @Context final UriInfo uriInfo) { String orgId = reqBody.get(STATE_EDORG_ID); if (orgId == null) { return Response.status(Status.BAD_REQUEST).entity("Missing required " + STATE_EDORG_ID).build(); } Res... | OnboardingResource { @POST @RightsAllowed({Right.INGEST_DATA }) public Response provision(Map<String, String> reqBody, @Context final UriInfo uriInfo) { String orgId = reqBody.get(STATE_EDORG_ID); if (orgId == null) { return Response.status(Status.BAD_REQUEST).entity("Missing required " + STATE_EDORG_ID).build(); } Res... | OnboardingResource { @POST @RightsAllowed({Right.INGEST_DATA }) public Response provision(Map<String, String> reqBody, @Context final UriInfo uriInfo) { String orgId = reqBody.get(STATE_EDORG_ID); if (orgId == null) { return Response.status(Status.BAD_REQUEST).entity("Missing required " + STATE_EDORG_ID).build(); } Res... |
@SuppressWarnings("unchecked") @Test public void testProvision() { Map<String, String> requestBody = new HashMap<String, String>(); requestBody.put(OnboardingResource.STATE_EDORG_ID, "TestOrg"); requestBody.put(ResourceConstants.ENTITY_METADATA_TENANT_ID, "12345"); requestBody.put(OnboardingResource.PRELOAD_FILES_ID, "... | @POST @RightsAllowed({Right.INGEST_DATA }) public Response provision(Map<String, String> reqBody, @Context final UriInfo uriInfo) { String orgId = reqBody.get(STATE_EDORG_ID); if (orgId == null) { return Response.status(Status.BAD_REQUEST).entity("Missing required " + STATE_EDORG_ID).build(); } Response r = createEdOrg... | OnboardingResource { @POST @RightsAllowed({Right.INGEST_DATA }) public Response provision(Map<String, String> reqBody, @Context final UriInfo uriInfo) { String orgId = reqBody.get(STATE_EDORG_ID); if (orgId == null) { return Response.status(Status.BAD_REQUEST).entity("Missing required " + STATE_EDORG_ID).build(); } Res... | OnboardingResource { @POST @RightsAllowed({Right.INGEST_DATA }) public Response provision(Map<String, String> reqBody, @Context final UriInfo uriInfo) { String orgId = reqBody.get(STATE_EDORG_ID); if (orgId == null) { return Response.status(Status.BAD_REQUEST).entity("Missing required " + STATE_EDORG_ID).build(); } Res... | OnboardingResource { @POST @RightsAllowed({Right.INGEST_DATA }) public Response provision(Map<String, String> reqBody, @Context final UriInfo uriInfo) { String orgId = reqBody.get(STATE_EDORG_ID); if (orgId == null) { return Response.status(Status.BAD_REQUEST).entity("Missing required " + STATE_EDORG_ID).build(); } Res... | OnboardingResource { @POST @RightsAllowed({Right.INGEST_DATA }) public Response provision(Map<String, String> reqBody, @Context final UriInfo uriInfo) { String orgId = reqBody.get(STATE_EDORG_ID); if (orgId == null) { return Response.status(Status.BAD_REQUEST).entity("Missing required " + STATE_EDORG_ID).build(); } Res... |
@SuppressWarnings({ "rawtypes", "unchecked" }) @Test public void testGetApps() { ResponseImpl resp = (ResponseImpl) resource.getApplications(""); List<Map> list = (List<Map>) resp.getEntity(); List<String> names = new ArrayList<String>(); for (Map map : list) { String name = (String) map.get("name"); names.add(name); }... | @GET @RightsAllowed(any = true) public Response getApplications(@DefaultValue("") @QueryParam("is_admin") String adminFilter) { List<EntityBody> results = new ArrayList<EntityBody>(); NeutralQuery query = new NeutralQuery(0); for (Entity result : repo.findAll("application", query)) { if (appValidator.isAuthorizedForApp... | ApprovedApplicationResource { @GET @RightsAllowed(any = true) public Response getApplications(@DefaultValue("") @QueryParam("is_admin") String adminFilter) { List<EntityBody> results = new ArrayList<EntityBody>(); NeutralQuery query = new NeutralQuery(0); for (Entity result : repo.findAll("application", query)) { if (a... | ApprovedApplicationResource { @GET @RightsAllowed(any = true) public Response getApplications(@DefaultValue("") @QueryParam("is_admin") String adminFilter) { List<EntityBody> results = new ArrayList<EntityBody>(); NeutralQuery query = new NeutralQuery(0); for (Entity result : repo.findAll("application", query)) { if (a... | ApprovedApplicationResource { @GET @RightsAllowed(any = true) public Response getApplications(@DefaultValue("") @QueryParam("is_admin") String adminFilter) { List<EntityBody> results = new ArrayList<EntityBody>(); NeutralQuery query = new NeutralQuery(0); for (Entity result : repo.findAll("application", query)) { if (a... | ApprovedApplicationResource { @GET @RightsAllowed(any = true) public Response getApplications(@DefaultValue("") @QueryParam("is_admin") String adminFilter) { List<EntityBody> results = new ArrayList<EntityBody>(); NeutralQuery query = new NeutralQuery(0); for (Entity result : repo.findAll("application", query)) { if (a... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.