DATACASS-85 - WIP
Fixed integration test to comply with new EntityMetadataVerifier.
This commit is contained in:
@@ -15,12 +15,13 @@
|
||||
*/
|
||||
package org.springframework.data.cassandra.test.integration.composites;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import org.springframework.cassandra.core.PrimaryKeyType;
|
||||
import org.springframework.data.cassandra.mapping.CassandraType;
|
||||
import org.springframework.data.cassandra.mapping.PrimaryKeyClass;
|
||||
import org.springframework.data.cassandra.mapping.PrimaryKeyColumn;
|
||||
import org.springframework.data.cassandra.mapping.CassandraType;
|
||||
|
||||
import com.datastax.driver.core.DataType;
|
||||
|
||||
@@ -33,7 +34,7 @@ import com.datastax.driver.core.DataType;
|
||||
* @author Alex Shvid
|
||||
*/
|
||||
@PrimaryKeyClass
|
||||
public class NotificationPK {
|
||||
public class NotificationPK implements Serializable {
|
||||
|
||||
/*
|
||||
* Row ID
|
||||
@@ -64,4 +65,35 @@ public class NotificationPK {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((time == null) ? 0 : time.hashCode());
|
||||
result = prime * result + ((username == null) ? 0 : username.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
NotificationPK other = (NotificationPK) obj;
|
||||
if (time == null) {
|
||||
if (other.time != null)
|
||||
return false;
|
||||
} else if (!time.equals(other.time))
|
||||
return false;
|
||||
if (username == null) {
|
||||
if (other.username != null)
|
||||
return false;
|
||||
} else if (!username.equals(other.username))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.springframework.data.cassandra.test.integration.composites;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import org.springframework.cassandra.core.PrimaryKeyType;
|
||||
@@ -32,7 +33,7 @@ import org.springframework.data.cassandra.mapping.PrimaryKeyColumn;
|
||||
*/
|
||||
|
||||
@PrimaryKeyClass
|
||||
public class PostPK {
|
||||
public class PostPK implements Serializable {
|
||||
|
||||
@PrimaryKeyColumn(ordinal = 0, type = PrimaryKeyType.PARTITIONED)
|
||||
private String author;
|
||||
@@ -56,4 +57,35 @@ public class PostPK {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((author == null) ? 0 : author.hashCode());
|
||||
result = prime * result + ((time == null) ? 0 : time.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
PostPK other = (PostPK) obj;
|
||||
if (author == null) {
|
||||
if (other.author != null)
|
||||
return false;
|
||||
} else if (!author.equals(other.author))
|
||||
return false;
|
||||
if (time == null) {
|
||||
if (other.time != null)
|
||||
return false;
|
||||
} else if (!time.equals(other.time))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.springframework.data.cassandra.test.integration.composites;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import org.springframework.cassandra.core.PrimaryKeyType;
|
||||
@@ -32,7 +33,7 @@ import org.springframework.data.cassandra.mapping.PrimaryKeyColumn;
|
||||
*/
|
||||
|
||||
@PrimaryKeyClass
|
||||
public class TimelinePK {
|
||||
public class TimelinePK implements Serializable {
|
||||
|
||||
/*
|
||||
* Row ID
|
||||
@@ -62,4 +63,35 @@ public class TimelinePK {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((time == null) ? 0 : time.hashCode());
|
||||
result = prime * result + ((username == null) ? 0 : username.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
TimelinePK other = (TimelinePK) obj;
|
||||
if (time == null) {
|
||||
if (other.time != null)
|
||||
return false;
|
||||
} else if (!time.equals(other.time))
|
||||
return false;
|
||||
if (username == null) {
|
||||
if (other.username != null)
|
||||
return false;
|
||||
} else if (!username.equals(other.username))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ package org.springframework.data.cassandra.test.integration.mapping;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -56,13 +57,45 @@ public class CassandraCompositePrimaryKeyIntegrationTests {
|
||||
private static final CassandraSimpleTypeHolder SIMPLE_TYPE_HOLDER = new CassandraSimpleTypeHolder();
|
||||
|
||||
@PrimaryKeyClass
|
||||
static class Key {
|
||||
static class Key implements Serializable {
|
||||
|
||||
@PrimaryKeyColumn(ordinal = 0, type = PrimaryKeyType.PARTITIONED)
|
||||
String z;
|
||||
|
||||
@PrimaryKeyColumn(ordinal = 1, type = PrimaryKeyType.CLUSTERED)
|
||||
String a;
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((a == null) ? 0 : a.hashCode());
|
||||
result = prime * result + ((z == null) ? 0 : z.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Key other = (Key) obj;
|
||||
if (a == null) {
|
||||
if (other.a != null)
|
||||
return false;
|
||||
} else if (!a.equals(other.a))
|
||||
return false;
|
||||
if (z == null) {
|
||||
if (other.z != null)
|
||||
return false;
|
||||
} else if (!z.equals(other.z))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Table
|
||||
|
||||
Reference in New Issue
Block a user