mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-18 14:58:47 +00:00
No effective change - sys out for CI server - add ReadAuditQueryPlan equals/hashCode for CI issue
This commit is contained in:
1 parent
1d6e480402
commit
90a794fca5
3 files changed
+42
-1
No files matched your search
@@ -74,4 +74,23 @@ public class ReadAuditQueryPlan {
|
|||||||
public void setSql(String sql) {
|
public void setSql(String sql) {
|
||||||
this.sql = sql;
|
this.sql = sql;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
|
ReadAuditQueryPlan that = (ReadAuditQueryPlan) o;
|
||||||
|
if (!beanType.equals(that.beanType)) return false;
|
||||||
|
if (!queryKey.equals(that.queryKey)) return false;
|
||||||
|
return sql.equals(that.sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int result = beanType.hashCode();
|
||||||
|
result = 31 * result + queryKey.hashCode();
|
||||||
|
result = 31 * result + sql.hashCode();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.avaje.ebean.event.readaudit;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertNotEquals;
|
||||||
|
|
||||||
|
public class ReadAuditQueryPlanTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testEquals() {
|
||||||
|
|
||||||
|
ReadAuditQueryPlan plan1 = new ReadAuditQueryPlan("org.Bean", "queryKey", "select id from foo");
|
||||||
|
|
||||||
|
assertEquals(plan1, new ReadAuditQueryPlan("org.Bean", "queryKey", "select id from foo"));
|
||||||
|
assertNotEquals(plan1, new ReadAuditQueryPlan("org.Bean", "queryKey", "select id from Notfoo"));
|
||||||
|
assertNotEquals(plan1, new ReadAuditQueryPlan("org.Bean", "notQueryKey", "select id from foo"));
|
||||||
|
assertNotEquals(plan1, new ReadAuditQueryPlan("org.NotBean", "queryKey", "select id from foo"));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -20,6 +20,7 @@ import org.junit.Before;
|
|||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -358,7 +359,7 @@ public class TestReadAudit extends BaseTestCase {
|
|||||||
|
|
||||||
class TDReadAuditLogger implements ReadAuditLogger {
|
class TDReadAuditLogger implements ReadAuditLogger {
|
||||||
|
|
||||||
List<ReadAuditQueryPlan> plans = new ArrayList<ReadAuditQueryPlan>();
|
Set<ReadAuditQueryPlan> plans = new HashSet<ReadAuditQueryPlan>();
|
||||||
List<ReadEvent> beans = new ArrayList<ReadEvent>();
|
List<ReadEvent> beans = new ArrayList<ReadEvent>();
|
||||||
List<ReadEvent> many = new ArrayList<ReadEvent>();
|
List<ReadEvent> many = new ArrayList<ReadEvent>();
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user