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: initiation
Date Fri, 10 Apr 2015 17:40:42 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-648 [created] c54604a38


ignite-648: initiation


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

Branch: refs/heads/ignite-648
Commit: c54604a38bb91773e56ff0220bc5901c5268bd10
Parents: ad2ce58
Author: Artem Shutak <ashutak@gridgain.com>
Authored: Fri Apr 10 20:40:41 2015 +0300
Committer: Artem Shutak <ashutak@gridgain.com>
Committed: Fri Apr 10 20:40:41 2015 +0300

----------------------------------------------------------------------
 .../IpcSharedMemoryNativeLoaderSelfTest.java    |   1 -
 .../ignite/multijvm/IgniteNodeRunner.java       |  43 ++++++++
 .../apache/ignite/multijvm/MultiJvmTest.java    | 108 +++++++++++++++++++
 3 files changed, 151 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c54604a3/modules/core/src/test/java/org/apache/ignite/internal/util/ipc/shmem/IpcSharedMemoryNativeLoaderSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/util/ipc/shmem/IpcSharedMemoryNativeLoaderSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/util/ipc/shmem/IpcSharedMemoryNativeLoaderSelfTest.java
index 65fa543..6a72698 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/util/ipc/shmem/IpcSharedMemoryNativeLoaderSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/util/ipc/shmem/IpcSharedMemoryNativeLoaderSelfTest.java
@@ -28,7 +28,6 @@ import java.util.*;
  * Test shared memory native loader.
  */
 public class IpcSharedMemoryNativeLoaderSelfTest extends TestCase {
-
     /**
      * Test {@link IpcSharedMemoryNativeLoader#load()} in case, when native library path
was
      * already loaded, but corrupted.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c54604a3/modules/core/src/test/java/org/apache/ignite/multijvm/IgniteNodeRunner.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/multijvm/IgniteNodeRunner.java b/modules/core/src/test/java/org/apache/ignite/multijvm/IgniteNodeRunner.java
new file mode 100644
index 0000000..8ceb75d
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/multijvm/IgniteNodeRunner.java
@@ -0,0 +1,43 @@
+/*
+ * 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.multijvm;
+
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+
+import java.io.*;
+
+/**
+ * Run ignite node. 
+ */
+public class IgniteNodeRunner {
+    public static void main(String[] args) throws IOException, InterruptedException {
+        IgniteConfiguration cfg = new IgniteConfiguration();
+        
+        cfg.setGridName("TestGrid");
+
+        G.start(cfg);
+        
+        new File(U.getIgniteHome() + "/testFile1.txt").createNewFile();
+
+        Thread.sleep(5 * 1000);
+        
+        new File(U.getIgniteHome() + "/testFile2.txt").createNewFile();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c54604a3/modules/core/src/test/java/org/apache/ignite/multijvm/MultiJvmTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/multijvm/MultiJvmTest.java b/modules/core/src/test/java/org/apache/ignite/multijvm/MultiJvmTest.java
new file mode 100644
index 0000000..7df9c28
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/multijvm/MultiJvmTest.java
@@ -0,0 +1,108 @@
+/*
+ * 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.multijvm;
+
+import org.apache.ignite.*;
+import org.apache.ignite.internal.util.*;
+import org.apache.ignite.testframework.junits.common.*;
+
+import java.io.*;
+import java.util.*;
+
+/**
+ * Multi JVM tests. 
+ */
+public class MultiJvmTest extends GridCommonAbstractTest {
+    /**
+     * Runs given class as separate java process.
+     *
+     * @param runnerCls Runner class
+     * @param b
+     * @throws Exception If failed.
+     */
+    protected void runJavaProcess(Class<?> runnerCls, boolean wait) throws Exception
{
+        Process ps = GridJavaProcess.exec(
+            runnerCls,
+            null,
+            null,
+            null,
+            null,
+            Collections.<String>emptyList(),
+            System.getProperty("surefire.test.class.path")
+        ).getProcess();
+
+        readStreams(ps);
+
+        int code = 0;
+        
+        if (wait)
+            code = ps.waitFor();
+
+        assertEquals("Returned code have to be 0.", 0, code);
+    }
+
+    /**
+     * Read information from process streams.
+     *
+     * @param proc Process.
+     * @throws IOException If an I/O error occurs.
+     */
+    private void readStreams(final Process proc) throws IOException {
+        Thread reader = new Thread(new Runnable() {
+            @Override public void run() {
+                try {
+                    BufferedReader stdOut = new BufferedReader(new InputStreamReader(proc.getInputStream()));
+
+                    String s;
+
+                    while ((s = stdOut.readLine()) != null)
+                        System.out.println("OUT>>>>>> " + s);
+
+                    BufferedReader errOut = new BufferedReader(new InputStreamReader(proc.getErrorStream()));
+
+                    while ((s = errOut.readLine()) != null)
+                        System.out.println("ERR>>>>>> " + s);
+                }
+                catch (IOException e) {
+                    // No-op.
+                }
+            }
+        });
+        
+        reader.setDaemon(true);
+        
+        reader.start();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testMultiNode() throws Exception {
+        runJavaProcess(IgniteNodeRunner.class, false);
+        
+        log.info(">>>>> grids=" + Ignition.allGrids());
+
+        Thread.sleep(15 * 1000);
+
+        log.info(">>>>> grids=" + Ignition.allGrids());
+        
+        Ignition.stopAll(true);
+        
+        log.info(">>>>> grids=" + Ignition.allGrids());
+    }
+}


Mime
View raw message