ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agoncha...@apache.org
Subject [12/31] incubator-ignite git commit: # ignite-537
Date Sat, 11 Apr 2015 07:47:44 GMT
# ignite-537


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

Branch: refs/heads/ignite-721
Commit: 9837a4abdc87d81f7d640e413d7b47a782909203
Parents: d25627c
Author: sboikov <sboikov@gridgain.com>
Authored: Fri Apr 10 17:14:18 2015 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Fri Apr 10 17:14:18 2015 +0300

----------------------------------------------------------------------
 .../ignite/internal/util/GridJavaProcess.java   |  38 ++++-
 .../spi/discovery/tcp/TcpDiscoverySpi.java      |   4 +-
 .../cache/CacheConfigurationP2PTest.java        | 122 +++++++++++++++
 .../cache/CacheConfigurationP2PTestServer.java  |  63 ++++++++
 .../startcache/CacheConfigP2PStartClient.java   | 132 ----------------
 .../CacheConfigurationP2PTestClient.java        | 155 +++++++++++++++++++
 .../p2p/GridMultiJvmClassPathSelfTest.java      | 109 -------------
 7 files changed, 378 insertions(+), 245 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9837a4ab/modules/core/src/main/java/org/apache/ignite/internal/util/GridJavaProcess.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/GridJavaProcess.java
