ignite-1282 - Fixing model to run benchmarks with portable marshaller.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/230a6299 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/230a6299 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/230a6299 Branch: refs/heads/ignite-1753-1282 Commit: 230a6299489b936086c81400d7234c7fbdef5e55 Parents: e4b128e Author: Alexey Goncharuk <[email protected]> Authored: Wed Nov 4 13:43:39 2015 +0300 Committer: Alexey Goncharuk <[email protected]> Committed: Wed Nov 4 13:43:39 2015 +0300 ---------------------------------------------------------------------- .../yardstick/cache/model/Organization.java | 19 ++++++++++++++-- .../ignite/yardstick/cache/model/Person.java | 24 +++++++++++++++++++- .../ignite/yardstick/cache/model/SampleKey.java | 16 ++++++++++++- .../yardstick/cache/model/SampleValue.java | 16 ++++++++++++- 4 files changed, 70 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/230a6299/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Organization.java ---------------------------------------------------------------------- diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Organization.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Organization.java index 10d09ce..efb71d6 100644 --- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Organization.java +++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Organization.java @@ -22,11 +22,15 @@ import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import org.apache.ignite.cache.query.annotations.QuerySqlField; +import org.apache.ignite.portable.PortableException; +import org.apache.ignite.portable.PortableMarshalAware; +import org.apache.ignite.portable.PortableReader; +import org.apache.ignite.portable.PortableWriter; /** * Organization record used for query test. */ -public class Organization implements Externalizable { +public class Organization implements Externalizable, PortableMarshalAware { /** Organization ID. */ @QuerySqlField(index = true) private int id; @@ -94,9 +98,20 @@ public class Organization implements Externalizable { } /** {@inheritDoc} */ + @Override public void writePortable(PortableWriter writer) throws PortableException { + writer.writeInt("id", id); + writer.writeString("name", name); + } + + /** {@inheritDoc} */ + @Override public void readPortable(PortableReader reader) throws PortableException { + id = reader.readInt("id"); + name = reader.readString("name"); + } + + /** {@inheritDoc} */ @Override public boolean equals(Object o) { return this == o || (o instanceof Organization) && id == ((Organization)o).id; - } /** {@inheritDoc} */ http://git-wip-us.apache.org/repos/asf/ignite/blob/230a6299/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Person.java ---------------------------------------------------------------------- diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Person.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Person.java index 84360f6..e826d65 100644 --- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Person.java +++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Person.java @@ -22,11 +22,15 @@ import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import org.apache.ignite.cache.query.annotations.QuerySqlField; +import org.apache.ignite.portable.PortableException; +import org.apache.ignite.portable.PortableMarshalAware; +import org.apache.ignite.portable.PortableReader; +import org.apache.ignite.portable.PortableWriter; /** * Person record used for query test. */ -public class Person implements Externalizable { +public class Person implements Externalizable, PortableMarshalAware { /** Person ID. */ @QuerySqlField(index = true) private int id; @@ -172,6 +176,24 @@ public class Person implements Externalizable { } /** {@inheritDoc} */ + @Override public void writePortable(PortableWriter writer) throws PortableException { + writer.writeInt("id", id); + writer.writeInt("orgId", orgId); + writer.writeString("firstName", firstName); + writer.writeString("lastName", lastName); + writer.writeDouble("salary", salary); + } + + /** {@inheritDoc} */ + @Override public void readPortable(PortableReader reader) throws PortableException { + id = reader.readInt("id"); + orgId = reader.readInt("orgId"); + firstName = reader.readString("firstName"); + lastName = reader.readString("lastName"); + salary = reader.readDouble("salary"); + } + + /** {@inheritDoc} */ @Override public boolean equals(Object o) { return this == o || (o instanceof Person) && id == ((Person)o).id; } http://git-wip-us.apache.org/repos/asf/ignite/blob/230a6299/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/SampleKey.java ---------------------------------------------------------------------- diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/SampleKey.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/SampleKey.java index 9b65985..5fa9dea 100644 --- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/SampleKey.java +++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/SampleKey.java @@ -21,11 +21,15 @@ import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; +import org.apache.ignite.portable.PortableException; +import org.apache.ignite.portable.PortableMarshalAware; +import org.apache.ignite.portable.PortableReader; +import org.apache.ignite.portable.PortableWriter; /** * Key class for benchmark. */ -public class SampleKey implements Externalizable { +public class SampleKey implements Externalizable, PortableMarshalAware { /** */ private int id; @@ -66,6 +70,16 @@ public class SampleKey implements Externalizable { } /** {@inheritDoc} */ + @Override public void writePortable(PortableWriter writer) throws PortableException { + writer.writeInt("id", id); + } + + /** {@inheritDoc} */ + @Override public void readPortable(PortableReader reader) throws PortableException { + id = reader.readInt("id"); + } + + /** {@inheritDoc} */ @Override public boolean equals(Object o) { if (this == o) return true; http://git-wip-us.apache.org/repos/asf/ignite/blob/230a6299/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/SampleValue.java ---------------------------------------------------------------------- diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/SampleValue.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/SampleValue.java index 81b0225..f15d671 100644 --- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/SampleValue.java +++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/SampleValue.java @@ -21,11 +21,15 @@ import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; +import org.apache.ignite.portable.PortableException; +import org.apache.ignite.portable.PortableMarshalAware; +import org.apache.ignite.portable.PortableReader; +import org.apache.ignite.portable.PortableWriter; /** * Entity class for benchmark. */ -public class SampleValue implements Externalizable { +public class SampleValue implements Externalizable, PortableMarshalAware { /** */ private int id; @@ -66,6 +70,16 @@ public class SampleValue implements Externalizable { } /** {@inheritDoc} */ + @Override public void writePortable(PortableWriter writer) throws PortableException { + writer.writeInt("id", id); + } + + /** {@inheritDoc} */ + @Override public void readPortable(PortableReader reader) throws PortableException { + id = reader.readInt("id"); + } + + /** {@inheritDoc} */ @Override public String toString() { return "Value [id=" + id + ']'; }
