Repository: ignite Updated Branches: refs/heads/master 1f2f87243 -> c6571448c
http://git-wip-us.apache.org/repos/asf/ignite/blob/c6571448/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java index 3075920..2f91e40 100644 --- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java +++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java @@ -40,10 +40,10 @@ import org.apache.ignite.IgniteEvents; import org.apache.ignite.IgniteException; import org.apache.ignite.IgniteFileSystem; import org.apache.ignite.IgniteIllegalStateException; +import org.apache.ignite.IgniteLock; import org.apache.ignite.IgniteLogger; import org.apache.ignite.IgniteMessaging; import org.apache.ignite.IgniteQueue; -import org.apache.ignite.IgniteLock; import org.apache.ignite.IgniteScheduler; import org.apache.ignite.IgniteSemaphore; import org.apache.ignite.IgniteServices; @@ -137,27 +137,11 @@ public class IgniteProcessProxy implements IgniteEx { throws Exception { this.cfg = cfg; this.locJvmGrid = locJvmGrid; - this.log = log.getLogger("jvm-" + id.toString().substring(0, id.toString().indexOf('-'))); - - String cfgFileName = IgniteNodeRunner.storeToFile(cfg.setNodeId(id), resetDiscovery); - - Collection<String> filteredJvmArgs = new ArrayList<>(); - - filteredJvmArgs.add("-ea"); + this.log = logger(log, "jvm-" + id.toString().substring(0, id.toString().indexOf('-'))); - Marshaller marsh = cfg.getMarshaller(); + String params = params(cfg, resetDiscovery); - if (marsh != null) - filteredJvmArgs.add("-D" + IgniteTestResources.MARSH_CLASS_NAME + "=" + marsh.getClass().getName()); - else - filteredJvmArgs.add("-D" + IgniteTestResources.MARSH_CLASS_NAME + "=" + BinaryMarshaller.class.getName()); - - for (String arg : U.jvmArgs()) { - if (arg.startsWith("-Xmx") || arg.startsWith("-Xms") || - arg.startsWith("-cp") || arg.startsWith("-classpath") || - (marsh != null && arg.startsWith("-D" + IgniteTestResources.MARSH_CLASS_NAME))) - filteredJvmArgs.add(arg); - } + Collection<String> filteredJvmArgs = filteredJvmArgs(); final CountDownLatch rmtNodeStartedLatch = new CountDownLatch(1); @@ -165,8 +149,8 @@ public class IgniteProcessProxy implements IgniteEx { locJvmGrid.events().localListen(new NodeStartedListener(id, rmtNodeStartedLatch), EventType.EVT_NODE_JOINED); proc = GridJavaProcess.exec( - IgniteNodeRunner.class.getCanonicalName(), - cfgFileName, // Params. + igniteNodeRunnerClassName(), + params, this.log, // Optional closure to be called each time wrapped process prints line to system.out or system.err. new IgniteInClosure<String>() { @@ -194,6 +178,68 @@ public class IgniteProcessProxy implements IgniteEx { } /** + * Creates new logger instance based on given logger and given category. + * + * @param log Base logger. + * @param ctgr Category. + * @return Initiated logger. + * @throws Exception In case of an error. + */ + protected IgniteLogger logger(IgniteLogger log, Object ctgr) throws Exception { + return log.getLogger(ctgr); + } + + /** + * Gets Ignite node runner class name. + * + * @return Node runner class name. + * @throws Exception In case of an error. + */ + protected String igniteNodeRunnerClassName() throws Exception { + return IgniteNodeRunner.class.getCanonicalName(); + } + + /** + * Creates parameters which will be passed to new Ignite Process as command line arguments. + * + * @param cfg Configuration. + * @param resetDiscovery Reset DiscoverySpi at the configuration. + * @return Params to be passed to new Ignite process. + * @throws Exception In case of an error. + */ + protected String params(IgniteConfiguration cfg, boolean resetDiscovery) throws Exception { + return IgniteNodeRunner.storeToFile(cfg.setNodeId(id), resetDiscovery); + } + + /** + * Creates list of JVM arguments to be used to start new Ignite process in separate JVM. + * + * @return JVM arguments. + * @throws Exception In case of an error. + */ + protected Collection<String> filteredJvmArgs() throws Exception { + Collection<String> filteredJvmArgs = new ArrayList<>(); + + filteredJvmArgs.add("-ea"); + + Marshaller marsh = cfg.getMarshaller(); + + if (marsh != null) + filteredJvmArgs.add("-D" + IgniteTestResources.MARSH_CLASS_NAME + "=" + marsh.getClass().getName()); + else + filteredJvmArgs.add("-D" + IgniteTestResources.MARSH_CLASS_NAME + "=" + BinaryMarshaller.class.getName()); + + for (String arg : U.jvmArgs()) { + if (arg.startsWith("-Xmx") || arg.startsWith("-Xms") || + arg.startsWith("-cp") || arg.startsWith("-classpath") || + (marsh != null && arg.startsWith("-D" + IgniteTestResources.MARSH_CLASS_NAME))) + filteredJvmArgs.add(arg); + } + + return filteredJvmArgs; + } + + /** */ private static class NodeStartedListener extends IgnitePredicateX<Event> { /** Id. */ http://git-wip-us.apache.org/repos/asf/ignite/blob/c6571448/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index cfa266d..d60863f 100644 --- a/pom.xml +++ b/pom.xml @@ -103,6 +103,7 @@ <modules> <!-- sorted alphabetically --> <module>examples</module> <module>modules/benchmarks</module> + <module>modules/compatibility</module> <module>modules/geospatial</module> <module>modules/hibernate-4.2</module> <module>modules/hibernate-5.1</module> @@ -166,6 +167,13 @@ </profile> <profile> + <id>compatibility</id> + <modules> + <module>modules/compatibility</module> + </modules> + </profile> + + <profile> <id>javadoc</id> <build> <plugins>