ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject incubator-ignite git commit: # ignite-648: opt marhsaller 2 (tmp commit)
Date Thu, 07 May 2015 13:37:33 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-648-optmarsh2 [created] ef89e85da


# ignite-648: opt marhsaller 2 (tmp commit)


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

Branch: refs/heads/ignite-648-optmarsh2
Commit: ef89e85dad3452e80430e19cdec892ede2668eaa
Parents: e11b6b8
Author: Artem Shutak <ashutak@gridgain.com>
Authored: Thu May 7 16:37:34 2015 +0300
Committer: Artem Shutak <ashutak@gridgain.com>
Committed: Thu May 7 16:37:34 2015 +0300

----------------------------------------------------------------------
 .../cache/multijvm/FileMarshaller.java          | 39 ++++++++++++++++
 ...CachePartitionedMultiJvmFullApiSelfTest.java | 10 ++++
 .../cache/multijvm/IgniteExProcessProxy.java    |  2 +
 .../cache/multijvm/IgniteNodeRunner.java        | 49 +++++++++++---------
 4 files changed, 77 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ef89e85d/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/FileMarshaller.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/FileMarshaller.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/FileMarshaller.java
new file mode 100644
index 0000000..e52b44e
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/FileMarshaller.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.multijvm;
+
+import org.apache.ignite.*;
+import org.apache.ignite.configuration.*;
+
+import java.io.*;
+
+/**
+ * TODO: Add class description.
+ */
+public class FileMarshaller {
+    public static void toFile(Ignite grid, Object cfg) throws FileNotFoundException, IgniteCheckedException
{
+        grid.configuration().getMarshaller().marshal(cfg,
+            new BufferedOutputStream(new FileOutputStream(IgniteNodeRunner.CONFIGURATION_TMP_FILE)));
+    }
+
+    public static IgniteConfiguration fromFile(Ignite grid) throws FileNotFoundException,
IgniteCheckedException {
+        return grid.configuration().getMarshaller().unmarshal(
+            new BufferedInputStream(new FileInputStream(IgniteNodeRunner.CONFIGURATION_TMP_FILE)),
+            null);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ef89e85d/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedMultiJvmFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedMultiJvmFullApiSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedMultiJvmFullApiSelfTest.java
index 336949a..1905cfd 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedMultiJvmFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedMultiJvmFullApiSelfTest.java
@@ -27,4 +27,14 @@ public class GridCachePartitionedMultiJvmFullApiSelfTest extends GridCachePartit
     protected boolean isMultiJvm() {
         return true;
     }
+
+    @Override protected int gridCount() {
+        return 2;
+    }
+
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        IgniteExProcessProxy.killAll();
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ef89e85d/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/IgniteExProcessProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/IgniteExProcessProxy.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/IgniteExProcessProxy.java
index 469e425..c326010 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/IgniteExProcessProxy.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/IgniteExProcessProxy.java
@@ -71,6 +71,8 @@ public class IgniteExProcessProxy implements IgniteEx {
         this.locJvmGrid = locJvmGrid;
         this.log = log.getLogger("jvm-" + id);
 
+        FileMarshaller.toFile(locJvmGrid, cfg);
+
         IgniteNodeRunner.storeToFile(cfg.getCacheConfiguration()[0]);
 
         List<String> jvmArgs = U.jvmArgs();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ef89e85d/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/IgniteNodeRunner.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/IgniteNodeRunner.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/IgniteNodeRunner.java
index 32f33dc..987fa0a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/IgniteNodeRunner.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/IgniteNodeRunner.java
@@ -39,8 +39,8 @@ public class IgniteNodeRunner {
     public static final TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryMulticastIpFinder();
 
     /** */
-    private static final String CACHE_CONFIGURATION_TMP_FILE = System.getProperty("java.io.tmpdir")
+
-        File.separator + "cacheConfiguration.tmp";
+    public static final String CONFIGURATION_TMP_FILE = System.getProperty("java.io.tmpdir")
+
+        File.separator + "igniteConfiguration.tmp";
 
     /**
      * Starts {@link Ignite} instance accorging to given arguments.
@@ -51,10 +51,18 @@ public class IgniteNodeRunner {
     public static void main(String[] args) throws Exception {
         try {
             X.println(GridJavaProcess.PID_MSG_PREFIX + U.jvmPid());
-
             X.println("Starting Ignite Node... Args" + Arrays.toString(args));
 
-            IgniteConfiguration cfg = configuration(args);
+            TcpDiscoverySpi disco = new TcpDiscoverySpi();
+            disco.setIpFinder(ipFinder);
+
+            Ignite tmpNode = Ignition.start(configuration("fake-grid", null));
+
+            X.println(">>>> tmpNode started");
+
+            IgniteConfiguration cfg = FileMarshaller.fromFile(tmpNode);
+
+            X.println(">>>> Cfg was gotten");
 
             Ignition.start(cfg);
         }
@@ -86,32 +94,27 @@ public class IgniteNodeRunner {
         final UUID nodeId = UUID.fromString(args[0]);
         final String gridName = args[1];
 
+        return configuration(gridName, nodeId);
+    }
+
+    /**
+     * @param gridName
+     * @param nodeId
+     * @return Ignite configuration.
+     * @throws Exception If failed.
+     */
+    private static IgniteConfiguration configuration(String gridName, UUID nodeId) throws
Exception {
         // Configuration.
         IgniteConfiguration cfg = GridAbstractTest.getConfiguration0(gridName, new IgniteTestResources(),
             GridCachePartitionedMultiJvmFullApiSelfTest.class, false);
 
         TcpDiscoverySpi disco = new TcpDiscoverySpi();
-
-//        disco.setMaxMissedHeartbeats(Integer.MAX_VALUE);
-
         disco.setIpFinder(ipFinder);
-
-//        if (isDebug())
-//            disco.setAckTimeout(Integer.MAX_VALUE);
-
         cfg.setDiscoverySpi(disco);
 
-        cfg.setCacheConfiguration(cacheConfiguration());
-
         cfg.setMarshaller(new OptimizedMarshaller(false));
-////        ----------------
-////        if (offHeapValues())
-////            cfg.setSwapSpaceSpi(new GridTestSwapSpaceSpi());
-////        ----------------
-//        cfg.getTransactionConfiguration().setTxSerializableEnabled(true);
-//
-////        ---------------
-//        Special.
+
+//      Special.
         cfg.setLocalHost("127.0.0.1");
 
         cfg.setIncludeProperties();
@@ -128,7 +131,7 @@ public class IgniteNodeRunner {
      * @throws IOException If exception.
      */
     public static void storeToFile(CacheConfiguration cc) throws IOException {
-        File ccfgTmpFile = new File(CACHE_CONFIGURATION_TMP_FILE);
+        File ccfgTmpFile = new File(CONFIGURATION_TMP_FILE);
 
         // TODO: add file created check (and delete the file after tests).
         boolean created = ccfgTmpFile.createNewFile();
@@ -145,7 +148,7 @@ public class IgniteNodeRunner {
      * @throws Exception If exception.
      */
     private static CacheConfiguration cacheConfiguration() throws Exception {
-        File ccfgTmpFile = new File(CACHE_CONFIGURATION_TMP_FILE);
+        File ccfgTmpFile = new File(CONFIGURATION_TMP_FILE);
 
         try(ObjectInputStream in = new ObjectInputStream(new FileInputStream(ccfgTmpFile)))
{
             return (CacheConfiguration)in.readObject();


Mime
View raw message