@Test public void saveEditedAssociationFromFormAssociationNoErrors() throws Exception { when(validationService.runAssociationValidation(ASS_INTER_EDITED, "full","")).thenReturn(Collections.singleton( WARNING)); when(associationRepository.findOne(Matchers.anyLong())).thenReturn(ASS_INTER); assertThat(associationOperationsService.saveEditedAssociationFromForm(STUDY, ASS_INTER_EDITED, (long) 100, USER,"")).isInstanceOf( List.class) .hasOnlyElementsOfType( AssociationValidationView.class) .hasSize(1); verify(associationRepository, times(1)).findOne((long) 100); verify(lociAttributesService, times(1)).deleteLocusAndRiskAlleles(ASS_INTER); verify(associationTrackingOperationService, times(1)).update(ASS_INTER_EDITED, USER, "ASSOCIATION_UPDATE"); verify(associationRepository, times(1)).save(ASS_INTER_EDITED); verify(associationValidationReportService, times(1)).createAssociationValidationReport(Collections.singleton( WARNING), ASS_INTER_EDITED.getId()); }
public Collection<AssociationValidationView> saveEditedAssociationFromForm(Study study, Association association, Long associationId, SecureUser user, String eRelease) throws EnsemblMappingException { Collection<ValidationError> associationValidationErrors = validationService.runAssociationValidation(association, "full", eRelease); Collection<AssociationValidationView> associationValidationViews = processAssociationValidationErrors(associationValidationErrors); long errorCount = associationValidationErrors.parallelStream() .filter(validationError -> !validationError.getWarning()) .count(); if (errorCount == 0) { association.setId(associationId); Association associationUserIsEditing = associationRepository.findOne(associationId); lociAttributesService.deleteLocusAndRiskAlleles(associationUserIsEditing); association.setEvents(associationUserIsEditing.getEvents()); createAssociationUpdateEvent(association, user); saveAssociation(association, study, associationValidationErrors); } return associationValidationViews; }
AssociationOperationsService { public Collection<AssociationValidationView> saveEditedAssociationFromForm(Study study, Association association, Long associationId, SecureUser user, String eRelease) throws EnsemblMappingException { Collection<ValidationError> associationValidationErrors = validationService.runAssociationValidation(association, "full", eRelease); Collection<AssociationValidationView> associationValidationViews = processAssociationValidationErrors(associationValidationErrors); long errorCount = associationValidationErrors.parallelStream() .filter(validationError -> !validationError.getWarning()) .count(); if (errorCount == 0) { association.setId(associationId); Association associationUserIsEditing = associationRepository.findOne(associationId); lociAttributesService.deleteLocusAndRiskAlleles(associationUserIsEditing); association.setEvents(associationUserIsEditing.getEvents()); createAssociationUpdateEvent(association, user); saveAssociation(association, study, associationValidationErrors); } return associationValidationViews; } }
AssociationOperationsService { public Collection<AssociationValidationView> saveEditedAssociationFromForm(Study study, Association association, Long associationId, SecureUser user, String eRelease) throws EnsemblMappingException { Collection<ValidationError> associationValidationErrors = validationService.runAssociationValidation(association, "full", eRelease); Collection<AssociationValidationView> associationValidationViews = processAssociationValidationErrors(associationValidationErrors); long errorCount = associationValidationErrors.parallelStream() .filter(validationError -> !validationError.getWarning()) .count(); if (errorCount == 0) { association.setId(associationId); Association associationUserIsEditing = associationRepository.findOne(associationId); lociAttributesService.deleteLocusAndRiskAlleles(associationUserIsEditing); association.setEvents(associationUserIsEditing.getEvents()); createAssociationUpdateEvent(association, user); saveAssociation(association, study, associationValidationErrors); } return associationValidationViews; } @Autowired  AssociationOperationsService(SingleSnpMultiSnpAssociationService singleSnpMultiSnpAssociationService,
                                        SnpInteractionAssociationService snpInteractionAssociationService,
                                        AssociationReportRepository associationReportRepository,
                                        AssociationRepository associationRepository,
                                        LocusRepository locusRepository,
                                        MappingService mappingService,
                                        LociAttributesService lociAttributesService,
                                        ValidationService validationService,
                                        AssociationValidationReportService associationValidationReportService,
                                        ErrorCreationService errorCreationService,
                                        @Qualifier("associationTrackingOperationServiceImpl") TrackingOperationService trackingOperationService,
                                        AssociationMappingErrorService associationMappingErrorService); }
