Return-Path: X-Original-To: apmail-ignite-commits-archive@minotaur.apache.org Delivered-To: apmail-ignite-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 756A11828C for ; Wed, 13 May 2015 13:21:04 +0000 (UTC) Received: (qmail 64297 invoked by uid 500); 13 May 2015 13:21:04 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 64264 invoked by uid 500); 13 May 2015 13:21:04 -0000 Mailing-List: contact commits-help@ignite.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.incubator.apache.org Delivered-To: mailing list commits@ignite.incubator.apache.org Received: (qmail 64255 invoked by uid 99); 13 May 2015 13:21:04 -0000 Received: from Unknown (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 May 2015 13:21:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id A9DA3182369 for ; Wed, 13 May 2015 13:21:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.771 X-Spam-Level: * X-Spam-Status: No, score=1.771 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, T_RP_MATCHES_RCVD=-0.01, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id Ra3SQfwCaMau for ; Wed, 13 May 2015 13:20:57 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with SMTP id 6552024C66 for ; Wed, 13 May 2015 13:20:57 +0000 (UTC) Received: (qmail 63461 invoked by uid 99); 13 May 2015 13:20:57 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 May 2015 13:20:57 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 1BF03E090A; Wed, 13 May 2015 13:20:57 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sboikov@apache.org To: commits@ignite.incubator.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: incubator-ignite git commit: ignite-648: cfgs in different files Date: Wed, 13 May 2015 13:20:57 +0000 (UTC) Repository: incubator-ignite Updated Branches: refs/heads/ignite-648 cf26ffb78 -> aac6b03b6 ignite-648: cfgs in different files Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/aac6b03b Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/aac6b03b Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/aac6b03b Branch: refs/heads/ignite-648 Commit: aac6b03b67877b8bdec9f5c14e13923db58d055f Parents: cf26ffb Author: Artem Shutak Authored: Wed May 13 16:21:23 2015 +0300 Committer: Artem Shutak Committed: Wed May 13 16:21:23 2015 +0300 ---------------------------------------------------------------------- .../framework/IgniteExProcessProxy.java | 4 +-- .../multijvm/framework/IgniteNodeRunner.java | 33 +++++++++----------- 2 files changed, 17 insertions(+), 20 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aac6b03b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/framework/IgniteExProcessProxy.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/framework/IgniteExProcessProxy.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/framework/IgniteExProcessProxy.java index 034d32c..d6fef47 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/framework/IgniteExProcessProxy.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/framework/IgniteExProcessProxy.java @@ -72,7 +72,7 @@ public class IgniteExProcessProxy implements IgniteEx { this.locJvmGrid = locJvmGrid; this.log = log.getLogger("jvm-" + id.toString().substring(0, id.toString().indexOf('-'))); - IgniteNodeRunner.storeToFile(cfg.setNodeId(id)); + String cfgFileName = IgniteNodeRunner.storeToFile(cfg.setNodeId(id)); List jvmArgs = U.jvmArgs(); @@ -85,7 +85,7 @@ public class IgniteExProcessProxy implements IgniteEx { proc = GridJavaProcess.exec( IgniteNodeRunner.class, - IgniteNodeRunner.asParams(id, cfg), // Params. + cfgFileName, // Params. this.log, // Optional closure to be called each time wrapped process prints line to system.out or system.err. new IgniteInClosure() { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aac6b03b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/framework/IgniteNodeRunner.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/framework/IgniteNodeRunner.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/framework/IgniteNodeRunner.java index d927fc0..480b803 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/framework/IgniteNodeRunner.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/framework/IgniteNodeRunner.java @@ -36,7 +36,7 @@ import java.util.*; public class IgniteNodeRunner { /** */ private static final String IGNITE_CONFIGURATION_FILE = System.getProperty("java.io.tmpdir") + - File.separator + "igniteConfiguration.tmp"; + File.separator + "igniteConfiguration.tmp_"; /** * Starts {@link Ignite} instance accorging to given arguments. @@ -50,7 +50,7 @@ public class IgniteNodeRunner { X.println("Starting Ignite Node... Args" + Arrays.toString(args)); - IgniteConfiguration cfg = readFromFile(); + IgniteConfiguration cfg = readCfgFromFileAndDeleteFile(args[0]); Ignition.start(cfg); } @@ -61,37 +61,34 @@ public class IgniteNodeRunner { } } - /** - * @param id Grid id. - * @param cfg Configuration. - * @return Given paramethers as command line string arguments. - */ - public static String asParams(UUID id, IgniteConfiguration cfg) { - return id.toString() + ' ' + cfg.getGridName(); - } + public static String storeToFile(IgniteConfiguration cfg) throws IOException { + String fileName = IGNITE_CONFIGURATION_FILE + cfg.getNodeId(); - public static void storeToFile(IgniteConfiguration cfg) throws IOException { - try(OutputStream out = new BufferedOutputStream(new FileOutputStream(IGNITE_CONFIGURATION_FILE))) { + try(OutputStream out = new BufferedOutputStream(new FileOutputStream(fileName))) { cfg.setMBeanServer(null); cfg.setMarshaller(null); cfg.setDiscoverySpi(null); new XStream().toXML(cfg, out); } + + return fileName; } - private static IgniteConfiguration readFromFile() throws FileNotFoundException { - BufferedReader cfgReader = new BufferedReader(new FileReader(IGNITE_CONFIGURATION_FILE)); - + private static IgniteConfiguration readCfgFromFileAndDeleteFile(String fileName) throws FileNotFoundException { + BufferedReader cfgReader = new BufferedReader(new FileReader(fileName)); + IgniteConfiguration cfg = (IgniteConfiguration)new XStream().fromXML(cfgReader); - + cfg.setMarshaller(new OptimizedMarshaller(false)); TcpDiscoverySpi disco = new TcpDiscoverySpi(); disco.setIpFinder(new TcpDiscoveryMulticastIpFinder()); - + cfg.setDiscoverySpi(disco); - + + new File(fileName).delete(); + return cfg; } }