You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2015/07/09 20:02:19 UTC
incubator-ignite git commit: # ignite-648: add marshaller check
Repository: incubator-ignite
Updated Branches:
refs/heads/ignite-648 7df60149e -> 9fa7acfc3
# ignite-648: add marshaller check
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/9fa7acfc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/9fa7acfc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/9fa7acfc
Branch: refs/heads/ignite-648
Commit: 9fa7acfc3bebb8a00fc2b65f1db1f3f790b28f27
Parents: 7df6014
Author: ashutak <as...@gridgain.com>
Authored: Thu Jul 9 21:02:13 2015 +0300
Committer: ashutak <as...@gridgain.com>
Committed: Thu Jul 9 21:02:13 2015 +0300
----------------------------------------------------------------------
.../junits/multijvm/IgniteNodeRunner.java | 25 ++++++++++++++++++++
1 file changed, 25 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9fa7acfc/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteNodeRunner.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteNodeRunner.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteNodeRunner.java
index 22411e8..2703d2b 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteNodeRunner.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteNodeRunner.java
@@ -30,6 +30,7 @@ import org.apache.ignite.spi.discovery.tcp.*;
import sun.jvmstat.monitor.*;
import java.io.*;
+import java.lang.reflect.*;
import java.util.*;
/**
@@ -84,6 +85,30 @@ public class IgniteNodeRunner {
public static String storeToFile(IgniteConfiguration cfg) throws IOException {
String fileName = IGNITE_CONFIGURATION_FILE + cfg.getNodeId();
+ // Check marshaller configuration, because read configuration method expect specific marshaller.
+ if (cfg.getMarshaller() instanceof OptimizedMarshaller){
+ OptimizedMarshaller marsh = (OptimizedMarshaller)cfg.getMarshaller();
+
+ try {
+ Field isRequireFiled = marsh.getClass().getDeclaredField("requireSer");
+
+ isRequireFiled.setAccessible(true);
+
+ boolean isRequireSer = isRequireFiled.getBoolean(marsh);
+
+ if (isRequireSer)
+ throw new UnsupportedOperationException("Unsupported marshaller configuration. " +
+ "readCfgFromFileAndDeleteFile method expect " + OptimizedMarshaller.class.getSimpleName() +
+ "with requireSerializeble flag in 'false'.");
+ }
+ catch (NoSuchFieldException|IllegalAccessException e) {
+ throw new IgniteException("Failed to check filed of " + OptimizedMarshaller.class.getSimpleName(), e);
+ }
+ }
+ else
+ throw new UnsupportedOperationException("Unsupported marshaller. " +
+ "readCfgFromFileAndDeleteFile method expect " + OptimizedMarshaller.class.getSimpleName());
+
try(OutputStream out = new BufferedOutputStream(new FileOutputStream(fileName))) {
cfg.setMBeanServer(null);
cfg.setMarshaller(null);