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 2018/04/27 18:47:18 UTC
ignite git commit: IGNITE-8156 Ignite Compatibility: common
improvements. - Fixes #3901.
Repository: ignite
Updated Branches:
refs/heads/master fcc4d4a35 -> affddcb05
IGNITE-8156 Ignite Compatibility: common improvements. - Fixes #3901.
Signed-off-by: dpavlov <dp...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/affddcb0
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/affddcb0
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/affddcb0
Branch: refs/heads/master
Commit: affddcb05bd9512eded36a86f6a4b78af703c360
Parents: fcc4d4a
Author: Vyacheslav Daradur <da...@gmail.com>
Authored: Fri Apr 27 21:43:15 2018 +0300
Committer: dpavlov <dp...@apache.org>
Committed: Fri Apr 27 21:43:15 2018 +0300
----------------------------------------------------------------------
.../DummyPersistenceCompatibilityTest.java | 376 ------------------
.../FoldersReuseCompatibilityTest.java | 33 +-
...itePersistenceCompatibilityAbstractTest.java | 65 +---
.../IgniteUuidCompatibilityTest.java | 189 ---------
...tingToWalV2SerializerWithCompactionTest.java | 9 +-
.../PersistenceBasicCompatibilityTest.java | 379 +++++++++++++++++++
.../junits/IgniteCompatibilityAbstractTest.java | 34 +-
.../junits/IgniteCompatibilityNodeRunner.java | 5 +
.../util/CompatibilityTestsUtils.java | 12 +
.../IgniteCompatibilityBasicTestSuite.java | 7 +-
10 files changed, 440 insertions(+), 669 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/affddcb0/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/DummyPersistenceCompatibilityTest.java
----------------------------------------------------------------------
diff --git a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/DummyPersistenceCompatibilityTest.java b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/DummyPersistenceCompatibilityTest.java
deleted file mode 100644
index b36f563..0000000
--- a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/DummyPersistenceCompatibilityTest.java
+++ /dev/null
@@ -1,376 +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.compatibility.persistence;
-
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.io.Serializable;
-import javax.cache.Cache;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheWriteSynchronizationMode;
-import org.apache.ignite.configuration.BinaryConfiguration;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.DataRegionConfiguration;
-import org.apache.ignite.configuration.DataStorageConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
-import org.apache.ignite.internal.IgniteEx;
-import org.apache.ignite.internal.processors.cache.GridCacheAbstractFullApiSelfTest;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.lang.IgniteInClosure;
-import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
-
-/**
- * Saves data using previous version of ignite and then load this data using actual version
- */
-public class DummyPersistenceCompatibilityTest extends IgnitePersistenceCompatibilityAbstractTest {
- /** */
- protected static final String TEST_CACHE_NAME = DummyPersistenceCompatibilityTest.class.getSimpleName();
-
- /** */
- protected volatile boolean compactFooter;
-
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- super.beforeTest();
-
- U.delete(U.resolveWorkDirectory(U.defaultWorkDirectory(), "binary_meta", false));
- }
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
-
- cfg.setPeerClassLoadingEnabled(false);
-
- cfg.setDataStorageConfiguration(
- new DataStorageConfiguration()
- .setDefaultDataRegionConfiguration(
- new DataRegionConfiguration()
- .setPersistenceEnabled(true)
- ));
-
- cfg.setBinaryConfiguration(
- new BinaryConfiguration()
- .setCompactFooter(compactFooter)
- );
-
- return cfg;
- }
-
- /**
- * Tests opportunity to read data from previous Ignite DB version.
- *
- * @throws Exception If failed.
- */
- public void testNodeStartByOldVersionPersistenceData_2_2() throws Exception {
- doTestStartupWithOldVersion("2.2.0");
- }
-
- /**
- * Tests opportunity to read data from previous Ignite DB version.
- *
- * @throws Exception If failed.
- */
- public void testNodeStartByOldVersionPersistenceData_2_1() throws Exception {
- doTestStartupWithOldVersion("2.1.0");
- }
-
- /**
- * Tests opportunity to read data from previous Ignite DB version.
- *
- * @throws Exception If failed.
- */
- public void testNodeStartByOldVersionPersistenceData_2_3() throws Exception {
- doTestStartupWithOldVersion("2.3.0");
- }
-
- /**
- * Tests opportunity to read data from previous Ignite DB version.
- *
- * @param igniteVer 3-digits version of ignite
- * @throws Exception If failed.
- */
- protected void doTestStartupWithOldVersion(String igniteVer, boolean compactFooter) throws Exception {
- boolean prev = this.compactFooter;
-
- try {
- this.compactFooter = compactFooter;
-
- startGrid(1, igniteVer, new ConfigurationClosure(compactFooter), new PostStartupClosure());
-
- stopAllGrids();
-
- IgniteEx ignite = startGrid(0);
-
- assertEquals(1, ignite.context().discovery().topologyVersion());
-
- ignite.active(true);
-
- validateResultingCacheData(ignite.cache(TEST_CACHE_NAME));
- }
- finally {
- stopAllGrids();
-
- this.compactFooter = prev;
- }
- }
-
- /**
- * Tests opportunity to read data from previous Ignite DB version.
- *
- * @param igniteVer 3-digits version of ignite
- * @throws Exception If failed.
- */
- protected void doTestStartupWithOldVersion(String igniteVer) throws Exception {
- doTestStartupWithOldVersion(igniteVer, true);
- }
-
- /**
- * @param cache to be filled by different keys and values. Results may be validated in {@link
- * #validateResultingCacheData(Cache)}.
- */
- public static void saveCacheData(Cache<Object, Object> cache) {
- for (int i = 0; i < 10; i++)
- cache.put(i, "data" + i);
-
- cache.put("1", "2");
- cache.put(12, 2);
- cache.put(13L, 2L);
- cache.put(TestEnum.A, "Enum_As_Key");
- cache.put("Enum_As_Value", TestEnum.B);
- cache.put(TestEnum.C, TestEnum.C);
- cache.put("Serializable", new TestSerializable(42));
- cache.put(new TestSerializable(42), "Serializable_As_Key");
- cache.put("Externalizable", new TestExternalizable(42));
- cache.put(new TestExternalizable(42), "Externalizable_As_Key");
- cache.put("testStringContainer", new TestStringContainerToBePrinted("testStringContainer"));
- }
-
- /**
- * Asserts cache contained all expected values as it was saved before.
- * @param cache cache should be filled using {@link #saveCacheData(Cache)}.
- */
- public static void validateResultingCacheData(Cache<Object, Object> cache) {
- for (int i = 0; i < 10; i++)
- assertEquals(cache.get(i), "data" + i);
-
- assertEquals("2", cache.get("1"));
- assertEquals(2, cache.get(12));
- assertEquals(2L, cache.get(13L));
- assertEquals("Enum_As_Key", cache.get(TestEnum.A));
- assertEquals(TestEnum.B, cache.get("Enum_As_Value"));
- assertEquals(TestEnum.C, cache.get(TestEnum.C));
- assertEquals(new TestSerializable(42), cache.get("Serializable"));
- assertEquals("Serializable_As_Key", cache.get(new TestSerializable(42)));
- assertEquals(new TestExternalizable(42), cache.get("Externalizable"));
- assertEquals("Externalizable_As_Key", cache.get(new TestExternalizable(42)));
- assertEquals(new TestStringContainerToBePrinted("testStringContainer"), cache.get("testStringContainer"));
- }
-
- /** */
- public static class PostStartupClosure implements IgniteInClosure<Ignite> {
- /** {@inheritDoc} */
- @Override public void apply(Ignite ignite) {
- ignite.active(true);
-
- CacheConfiguration<Object, Object> cacheCfg = new CacheConfiguration<>();
- cacheCfg.setName(TEST_CACHE_NAME);
- cacheCfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
- cacheCfg.setBackups(1);
- cacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
-
- IgniteCache<Object, Object> cache = ignite.createCache(cacheCfg);
-
- saveCacheData(cache);
- }
- }
-
- /** */
- public static class ConfigurationClosure implements IgniteInClosure<IgniteConfiguration> {
- private boolean compactFooter;
-
- public ConfigurationClosure(boolean compactFooter) {
- this.compactFooter = compactFooter;
- }
-
- /** {@inheritDoc} */
- @Override public void apply(IgniteConfiguration cfg) {
- cfg.setLocalHost("127.0.0.1");
-
- TcpDiscoverySpi disco = new TcpDiscoverySpi();
- disco.setIpFinder(GridCacheAbstractFullApiSelfTest.LOCAL_IP_FINDER);
-
- cfg.setDiscoverySpi(disco);
-
- cfg.setPeerClassLoadingEnabled(false);
-
- cfg.setPersistentStoreConfiguration(new PersistentStoreConfiguration());
-
- if (!compactFooter)
- cfg.setBinaryConfiguration(new BinaryConfiguration().setCompactFooter(compactFooter));
- }
- }
-
- /** Enum for cover binaryObject enum save/load. */
- public enum TestEnum {
- /** */A, /** */B, /** */C
- }
-
- /** Special class to test WAL reader resistance to Serializable interface. */
- static class TestSerializable implements Serializable {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** I value. */
- private int iVal;
-
- /**
- * Creates test object
- *
- * @param iVal I value.
- */
- TestSerializable(int iVal) {
- this.iVal = iVal;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return "TestSerializable{" +
- "iVal=" + iVal +
- '}';
- }
-
- /** {@inheritDoc} */
- @Override public boolean equals(Object o) {
- if (this == o)
- return true;
- if (o == null || getClass() != o.getClass())
- return false;
-
- TestSerializable that = (TestSerializable)o;
-
- return iVal == that.iVal;
- }
-
- /** {@inheritDoc} */
- @Override public int hashCode() {
- return iVal;
- }
- }
-
- /** Special class to test WAL reader resistance to Serializable interface. */
- static class TestExternalizable implements Externalizable {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** I value. */
- private int iVal;
-
- /** Noop ctor for unmarshalling */
- public TestExternalizable() {
-
- }
-
- /**
- * Creates test object with provided value.
- *
- * @param iVal I value.
- */
- public TestExternalizable(int iVal) {
- this.iVal = iVal;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return "TestExternalizable{" +
- "iVal=" + iVal +
- '}';
- }
-
- /** {@inheritDoc} */
- @Override public void writeExternal(ObjectOutput out) throws IOException {
- out.writeInt(iVal);
- }
-
- /** {@inheritDoc} */
- @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- iVal = in.readInt();
- }
-
- /** {@inheritDoc} */
- @Override public boolean equals(Object o) {
- if (this == o)
- return true;
- if (o == null || getClass() != o.getClass())
- return false;
-
- TestExternalizable that = (TestExternalizable)o;
-
- return iVal == that.iVal;
- }
-
- /** {@inheritDoc} */
- @Override public int hashCode() {
- return iVal;
- }
- }
-
- /** Container class to test toString of data records. */
- static class TestStringContainerToBePrinted {
- /** */
- String data;
-
- /**
- * Creates container.
- *
- * @param data value to be searched in to String.
- */
- public TestStringContainerToBePrinted(String data) {
- this.data = data;
- }
-
- /** {@inheritDoc} */
- @Override public boolean equals(Object o) {
- if (this == o)
- return true;
- if (o == null || getClass() != o.getClass())
- return false;
-
- TestStringContainerToBePrinted printed = (TestStringContainerToBePrinted)o;
-
- return data != null ? data.equals(printed.data) : printed.data == null;
- }
-
- /** {@inheritDoc} */
- @Override public int hashCode() {
- return data != null ? data.hashCode() : 0;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return "TestStringContainerToBePrinted{" +
- "data='" + data + '\'' +
- '}';
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/affddcb0/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/FoldersReuseCompatibilityTest.java
----------------------------------------------------------------------
diff --git a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/FoldersReuseCompatibilityTest.java b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/FoldersReuseCompatibilityTest.java
index 5a64381..69eecb1 100644
--- a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/FoldersReuseCompatibilityTest.java
+++ b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/FoldersReuseCompatibilityTest.java
@@ -56,19 +56,6 @@ public class FoldersReuseCompatibilityTest extends IgnitePersistenceCompatibilit
private static final String KEY_OBJ = "ObjectFromPrevVersion";
/** {@inheritDoc} */
- @Override protected void afterTest() throws Exception {
- // No-op. super.afterTest();
- stopAllGrids();
- }
-
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- super.beforeTest();
-
- U.delete(U.resolveWorkDirectory(U.defaultWorkDirectory(), "binary_meta", false));
- }
-
- /** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
final IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
@@ -129,7 +116,7 @@ public class FoldersReuseCompatibilityTest extends IgnitePersistenceCompatibilit
assertEquals(VAL, ignite.cache(CACHE_NAME).get(KEY));
- final DummyPersistenceCompatibilityTest.TestStringContainerToBePrinted actual = (DummyPersistenceCompatibilityTest.TestStringContainerToBePrinted)ignite.cache(CACHE_NAME).get(KEY_OBJ);
+ final PersistenceBasicCompatibilityTest.TestStringContainerToBePrinted actual = (PersistenceBasicCompatibilityTest.TestStringContainerToBePrinted)ignite.cache(CACHE_NAME).get(KEY_OBJ);
assertEquals(VAL, actual.data);
assertNodeIndexesInFolder();// should not create any new style directories
@@ -148,15 +135,15 @@ public class FoldersReuseCompatibilityTest extends IgnitePersistenceCompatibilit
cache.put("1", "2");
cache.put(1, 2);
cache.put(1L, 2L);
- cache.put(DummyPersistenceCompatibilityTest.TestEnum.A, "Enum_As_Key");
- cache.put("Enum_As_Value", DummyPersistenceCompatibilityTest.TestEnum.B);
- cache.put(DummyPersistenceCompatibilityTest.TestEnum.C, DummyPersistenceCompatibilityTest.TestEnum.C);
-
- cache.put("Serializable", new DummyPersistenceCompatibilityTest.TestSerializable(42));
- cache.put(new DummyPersistenceCompatibilityTest.TestSerializable(42), "Serializable_As_Key");
- cache.put("Externalizable", new DummyPersistenceCompatibilityTest.TestExternalizable(42));
- cache.put(new DummyPersistenceCompatibilityTest.TestExternalizable(42), "Externalizable_As_Key");
- cache.put(KEY_OBJ, new DummyPersistenceCompatibilityTest.TestStringContainerToBePrinted(VAL));
+ cache.put(PersistenceBasicCompatibilityTest.TestEnum.A, "Enum_As_Key");
+ cache.put("Enum_As_Value", PersistenceBasicCompatibilityTest.TestEnum.B);
+ cache.put(PersistenceBasicCompatibilityTest.TestEnum.C, PersistenceBasicCompatibilityTest.TestEnum.C);
+
+ cache.put("Serializable", new PersistenceBasicCompatibilityTest.TestSerializable(42));
+ cache.put(new PersistenceBasicCompatibilityTest.TestSerializable(42), "Serializable_As_Key");
+ cache.put("Externalizable", new PersistenceBasicCompatibilityTest.TestExternalizable(42));
+ cache.put(new PersistenceBasicCompatibilityTest.TestExternalizable(42), "Externalizable_As_Key");
+ cache.put(KEY_OBJ, new PersistenceBasicCompatibilityTest.TestStringContainerToBePrinted(VAL));
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/affddcb0/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/IgnitePersistenceCompatibilityAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/IgnitePersistenceCompatibilityAbstractTest.java b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/IgnitePersistenceCompatibilityAbstractTest.java
index f39b6f6..b08f6f7 100644
--- a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/IgnitePersistenceCompatibilityAbstractTest.java
+++ b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/IgnitePersistenceCompatibilityAbstractTest.java
@@ -18,27 +18,34 @@
package org.apache.ignite.compatibility.persistence;
import java.io.File;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import org.apache.ignite.IgniteCheckedException;
+import java.util.Arrays;
+import java.util.List;
import org.apache.ignite.compatibility.testframework.junits.IgniteCompatibilityAbstractTest;
+import org.apache.ignite.compatibility.testframework.util.CompatibilityTestsUtils;
import org.apache.ignite.internal.util.typedef.internal.U;
import static org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager.DFLT_STORE_DIR;
+import static org.apache.ignite.internal.processors.cache.persistence.wal.reader.StandaloneGridKernalContext.BINARY_META_FOLDER;
/**
* Super class for all persistence compatibility tests.
*/
public abstract class IgnitePersistenceCompatibilityAbstractTest extends IgniteCompatibilityAbstractTest {
+ /** Persistence directories. */
+ private static final List<String> PERSISTENCE_DIRS = Arrays.asList(DFLT_STORE_DIR, BINARY_META_FOLDER, "cp", "marshaller");
+
/** {@inheritDoc} */
@Override protected void beforeTest() throws Exception {
super.beforeTest();
- if (!isDefaultDBWorkDirectoryEmpty())
- deleteDefaultDBWorkDirectory();
+ for (String dirName : PERSISTENCE_DIRS) {
+ File dir = U.resolveWorkDirectory(U.defaultWorkDirectory(), dirName, true);
- assert isDefaultDBWorkDirectoryEmpty() : "DB work directory is not empty.";
+ if (!CompatibilityTestsUtils.isDirectoryEmpty(dir)) {
+ throw new IllegalStateException("Directory is not empty and can't be cleaned: " +
+ "[" + dir.getAbsolutePath() + "]. It may be locked by another system process.");
+ }
+ }
}
/** {@inheritDoc} */
@@ -48,47 +55,7 @@ public abstract class IgnitePersistenceCompatibilityAbstractTest extends IgniteC
//protection if test failed to finish, e.g. by error
stopAllGrids();
- assert deleteDefaultDBWorkDirectory() : "Couldn't delete DB work directory.";
- }
-
- /**
- * Gets a path to the default DB working directory.
- *
- * @return Path to the default DB working directory.
- * @throws IgniteCheckedException In case of an error.
- * @see #deleteDefaultDBWorkDirectory()
- * @see #isDefaultDBWorkDirectoryEmpty()
- */
- protected Path getDefaultDbWorkPath() throws IgniteCheckedException {
- return Paths.get(U.defaultWorkDirectory() + File.separator + DFLT_STORE_DIR);
- }
-
- /**
- * Deletes the default DB working directory with all sub-directories and files.
- *
- * @return {@code true} if and only if the file or directory is successfully deleted, otherwise {@code false}.
- * @throws IgniteCheckedException In case of an error.
- * @see #getDefaultDbWorkPath()
- * @see #deleteDefaultDBWorkDirectory()
- */
- protected boolean deleteDefaultDBWorkDirectory() throws IgniteCheckedException {
- Path dir = getDefaultDbWorkPath();
-
- return Files.notExists(dir) || U.delete(dir.toFile());
- }
-
- /**
- * Checks if the default DB working directory is empty.
- *
- * @return {@code true} if the default DB working directory is empty or doesn't exist, otherwise {@code false}.
- * @throws IgniteCheckedException In case of an error.
- * @see #getDefaultDbWorkPath()
- * @see #deleteDefaultDBWorkDirectory()
- */
- @SuppressWarnings("ConstantConditions")
- protected boolean isDefaultDBWorkDirectoryEmpty() throws IgniteCheckedException {
- File dir = getDefaultDbWorkPath().toFile();
-
- return !dir.exists() || (dir.isDirectory() && dir.list().length == 0);
+ for (String dir : PERSISTENCE_DIRS)
+ U.delete(U.resolveWorkDirectory(U.defaultWorkDirectory(), dir, false));
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/affddcb0/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/IgniteUuidCompatibilityTest.java
----------------------------------------------------------------------
diff --git a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/IgniteUuidCompatibilityTest.java b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/IgniteUuidCompatibilityTest.java
deleted file mode 100644
index 88c6900..0000000
--- a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/IgniteUuidCompatibilityTest.java
+++ /dev/null
@@ -1,189 +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.compatibility.persistence;
-
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-import javax.cache.Cache;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CachePeekMode;
-import org.apache.ignite.cache.CacheWriteSynchronizationMode;
-import org.apache.ignite.configuration.BinaryConfiguration;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.DataRegionConfiguration;
-import org.apache.ignite.configuration.DataStorageConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
-import org.apache.ignite.internal.IgniteEx;
-import org.apache.ignite.internal.binary.BinaryContext;
-import org.apache.ignite.internal.processors.cache.GridCacheAbstractFullApiSelfTest;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.lang.IgniteInClosure;
-import org.apache.ignite.lang.IgniteUuid;
-import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
-
-/**
- * Checks that index and caches with IgniteUuid are compatible when IgniteUuid becomes predefined type.
- *
- * @see BinaryContext#registerPredefinedType(Class, int)
- */
-public class IgniteUuidCompatibilityTest extends IgnitePersistenceCompatibilityAbstractTest {
- /** */
- protected static final String TEST_CACHE_NAME = IgniteUuidCompatibilityTest.class.getSimpleName();
-
- /** */
- protected volatile boolean compactFooter;
-
- /** */
- private static Set<String> VALUES = new HashSet<>(Arrays.asList("one", "two", "three"));
-
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- super.beforeTest();
-
- U.delete(U.resolveWorkDirectory(U.defaultWorkDirectory(), "binary_meta", false));
- }
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
-
- cfg.setPeerClassLoadingEnabled(false);
-
- cfg.setDataStorageConfiguration(
- new DataStorageConfiguration()
- .setDefaultDataRegionConfiguration(
- new DataRegionConfiguration()
- .setPersistenceEnabled(true)
- ));
-
- cfg.setBinaryConfiguration(
- new BinaryConfiguration()
- .setCompactFooter(compactFooter)
- );
-
- return cfg;
- }
-
- /**
- * Tests opportunity to read data from previous Ignite DB version for cache contains IgniteUuid instances.
- *
- * @throws Exception If failed.
- */
- public void testIgniteUuid_2_3() throws Exception {
- doTestIgniteUuidCompatibility("2.3.0", false);
- }
-
- /**
- * Tests opportunity to read data from previous Ignite DB version for cache contains IgniteUuid instances.
- *
- * @throws Exception If failed.
- */
- public void testIgniteUuidWithCompactFooter_2_3() throws Exception {
- doTestIgniteUuidCompatibility("2.3.0", true);
- }
-
- /**
- * Tests opportunity to read data from previous Ignite DB version.
- *
- * @param igniteVer 3-digits version of ignite
- * @throws Exception If failed.
- */
- private void doTestIgniteUuidCompatibility(String igniteVer, boolean compactFooter) throws Exception {
- boolean prev = this.compactFooter;
-
- try {
- this.compactFooter = compactFooter;
-
- startGrid(1, igniteVer, new ConfigurationClosure(compactFooter), new PutData());
-
- stopAllGrids();
-
- IgniteEx ignite = startGrid(0);
-
- assertEquals(1, ignite.context().discovery().topologyVersion());
-
- ignite.active(true);
-
- IgniteCache<IgniteUuid, String> cache = ignite.cache(TEST_CACHE_NAME);
-
- assertEquals(cache.size(CachePeekMode.ALL), VALUES.size());
-
- Set<String> values = new HashSet<>();
-
- for (Cache.Entry<IgniteUuid, String> e : cache)
- values.add(e.getValue());
-
- assertEquals(values, VALUES);
- }
- finally {
- stopAllGrids();
-
- this.compactFooter = prev;
- }
- }
-
- /** */
- public static class ConfigurationClosure implements IgniteInClosure<IgniteConfiguration> {
- private boolean compactFooter;
-
- public ConfigurationClosure(boolean compactFooter) {
- this.compactFooter = compactFooter;
- }
-
- /** {@inheritDoc} */
- @Override public void apply(IgniteConfiguration cfg) {
- cfg.setLocalHost("127.0.0.1");
-
- TcpDiscoverySpi disco = new TcpDiscoverySpi();
- disco.setIpFinder(GridCacheAbstractFullApiSelfTest.LOCAL_IP_FINDER);
-
- cfg.setDiscoverySpi(disco);
-
- cfg.setPeerClassLoadingEnabled(false);
-
- cfg.setPersistentStoreConfiguration(new PersistentStoreConfiguration());
-
- if (!compactFooter)
- cfg.setBinaryConfiguration(new BinaryConfiguration().setCompactFooter(compactFooter));
- }
- }
-
- /** */
- public static class PutData implements IgniteInClosure<Ignite> {
- /** {@inheritDoc} */
- @Override public void apply(Ignite ignite) {
- ignite.active(true);
-
- CacheConfiguration<IgniteUuid, String> cacheCfg = new CacheConfiguration<>();
-
- cacheCfg.setName(TEST_CACHE_NAME);
- cacheCfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
- cacheCfg.setBackups(1);
- cacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
-
- IgniteCache<IgniteUuid, String> cache = ignite.createCache(cacheCfg);
-
- for (String v : VALUES)
- cache.put(IgniteUuid.randomUuid(), v);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/affddcb0/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/MigratingToWalV2SerializerWithCompactionTest.java
----------------------------------------------------------------------
diff --git a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/MigratingToWalV2SerializerWithCompactionTest.java b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/MigratingToWalV2SerializerWithCompactionTest.java
index d79790e..c9f572f 100644
--- a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/MigratingToWalV2SerializerWithCompactionTest.java
+++ b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/MigratingToWalV2SerializerWithCompactionTest.java
@@ -40,7 +40,7 @@ import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
*/
public class MigratingToWalV2SerializerWithCompactionTest extends IgnitePersistenceCompatibilityAbstractTest {
/** */
- private static final String TEST_CACHE_NAME = DummyPersistenceCompatibilityTest.class.getSimpleName();
+ private static final String TEST_CACHE_NAME = MigratingToWalV2SerializerWithCompactionTest.class.getSimpleName();
/** Entries count. */
private static final int ENTRIES = 300;
@@ -52,13 +52,6 @@ public class MigratingToWalV2SerializerWithCompactionTest extends IgnitePersiste
private static final int PAYLOAD_SIZE = 20000;
/** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- super.beforeTest();
-
- U.delete(U.resolveWorkDirectory(U.defaultWorkDirectory(), "binary_meta", false));
- }
-
- /** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
http://git-wip-us.apache.org/repos/asf/ignite/blob/affddcb0/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/PersistenceBasicCompatibilityTest.java
----------------------------------------------------------------------
diff --git a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/PersistenceBasicCompatibilityTest.java b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/PersistenceBasicCompatibilityTest.java
new file mode 100644
index 0000000..af14b04
--- /dev/null
+++ b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/PersistenceBasicCompatibilityTest.java
@@ -0,0 +1,379 @@
+/*
+ * 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.compatibility.persistence;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.io.Serializable;
+import java.util.UUID;
+import javax.cache.Cache;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.configuration.BinaryConfiguration;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.PersistentStoreConfiguration;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.processors.cache.GridCacheAbstractFullApiSelfTest;
+import org.apache.ignite.lang.IgniteInClosure;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+
+/**
+ * Saves data using previous version of ignite and then load this data using actual version.
+ */
+public class PersistenceBasicCompatibilityTest extends IgnitePersistenceCompatibilityAbstractTest {
+ /** */
+ protected static final String TEST_CACHE_NAME = PersistenceBasicCompatibilityTest.class.getSimpleName();
+
+ /** */
+ protected volatile boolean compactFooter;
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
+
+ cfg.setPeerClassLoadingEnabled(false);
+
+ cfg.setDataStorageConfiguration(
+ new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration()
+ .setPersistenceEnabled(true)
+ ));
+
+ cfg.setBinaryConfiguration(
+ new BinaryConfiguration()
+ .setCompactFooter(compactFooter)
+ );
+
+ return cfg;
+ }
+
+ /**
+ * Tests opportunity to read data from previous Ignite DB version.
+ *
+ * @throws Exception If failed.
+ */
+ public void testNodeStartByOldVersionPersistenceData_2_2() throws Exception {
+ doTestStartupWithOldVersion("2.2.0");
+ }
+
+ /**
+ * Tests opportunity to read data from previous Ignite DB version.
+ *
+ * @throws Exception If failed.
+ */
+ public void testNodeStartByOldVersionPersistenceData_2_1() throws Exception {
+ doTestStartupWithOldVersion("2.1.0");
+ }
+
+ /**
+ * Tests opportunity to read data from previous Ignite DB version.
+ *
+ * @throws Exception If failed.
+ */
+ public void testNodeStartByOldVersionPersistenceData_2_3() throws Exception {
+ doTestStartupWithOldVersion("2.3.0");
+ }
+
+ /**
+ * Tests opportunity to read data from previous Ignite DB version.
+ *
+ * @param igniteVer 3-digits version of ignite
+ * @throws Exception If failed.
+ */
+ protected void doTestStartupWithOldVersion(String igniteVer, boolean compactFooter) throws Exception {
+ boolean prev = this.compactFooter;
+
+ try {
+ this.compactFooter = compactFooter;
+
+ startGrid(1, igniteVer, new ConfigurationClosure(compactFooter), new PostStartupClosure());
+
+ stopAllGrids();
+
+ IgniteEx ignite = startGrid(0);
+
+ assertEquals(1, ignite.context().discovery().topologyVersion());
+
+ ignite.active(true);
+
+ validateResultingCacheData(ignite.cache(TEST_CACHE_NAME));
+ }
+ finally {
+ stopAllGrids();
+
+ this.compactFooter = prev;
+ }
+ }
+
+ /**
+ * Tests opportunity to read data from previous Ignite DB version.
+ *
+ * @param igniteVer 3-digits version of ignite
+ * @throws Exception If failed.
+ */
+ protected void doTestStartupWithOldVersion(String igniteVer) throws Exception {
+ doTestStartupWithOldVersion(igniteVer, true);
+ }
+
+ /**
+ * @param cache to be filled by different keys and values. Results may be validated in {@link
+ * #validateResultingCacheData(Cache)}.
+ */
+ public static void saveCacheData(Cache<Object, Object> cache) {
+ for (int i = 0; i < 10; i++)
+ cache.put(i, "data" + i);
+
+ cache.put("1", "2");
+ cache.put(12, 2);
+ cache.put(13L, 2L);
+ cache.put(TestEnum.A, "Enum_As_Key");
+ cache.put("Enum_As_Value", TestEnum.B);
+ cache.put(TestEnum.C, TestEnum.C);
+ cache.put("Serializable", new TestSerializable(42));
+ cache.put(new TestSerializable(42), "Serializable_As_Key");
+ cache.put("Externalizable", new TestExternalizable(42));
+ cache.put(new TestExternalizable(42), "Externalizable_As_Key");
+ cache.put("testStringContainer", new TestStringContainerToBePrinted("testStringContainer"));
+ cache.put(UUID.fromString("DA9E0049-468C-4680-BF85-D5379164FDCC"),
+ UUID.fromString("B851B870-3BA7-4E5F-BDB8-458B42300000"));
+ }
+
+ /**
+ * Asserts cache contained all expected values as it was saved before.
+ *
+ * @param cache Cache should be filled using {@link #saveCacheData(Cache)}.
+ */
+ public static void validateResultingCacheData(Cache<Object, Object> cache) {
+ assertNotNull(cache);
+
+ for (int i = 0; i < 10; i++)
+ assertEquals("data" + i, cache.get(i));
+
+ assertEquals("2", cache.get("1"));
+ assertEquals(2, cache.get(12));
+ assertEquals(2L, cache.get(13L));
+ assertEquals("Enum_As_Key", cache.get(TestEnum.A));
+ assertEquals(TestEnum.B, cache.get("Enum_As_Value"));
+ assertEquals(TestEnum.C, cache.get(TestEnum.C));
+ assertEquals(new TestSerializable(42), cache.get("Serializable"));
+ assertEquals("Serializable_As_Key", cache.get(new TestSerializable(42)));
+ assertEquals(new TestExternalizable(42), cache.get("Externalizable"));
+ assertEquals("Externalizable_As_Key", cache.get(new TestExternalizable(42)));
+ assertEquals(new TestStringContainerToBePrinted("testStringContainer"), cache.get("testStringContainer"));
+ assertEquals(UUID.fromString("B851B870-3BA7-4E5F-BDB8-458B42300000"),
+ cache.get(UUID.fromString("DA9E0049-468C-4680-BF85-D5379164FDCC")));
+ }
+
+ /** */
+ public static class PostStartupClosure implements IgniteInClosure<Ignite> {
+ /** {@inheritDoc} */
+ @Override public void apply(Ignite ignite) {
+ ignite.active(true);
+
+ CacheConfiguration<Object, Object> cacheCfg = new CacheConfiguration<>();
+ cacheCfg.setName(TEST_CACHE_NAME);
+ cacheCfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
+ cacheCfg.setBackups(1);
+ cacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
+
+ IgniteCache<Object, Object> cache = ignite.createCache(cacheCfg);
+
+ saveCacheData(cache);
+ }
+ }
+
+ /** */
+ public static class ConfigurationClosure implements IgniteInClosure<IgniteConfiguration> {
+ /** Compact footer. */
+ private boolean compactFooter;
+
+ /**
+ * @param compactFooter Compact footer.
+ */
+ public ConfigurationClosure(boolean compactFooter) {
+ this.compactFooter = compactFooter;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void apply(IgniteConfiguration cfg) {
+ cfg.setLocalHost("127.0.0.1");
+
+ TcpDiscoverySpi disco = new TcpDiscoverySpi();
+ disco.setIpFinder(GridCacheAbstractFullApiSelfTest.LOCAL_IP_FINDER);
+
+ cfg.setDiscoverySpi(disco);
+
+ cfg.setPeerClassLoadingEnabled(false);
+
+ cfg.setPersistentStoreConfiguration(new PersistentStoreConfiguration());
+
+ cfg.setBinaryConfiguration(new BinaryConfiguration().setCompactFooter(compactFooter));
+ }
+ }
+
+ /** Enum for cover binaryObject enum save/load. */
+ public enum TestEnum {
+ /** */A, /** */B, /** */C
+ }
+
+ /** Special class to test WAL reader resistance to Serializable interface. */
+ static class TestSerializable implements Serializable {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** I value. */
+ private int iVal;
+
+ /**
+ * Creates test object
+ *
+ * @param iVal I value.
+ */
+ TestSerializable(int iVal) {
+ this.iVal = iVal;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return "TestSerializable{" +
+ "iVal=" + iVal +
+ '}';
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+
+ TestSerializable that = (TestSerializable)o;
+
+ return iVal == that.iVal;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ return iVal;
+ }
+ }
+
+ /** Special class to test WAL reader resistance to Serializable interface. */
+ static class TestExternalizable implements Externalizable {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** I value. */
+ private int iVal;
+
+ /** Noop ctor for unmarshalling */
+ public TestExternalizable() {
+
+ }
+
+ /**
+ * Creates test object with provided value.
+ *
+ * @param iVal I value.
+ */
+ public TestExternalizable(int iVal) {
+ this.iVal = iVal;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return "TestExternalizable{" +
+ "iVal=" + iVal +
+ '}';
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeExternal(ObjectOutput out) throws IOException {
+ out.writeInt(iVal);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ iVal = in.readInt();
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+
+ TestExternalizable that = (TestExternalizable)o;
+
+ return iVal == that.iVal;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ return iVal;
+ }
+ }
+
+ /** Container class to test toString of data records. */
+ static class TestStringContainerToBePrinted {
+ /** */
+ String data;
+
+ /**
+ * Creates container.
+ *
+ * @param data value to be searched in to String.
+ */
+ public TestStringContainerToBePrinted(String data) {
+ this.data = data;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+
+ TestStringContainerToBePrinted printed = (TestStringContainerToBePrinted)o;
+
+ return data != null ? data.equals(printed.data) : printed.data == null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ return data != null ? data.hashCode() : 0;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return "TestStringContainerToBePrinted{" +
+ "data='" + data + '\'' +
+ '}';
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/affddcb0/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/IgniteCompatibilityAbstractTest.java
----------------------------------------------------------------------
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 f1aceb5..2301717 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
@@ -21,9 +21,11 @@ import java.io.File;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Set;
import java.util.UUID;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.compatibility.testframework.junits.logger.ListenedGridTestLog4jLogger;
@@ -164,31 +166,25 @@ public abstract class IgniteCompatibilityAbstractTest extends GridCommonAbstract
filteredJvmArgs.add(arg);
}
- ClassLoader ldr = CLASS_LOADER;
-
final Collection<Dependency> dependencies = getDependencies(ver);
+ Set<String> excluded = dependencies.stream().map(Dependency::localPathTemplate).collect(Collectors.toSet());
+
StringBuilder pathBuilder = new StringBuilder();
- for (URL url : CompatibilityTestsUtils.classLoaderUrls(ldr)) {
+ for (URL url : CompatibilityTestsUtils.classLoaderUrls(CLASS_LOADER)) {
String path = url.getPath();
- boolean excluded = false;
- for (Dependency next : dependencies) {
- if (path.contains(next.localPathTemplate())) {
- excluded = true;
- break;
- }
- }
- if (!excluded)
+ if (excluded.stream().noneMatch(path::contains))
pathBuilder.append(path).append(File.pathSeparator);
}
- for (Dependency next : dependencies) {
- final String artifactVer = next.version() != null ? next.version() : ver;
- final String grpName = next.groupName() != null ? next.groupName() : "org.apache.ignite";
- String pathToArtifact = MavenUtils.getPathToIgniteArtifact(grpName, next.artifactName(),
- artifactVer, next.classifier());
+ for (Dependency dependency : dependencies) {
+ final String artifactVer = dependency.version() != null ? dependency.version() : ver;
+ final String grpName = dependency.groupName() != null ? dependency.groupName() : "org.apache.ignite";
+
+ String pathToArtifact = MavenUtils.getPathToIgniteArtifact(grpName, dependency.artifactName(),
+ artifactVer, dependency.classifier());
pathBuilder.append(pathToArtifact).append(File.pathSeparator);
}
@@ -196,7 +192,7 @@ public abstract class IgniteCompatibilityAbstractTest extends GridCommonAbstract
filteredJvmArgs.add("-cp");
filteredJvmArgs.add(pathBuilder.toString());
- final Collection<String> jvmParms = getJvmParms();
+ final Collection<String> jvmParms = getJvmParams();
if (jvmParms != null)
filteredJvmArgs.addAll(jvmParms);
@@ -255,7 +251,7 @@ public abstract class IgniteCompatibilityAbstractTest extends GridCommonAbstract
*
* @return additional JVM arguments
*/
- protected Collection<String> getJvmParms() {
+ protected Collection<String> getJvmParams() {
return new ArrayList<>();
}
@@ -327,4 +323,4 @@ public abstract class IgniteCompatibilityAbstractTest extends GridCommonAbstract
nodeJoinedLatch.countDown();
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/affddcb0/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/IgniteCompatibilityNodeRunner.java
----------------------------------------------------------------------
diff --git a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/IgniteCompatibilityNodeRunner.java b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/IgniteCompatibilityNodeRunner.java
index 2ad5544..165cb4c 100644
--- a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/IgniteCompatibilityNodeRunner.java
+++ b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/IgniteCompatibilityNodeRunner.java
@@ -106,12 +106,16 @@ public class IgniteCompatibilityNodeRunner extends IgniteNodeRunner {
}
X.println(IgniteCompatibilityAbstractTest.SYNCHRONIZATION_LOG_MESSAGE + nodeId);
+
watchdog.interrupt();
}
catch (Throwable e) {
e.printStackTrace();
+
X.println("Dumping classpath, error occurred: " + e);
+
dumpClasspath();
+
throw e;
}
}
@@ -147,6 +151,7 @@ public class IgniteCompatibilityNodeRunner extends IgniteNodeRunner {
};
final Thread thread = new Thread(target);
+
thread.setDaemon(true);
thread.start();
http://git-wip-us.apache.org/repos/asf/ignite/blob/affddcb0/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/util/CompatibilityTestsUtils.java
----------------------------------------------------------------------
diff --git a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/util/CompatibilityTestsUtils.java b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/util/CompatibilityTestsUtils.java
index ce48ff8..5e6be51 100644
--- a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/util/CompatibilityTestsUtils.java
+++ b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/util/CompatibilityTestsUtils.java
@@ -17,6 +17,7 @@
package org.apache.ignite.compatibility.testframework.util;
+import java.io.File;
import java.lang.reflect.Field;
import java.net.URL;
import java.net.URLClassLoader;
@@ -90,4 +91,15 @@ public class CompatibilityTestsUtils {
return null;
}
}
+
+ /**
+ * Checks if the given directory is empty.
+ *
+ * @param dir Directory to check.
+ * @return {@code true} if the given directory is empty or doesn't exist, otherwise {@code false}.
+ */
+ @SuppressWarnings("ConstantConditions")
+ public static boolean isDirectoryEmpty(File dir) {
+ return !dir.exists() || (dir.isDirectory() && dir.list().length == 0);
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/affddcb0/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testsuites/IgniteCompatibilityBasicTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testsuites/IgniteCompatibilityBasicTestSuite.java b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testsuites/IgniteCompatibilityBasicTestSuite.java
index eaa38af..b526137 100644
--- a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testsuites/IgniteCompatibilityBasicTestSuite.java
+++ b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testsuites/IgniteCompatibilityBasicTestSuite.java
@@ -18,10 +18,9 @@
package org.apache.ignite.compatibility.testsuites;
import junit.framework.TestSuite;
-import org.apache.ignite.compatibility.persistence.DummyPersistenceCompatibilityTest;
import org.apache.ignite.compatibility.persistence.FoldersReuseCompatibilityTest;
-import org.apache.ignite.compatibility.persistence.IgniteUuidCompatibilityTest;
import org.apache.ignite.compatibility.persistence.MigratingToWalV2SerializerWithCompactionTest;
+import org.apache.ignite.compatibility.persistence.PersistenceBasicCompatibilityTest;
/**
* Compatibility tests basic test suite.
@@ -34,14 +33,12 @@ public class IgniteCompatibilityBasicTestSuite {
public static TestSuite suite() throws Exception {
TestSuite suite = new TestSuite("Ignite Compatibility Basic Test Suite");
- suite.addTestSuite(DummyPersistenceCompatibilityTest.class);
+ suite.addTestSuite(PersistenceBasicCompatibilityTest.class);
suite.addTestSuite(FoldersReuseCompatibilityTest.class);
suite.addTestSuite(MigratingToWalV2SerializerWithCompactionTest.class);
- suite.addTestSuite(IgniteUuidCompatibilityTest.class);
-
return suite;
}
}