Skip to content

Commit

Permalink
Patch to populate creation date on email domain
Browse files Browse the repository at this point in the history
  • Loading branch information
amontenegro committed Dec 19, 2024
1 parent d3ccb64 commit b4257b9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ public class SummaryManagerTest {

@Mock
private ProfileEntity profileEntityMock;

@Mock
private ProfileEmailDomainEntity profileEmailDomainEntityMock;

@Mock
private ProfileEmailDomainEntity profileEmailDomainEntityTwoMock;

@Mock
private WorksCacheManager worksCacheManagerMock;
Expand Down Expand Up @@ -561,8 +567,6 @@ public void getSummaryTest() {
assertEquals(Integer.valueOf(16), rs.getPeerReviews().getTotal());

// Email domains
assertEquals("2024-12-20", rs.getEmailDomains().getEmailDomains().get(0).getVerificationDate().toString());
assertEquals(null, rs.getEmailDomains().getEmailDomains().get(1).getVerificationDate());
assertEquals(2, rs.getEmailDomains().getEmailDomains().size());
}

Expand Down Expand Up @@ -597,9 +601,6 @@ public void getSummaryPojoTest() {
assertEquals(16, rs.getPeerReviewsTotal());
// Email domain
assertEquals(2, rs.getEmailDomains().size());
assertEquals("2024-12-20", rs.getEmailDomains().get(0).getVerificationDate());
assertEquals(null, rs.getEmailDomains().get(1).getVerificationDate());

}

private PersonExternalIdentifiers getPersonExternalIdentifiers() {
Expand All @@ -619,18 +620,14 @@ private ResearchResources getResearchResources() {
}

private List<ProfileEmailDomainEntity> getEmailDomains() {
List<ProfileEmailDomainEntity> emailDomains = new ArrayList<ProfileEmailDomainEntity>();
ProfileEmailDomainEntity emailDomain = new ProfileEmailDomainEntity();
emailDomain.setEmailDomain(EMAIL_DOMAIN);
emailDomain.setOrcid(ORCID);
emailDomain.setDateCreated(new Date(124, 11, 20));
emailDomains.add(emailDomain);

ProfileEmailDomainEntity emailDomain2 = new ProfileEmailDomainEntity();
emailDomain2.setEmailDomain(EMAIL_DOMAIN + "2");
emailDomain2.setOrcid(ORCID);
emailDomain2.setDateCreated(new Date(124, 9, 20));
emailDomains.add(emailDomain2);
List<ProfileEmailDomainEntity> emailDomains = new ArrayList<>();
Mockito.when(profileEmailDomainEntityMock.getEmailDomain()).thenReturn(EMAIL_DOMAIN);
Mockito.when(profileEmailDomainEntityMock.getDateCreated()).thenReturn(new Date(124, 9, 20));
Mockito.when(profileEmailDomainEntityTwoMock.getEmailDomain()).thenReturn(EMAIL_DOMAIN + "2");
Mockito.when(profileEmailDomainEntityTwoMock.getDateCreated()).thenReturn(new Date(124, 11, 20));

emailDomains.add(profileEmailDomainEntityMock);
emailDomains.add(profileEmailDomainEntityTwoMock);

return emailDomains;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ public void before() {

ped1.setEmailDomain(EMAIL_DOMAIN);
ped1.setOrcid(ORCID);
ped1.setDateCreated(new Date(124, 12, 12));
ped1.setVisibility(Visibility.PUBLIC.value());

ped2.setEmailDomain(EMAIL_DOMAIN_TWO);
Expand All @@ -72,7 +71,6 @@ public void before() {

ped3.setEmailDomain(EMAIL_DOMAIN);
ped3.setOrcid(ORCID_TWO);
ped3.setDateCreated(new Date(124, 12, 30));
ped3.setVisibility(Visibility.PUBLIC.value());

when(profileEmailDomainDaoMock.findByEmailDomain(eq(ORCID), eq(EMAIL_DOMAIN))).thenReturn(ped1);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.orcid.persistence.jpa.entities;

import javax.persistence.*;
import java.util.Date;
import java.util.Objects;

/**
Expand All @@ -17,7 +16,6 @@ public class ProfileEmailDomainEntity extends BaseEntity<Long> {
private String orcid;
private String emailDomain;
private String visibility;
private Date dateCreated;

@Id
@Column(name = "id")
Expand Down Expand Up @@ -58,16 +56,6 @@ public void setVisibility(String visibility) {
this.visibility = visibility;
}

@Column(name = "date_created")
public Date getDateCreated() {
return dateCreated;
}

public void setDateCreated(Date dateCreated) {
this.dateCreated = dateCreated;
}


@Override
public boolean equals(Object obj) {
if (this == obj)
Expand Down

0 comments on commit b4257b9

Please sign in to comment.