ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vkuliche...@apache.org
Subject [48/50] [abbrv] incubator-ignite git commit: # ignite-nio - Test fix
Date Sun, 15 Feb 2015 08:42:30 GMT
# ignite-nio - Test fix


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/497fc876
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/497fc876
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/497fc876

Branch: refs/heads/sprint-1
Commit: 497fc8761e158c11cecd83c7d2606d6dd059b5cb
Parents: b46cea8
Author: Valentin Kulichenko <vkulichenko@gridgain.com>
Authored: Sun Feb 15 00:23:23 2015 -0800
Committer: Valentin Kulichenko <vkulichenko@gridgain.com>
Committed: Sun Feb 15 00:23:23 2015 -0800

----------------------------------------------------------------------
 .../spi/communication/GridTestMessage.java      | 138 +++++++++----------
 1 file changed, 69 insertions(+), 69 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/497fc876/modules/core/src/test/java/org/apache/ignite/spi/communication/GridTestMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/GridTestMessage.java
b/modules/core/src/test/java/org/apache/ignite/spi/communication/GridTestMessage.java
index 82b3030..97c7f4f 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/communication/GridTestMessage.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/GridTestMessage.java
@@ -95,81 +95,81 @@ public class GridTestMessage extends MessageAdapter {
 
     /** {@inheritDoc} */
     @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
-//        writer.setBuffer(buf);
-//
-//        if (!typeWritten) {
-//            if (!writer.writeByte(null, directType()))
-//                return false;
-//
-//            typeWritten = true;
-//        }
-//
-//        switch (state) {
-//            case 0:
-//                if (!writer.writeUuid(null, srcNodeId))
-//                    return false;
-//
-//                state++;
-//
-//            case 1:
-//                if (!writer.writeLong(null, msgId))
-//                    return false;
-//
-//                state++;
-//
-//            case 2:
-//                if (!writer.writeLong(null, resId))
-//                    return false;
-//
-//                state++;
-//
-//            case 3:
-//                if (!writer.writeByteArray(null, payload))
-//                    return false;
-//
-//                state++;
-//        }
+        writer.setBuffer(buf);
+
+        if (!writer.isTypeWritten()) {
+            if (!writer.writeByte(null, directType()))
+                return false;
+
+            writer.onTypeWritten();
+        }
+
+        switch (writer.state()) {
+            case 0:
+                if (!writer.writeUuid(null, srcNodeId))
+                    return false;
+
+                writer.incrementState();
+
+            case 1:
+                if (!writer.writeLong(null, msgId))
+                    return false;
+
+                writer.incrementState();
+
+            case 2:
+                if (!writer.writeLong(null, resId))
+                    return false;
+
+                writer.incrementState();
+
+            case 3:
+                if (!writer.writeByteArray(null, payload))
+                    return false;
+
+                writer.incrementState();
+        }
 
         return true;
     }
 
     /** {@inheritDoc} */
     @Override public boolean readFrom(ByteBuffer buf) {
-//        reader.setBuffer(buf);
-//
-//        switch (state) {
-//            case 0:
-//                srcNodeId = reader.readUuid(null);
-//
-//                if (!reader.isLastRead())
-//                    return false;
-//
-//                state++;
-//
-//            case 1:
-//                msgId = reader.readLong(null);
-//
-//                if (!reader.isLastRead())
-//                    return false;
-//
-//                state++;
-//
-//            case 2:
-//                resId = reader.readLong(null);
-//
-//                if (!reader.isLastRead())
-//                    return false;
-//
-//                state++;
-//
-//            case 3:
-//                payload = reader.readByteArray(null);
-//
-//                if (!reader.isLastRead())
-//                    return false;
-//
-//                state++;
-//        }
+        reader.setBuffer(buf);
+
+        switch (readState) {
+            case 0:
+                srcNodeId = reader.readUuid(null);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                readState++;
+
+            case 1:
+                msgId = reader.readLong(null);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                readState++;
+
+            case 2:
+                resId = reader.readLong(null);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                readState++;
+
+            case 3:
+                payload = reader.readByteArray(null);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                readState++;
+        }
 
         return true;
     }


Mime
View raw message