You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by dp...@apache.org on 2019/03/15 12:14:36 UTC
[ignite] branch master updated: IGNITE-11461 Automatic modules
tests with java11 and standalone project (#6214)
This is an automated email from the ASF dual-hosted git repository.
dpavlov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git
The following commit(s) were added to refs/heads/master by this push:
new ee172d2 IGNITE-11461 Automatic modules tests with java11 and standalone project (#6214)
ee172d2 is described below
commit ee172d2604dfc393b5516c78cdd328a1db08847e
Author: Dmitriy Pavlov <dp...@apache.org>
AuthorDate: Fri Mar 15 15:14:26 2019 +0300
IGNITE-11461 Automatic modules tests with java11 and standalone project (#6214)
---
modules/dev-utils/ignite-modules-test/README.md | 16 +++
modules/dev-utils/ignite-modules-test/build.gradle | 139 +++++++++++++++++++++
.../src/test/java/module-info.java | 21 ++++
.../modulestest/IgniteLaunchInModularEnvTest.java | 97 ++++++++++++++
4 files changed, 273 insertions(+)
diff --git a/modules/dev-utils/ignite-modules-test/README.md b/modules/dev-utils/ignite-modules-test/README.md
new file mode 100644
index 0000000..3f04de4
--- /dev/null
+++ b/modules/dev-utils/ignite-modules-test/README.md
@@ -0,0 +1,16 @@
+# Ignite modular environment test project
+
+This project intended for testing Ignite artifacts separately from main project.
+
+## Local Setup
+To import project use Import from existing sources, use gradle option:
+[modules\dev-utils\ignite-modules-test\build.gradle](build.gradle)
+
+After imoport of gradle, it may require resync.
+Use latest gradle distribution, because older versions may not support modules.
+
+This project is compatible only with Java 11.
+
+## Used Ignite version
+By default this project uses Ignite version of previous released Ignite, but it can be switched to snapshot version if needed.
+
diff --git a/modules/dev-utils/ignite-modules-test/build.gradle b/modules/dev-utils/ignite-modules-test/build.gradle
new file mode 100644
index 0000000..92ba917
--- /dev/null
+++ b/modules/dev-utils/ignite-modules-test/build.gradle
@@ -0,0 +1,139 @@
+/*
+ * 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.
+ */
+
+plugins {
+ id 'java'
+}
+
+group 'org.apache.ignite'
+version '1.0'
+
+sourceCompatibility = 11
+targetCompatibility = 11
+
+ext {
+ ignVer = '2.8.0-SNAPSHOT'
+ // ignVer = '2.7.0'
+ moduleName = 'ignite_modules_test'
+}
+
+compileJava {
+ inputs.property("moduleName", moduleName)
+ doFirst {
+ options.compilerArgs = [
+ '--module-path', classpath.asPath,
+ ];
+ classpath = files();
+ }
+}
+
+compileTestJava {
+ inputs.property("moduleName", moduleName)
+ doFirst {
+ options.compilerArgs = [
+ '--module-path', classpath.asPath,
+ '--add-modules', 'junit',
+ '--add-reads', "$moduleName=junit",
+ '--patch-module', "$moduleName=" + files(sourceSets.test.java.srcDirs).asPath,
+ ]
+ classpath = files()
+ }
+}
+
+repositories {
+ mavenLocal()
+ mavenCentral()
+}
+
+dependencies {
+ testCompile group: 'junit', name: 'junit', version: '4.12'
+
+ compile group: 'org.apache.ignite', name: 'ignite-core', version: ignVer
+ //todo https://issues.apache.org/jira/browse/IGNITE-11464 - Fix indexing modularity:
+ compile(group: 'org.apache.ignite', name: 'ignite-indexing', version: ignVer) {
+ exclude group: 'org.apache.lucene' // to remove "lucene-sandbox and analyzers-commons" package conflicts.
+ }
+
+ /*
+ compile (group: 'org.apache.ignite', name: 'ignite-direct-io', version: ignVer) {
+ exclude group: 'org.apache.lucene' // to remove "lucene-sandbox and analyzers-commons" package conflicts
+ }
+ */
+
+ // module reads package org.apache.ignite.internal.processors.compress from both ignite.compress and ignite.core
+ // compile group: 'org.apache.ignite', name: 'ignite-compress', version: ignVer
+ /* compile (group: 'org.apache.ignite', name: 'ignite-spring', version: ignVer) {
+ exclude group: 'org.apache.lucene' // to remove "lucene-sandbox and analyzers-commons" package conflicts.
+ }*/
+ compile group: 'org.apache.ignite', name: 'ignite-ml', version: ignVer
+
+ compile group: 'org.apache.ignite', name: 'ignite-log4j', version: ignVer
+ compile group: 'org.apache.ignite', name: 'ignite-log4j2', version: ignVer
+ compile group: 'org.apache.ignite', name: 'ignite-slf4j', version: ignVer
+
+ compile(group: 'org.apache.ignite', name: 'ignite-rest-http', version: ignVer) {
+ //todo https://issues.apache.org/jira/browse/IGNITE-11469
+ exclude group: 'org.apache.tomcat'
+ // to remove "javax.servlet.http, javax.servlet.descriptor, javax.servlet.annotation, javax.servlet" package conflicts.
+
+ exclude group: "log4j", module: "log4j"
+ exclude group: "org.slf4j", module: "slf4j-log4j12"
+ }
+
+ // todo https://issues.apache.org/jira/browse/IGNITE-11485
+ // compile group: 'org.apache.ignite', name: 'ignite-hibernate_5.3', version: ignVer
+
+
+ // todo https://issues.apache.org/jira/browse/IGNITE-11486
+ compile (group: 'org.apache.ignite', name: 'ignite-zookeeper', version: ignVer) {
+ exclude group: "org.slf4j", module: "slf4j-log4j12"
+ exclude group: "log4j", module: "log4j"
+ }
+
+ compile group: "org.slf4j", name: "slf4j-api", version: "1.7.25"
+ compile group: "org.apache.logging.log4j", name: "log4j-slf4j-impl", version: "2.11.2"
+
+ /*
+ compile (group: 'org.apache.ignite', name: 'ignite-spring-data_2.0', version: ignVer) {
+ exclude group: 'org.apache.lucene' // to remove "lucene-sandbox and analyzers-commons" package conflicts.
+ }
+ */
+
+ // compile group: 'org.apache.ignite', name: 'ignite-compress', version: ignVer
+
+ compile (group: 'org.apache.ignite', name: 'ignite-cassandra-store', version: ignVer) {
+ exclude group: 'org.apache.lucene' // to remove "lucene-sandbox and analyzers-commons" package conflicts.
+
+ exclude group: 'org.apache.ignite', module: 'ignite-spring'
+ }
+}
+
+test {
+ // set JVM arguments for the test JVM(s)
+ jvmArgs("--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED",
+ "--add-exports=java.base/sun.nio.ch=ALL-UNNAMED",
+ "--add-exports=java.management/com.sun.jmx.mbeanserver=ALL-UNNAMED",
+ "--add-exports=jdk.internal.jvmstat/sun.jvmstat.monitor=ALL-UNNAMED",
+ "--add-exports=java.base/sun.reflect.generics.reflectiveObjects=ALL-UNNAMED",
+ "--illegal-access=permit",
+ "-Djdk.tls.client.protocols=TLSv1.2");
+}
+
+tasks.withType(Test) {
+ scanForTestClasses = false
+ include "**/*Test.class" // whatever Ant pattern matches your test class files
+}
\ No newline at end of file
diff --git a/modules/dev-utils/ignite-modules-test/src/test/java/module-info.java b/modules/dev-utils/ignite-modules-test/src/test/java/module-info.java
new file mode 100644
index 0000000..c516771
--- /dev/null
+++ b/modules/dev-utils/ignite-modules-test/src/test/java/module-info.java
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+
+module ignite_modules_test {
+ requires ignite.core;
+ requires junit;
+}
\ No newline at end of file
diff --git a/modules/dev-utils/ignite-modules-test/src/test/java/org/apache/ignite/modulestest/IgniteLaunchInModularEnvTest.java b/modules/dev-utils/ignite-modules-test/src/test/java/org/apache/ignite/modulestest/IgniteLaunchInModularEnvTest.java
new file mode 100644
index 0000000..c71ee3d
--- /dev/null
+++ b/modules/dev-utils/ignite-modules-test/src/test/java/org/apache/ignite/modulestest/IgniteLaunchInModularEnvTest.java
@@ -0,0 +1,97 @@
+/*
+ * 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.modulestest;
+
+import java.util.Collections;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.G;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import static junit.framework.TestCase.assertTrue;
+import static org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager.DFLT_STORE_DIR;
+
+/**
+ *
+ */
+public class IgniteLaunchInModularEnvTest {
+ /**
+ * Tests ignite startup without any features used.
+ */
+ @Test
+ public void testSimpleLaunch() {
+ IgniteConfiguration cfg = igniteConfiguration();
+
+ Ignite ignite = Ignition.start(cfg);
+
+ ignite.close();
+ }
+
+ @Test
+ public void testPdsEnabledSimpleLaunch() {
+ IgniteConfiguration cfg = igniteConfiguration();
+
+ DataRegionConfiguration regCfg = new DataRegionConfiguration()
+ .setMaxSize(256L * 1024 * 1024)
+ .setPersistenceEnabled(true);
+
+ cfg.setDataStorageConfiguration(
+ new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(regCfg));
+
+ Ignite ignite = Ignition.start(cfg);
+
+ ignite.cluster().active(true);
+
+ String cacheName = "CACHE";
+ ignite.getOrCreateCache(cacheName).put("key", "value");
+ ignite.close();
+ }
+
+
+ @Before
+ public void cleanPersistenceDir() throws Exception {
+ assertTrue("Grids are not stopped", F.isEmpty(G.allGrids()));
+
+ U.delete(U.resolveWorkDirectory(U.defaultWorkDirectory(), "cp", false));
+ U.delete(U.resolveWorkDirectory(U.defaultWorkDirectory(), DFLT_STORE_DIR, false));
+ U.delete(U.resolveWorkDirectory(U.defaultWorkDirectory(), "marshaller", false));
+ U.delete(U.resolveWorkDirectory(U.defaultWorkDirectory(), "binary_meta", false));
+ }
+
+ /**
+ * @return default configuration for test without spring module.
+ */
+ private IgniteConfiguration igniteConfiguration() {
+ IgniteConfiguration cfg = new IgniteConfiguration();
+
+ TcpDiscoveryVmIpFinder finder = new TcpDiscoveryVmIpFinder();
+ finder.setAddresses(Collections.singletonList("127.0.0.1"));
+ cfg.setDiscoverySpi(new TcpDiscoverySpi().setIpFinder(finder));
+ return cfg;
+ }
+}