b/modules/core/src/main/java/org/apache/ignite/internal/util/GridJavaProcess.java
index b90c4a9..d62e0b7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/GridJavaProcess.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/GridJavaProcess.java
@@ -82,7 +82,7 @@ public final class GridJavaProcess {
      */
     public static GridJavaProcess exec(Class cls, String params, @Nullable IgniteLogger log,
         @Nullable IgniteInClosure<String> printC, @Nullable GridAbsClosure procKilledC)
throws Exception {
-        return exec(cls, params, log, printC, procKilledC, null, null);
+        return exec(cls.getCanonicalName(), params, log, printC, procKilledC, null, null);
     }
 
     /**
@@ -101,6 +101,25 @@ public final class GridJavaProcess {
     public static GridJavaProcess exec(Class cls, String params, @Nullable IgniteLogger log,
         @Nullable IgniteInClosure<String> printC, @Nullable GridAbsClosure procKilledC,
         @Nullable Collection<String> jvmArgs, @Nullable String cp) throws Exception
{
+        return exec(cls.getCanonicalName(), params, log, printC, procKilledC, jvmArgs, cp);
+    }
+
+    /**
+     * Executes main() method of the given class in a separate system process.
+     *
+     * @param clsName Class with main() method to be run.
+     * @param params main() method parameters.
+     * @param printC Optional closure to be called each time wrapped process prints line
to system.out or system.err.
+     * @param procKilledC Optional closure to be called when process termination is detected.
+     * @param log Log to use.
+     * @param jvmArgs JVM arguments to use.
+     * @param cp Additional classpath.
+     * @return Wrapper around {@link Process}
+     * @throws Exception If any problem occurred.
+     */
+    public static GridJavaProcess exec(String clsName, String params, @Nullable IgniteLogger
log,
+        @Nullable IgniteInClosure<String> printC, @Nullable GridAbsClosure procKilledC,
+        @Nullable Collection<String> jvmArgs, @Nullable String cp) throws Exception
{
         if (!(U.isLinux() || U.isMacOs() || U.isWindows()))
             throw new Exception("Your OS is not supported.");
 
@@ -111,7 +130,6 @@ public final class GridJavaProcess {
 
         String javaBin = System.getProperty("java.home") + File.separator + "bin" + File.separator
+ "java";
         String classpath = System.getProperty("java.class.path");
-        String clsName = cls.getCanonicalName();
 
         if (cp != null)
             classpath += System.getProperty("path.separator") + cp;
@@ -170,6 +188,22 @@ public final class GridJavaProcess {
     }
 
     /**
+     * Kills process using {@link Process#destroy()}.
+     */
+    public void killProcess() {
+        proc.destroy();
+
+        if (procKilledC != null)
+            procKilledC.apply();
+
+        U.interrupt(osGrabber);
+        U.interrupt(esGrabber);
+
+        U.join(osGrabber, log);
+        U.join(esGrabber, log);
+    }
+
+    /**
      * Returns pid of the java process.
      * Wrapped java class should print it's PID to system.out or system.err to make wrapper
know about it.
      *

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9837a4ab/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
index 21f1c97..7da004a 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
@@ -5401,8 +5401,8 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements
TcpDiscov
          * @param node Node.
          */
         public DiscoveryDeploymentClassLoader(TcpDiscoveryNode node) {
-            assert !node.isClient();
-            assert !node.id().equals(getLocalNodeId());
+            assert !node.isClient() : node;
+            assert !node.id().equals(getLocalNodeId()) : node;
 
             this.node = node;
         }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9837a4ab/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConfigurationP2PTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConfigurationP2PTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConfigurationP2PTest.java
new file mode 100644
index 0000000..96b124c
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConfigurationP2PTest.java
@@ -0,0 +1,122 @@
+/*
+ * 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;
+
+import org.apache.ignite.internal.util.*;
+import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.testframework.junits.common.*;
+
+import java.util.concurrent.*;
+
+import static java.util.concurrent.TimeUnit.*;
+
+/**
+ *
+ */
+public class CacheConfigurationP2PTest extends GridCommonAbstractTest {
+    /** */
+    public static final String NODE_START_MSG = "Test external node started";
+
+    /** */
+    private static final String CLIENT_CLS_NAME =
+        "org.apache.ignite.tests.p2p.startcache.CacheConfigurationP2PTestClient";
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testCacheConfigurationP2P() throws Exception {
+        final CountDownLatch srvsReadyLatch = new CountDownLatch(2);
+
+        final CountDownLatch clientReadyLatch = new CountDownLatch(1);
+
+        GridJavaProcess node1 = null;
+        GridJavaProcess node2 = null;
+        GridJavaProcess clientNode = null;
+
+        try {
+            node1 = GridJavaProcess.exec(
+                CacheConfigurationP2PTestServer.class.getName(), null,
+                log,
+                new CI1<String>() {
+                    @Override public void apply(String s) {
+                        info("Server node1: " + s);
+
+                        if (s.contains(NODE_START_MSG))
+                            srvsReadyLatch.countDown();
+                    }
+                },
+                null,
+                null,
+                null
+            );
+
+            node2 = GridJavaProcess.exec(
+                CacheConfigurationP2PTestServer.class.getName(), null,
+                log,
+                new CI1<String>() {
+                    @Override public void apply(String s) {
+                        info("Server node2: " + s);
+
+                        if (s.contains(NODE_START_MSG))
+                            srvsReadyLatch.countDown();
+                    }
+                },
+                null,
+                null,
+                null
+            );
+
+            assertTrue(srvsReadyLatch.await(60, SECONDS));
+
+            String str = U.getIgniteHome() + "/modules/extdata/p2p/target/classes/";
+
+            clientNode = GridJavaProcess.exec(
+                CLIENT_CLS_NAME, null,
+                log,
+                new CI1<String>() {
+                    @Override public void apply(String s) {
+                        info("Client node: " + s);
+
+                        if (s.contains(NODE_START_MSG))
+                            clientReadyLatch.countDown();
+                    }
+                },
+                null,
+                null,
+                str
+            );
+
+            assertTrue(clientReadyLatch.await(60, SECONDS));
+
+            int exitCode = clientNode.getProcess().waitFor();
+
+            assertEquals("Unexpected exit code", 0, exitCode);
+        }
+        finally {
+            if (node1 != null)
+                node1.killProcess();
+
+            if (node2 != null)
+                node2.killProcess();
+
+            if (clientNode != null)
+                clientNode.killProcess();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9837a4ab/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConfigurationP2PTestServer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConfigurationP2PTestServer.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConfigurationP2PTestServer.java
new file mode 100644
index 0000000..490f951
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConfigurationP2PTestServer.java
@@ -0,0 +1,63 @@
+/*
+ * 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;
+
+import org.apache.ignite.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.spi.discovery.tcp.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
+
+import java.util.*;
+
+/**
+ *
+ */
+public class CacheConfigurationP2PTestServer {
+    /**
+     * @param args Arguments.
+     * @throws Exception If failed.
+     */
+    public static void main(String[] args) throws Exception {
+        System.out.println("Starting test server node.");
+
+        IgniteConfiguration cfg = new IgniteConfiguration();
+
+        cfg.setPeerClassLoadingEnabled(true);
+
+        cfg.setLocalHost("127.0.0.1");
+
+        TcpDiscoverySpi disco = new TcpDiscoverySpi();
+
+        TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder();
+
+        ipFinder.setAddresses(Arrays.asList("127.0.0.1:47500..47509"));
+
+        disco.setIpFinder(ipFinder);
+
+        cfg.setDiscoverySpi(disco);
+
+        U.setWorkDirectory(null, U.getIgniteHome());
+
+        try (Ignite ignite = Ignition.start(cfg)) {
+            System.out.println(CacheConfigurationP2PTest.NODE_START_MSG);
+
+            U.sleep(Long.MAX_VALUE);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9837a4ab/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/startcache/CacheConfigP2PStartClient.java
----------------------------------------------------------------------
diff --git a/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/startcache/CacheConfigP2PStartClient.java
b/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/startcache/CacheConfigP2PStartClient.java
deleted file mode 100644
index 1170175..0000000
--- a/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/startcache/CacheConfigP2PStartClient.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * 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.tests.p2p.startcache;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cache.query.annotations.*;
-import org.apache.ignite.configuration.*;
-
-import java.io.*;
-import java.util.*;
-
-/**
- *
- */
-public class CacheConfigP2PStartClient {
-    /**
-     * @param args Arguments.
-     * @throws Exception If failed.
-     */
-    public static void main(String[] args) throws Exception {
-        IgniteConfiguration cfg = new IgniteConfiguration();
-
-        try (Ignite ignite = Ignition.start(cfg)) {
-            int nodes = ignite.cluster().nodes().size();
-
-            if (nodes != 3)
-                throw new Exception("Unexpected nodes number: " + nodes);
-
-            CacheConfiguration<Integer, Organization1> ccfg1 = new CacheConfiguration<>();
-
-            ccfg1.setName("cache1");
-
-            ccfg1.setNodeFilter(new CacheAllNodesFilter());
-
-            ccfg1.setIndexedTypes(Integer.class, Organization1.class);
-
-            System.out.println("Create cache1.");
-
-            IgniteCache<Integer, Organization1> cache1 = ignite.createCache(ccfg1);
-
-            for (int i = 0; i < 500; i++)
-                cache1.put(i, new Organization1("org-" + i));
-
-            System.out.println("Sleep some time.");
-
-            Thread.sleep(5000); // Sleep some time to wait when connection of p2p loader
is closed.
-
-            System.out.println("Create cache2.");
-
-            CacheConfiguration<Integer, Organization2> ccfg2 = new CacheConfiguration<>();
-
-            ccfg2.setName("cache2");
-
-            ccfg2.setIndexedTypes(Integer.class, Organization1.class);
-
-            IgniteCache<Integer, Organization2> cache2 = ignite.createCache(ccfg2);
-        }
-    }
-
-    /**
-     * Organization class.
-     */
-    private static class Organization1 implements Serializable {
-        /** Organization ID (indexed). */
-        @QuerySqlField(index = true)
-        private UUID id;
-
-        /** Organization name (indexed). */
-        @QuerySqlField(index = true)
-        private String name;
-
-        /**
-         * Create organization.
-         *
-         * @param name Organization name.
-         */
-        Organization1(String name) {
-            id = UUID.randomUUID();
-
-            this.name = name;
-        }
-
-        /** {@inheritDoc} */
-        @Override public String toString() {
-            return "Organization [id=" + id + ", name=" + name + ']';
-        }
-    }
-
-    /**
-     * Organization class.
-     */
-    private static class Organization2 implements Serializable {
-        /** Organization ID (indexed). */
-        @QuerySqlField(index = true)
-        private UUID id;
-
-        /** Organization name (indexed). */
-        @QuerySqlField(index = true)
-        private String name;
-
-        /**
-         * Create organization.
-         *
-         * @param name Organization name.
-         */
-        Organization2(String name) {
-            id = UUID.randomUUID();
-
-            this.name = name;
-        }
-
-        /** {@inheritDoc} */
-        @Override public String toString() {
-            return "Organization [id=" + id + ", name=" + name + ']';
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9837a4ab/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/startcache/CacheConfigurationP2PTestClient.java
----------------------------------------------------------------------
diff --git a/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/startcache/CacheConfigurationP2PTestClient.java
b/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/startcache/CacheConfigurationP2PTestClient.java
new file mode 100644
index 0000000..0634e5f
--- /dev/null
+++ b/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/startcache/CacheConfigurationP2PTestClient.java
@@ -0,0 +1,155 @@
+/*
+ * 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.tests.p2p.startcache;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.query.annotations.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.spi.discovery.tcp.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
+
+import java.io.*;
+import java.util.*;
+
+/**
+ *
+ */
+public class CacheConfigurationP2PTestClient {
+    /**
+     * @param args Arguments.
+     * @throws Exception If failed.
+     */
+    public static void main(String[] args) throws Exception {
+        System.out.println("Starting test client node.");
+
+        IgniteConfiguration cfg = new IgniteConfiguration();
+
+        cfg.setPeerClassLoadingEnabled(true);
+
+        cfg.setLocalHost("127.0.0.1");
+
+        TcpDiscoverySpi disco = new TcpDiscoverySpi();
+
+        TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder();
+
+        ipFinder.setAddresses(Arrays.asList("127.0.0.1:47500..47509"));
+
+        disco.setIpFinder(ipFinder);
+
+        cfg.setDiscoverySpi(disco);
+
+        U.setWorkDirectory(null, U.getIgniteHome());
+
+        try (Ignite ignite = Ignition.start(cfg)) {
+            System.out.println("Test external node started");
+
+            int nodes = ignite.cluster().nodes().size();
+
+            if (nodes != 3)
+                throw new Exception("Unexpected nodes number: " + nodes);
+
+            CacheConfiguration<Integer, Organization1> ccfg1 = new CacheConfiguration<>();
+
+            ccfg1.setName("cache1");
+
+            ccfg1.setNodeFilter(new CacheAllNodesFilter());
+
+            ccfg1.setIndexedTypes(Integer.class, Organization1.class);
+
+            System.out.println("Create cache1.");
+
+            IgniteCache<Integer, Organization1> cache1 = ignite.createCache(ccfg1);
+
+            for (int i = 0; i < 500; i++)
+                cache1.put(i, new Organization1("org-" + i));
+
+            System.out.println("Sleep some time.");
+
+            Thread.sleep(5000); // Sleep some time to wait when connection of p2p loader
is closed.
+
+            System.out.println("Create cache2.");
+
+            CacheConfiguration<Integer, Organization2> ccfg2 = new CacheConfiguration<>();
+
+            ccfg2.setName("cache2");
+
+            ccfg2.setIndexedTypes(Integer.class, Organization1.class);
+
+            IgniteCache<Integer, Organization2> cache2 = ignite.createCache(ccfg2);
+        }
+    }
+
+    /**
+     * Organization class.
+     */
+    private static class Organization1 implements Serializable {
+        /** Organization ID (indexed). */
+        @QuerySqlField(index = true)
+        private UUID id;
+
+        /** Organization name (indexed). */
+        @QuerySqlField(index = true)
+        private String name;
+
+        /**
+         * Create organization.
+         *
+         * @param name Organization name.
+         */
+        Organization1(String name) {
+            id = UUID.randomUUID();
+
+            this.name = name;
+        }
+
+        /** {@inheritDoc} */
+        @Override public String toString() {
+            return "Organization [id=" + id + ", name=" + name + ']';
+        }
+    }
+
+    /**
+     * Organization class.
+     */
+    private static class Organization2 implements Serializable {
+        /** Organization ID (indexed). */
+        @QuerySqlField(index = true)
+        private UUID id;
+
+        /** Organization name (indexed). */
+        @QuerySqlField(index = true)
+        private String name;
+
+        /**
+         * Create organization.
+         *
+         * @param name Organization name.
+         */
+        Organization2(String name) {
+            id = UUID.randomUUID();
+
+            this.name = name;
+        }
+
+        /** {@inheritDoc} */
+        @Override public String toString() {
+            return "Organization [id=" + id + ", name=" + name + ']';
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9837a4ab/modules/spring/src/test/java/org/apache/ignite/p2p/GridMultiJvmClassPathSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/java/org/apache/ignite/p2p/GridMultiJvmClassPathSelfTest.java
b/modules/spring/src/test/java/org/apache/ignite/p2p/GridMultiJvmClassPathSelfTest.java
deleted file mode 100644
index 00b61b1..0000000
--- a/modules/spring/src/test/java/org/apache/ignite/p2p/GridMultiJvmClassPathSelfTest.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * 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.p2p;
-
-import org.apache.ignite.*;
-import org.apache.ignite.internal.util.*;
-import org.apache.ignite.internal.util.typedef.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
-import org.apache.ignite.testframework.config.*;
-import org.apache.ignite.testframework.junits.common.*;
-
-import java.util.concurrent.*;
-
-/**
- * Test.
- */
-public class GridMultiJvmClassPathSelfTest extends GridCommonAbstractTest {
-    private static String START = "Start external node";
-
-    public static void main(String[] args) throws Exception {
-        U.setWorkDirectory(null, U.getIgniteHome());
-
-        // Tell our process PID to the wrapper.
-        X.println(GridJavaProcess.PID_MSG_PREFIX + U.jvmPid());
-
-        X.println("Java path: " + System.getProperty("java.class.path"));
-
-        try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
-            X.println(START);
-            U.sleep(10000);
-        }
-    }
-    /**
-     * @throws Exception If failed.
-     */
-    public void testDifferentClassPath() throws Exception {
-        final CountDownLatch killedLatch = new CountDownLatch(2);
-
-        final CountDownLatch readyLatch = new CountDownLatch(2);
-
-        GridJavaProcess proc1 = GridJavaProcess.exec(
-            GridMultiJvmClassPathSelfTest.class, null,
-            log,
-            new CI1<String>() {
-                @Override public void apply(String s) {
-                    info("Process 1 prints: " + s);
-
-                    if (s.startsWith(START))
-                        readyLatch.countDown();
-                }
-            },
-            new CA() {
-                @Override public void apply() {
-                    info("Process 1 is killed");
-
-                    killedLatch.countDown();
-                }
-            },
-            null,
-            null
-        );
-
-        GridJavaProcess proc2 = GridJavaProcess.exec(
-            GridMultiJvmClassPathSelfTest.class, null,
-            log,
-            new CI1<String>() {
-                @Override public void apply(String s) {
-                    info("Process 2 prints: " + s);
-
-                    if (s.contains(START))
-                        readyLatch.countDown();
-                }
-            },
-            new CA() {
-                @Override public void apply() {
-                    info("Process 2 is killed");
-
-                    killedLatch.countDown();
-                }
-            },
-            null,
-            GridTestProperties.getProperty("p2p.uri.cls")
-        );
-
-        readyLatch.await();
-
-        try(Ignite ignite = Ignition.start("examples/config/example-ignite.xml")){
-            proc1.kill();
-            proc2.kill();
-
-            killedLatch.await();
-        }
-    }
-}


Mime
View raw message