Fixed bugs is equals and hashCode methods of sci-project and
sci-publications entitiespull/1/head
parent
8828cfbfc6
commit
749aa02249
|
|
@ -10,6 +10,7 @@ import org.hibernate.envers.Audited;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.OneToMany;
|
import javax.persistence.OneToMany;
|
||||||
|
|
@ -41,6 +42,7 @@ public class CollectedVolume extends PublicationWithPublisher {
|
||||||
return Collections.unmodifiableList(articles);
|
return Collections.unmodifiableList(articles);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void addArticle(final ArticleInCollectedVolume article) {
|
protected void addArticle(final ArticleInCollectedVolume article) {
|
||||||
articles.add(article);
|
articles.add(article);
|
||||||
}
|
}
|
||||||
|
|
@ -53,9 +55,37 @@ public class CollectedVolume extends PublicationWithPublisher {
|
||||||
this.articles = new ArrayList<>(articles);
|
this.articles = new ArrayList<>(articles);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int hash = super.hashCode();
|
||||||
|
hash = 29 * hash;
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(final Object obj) {
|
||||||
|
if (this == obj) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (obj == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!super.equals(obj)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!(obj instanceof CollectedVolume)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final CollectedVolume other = (CollectedVolume) obj;
|
||||||
|
return other.canEqual(this);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canEqual(final Object obj) {
|
public boolean canEqual(final Object obj) {
|
||||||
return obj instanceof CollectedVolume;
|
return obj instanceof CollectedVolume;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -179,7 +179,7 @@ public class Journal implements Serializable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int hash = super.hashCode();
|
int hash = 7;
|
||||||
hash = 73 * hash + Objects.hashCode(firstYear);
|
hash = 73 * hash + Objects.hashCode(firstYear);
|
||||||
hash = 73 * hash + Objects.hashCode(lastYear);
|
hash = 73 * hash + Objects.hashCode(lastYear);
|
||||||
hash = 73 * hash + Objects.hashCode(issn);
|
hash = 73 * hash + Objects.hashCode(issn);
|
||||||
|
|
@ -197,9 +197,6 @@ public class Journal implements Serializable {
|
||||||
if (obj == null) {
|
if (obj == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!super.equals(obj)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!(obj instanceof Journal)) {
|
if (!(obj instanceof Journal)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,8 @@ import javax.persistence.Entity;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.GenerationType;
|
import javax.persistence.GenerationType;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.Inheritance;
|
||||||
|
import javax.persistence.InheritanceType;
|
||||||
import javax.persistence.JoinColumn;
|
import javax.persistence.JoinColumn;
|
||||||
import javax.persistence.JoinTable;
|
import javax.persistence.JoinTable;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
@ -32,6 +34,7 @@ import static org.scientificcms.publications.SciPublicationsConstants.*;
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "PUBLICATIONS", schema = DB_SCHEMA)
|
@Table(name = "PUBLICATIONS", schema = DB_SCHEMA)
|
||||||
|
@Inheritance(strategy = InheritanceType.JOINED)
|
||||||
@Audited
|
@Audited
|
||||||
public class Publication implements Serializable {
|
public class Publication implements Serializable {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,18 +8,15 @@ package org.scientificcms.publications;
|
||||||
import org.hibernate.envers.Audited;
|
import org.hibernate.envers.Audited;
|
||||||
import org.libreccm.l10n.LocalizedString;
|
import org.libreccm.l10n.LocalizedString;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import javax.persistence.AssociationOverride;
|
import javax.persistence.AssociationOverride;
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Embeddable;
|
|
||||||
import javax.persistence.Embedded;
|
import javax.persistence.Embedded;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.JoinColumn;
|
import javax.persistence.JoinColumn;
|
||||||
import javax.persistence.JoinTable;
|
import javax.persistence.JoinTable;
|
||||||
import javax.persistence.ManyToOne;
|
import javax.persistence.ManyToOne;
|
||||||
import javax.persistence.OneToOne;
|
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
import static org.scientificcms.publications.SciPublicationsConstants.*;
|
import static org.scientificcms.publications.SciPublicationsConstants.*;
|
||||||
|
|
@ -122,7 +119,7 @@ public class PublicationWithPublisher extends Publication {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int hash = 7;
|
int hash = super.hashCode();
|
||||||
hash = 47 * hash + Objects.hashCode(publisher);
|
hash = 47 * hash + Objects.hashCode(publisher);
|
||||||
hash = 47 * hash + Objects.hashCode(isbn10);
|
hash = 47 * hash + Objects.hashCode(isbn10);
|
||||||
hash = 47 * hash + Objects.hashCode(isbn13);
|
hash = 47 * hash + Objects.hashCode(isbn13);
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,7 @@ public class Publisher implements Serializable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int hash = super.hashCode();
|
int hash = 7;
|
||||||
hash = 29 * hash + (int) (publisherId ^ (publisherId >>> 32));
|
hash = 29 * hash + (int) (publisherId ^ (publisherId >>> 32));
|
||||||
hash = 29 * hash + Objects.hashCode(uuid);
|
hash = 29 * hash + Objects.hashCode(uuid);
|
||||||
hash = 29 * hash + Objects.hashCode(name);
|
hash = 29 * hash + Objects.hashCode(name);
|
||||||
|
|
@ -137,9 +137,6 @@ public class Publisher implements Serializable {
|
||||||
if (obj == null) {
|
if (obj == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!super.equals(obj)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!(obj instanceof Publisher)) {
|
if (!(obj instanceof Publisher)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,31 @@ public class WorkingPaper extends UnPublished {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int hash = super.hashCode();
|
||||||
|
hash = 41 * hash;
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(final Object obj) {
|
||||||
|
if (this == obj) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (obj == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!super.equals(obj)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!(obj instanceof WorkingPaper)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final WorkingPaper other = (WorkingPaper) obj;
|
||||||
|
return other.canEqual(this);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canEqual(final Object obj) {
|
public boolean canEqual(final Object obj) {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ public class PublisherAsset extends Asset {
|
||||||
if (obj == null) {
|
if (obj == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!super.canEqual(this)) {
|
if (!super.equals(obj)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!(obj instanceof PublisherAsset)) {
|
if (!(obj instanceof PublisherAsset)) {
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,32 @@ public abstract class AbstractPublicationItem<T extends Publication>
|
||||||
|
|
||||||
protected abstract void setPublication(T publication);
|
protected abstract void setPublication(T publication);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int hash = super.hashCode();
|
||||||
|
hash = 29 * hash;
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(final Object obj) {
|
||||||
|
if (this == obj) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (obj == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!super.equals(obj)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!(obj instanceof AbstractPublicationItem)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final AbstractPublicationItem<?> other
|
||||||
|
= (AbstractPublicationItem<?>) obj;
|
||||||
|
return other.canEqual(this);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canEqual(final Object obj) {
|
public boolean canEqual(final Object obj) {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,32 @@ public abstract class AbstractPublicationWithPublisherItem<T extends Publication
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int hash = super.hashCode();
|
||||||
|
hash = 23 * hash;
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(final Object obj) {
|
||||||
|
if (this == obj) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (obj == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!super.equals(obj)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!(obj instanceof AbstractPublicationWithPublisherItem)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final AbstractPublicationWithPublisherItem<?> other
|
||||||
|
= (AbstractPublicationWithPublisherItem<?>) obj;
|
||||||
|
return other.canEqual(this);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canEqual(final Object obj) {
|
public boolean canEqual(final Object obj) {
|
||||||
return obj instanceof AbstractPublicationWithPublisherItem;
|
return obj instanceof AbstractPublicationWithPublisherItem;
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ public class ArticleInCollectedVolumeItem
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int hash = super.hashCode();
|
int hash = super.hashCode();
|
||||||
hash = 67 * hash + Objects.hashCode(this.article);
|
hash = 67 * hash + Objects.hashCode(article);
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -69,7 +69,7 @@ public class ArticleInCollectedVolumeItem
|
||||||
if (!other.canEqual(this)) {
|
if (!other.canEqual(this)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return Objects.equals(this.article, other.getPublication());
|
return Objects.equals(article, other.getPublication());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -62,14 +62,14 @@ public class CollectedVolumeItem
|
||||||
if (!super.equals(obj)) {
|
if (!super.equals(obj)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!(obj instanceof CollectedVolume)) {
|
if (!(obj instanceof CollectedVolumeItem)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final CollectedVolumeItem other = (CollectedVolumeItem) obj;
|
final CollectedVolumeItem other = (CollectedVolumeItem) obj;
|
||||||
if (!other.canEqual(this)) {
|
if (!other.canEqual(this)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return Objects.equals(this.collectedVolume, other.getPublication());
|
return Objects.equals(collectedVolume, other.getPublication());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.security;
|
package org.libreccm.security;
|
||||||
|
|
||||||
import nl.jqno.equalsverifier.EqualsVerifier;
|
import nl.jqno.equalsverifier.EqualsVerifierApi;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -17,7 +17,7 @@ public final class SecurityEntitiesPrefabProvider {
|
||||||
// Nothing
|
// Nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addPrefabEntities(final EqualsVerifier<?> verifier) {
|
public static void addPrefabEntities(final EqualsVerifierApi<?> verifier) {
|
||||||
|
|
||||||
final Role role1 = new Role();
|
final Role role1 = new Role();
|
||||||
role1.setRoleId(2001);
|
role1.setRoleId(2001);
|
||||||
|
|
@ -50,4 +50,16 @@ public final class SecurityEntitiesPrefabProvider {
|
||||||
verifier.withPrefabValues(User.class, user1, user2);
|
verifier.withPrefabValues(User.class, user1, user2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final void addPrefabPermissions(
|
||||||
|
final EqualsVerifierApi<?> verifierApi) {
|
||||||
|
|
||||||
|
final Permission permission1 = new Permission();
|
||||||
|
permission1.setGrantedPrivilege("privilege1");
|
||||||
|
final Permission permission2 = new Permission();
|
||||||
|
permission2.setGrantedPrivilege("privilege2");
|
||||||
|
verifierApi.withPrefabValues(Permission.class,
|
||||||
|
permission1,
|
||||||
|
permission2);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,16 +5,19 @@
|
||||||
*/
|
*/
|
||||||
package org.scientificcms.publications;
|
package org.scientificcms.publications;
|
||||||
|
|
||||||
|
import nl.jqno.equalsverifier.EqualsVerifierApi;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.junit.runners.Parameterized;
|
import org.junit.runners.Parameterized;
|
||||||
import org.libreccm.l10n.LocalizedString;
|
|
||||||
import org.libreccm.tests.categories.UnitTest;
|
import org.libreccm.tests.categories.UnitTest;
|
||||||
import org.libreccm.testutils.EqualsVerifier;
|
import org.libreccm.testutils.EqualsVerifier;
|
||||||
|
import org.librecms.assets.Organization;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
|
@ -51,8 +54,7 @@ public class EqualsAndHashCodeTest extends EqualsVerifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void addPrefabValues(
|
protected void addPrefabValues(final EqualsVerifierApi<?> verifier) {
|
||||||
final nl.jqno.equalsverifier.EqualsVerifier<?> verifier) {
|
|
||||||
|
|
||||||
final CollectedVolume volume1 = new CollectedVolume();
|
final CollectedVolume volume1 = new CollectedVolume();
|
||||||
volume1.getTitle().addValue(Locale.ENGLISH, "Test 1");
|
volume1.getTitle().addValue(Locale.ENGLISH, "Test 1");
|
||||||
|
|
@ -60,6 +62,35 @@ public class EqualsAndHashCodeTest extends EqualsVerifier {
|
||||||
volume2.getTitle().addValue(Locale.ENGLISH, "Test 2");
|
volume2.getTitle().addValue(Locale.ENGLISH, "Test 2");
|
||||||
verifier.withPrefabValues(CollectedVolume.class, volume1, volume2);
|
verifier.withPrefabValues(CollectedVolume.class, volume1, volume2);
|
||||||
|
|
||||||
|
final Journal journal1 = new Journal();
|
||||||
|
journal1.setTitle("Journal 1");
|
||||||
|
journal1.setFirstYear(1980);
|
||||||
|
final Journal journal2 = new Journal();
|
||||||
|
journal2.setTitle("Journal 2");
|
||||||
|
journal2.setFirstYear(2004);
|
||||||
|
verifier.withPrefabValues(Journal.class, journal1, journal2);
|
||||||
|
|
||||||
|
final Publisher publisher1 = new Publisher();
|
||||||
|
publisher1.setName("publisher1");
|
||||||
|
final Publisher publisher2 = new Publisher();
|
||||||
|
publisher2.setName("publisher2");
|
||||||
|
verifier.withPrefabValues(Publisher.class, publisher1, publisher2);
|
||||||
|
|
||||||
|
final Organization organization1 = new Organization();
|
||||||
|
organization1.setName("Orga 1");
|
||||||
|
final Organization organization2 = new Organization();
|
||||||
|
organization2.setName("Orga 2");
|
||||||
|
verifier.withPrefabValues(Organization.class,
|
||||||
|
organization1,
|
||||||
|
organization2);
|
||||||
|
|
||||||
|
final Proceedings proceedings1 = new Proceedings();
|
||||||
|
proceedings1.getTitle().addValue(Locale.ENGLISH, "Proceedings 1");
|
||||||
|
final Proceedings proceedings2 = new Proceedings();
|
||||||
|
proceedings2.getTitle().addValue(Locale.ENGLISH, "Proceedings 2");
|
||||||
|
verifier.withPrefabValues(Proceedings.class,
|
||||||
|
proceedings1,
|
||||||
|
proceedings2);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,114 @@
|
||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package org.scientificcms.publications.assets;
|
||||||
|
|
||||||
|
import nl.jqno.equalsverifier.EqualsVerifierApi;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.junit.runners.Parameterized;
|
||||||
|
import org.libreccm.categorization.Category;
|
||||||
|
import org.libreccm.core.CcmObject;
|
||||||
|
import org.libreccm.security.Permission;
|
||||||
|
import org.libreccm.security.SecurityEntitiesPrefabProvider;
|
||||||
|
import org.libreccm.tests.categories.UnitTest;
|
||||||
|
import org.libreccm.testutils.EqualsVerifier;
|
||||||
|
import org.librecms.contentsection.ItemAttachment;
|
||||||
|
import org.scientificcms.publications.CollectedVolume;
|
||||||
|
import org.scientificcms.publications.Journal;
|
||||||
|
import org.scientificcms.publications.Proceedings;
|
||||||
|
import org.scientificcms.publications.Publisher;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
@RunWith(Parameterized.class)
|
||||||
|
@org.junit.experimental.categories.Category(UnitTest.class)
|
||||||
|
public class EqualsAndHashCodeTest extends EqualsVerifier {
|
||||||
|
|
||||||
|
@Parameterized.Parameters(name = "{0}")
|
||||||
|
public static Collection<Class<?>> data() {
|
||||||
|
|
||||||
|
return Arrays.asList(new Class<?>[]{
|
||||||
|
CollectedVolumeAsset.class,
|
||||||
|
JournalAsset.class,
|
||||||
|
ProceedingsAsset.class,
|
||||||
|
PublisherAsset.class
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public EqualsAndHashCodeTest(final Class<?> clazz) {
|
||||||
|
super(clazz);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void addPrefabValues(final EqualsVerifierApi<?> verifier) {
|
||||||
|
|
||||||
|
final CollectedVolume volume1 = new CollectedVolume();
|
||||||
|
volume1.getTitle().addValue(Locale.ENGLISH, "Test 1");
|
||||||
|
final CollectedVolume volume2 = new CollectedVolume();
|
||||||
|
volume2.getTitle().addValue(Locale.ENGLISH, "Test 2");
|
||||||
|
verifier.withPrefabValues(CollectedVolume.class, volume1, volume2);
|
||||||
|
|
||||||
|
final Journal journal1 = new Journal();
|
||||||
|
journal1.setTitle("Journal 1");
|
||||||
|
journal1.setFirstYear(1980);
|
||||||
|
final Journal journal2 = new Journal();
|
||||||
|
journal2.setTitle("Journal 2");
|
||||||
|
journal2.setFirstYear(2004);
|
||||||
|
verifier.withPrefabValues(Journal.class, journal1, journal2);
|
||||||
|
|
||||||
|
final Publisher publisher1 = new Publisher();
|
||||||
|
publisher1.setName("publisher1");
|
||||||
|
final Publisher publisher2 = new Publisher();
|
||||||
|
publisher2.setName("publisher2");
|
||||||
|
verifier.withPrefabValues(Publisher.class, publisher1, publisher2);
|
||||||
|
|
||||||
|
final PublisherAsset publisherAsset1 = new PublisherAsset();
|
||||||
|
publisherAsset1.setPublisher(publisher1);
|
||||||
|
final PublisherAsset publisherAsset2 = new PublisherAsset();
|
||||||
|
publisherAsset2.setPublisher(publisher2);
|
||||||
|
verifier.withPrefabValues(PublisherAsset.class,
|
||||||
|
publisherAsset1,
|
||||||
|
publisherAsset2);
|
||||||
|
|
||||||
|
final ItemAttachment<PublisherAsset> attachment1
|
||||||
|
= new ItemAttachment<>();
|
||||||
|
attachment1.setAsset(publisherAsset1);
|
||||||
|
final ItemAttachment<PublisherAsset> attachment2
|
||||||
|
= new ItemAttachment<>();
|
||||||
|
attachment2.setAsset(publisherAsset2);
|
||||||
|
verifier.withPrefabValues(ItemAttachment.class,
|
||||||
|
attachment1,
|
||||||
|
attachment2);
|
||||||
|
|
||||||
|
final Proceedings proceedings1 = new Proceedings();
|
||||||
|
proceedings1.getTitle().addValue(Locale.ENGLISH, "Proceedings 1");
|
||||||
|
final Proceedings proceedings2 = new Proceedings();
|
||||||
|
proceedings2.getTitle().addValue(Locale.ENGLISH, "Proceedings 2");
|
||||||
|
verifier.withPrefabValues(Proceedings.class,
|
||||||
|
proceedings1,
|
||||||
|
proceedings2);
|
||||||
|
|
||||||
|
SecurityEntitiesPrefabProvider.addPrefabPermissions(verifier);
|
||||||
|
|
||||||
|
final Category category1 = new Category();
|
||||||
|
category1.setName("category1");
|
||||||
|
final Category category2 = new Category();
|
||||||
|
category2.setName("category2");
|
||||||
|
verifier.withPrefabValues(Category.class, category1, category2);
|
||||||
|
|
||||||
|
final CcmObject ccmObject1 = new CcmObject();
|
||||||
|
ccmObject1.setDisplayName("obj1");
|
||||||
|
final CcmObject ccmObject2 = new CcmObject();
|
||||||
|
ccmObject2.setDisplayName("obj2");
|
||||||
|
verifier.withPrefabValues(CcmObject.class, ccmObject1, ccmObject2);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,104 +0,0 @@
|
||||||
/*
|
|
||||||
* To change this license header, choose License Headers in Project Properties.
|
|
||||||
* To change this template file, choose Tools | Templates
|
|
||||||
* and open the template in the editor.
|
|
||||||
*/
|
|
||||||
package org.scientificcms.publications.assets;
|
|
||||||
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.junit.runners.Parameterized;
|
|
||||||
import org.libreccm.tests.categories.UnitTest;
|
|
||||||
import org.libreccm.testutils.EqualsVerifier;
|
|
||||||
import org.librecms.contentsection.AttachmentList;
|
|
||||||
import org.librecms.contentsection.ContentItem;
|
|
||||||
import org.librecms.contentsection.ContentSection;
|
|
||||||
import org.librecms.contentsection.ContentType;
|
|
||||||
import org.librecms.contentsection.ItemAttachment;
|
|
||||||
import org.scientificcms.publications.ArticleInJournal;
|
|
||||||
import org.scientificcms.publications.CollectedVolume;
|
|
||||||
import org.scientificcms.publications.Journal;
|
|
||||||
import org.scientificcms.publications.Publisher;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
|
||||||
*/
|
|
||||||
@RunWith(Parameterized.class)
|
|
||||||
@org.junit.experimental.categories.Category(UnitTest.class)
|
|
||||||
public class EqualsAndHashCodeTest extends EqualsVerifier {
|
|
||||||
|
|
||||||
@Parameterized.Parameters(name = "{0}")
|
|
||||||
public static Collection<Class<?>> data() {
|
|
||||||
|
|
||||||
return Arrays.asList(new Class<?>[]{
|
|
||||||
CollectedVolumeAsset.class,
|
|
||||||
JournalAsset.class,
|
|
||||||
ProceedingsAsset.class,
|
|
||||||
PublisherAsset.class
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public EqualsAndHashCodeTest(final Class<?> clazz) {
|
|
||||||
super(clazz);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void addPrefabValues(
|
|
||||||
final nl.jqno.equalsverifier.EqualsVerifier<?> verifier) {
|
|
||||||
|
|
||||||
final CollectedVolume volume1 = new CollectedVolume();
|
|
||||||
volume1.getTitle().addValue(Locale.ENGLISH, "Test 1");
|
|
||||||
final CollectedVolume volume2 = new CollectedVolume();
|
|
||||||
volume2.getTitle().addValue(Locale.ENGLISH, "Test 2");
|
|
||||||
verifier.withPrefabValues(CollectedVolume.class, volume1, volume2);
|
|
||||||
|
|
||||||
final CollectedVolumeAsset volumeAsset1 = new CollectedVolumeAsset();
|
|
||||||
volumeAsset1.setCollectedVolume(volume1);
|
|
||||||
final CollectedVolumeAsset volumeAsset2 = new CollectedVolumeAsset();
|
|
||||||
volumeAsset2.setCollectedVolume(volume2);
|
|
||||||
verifier.withPrefabValues(CollectedVolumeAsset.class,
|
|
||||||
volumeAsset1,
|
|
||||||
volumeAsset2);
|
|
||||||
|
|
||||||
final ContentSection section1 = new ContentSection();
|
|
||||||
section1.setDisplayName("section1");
|
|
||||||
final ContentSection section2 = new ContentSection();
|
|
||||||
section2.setDisplayName("section2");
|
|
||||||
verifier.withPrefabValues(ContentSection.class, section1, section2);
|
|
||||||
|
|
||||||
final ContentType type1 = new ContentType();
|
|
||||||
type1.setDisplayName("type1");
|
|
||||||
final ContentType type2 = new ContentType();
|
|
||||||
type2.setDisplayName("type2");
|
|
||||||
verifier.withPrefabValues(ContentType.class, type1, type2);
|
|
||||||
|
|
||||||
final ContentItem item1 = new ContentItem();
|
|
||||||
item1.setDisplayName("item1");
|
|
||||||
final ContentItem item2 = new ContentItem();
|
|
||||||
item2.setDisplayName("item2");
|
|
||||||
verifier.withPrefabValues(ContentItem.class, item1, item2);
|
|
||||||
|
|
||||||
final AttachmentList list1 = new AttachmentList();
|
|
||||||
list1.setName("list1");
|
|
||||||
final AttachmentList list2 = new AttachmentList();
|
|
||||||
list2.setName("list2");
|
|
||||||
verifier.withPrefabValues(AttachmentList.class, list1, list2);
|
|
||||||
|
|
||||||
final Journal journal1 = new Journal();
|
|
||||||
journal1.setTitle("Journal 1");
|
|
||||||
final Journal journal2 = new Journal();
|
|
||||||
journal2.setTitle("Journal 2");
|
|
||||||
verifier.withPrefabValues(Journal.class, journal1, journal2);
|
|
||||||
|
|
||||||
final ArticleInJournal article1 = new ArticleInJournal();
|
|
||||||
article1.getTitle().addValue(Locale.ENGLISH, "Article 1");
|
|
||||||
final ArticleInJournal article2 = new ArticleInJournal();
|
|
||||||
article2.getTitle().addValue(Locale.ENGLISH, "Article 2");
|
|
||||||
verifier.withPrefabValues(ArticleInJournal.class, article1, article2);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package org.scientificcms.publications.assets;
|
||||||
|
|
||||||
|
import nl.jqno.equalsverifier.EqualsVerifierApi;
|
||||||
|
import org.librecms.contentsection.ItemAttachment;
|
||||||
|
import org.scientificcms.publications.Publisher;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
public final class PrefabAssetsProvider {
|
||||||
|
|
||||||
|
private PrefabAssetsProvider() {
|
||||||
|
// Nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final void addPrefabAssetsAndAttachments(
|
||||||
|
final EqualsVerifierApi<?> verifier) {
|
||||||
|
|
||||||
|
final Publisher publisher1 = new Publisher();
|
||||||
|
publisher1.setName("publisher1");
|
||||||
|
final Publisher publisher2 = new Publisher();
|
||||||
|
publisher2.setName("publisher2");
|
||||||
|
verifier.withPrefabValues(Publisher.class, publisher1, publisher2);
|
||||||
|
|
||||||
|
final PublisherAsset publisherAsset1 = new PublisherAsset();
|
||||||
|
publisherAsset1.setPublisher(publisher1);
|
||||||
|
final PublisherAsset publisherAsset2 = new PublisherAsset();
|
||||||
|
publisherAsset2.setPublisher(publisher2);
|
||||||
|
verifier.withPrefabValues(PublisherAsset.class,
|
||||||
|
publisherAsset1,
|
||||||
|
publisherAsset2);
|
||||||
|
|
||||||
|
final ItemAttachment<PublisherAsset> attachment1
|
||||||
|
= new ItemAttachment<>();
|
||||||
|
attachment1.setAsset(publisherAsset1);
|
||||||
|
final ItemAttachment<PublisherAsset> attachment2
|
||||||
|
= new ItemAttachment<>();
|
||||||
|
attachment2.setAsset(publisherAsset2);
|
||||||
|
verifier.withPrefabValues(ItemAttachment.class,
|
||||||
|
attachment1,
|
||||||
|
attachment2);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,161 @@
|
||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package org.scientificcms.publications.contenttypes;
|
||||||
|
|
||||||
|
import nl.jqno.equalsverifier.EqualsVerifierApi;
|
||||||
|
import nl.jqno.equalsverifier.Warning;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.junit.runners.Parameterized;
|
||||||
|
import org.libreccm.categorization.Category;
|
||||||
|
import org.libreccm.core.CcmObject;
|
||||||
|
import org.libreccm.security.SecurityEntitiesPrefabProvider;
|
||||||
|
import org.libreccm.tests.categories.UnitTest;
|
||||||
|
import org.libreccm.testutils.EqualsVerifier;
|
||||||
|
import org.libreccm.workflow.Workflow;
|
||||||
|
import org.librecms.assets.Organization;
|
||||||
|
import org.librecms.contentsection.ContentItem;
|
||||||
|
import org.librecms.contentsection.ContentSection;
|
||||||
|
import org.librecms.lifecycle.Lifecycle;
|
||||||
|
import org.librecms.lifecycle.LifecycleDefinition;
|
||||||
|
import org.scientificcms.publications.CollectedVolume;
|
||||||
|
import org.scientificcms.publications.Journal;
|
||||||
|
import org.scientificcms.publications.Proceedings;
|
||||||
|
import org.scientificcms.publications.assets.PrefabAssetsProvider;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
@RunWith(Parameterized.class)
|
||||||
|
@org.junit.experimental.categories.Category(UnitTest.class)
|
||||||
|
public class EqualsAndHashCodeTest extends EqualsVerifier {
|
||||||
|
|
||||||
|
@Parameterized.Parameters(name = "{0}")
|
||||||
|
public static Collection<Class<?>> data() {
|
||||||
|
|
||||||
|
return Arrays.asList(new Class<?>[]{
|
||||||
|
ArticleInCollectedVolumeItem.class,
|
||||||
|
ArticleInJournalItem.class,
|
||||||
|
CollectedVolumeItem.class,
|
||||||
|
ExpertiseItem.class,
|
||||||
|
GreyLiteratureItem.class,
|
||||||
|
InProceedingsItem.class,
|
||||||
|
InternetArticleItem.class,
|
||||||
|
MonographItem.class,
|
||||||
|
ProceedingsItem.class,
|
||||||
|
TalkItem.class,
|
||||||
|
WorkingPaperItem.class
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public EqualsAndHashCodeTest(final Class<?> clazz) {
|
||||||
|
super(clazz);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void addSuppressWarnings(final EqualsVerifierApi<?> verifier) {
|
||||||
|
super.addSuppressWarnings(verifier);
|
||||||
|
verifier.suppress(Warning.REFERENCE_EQUALITY);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void addPrefabValues(
|
||||||
|
final nl.jqno.equalsverifier.EqualsVerifierApi<?> verifier) {
|
||||||
|
|
||||||
|
final CollectedVolume volume1 = new CollectedVolume();
|
||||||
|
volume1.getTitle().addValue(Locale.ENGLISH, "Test 1");
|
||||||
|
final CollectedVolume volume2 = new CollectedVolume();
|
||||||
|
volume2.getTitle().addValue(Locale.ENGLISH, "Test 2");
|
||||||
|
verifier.withPrefabValues(CollectedVolume.class, volume1, volume2);
|
||||||
|
|
||||||
|
final Journal journal1 = new Journal();
|
||||||
|
journal1.setTitle("Journal 1");
|
||||||
|
journal1.setFirstYear(1980);
|
||||||
|
final Journal journal2 = new Journal();
|
||||||
|
journal2.setTitle("Journal 2");
|
||||||
|
journal2.setFirstYear(2004);
|
||||||
|
verifier.withPrefabValues(Journal.class, journal1, journal2);
|
||||||
|
|
||||||
|
// final Publisher publisher1 = new Publisher();
|
||||||
|
// publisher1.setName("publisher1");
|
||||||
|
// final Publisher publisher2 = new Publisher();
|
||||||
|
// publisher2.setName("publisher2");
|
||||||
|
// verifier.withPrefabValues(Publisher.class, publisher1, publisher2);
|
||||||
|
final Organization organization1 = new Organization();
|
||||||
|
organization1.setName("Orga 1");
|
||||||
|
final Organization organization2 = new Organization();
|
||||||
|
organization2.setName("Orga 2");
|
||||||
|
verifier.withPrefabValues(Organization.class,
|
||||||
|
organization1,
|
||||||
|
organization2);
|
||||||
|
|
||||||
|
final Proceedings proceedings1 = new Proceedings();
|
||||||
|
proceedings1.getTitle().addValue(Locale.ENGLISH, "Proceedings 1");
|
||||||
|
final Proceedings proceedings2 = new Proceedings();
|
||||||
|
proceedings2.getTitle().addValue(Locale.ENGLISH, "Proceedings 2");
|
||||||
|
verifier.withPrefabValues(Proceedings.class,
|
||||||
|
proceedings1,
|
||||||
|
proceedings2);
|
||||||
|
|
||||||
|
final ContentSection section1 = new ContentSection();
|
||||||
|
section1.setDisplayName("section1");
|
||||||
|
final ContentSection section2 = new ContentSection();
|
||||||
|
section2.setDisplayName("section2");
|
||||||
|
verifier.withPrefabValues(ContentSection.class, section1, section2);
|
||||||
|
|
||||||
|
final Workflow workflow1 = new Workflow();
|
||||||
|
workflow1.getName().addValue(Locale.ENGLISH, "workflow1");
|
||||||
|
final Workflow workflow2 = new Workflow();
|
||||||
|
workflow2.getName().addValue(Locale.ENGLISH, "workflow2");
|
||||||
|
verifier.withPrefabValues(Workflow.class, workflow1, workflow2);
|
||||||
|
|
||||||
|
SecurityEntitiesPrefabProvider.addPrefabPermissions(verifier);
|
||||||
|
|
||||||
|
final Category category1 = new Category();
|
||||||
|
category1.setName("category1");
|
||||||
|
final Category category2 = new Category();
|
||||||
|
category2.setName("category2");
|
||||||
|
verifier.withPrefabValues(Category.class, category1, category2);
|
||||||
|
|
||||||
|
final CcmObject ccmObject1 = new CcmObject();
|
||||||
|
ccmObject1.setDisplayName("obj1");
|
||||||
|
final CcmObject ccmObject2 = new CcmObject();
|
||||||
|
ccmObject2.setDisplayName("obj2");
|
||||||
|
verifier.withPrefabValues(CcmObject.class, ccmObject1, ccmObject2);
|
||||||
|
|
||||||
|
final ContentItem item1 = new ContentItem();
|
||||||
|
item1.setDisplayName("item1");
|
||||||
|
final ContentItem item2 = new ContentItem();
|
||||||
|
item2.setDisplayName("item2");
|
||||||
|
verifier.withPrefabValues(ContentItem.class, item1, item2);
|
||||||
|
|
||||||
|
PrefabAssetsProvider.addPrefabAssetsAndAttachments(verifier);
|
||||||
|
|
||||||
|
final LifecycleDefinition lifecycleDef1 = new LifecycleDefinition();
|
||||||
|
lifecycleDef1.setDefinitionId(-100);
|
||||||
|
lifecycleDef1.getLabel().addValue(Locale.ENGLISH, "def1");
|
||||||
|
final LifecycleDefinition lifecycleDef2 = new LifecycleDefinition();
|
||||||
|
lifecycleDef2.setDefinitionId(-110);
|
||||||
|
lifecycleDef2.getLabel().addValue(Locale.ENGLISH, "def2");
|
||||||
|
verifier.withPrefabValues(LifecycleDefinition.class,
|
||||||
|
lifecycleDef1,
|
||||||
|
lifecycleDef2);
|
||||||
|
final Lifecycle lifecycle1 = new Lifecycle();
|
||||||
|
lifecycle1.setDefinition(lifecycleDef1);
|
||||||
|
lifecycle1.setStarted(true);
|
||||||
|
final Lifecycle lifecycle2 = new Lifecycle();
|
||||||
|
lifecycle2.setDefinition(lifecycleDef2);
|
||||||
|
lifecycle2.setStarted(false);
|
||||||
|
verifier.withPrefabValues(Lifecycle.class, lifecycle1, lifecycle2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,168 +0,0 @@
|
||||||
/*
|
|
||||||
* To change this license header, choose License Headers in Project Properties.
|
|
||||||
* To change this template file, choose Tools | Templates
|
|
||||||
* and open the template in the editor.
|
|
||||||
*/
|
|
||||||
package org.scientificcms.publications.contenttypes;
|
|
||||||
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.junit.runners.Parameterized;
|
|
||||||
import org.libreccm.tests.categories.UnitTest;
|
|
||||||
import org.libreccm.testutils.EqualsVerifier;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
|
||||||
*/
|
|
||||||
@RunWith(Parameterized.class)
|
|
||||||
@org.junit.experimental.categories.Category(UnitTest.class)
|
|
||||||
public class EqualsAndHashCodeTest extends EqualsVerifier {
|
|
||||||
|
|
||||||
@Parameterized.Parameters(name = "{0}")
|
|
||||||
public static Collection<Class<?>> data() {
|
|
||||||
|
|
||||||
return Arrays.asList(new Class<?>[]{
|
|
||||||
ArticleInCollectedVolumeItem.class,
|
|
||||||
ArticleInJournalItem.class,
|
|
||||||
CollectedVolumeItem.class,
|
|
||||||
ExpertiseItem.class,
|
|
||||||
GreyLiteratureItem.class,
|
|
||||||
InProceedingsItem.class,
|
|
||||||
InternetArticleItem.class,
|
|
||||||
MonographItem.class,
|
|
||||||
ProceedingsItem.class,
|
|
||||||
TalkItem.class,
|
|
||||||
WorkingPaperItem.class
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public EqualsAndHashCodeTest(final Class<?> clazz) {
|
|
||||||
super(clazz);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void addPrefabValues(
|
|
||||||
final nl.jqno.equalsverifier.EqualsVerifier<?> verifier) {
|
|
||||||
|
|
||||||
// final JournalAsset journal1 = new JournalAsset();
|
|
||||||
// journal1.setFirstYear(1953);
|
|
||||||
// journal1.setSymbol("foo");
|
|
||||||
//
|
|
||||||
// final JournalAsset journal2 = new JournalAsset();
|
|
||||||
// journal2.setSymbol("bar");
|
|
||||||
//
|
|
||||||
// verifier.withPrefabValues(JournalAsset.class, journal1, journal2);
|
|
||||||
//
|
|
||||||
// final PublisherAsset publisher1 = new PublisherAsset();
|
|
||||||
// publisher1.setName("Muster Verlag");
|
|
||||||
// publisher1.setPlace("Musterburg");
|
|
||||||
//
|
|
||||||
// final PublisherAsset publisher2 = new PublisherAsset();
|
|
||||||
// publisher2.setName("Example Press");
|
|
||||||
// publisher2.setPlace("Riverton");
|
|
||||||
//
|
|
||||||
// verifier.withPrefabValues(PublisherAsset.class, publisher1, publisher2);
|
|
||||||
//
|
|
||||||
// final ContentSection contentSection1 = new ContentSection();
|
|
||||||
// contentSection1.setObjectId(401);
|
|
||||||
// contentSection1.setDisplayName("section1");
|
|
||||||
//
|
|
||||||
// final ContentSection contentSection2 = new ContentSection();
|
|
||||||
// contentSection2.setObjectId(402);
|
|
||||||
// contentSection2.setDisplayName("section2");
|
|
||||||
//
|
|
||||||
// verifier.withPrefabValues(ContentSection.class,
|
|
||||||
// contentSection1,
|
|
||||||
// contentSection2);
|
|
||||||
//
|
|
||||||
// final ContentType contentType1 = new ContentType();
|
|
||||||
// contentType1.setObjectId(501);
|
|
||||||
// contentType1.setDisplayName("type-1");
|
|
||||||
//
|
|
||||||
// final ContentType contentType2 = new ContentType();
|
|
||||||
// contentType2.setObjectId(502);
|
|
||||||
// contentType2.setDisplayName("type-2");
|
|
||||||
//
|
|
||||||
// verifier.withPrefabValues(ContentType.class,
|
|
||||||
// contentType1,
|
|
||||||
// contentType2);
|
|
||||||
//
|
|
||||||
// final ContentItem item1 = new ContentItem();
|
|
||||||
// item1.setObjectId(601);
|
|
||||||
// item1.setDisplayName("item1");
|
|
||||||
//
|
|
||||||
// final ContentItem item2 = new ContentItem();
|
|
||||||
// item2.setObjectId(602);
|
|
||||||
// item2.setDisplayName("item2");
|
|
||||||
//
|
|
||||||
// verifier.withPrefabValues(ContentItem.class, item1, item2);
|
|
||||||
//
|
|
||||||
// final Lifecycle lifecycle1 = new Lifecycle();
|
|
||||||
// lifecycle1.setLifecycleId(801);
|
|
||||||
// lifecycle1.setStarted(true);
|
|
||||||
//
|
|
||||||
// final Lifecycle lifecycle2 = new Lifecycle();
|
|
||||||
// lifecycle2.setLifecycleId(802);
|
|
||||||
// lifecycle2.setStarted(false);
|
|
||||||
//
|
|
||||||
// verifier.withPrefabValues(Lifecycle.class, lifecycle1, lifecycle2);
|
|
||||||
//
|
|
||||||
// final Workflow workflow1 = new Workflow();
|
|
||||||
// final LocalizedString workflow1Name = new LocalizedString();
|
|
||||||
// workflow1Name.addValue(Locale.ROOT, "workflow1");
|
|
||||||
// workflow1.setName(workflow1Name);
|
|
||||||
//
|
|
||||||
// final Workflow workflow2 = new Workflow();
|
|
||||||
// final LocalizedString workflow2Name = new LocalizedString();
|
|
||||||
// workflow2Name.addValue(Locale.ROOT, "workflow2");
|
|
||||||
// workflow2.setName(workflow2Name);
|
|
||||||
//
|
|
||||||
// verifier.withPrefabValues(Workflow.class, workflow1, workflow2);
|
|
||||||
//
|
|
||||||
// final CcmObject ccmObj1 = new CcmObject();
|
|
||||||
// ccmObj1.setObjectId(1001);
|
|
||||||
// ccmObj1.setDisplayName("obj1");
|
|
||||||
//
|
|
||||||
// final CcmObject ccmObj2 = new CcmObject();
|
|
||||||
// ccmObj2.setObjectId(1002);
|
|
||||||
// ccmObj2.setDisplayName("obj2");
|
|
||||||
//
|
|
||||||
// verifier.withPrefabValues(CcmObject.class, ccmObj1, ccmObj2);
|
|
||||||
//
|
|
||||||
// SecurityEntitiesPrefabProvider.addPrefabEntities(verifier);
|
|
||||||
//
|
|
||||||
// final Category category1 = new Category();
|
|
||||||
// category1.setObjectId(5001);
|
|
||||||
// category1.setName("category1");
|
|
||||||
//
|
|
||||||
// final Category category2 = new Category();
|
|
||||||
// category2.setCategoryOrder(5002);
|
|
||||||
// category2.setName("category2");
|
|
||||||
//
|
|
||||||
// verifier.withPrefabValues(Category.class, category1, category2);
|
|
||||||
//
|
|
||||||
// final Organization organization1 = new Organization();
|
|
||||||
// organization1.setName("orga1");
|
|
||||||
//
|
|
||||||
// final Organization organization2 = new Organization();
|
|
||||||
// organization1.setName("orga2");
|
|
||||||
//
|
|
||||||
// verifier.withPrefabValues(Organization.class,
|
|
||||||
// organization1,
|
|
||||||
// organization2);
|
|
||||||
//
|
|
||||||
// final ItemAttachment<?> itemAttachment1 = new ItemAttachment<>();
|
|
||||||
// itemAttachment1.setUuid("927ac9de-029d-4233-9015-1135eb861c34");
|
|
||||||
//
|
|
||||||
// final ItemAttachment<?> itemAttachment2 = new ItemAttachment<>();
|
|
||||||
// itemAttachment2.setUuid("d1bd98a1-75c2-4e61-8f9f-2e2eadd30812");
|
|
||||||
//
|
|
||||||
// verifier.withPrefabValues(ItemAttachment.class,
|
|
||||||
// itemAttachment1,
|
|
||||||
// itemAttachment2);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.security;
|
package org.libreccm.security;
|
||||||
|
|
||||||
import nl.jqno.equalsverifier.EqualsVerifier;
|
import nl.jqno.equalsverifier.EqualsVerifierApi;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -17,7 +17,7 @@ public final class SecurityEntitiesPrefabProvider {
|
||||||
// Nothing
|
// Nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addPrefabEntities(final EqualsVerifier<?> verifier) {
|
public static void addPrefabEntities(final EqualsVerifierApi<?> verifier) {
|
||||||
|
|
||||||
final Role role1 = new Role();
|
final Role role1 = new Role();
|
||||||
role1.setRoleId(2001);
|
role1.setRoleId(2001);
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
*/
|
*/
|
||||||
package org.scientificcms.contenttypes.sciproject;
|
package org.scientificcms.contenttypes.sciproject;
|
||||||
|
|
||||||
|
import nl.jqno.equalsverifier.EqualsVerifierApi;
|
||||||
import nl.jqno.equalsverifier.Warning;
|
import nl.jqno.equalsverifier.Warning;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.junit.runners.Parameterized;
|
import org.junit.runners.Parameterized;
|
||||||
|
|
@ -52,8 +53,7 @@ public class EqualsAndHashCodeTest extends EqualsVerifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void addPrefabValues(
|
protected void addPrefabValues(final EqualsVerifierApi<?> verifier) {
|
||||||
final nl.jqno.equalsverifier.EqualsVerifier<?> verifier) {
|
|
||||||
|
|
||||||
final Contact contact1 = new Contact();
|
final Contact contact1 = new Contact();
|
||||||
contact1.setContactId(10);
|
contact1.setContactId(10);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue