Skip to content

Remove lombok from test cases. #1778

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,13 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.couchbase.core.query.Query;
import org.springframework.data.couchbase.core.query.QueryCriteria;
import org.springframework.data.couchbase.domain.Address;
import org.springframework.data.couchbase.domain.Airport;
import org.springframework.data.couchbase.domain.AssessmentDO;
import org.springframework.data.couchbase.domain.Course;
import org.springframework.data.couchbase.domain.Config;
import org.springframework.data.couchbase.domain.Course;
import org.springframework.data.couchbase.domain.NaiveAuditorAware;
import org.springframework.data.couchbase.domain.PersonWithMaps;
import org.springframework.data.couchbase.domain.Submission;
Expand Down Expand Up @@ -152,7 +151,7 @@ void findById() {
person1.setReleaseVersions(releaseVersions);
couchbaseTemplate.upsertById(PersonWithMaps.class).one(person1);
PersonWithMaps person2 = couchbaseTemplate.findById(PersonWithMaps.class).one(person1.getId());
assertEquals(person1, person2);
assertEquals(person1, person2);
couchbaseTemplate.removeById(PersonWithMaps.class).oneEntity(person1);
}

Expand Down Expand Up @@ -184,11 +183,11 @@ void findAssessmentDO() {
ado = couchbaseTemplate.upsertById(AssessmentDO.class).one(ado);

Query specialUsers = new Query(QueryCriteria.where(i("id")).is(ado.getId()));
final List<AssessmentDO> foundUsers = couchbaseTemplate.findByQuery(AssessmentDO.class)
final List<AssessmentDO> assementDOs = couchbaseTemplate.findByQuery(AssessmentDO.class)
.withConsistency(REQUEST_PLUS).matching(specialUsers).all();
assertEquals("123", foundUsers.get(0).getId(), "id");
assertEquals("44444444", foundUsers.get(0).getDocumentId(), "documentId");
assertEquals(ado, foundUsers.get(0));
assertEquals("123", assementDOs.get(0).getId(), "id");
assertEquals("44444444", assementDOs.get(0).getDocumentId(), "documentId");
assertEquals(ado, assementDOs.get(0));
couchbaseTemplate.removeById(AssessmentDO.class).one(ado.getDocumentId());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@

package org.springframework.data.couchbase.domain;

import lombok.Data;
import lombok.NoArgsConstructor;

import org.springframework.data.annotation.Id;
import org.springframework.data.couchbase.core.mapping.Document;
import org.springframework.data.couchbase.core.mapping.Field;
Expand All @@ -30,8 +27,6 @@
* @author Michael Reiche
*/
@Document()
@Data
@NoArgsConstructor
public class AssessmentDO {
@Id @GeneratedValue(strategy = GenerationStrategy.USE_ATTRIBUTES) private String documentId;

Expand All @@ -40,4 +35,38 @@ public class AssessmentDO {
@Field("docType") private String documentType;

@Field private String id;

public String getId() {
return id;
}

public String getDocumentId() {
return documentId;
}

public void setEventTimestamp(long eventTimestamp) {
this.eventTimestamp = eventTimestamp;
}

public void setId(String id) {
this.id = id;
}

public boolean equals(Object other) {
if (other == null || !(other instanceof AssessmentDO)) {
return false;
}
AssessmentDO that = (AssessmentDO) other;
return equals(this.id, that.id) && equals(this.documentId, that.documentId)
&& equals(this.eventTimestamp, that.eventTimestamp) && equals(this.documentType, that.documentType);
}

boolean equals(Object s0, Object s1) {
if (s0 == null && s1 == null || s0 == s1) {
return true;
}
Object sa = s0 != null ? s0 : s1;
Object sb = s0 != null ? s1 : s0;
return sa.equals(sb);
}
}
Original file line number Diff line number Diff line change
@@ -1,28 +1,42 @@
package org.springframework.data.couchbase.domain;

import lombok.Getter;
import lombok.Setter;
import org.springframework.data.couchbase.core.mapping.Document;

import java.util.List;

import org.springframework.data.couchbase.core.mapping.Document;

@Document
public class MutableUser extends User{
public MutableUser(String id, String firstname, String lastname) {
super(id, firstname, lastname);
}

@Getter
@Setter

private Address address;

@Getter
@Setter
private MutableUser subuser;

@Getter
@Setter
private List<String> roles;



public void setRoles(List<String> roles) {
this.roles = roles;
}

public List<String> getRoles() {
return roles;
}

public void setAddress(Address address) {
this.address = address;
}

public Address getAddress() {
return address;
}

public void setSubuser(MutableUser subuser) {
this.subuser = subuser;
}

public MutableUser getSubuser() {
return subuser;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
*/
package org.springframework.data.couchbase.domain;

import lombok.Value;
import lombok.With;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Version;
import org.springframework.data.couchbase.core.mapping.Document;
Expand All @@ -30,16 +28,13 @@
* @author Michael Reiche
*/

@Value
@Document
public class PersonValue {
@Id @GeneratedValue(strategy = GenerationStrategy.UNIQUE)
@With String id;
@Version
@With
long version;
@Field String firstname;
@Field String lastname;
private final String id;
@Version private final long version;
@Field private final String firstname;
@Field private final String lastname;

public PersonValue(String id, long version, String firstname, String lastname) {
this.id = id;
Expand All @@ -48,15 +43,56 @@ public PersonValue(String id, long version, String firstname, String lastname) {
this.lastname = lastname;
}

public PersonValue withId(String id) {
return new PersonValue(id, this.version, this.firstname, this.lastname);
}

public PersonValue withVersion(Long version) {
return new PersonValue(this.id, version, this.firstname, this.lastname);
}

public PersonValue withFirstname(String firstname) {
return new PersonValue(this.id, this.version, firstname, this.lastname);
}

public PersonValue withLastname(String lastname) {
return new PersonValue(this.id, this.version, this.firstname, lastname);
}

public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("PersonValue : {");
sb.append(" id : " + getId());
sb.append(" id : " + id);
sb.append(", version : " + version);
sb.append(", firstname : " + firstname);
sb.append(", lastname : " + lastname);
sb.append(" }");
return sb.toString();
}

public String getId() {
return id;
}

public long getVersion() {
return version;
}

public boolean equals(Object other) {
if (other == null || !(other instanceof PersonValue)) {
return false;
}
PersonValue that = (PersonValue) other;
return equals(this.getId(), that.getId()) && equals(this.version, that.version)
&& equals(this.firstname, that.firstname) && equals(this.lastname, that.lastname);
}

boolean equals(Object s0, Object s1) {
if (s0 == null && s1 == null || s0 == s1) {
return true;
}
Object sa = s0 != null ? s0 : s1;
Object sb = s0 != null ? s1 : s0;
return sa.equals(sb);
}
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
package org.springframework.data.couchbase.domain;

import com.couchbase.client.core.deps.com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import java.util.Map;
import java.util.Set;

import org.springframework.data.annotation.Id;
import org.springframework.data.couchbase.core.mapping.Document;
import org.springframework.data.couchbase.core.mapping.Field;

import java.util.Map;
import java.util.Set;
import com.couchbase.client.core.deps.com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;

@Data
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
@Document
Expand All @@ -24,6 +23,40 @@ public class PersonWithMaps {
private Map<String, Map<String,String>> releaseVersions;

public PersonWithMaps(){
}

public void setId(String id) {
this.id = id;
}

public void setVersions(Map<String, Set<String>> versions) {
this.versions = versions;
}

public void setReleaseVersions(Map<String, Map<String, String>> releaseVersions) {
this.releaseVersions = releaseVersions;
}

public String getId() {
return id;
}

public boolean equals(Object other) {
if (other == null || !(other instanceof PersonWithMaps)) {
return false;
}
PersonWithMaps that = (PersonWithMaps) other;
return equals(this.getId(), that.getId()) && equals(this.versions, that.versions)
&& equals(this.releaseVersions, that.releaseVersions);
}

boolean equals(Object s0, Object s1) {
if (s0 == null && s1 == null || s0 == s1) {
return true;
}
Object sa = s0 != null ? s0 : s1;
Object sb = s0 != null ? s1 : s0;
return sa.equals(sb);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@

package org.springframework.data.couchbase.domain;

import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.ToString;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Version;
import org.springframework.data.couchbase.core.mapping.Document;
Expand All @@ -31,9 +28,6 @@
*
* @author Michael Reiche
*/
@Getter
@ToString
@EqualsAndHashCode
@Document
public class SubscriptionToken {
private @Id
Expand Down Expand Up @@ -72,4 +66,12 @@ public SubscriptionToken(
public void setType(String type) {
type = type;
}

public long getVersion() {
return version;
}

public String getId() {
return id;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

package org.springframework.data.couchbase.domain;

import lombok.Data;

import java.util.List;

import org.springframework.data.annotation.TypeAlias;
Expand All @@ -31,7 +29,6 @@
*
* @author Michael Reiche
*/
@Data
@Document
@TypeAlias("user")
@CompositeQueryIndex(fields = { "id", "username", "email" })
Expand All @@ -56,4 +53,43 @@ public void setCourses(List<Course> courses) {
this.courses = courses;
}

public void setId(String id) {
this.id = id;
}

public void setUsername(String username) {
this.username = username;
}

public String getId() {
return id;
}

public Address getAddress() {
return address;
}

public List<Course> getCourses() {
return courses;
}

public String getUsername() {
return username;
}

public List<Address> getOtherAddresses() {
return otherAddresses;
}

public List<Submission> getSubmissions() {
return submissions;
}

public void setRoles(List<String> roles) {
this.roles = roles;
}

public void setAddress(Address address) {
this.address = address;
}
}
Loading