diff --git a/assertion-service/src/main/java/org/orcid/memberportal/service/assertion/services/AssertionService.java b/assertion-service/src/main/java/org/orcid/memberportal/service/assertion/services/AssertionService.java index f93d1af34..343af75a2 100644 --- a/assertion-service/src/main/java/org/orcid/memberportal/service/assertion/services/AssertionService.java +++ b/assertion-service/src/main/java/org/orcid/memberportal/service/assertion/services/AssertionService.java @@ -296,9 +296,10 @@ public List findAssertionsByEmail(String email) { } public boolean isDuplicate(Assertion assertion, String salesforceId) { + Assertion normalized = assertionNormalizer.normalize(assertion); List assertions = assertionRepository.findByEmailAndSalesforceId(assertion.getEmail(), salesforceId); for (Assertion a : assertions) { - if (duplicates(a, assertion)) { + if (duplicates(a, normalized)) { return true; } } diff --git a/assertion-service/src/test/java/org/orcid/memberportal/service/assertion/services/AssertionServiceTest.java b/assertion-service/src/test/java/org/orcid/memberportal/service/assertion/services/AssertionServiceTest.java index fb1948485..81453da63 100644 --- a/assertion-service/src/test/java/org/orcid/memberportal/service/assertion/services/AssertionServiceTest.java +++ b/assertion-service/src/test/java/org/orcid/memberportal/service/assertion/services/AssertionServiceTest.java @@ -1177,6 +1177,7 @@ void testIsDuplicate() { a.setUrl("something-different"); assertFalse(assertionService.isDuplicate(comparison, DEFAULT_SALESFORCE_ID)); + a.setUrl(null); assertFalse(assertionService.isDuplicate(comparison, DEFAULT_SALESFORCE_ID)); @@ -1319,6 +1320,7 @@ void testIsDuplicate() { comparison.setId("not-null"); // id should be ignored assertTrue(assertionService.isDuplicate(comparison, DEFAULT_SALESFORCE_ID)); + verify(assertionNormalizer, Mockito.times(49)).normalize(Mockito.any(Assertion.class)); // check normalization was used } @Test @@ -1722,10 +1724,10 @@ void testUpdateAssertionsSalesforceId() { void testUpdateAssertionsSalesforceIdWithFailure() { List firstPage = getAssertionsForSalesforceId("salesforce-id", 0, AssertionService.REGISTRY_SYNC_BATCH_SIZE); Mockito.when(assertionRepository.findBySalesforceId(Mockito.eq("salesforce-id"), Mockito.any(Pageable.class))).thenReturn(new PageImpl(firstPage)); - + // representing updated assertions that need to be rolled back Mockito.when(assertionRepository.findBySalesforceId(Mockito.eq("new-salesforce-id"), Mockito.any(Pageable.class))) - .thenReturn(new PageImpl(Arrays.asList(new Assertion(), new Assertion(), new Assertion()))).thenReturn(new PageImpl(new ArrayList<>())); + .thenReturn(new PageImpl(Arrays.asList(new Assertion(), new Assertion(), new Assertion()))).thenReturn(new PageImpl(new ArrayList<>())); // 3 successful updates before error, followed by rollback Mockito.when(assertionRepository.save(Mockito.any(Assertion.class))).thenReturn(new Assertion()).thenReturn(new Assertion()).thenReturn(new Assertion()) @@ -1734,8 +1736,8 @@ void testUpdateAssertionsSalesforceIdWithFailure() { boolean success = assertionService.updateAssertionsSalesforceId("salesforce-id", "new-salesforce-id"); assertThat(success).isFalse(); - // 3 updates followed by 1 failure and 3 rollbacks - Mockito.verify(assertionRepository, Mockito.times(7)).save(assertionCaptor.capture()); + // 3 updates followed by 1 failure and 3 rollbacks + Mockito.verify(assertionRepository, Mockito.times(7)).save(assertionCaptor.capture()); List saved = assertionCaptor.getAllValues(); assertThat(saved.get(0).getSalesforceId()).isEqualTo("new-salesforce-id"); assertThat(saved.get(1).getSalesforceId()).isEqualTo("new-salesforce-id"); @@ -1745,7 +1747,7 @@ void testUpdateAssertionsSalesforceIdWithFailure() { assertThat(saved.get(5).getSalesforceId()).isEqualTo("salesforce-id"); assertThat(saved.get(6).getSalesforceId()).isEqualTo("salesforce-id"); } - + private List getDummyAssertionStatusCounts() { List counts = new ArrayList<>(); counts.add(new MemberAssertionStatusCount("salesforceId1", "PENDING", 4)); diff --git a/ui/src/app/affiliation/affiliation-delete.component.ts b/ui/src/app/affiliation/affiliation-delete.component.ts index 1196e0978..422fa6474 100644 --- a/ui/src/app/affiliation/affiliation-delete.component.ts +++ b/ui/src/app/affiliation/affiliation-delete.component.ts @@ -72,8 +72,6 @@ export class AffiliationDeletePopupComponent implements OnInit, OnDestroy { ngOnInit() { this.activatedRoute.data.subscribe(({ affiliation }) => { - console.log(affiliation) - setTimeout(() => { this.ngbModalRef = this.modalService.open(AffiliationDeleteDialogComponent as Component, { size: 'lg', diff --git a/ui/src/app/affiliation/affiliation-import-dialog.component.html b/ui/src/app/affiliation/affiliation-import-dialog.component.html index 92402e4ce..0366e2728 100644 --- a/ui/src/app/affiliation/affiliation-import-dialog.component.html +++ b/ui/src/app/affiliation/affiliation-import-dialog.component.html @@ -69,7 +69,7 @@