ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [36/50] incubator-ignite git commit: # IGNITE-61 - Test fix
Date Tue, 10 Feb 2015 13:02:33 GMT
# IGNITE-61 - 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/f3c503ed
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/f3c503ed
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/f3c503ed

Branch: refs/heads/ignite-204
Commit: f3c503ed5a5bb04514458d6b422bcb880dd9bbc0
Parents: 150e25b
Author: Valentin Kulichenko <vkulichenko@gridgain.com>
Authored: Mon Feb 9 19:12:52 2015 -0800
Committer: Valentin Kulichenko <vkulichenko@gridgain.com>
Committed: Mon Feb 9 19:12:52 2015 -0800

----------------------------------------------------------------------
 .../testframework/GridSpiTestContext.java       | 32 ++++++++++++++------
 1 file changed, 23 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f3c503ed/modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java
b/modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java
index 97cb488..80b9b96 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java
@@ -61,6 +61,12 @@ public class GridSpiTestContext implements IgniteSpiContext {
     /** */
     private final ConcurrentMap<String, Map> cache = new ConcurrentHashMap<>();
 
+    /** */
+    private MessageFormatter formatter;
+
+    /** */
+    private MessageFactory factory;
+
     /** {@inheritDoc} */
     @Override public Collection<ClusterNode> remoteNodes() {
         return rmtNodes;
@@ -505,21 +511,29 @@ public class GridSpiTestContext implements IgniteSpiContext {
         return null;
     }
 
+    /** {@inheritDoc} */
     @Override public MessageFormatter messageFormatter() {
-        return new MessageFormatter() {
-            @Override public MessageWriter writer() {
-                return new DirectMessageWriter();
-            }
+        if (formatter == null) {
+            formatter = new MessageFormatter() {
+                @Override public MessageWriter writer() {
+                    return new DirectMessageWriter();
+                }
 
-            @Override public MessageReader reader() {
-                throw new UnsupportedOperationException();
-            }
-        };
+                @Override public MessageReader reader() {
+                    return new DirectMessageReader(messageFactory());
+                }
+            };
+        }
+
+        return formatter;
     }
 
     /** {@inheritDoc} */
     @Override public MessageFactory messageFactory() {
-        return new GridIoMessageFactory(messageFormatter(), null);
+        if (factory == null)
+            factory = new GridIoMessageFactory(messageFormatter(), null);
+
+        return factory;
     }
 
     /**


Mime
View raw message