Skip to content

Commit

Permalink
remove custom date created in profile email domain entity (#7161)
Browse files Browse the repository at this point in the history
Co-authored-by: Angel Montenegro <[email protected]>
  • Loading branch information
auumgn and amontenegro authored Dec 18, 2024
1 parent 024c080 commit d7b11c4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 29 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,7 +567,7 @@ public void getSummaryTest() {
assertEquals(Integer.valueOf(16), rs.getPeerReviews().getTotal());

// Email domains
assertEquals("2024-12-20", rs.getEmailDomains().getEmailDomains().get(0).getVerificationDate().toString());
assertEquals("2024-10-20", rs.getEmailDomains().getEmailDomains().get(0).getVerificationDate().toString());
assertNull(rs.getEmailDomains().getEmailDomains().get(1).getVerificationDate());
assertEquals(2, rs.getEmailDomains().getEmailDomains().size());
}
Expand Down Expand Up @@ -597,7 +603,7 @@ public void getSummaryPojoTest() {
assertEquals(16, rs.getPeerReviewsTotal());
// Email domain
assertEquals(2, rs.getEmailDomains().size());
assertEquals("2024-12-20", rs.getEmailDomains().get(0).getVerificationDate());
assertEquals("2024-10-20", rs.getEmailDomains().get(0).getVerificationDate());
assertEquals(null, rs.getEmailDomains().get(1).getVerificationDate());

}
Expand All @@ -619,20 +625,16 @@ 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));
emailDomain.setGeneratedByScript(false);
emailDomains.add(emailDomain);

ProfileEmailDomainEntity emailDomain2 = new ProfileEmailDomainEntity();
emailDomain2.setEmailDomain(EMAIL_DOMAIN + "2");
emailDomain2.setOrcid(ORCID);
emailDomain2.setDateCreated(new Date(124, 9, 20));
emailDomain2.setGeneratedByScript(true);
emailDomains.add(emailDomain2);
List<ProfileEmailDomainEntity> emailDomains = new ArrayList<>();
Mockito.when(profileEmailDomainEntityMock.getEmailDomain()).thenReturn(EMAIL_DOMAIN);
Mockito.when(profileEmailDomainEntityMock.getGeneratedByScript()).thenReturn(false);
Mockito.when(profileEmailDomainEntityMock.getDateCreated()).thenReturn(new Date(124, 9, 20));
Mockito.when(profileEmailDomainEntityTwoMock.getEmailDomain()).thenReturn(EMAIL_DOMAIN + "2");
Mockito.when(profileEmailDomainEntityTwoMock.getGeneratedByScript()).thenReturn(true);
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;
private Boolean generatedByScript;

@Id
Expand Down Expand Up @@ -59,15 +57,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;
}

@Column(name = "generated_by_script")
public Boolean getGeneratedByScript() {
return generatedByScript;
Expand Down

0 comments on commit d7b11c4

Please sign in to comment.