You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by mm...@apache.org on 2022/06/02 14:23:26 UTC
[ignite] branch master updated: IGNITE-17079 Fix compatibility framework if a node is started in a dedicated JVM with incorrect classpath (#10064)
This is an automated email from the ASF dual-hosted git repository.
mmuzaf 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 1c3440d1d70 IGNITE-17079 Fix compatibility framework if a node is started in a dedicated JVM with incorrect classpath (#10064)
1c3440d1d70 is described below
commit 1c3440d1d70e870a26415b16a3f0cb9f147fb447
Author: Maxim Muzafarov <ma...@gmail.com>
AuthorDate: Thu Jun 2 17:23:17 2022 +0300
IGNITE-17079 Fix compatibility framework if a node is started in a dedicated JVM with incorrect classpath (#10064)
---
modules/compatibility/pom.xml | 7 +++++
.../testframework/junits/Dependency.java | 32 ++++++++++++----------
.../junits/IgniteCompatibilityAbstractTest.java | 12 ++++----
.../src/test/resources/compatibility.properties | 18 ++++++++++++
4 files changed, 49 insertions(+), 20 deletions(-)
diff --git a/modules/compatibility/pom.xml b/modules/compatibility/pom.xml
index 41741dcba07..3be245abd32 100644
--- a/modules/compatibility/pom.xml
+++ b/modules/compatibility/pom.xml
@@ -117,6 +117,13 @@
</dependencies>
<build>
+ <testResources>
+ <testResource>
+ <directory>src/test/resources</directory>
+ <filtering>true</filtering>
+ </testResource>
+ </testResources>
+
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
diff --git a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/Dependency.java b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/Dependency.java
index 9f99c73c9cd..10e05fc053d 100644
--- a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/Dependency.java
+++ b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/Dependency.java
@@ -17,6 +17,8 @@
package org.apache.ignite.compatibility.testframework.junits;
+import java.util.Properties;
+import org.apache.ignite.internal.IgniteProperties;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -24,8 +26,11 @@ import org.jetbrains.annotations.Nullable;
* Module dependency: Should be filtered out from current test classpath for separate JVM classpath.
*/
public class Dependency {
- /** Default value of group id. */
- private static final String DEFAULT_GROUP_ID = "org.apache.ignite";
+ /** The Apache Ignite group id required for preparing a classpath in a dedicated JVM. */
+ public static final String APACHE_IGNITE_GROUP_ID = "org.apache.ignite";
+
+ /** The project group id. */
+ private static final String PROJECT_GROUP_ID;
/** Local module name. Folder name where module is located. */
private final String locModuleName;
@@ -42,27 +47,24 @@ public class Dependency {
/** Test flag. Test jar should have {@code true} value. */
private final boolean test;
- /**
- * Creates dependency with {@link #DEFAULT_GROUP_ID} as group id.
- *
- * @param locModuleName Local module name. Folder name where module is located.
- * @param artifactId Artifact id.
- * @param test Test flag. Test jar should have {@code true} value.
- */
- public Dependency(String locModuleName, String artifactId, boolean test) {
- this(locModuleName, artifactId, null, test);
+ /** */
+ static {
+ Properties props = new Properties();
+
+ IgniteProperties.readProperties("compatibility.properties", props, true);
+
+ PROJECT_GROUP_ID = props.getProperty("ignite.groupId", APACHE_IGNITE_GROUP_ID);
}
/**
- * Creates dependency with {@link #DEFAULT_GROUP_ID} as group id.
+ * Creates dependency with {@link #PROJECT_GROUP_ID} as group id.
*
* @param locModuleName Local module name. Folder name where module is located.
* @param artifactId Artifact id.
- * @param ver Version, {@code null} means default Ignite version is to be used.
* @param test Test flag. Test jar should have {@code true} value.
*/
- public Dependency(String locModuleName, String artifactId, String ver, boolean test) {
- this(locModuleName, DEFAULT_GROUP_ID, artifactId, ver, test);
+ public Dependency(String locModuleName, String artifactId, boolean test) {
+ this(locModuleName, PROJECT_GROUP_ID, artifactId, null, test);
}
/**
diff --git a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/IgniteCompatibilityAbstractTest.java b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/IgniteCompatibilityAbstractTest.java
index 6fa43d2abec..0c60bd3f3d0 100644
--- a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/IgniteCompatibilityAbstractTest.java
+++ b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/IgniteCompatibilityAbstractTest.java
@@ -22,7 +22,6 @@ import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
-import java.util.Optional;
import java.util.Set;
import java.util.UUID;
import org.apache.ignite.Ignite;
@@ -40,6 +39,7 @@ import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.apache.ignite.testframework.junits.multijvm.IgniteProcessProxy;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import static org.apache.ignite.compatibility.testframework.junits.Dependency.APACHE_IGNITE_GROUP_ID;
/**
* Super class for all compatibility tests.
@@ -213,10 +213,12 @@ public abstract class IgniteCompatibilityAbstractTest extends GridCommonAbstract
}
for (Dependency dependency : dependencies) {
- final String artifactVer = Optional.ofNullable(dependency.version()).orElse(ver);
-
- String pathToArtifact = MavenUtils.getPathToIgniteArtifact(dependency.groupId(),
- dependency.artifactId(), artifactVer, dependency.classifier());
+ // dependency.version() == null means the default Ignite classpath is used.
+ String pathToArtifact = MavenUtils.getPathToIgniteArtifact(
+ dependency.version() == null ? APACHE_IGNITE_GROUP_ID : dependency.groupId(),
+ dependency.artifactId(),
+ dependency.version() == null ? ver : dependency.version(),
+ dependency.classifier());
pathBuilder.append(pathToArtifact).append(File.pathSeparator);
}
diff --git a/modules/compatibility/src/test/resources/compatibility.properties b/modules/compatibility/src/test/resources/compatibility.properties
new file mode 100644
index 00000000000..e668cb8f27e
--- /dev/null
+++ b/modules/compatibility/src/test/resources/compatibility.properties
@@ -0,0 +1,18 @@
+#
+# 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.
+#
+
+ignite.groupId=${project.groupId}