AssociationOperationsService { public Collection<AssociationValidationView> saveEditedAssociationFromForm(Study study, Association association, Long associationId, SecureUser user, String eRelease) throws EnsemblMappingException { Collection<ValidationError> associationValidationErrors = validationService.runAssociationValidation(association, "full", eRelease); Collection<AssociationValidationView> associationValidationViews = processAssociationValidationErrors(associationValidationErrors); long errorCount = associationValidationErrors.parallelStream() .filter(validationError -> !validationError.getWarning()) .count(); if (errorCount == 0) { association.setId(associationId); Association associationUserIsEditing = associationRepository.findOne(associationId); lociAttributesService.deleteLocusAndRiskAlleles(associationUserIsEditing); association.setEvents(associationUserIsEditing.getEvents()); createAssociationUpdateEvent(association, user); saveAssociation(association, study, associationValidationErrors); } return associationValidationViews; } @Autowired  AssociationOperationsService(SingleSnpMultiSnpAssociationService singleSnpMultiSnpAssociationService,
                                        SnpInteractionAssociationService snpInteractionAssociationService,
                                        AssociationReportRepository associationReportRepository,
                                        AssociationRepository associationRepository,
                                        LocusRepository locusRepository,
                                        MappingService mappingService,
                                        LociAttributesService lociAttributesService,
                                        ValidationService validationService,
                                        AssociationValidationReportService associationValidationReportService,
                                        ErrorCreationService errorCreationService,
                                        @Qualifier("associationTrackingOperationServiceImpl") TrackingOperationService trackingOperationService,
                                        AssociationMappingErrorService associationMappingErrorService); List<AssociationValidationView> checkSnpAssociationFormErrors(SnpAssociationStandardMultiForm form,
                                                                         String measurementType); List<AssociationValidationView> checkSnpAssociationErrors(Association association,
                                                                         String measurementType); List<AssociationValidationView> checkSnpAssociationInteractionFormErrors(SnpAssociationInteractionForm form,
                                                                                    String measurementType); Collection<AssociationValidationView> saveAssociationCreatedFromForm(Study study,
                                                                                Association association,
                                                                                SecureUser user,
                                                                                String eRelease); Collection<AssociationValidationView> saveEditedAssociationFromForm(Study study,
                                                                               Association association,
                                                                               Long associationId,
                                                                               SecureUser user,
                                                                               String eRelease); Collection<AssociationValidationView> validateAndSaveAssociation(Study study,
                                                                               Association association,
                                                                               SecureUser user,
                                                                               String eRelease); void saveAssociation(Association association, Study study, Collection<ValidationError> errors); void runMapping(Curator curator, Association association, SecureUser user); String determineIfAssociationIsOrType(Association association); SnpAssociationForm generateForm(Association association); MappingDetails createMappingDetails(Association association); LastViewedAssociation getLastViewedAssociation(Long associationId); void approveAssociation(Association association, SecureUser user); void unapproveAssociation(Association association, SecureUser user); void createAssociationCreationEvent(Association association, SecureUser user); void deleteAssocationReport(Long associationReportId); Collection<String> getGenesIds(Collection<Locus> loci); Collection<String> getSpnsName(Collection<SingleNucleotidePolymorphism> snpsList); }
AssociationOperationsService { public Collection<AssociationValidationView> saveEditedAssociationFromForm(Study study, Association association, Long associationId, SecureUser user, String eRelease) throws EnsemblMappingException { Collection<ValidationError> associationValidationErrors = validationService.runAssociationValidation(association, "full", eRelease); Collection<AssociationValidationView> associationValidationViews = processAssociationValidationErrors(associationValidationErrors); long errorCount = associationValidationErrors.parallelStream() .filter(validationError -> !validationError.getWarning()) .count(); if (errorCount == 0) { association.setId(associationId); Association associationUserIsEditing = associationRepository.findOne(associationId); lociAttributesService.deleteLocusAndRiskAlleles(associationUserIsEditing); association.setEvents(associationUserIsEditing.getEvents()); createAssociationUpdateEvent(association, user); saveAssociation(association, study, associationValidationErrors); } return associationValidationViews; } @Autowired  AssociationOperationsService(SingleSnpMultiSnpAssociationService singleSnpMultiSnpAssociationService,
                                        SnpInteractionAssociationService snpInteractionAssociationService,
                                        AssociationReportRepository associationReportRepository,
                                        AssociationRepository associationRepository,
                                        LocusRepository locusRepository,
                                        MappingService mappingService,
                                        LociAttributesService lociAttributesService,
                                        ValidationService validationService,
                                        AssociationValidationReportService associationValidationReportService,
                                        ErrorCreationService errorCreationService,
                                        @Qualifier("associationTrackingOperationServiceImpl") TrackingOperationService trackingOperationService,
                                        AssociationMappingErrorService associationMappingErrorService); List<AssociationValidationView> checkSnpAssociationFormErrors(SnpAssociationStandardMultiForm form,
                                                                         String measurementType); List<AssociationValidationView> checkSnpAssociationErrors(Association association,
                                                                         String measurementType); List<AssociationValidationView> checkSnpAssociationInteractionFormErrors(SnpAssociationInteractionForm form,
                                                                                    String measurementType); Collection<AssociationValidationView> saveAssociationCreatedFromForm(Study study,
                                                                                Association association,
                                                                                SecureUser user,
                                                                                String eRelease); Collection<AssociationValidationView> saveEditedAssociationFromForm(Study study,
                                                                               Association association,
                                                                               Long associationId,
                                                                               SecureUser user,
                                                                               String eRelease); Collection<AssociationValidationView> validateAndSaveAssociation(Study study,
                                                                               Association association,
                                                                               SecureUser user,
                                                                               String eRelease); void saveAssociation(Association association, Study study, Collection<ValidationError> errors); void runMapping(Curator curator, Association association, SecureUser user); String determineIfAssociationIsOrType(Association association); SnpAssociationForm generateForm(Association association); MappingDetails createMappingDetails(Association association); LastViewedAssociation getLastViewedAssociation(Long associationId); void approveAssociation(Association association, SecureUser user); void unapproveAssociation(Association association, SecureUser user); void createAssociationCreationEvent(Association association, SecureUser user); void deleteAssocationReport(Long associationReportId); Collection<String> getGenesIds(Collection<Locus> loci); Collection<String> getSpnsName(Collection<SingleNucleotidePolymorphism> snpsList);  }