ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agoncha...@apache.org
Subject [26/34] ignite git commit: ignite-3477-master fix MarshallerContextSelfTest.testOnUpdated
Date Thu, 30 Mar 2017 17:25:36 GMT
ignite-3477-master fix MarshallerContextSelfTest.testOnUpdated


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

Branch: refs/heads/ignite-3477-master
Commit: c48e3d6288226737b1b0e9ad698481dce9dbdbf8
Parents: 3fcab0d
Author: Dmitriy Govorukhin <dgovorukhin@gridgain.com>
Authored: Thu Mar 30 15:23:38 2017 +0300
Committer: Dmitriy Govorukhin <dgovorukhin@gridgain.com>
Committed: Thu Mar 30 15:23:38 2017 +0300

----------------------------------------------------------------------
 .../ignite/marshaller/MarshallerContextSelfTest.java   | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/c48e3d62/modules/core/src/test/java/org/apache/ignite/marshaller/MarshallerContextSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/marshaller/MarshallerContextSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/marshaller/MarshallerContextSelfTest.java
index 5883898..48d971e 100644
--- a/modules/core/src/test/java/org/apache/ignite/marshaller/MarshallerContextSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/marshaller/MarshallerContextSelfTest.java
@@ -31,12 +31,15 @@ import org.apache.ignite.internal.MarshallerContextImpl;
 import org.apache.ignite.internal.processors.closure.GridClosureProcessor;
 import org.apache.ignite.internal.processors.marshaller.MarshallerMappingItem;
 import org.apache.ignite.internal.processors.pool.PoolProcessor;
+import org.apache.ignite.internal.util.typedef.PA;
 import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.GridTestKernalContext;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 
 import static java.nio.file.Files.readAllBytes;
 import static org.apache.ignite.internal.MarshallerPlatformIds.JAVA_ID;
+import static org.apache.ignite.testframework.GridTestUtils.waitForCondition;
 
 /**
  * Test marshaller context.
@@ -95,6 +98,9 @@ public class MarshallerContextSelfTest extends GridCommonAbstractTest {
 
         ctx.onMappingAccepted(item1);
 
+        // Wait until marshaller context write class to file.
+        U.sleep(2_000);
+
         checkFileName("java.lang.String", Paths.get(workDir + "/1.classname0"));
 
         MarshallerMappingItem item2 = new MarshallerMappingItem((byte) 2, 2, "Random.Class.Name");
@@ -103,6 +109,7 @@ public class MarshallerContextSelfTest extends GridCommonAbstractTest
{
         ctx.onMappingAccepted(item2);
 
         execSvc.shutdown();
+
         if (execSvc.awaitTermination(1000, TimeUnit.MILLISECONDS))
             checkFileName("Random.Class.Name", Paths.get(workDir + "/2.classname2"));
         else
@@ -181,6 +188,10 @@ public class MarshallerContextSelfTest extends GridCommonAbstractTest
{
      * @param pathToReal Path to real.
      */
     private void checkFileName(String expected, Path pathToReal) throws IOException {
-        assertEquals(expected, new String(readAllBytes(pathToReal)));
+        byte[] fileContent = readAllBytes(pathToReal);
+
+        assert fileContent != null && fileContent.length > 0;
+
+        assertEquals(expected, new String(fileContent));
     }
 }


Mime
View raw message